akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_set>
#include <string>
#include <random>
#include <queue>


using namespace std;

// ans = a ? b : c; // to simplify: if (a) ans = b; else ans = c;
// ans += val; // to simplify: ans = ans + val; and its variants
// index = (index + 1) % n; // index++; if (index >= n) index = 0;
// index = (index + n - 1) % n; // index--; if (index < 0) index = n - 1;
// int ans = (int)((double)d + 0.5); // for rounding to nearest integer
// ans = min(ans, new_computation); // min/max shortcut
// alternative form but not used in this book: ans <?= new_computation;
// some code use short circuit && (AND) and || (OR)

typedef long long ll; // comments that are mixed in with code
typedef pair<int, int> ii; // are aligned to the right like this
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vll;
#define INF 1000000000
#define M_PI 3.14159265358979323846

void printVector2d(vector<vector<int>> a){
    for(int i=0;i<a.size();i++){
        for(int j=0;j<a[i].size();j++){
            cout<<a[i][j]<<" ";
        }
        cout<<endl;
    }
    cout<<"end"<<endl;
}

void printVector(vector<int> a){
    for(int i=0;i<a.size();i++){
        int curr_num = a[i];
        cout<<curr_num<<" ";
    }
    cout<<endl;
}

void printVectorTwo(vector<int> a){
    for(int i=0;i<a.size();i++){
        int curr_num = a[i];
        cout<<curr_num<<" ";
    }
    cout<<endl;
}

void printVectorPair(vector<pair<int,int>> a){
    for(int i=0;i<a.size();i++){
        cout<<"Total "<<i<<": "<<a[i].first<<" "<<a[i].second<<endl;
    }
}

void printMap(map<char, int> mp){
    for(auto x:mp){
        cout<<x.first<<": "<<x.second<<endl;
    }
}

void printMapVec(map<int, vector<int>> mpV){
    for(auto x:mpV){
        cout<<x.first<<": ";
        for(auto y:x.second){
            cout<<y<<" ";
        }
        cout<<endl;
    }
}

void printQueue(queue<char> q){
    while(!q.empty()){
        cout<<q.front()<<" ";
        q.pop();
    }
    cout<<" ##### ";
}

void solve(){
    int N;
    string c;
    cin>>N>>c;

    vi inds_of_R, inds_of_W;

    int curr_streak = 0;

    for(int i=0;i<N;i++){
        if(c[i] == 'W'){
            inds_of_W.push_back(i);
        }else{
            // then is R
            inds_of_R.push_back(i);
        }
    }

    if(inds_of_W.size() == 0 || inds_of_R.size() == 0){
        cout<<0<<endl;
        return;
    }

//    reverse(inds_of_R.begin(), inds_of_R.end());

    int tot_moves_made = 0;
    int j = 0;
    for(int i=inds_of_R.size()-1;i>=0;i--){
        // Try fill streak
        int curr_R_ind = inds_of_R[i];
        int curr_W_ind = inds_of_W[j];

        if(curr_R_ind<curr_W_ind){
            break;
        }

        tot_moves_made++;
        j++;
    }

    cout<<tot_moves_made<<endl;
}

int main() {
    //solve();
    int T;
//    cin >> T;
    T=1;
    for (int case_num = 1; case_num <= T; case_num++) {
//        cout<<"Case #"<<case_num<<": ";
        solve();
    }
    return 0;
}

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

int f(int n){
    if(n!=0){
        int r = n%(-2);
        if(r == -1){
            f(n/(-2) + 1);
            cout << "1";
        }
        else{
            f(n/(-2));
            cout << r;
        }
    }
}

int main(){
    int n;
    cin >> n;
    if(n == 0)
        cout << "0";
    else
        f(n);
}

Measured memory_bytes: 256
import Control.Monad
import Data.List

main = readLn >>= flip replicateM (map read . words <$> getLine) . (subtract 1) >>= let g t [c,s,f] = c + max s ((t + f - 1) `div` f * f) in mapM_ print . map (foldl g 0) . tails

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

int main() {
    int n, m;
    cin >> n >> m;
    int lmax = 0, rmin = n;
    rep(i,m) {
      int l, r;
      cin >> l >> r;
      lmax = max(lmax, l);
      rmin = min(rmin, r);
    }
    int ans = rmin - lmax + 1;
    if (ans <= 0) ans = 0;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstring>
using namespace std;

const int B=999999937;
const int P=1000000007;

vector<long long> gen_hash(const string &s){
	vector<long long> hash(s.size());
	long long c=0;
	for(int i=0;i<s.size();i++){
		c=(c*B+s[i])%P;
		hash[i]=c;
	}
	return hash;
}
long long pow_binary_mod(long long x,long long y,long long mod){
	long long z=1;
	for(;y;y>>=1){
		if((y&1)!=0)z=z*x%mod;
		x=x*x%mod;
	}
	return z;
}

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

	string s;
	cin>>s;
	vector<long long> v=gen_hash(s);

	//int T;
	//for(cin>>T;T--;){
		string q;
		cin>>q;
		long long hash=gen_hash(q)[q.size()-1];
		long long Brev=pow_binary_mod(B,q.size(),P);
		vector<int> r;
		int i=q.size()-1;
		for(;i<s.size();i++){
			if(v[i]==((i==q.size()-1?0:v[i-q.size()])*Brev+hash)%P){
				r.push_back(i-q.size()+1);
			}
		}
		if(!r.empty()){
			for(int i=0;i<r.size();i++)printf("%d\n",r[i]);
			//puts("1");
		}else{
			//puts("0");
		}
	//}
}

