akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define M 200010
#define MOD 1000000007
#define rep(i, x, y) for(int i = (x); i <= (y); i ++)
inline int read() {
	char ch = getchar(); int x = 0, f = 1;
	while(ch < '0' || ch > '9') {
		if(ch == '-') f = -1;
		ch = getchar();
	} while('0' <= ch && ch <= '9') {
		x = x * 10 + ch - '0';
		ch = getchar();
	} return x * f;
}
int fac[M], inv[M];
inline void init() {
	fac[0] = 1; rep(i, 1, 200000) fac[i] = 1ll * i * fac[i - 1] % MOD;
	inv[0] = inv[1] = 1;
	rep(i, 2, 200000) inv[i] = 1ll * inv[MOD % i] * (MOD - MOD / i) % MOD;
	rep(i, 2, 200000) inv[i] = 1ll * inv[i - 1] * inv[i] % MOD;
}
inline int C(int n, int m) {
	int a = n + m - 2, b = n - 1;
	//printf("%d %d\n", a, b);
	return 1ll * fac[a] * inv[b] % MOD * inv[a - b] % MOD;
}
int main() {
	int H = read(), W = read(), A = read(), B = read();
	init(); int res = 0;
	rep(i, 1, H - A) {
		//cout << res << endl;
		res += 1ll * C(i, B) * C(H - i + 1, W - B) % MOD;
		res %= MOD; //cout << res << endl;
	} cout << res;
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
 int n;
 cin >> n;
int a[n];int count = 0;
 for(int i=0;i<n;i++)
 cin >> a[i];
 int c=1;
 int minm = a[0]-1;
  for(int i=1;i<n;i++)
  {
      if(a[i]>=minm)
        minm = max(minm, a[i]-1);
     else
     {
         c=0;
         break;
     }
  }
 if(c)
 cout << "Yes" << endl;
 else
 cout << "No" << endl;
}


Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
long long N, A, B, S[120000], dp[120000][2], mod = 1000000007; vector<long long>EA, EB;
int main() {
	cin >> N >> A >> B; S[1] = -(1LL << 62); S[N + 2] = (1LL << 62); EA.push_back(2); EB.push_back(2);
	for (int i = 2; i <= N + 1; i++) {
		cin >> S[i]; if (S[i] - S[i - 1] < A)EA.push_back(i); if (S[i] - S[i - 1] < B)EB.push_back(i);
	}
	dp[1][0] = 1; dp[1][1] = 1;
	for (int i = 2; i <= N + 1; i++) {
		int pos1 = upper_bound(S, S + N + 3, S[i + 1] - A) - S; pos1--; if (pos1 == i)pos1--;
		int pos2 = upper_bound(EB.begin(), EB.end(), i) - EB.begin(); pos2--; pos2 = EB[pos2] - 1;
		if (pos1 >= pos2)dp[i][0] = (dp[pos1][1] - dp[pos2 - 1][1] + mod) % mod; dp[i][0] += dp[i - 1][0]; dp[i][0] %= mod;
		
		int pos3 = upper_bound(S, S + N + 3, S[i + 1] - B) - S; pos3--; if (pos3 == i)pos3--;
		int pos4 = upper_bound(EA.begin(), EA.end(), i) - EA.begin(); pos4--; pos4 = EA[pos4] - 1;
		if (pos3 >= pos4)dp[i][1] = (dp[pos3][0] - dp[pos4 - 1][0] + mod) % mod; dp[i][1] += dp[i - 1][1]; dp[i][1] %= mod;
	}
	cout << (dp[N + 1][0] + dp[N + 1][1] - dp[N][0] - dp[N][1] + mod * 2) % mod << endl;
	return 0;
}

Measured memory_bytes: 4332
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define for1(i, m, n) for(int i = m;i < n;i++)
#define ll long long
#define endl '\n'
using namespace std;


int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
    int n, a[100];
    cin >> n;
    rep(i, n) {
        cin >> a[i];
    }

    int cnt_odd = 1;
    rep(i, n) {
        if(a[i] % 2 == 0) {
            cnt_odd *= 2;
        } else {
            cnt_odd *= 1;
        }
    }
    ll int ans = pow(3, n) - cnt_odd;
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(i, name)in(i)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(i,v) for(auto &i:(v))
#define all(v) (v).begin(),(v).end()
#define print(...) out(__VA_ARGS__);cout<<endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void out(){} template<class T,class... U> void out(T t,U ...u){cout<<t<<" ";out(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

void solve() {
  VAR(string, a, b);
  auto c = sqrt(stoi(a + b));
  print(floor(c) == c ? "Yes" : "No");
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(200000)
input = sys.stdin.readline
k,a,b = map(int,input().split())
if a >= b+2:
    print(1+k)
    exit()
if a>=k:
    print(1+k)
    exit()
ans = 1+k
k-=a+1
tmp = b
x = k//2
tmp = (b-a)*(x)+k%2+b
print(max(ans,tmp))

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

int main() {
  double N,T,A;
  cin >> N >> T >> A;
  double TSURAI = 99999999;
  int KARIKENSETSU = 0;
  vector<double> H(N);
  for (int i = 0; i < N; i++) {
    cin >> H.at(i);
if (TSURAI > max(T-A,H.at(i)*0.006) - min(T-A,H.at(i)*0.006)){
 TSURAI = max(T-A,H.at(i)*0.006) - min(T-A,H.at(i)*0.006);
 KARIKENSETSU = i+1;
  }
  }
   cout << KARIKENSETSU << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

long long int A,B;
char op;

int main(){
	scanf("%lld",&A);
	scanf("%s",&op);
	scanf("%lld",&B);
	if(op=='+'){
		printf("%lld\n",A+B);
	}else{
		printf("%lld\n",A-B);
	}
}

Measured memory_bytes: 128
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
//typedef tuple<pii,int,int> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	ll a,b;
	cin>>a>>b;
	if(a%b==0)cout<<-1<<endl;
	else{
		ll t=0;
		while(t%b==0)t+=a;
		cout<<t<<endl;
	}
}










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

int main() {
	int w, h;
	cin >> h >> w;
	//char a[h][w];
	string a[h];
	int b[h+2][w+2] = {0};
	for (int i = 0; i < h; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (a[i][j] == '#') {
				for(int g=i;g<i+3;g++){
					for(int f=j;f<j+3;f++){
						b[g][f]++;
					}
				}
			}
		}
	}
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (a[i][j] == '#') {
				cout << '#';
			}
			else {
				cout << b[i+1][j+1];
			}
		}
		cout << endl;
	}
	return 0;
}


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

