akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
using namespace std;

struct Card {
  char suit;
  char value;
};

void print(const vector<Card>& A) {
  for(int i = 0; i < A.size(); i++) {
    if (i > 0) {
      cout << " ";
    }
    cout << A[i].suit << A[i].value;
  }
  cout << endl;
}

void bubbleSort(vector<Card>& A) {

  for (int i = 0; i < A.size(); i++) {
    for (int j = A.size() - 1; j >= i + 1; j--) {
      if (A[j].value < A[j-1].value) {
        swap(A[j], A[j-1]);
      }
    }
  }
}

void selectionSort(vector<Card>& A) {
  for (int i = 0; i < A.size() - 1; i++) {
    int minj = i;
    for (int j = i; j < A.size(); j++) {
      if (A[j].value < A[minj].value) {
        minj = j;
      }
    }
    swap(A[i], A[minj]);
  }
}

bool isStable(vector<Card>& C1, vector<Card>& C2, int N) {
  for (int i = 0; i < N; i++) {
    if (C1[i].suit != C2[i].suit) {
      return false;
    }
  }
  return true;
}

int main(){
  vector<Card> C1, C2;
  C1.reserve(36);
  C2.reserve(36);

  int N;
  cin >> N;
  C1.resize(N);
  C2.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> C1[i].suit >> C1[i].value;
  }

  for (int i = 0; i < N; i++) {
    C2[i] = C1[i];
  }

  bubbleSort(C1);
  selectionSort(C2);

  print(C1);
  cout << "Stable" << endl;
  print(C2);
  if (isStable(C1, C2, N)) {
    cout << "Stable" << endl;
  } else {
    cout << "Not stable" << endl;
  }

  return 0;
}


Measured memory_bytes: 3096
#include<functional>
#include<algorithm>
#include<iostream>
#include<utility>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,x,n) for(int i=x;i<n;i++)
#define pb push_back
#define pf push_front
#define int long long
using namespace std;
const int INF=1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


signed main(){
  int n;
  cin>>n;
  vector<int> d;
  int edge=pow(n,0.5)+1;
  loop(i,1,edge){
    if(n%i==0){
      d.pb(n/i);
    }
  }
  sort(d.begin(),d.end());
  int x=d[0];
  int ans=0;
  while(x!=0){
    x= x/10;
    ans++;
  }
  cout<<ans<<endl;
  return 0;
}