Measured memory_bytes: 15144
N = int(input())
A = [int(a) for a in input().split()]

mod = 10**9+7
A.sort()
if N%2 == 1:
    if A[0] == 0:
        ans = 1
        i = 1
        while i < N-1:
            if A[i] == A[i+1] and A[i] == i+1:
                ans *= 2
                ans %= mod
                i += 2
            else:
                ans = 0
                break
    else:
        ans = 0
else:
    ans = 1
    i = 0
    while i < N:
        if A[i] == A[i+1] and A[i] == i+1:
            ans *= 2
            ans %= mod
            i += 2
        else:
            ans = 0
            break
print(ans)

Measured memory_bytes: 13880
import java.util.*;

public class Main{
	public static void main(String[] args){
		//new Main().printHelloWorld();
		//System.out.println(new Main().ITP1_1_B(Integer.parseInt(new Scanner(System.in).next())));
		//new Main().ITP1_1_C();
		new Main().ITP1_1_D();
	}

	public void printHelloWorld(){
		System.out.println("Hello World");
	}

	public int ITP1_1_B(int x){
		return x*x*x;
	}

	public void ITP1_1_C(){
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		System.out.println(a*b + " " + 2*(a+b));
	}

	public void ITP1_1_D(){
		int seconds = new Scanner(System.in).nextInt();
		System.out.println(seconds/3600 + ":" + (seconds%3600)/60 + ":" + (seconds%3600)%60);
	}
}

Measured memory_bytes: 26344
#include <bits/stdc++.h>
#define int long long int
using namespace std;
#define mod 1000000007

int power(int x, int y)
{
    int res = 1;      // Initialize result

     // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x);

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x);
    }
    return res;
}

bool lm[1005];

void sieve(){
	memset(lm, true, sizeof lm);
	for(int i=2; i<=1000; i++){
		if(lm[i]){
			for(int j=2*i; j<=1000; j=j+i) lm[j] = false;
		}
	}
}

int expFactor(int n, int p)
{
    int x = p;
    int exponent = 0;
    while ((n/x) > 0)
    {
        exponent += n/x;
        x *= p;
    }
    return exponent;
}