using namespace std;

int main() {
  int m[3][3];
  for (size_t i = 0; i < 3; i++) {
    for (size_t j = 0; j < 3; j++) {
      cin >> m[i][j];
    }
  }
  int a[3] = {0};
  int b[3] = {0};
  a[0] = 0;
  b[0] = m[0][0] - a[0];
  b[1] = m[0][1] - a[0];
  b[2] = m[0][2] - a[0];
  a[1] = m[1][0] - b[0];
  a[2] = m[2][0] - b[0];

  for (size_t i = 0; i < 3; i++) {
    for (size_t j = 0; j < 3; j++) {
      if (a[i] + b[j] != m[i][j]) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}


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

using namespace std;

int main(){
    int N;
    cin >> N;
    int a[N];
    for(int i=0; i<N; i++) cin >> a[i];
    sort(a, a + N, greater<int>());
    int sumA=0, sumB=0;
    for(int i=0; i<N; i++){
        if(i%2==0) sumA += a[i];
        else sumB += a[i];
    }
    cout << sumA - sumB << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;

class Magatro
{

    static void Main()
    {
        string[] s = Console.ReadLine().Split(' ');
        int a = int.Parse(s[0]);
        int b = int.Parse(s[1]);
        if (a > 0)
        {
            Console.WriteLine("Positive");
        }
        else
        {
            if (b >= 0)
            {
                Console.WriteLine("Zero");
            }
            else
            {
                if ((b - a) % 2 == 0)
                {
                    Console.WriteLine("Negative");
                }
                else
                {
                    Console.WriteLine("Positive");
                }
            }
        }
    }

}

Measured memory_bytes: 2648
/*
A - 9x9 : https://atcoder.jp/contests/abc144/tasks/abc144_a
*/
#include<iostream>
using namespace std;
int main(){
int A,B;
cin>>A>>B;

        if(A<=9 && A>=1 && B<=9 && B>=1){
               cout<<A*B<<endl;
            }
            else{
               cout<<-1<<endl;
            }

} // END


Measured memory_bytes: 256
n = int(input())
h = list(map(int,input().split(" ")))
h.reverse()

for i in range(n - 1):
  h1 = h[i]
  h2 = h[i + 1]
  if h1 >= h2:
    pass
  elif h1 + 1 == h2:
    h[i + 1] = h2 - 1
  else:
    print("No")
    exit()

print("Yes")

Measured memory_bytes: 14396
#include<bits/stdc++.h>
using namespace std;
#define MD 1000000007
int main()
{ 
	long long n;
	cin>>n;
	long long f[n+1]={0};
	for(int i=2;i<=n;i++){
		int a=i;
		for(int j=2;j<=a;j++){
			while(a%j==0){
				f[j]++;
				a/=j;
			}
		}
	}
	long long ans=1;
	for(int i=2;i<=n;i++){
		ans*=(f[i]+1);
		ans%=MD;
	}
	cout<<ans;
	return 0;
}

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

int main(){
  long long int A, B, C;
  cin >> A >> B >> C;
  
  long long int test = C - A - B;

  if (test > 0 && test * test > 4 * A * B){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3544
#include<stdio.h>

#define N 8

int q[N][N],x[N],y[N],jmemo[N],row[N],col[N],dpos[2*N-1],dneg[2*N-1],cnt=0,ok=0;

int judge(int n){
    int k;
    
    for(k=0;k<n;k++){
     
        if(q[x[k]][y[k]]==0){
            return 0;// 2回目はできてない
        }
    }
    
    return 1;
}

void queen(int i,int j,int n){
    int m,l,v,k,a;
    
    if(ok==1)return;
    
    if(row[i]==1&&col[j]==1&&dpos[i+j]==1&&dneg[i-j+N-1]==1&&i<N&&j<N){
        q[i][j]=1;
        row[i]=0;
        col[j]=0;
        dpos[i+j]=0;
        dneg[i-j+N-1]=0;
        jmemo[i]=j+1;
    
         queen(i+1,0,n);
    }
    
    if(j==N){
        q[i-1][jmemo[i-1]-1]=0;
        dpos[i-1+jmemo[i-1]-1]=1;
        row[i-1]=1;
        col[jmemo[i-1]-1]=1;
        dneg[i-1-jmemo[i-1]+1+N-1]=1;
        jmemo[i]=0;
       
        queen(i-1,jmemo[i-1],n);
    }
    
    if(i==N){
      

        a=judge(n);
        if(a!=1){
            q[i-1][jmemo[i-1]-1]=0;
            dpos[i-1+jmemo[i-1]-1]=1;
            row[i-1]=1;
            col[jmemo[i-1]-1]=1;
            dneg[i-1-jmemo[i-1]+1+N-1]=1;
            jmemo[i]=0;
           
            queen(i-1,jmemo[i-1],n);//queen1(jmemo[0])これだと同じ列のときできない サイキが5回してる ここにきた奴らはできてる　来てないやつがいる
        }

        else if(a==1){
            ok=1;
            
            return;
        }
        // 2回目はできてない
    }
     
 queen(i,j+1,n);
}

void queen1(int n){
    int i,j,k,u;//not free=0,free=1

   for(i=0;i<N;i++){
       row[i]=1;
       col[i]=1;
       for(j=0;j<N;j++){
           dpos[i+j]=1;
           dneg[i-j+N-1]=1;
           q[i][j]=0;
       }
   }
   
     queen(0,0,n);
}

int main(){
    int i,j,k,n;

    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d%d",&x[i],&y[i]);
    }
    queen1(n);
    for(i=0;i<N;i++){
        for(j=0;j<N;j++){
            if(q[i][j]==1)printf("Q");
            else printf(".");
        }
        printf("\n");
    }
    return 0;
}



Measured memory_bytes: 2108
import java.util.Scanner;

public class Main {
  static final long MAX_NUMBER = 1000000000000000000L;
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long answer = 1l;
    int n = sc.nextInt();
    long[] values = new long[n];
    for(int i = 0; i < n; i++) {
      values[i] = sc.nextLong();
      if(values[i] == 0){
        System.out.println(0);
        return;
      }
    }
    for(int i = 0; i < n; i++) {
      long tmp = values[i];
      if(MAX_NUMBER / tmp < answer){
        System.out.println(-1);
        return;
      } else {
        answer *= tmp;
      }
    }
    System.out.println(answer);
  }
}

Measured memory_bytes: 62064
#include <stdio.h>
 
int main()
{
    int n=0;
    long long int num[100]={0};
    long long int ke1=0;
    long long int ke2=0;
    long long int ke3=0;
    int count=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%lld",&num[i]);
    }
    if(n<3){
        printf("0");
        return 0;
    }
 
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            if(num[i]!=num[j]){
                for(int k=j+1;k<n;k++){
                    if(num[i]!=num[k] && num[j]!=num[k]){
                        ke1=num[i]+num[j]-num[k];
                        ke2=num[j]+num[k]-num[i];
                        ke3=num[k]+num[i]-num[j];
                        if(ke1>0 && ke2>0 && ke3>0){
                            count++;
                            
                        }
                    }
                }
            }
        }
    }
 
    printf("%d",count);
    return 0;
}