Measured memory_bytes: 384
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, x int
	fmt.Scan(&n, &x)
	a := make([]int, n)
	for i := range a {
		fmt.Scan(&a[i])
	}
	sort.Ints(a)
	rem := x
	ans := 0
	for _, e := range a {
		rem -= e
		if rem < 0 {
			break
		}
		ans++
	}
	if rem > 0 {
		ans--
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#include <sstream>
#include <utility>
#include <deque>
#include <numeric>
#include <map>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
 
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

class SegmentTree {
private:
    int n;
    vector<int> lo, hi, max_el; 

    void init(int i, int a, int b) {
        lo[i] = a;
        hi[i] = b;

        if (a == b) {
            return;
        }

        int m = (a+b)/2;
        init(2*i, a, m);
        init(2*i+1, m+1, b);
    }

    void update(int i, int a, int val) {
        if (lo[i] > a || hi[i] < a) {
            return;
        }

        if (lo[i] == hi[i] && hi[i] == a) {
            max_el[i] = val;
            return;
        }

        update(2*i, a, val);
        update(2*i + 1, a, val);
        max_el[i] = max(max_el[2*i], max_el[2*i+1]);
    }

    int maximum(int i, int a, int b) {
        if (lo[i] > b || hi[i] < a) {
            return -1;
        }

        if (lo[i] >= a && hi[i] <= b) {
            return max_el[i];
        }

        int left = maximum(2*i, a, b);
        int right = maximum(2*i + 1, a, b);
        return max(left, right);
    }
    
public:
    SegmentTree(int _n) : n(_n), lo(4*n+1), hi(4*n+1), max_el(4*n+1) {
        init(1,0,n-1);
    }

    // update value on one point to val
    void update(int a, int val) {
        update(1, a, val);
    }
    int maximum(int a, int b) {
        return maximum(1, a, b);
    }
};
 
int main () {
	int N, M;
    cin >> N >> M;
	vector<pii> v(N);
    int a, b;
	rep(i,N) {
		cin >> a >> b;
        v[i] = make_pair(b,a);
	}
    sort(v.begin(), v.end());
    SegmentTree st(M+1);
    rep(i,M+1) {
        st.update(i,i);
    }
	int ans = 0;
    rep(i,N) {
        int a = v[N-1-i].second;
        int b = v[N-1-i].first;
        int ind = st.maximum(0, M-a);
        if (ind == -1)
            continue;
        ans += b;
        st.update(ind, -1);        
    }
	cout << ans << endl;
    return 0;
}

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

int main()
{
    int N;
    cin >> N;
    vector<int> V(N);
    for (int i = 0; i < N; i++)
        cin >> V[i];
    vector<int> C(N);
    for (int i = 0; i < N; i++)
        cin >> C[i];
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        if (C[i] < V[i])
            ans += V[i] - C[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(void){
    // Your code here!
    string s;
    cin >> s;
    int r_max=0;
    int r=0;
    for(int i=0;i<3;i++){
        if(s[i]=='R'){
            r++;
            if(r_max<r)r_max = r;
        }
        else {
            r=0;
        }
    }
    cout << r_max;
}

Measured memory_bytes: 3532
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cstdlib>

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;


int calc_k(int n, vi&p)
{
	vi a;
	int u=1;
	int ret=0;

	for(int i=1;i<=n;i++) a.push_back(i), u*=i;
	for(int i=n;i>=1;i--)
	{
		u/=i;
		for(int j=0;j<i;j++)
		{
			if(p[n-i]==a[j])
			{
				ret+=j*u;
				a.erase(a.begin()+j);
				break;
			}
		}
	}
	return ret;
}


int main(void)
{
	int n;

	while(scanf("%d", &n)==1)
	{
		vi p(n), q(n);

		for(int i=0;i<n;i++) scanf("%d", &p[i]);
		for(int i=0;i<n;i++) scanf("%d", &q[i]);

		int pk=calc_k(n, p);
		int qk=calc_k(n, q);
		printf("%d\n", abs(pk-qk));
	}
	return 0;
}


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

using namespace std;
typedef long long ll;

ll c,d;

ll f(ll a){
    ll res = a;
    res-= a/c;
    res -= a/d;
    res+= a/(c/__gcd(c,d)*d);
    return res;
}

int main(){
    ll a,b;
    cin>>a>>b>>c>>d;

    cout<<f(b)-f(a-1);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using pq = priority_queue<int>;
template<class T>
using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
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; }
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; }
int under = (1 << 31);
int upper = under - 1;
ll UNDER = (1LL << 63);
ll UPPER = UNDER - 1;
const int MOD = 1e9 + 7;
const long double pi = 3.141592653589793;
int main(){
	string s;
	cin >> s;
	rep(i, 3) if (s[i] == '7') {
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
	return 0;
}

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

 int main()
 {
     long long a, b;
     cin >> a >> b;
     for (int i = 1; i <=b;i++)
     {
         if((a*i)%b == 0) {cout << a*i;break;}

     }
    return 0;

 }


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

typedef long long ll;

int main(){
    ll a,b,x;
    cin >> a >> b >> x;

    ll count;    
    if(a>0){
        count = b/x-(a-1)/x;
    }else{
        count = (b/x)+1;
    }
    printf("%lld\n",count);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string> 
#include <vector>
#include <iomanip>
#include <math.h>
#include <map>
using namespace std;

int main()
{
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	if (A + B < C + D) {
		cout << "Right" << endl;
	}
	else if (A + B > C + D) {
		cout << "Left" << endl;
	}
	else {
		cout << "Balanced" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll a;
int n;

int main()
{
	cin>>n;
	map<ll,ll>m;
	int f=0;
	for(int i=1;i<=n;i++){
		cin>>a;
		m[a]++;
		if(m[a]>=2) f=1;
	}
	if(f==1) cout<<"NO"<<endl;
	else cout<<"YES"<<endl;
		
}

Measured memory_bytes: 12800
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<char>> C(H, vector<char>(W));
    rep(i, H) rep(j, W) cin >> C[i][j];
    
    rep(i, 2 * H) {
        rep(j, W) cout << C[i / 2][j];
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 256
// B - Shift only
#include <bits/stdc++.h>
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
const lli INF = 2147483647;
const lli MINF = -2147483648;
const lli LINF = 9223372036854775807;
const lli MOD = 1000000007; //10^9+7
const long double PI = acos(-1);
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define Vec(K, L, N, S) vector<L> K(N, S)
#define rt sqrt
#define pb push_back
#define eb emplace_back
#pragma GCC optimize("Ofast")
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using P = pair<lli, lli>;
// vector<P> vp;
// vp.emplace_back(a[i], b[i]);
using vs = vector<string>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli b, c, h, k, n, w, ans = 0, count = 0, tmp = 100;
  string s, t;
  cin >> n;
  vlli a(n);
  rep(i, 0, n)
  {
    cin >> a[i];
  }
  while (tmp > 0)
  {
    rep(i, 0, n)
    {
      if (a[i] % 2 == 0)
      {
        count++;
      }
    }
    if (count == a.size())
    {
      rep(i, 0, n)
      {
        a[i] /= 2;
      }
      ans++;
    }
    tmp--;
    count = 0;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;

long long int dp[61][2][2][2];// 10-18 < 2^60

int main(){
    long long int l, r;
    cin >> l >> r;

    dp[60][0][0][0] = 1;
    for(int i=59; i>=0; i--){// digit DP
        for(int j=0; j<2; j++){
            for(int k=0; k<2; k++){
                for(int s=0; s<2; s++){

                    for(int nx=0; nx<2; nx++){
                        for(int ny=0; ny<2; ny++){
                            if(nx == 1 && ny == 0) continue;

                            int nj = j, nk = k, ns = s;

                            // s : MSB
                            if(s == 0 && nx != ny) continue;
                            if(nx == 1 && ny == 1) ns = 1;

                            // j : L <= x
                            if(j == 0 && nx == 0 && ((l>>i) & 1)) continue;// x < L
                            if(nx == 1 && !((l>>i) & 1)) nj = 1; 

                            // k : y <= R
                            if(k == 0 && ny == 1 && !((r>>i) & 1)) continue;// y > R
                            if(ny == 0 && ((r>>i) & 1)) nk = 1; 

                            dp[i][nj][nk][ns] += dp[i+1][j][k][s];
                            dp[i][nj][nk][ns] %= MOD;
                        }
                    }

                }
            }
        }
    }

    long long int ans = 0;
    for(int j=0; j<2; j++){
        for(int k=0; k<2; k++){
            for(int s=0; s<2; s++){
                ans += dp[0][j][k][s];
                ans %= MOD;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

int n, q, temp, ans;

int main() {
    cin >> n;
    int a[n];
    for (int i=0; i < n; i++) cin >> a[i];
    cin >> q;
    int b[q];
    for (int i=0; i<q; i++) cin >> b[i];
    for (int i=0; i<q; i++) {
        for (int j=0; j<n; j++) {
            if (a[j] == b[i]) temp = 1;
        }
    ans += temp;
    temp =0;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3128
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int main(){
	fast;
	ll n,cnt=0;
	cin>>n;
	int arr[n],pos[n+1]={0};
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
		if(arr[i]==i+1)
			pos[i+1]=1;
	}
	for(int i=1;i<n+1;i++)
	{
		if(pos[i]&&pos[i+1])
			cnt++,i++;
		else if(pos[i])
			cnt++;
	}
	cout<<cnt;
	return 0;
}



Measured memory_bytes: 4440
#include<stdio.h> 
main(void)
{
 int i,n,m;
 	for(i=1;;i++){
		 scanf("%d %d",&n,&m);
 		if(n==0 && m==0)break;
 		if(n>m)printf("%d %d\n",m,n);
 		else printf("%d %d\n",n,m);
 		}
 return 0;
 } 


Measured memory_bytes: 2036
#include<bits/stdc++.h>
using namespace  std;
main(){
long long int n,k;
cin>>n>>k;
long long int h[n],m[n];
for(int i=0;i<n;i++)m[i]=100000000000;
m[0]=0;
for(int i=0;i<n;i++)cin>>h[i];





for(int i=1;i<n;i++)for(int j=1;j<=k;j++)
{
if(i-j<0)break;
m[i]=min(m[i],abs(h[i]-h[i-j])+m[i-j]);


//cout<<m[i]<<endl;
}

cout<<m[n-1];

}


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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrepa(i,a,n) for(int i=(n)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

int main(){
   
    int n,m;cin>>n>>m;
    vi a(m),b(m);
    vvi c(m,vi(m,-1));
    rep(i,m){
        cin>>a[i]>>b[i];
        rep(j,b[i]){
            cin>>c[i][j];
        }
    }

    vi cbit(m,0);
    rep(i,m){
        rep(j,b[i]){
            cbit[i] +=  1<<(c[i][j]-1);
        }
    }

    vi dp(1<<n,100000*m);
    dp[0]=0;

    rep(i,1<<n){
        rep(j,m){
            dp[i|cbit[j]] = min(dp[i|cbit[j]],dp[i]+a[j]);
        }
    }
    
    if(dp[(1<<n)-1]==100000*m)cout<<-1<<endl;
    else cout<<dp[(1<<n)-1]<<endl;

    return 0;
}

Measured memory_bytes: 4224
#include<cstdio>
using namespace std;
int a[105];
int main()
{
	//freopen("xx.in","r",stdin");
	int n,sum=0;
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",a+i),sum+=a[i];
    int m;
    scanf("%d",&m);
    while(m--)
	{
        int p,x;
        scanf("%d%d",&p,&x);
        printf("%d\n",sum-a[p]+x);
    }
    return 0;
}

Measured memory_bytes: 128
/*Rabbi Zidni Ilma*/

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define scl(n) scanf("%lld",&n)
#define scll(n,m) scanf("%lld%lld",&n,&m)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define mod 1000000007
#define read freopen("input.txt","r",stdin)
#define write freopen("output.txt","w",stdout)

ll dp[3005][3005];

int main()
{
	ll l1,l2,i,j;
    string s,t;
    cin >> s >> t;
    l1=s.size();
    l2=t.size();
    for(i=l1;i>=1;i--)
    {
    	for(j=l2;j>=1;j--)
    	{
    		if(s[i-1]==t[j-1])
    		dp[i][j]=dp[i+1][j+1]+1;
    		else
    		dp[i][j]=max(dp[i+1][j],dp[i][j+1]);
		}
	}
	
	string ans;
	i=1,j=1;
	while(i<=l1&&j<=l2)
	{
		if(s[i-1]==t[j-1])
		{
			ans.pb(s[i-1]);
			i++;
			j++;
		}
		else if(dp[i+1][j]>dp[i][j+1])
		i++;
		else 
		j++;
	}
	cout << ans <<"\n";
}

Measured memory_bytes: 74052
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define REP(i,a,b) for(int i=int(a);i<(int)b;++i)


using namespace std;
using ll = long long;

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int main(void)
{
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    int a,b,k;
    bool p=false;
    cin  >> k >>a >> b;
    for(int i=a;i<b+1;i++)
    {
        if(i%k==0) p=true;
    }
    if(p) cout << "OK" <<endl;
    else cout << "NG" << endl;
   

    return 0;
}


Measured memory_bytes: 3664
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <climits>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
using namespace std;
#define ll long long 
#define pb push_back
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
//typedef long long  MOD=1000000009;
ll MOD=998244353;
ll add(ll x, ll y) {ll res = x + y; return (res >= MOD ? res - MOD : res);}
ll mul(ll x, ll y) {ll res = x * y; return (res >= MOD ? res % MOD : res);}
ll sub(ll x, ll y) {ll res = x - y; return (res < 0 ? res + MOD : res);}
ll lcm(ll x, ll y) {ll res = (x * y) / __gcd(x, y); return res;}
ll power(ll x, ll y) {if (y < 0) return 1; ll res = 1; x %= MOD; while (y) {if (y & 1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;}

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



void solution()
{
    ll k,i,j,n,m,w;
    string s;
    cin>>s;
    if(s[s.length()-1]=='s')
    {
        cout<<s<<"es";
    }
    else cout<<s<<'s';
}

int main(){
    fio
    //iofoj();
    // ll t;
    // cin>>t;
    // while(t--)
    solution();
    return 0; 
}


Measured memory_bytes: 3648
#include<iostream>
using namespace std;
int main()
{
    long long n,k,l,m;
    cin>>n>>k;
    l=n%k;
    if(l<=k)
    {
        m=k-l;
    }
    else
    {
        m=l-k;
    } 
    if(m<0)
    {
        cout<<l<<endl;
    }
    else
    {
        if(m<=l)
        {
            cout<<m<<endl;
        }
        else
        {
            cout<<l<<endl;
        }
    }
    return 0;
}

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

int main() {
    int a, b;
    cin >> a >> b;
    if (a >= 13) cout << b << endl;
    else if (6 <= a && a <= 12) cout << b/2 << endl;
    else cout << 0 << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<bitset>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<functional>
#include<list>
#include<map>
#include<iomanip>
#include<iostream>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<vector>
#include<algorithm>
#include<memory.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	if(s[0]=='9'||s[1]=='9')cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <list>
#include<stack>
#include<queue>
#include <vector>
#include <set>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include <functional>

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long
#define CLR(a) memset((a),0,sizeof(a))
#define SZ(x) (int((x).size()))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl
using namespace std;

const LL MOD = 1000000007;// 10^9+7
const int INF = (1 << 30);


//変数
int N;
vector<string> s;





//サブ関数
//入力
void input()
{
	cin >> N;
	s.resize(N);
	REP(i, N)cin >> s[i];
}


//計算
void calc()
{
	vector<LL> cnt(5, 0ll);
	for (auto name : s) {
		switch (name[0]) {
		case 'M':cnt[0]++; break;
		case 'A':cnt[1]++; break;
		case 'R':cnt[2]++; break;
		case 'C':cnt[3]++; break;
		case 'H':cnt[4]++; break;
		}
	}
	LL ans = 0;
	REP(i, 5)FOR(j, i + 1, 5)FOR(k, j + 1, 5) {
		ans += cnt[i] * cnt[j] * cnt[k];
	}
	cout << ans << endl;
}


//出力
void output()
{

}


//デバッグ
void debug()
{
	int N;
	cin>>N;
}


//メイン関数
int main()
{
	input();
	calc();
	output();
	debug();
	
	return 0;
}


Measured memory_bytes: 6144
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = 1e18;
/* テンプレートここまで */

int main() {
  ll n; cin >> n;
  vector<ll> a(n+1), b(n+1);
  REP(i,n) cin >> a[i+1];

  IFOR(i,1,n+1){
    b[i] = a[i];
    for(ll j=2*i; j<=n; j+=i){
      b[i] ^= b[j];
    }
  }

  vector<ll> ans;
  FOR(i, 1, n+1){
    if(b[i]) ans.push_back(i);
  }
  cout << ans.size() << endl;
  REP(i,ans.size()){
    cout << ans[i];
    if(i==ans.size()-1) cout << endl;
    else cout << " ";
  }
}

Measured memory_bytes: 4980
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Math;
using static System.Array;
namespace AtCoderSolve
{
    class Solve
    {
        const int mod = 1000000007;
        const int INF = 2147483647;
        const long SINF = 9223372036854775807;

        static long N, M;
        

        public static void Input()
        {
            var cin = new Scanner();
            var input = cin.SplitReaderL();
            N = input[0];
            M = input[1];
        }

        static void Main(string[] args)
        {
            Input();
            //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            //Console.SetOut(sw);

            Console.WriteLine((1900 * M + 100 * (N - M) )* Pow(2, M));

            //Console.Out.Flush();
        }
    }

    public class Scanner
    {
        public int[] SplitReader()
        {
            int[] array = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return array;
        }
        public long[] SplitReaderL()
        {
            long[] array = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return array;
        }

    }

    public class Graph
    {
        
    }
}

    



Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
int main(){
   string S;
   cin >> S;
   int ans = 700;
   for(int i = 0; i < S.length(); i++){
       if(S[i]=='o') ans+=100;
   }
    cout << ans << endl;  
    return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int,int> P;

int main(){
  int n;
  cin >> n;
  int a[n];
  rep(i,n)cin >> a[i];
  int b[n];
  for(int i = n;i>0;i--){
    int sum = 0;
    for(int j = n-n%i;j>i;j-=i){
      sum += b[j-1];
    }
    b[i-1] = (a[i-1] - sum) % 2;
    if(b[i-1]<0)b[i-1]=1;
  }
  int m=0;
  rep(i,n)m+=b[i];
  cout << m << endl;
  rep(i,n)if(b[i]==1)cout << i+1 << " ";
  cout << endl;
}

Measured memory_bytes: 2432
# coding: utf-8
# hello worldと表示する
#dpでできないかな？
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

s=SI()
a=int(s[0])
b=int(s[1])
c=int(s[2])
d=int(s[3])
def porm(x):
    if x==1:
        return "+"
    else:
        return "-"
def vec(x):
    if x==1:
        return 1
    else:
        return -1
for i in range(8):
    j=(i>>0) %2
    k=(i>>1) %2
    l=(i>>2) %2
    if a+b*vec(j)+c*vec(k)+d*vec(l)==7:
        print(a,end="")
        print(porm(j),end="")
        print(b,end="")
        print(porm(k),end="")
        print(c,end="")
        print(porm(l),end="")
        print(d,end="")
        print("=7")
        sys.exit()

Measured memory_bytes: 3316
import java.util.Scanner;
import java.util.Arrays;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] initial = new int[26];
		int cnt = 0;

		for(int i=0; i<n; i++){
			String s = sc.next();
			initial[s.charAt(0)-'A']++;
		}

		while(true){
			Arrays.sort(initial);
			int sum = 0;
			for(int i=25; i>=0; i--){
				if(initial[i]>0){
					initial[i]--;
					sum++;
				}
				if(sum==k){
					cnt++;
					break;
				}
			}
			if(sum<k) break;
		}

		System.out.println(cnt);
	}
}

Measured memory_bytes: 18672
#include <iostream>
#include <vector>   
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main() {
  string s, t;
  cin >> s >> t;
  t.pop_back();
  if (s == t) {
    cout << "Yes";
  }  else {
    cout << "No";
  }
  return 0;
}

Measured memory_bytes: 3120
import sys
sys.setrecursionlimit(10**5-10)

n = int(input())
if n==1:
  print(0)
  exit()
from collections import defaultdict
edge = defaultdict(list)
for i in range(n-1):
  u, v, w = list(map(int, input().split()))
  edge[u].append((v, w))
  edge[v].append((u, w))
graph = [-1 for i in range(n+1)]

def dfs(x, c):
  nexts = edge.get(x)
  if nexts is None:
    return
  if graph[x]!=-1:
    return
  else:
    graph[x] = c
  for y, w in nexts:
    if w%2:
      dfs(y, not c)
    else:
      dfs(y, c)

dfs(1, 0)
for i in range(1, n+1):
  print(int(graph[i]))

Measured memory_bytes: 159704
#include <bits/stdc++.h>
using namespace std;
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG true
// sort(a.begin(), a.end(), std::greater<int>());

/*
std::vector<std::string> split(const std::string &input, char delimiter)
{
    std::istringstream stream(input);

    std::string field;
    std::vector<std::string> result;
    while (std::getline(stream, field, delimiter))
    {
        result.push_back(field);
    }
    return result;
}
*/

int main()
{
    int a, b;
    cin >> a >> b;
    if (a % 500 <= b)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

int main()
{
    int n;
    double x1, y1, x2, y2, x3, y3;
    double a1, a2, b1, b2, c1, c2;
    double x, y, r;

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> x1 >> y1 >>  x2 >>  y2 >>  x3 >> y3;
            
        a1 = 2 * (x2 - x1);
        b1 = 2 * (y2 - y1);
        c1 = x1 * x1 - x2 * x2 + y1 * y1  - y2 * y2;
        a2 = 2 * (x3 - x1);
        b2 = 2 * (y3 - y1);
        c2 = x1 * x1 - x3 * x3 + y1 * y1  - y3 * y3;

        x = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1);
        y = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1);
        r = sqrt((x1 - x) * (x1 - x) + (y1 - y) * (y1 - y));

        cout << setprecision(3) << fixed;
        cout << x << " " << y << " " << r << endl;
    }

    return 0;
}

Measured memory_bytes: 1284
#include <iostream>
using namespace std;
int main(){
	int n;
	cin >> n;
	string a, b;
	cin >> a>> b;
	string ans = "";
	for(int i =0; i < n; i++){
		ans += a[i];
		ans += b[i];
	}
	cout << ans << endl;
	return 0;

}












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

const ll MAXN = 1e5+5;
const ll M = 2200; //M*M*M > 10^10.

ll n, a[MAXN], red[MAXN], comp[MAXN], ans;
bool pr[M];
map<ll, ll> m, sq;
vector<ll> p;

ll proc(int x) {
	ll y = a[x];
	ll prod = 1, prod1 = 1;
	for (int prime : p) {
		int ct = 0;
		while (y%prime == 0) {
			y /= prime; ct++;
		}

		ct %= 3;
		if (ct == 0)
			continue;
		prod *= prime;
		if (ct == 2)
			prod *= prime;
		if (prod1 != -1) {
			prod1 *= prime;
			if (ct == 1)
				prod1 *= prime;
		}
		if (prod1 > M*M*M)
			prod1 = -1;
	}

	if (y > 1 && sq[y] != 0) {
		int prime = sq[y], ct = 0;
		while (y%prime == 0) {
			y /= prime; ct++;
		}

		ct %= 3;
		prod *= prime;
		if (ct == 2)
			prod *= prime;
		if (prod1 != -1) {
			prod1 *= prime;
			if (prod1 > M*M*M)
				prod1 = -1;
			if (prod1 != -1 && ct == 1)
				prod1 *= prime;
		}
		if (prod1 > M*M*M)
			prod1 = -1;
	}

	prod *= y;
	if (prod1 != -1) {
		prod1 *= y;
		if (prod1 > M*M*M)
			prod1 = -1;
		if (prod1 != -1)
			prod1 *= y;
		if (prod1 > M*M*M)
			prod1 = -1;
	}

	red[x] = prod, comp[x] = prod1;
	m[red[x]]++;
}

int main() {
	cin >> n;
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	for (ll i = 1; i <= 100000; ++i)
		sq[i*i] = i;
	for (int i = 2; i < M; ++i) {
		if (pr[i] == 0) {
			p.push_back(i);
			for (int k = 2*i; k < M; k += i)
				pr[k] = 1;
		}
	}

	ll tot = 0;
	for (int i = 0; i < n; ++i)
		proc(i);
	for (int i = 0; i < n; ++i) {
		if (red[i] == 1)
			continue;
		tot += max(m[red[i]], m[comp[i]]);
		m[red[i]] = m[comp[i]] = 0;
	}
	if (m[1] > 0)
		tot++;
	cout << tot << endl;
}

Measured memory_bytes: 20352
#include<bits/stdc++.h>
using namespace std;
#define step(i, s, n, d) for(int i=s; i<n; i+=d)
#define FOR(i,s,n) step(i,s,n,1)
#define rep(i,n) FOR(i,0,n)
#define gets(x) x; cin >> x;
#define puts(x) x; cout << x << endl;
#define list_input(x, n) x[n]; rep(i,n){ gets(x[i]);}
#define ll long long
int main(){
  ll n;
  cin >> n;
  ll tmp, x[n], xx[n];
  rep(i, n){
    cin >> tmp;
    x[i] = tmp;
    xx[i] = tmp;
  }
  sort(x, x+n);
  ll left = x[n/2-1], right = x[n/2];
  rep(i, n){
    if (xx[i] >= right) {
      puts(left)
    }else{
      puts(right)
    }
  }
}

Measured memory_bytes: 5376
#include<iostream>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	int c=a+b;
	int d=a-b;
	int e=a*b;
	if(c>=d&&c>=e){
		cout<<c;
		return 0;
	}
	if(d>=c&&d>=e){
		cout<<d;
		return 0;
	}if(e>=c&&e>=d){
		cout<<e;
		return 0;
	}	
	return 0;
}
 

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

int n, a[100], x[100][100], y[100][100];
int t[100], f[100];
int maxn;

int main() {
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> a[i];
		for(int j = 0; j < a[i]; j++) {
			cin >> x[i][j] >> y[i][j];
			x[i][j]--;
			if(y[i][j] == 1) {
				t[i] |= (1 << x[i][j]);
			} else {
				f[i] |= (1 << x[i][j]);
			}
		}
	}
	for(int i = 0; i < (1 << n); i++) {
		int flag = 1;
		for(int j = 0; j < n; j++) {
			if(!((i >> j) & 1)) continue;
			if((t[j] & i) != t[j]) {
				flag = 0;
			}
			if((f[j] & i) != 0) {
				flag = 0;
			}
		}
		if(flag) {
			maxn = max(maxn, __builtin_popcount(i));
		} 
	}
	cout << maxn << endl;
	return 0;
}

Measured memory_bytes: 256
/*
螺旋本 p371

circumcenter:
    https://ja.wikipedia.org/wiki/%E5%A4%96%E6%8E%A5%E5%86%86#%E5%A4%96%E5%BF%83%E3%81%AE%E4%BD%8D%E7%BD%AE
    https://mathtrain.jp/goshin
*/
#pragma GCC optimize("Ofast")
#include <cstdio>
#include <cstdlib>
#include <string>
#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include <map>
#include <set>
#include <tuple>
using namespace std;
#define INF 1LL << 55
#define MAX 1LL << 30
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;
//typedef pair<pair<int,int>,int> p;
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)
template<class T,class U>bool chmin(T&a,const U&b){if(a<=b)return false;a=b;return true;}
template<class T,class U>bool chmax(T&a,const U&b){if(a>=b)return false;a=b;return true;}
//__builtin_popcount(S);
//C.erase(unique(C.begin(),C.end()),C.end());
//#define int ll
int dx[]={1,-1,0,0},dy[]={0,0,-1,1};

signed main(){
    int N;
    cin>>N;
    ll S=0;
    ll ans=INF;
    for(int i=0;i<N;i++){
        ll a,b;
        cin>>a>>b;
        S+=a;
        if(a>b){
            chmin(ans,b);
        }
    }
    if(ans==INF) ans=S;
    cout<<S-ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define PP pair<P,P>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;
template<class T> inline void chmax(T& a, T b) { a = max(a, b); }
template<class T> inline void chmin(T& a, T b) { a = min(a, b); }

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return true;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
int get_rand(int MIN, int MAX) {
	random_device rnd;
	mt19937_64 mt64(rnd());
	uniform_int_distribution<int>engine(MIN, MAX);
	return engine(mt64);
}
/*--------Library Zone!--------*/

int n, a[114514];
signed main() {
	cin >> n;
	rep(i, n)cin >> a[i];
	int now = 1, ans = a[0] - 1;
	REP(i, n) {
		if (a[i] == now + 1) {
			now++;
		}
		else if (a[i] % (now + 1) == 0) {
			int memo = a[i] / (now + 1) - 1;
			ans += memo;
		}
		else {
			int memo = a[i] / (now + 1);
			ans += memo;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int h,n,x,sum=0;
	cin>>h>>n;
	for(int i=0;i<n;i++)
	{
		cin>>x;
		sum+=x;
	}
	if(h<=sum)
		cout<<"Yes";
	else
		cout<<"No";
}

Measured memory_bytes: 256
n=int(input())
l=list(map(int,input().split()))
p=1
flag=1
zero=0 
for i in l:
    if i==0 :
        zero=1 
        break 
if zero==0:
    for i in l:
        p*=i
        if p>1000000000000000000:
            flag=0
            break
    if flag==0:
        print('-1')
    else:
        print(p)
else : 
    print("0")

Measured memory_bytes: 21636
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int a = sc.nextInt();
        sc.close();

        if (x < a) {
            System.out.println(0);
        } else {
            System.out.println(10);
        }
    }

}


Measured memory_bytes: 22996
#include <cstdio>
#include <cstdlib>
#include <algorithm>
using namespace std;

int N,W,i,j;
long int w[101],v[101],dp[101][100001];

int main(){
    scanf("%d%d",&N,&W);
    for(i=0;i<101;i++){
        for(j=0;j<100001;j++){
            dp[i][j]=(!i && !j)? 0:1e11;
        }
    }
    for(i=1;i<=N;i++){
        scanf("%ld%ld",w+i,v+i);
    }
    for(i=1;i<=N;i++){
        for(j=0;j<=100000;j++){
            dp[i][j]=(j-v[i]<0) ? dp[i-1][j] : min(dp[i-1][j],dp[i-1][j-v[i]]+w[i]);
        }
    }
    for(i=100000;i>=0;i--){
        if(dp[N][i]<=W){
            printf("%d\n",i);
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 79104
from math import sqrt, floor
from itertools import combinations
from collections import defaultdict
N = int(input())

ans_root = sqrt(1 + 8 * N)
if (1 + 8 * N) - floor(ans_root) ** 2 > 1e-6:
    print("No")
    exit(0)

k = floor((1 + ans_root) // 2)
result = defaultdict(list)
for i, (flag1, flag2) in enumerate(combinations(range(k), 2), start=1):
    result[flag1].append(str(i))
    result[flag2].append(str(i))

print("Yes")
print(k)
for value in result.values():
    print(len(value), " ".join(value))


Measured memory_bytes: 53468
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int a[n-1],b[n-1];
    vector<vector<int>>pas(n);
    for(int i=0;i<n-1;i++){
        cin>>a[i]>>b[i];
        pas[a[i]-1].push_back(b[i]-1);
        pas[b[i]-1].push_back(a[i]-1);
    }
    int root[n],depth[n];
    root[0]=0;
    depth[0]=0;
    queue<int>q;
    q.push(0);
    int maxd=0;
    while(q.size()){
        int x=q.front();
        q.pop();
        maxd=max(maxd,depth[x]);
        for(int i=0;i<pas[x].size();i++){
            int next=pas[x][i];
            if(next!=root[x]){
                q.push(next);
                root[next]=x;
                depth[next]=depth[x]+1;
            }
        }
    }
    vector<vector<int>>tree(maxd+1);
    for(int i=0;i<n;i++)tree[depth[i]].push_back(i);
    int lca[n][n];
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            int I=i,J=j;
            while(depth[I]<depth[J])J=root[J];
            while(depth[J]<depth[I])I=root[I];
            while(I!=J){
                I=root[I];
                J=root[J];
            }
            lca[i][j]=I;
        }
    }
    int m;
    cin>>m;
    int u[m],v[m];
    for(int i=0;i<m;i++){
        cin>>u[i]>>v[i];
        u[i]--;
        v[i]--;
    }
    int M=1;
    for(int i=0;i<m;i++)M*=2;
    long long ans=1;
    for(int i=0;i<n-1;i++)ans*=2;
    for(int i=1;i<M;i++){
        int I=i,one=0;
        int imos[n]={};
        for(int j=0;j<m;j++){
            if(I%2){
                one++;
                imos[u[j]]++;
                imos[v[j]]++;
                imos[lca[u[j]][v[j]]]-=2;
            }
            I/=2;
        }
        for(int j=maxd;j>0;j--)for(int k=0;k<tree[j].size();k++)imos[root[tree[j][k]]]+=imos[tree[j][k]];
        long long paint=1;
        for(int j=0;j<n;j++){
            if(imos[j]==0)paint*=2;
        }
        if(one%2)ans-=paint/2;
        else ans+=paint/2;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
s=int(input())
a=s//100
b=s%100
if 1<=a<=12 and 1<=b<=12:
    print("AMBIGUOUS")
elif 1<=a<=12 and not 1<=b<=12:
    print("MMYY")
elif 1<=b<=12 and not 1<=a<=12:
    print("YYMM")
else:
    print("NA")


Measured memory_bytes: 2940
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var m = int.Parse(line[1]);
        for (int i = 0; i < m; i++) Console.ReadLine();
        Console.WriteLine(n - m - 1);
    }
}


Measured memory_bytes: 9224
#include<bits/stdc++.h>
using namespace std;
namespace FAST_IO
{
	template<typename T> void read(T &a)
	{
		a=0;
		int f=1;
		char c=getchar();
		while(!isdigit(c))
		{
			if(c=='-')
			{
				f=-1;
			}
			c=getchar();
		}
		while(isdigit(c))
		{
			a=a*10+c-'0';
			c=getchar();
		}
		a=a*f;
	}
	template <typename T> void write(T a)
	{
		if(a<0)
		{
			a=-a;
			putchar('-');
		}
		if(a>9)
		{
			write(a/10);
		}
		putchar(a%10+'0');
	}
	template <typename T> void writeln(T a)
	{
		write(a);
		puts("");
	}
}
struct r
{
	string city;
	int score,id;
};
bool cmp(r a,r b)
{
	return (a.city==b.city)?(a.score>b.score):(a.city<b.city);
}
r rs[101];
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>rs[i].city>>rs[i].score;
		rs[i].id=i; 
	}
	sort(rs+1,rs+n+1,cmp);
	for(int i=1;i<=n;i++)
	{
		cout<<rs[i].id<<endl;
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <numeric>
#include <set>
#include <list>
#include <bitset>
#include <cstdlib>
using namespace std;

int main()
{
    int N, M, C;
    cin >> N >> M >> C;
    vector<int> B(M);
    for (int i = 0; i < M; i++)
    {
        cin >> B[i];
    }
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        int tmp = 0;
        for (int j = 0; j < M; j++)
        {
            int a;
            cin >> a;
            tmp += a * B[j];
        }
        tmp += C;
        if (tmp > 0)
        {
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'
#define debugArrayP(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i].first<< " " << x[i].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = INT_MAX;
const ll MOD = 1e9+7;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;cin>>N;
  int K;cin>>K;
  int ans = 1;
  repeat(i,N){
    if(ans < K){
      ans<<=1;
    }else{
      ans += K;
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main()
{
	int a,b,c,d,sum=0;
	char s[100];
	cin>>a>>b>>c>>d;
	if((max(a,b)-min(a,b))<=d && (max(c,b)-min(c,b))<=d)
		cout<<"Yes"<<endl;
    else if(max(a,c)-min(a,c)<=d)
        cout<<"Yes"<<endl;
	else
	{
		cout<<"No"<<endl;

	}
	
	
	return 0;
}
	

Measured memory_bytes: 256
//
// Created on 2020/06/14.
//


#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 <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;


int main() {
    for (int i = 1; i <= 5; ++i) {
        int t;
        cin>>t;
        if(t == 0){
            cout<<i<<endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 3632
import sys
sys.setrecursionlimit(1000000)

mod = 1000000007

n,m = map(int,input().split())
good = [True] * (n+1)
for _ in range(m):
    x = int(input())
    good[x] = False

dp = [0] * (n+1)
dp[0] = 1

for i in range(n):
    # 出発点になれるなら、のみでOK
        # Falseの部分が更新されることはあっても、出発点になれないから
    if good[i]:
        if i+1 <= n:
            dp[i+1] += dp[i]
            dp[i+1]%= mod
        if i+2 <= n:
            dp[i+2] += dp[i]
            dp[i+2] %= mod

print(dp[n])


Measured memory_bytes: 45016
#include <iostream>
#include <climits>
using namespace std;
int min(int a, int b){
  return a < b ? a : b;
}
int main(void){
  int a, b, c;
  int mi = INT_MAX;
  cin >> a >> b >> c;
  mi = min(a+b, b+c);
  mi = min(mi, c+a);
  cout << mi << endl;
  return 0;
}

Measured memory_bytes: 256
l, r = gets.split.map(&:to_i)
ans = 2019
l.upto(r - 1).each do |i|
	(i + 1).upto(r).each do |j|
	  mod = (i * j) % 2019
		if mod == 0
			puts 0
			exit
		end
		ans = mod if mod < ans
	end
end 
puts ans

 	
	


Measured memory_bytes: 1788
//
//  main.cpp
//  atcoder-frog3
//
//  Created by r on 6/18/19.
//  Copyright © 2019 r. All rights reserved.
//


#include <iostream>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <stack>
#include <queue>
#include <assert.h>
#include <limits>
#include <cstdio>
using namespace std;

//#define RDEBUG 1
#ifdef RDEBUG
#define D(x) x
#else
#define D(x)
#endif
#define inf 0x7fffffff
#define MOD 1000000007

typedef long long ll;


ll add(ll a, ll b) {
    a += b;
    if(a >= MOD) {
        a -= MOD;
    }
    return a;
}
ll sub(ll a, ll b) {
    a -= b;
    if(a < 0) {
        a += MOD;
    }
    return a;
}

ll mul(ll a, ll b) {
    return (a * b)%MOD;
}

void add_self(ll& a, ll b) {
    a = add(a, b);
}
void sub_self(ll& a, ll b) {
    a = sub(a, b);
}
void mul_self(ll& a, ll b) {
    a = mul(a, b);
}


const ll MAXN = 200010;

ll sh[MAXN];
ll dp[MAXN];
ll N, K;

struct line {
    ll a, b;
};

vector<line> curr;

ll binsearch(ll x) {
    ll L = 0, R = curr.size()-1;
    while (L<R) {
        ll mid = L+(R-L)/2;
        if (x*curr[mid].a+curr[mid].b > x*curr[mid+1].a + curr[mid+1].b) {
            L = mid+1;
        } else {
            R = mid;
        }
    }
    return x*(curr[L].a)+curr[L].b;
}

// A.a * x + A.b = B.a * x + B.b

pair<ll, ll> intersect(line A, line B) {
    return {B.b-A.b, A.a-B.a};
}

bool works(line A, line B, line C) {
    pair<ll, ll> fint = intersect(A, B);
    pair<ll, ll> sint = intersect(A, C);
    if (fint.second < 0) {
        fint.second*=-1;
        fint.first*=-1;
    }
    if (sint.second < 0) {
        sint.second*=-1;
        sint.first*=-1;
    }
    return fint.first*sint.second<sint.first*fint.second;
}


int main() {
    ios_base :: sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> N >> K;
    for (int i = 0; i<N; i++) {
        cin >> sh[i];
    }
    dp[0] = 0;
    curr.push_back({-2*sh[0], sh[0]*sh[0]+K});
    for (int i = 1; i<N; i++) {
        dp[i] = sh[i]*sh[i] + binsearch(sh[i]);
        line C = {-2*sh[i], sh[i]*sh[i] + K + dp[i]};
        while (curr.size() >= 2) {
            line A = curr[curr.size()-2], B = curr[curr.size()-1];
            if (!works(A, B, C)) {
                curr.pop_back();
            } else {
                break;
            }
        }
        curr.push_back(C);
    }
    cout << dp[N-1] << endl;
    return 0;
}





Measured memory_bytes: 9072
card = list(map(int, input().split()))
list = list()
result = 0

if card[3] <= card[0]:
  result = card[3]
elif card[0] < card[3] and card[3] <= card[1]:
  result = card[0]
else:
  result = card[0] - (card[3] - (card[0] + card[1]))

print(result)

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

int main(){
  string S;
  cin >> S;

  if(S.size()%2!=0){
    cout << "No" << endl;
    return 0;
  }
  for(int i=0;i<S.size()-1;i++){
    if(S.at(i)=='h' && S.at(i+1)=='i'){
      i++;
      continue;
    }
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;
const int INF = INT_MAX;

int main() {
	int r;
	cin >> r;

	cout << 3 * r * r << endl;
}

Measured memory_bytes: 3644