int32_t main(){
	sieve();
	int n;
	cin>>n;
	int ans = 1;
	for(int i=2; i<=n; i++){
		if(lm[i]){
			int sum = expFactor(n, i);
			ans = (ans * (sum+1)%mod)%mod;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) GET_MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000

inline int extgcd(int a, int b, int& x, int& y){
  x = 1; y = 0;
  int tx = 0, ty = 1;
  while (b != 0){
    int q = a/b, r = a%b;
    int x2 = x - q*tx;
    int y2 = y - q*ty;
    a = b; b = r;
    x = tx; tx = x2;
    y = ty; ty = y2;
  }
  return a;
}

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

  cout << x << " " << y << endl;

  return 0;
}

Measured memory_bytes: 3112
#include<bits/stdc++.h>
using namespace std;
 
#define int             long long
#define ld              long double
#define ff              first
#define ss              second
#define pb              push_back
#define mp              make_pair
#define pii             pair<int, int>
#define mk(arr,n,type)  type *arr=new type[n];
#define vi              vector<int>
#define si              set<int>
#define usi             unordered_set<int>
#define mii             map<int, int>
#define umii            unordered_map<int, int>
#define pqmax           priority_queue<int>
#define pqmin           priority_queue<int, vi, greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define trailzrobits(x) __builtin_ctzll(x)
#define leadzrobits(x)  __builtin_clzll(x)
#define paritybits(x)   __builtin_parityll(x)
#define gcd             __gcd
#define lcm(x, y)       (x * y) / gcd(x, y)
#define mod             1000000007
#define endl            '\n'
#define PI              3.14159265358979323846
#define inf             1e18
#define sp(x,y)         fixed<<setprecision(y)<<x

void __print(int x) {cout<<x;}
void __print(float x){cout<<x;}
void __print(double x){cout<<x;}
void __print(ld x) {cout<<x;}
void __print(char x){cout <<'\''<<x<<'\'';}
void __print(const char *x){cout <<'\"' <<x<<'\"';}
void __print(const string &x) {cout<<'\"'<<x<<'\"';}
void __print(bool x) {cout<<(x?"true":"false");}
template<typename T,typename V>     void __print(const pair<T,V> &x) {cout<<'{';__print(x.first);cout<<',';__print(x.second);cout<<'}';}
template<typename T>                void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}void _print() {cout << "]\n";}
template <typename T,typename... V> void _print(T t, V... v) {__print(t);if(sizeof...(v))cout<<", ";_print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout<<"["<<#x<<"]=[";_print(x)
#else 
#define dbg(x...)
#endif

int power(int x, int y, int p = mod){
    int res = 1;
    x %= p;
    while(y > 0){
        if(y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res; 
}

int inv(int x, int p = mod){
    return power(x, p - 2) % p;
}

const int N = 1e6 + 6;
 
struct item{
    int wt, val;
};
int32_t main(){

    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    int t = 1;
    // cin >> t;
    while(t--){
       
        int n, W; cin>>n>>W; 
        vector<item> a(n+1);
        for(int i=1; i<=n; i++)
            cin>>a[i].wt>>a[i].val;
        
        int maxVal = n * 1000;
        int dp[n+1][maxVal+1];

        for(int v=0; v<=maxVal; v++)
            dp[1][v] = inf;
        dp[1][0] = 0;
        dp[1][a[1].val] = a[1].wt;

        for(int i=2; i<=n; i++){
            for(int v=0; v<=maxVal; v++){
                dp[i][v] = dp[i-1][v];
                if(v >= a[i].val)
                    dp[i][v] = min(dp[i][v], a[i].wt + dp[i-1][v-a[i].val]);
            }
        }

        int ans = 0;
        for(int v=0; v<=maxVal; v++){
            if(dp[n][v] <= W)
                ans = v;
        }
        cout<<ans;
    }

    return 0;

}

Measured memory_bytes: 78464
N=int(input())

def aa():
    c=0
    for i in range(N):
        D=list(map(int,input().split()))
        if(D[0]==D[1]):
            c+=1
            if(c==3):
                return 'Yes'
        else:
            c=0
    return 'No'
print(aa())

Measured memory_bytes: 9180
//つよつよの人のコード
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,a,b;
  cin>>n>>a>>b;
  int s=0;
  for(int i=1;i<=n;i++){
    int x=i;
    int si=0;
    while(x>0){
      si+=x%10;
      x/=10;
    }
    if(si>=a&&si<=b)
      s+=i;
  }
  cout<<s<<endl;
}


Measured memory_bytes: 3560
x=[]
for i in range(3):
  y,z=map(int,input().split())
  x.append(y)
  x.append(z)
a=x.count(1)
b=x.count(2)
c=x.count(3)
d=x.count(4)

if a==3 or b==3 or c==3 or d==3:
  print("NO")
else:
  print("YES")


Measured memory_bytes: 3060
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
 
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ll long long
 
 
 
using namespace std;
void file(){
	#ifndef ONLINE_JUDGE
    	freopen("tst.txt", "r", stdin);
	#endif	
}
int tc;
const int N=3e5+5,M=3e5+5,MOD=1e9+7,OO=1e9;

int a,b;
int main()
{	
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 	//file();

 	ll n;
 	scanf("%lld",&n);
 	ll ans =1e18;
 	for(ll i=1;i*i<=n;i++){
 		if(n%i==0)ans=min(ans,i-1+n/i-1);
 	}
 	printf("%lld\n",ans );
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

int P[200002];
int eranda[200002];

int Find(int A) {
	if (P[A] < 0) return A;
	return P[A] = Find(P[A]);
}

bool Unite(int A, int B) {
	int a = Find(A);
	int b = Find(B);
	if (a == b) return false;
	if (P[a] > P[b]) swap(a, b);
	P[a] += P[b];
	eranda[a] |= eranda[b];
	P[b] = a;
	return true;
}

int Size(int A) {
	return -P[Find(A)];
}

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


	int N, H, W;
	cin >> N >> H >> W;

	pair<int, pair<int, int>> E[100000];
	rep(i, N) {
		int r, c, a;
		cin >> r >> c >> a;
		E[i] = mp(a, mp(r - 1, H + c - 1));
	}
	sort(E, E + N);
	reverse(E, E + N);

	rep(i, H + W) P[i] = -1;
	ll kotae = 0;
	rep(i, N) {
		int r = E[i].second.first;
		int c = E[i].second.second;
		if (Find(r) != Find(c)) {
			if (!(eranda[Find(r)] && eranda[Find(c)])) {
				Unite(r, c);
				kotae += E[i].first;
			}
		}
		else {
			if (eranda[Find(r)] == 0) {
				kotae += E[i].first;
				eranda[Find(r)] = 1;
			}
		}
	}

	co(kotae);


	Would you please return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define sayyes cout<<"Yes"<<endl;
#define sayno cout<<"No"<<endl;
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const int mod =1e9+7;

const int di[]={-1,-1,-1,0,0,1,1,1},dj[]={-1,0,1,-1,1,-1,0,1};


int main()
{
    int h,w;
    cin>>h>>w;
    vector<string> s(h);
    vector< vector<int>> ans(h,vector<int>(w,0));
    rep(i,h)cin>>s[i];
    rep(i,h)rep(j,w)
    {
        rep(k,8)
        {
            int nx=i+di[k];
            int ny=j+dj[k];
            if(nx>=0 && nx<h && ny>=0 && ny<w && s[nx][ny]=='#')
            {
                ans[i][j]++;
            }
        }


    }
    rep(i,h)
    {
        rep(j,w)
        {
            if(s[i][j]=='.')
            {
                cout<<ans[i][j];
            }
            else
            {
                cout<<"#";
            }
            
            
        }
        cout<<endl;
    }
}


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

int main()
{
    while(true){

        int n;
        cin >> n;
        if( n==0 ){
            break;
        }

        vector<int> s(n,0);
        for(auto&& x: s){
            cin >> x;
        }
        int sum = accumulate(s.begin(),s.end(),0);
        double avr = (1.0 *sum) / s.size();
        double sigma {0};
        for(const auto& x:s){
            sigma += (x - avr)*(x - avr);
        }
        cout << fixed << sqrt(sigma/s.size()) << endl;
    }
    return 0;
}


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

    public static void main(String[] args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int n=Integer.parseInt(br.readLine());
        
        /*
        int n=Integer.parseInt(st.nextToken());
        int m=Integer.parseInt(st.nextToken());
        st=new StringTokenizer(br.readLine());
        int[] coin_list=new int[m];
        for(int i=0;i<m;i++){
            coin_list[i]=Integer.parseInt(st.nextToken());
        }
        System.out.println(Arrays.toString(coin_list));
        */
        
        for(int i=0;i<n;i++){
            StringTokenizer st=new StringTokenizer(br.readLine());
            int[] list=new int[10];
            for(int j=0;j<10;j++){
                list[j]=Integer.parseInt(st.nextToken());
            }if(dfs(list,0,0,0)){
                System.out.println("YES");
            }else{
                System.out.println("NO");
            }
        }
    }
    
    
    static boolean dfs(int[] list,int a,int b,int index){
        if(index==list.length) return true;
        if(a<list[index]){
            if(dfs(list,list[index],b,index+1)){
                return true;
            }
        }if(b<list[index]){
            if(dfs(list,a,list[index],index+1)){
                return true;
            }
        }
        return false;
    }
    
}

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

using namespace std;

template <class T>inline T updmax(T &a, T b) { return a = max(a, b); }
template <class T>inline T updmin(T &a, T b) { return a = min(a, b); }

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	int n;
	cin >> n;
	vector<int> a(n, 0);
	for(int i=0; i<n; i++)cin >> a[i];
	int cnt = 0;
	for(int i=0; i < n; i++){
		if(a[i] == i+1)cnt++;
	}
	if(cnt >= n-2){
		cout << "YES" << "\n";
	}else{
		cout << "NO" << "\n";
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 1LL << 60;

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

  int ans = 0;
  for (int i = 0; i < N; i++)
  {
    ans += s[i];
  }
  if (ans % 10 != 0)
    cout << ans << endl;
  else
  {
    bool exist = false;
    sort(s.begin(), s.end(), greater<int>());
    for (int i = N - 1; i >= 0; i--)
    {
      if (s[i] % 10 != 0)
      {
        exist = true;
        ans -= s[i];
        break;
      }
    }
    if (exist)
      cout << ans << endl;
    else
    {
      cout << 0 << endl;
    }
  }
}


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

using namespace std;

#define int int64_t
const int MOD = 1e9+7;

int total[26];

signed main() {
	int n, ans = 1;
	
	cin >> n;
	while(n--) {
		char temp;
		cin >> temp;
		total[temp-'a']++;
	}
	
	for(int i = 0; i < 26; i++) ans = (ans * (total[i]+1)) % MOD;
	cout << ((ans-1) + MOD) % MOD;
}

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

int main(){
  long int a,b,k ;
  cin >> a >> b >> k ;
  if(k<=a){
    cout << a-k << " " << b << endl ;
  }else if(a+b-k>=0){
    cout << 0 << " " << a+b-k << endl ;
  }else{
    cout << "0 0" << endl ;
  }
}

Measured memory_bytes: 256
from collections import deque
h,w = map(int, input().split())

m = [list(input()) for _ in range(h)]
# '#'の数を数えておく
sharp_num = 0
for y in range(h):
    for x in range(w):
        if m[y][x] == '#':
            sharp_num += 1

def bfs(s):
    que = deque([s])
    log = [[0]*w for _ in range(h)]
    while len(que):
        y,x = que.popleft()
        for dy, dx in [(1,0),(-1,0),(0,1),(0,-1)]:
            ny = y + dy
            nx = x + dx
            if not (0<=ny<h and 0<=nx<w) or m[ny][nx] == '#' or log[ny][nx] != 0:
                continue
            log[ny][nx] = log[y][x] + 1
            if (ny,nx) == (h-1, w-1):
                return log[ny][nx]

            que.append((ny,nx))

    return 0

result = bfs((0,0))

if result:
    print(h*w - sharp_num - (result+1))
else:
    print('-1')

Measured memory_bytes: 3444
#include <stdio.h>
int main()
{
    int i, n, m = 0, s = 0, l[11];
    scanf("%d", &n);
    for (i = 0; i < n; i++){    
        scanf("%d", &l[i]);
        s += l[i];
        if(m < l[i]){
            m = l[i];
        }
    }
    printf("%s\n", s-m > m ? "Yes" : "No");
}

Measured memory_bytes: 128
#include<stdio.h>
#include<math.h>
long gcd(long a,long b){
 // printf("%ld %ld\n",a,b);
  
if(a<b){
  long w=a;
  a=b;
  b=w;
}
  //if(b==1)return a;
  if(a%b!=0)return gcd(b,a%b);
  else return b;
}
int main(void){
int n;
  scanf("%d",&n);
  long a[n];
  for(int i=0;i<n;i++){
   	scanf("%ld",&a[i]);
  }
  long l[n],r[n];
  l[0]=a[0];
  //printf("%ld ",l[0]);
  for(int i=1;i<n;i++){
	l[i]=gcd(l[i-1],a[i]);
    //printf("%ld ",l[i]);
  }
  //printf("\n");
  r[n-1]=a[n-1];
  //printf("%ld ",r[n-1]);
  for(int i=1;i<n;i++){
	r[n-1-i]=gcd(r[n-i],a[n-1-i]);
    //printf("%ld ",r[n-1-i]);
  }
  //printf("\n");
  long max=0;
  for(int i=0;i<n;i++){
    long yaku;
    if(i==0)yaku=r[i+1];
    else if(i==n-1)yaku=l[n-2];
    else yaku=gcd(l[i-1],r[i+1]);
   // printf("%ldを抜いた時の最大公約数は%ld\n",a[i],yaku);
    if(yaku>max)max=yaku;
  }
  printf("%ld",max);
  
      return 0;
    }
 


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

using namespace std;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()
#define sortAl(v) sort(all(v))
#define sortAlr(v)          \
  sort(v.begin(), v.end()); \
  reverse(v.begin(), v.end())

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T &a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T &a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
#define INF LLONG_MAX

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);

  ll n;
  cin >> n;

  cout << (n * n) << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INFTY (1<<30)
using namespace std;
int H,heap[2000001];
void maxHeapify(int i){
    int l,r,largest;
    l = i * 2;
    r = i * 2 + 1;
    if( l <= H && heap[l] > heap[i] ) largest = l;
    else largest = i;
    if( r <= H && heap[r] > heap[largest] ) largest = r;

    if( largest != i ){
        swap(heap[i],heap[largest]);
        maxHeapify(largest);
    }
}
void increasekey(int i,int key){
    if( key < heap[i] ) return;
    heap[i] = key;
    while( i > 1 && heap[i/2] < heap[i] ){
        swap(heap[i/2],heap[i]);
        i = i / 2;
    }
}
void insert(int key){
    H++;
    heap[H]=-INFTY;
    increasekey(H,key);
}
int extract(){
    int maxv;
    if( H < 1 ) return -INFTY;
    maxv = heap[1];
    heap[1] = heap[H--];
    maxHeapify(1);
    return maxv;
}
int main(){
    int key;
    string com;
    while(true){
        cin >> com;
        if(com=="end") break;
        if(com=="insert"){
            scanf("%d",&key);
            insert(key);
        }else printf("%d\n",extract());
    }
    return 0;
}



Measured memory_bytes: 7212
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <tuple>
#include <stack>

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
typedef long long ll;
using namespace std;

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main() {
	int a,b; cin >> a >> b;
	cout << (a+b >= 10? "error" : to_string(a+b)) << endl;
}

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

using namespace std;

int main(){
	int a[100001]={};
	int n,tmp;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> tmp;
		a[tmp]+=1;
	}
	int card=0;
	for(int i=0;i<100001;i++){
		if(a[i]!=0)card += a[i]-1; 
	}
	if(card%2==0){
		cout << n-card<<endl;
	}else{
		cout << n-card-1<<endl;
	}
	return 0;
}