Measured memory_bytes: 1720
fun main(args:Array<String>) {
    val n = readLine()!!.toInt()
    val list = getVariation(n)
    val p = readLine()!!
    val q = readLine()!!
    val ans = Math.abs(list.indexOf(q) - list.indexOf(p))
    println(ans)
}

fun getVariation(len:Int):List<String> {
    val tmp = getVariationSub((1..len).toList())
    return tmp.map { it.joinToString(" ") }
}

fun getVariationSub(remain:List<Int>):List<List<Int>> {
    if(remain.size == 1) {
        return listOf(listOf(remain.first()))
    }
    val ret = mutableListOf<List<Int>>()
    for(i in remain.indices) {
        val newList = remain.indices.filter { it != i }.map { remain[it] }
        val tmp = getVariationSub(newList).toMutableList().map { it.toMutableList() }
        tmp.forEach { it.add(0, remain[i]) }
        ret.addAll(tmp)
    }
    return ret
}

Measured memory_bytes: 63348
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, K;
	cin >> N >> K;
	int res;
	if (K == 1) {
		res = 0;
	}
	else {
		res = N - K;
	}
	cout << res << endl;
}

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

#define rep(i, n) for(long long i=0;i<(long long)(n);i++)
#define rep2(i, s, n) for(long long i=(s);i<(long long)(n);i++)
#define all(v) v.begin(), v.end()

using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<ll, ll>;

const ll INF = (1LL<<60);

int main(){

    ll n, k, d; cin >> n >> k;
    bool sunuke[n];
    rep(i, n){
        sunuke[i] = true;
    }
    rep(i, k){
        cin >> d;
        ll in;
        rep(j, d){
            cin >> in;
            sunuke[in-1] = false;
        }
    }

    ll cnt = 0;
    rep(i, n){
        if(sunuke[i]) cnt++;
    }

    cout << cnt << endl;

    return 0;
}

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

using namespace std;

typedef long long LL;

const int MAX_N = 1e5 + 10;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	int N;
	LL ans = 0, A[MAX_N];
	map<int, int> mp;
	
	cin >> N;
	for (int i = 0; i < N; i++) cin >> A[i], mp[A[i]]++;
	
	vector<LL> vec;
	for (int i = 0; i < N; i++)
	{
		if (mp[A[i]] >= 2)
		{
			if (mp[A[i]] >= 4) ans = max(ans, A[i] * A[i]);
			
			vec.emplace_back(A[i]);
		}//if
	}//for i
	
	sort(vec.begin(), vec.end());
	vec.resize(unique(vec.begin(), vec.end()) - vec.begin());
	
	for (int i = 0; i < (int)vec.size() - 1; i++)
		ans = max(ans, vec[i] * vec[i + 1]);
		
	cout << ans << '\n';
	
	return 0;
}//main

Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,NAME,...) NAME
#define pr(...) GET_MACRO(__VA_ARGS__,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__)
#define pr1(a) (#a)<<"="<<(a)
#define pr2(a,b) pr1(a)<<", "<<pr1(b)
#define pr3(a,b,c) pr2(a,b)<<", "<<pr1(c)
#define pr4(a,b,c,d) pr3(a,b,c)<<", "<<pr1(d)
#define pr5(a,b,c,d,e) pr4(a,b,c,d)<<", "<<pr1(e)
#define int long long
#define double long double
using namespace std;
const int N = 100010;
const int INF = 1LL<<55;
const int mod = (1e9)+7;
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
typedef pair<int,int> P;
typedef long long ll;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
ostream& operator<<(ostream& o,P p){return o<<"("<<p.first<<","<<p.second<<")";}
istream& operator>>(istream& i,P &p){return i>>p.first>>p.second;}
ostream& operator<<(ostream& o,vector<auto> &a){int i=0;for(auto t:a)o<<(i++?" ":"")<<t;return o;}
istream& operator>>(istream& i,vector<auto> &a){for(auto &t:a)i>>t;return i;}
void prArr(auto a,string s=" "){int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;}


bool check(int A,int B,vector<string> mp){

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

  int h = mp.size();
  int w = mp[0].size();
  function<void(int,int,int) > dfs=[&](int x,int y, int col){
    mp[y][x] = '!';
    for(int i=0;i<4;i++){
      int nx = x + dx[i];
      int ny = y + dy[i];
      if(nx < 0 || ny < 0 || nx >= w || ny >= h || mp[ny][nx] != col) continue;
      dfs(nx,ny,col);
    }
  };

  int cntA = 0,cntB = 0;
  for(int i=0;i < h;i++)
    for(int j=0;j < w;j++){
      if(mp[i][j] == '!') continue;
      mp[i][j] == '.'? cntA++:cntB++;
      dfs(j,i,mp[i][j]);
    }
  
  return cntA == A && cntB == B;
}

vector<string> solve(int A,int B){
  
  int K = 50;
  vector<string> mp(K*2);

  for(int i=0;i<K;i++) mp[i] = string(K*2,'#');
  for(int i=0;i<K;i++) mp[K+i] = string(K*2,'.');

  {  
    int a = 1;
    for(int i=0;i<K;i+=2)
      for(int j=0;j<K*2;j+=2){
        if(A == a) continue;
        a++;
        mp[i][j] = '.';
      }
  }

  {
    int b = 1;
    for(int i=0;i<K;i+=2)
      for(int j=0;j<K*2;j+=2){
        if(B == b) continue;
        b++;
        mp[K+i+1][j] = '#';
      }
  }
  return mp;
}

             
signed main(){

  /*for(int i=1;i<=500;i++)
    for(int j=1;j<=500;j++) assert(check(i,j,solve(i,j)));
  */
  
  int A,B;
  cin>>A>>B;
  
  vector<string> ans = solve(A,B);
  assert(check(A,B,ans));

  int h = ans.size();
  int w = ans[0].size();
  cout<<h<<" "<<w<<endl;
  for(int i=0;i<(int)ans.size();i++) cout<<ans[i]<<endl; 
  
  return 0;
}


Measured memory_bytes: 768
n, m, x = map(int, input().split())
book_list = [list(map(int, input().split())) for _ in range(n)]

ans = 10**7
for i in range(2**n):
    uns = [0 for _ in range(m)]
    tmp_ans = 0
    for j in range(n):  # このループが一番のポイント
        if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
            for k in range(1,m+1):
                uns[k-1] += book_list[j][k]  # フラグが立っていたら bag に果物を詰める
            tmp_ans += book_list[j][0]  # 買い物累計額にも加算
        if min(uns) >= x:
            ans = min(ans, tmp_ans)
if ans == 10**7:
    print(-1)
else:
    print(ans)


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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<ll> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

int main(){
	cin.tie(0); ios_base::sync_with_stdio(false);
	int x,y,z; ll k;
	cin >>x >>y >>z >>k;
	VI a(x), b(y), c(z);
	rep(i,x) cin>>a[i];
	rep(i,y) cin>>b[i];
	rep(i,z) cin>>c[i];

	VI ab; ab.reserve(x*y);
	rep(i, x) rep(j, y) ab.push_back(a[i]+b[j]);
	sort(ab.rbegin(), ab.rend());
	if(sz(ab)>k ) ab.resize(k);
	
	VI abc; abc.reserve(z*sz(ab));
	rep(i, sz(ab)) rep(j, z) abc.push_back(ab[i]+c[j]);
	sort(abc.rbegin(), abc.rend());
	
	rep(i, k) cout<< abc[i] <<"\n";
	
	return 0;
}

Measured memory_bytes: 31616
//Beta tumse na ho payega
#include"bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
//#define ll long long int
#define ld long double
#define int long long
#define pb push_back 
#define mod 1000000007
#define mod2 998244353
#define Z(c) (int)(c).size()
#define F first
#define S second
#define nl "\n"
#define mii map<int,int> 
//#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define clber cin.ignore(numeric_limits<streamsize>::max(),'\n')
#define rep(i,iv,n) for(int (i)=(iv);(i)<(n);(i)++)
#define D1(x) cerr <<"At line "<<__LINE__<<" "<<#x<<"="<<x<<nl
#define D2(x,y) cerr <<"At line "<<__LINE__<<" "<<#x<<"="<<x<<" "<<#y<<"="<<y<<nl
#define D3(x,y,z) cerr <<"At line "<<__LINE__<<" "<<#x<<"="<<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<nl
#define pi 3.1415926536
#define BS binary_search
#define LB lower_bound
#define UB upper_bound
#define FO find_by_order
#define OK order_of_key
#define tr(it,ct) for(auto &(it) : (ct))
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > pii;
typedef vector< pii > vp;
typedef tree<int, null_type, less<int>, rb_tree_tag, 
             tree_order_statistics_node_update> 
    baap;
 