Measured memory_bytes: 640
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {

            out.print(((in.nextInt() + in.nextInt()) >= in.nextInt()) ? "Yes" : "No");

        }

    }
}



Measured memory_bytes: 21844
/* Name        : c
 * Creat       : Fri Jul 12 22:30:10 CST 2019
 * Accept      : Fri Jul 12 22:57:08 CST 2019
 * Author      : landcold7
 * Action speaks louder more than words
 */
#include <bits/stdc++.h>
using namespace std;

#define x first
#define y second
#define sz(x) ((int)(x).size())
#ifndef _has_trace
#define trace(...)
#endif
typedef long long ll;

void solve() {
  ll w, h, x, y;
  cin >> w >> h >> x >> y;
  int ok = 0;
  if (x * 2 == w && y * 2 == h) {
    ok = 1;
  }
  cout << h * w / 2.0 << " " << ok << "\n";
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << setprecision(15) << fixed;
  solve();
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var A = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).OrderByDescending(a => a).ToArray();
            double mid = A[0] / 2.0;
            double min = A[0];
            var ans = 0;

            for(var i = 1; i < A.Length; i++)
            {
                if (Math.Abs(mid - A[i]) < min)
                {
                    min = Math.Abs(mid - A[i]);
                    ans = A[i];
                }
            }

            Console.WriteLine(A[0] + " " + ans);
        }
    }
}

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