int power(int a,int n,int lelo)
{
        if(n==0)
                return 1;
        if(n==1)
                return a;
        if(n==2)
                return (a*a)%lelo;
        if(n%2)
                return (a*power(a,n-1,lelo))%lelo;
        else
                return power(power(a,n/2,lelo),2,lelo)%lelo;
}
ld dpower(ld a,int n)
{
        if(n==0)
                return 1;
        if(n==1)
                return a;
        if(n==2)
                return (a*a);
        if(n%2)
                return (a*dpower(a,n-1));
        else
                return dpower(dpower(a,n/2),2);
}
 
 
void swap(int &a,int &b)
{ auto tm=a; a=b; b=tm; }
 
 const int N=1e5+1;   //Take care of duplicates
 const int INF=1e16;
 
 void solve()
 { 
   string s,t; cin>>s>>t;
   int ans=0;
   rep(i,0,3)
   if(s[i]==t[i])
    ans++;
  cout<<ans;
 } 
signed main()
{  
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
  
 
 
  int t=1;
   
 // cin>>t;
  rep(i,1,t+1)
  { // cout<<"Scenario #"<<i<<":\n";
   solve();
 
   if(i<t)
   cout<<nl;
  }
  
 
 return 0; 
}


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

int main(){
    int n; cin>>n;
    if(10<=n&&n<=99){
        n=n%10;
    }
    else if(100<=n&&n<=999){
        n=n%10;
    }
    if(n==2||n==4||n==5||n==7||n==9) cout<<"hon"<<endl;
    else if(n==3) cout<<"bon"<<endl;
    else cout<<"pon"<<endl;
    return 0;
}

Measured memory_bytes: 3636
a, b, c = map(int, input().split())
count = 0
while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
    if a == b and b == c and c == a:
        count = -1
        break
    a_tmp = a
    b_tmp = b
    c_tmp = c
    a = (b_tmp + c_tmp) / 2
    b = (c_tmp + a_tmp) / 2
    c = (a_tmp + b_tmp) / 2
    count += 1
print(count)


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

using namespace std;

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

    sort(An_sorted.begin(), An_sorted.end(), greater<int>());

    for (int i=0;i<N;i++) {
        if (An[i] == An_sorted[0]) cout << An_sorted[1] << endl;
        else cout << An_sorted[0] << endl;
        // for (int j=0;j<N;j++) {
        //     if (An[i])
        //     // if (An[i] != An_sorted[j]) {
        //     //     cout << An_sorted[j] << endl;
        //     //     break;
        //     // }
        // }
    }
    
    return 0;
}

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

using namespace std;

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

  int ans = 0;
  for (int i = 0; i < n + m; ++i) {
    for (int j = i + 1; j < n + m; ++j) {
      if (i == j) continue;
      int a = (i < n? 2: 1) + (j < n? 2: 1);
      if (a % 2 == 0) {
	ans++;
      }
    }
  }
  cout << ans << '\n';
  return 0;
}



Measured memory_bytes: 256
def calc_sum(num):
    sum_value = 0
    while True:
        if num != 0:
            sum_value += (num % 10)
            num //= 10
        else:
            return sum_value


N, A, B = [int(n) for n in input().split()]
count = 0
for n in range(1, N+1):
    if A <= calc_sum(n) <= B:
        count += n
print(count)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (1E9+7)
#define PI 3.1415926535897932384

std::ostream &operator<<(std::ostream &out, const vector<int> &tgt)
{
	string s;
	for (int i = 0; i<tgt.size(); i++) {
		s += (to_string(tgt[i]) + ((i != tgt.size() - 1) ? " " : ""));
	}
	out << s;
	return out;
}

int main() {
	string s, t;
	string ans = "";
	cin >> s >> t;
	rep(i, s.size() - t.size() + 1) {
		string tmp = s;
		rep(j, t.size()) {
			if (tmp[j + i] == '?'||tmp[j + i] == t[j])tmp[j + i] = t[j];
			else break;
			if (j == t.size() - 1) {
				rep(k, tmp.size())if (tmp[k] == '?')tmp[k] = 'a';
				ans = tmp;
			}
		}
	}
	cout << (ans != "" ? ans : "UNRESTORABLE") << endl;
}


Measured memory_bytes: 256
package main

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

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	n := nextInt()

	ans := nextInt()
	for i := 1; i < n; i++ {
		ans = lcm(ans, nextInt())
	}

	puts(ans)
}

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

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

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	for a%b != 0 {
		a, b = b, a%b
	}
	return b
}

func lcm(a, b int) int {
	return a / gcd(a, b) * b
}


Measured memory_bytes: 640
import java.util.*;

public class Main {

	static void log(String s) {
		System.out.println(s);
	}

	static void log(int i) {
		System.out.println(i);
	}
	
	static void log(long i) {
		System.out.println(i);
	}
	
	// test 4  D
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		
		int k = sc.nextInt();		// num of points
		
		Queue queue;
//		= new Queue();
		try {
			queue = new Queue();
					
//					Main.Queue.class.newInstance();
		}
		catch(Exception e) {
			log( e.toString() );
			return;
		}
		
		
		// initialize until 10
		for (int i=1; i<=9; i++) {
			queue.put(i);
		}
		
		long val=1;
		
		// queue から read しつつ、couunt
		for (int from=1; from<=k; from++) {
			val = queue.get();
			long nextVal;
			
			if (val % 10 != 0) {
				nextVal = 10 * val + (val % 10) - 1;
				queue.put(nextVal);
			}
			nextVal = 10 * val + (val % 10);
			queue.put(nextVal);
			
			// 9 
			if ( (val % 10) != 9 ) {
				nextVal = 10 * val + (val % 10) + 1;
				queue.put(nextVal);
			}
		}
				
		log( val );

		sc.close();
	}
	

}

class Queue{
	Node firstNode;
	Node lastNode;
	