int gcd(int x,int y);

int main(){
	int x,y;
	cin>>x>>y;
	cout<<gcd(x,y)<<endl;
}

int gcd(int x,int y){
	if(x<y) swap(x,y);
	while(y>0){
		int r = x%y;
		x = y;
		y = r;
	}
	return x;
}

Measured memory_bytes: 3088
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<climits>
#include<set>
#include<utility>
using namespace std;
typedef long long int ll;

int main(){

  int x, ans=1;
  cin >> x;

  for(int i=1; i<x; i++){
    for(int j=2; j<20; j++){
      int tmp=pow(i, j);
      if(tmp<=x){
        ans=max(ans, tmp);
      }
    }
  }
  cout << ans << endl;

	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

int main(){
    vector<string> s(3);
    for(int i=0; i<3; ++i) cin >> s[i];

    for(auto e:s) cout << (char)toupper(e[0]);
    cout << endl;

    return 0;
}

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

const int inf = 1e9;
const ll linf = 1e18;

vector<pair<char, int>> rle(string s)
{
    vector<pair<char, int>> res;
    char c; int l;
    for (int i = 0; i < (int)s.length(); i++) {
        if (i == 0) {
            c = s[i]; l = 1;
        } else if (s[i] == c) {
            l++;
        } else {
            res.push_back({c, l});
            c = s[i]; l = 1;
        }
    }
    res.push_back({c, l});
    return res;
}

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

    string s; cin >> s;
    auto r = rle(s);
    ll ans = 0;
    for (int i = 0; i < r.size(); i++) {
        if (i < r.size() - 1 && r[i].first == '<' && r[i+1].first == '>') {
            if (r[i].second > r[i+1].second) {
                ans += (ll)r[i].second * (r[i].second + 1) / 2 + (ll)r[i+1].second * (r[i+1].second - 1) / 2;
            } else {
                ans += (ll)r[i].second * (r[i].second - 1) / 2 + (ll)r[i+1].second * (r[i+1].second + 1) / 2;
            }
            i++;
        } else {
            ans += (ll)r[i].second * (r[i].second + 1) / 2;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3864
#include<bits/stdc++.h>
#define ull unsigned long long
# define ll long long
# define mod 1000000007LL 
using namespace std;
int main()
{
     ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<max(a*c,max(b*d,max(b*c,a*d)));
    
    
    return 0;
}

Measured memory_bytes: 3648
import qualified Data.IntMap as M
 
main = do
  getLine
  as <- map read . words <$> getLine
  print $ solve as
 
solve = calc . count
 
count as = M.fromListWith (+) $ zip as (repeat 1)
 
calc = M.foldrWithKey op 0
 
op k v s
  | k <= v = s + v - k
  | otherwise = s + v

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

long long N;
string S;
set<long long> R;
set<long long> G;
set<long long> B;

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

	for(long long i = 0; i < N; i++) {
		if(S[i] == 'R') {
			R.insert(i);
		} else if (S[i] == 'G') {
			G.insert(i);
		} else {
			B.insert(i);
		}
	}


	long long ans = 0;
	for(auto ridx: R) {
		for(auto gidx: G) {
			ans += B.size();
			// r, g, b
			if(ridx < gidx) {
				long long bidx = gidx + (gidx - ridx);
				if(B.count(bidx)>0) {
					ans--;
				}
			}
			// r, b, g
			if(ridx + 1 < gidx) {
				if((gidx - ridx)%2 == 0) {
					long long bidx = ridx + (gidx - ridx)/2;
					if(B.count(bidx)>0) {
						ans--;
					}
				}
			}

			// g, r, b
			if(gidx < ridx) {
				long long bidx = ridx + (ridx - gidx);
				if(B.count(bidx)>0) {
					ans--;
				}
			}

			// g, b, r
			if(gidx + 1 < ridx) {
				if((ridx - gidx)%2 == 0) {
					long long bidx = gidx + (ridx - gidx)/2;
					if(B.count(bidx)>0) {
						ans--;
					}
				}
			}

			// b, g, r
			if(gidx < ridx) {
				long long bidx = gidx - (ridx - gidx);
				if(B.count(bidx)>0) {
					ans--;
				}
			}

			// b, r, g
			if(ridx < gidx) {
				long long bidx = ridx - (gidx - ridx);
				if(B.count(bidx)>0) {
					ans--;
				}
			}
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 3724
// 1_agc032_a
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define INF (1e16)
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    list<int> b;
    rep1(i, n) {
        int tmp;
        cin >> tmp;
        b.push_back(tmp);
    }

    list<int> a;
    rep(i, n){
        int k = -1;
        int cnt = 1;
        auto j = b.begin();
        for(auto itr = b.begin(); itr != b.end(); itr++){
            if(cnt == *itr){
                if(k < *itr){
                    k = *itr;
                    j = itr;
                }
            }
            cnt++;
        }
        if(k == -1){
            cout << -1 << endl;
            return 0;
        }
        b.erase(j);
        a.push_front(k);
    }

    for(auto itr = a.begin(); itr != a.end(); itr++){
        cout << *itr << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;
#define ll long long
#define pb push_back

int main()
{
    int n, r, j=0,c;
    vector<int> x;

    while (1)
    {
        cin >> n >> r;
        if (n == 0 || r == 0)
        {
            break;
        }
        vector<int> a(n);
        for(int i=1;i<=n;i++){ // a[n] を一番上とする
            a[i-1] = i;
        }
        int p,c;
        for (int i = 0;i<r;i++)
        {
            cin >> p >> c;
            for(int j = 0; j < c; j++){
                a.push_back(a[n-p-c+1]); // p番目を取り出す
                a.erase(a.begin()+(n-p-c+1));
            }
            // for(int i=0;i<n;i++){ // a[n] を一番上とする
            //     cout << a[i];
            // }
            // cout << endl;
        }
        x.push_back(a[n-1]);
        j++; 
    }
    for(int i=0;i<j;i++){
        cout << x[i] << endl;
    }
}



Measured memory_bytes: 3164
#include    <iostream>

using namespace std;

int main() {
    while(1) {
        double a1[2], a2[2], b1[2], b2[2];

        cin >> a1[0] >> a1[1] >> a2[0] >> a2[1] >> b1[0] >> b1[1] >> b2[0] >> b2[1];
        if(cin.eof()) break;

        // 重なっていない場合は、x座標またはy座標について、
        // a2 < b1 または b2 < a1 が成立しているときは衝突していない
        if(a2[0] < b1[0] || b2[0] < a1[0] || a2[1] < b1[1] || b2[1] < a1[1] )
            cout << "NO" << endl;
        else
            cout << "YES" << endl;
    }

    return 0;
}


Measured memory_bytes: 3048
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;

 
lint fac[MAX], finv[MAX], inv[MAX];

void COMinit() // 二項係数を求める時は前処理としてCOMinit()をする
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return 0;
        }
    }

    // 素数である
    return 1;
}
   
    
  int main(){
      lint N,K;
      cin>>N>>K;
      lint ans=0;
      lint x=1;
      while(1){
          ans++;
          x*=K;
          if(N<x)break;
      }
      cout<<ans;
    }
     
  


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007
#define MAX 1000005
#define ll long long
#define slld(t) scanf("%I64d",&t)
#define sd(t) scanf("%d",&t)
#define ss(x) scanf("%s",x)
#define pd(t) printf("%d\n",t)
#define plld(t) printf("%I64d\n",t)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tr(container,it) for(typeof(container.begin()) it=container.begin();it!=container.end();it++)
#define mp(a,b) make_pair(a,b)
#define FF first
#define SS second
#define pb(x) push_back(x)
#define ub upper_bound
#define lb lower_bound
#define vi vector<int>
#define vpii vector<pii >
#define vll vector<ll>
#define clr(x) memset(x,0,sizeof(x))
#define cler(x) memset(x,-1,sizeof(x))
#define fil(x) memset(x,MAX,sizeof(x))
#define sws ios::sync_with_stdio(false); cin.tie(0)
#define pi acos(-1)
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPR(I, A, B) for (int I = (A); I > (B); --I)
using namespace std;
const ll INF = 2147483647;
ll digitsum (ll num)
{
    ll sum = 0 ;
    while (num != 0)
    {
        sum+=(num%10);
        num/=10;
    }
    return sum;
}
#define matrix vector< vector<ll> >
matrix matmul(matrix &a, matrix &b){
    int i, j, k, n = a.size();
    matrix ans (n, vector<ll>(n));
    for(i=0;i<n;i++)
        for(j=0;j<n;j++){
            ll temp = 0;
            for(k=0;k<n;k++)    temp = (temp + a[i][k] * b[k][j]) % MOD;
            ans[i][j] = temp;
        }
    return ans;
}
matrix matpwr(matrix &a, ll p)
{
    int n = a.size();
    matrix ans(n, vector<ll> (n));
    for(int i=0;i<n;i++)    ans[i][i] = 1;
    while(p)
    {
        if(p&1) ans = matmul(ans, a);
        a = matmul(a, a);
        p >>= 1;
    }
    return ans;
}
ll pwr(ll base, ll p, ll mod = MOD)
{
    ll ans = 1;
    while(p)
    {
        if(p & 1)   ans = (ans * base) % MOD;
        base = (base * base) % MOD;
        p /= 2;
    }
    return ans;
}
ll gcd(ll a, ll b){
    if(b == 0)  return a;
    return gcd(b, a%b);
}
ll lcm(ll a, ll b){
    return (a*b) / gcd(a, b);
}
bool isPrime[MAX];
void sieve(int n) 
{
    for(int i = 0; i <= n;++i) 
    {
        isPrime[i] = true;
    }
    isPrime[0] = false;
    isPrime[1] = false;
    for(int i = 2; i * i <= n; ++i) 
    {
         if(isPrime[i] == true) 
         {
             for(int j = i * i; j <= n ;j += i)
                 isPrime[j] = false;
        }
    }
}
bool cmp(const pair<int,int> &a, const pair<int,int> &b)
{
    return (a.first > b.first);
}
const int N = 1e5+5 ;
int main()
{
    sws;
    //clock_t clk;
    //clk = clock();
    //freopen("A.in", "r", stdin); 
    //freopen("A.out", "w", stdout);

    ll x, a, b;
    cin >> x >> a >> b;
    int bb = 0;
    bb -= a;
    bb += b;
    if(bb > x) cout << "dangerous";
    else if(bb > 0) cout << "safe";
    else if(bb <= 0) cout << "delicious";

    //clk = clock() - clk;
    //cout << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
#define ll long long 
const int maxn = 1e6 + 5;
int a[maxn];
int main()
{
	int T;int a = 0, b = 0, c = 0, d = 0;
	cin >> T;
	while(T--)
	{ string s;
			cin >> s;
			if (s[0] == 'A')a++;
			else if (s[0] == 'W')b++;
			else if (s[0] == 'T')c++;
			else if (s[0] == 'R')d++;
	}	cout << "AC x " << a << endl;
		cout << "WA x " << b << endl;
		cout << "TLE x " << c << endl;
		cout << "RE x " << d << endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define INF 5000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main() {
  ll N;
  cin >> N;
  vector<ll> A(N), B(N);
  for (ll i = 0; i < N; ++i) {
    cin >> A.at(i) >> B.at(i);
  }
  sort(A.begin(), A.end());
  sort(B.begin(), B.end());
  if (N % 2 == 1) {
    ll mid = N / 2;
    cout << B.at(mid) - A.at(mid) + 1 << "\n";
  }
  else {
    ll mid = N / 2;
    ll m = A.at(mid) + A.at(mid - 1);
    ll M = B.at(mid) + B.at(mid - 1);
    cout << M - m + 1 << "\n";
  }
}


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

using namespace std;

typedef int in;
#define int long long

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


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

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
    // 3
    // 1 2
    // 1 3
    // 1 4
    // のようなタイプ
    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
  }
fn main() {
    input! {
        a: i64,
        b: i64
    }

    let mut ans = 1;
    for i in 1..4 {
        if i as i64 == a {
        } else if i as i64 == b {
        } else {
            ans = i;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
mod=1000000007

n=int(input())
t=list(map(int,input().split()))

t.sort()

f=1

if n%2==1:
    for i in range(n):
        if not t[i]//2==(i+1)//2 or t[i]%2==1:
            f=-1
else:
    for i in range(n):
        if not t[i]//2==i//2 or t[i]%2==0:
            f=-1

if f<0:
    print(0)
else:
    ans=1
    for i in range(n//2):
        ans=(ans*2)%mod
    print(ans)
        

Measured memory_bytes: 14008
package main

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

func main() {
	scan := bufio.NewScanner(os.Stdin)
	scan.Split(bufio.ScanWords)
	scan.Scan()
	//n, _ := strconv.Atoi(scan.Text())
	scan.Scan()
	k, _ := strconv.Atoi(scan.Text())
	scan.Scan()
	s := scan.Text()

	sRune := []rune(s)

	for i := range sRune {
		if i == k-1 {
			fmt.Print(strings.ToLower(string(sRune[i])))
		} else {
			fmt.Print(string(sRune[i]))
		}
	}
}

Measured memory_bytes: 640
using System;
using System.Collections.Generic;

namespace AtCoder {

    class Program {

        const string Keyence = "keyence";
        const string KeyenceReverse = "ecneyek";
        static void Main(string[] args) {

            var S = Console.ReadLine();

            var list = new List<char>(S.ToCharArray());

            var result = false;
            var numLeft = 0;
            var numRight = 0;

            foreach(var ch in list) {

                if(ch == Keyence[numLeft]) {
                    numLeft++;
                } else {
                    break;
                }
            }

            list.Reverse();

            foreach (var ch in list) {

                if(numLeft + numRight == 7) {

                    result = true;
                    break;
                }

                if (ch == KeyenceReverse[numRight]) {

                    numRight++;
                } else {

                    break;
                }
            }
            Console.WriteLine(result ? "YES" : "NO");
        }
    }
}


Measured memory_bytes: 13268
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using lint = 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; }

int main() {
  int N;
  cin >> N;
  int H[N];
  rep(i, N) {
    cin >> H[i];
  }
  int ans = 0;
  int max = H[0];
  rep(i, N) {
    if (max <= H[i]) {
      ans++;
      max = H[i];
    }
  }
  cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
int main(){
    string s;
    cin >> s;
    int ans;
    s.erase(s.length()-1);
    while(true){
            if(s.substr(0,s.length()/2)==s.substr(s.length()/2,s.length()-s.length()/2)){
                ans = s.length();
                break;
        }else{
            s.erase(s.length()-1);
        }
    }
    cout << ans << endl;
}

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

using namespace std;

int gcd(int a, int b) {
    if(a == 0) return b;
    if(b == 0) return a;

    if(a < b) return gcd(b,a);
    return gcd(b, a%b);
}

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

    vector<int> L(N+2), R(N+2);
    L[0] = 0; R[N+1] = 0;
    for(int i=1;i<=N;i++) {
        L[i] = gcd(L[i-1], A[i-1]);
    }

    for(int j=N;j>=1;j--) {
        R[j] = gcd(R[j+1], A[j]);
    }

    int ans = 0;
    for(int i=1;i<=N;i++) {
        ans = max(ans, gcd(L[i], R[i+1]));
    }
                
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1408