	public Queue(){
		firstNode=null;
		lastNode=null;
	}
	
	long get() {
		long retVal=0;
		if (firstNode != null) {
			retVal = firstNode.val;
			if (firstNode.nextNode != null) {
				firstNode.nextNode.prevNode = null;
				firstNode = firstNode.nextNode;
			}
			if (firstNode == null) {
				lastNode = null;
			}
		}
		else {
			retVal = -1;		// need to handle by caller
		}
		return retVal;
	}
	
	void put(long val) {
		Node newNode = new Node(val);
		if (lastNode != null) {
			newNode.prevNode = lastNode;
			lastNode.nextNode = newNode;
			if (lastNode.nextNode == null)
				firstNode = lastNode;
		}
		// must be empty
		else {
			newNode.prevNode = null;
			newNode.nextNode = null;
			firstNode = newNode;
		}
		lastNode = newNode;
	}
}

class Node{
	long  val;
	Node nextNode;
	Node prevNode;
	
	Node(long v){
		val = v;
	}
}


Measured memory_bytes: 29396
/*I MAY NOT GET THE SUCCESS IMMEDIATELY BUT I WILL GET IT FOR SURE*/
#include<bits/stdc++.h>
#define opt std::ios_base::sync_with_stdio(false)
#define I int
#define li		int32_t
#define lli		long long
#define ulli unsigned long long

#define pn			 printf("\n")
#define nl			 cout<<'\n'
#define sf(N)        scanf("%lld",&N)
#define pf(N)        printf("%lld",N)
#define sf1(N1,N2)    scanf("%lld %lld",&N1,&N2)
#define pf1(N1,N2)    printf("%lld %lld",N1,N2)
#define sf2(N1,N2,N3) scanf("%lld %lld %lld",&N1,&N2,&N3)
#define pf2(N1,N2,N3) printf("%lld %lld %lld",N1,N2,N3)

#define sl          cout<<' '
#define ps          printf(" ")

#define rep(i,a,b)	for(i=a;i<b;i++)
#define repr(i,a,b)	for(i=a;i>b;i--)
#define elif		else if
#define mset(a,b)	memset(a,b,sizeof(a))

#define pb		push_back
#define pob		pop_back
#define itr		iterator
#define sz()	size()
#define szof    sizeof
#define lb		lower_bound
#define ub		upper_bound
#define mp		make_pair
#define vlli    vector<lli>
#define plli	pair<lli,lli>
#define vplli	vector<plli >
#define F   	first
#define S		second
#define Dup     erase(unique(V.begin(),V.end()),V.end())

#define bs      binary_search
#define ub      upper_bound
#define lb      lower_bound

#define ALL(V)  V.begin(),V.end()

#define MX1     100000LL
#define MX2     1000000LL
#define Inf     1000000000000000LL
#define mod		1000000007LL
using namespace std;

lli Power(lli a,lli b)
{
    lli result=1;

    while(b)
    {
        if(b%2)
        {
            result=(result*a)%mod;
        }

        b=b>>1;
        a=(a*a)%mod;
    }

 return result;
}

int main()
{
    opt;

    /*#ifndef ONLINE_JUDGE
    freopen("double_squares.txt","r",stdin);
    freopen("double_squares_out.txt","w",stdout);
    #endif // ONLINE_JUDGE*/

    string s,t;
    cin>>s>>t;

    lli N=s.length(),N1=t.length(),i,j,cnt=0;

    if(N1>N)
    {
        cout<<"UNRESTORABLE\n";
        exit(0);
    }

    repr(i,N-N1,-1)
    {
        bool flag=1;
        rep(j,i,i+N1)
        {
            if(s[j] == '?')
            {
                continue;
            }
            else
            {
                flag=flag&(s[j]==t[j-i]);
            }
        }

        if(flag)
        {
            rep(j,i,i+N1)
            {
                s[j]=t[j-i];
            }

            rep(i,0,N)
            {
                if(s[i]=='?')
                {
                    s[i]='a';
                }
            }

            cout<<s;
            exit(0);
        }
    }

    cout<<"UNRESTORABLE";





 return 0;
}


Measured memory_bytes: 256
str = input()

list = list(str)

i = 0
f = True
for l in list:
    i+=1
    if i%2 != 0:
        if l == "L":
            f=False
            break
    else:
        if l == "R":
            f=False
            break

if(f):
    print("Yes",end="\n")
else:
    print("No",end="\n")

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

    public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    int res =0;
    for(int i=0; i<s.length(); i++) {
    res += (int)(s.charAt(i)-48);
    res = res%9;
    }
    if(res==0)
    System.out.println("Yes");
    else
    System.out.println("No");
     //   System.out.println("Hello World");
    }
}


Measured memory_bytes: 41504
#include <algorithm>
#include <boost/optional.hpp>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0, i##_MACRO = (n); i < i##_MACRO; i++)
#define RANGE(i, a, b) for(int i = (a), i##_MACRO = (b); i < i##_MACRO; i++)
#define EACH(e, a) for(auto&& e : a)
#define ALL(a) std::begin(a), std::end(a)
#define RALL(a) std::rbegin(a), std::rend(a)
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)
#define INT(x) (static_cast<int>(x))
#define PRECISION(x) std::fixed << std::setprecision(x)

using namespace std;

using ll = long long;
using VI = vector<int>;
using VI2D = vector<vector<int>>;

constexpr int INF = 2e9;
constexpr double EPS = 1e-10;
constexpr double PI = acos(-1.0);

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

template <typename T>
constexpr int sign(T x) {
	return x < 0 ? -1 : x > 0 ? 1 : 0;
}

template <>
constexpr int sign(double x) {
	return x < -EPS ? -1 : x > EPS ? 1 : 0;
}

template <typename T, typename U>
constexpr void chmax(T& m, U x) {
	m = max(m, x);
}

template <typename T, typename U>
constexpr void chmin(T& m, U x) {
	m = min(m, x);
}

template <typename T>
constexpr T square(T x) {
	return x * x;
}

int main() {
	int n;
	cin >> n;
	vector<pair<int, int>> xy(n);
	REP(i, n) { cin >> xy[i].first >> xy[i].second; }

	if(n == 1) {
		cout << 1 << endl;
		return 0;
	}

	int result = 0;
	REP(i, n) {
		REP(j, n) {
			if(i == j) {
				continue;
			}
			int x = xy[i].first - xy[j].first;
			int y = xy[i].second - xy[j].second;
			int count = 0;
			REP(k, n) {
				REP(l, n) {
					if(k == l) {
						continue;
					}
					int xx = xy[k].first - xy[l].first;
					int yy = xy[k].second - xy[l].second;
					if(x == xx && y == yy) {
						count++;
					}
				}
			}
			chmax(result, count);
		}
	}

	cout << n - result << endl;
	return 0;
}


Measured memory_bytes: 3620
package main

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

func main() {
	scn := newScanner()
	X := scn.nextLine()
	stack := make([]byte, 0)
	for i := 0; i < len(X); i++ {
		if X[i] == 'S' {
			stack = append(stack, X[i])
		} else if X[i] == 'T' && (len(stack) == 0 || stack[len(stack)-1] == 'T') {
			stack = append(stack, X[i])
		} else if X[i] == 'T' && stack[len(stack)-1] == 'S' {
			stack = stack[:len(stack)-1]
		}
	}
	fmt.Println(len(stack))
}

// func main() {
// 	scn := newScanner()
// 	X := scn.nextLine()
// 	stack := list.New()
// 	for i := 0; i < len(X); i++ {
// 		if X[i] == 'S' {
// 			stack.PushFront(X[i])
// 		} else if X[i] == 'T' && (stack.Len() == 0 || stack.Front().Value.(byte) == 'T') {
// 			stack.PushFront(X[i])
// 		} else if X[i] == 'T' && stack.Front().Value.(byte) == 'S' {
// 			_ = stack.Remove(stack.Front())
// 		}
// 	}
// 	fmt.Println(stack.Len())
// }
type scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func newScanner() *scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 10000)
	return &scanner{r: rdr}
}
func (s *scanner) next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *scanner) nextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *scanner) nextInt() int {
	v, _ := strconv.Atoi(s.next())
	return v
}
func (s *scanner) nextInt64() int64 {
	v, _ := strconv.ParseInt(s.next(), 10, 64)
	return v
}
func (s *scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 3072
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#include<map>
#include<set>
using namespace std;
#define ll long long
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define fi first
#define se second
#define pr(x) cerr<<#x<<"="<<(x)<<endl
#define pri(x,lo) {cerr<<#x<<"={";for (int ol=0;ol<=lo;ol++)cerr<<x[ol]<<",";cerr<<"}"<<endl;}
#define inf 100000000
#define N 1000
int n,k;
int main()
{
	cin>>n>>k;
	cout<<ceil(1.0*(n-1)/(k-1));
}

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

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  int ans = 0;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    if (i % 2 == 0 && a[i] % 2 == 1) ans++;
  }
  cout << ans << endl;
}


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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

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

  CIN(A, B);
  int tmp = B;
  int cnt = 1;
  while (tmp > 0) {
    tmp /= 10;
    cnt *= 10;
  }
  tmp = A * cnt + B;
  REP(i, MAX_N) {
    if (i * i == tmp) {
      OK(true);
      return 0;
    }
    if (i * i > tmp) {
      OK(false);
      return 0;
    }
  }

  return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.nextLine();
		int a = Integer.parseInt(s.substring(0, 2)), b = Integer.parseInt(s.substring(2));
		
		if(isMon(a)) {
			if(isMon(b))
				System.out.println("AMBIGUOUS");
			else
				System.out.println("MMYY");
		} else {
			if(isMon(b))
				System.out.println("YYMM");
			else
				System.out.println("NA");
		}
	}
	
	public static boolean isMon(int x) {
		return x >= 1 && x <= 12;
	}
}


Measured memory_bytes: 21844
import java.util.Scanner;
import java.util.concurrent.LinkedBlockingQueue;

class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		LinkedBlockingQueue<Long> que = new LinkedBlockingQueue<Long>();
		while (true)
		{
			long n = sc.nextInt(),
				k = sc.nextInt();
			if (n == 0 && k == 0) break;
			que.clear();
			long i;
			long total = 0;
			for (i = 0; i < k; i++)
			{
				long a = sc.nextInt();
				que.offer(a);
				total += a;
			}
			long max = total;
			for (; i < n; i++)
			{
				long a = sc.nextInt();
				total = total + a - que.poll();
				que.offer(a);
				max = Math.max(max, total);
			}
			System.out.println(max);
		}
	}
}

Measured memory_bytes: 15000
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int a = Integer.parseInt(s.substring(0, 1));
		int b = Integer.parseInt(s.substring(1, 2));
		int c = Integer.parseInt(s.substring(2, 3));
		int count = 0;
		if (a == 1) count++;
		if (b == 1) count++;
		if (c == 1) count++;
		System.out.println(count);
		sc.close();
	}
}


Measured memory_bytes: 21844
// C++ 14
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)

int main() {
  ll n; cin >> n;
  vector<ll> A(n);
  loop(i,0,n) cin >> A[i];
  int cur = 0, max_ = 0;
  loop(i,1,n) {
    if (A[i]<=A[i-1]) {
      cur++;
      max_ = max(max_, cur);
    } else {
      cur = 0;
    }
  }
  cout << max_ << endl;
  return 0;
}


Measured memory_bytes: 3928
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c,d=3;
    cin>>a>>b>>c;
    if(a==b) d--;
    if(a==c) d--;
    if(b==c) d--;
    if(d) cout<<d<<endl;
    else cout<<1<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<string>
#include<bitset>
#include<cfloat>
#include<iomanip>
#include<numeric>

using namespace std;
using ll =  long long;
using pint =  pair<int,int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vpint = vector<pint>;
#define repi(i,start,end) for(int (i)=(start),TemPNuM=(int)(end);(i)<TemPNuM;++(i))
#define rep(i,end) repi((i),0,(end))
#define rfor(x,v) for(auto& (x) : (v))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fsort(v,lambda) sort(all((v)),(lambda))
#define vin(v) rep(i,(v).size())cin >> (v)[i];
#define vpin(v) rep(i,(v).size())cin>>v[i].first>>v[i].second
//#define int long long
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; }
template<class T>void println(T a){if(cout.precision()!=12)cout<<setprecision(12);cout<<a<<endl;}
//lambda: [](int x, int y){return x<y;}

signed main(void) {
    int n, l; cin >> n >> l;
    vector<string> s(n); vin(s);
    sort(all(s));
    rfor(c, s) {
        cout << c;
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP2(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
#define INF 2e9
typedef long long ll;

int main()
{
    int n,k;
    cin>>n>>k;
    vector<int> a(n);
    REP(i,n) cin>>a[i];

    sort(ALL(a));
    vector<int> cnt;
    int c=1;
    REP(i,n){
        if(i==0) continue;
        if(a[i-1]==a[i]) c++;
        if(a[i-1]!=a[i] || i==n-1){
            cnt.push_back(c);
            c=1;
        }
    }
    sort(ALL(cnt),greater<int>());
    int ans=n;
    if(cnt.size()<k) cout<<0<<endl;
    else{
        REP(i,k) ans-=cnt[i];
        cout<<ans<<endl;
    }

	return 0; 
}

Measured memory_bytes: 2168
#pragma GCC optimize("Ofast",3,"inline")
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	int N; cin>>N;
	vector<int> L(N); rep(i, 0, N) cin>>L[i];
	sort(L.begin(), L.end());
	int c = 0;
	rep(i, 0, N) rep(j, i+1, N){
		if(L[i] == L[j]) continue;
		rep(k, j+1, N){
			if(L[j] == L[k]) continue;
			if(L[k] == L[i]) continue;
			if(L[i] + L[j] > L[k]) c++;
		}
	}
	cout<< c <<endl;
	return 0;
}



Measured memory_bytes: 3572
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;

#define MOD 1000000007
#define INF 1e9+7
#define rep(i, n) for(int i=0; i<n; ++i)
#define rrep(i, m, n) for(int i=m; i<n; ++i)
typedef long long ll;

#define MAX_N 100000
#define MAX_M 100000
#define MAX_V 100
#define MAX_E 100

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

int ddx[] = {-1, 0, 1, 0, -1, 1, -1, 1};
int ddy[] = {0, -1, 0, 1, 1, 1, -1, -1};

//--------------------------

ll n, k;
ll h[MAX_N];
ll dp[MAX_N+1]; //足場iまでのコストの総和の最小値

int main() {

  cin >> n >> k;
  rep(i, n) {
    cin >> h[i];
    dp[i] = INF;
  }

  dp[0] = 0;

  for(int i=0; i<n-1; ++i) {  //渡すDPの回数
    for(int j=0; (j<k)&&(i+j+1<n); ++j) {
      dp[i+j+1] = min(dp[i+j+1], dp[i] + abs(h[i+j+1]-h[i]));
    }
  }

  cout << dp[n-1] << endl;

  return 0;
}


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

int main(){
    string s;
    cin >> s;
    bool app[26];
    for(int i=0;i<26;i++)app[i]=false;
    for(int i=0;i<s.size();i++)app[s[i]-'a']=true;
    for(int i=0;i<26;i++){
        if(!app[i]){
            printf("%c\n",(char)(i+'a'));
            return 0;
        }
    }
    puts("None");
    return 0;
}

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

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

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

  int a, b, c, k;
  cin >> a >> b >> c >> k;
  cout << a+b+c - max({a, b, c}) + max({a, b, c}) * (1LL<<k) << endl;

  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import collections
import itertools as it
import math
import numpy as np

# A = input()
# A = int(input())
# A = map(int, input().split())
# A = list(map(int, input().split()))
# A = [int(input()) for i in range(N)]
#
# c = collections.Counter()

a, b, c = map(int, input().split())

l = [a,b,c]

if len(set(l))==2:
    print('Yes')
else: print('No')

Measured memory_bytes: 12504
#include <bits/stdc++.h>
using namespace std;
 
typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<double> VD;
#define MP make_pair
#define PB push_back
#define X first
#define Y second
 
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ITER(it, a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cout << #a << " = " << a << endl;

const double PI = acos(-1.0);
const LL INF = 1e9 + 47;
const LL LINF = INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//freopen("In.txt", "r", stdin);
	//freopen("In.txt", "w", stdout);
	
	int n;
	cin >> n;
	VI a(n);
	FOR(i, 0, n)
		cin >> a[i];
	sort(ALL(a));
	reverse(ALL(a));
	double ans = 0;
	double kk = 2;
	FOR(i, 0, n)
	{
		ans += a[i] / kk;
		if (i != n - 2)
			kk += kk;
	}
	
	cout << ans << endl;
	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
	return 0;
}


Measured memory_bytes: 256