akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = 2147483647;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//


int main() {

    int N; cin >> N;
    int a[N]; 
    rep(i,N) cin >> a[i];

    int one, two, four;
    two = four = 0;
    rep(i,N) {
        if (a[i] % 4 == 0) ++four;
        else if (a[i] % 2 == 0) ++two;
        else ++one;
    }
    bool flag = false;
    if (two == 0) {
        if (four + 1 >= one) flag = true;
    }
    else {
        if (four >= one) flag = true;
    }
    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    

    return 0;
}






Measured memory_bytes: 640
import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int[] inputArray = new int[100];

	while (sc.hasNextInt()) {
	    int input = sc.nextInt();
	    for (int i = 0; i < 100; i++) {
		if ((i + 1) == input) {
		    inputArray[i] = inputArray[i] + 1;
		    break;
		}
	    }
	}

	/**
	 * ?????§????????????
	 */
	int max = 0;
	for (int i = 0; i < 100; i++) {
	    max = Math.max(max, inputArray[i]);
	}

	/**
	 * ??????????????????
	 */
	for (int i = 0; i < 100; i++) {
	    if (max == inputArray[i]) {
		System.out.println(i + 1);
	    }
	}
    }
}

Measured memory_bytes: 26256
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    string s, t;
    cin >> s >> t;
    int n = s.size();
    unordered_map<char, vector<int>> pos;
    for(int i = 0; i < n; i++) {
        pos[s[i]].push_back(i);
    }
    ll ans = -1;
    for(char c: t) {
        if (pos.count(c) == 0) {
            cout << -1 << endl;
            return 0;
        }
        ll major = ans / n;
        ll minor = ans % n;
        auto it = upper_bound(pos[c].begin(), pos[c].end(), minor);
        if (it != pos[c].end()) {
            ans = major * n + (*it);
        } else {
            ans = (major+1) * n + pos[c][0];
        }
    }
    cout << ans + 1 << endl;
    return 0;
}



Measured memory_bytes: 1228
#!usr/bin/env python3

import sys


def main():
    WINNING_HANDS = [
                '111', '222', '333', '444', '555', '666', '777', '888', '999',
                '123', '234', '345', '456', '567', '678', '789'
            ]

    num_of_datasets = int(sys.stdin.readline().strip('\n'))
    datasets = [{'R': [], 'G': [], 'B': []} for _ in range(num_of_datasets)]
    results = list()

    for dataset in range(num_of_datasets):
        n_set = [num for num in sys.stdin.readline().strip('\n').split()]
        c_set = [colour for colour in sys.stdin.readline().strip('\n').split()]
        for idx, colour in enumerate(c_set):
            if colour == 'R':
                datasets[dataset]['R'].append(n_set[idx])
            elif colour == 'G':
                datasets[dataset]['G'].append(n_set[idx])
            elif colour == 'B':
                datasets[dataset]['B'].append(n_set[idx])

        match_count = int()

        for rgb_key in datasets[dataset]:
            nums = sorted(datasets[dataset][rgb_key])

            for hand in WINNING_HANDS:
                while hand[0] in nums and hand[1] in nums and hand[2] in nums:
                    tmp = nums.copy()
                    if hand[0] in tmp:
                        tmp.pop(tmp.index(hand[0]))
                        if hand[1] in tmp:
                            tmp.pop(tmp.index(hand[1]))
                            if hand[2] in tmp:
                                tmp.pop(tmp.index(hand[2]))
                                match_count += 1
                                nums = tmp
                            else:
                                break
                        else:
                            break
                    else:
                        break

                    if match_count == 3:
                        results.append(1)
                        continue

        if dataset < num_of_datasets and match_count != 3:
            results.append(0)

    for result in results:
        print(result)


if __name__ == '__main__':
    main()

Measured memory_bytes: 7804
#include <bits/stdc++.h>
#include <string>
using namespace std;
int main(void){
	string x;
	int a,b;
	while(true){
		cin>>x;
		if(x == "-")break;
		cin>>a;
		for(int i = 0;i<a;i++){
			cin>>b;
			for(int j = 0;j<b;j++){
				char c = x.at(i);
				x += x.at(0);	
				x.erase(0,1);
			}
		}
		cout<<x<<endl;
	}
	return 0;
}


Measured memory_bytes: 3204
#include <bits/stdc++.h>
using namespace std;
string s;
int main(){
	cin>>s;
	reverse(s.begin(),s.end());
	s[0]-='0';
	if(s[0]==3)puts("bon");
	else if(s[0]==0 || s[0]==1 || s[0]==6 || s[0]==8)puts("pon");
	else puts("hon");
}

Measured memory_bytes: 3592
#include <iostream>
#include <algorithm>       // for next_permutation
#include <vector>
#include <bits/stl_numeric.h>
#include <queue>

#define DEBUG 0
#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;

static const int MAX = 510000;

int main() {

    string s,res;
    cin >> s;
    res = "No";
    REP(i,3)
    {
        if(s[i] == '7')res = "Yes";
    }
    cout << res << endl;
    return 0;
}


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

int main(){
  int D;
  cin>>D;
  int C[26];
  map<int,int>mp;
  for(int i=0;i<26;i++){
    cin>>C[i];
    if(C[i]>10){
      mp[i]++;
    }   
  }
  int S[365][26];
  for(int i=0;i<365;i++){
    for(int j=0;j<26;j++){
      cin>>S[i][j];
    }
  }
  
  
  //cout<<mp[0]<<" "<<mp[1]<<endl;
  
  
  int flag=1;
  int temp=0;
  int now=0;
  int maxans=0;
  while(temp<365){
    maxans=0;
    now=0;
    for(int i=0;i<26;i++){
      if(S[temp][i]>maxans){
        now=i;
        maxans=S[temp][i];
      }
    }
    if(maxans>5000){
      cout<<now+1<<endl;
      temp++;
      continue;
    }

    if(mp[temp%26]==1){
      cout<<temp%26+1<<endl;
    }
    else{
      if(flag){
        cout<<temp%26+1<<endl;
        flag=0;
      }
      else{
        cout<<(temp+3)%26+1<<endl;
        flag=1;
      }
    }
    temp++;
  }
  
  return 0;
}



Measured memory_bytes: 3652
def main():
    n = int(input())
    a_list = list(map(int, input().split()))

    num = 1
    for a in a_list:
        if a == num:
            num += 1
    
    if num == 1:
        print(-1)
    else:
        print(n - num + 1)


if __name__ == "__main__":
    main()


Measured memory_bytes: 92372
object Main extends App {
  val inputs: Seq[String] = scala.io.Source.stdin.getLines().toList
  val oddStr = inputs.head

  println(solve(oddStr))

  private def solve(oddStr: String): Int = {
    val size   = oddStr.size

    Range.inclusive(2, size, 2) .foreach { i =>
      val str = oddStr.dropRight(i)
      val part = str.splitAt(str.size / 2)
      if(part._1 == part._2) {
        return size - i
      }
    }

    -1
  }
}

Measured memory_bytes: 54952
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int n;cin>>n;
    int honest[n][n];
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            honest[i][j]=-1;
        }
    }
    for(int i=0;i<n;i++){
        int a;cin>>a;
        for(int j=0;j<a;j++){
            int x,y;cin>>x>>y;x--;
            honest[i][x]=y;
        }
    }
    int res = 0;
    for(int tmp=0;tmp<(1<<n);tmp++){
        bitset<15> s(tmp);
        bool jud = true;
        for(int i=0;i<n;i++){
            if(s[i]!=1)continue;
            for(int j=0;j<n;j++){
                if(honest[i][j]==1&&s[j]==0){
                    jud=false;
                }
                else if(honest[i][j]==0&&s[j]==1){
                    jud=false;
                }
            }
        }
        if(jud){
            int ans = 0;
            for(int i=0;i<n;i++){
                if(s[i]==1)ans++;
            }
            res = max(res,ans);
        }
    }
    cout<<res<<endl;
}


Measured memory_bytes: 256
/*
Author : Xinyuan
*/
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef long long int ll;
const int INF = 1e9 + 7;
const int mod = 1e9 + 7;
ll powmod(ll a, ll b) {
    ll res = 1;
    a %= mod;
    assert(b >= 0);
    for (; b; b >>= 1) {
        if (b & 1) res = res * a % mod;
        a = a * a % mod;
    }
    return res;
}
int nxt() {
    int x;
    scanf("%d", &x);
    return x;
}

void add_self(int& a, int b) {
    a += b;
    if (a > mod) a -= mod;
}
int n;
struct M {
    VVI t;
    M() {
        t.resize(n, VI(n));
    }
    M operator*(const M& b) const {
        M c = M();
        REP(i, n)
        REP(j, n)
        REP(k, n)
        add_self(c.t[i][k], ((ll)t[i][j] * b.t[j][k]) % mod);
        return c;
    }
};

int main() {
    ll k;
    cin >> n >> k;
    VVI can(n, VI(n));
    REP(i, n)
    REP(j, n)
    cin >> can[i][j];
    M answer = M();
    REP(i, n)
    answer.t[i][i] = 1;
    M m = M();
    m.t = can;
    while (k) {
        if (k % 2) answer = answer * m;
        m = m * m;
        k /= 2;
    }
    int total = 0;
    REP(i, n)
    REP(j, n)
    add_self(total, answer.t[i][j]);
    printf("%d\n", total);
    return 0;
}


Measured memory_bytes: 3776
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef  unsigned long long int ull;
typedef pair<ll,ll> P;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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 (a>b) { a=b; return 1; } return 0; }
int h,w;
bool usedb[500][500];
bool visited[500][500];
V<int> dx={-1,0,1,0},dy={0,-1,0,1};
V<string> s;
ll dfs(int x,int y,ll &b){
    ll cnt=0;
    if(s[x][y]=='.')cnt++;
    if(s[x][y]=='#'){b++;usedb[x][y]=false;}
   for(int i=0;i<4;i++){
       int nx=dx[i]+x,ny=dy[i]+y;
       if(nx<0||nx>=h||ny<0||ny>=w)continue;
       if(visited[nx][ny])continue;
       if(s[x][y]==s[nx][ny])continue;
       visited[nx][ny]=true;//通りではなく辿りつけるペア数なのでdfsの後にfalseしない
       cnt+=dfs(nx,ny,b);
   }
   return cnt;
}
int main(){
cin>>h>>w;
s.resize(h);
for(int i=0;i<h;i++)cin>>s[i];
for(int i=0;i<h;i++){
    for(int j=0;j<w;j++)if(s[i][j]=='#')usedb[i][j]=true;
}
ll ans=0;
for(int i=0;i<h;i++){
    for(int j=0;j<w;j++)if(usedb[i][j]){
        //通りではなく辿りつけるペア数なのでdfsの後にfalseしない
        visited[i][j]=true;
        usedb[i][j]=false;
        ll cnt=0;//条件を満たす通りにある黒いマスも他の白いマスに辿りつけるのでカウントする
        ll times=dfs(i,j,cnt);
        ans+=times*cnt;// 辿り着ける白いマス*辿りつける黒いマス
    }
}
cout<<ans<<"\n";
}



Measured memory_bytes: 20736
#include<iostream>
#include<cstdio>
#include<algorithm>
#define ABS(x) ((x) < 0 ? (x)*(-1) : (x))
using namespace std;
int main(void){
	int n=0;
	cin>>n;
	int a,b,t;
	int x,y,now;
	x=0;
	y=x;
	now=0;
	bool check=true;
	for(int i=0;i<n;i++){
		cin>>t>>a>>b;
		int proc=ABS(x-a)+ABS(y-b);
		if(t-now < proc){
			check=false;
		}
		if(proc==t-now){
			x=a;
			y=b;
			now=t;
		}else{
			if(((t-now-proc) % 2)==0){
				x=a;
				y=b;
				now=t;
			}else{
				check=false;
			}
		}
	}
	if(check){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
    return 0;
}

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

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

const int B = 321;
int N;
string S;
int dp[500001];
int num[500001];
int T[500001];
int pB[500001];
bool good_prefix[500000], good_suffix[500000];

inline int rhash(int l, int r) {
  return (1LL * ((T[r]+MOD-(l>0?T[l-1]:0))%MOD) * pB[N-l]) % MOD;
}

bool cycle(int l, int r, int d) {
  if (2*d > r-l+1) return false;
  // [l, r-d] = [l+d, r]
  return rhash(l, r-d) == rhash(l+d, r);
}

bool is_good(int l, int r) {
  int n = r-l+1;
  int til = sqrt(n);
  for (int d=1; d<=til; d++) {
    if (n % d) continue;
    if (cycle(l, r, d)) return false;
    if (cycle(l, r, n/d)) return false;
  }
  return true;
}

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> S;
  N = S.length();
  pB[0] = 1;
  for (int i=1; i<=500000; i++) pB[i] = (1LL*pB[i-1]*B) % MOD;
  rep(i, N) {
    T[i] = (1LL*pB[i]*S[i])%MOD;
    if (i > 0) T[i] = (T[i] + T[i-1]) % MOD;
  }

  bool same = true;
  rep(i, N-1) if (S[i] != S[i+1]) same = false;
  if (same) {
    cout << N << "\n";
    cout << 1 << "\n";
    return 0;
  }
  if (is_good(0, N-1)) {
    cout << 1 << "\n";
    cout << 1 << "\n";
    return 0;
  }
  rep(i, N) if (is_good(0    , i  )) good_prefix[i] = true;
  rep(i, N) if (is_good(N-1-i, N-1)) good_suffix[i] = true;
  int s = 0;
  for (int p=1; p<=N-1; p++) {
    if (good_prefix[p-1] && good_suffix[N-1-p]) s++;
  }
  cout << 2 << "\n";
  cout << s << "\n";
  return 0;
}


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

#define faster  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#define sq(x)   (x)*(x)
#define PI      acos(-1.0)
#define all(x) x.begin(),x.end()
#define nl      '\n'

typedef long long int ll;
typedef unsigned long long int  llu;


int main()
{
	faster;
	int n,i,sum=0;
	cin>>n;
	int l=2*n;
	int a[l+1];
	for(i=0;i<l;i++)cin>>a[i];
	sort(a,a+l);
	for(i=0;i<l;i+=2)sum+=a[i];
	cout<<sum<<nl;
	return 0;
}


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

const ll mod=1000000007;

int main() {
  double a,b,h,m,x,y,z;
  cin >> a >> b>>h>>m;
  x=30*h+m*0.5;
  y=6*m;
  z=sqrt(a*a+b*b-2*a*b*cos((x-y)/180*3.14159265359));
  printf("%.11lf",z);
}


Measured memory_bytes: 4192
#include <stdio.h>
#include <vector>
#include <set>

#define MYSCAN scanf

int primejudg(int num);

std::vector<int> prime_v;
std::set<int> prime_s;
int prime_size;

int main(void){

	int max = 0;
	int i, n, count;

	prime_s.insert(2);
	prime_s.insert(3);
	prime_v.push_back(2);
	prime_v.push_back(3);
	prime_size = 2;

	while (true){

		MYSCAN("%d", &n);
		if (n == 0){ break; }
		count = 0;


		// DPテ」ツ?ョティツカツウテ」ツつ甘」ツ?ェテ」ツ??」ツ?ィテ」ツ?禿」ツつ催」ツつ津ィツ」ツ愿・ツョツ?
		for (i = prime_v[prime_size - 1] + 2; i <= n; i += 2){
			if (primejudg(i) == 0){
				prime_s.insert(i);
				prime_v.push_back(i);
				prime_size++;
			}
		}

		// setテ」ツ?ョテ、ツクツュテ」ツ?ォテァツ崢クテヲツ鳴ケテ」ツ?古」ツ?づ」ツ?」テ」ツ?淌」ツつ嘉ヲツ閉ーテ」ツつ津ヲツ閉ーテ」ツ?暗」ツつ?
		for (i = 0; i < prime_size && prime_v[i] <= n / 2; i++){
			//printf("%d, %d\n", prime_v[i], n - prime_v[i]);
			if (prime_s.count(n - prime_v[i]) != 0){
				count++;
				//printf("----- %d, %d -----\n", prime_v[i], n - prime_v[i]);
			}
		}

		printf("%d\n", count);
	}

	return 0;
}



// テァツエツ?ヲツ閉ーテ」ツ?凝」ツ?ゥテ」ツ??」ツ?凝・ツ按、テ・ツョツ?
int primejudg(int num){
	// テ、ツサツ甘」ツ?セテ」ツ?ァテ」ツ?ョテ・ツ?ィテァツエツ?ヲツ閉ーテ」ツ?ァテ・ツ可イテ」ツつ?
	for (int i = 0; i < prime_size; i++){
		if (num % prime_v[i] == 0){ return -1; }
	}
	return 0;
}

Measured memory_bytes: 1232
#include <iostream>
#include<string>
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];
    }
    bool f = true;
    while(f){
        for(int j=0; j<N; j++){
            if(a[j]%2!=0){
                f = false;
                break;
            }
            else{
                a[j]=a[j]/2;
            }
            if(j==N-1){
                count++;
            }
        }    
    }        
            
    cout<<count<<endl;       
            
    
    
}
    

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.10f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e10;
const ll MAX_N = 1010;

ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };
char c[310][310];

//long longしか使わない
//素数は1より大きい
//lower_boundは指定したkey以上の要素の一番左のイテレータをかえす
//upper_boundは指定したkeyより大きい要素の一番左のイテレータをかえす
int main() {
	ll n;
	cin >> n;
	map<ll, ll>mp;
	for (ll i = 2;i <= n;++i) {
		ll target = i;
		for (ll j = 2;j <= sqrt(i) + 3;++j) {
			while (target % j == 0) {
				mp[j]++;
				target /= j;
			}
		}
		if (target != 1)mp[target]++;
	}
	ll ans = 1;
	for (auto p : mp) {
		ll x = p.second + 1;
		ans *= x;
		ans %= MOD;
	}
	cout << ans << endl;
	return 0;
}


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

using namespace std;

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

  int a = 0, b = 0;
  for(int i = 0; i < N; i++) {
    int x;
    cin >> x;
    if(x % 2 == 1) ++a;
    else ++b;
  }

  if(a % 2 == 1) {
    cout << "NO" << endl;
  } else {
    cout << "YES" << endl;
  }

}


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

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  string s;
  cin >> s;
  if (s == "AAA" || s == "BBB") {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <unordered_map>

int main()
{
    std::unordered_map<char, int> suit2id;
    suit2id['S'] = 0;
    suit2id['H'] = 1;
    suit2id['C'] = 2;
    suit2id['D'] = 3;
    std::array<char, 4> id2suit = {'S', 'H', 'C', 'D'};
    int buf[4][13] = {};

    int n;
    std::cin >> n;
    char suit;
    int rank;
    for (int i = 0; i < n; i++) {
        std::cin >> suit;
        std::cin >> rank;
        buf[suit2id[suit]][rank-1] = 1;
    }
    // std::cout << "result" << std::endl;
    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 13; j++) {
            if (buf[i][j] == 0) {
                std::cout << id2suit.at(i) << ' ' << j+1 << std::endl;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3080
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>

using ll = long long;
using itn = int;
using namespace std;


int main() {
	int s;
	cin >> s;
	int p = s / 100;
	int q = s % 100;
	if (p <= 12 && p > 0) {
		if (q <= 12 && q > 0) {
			cout << "AMBIGUOUS" << endl;
		} else{
			cout << "MMYY" << endl;
		}
	}
	if (p > 12 || p == 0) {
		if (q <= 12 && q > 0) {
			cout << "YYMM" << endl;
		} else {
			cout << "NA" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>
#define rep(i, a) for (int i = 0; i < (a); i++)
using namespace std;

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

    cin >> a >> b >> c;
    
    if((a==5 && b==5 && c==7) || (a==5 && b==7 && c==5) || (a==7 && b==5 && c==5)){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int H=0,W=0;
	while(true){
		//たて→H よこ→W
		scanf("%d",&H);
		scanf("%d",&W);
		if(H==0 && W==0){
			break;
		}
		for(int i=0; i<H; i++){
			for(int j=0; j<W; j++){
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}



Measured memory_bytes: 2688
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int N,K,t;
  cin>>N>>K;
  vector<int> h(N,0);
  for(int i=0;i<N;i++){
    cin>>t;
    h[i]=t;
  }
  t=0;
  for(int i=0;i<N;i++){
    if(K<=h[i])t++;
  }
  cout<<t<<endl;
  return 0;
}

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

int main() {
    ll n,x,count=0;
    cin >> n >> x;
    vector<ll> L(n+2,0);
    vector<ll> D(n+2,0);
    for(ll i=1; i<=n+1; i++){
        
        if(i==n+1){
            D.at(i)=D.at(i-1)+L.at(i-1);
            break;
        }
        
        cin >> L.at(i);
        D.at(i)=D.at(i-1)+L.at(i-1);
    }
    for(ll i=1; i<=n+1; i++){
        if(D.at(i)<=x){
            count++;
        }
        if(D.at(i)>x){
            break;
        }
    }

    cout << count << endl;
}



    

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

#define mod 1000000007

using namespace std;

int N, a[300000];
 
int main(void){
	
	//int N;
	
	int64_t count=0;
	
	cin >> N;
	
	//int a[N];
	
	for(int i=0; i<3*N; i++)
		cin >> a[i];
	
	sort(a, a+3*N, greater<int>());
	
	for(int i=1; i<N*2; i+=2)
		count += a[i];
	
	cout << count;
	
	return 0;
}

Measured memory_bytes: 1408
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv,
    std.functional, std.math, std.numeric, std.range, std.stdio, std.string,
    std.random, std.typecons, std.container;

ulong MAX = 1_000_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Clue = Tuple!(long, "x", long, "y", long, "h");
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);

void main()
{
    long n, m;
    scan(n, m);
    auto a = 100 * (n - m) + 1900 * m;
    writeln(a * 2 ^^ m);
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> PP;
#define MOD 1000000007
//#define MOD 998244353
#define INF 2305843009213693951
//#define INF 810114514
#define PI 3.141592653589
#define setdouble setprecision
#define REP(i,n) for(ll i=0;i<(n);++i)
#define OREP(i,n) for(ll i=1;i<=(n);++i)
#define RREP(i,n) for(ll i=(n)-1;i>=0;--i)
#define all1(i) begin(i),end(i)
#define GOODBYE do { cout << "-1" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl
#define debug false
#define debug2 false

int main(void){
    
    ll N,a;
    vector<pair<ll,ll>> A;
    cin >> N;
    REP(i,N){
        cin >> a;
        A.push_back({a,i});
    }
    sort(A.begin(),A.end(),greater<>());
    
    //REP(i,N){cout << A[i].first << " " << A[i].second+1 << endl;}
    
    A.push_back({0,-1});
    
    vector<ll> Ans(N,0);
    ll index=INF;
    
    REP(i,N){
        index = min(index,A[i].second);
        Ans[index]+=(A[i].first-A[i+1].first)*(i+1);
    }
    
    REP(i,N){
        cout << Ans[i] << endl;
    }
    
    return 0;
}



Measured memory_bytes: 5588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int main(){
    ll n,q; cin>>n>>q;
    queue<pair<string,ll>> que;
    vector<vector<ll>> process(n,vector<ll>(2));
    rep(i,n){
        string a; ll b; cin>>a>>b;
        que.push({a,b});
    }
    ll time=0;
    while(!que.empty()){
        pair<string,ll> p=que.front();
        que.pop();
        if(p.second>q) {que.push({p.first,p.second-q}); time+=q;}
        else{
            time+=p.second;
            cout<<p.first<<' '<<time<<endl;
        }
    }

    return 0;
}


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

#define LL long long
#define VI vector<int>
#define VB vector<bool>
#define VL vector<long long>
#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i)
#define RFOR(i,a) for(int i=(a); i >= 0; --i)
#define FOE(i,a) for(auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v,x) (std::find(v.begin(), v.end(), x) != v.end())
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define EPS 1e-14

const std::string YES = "YES";
const std::string Yes = "Yes";
const std::string NO = "NO";
const std::string No = "No";

bool inside(int y, int x, int H, int W) { return 0 <= y && y < H && 0 <= x && x < W; }

// 4近傍（右, 下, 左, 上）
const std::vector<int> dy = { 0, -1, 0, 1 };
const std::vector<int> dx = { 1, 0, -1, 0 };

using namespace std;

int main() {
    int N, L, Q;
    cin >> N;
    vector<int> X(N);
    FOR(i, 0, N) {
        cin >> X[i];
    }

    cin >> L;

    // r[k][i]: i番目のホテルから2^k日以内に到達可能なホテル番号のうち最も遠いもの
    vector<vector<int>> r(32, vector<int>(N + 1, 0));
    // iから1日でいける
    FOR(i, 0, N) {
        r[0][i] = upper_bound(ALL(X), X[i] + L) - X.begin() - 1;
    }
    FOR(k, 1, 32) {
        FOR(i, 0, N) {
            // ホテルiから2^(k-1)日でいったホテルから2^(k-1)日でいけるホテルは、ホテルiから2^k日でいける
            r[k][i] = r[k - 1][r[k - 1][i]];
        }
    }

    cin >> Q;
    FOR(i, 0, Q) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        if (a > b) { swap(a, b); }

        int ans = 0;
        int hotel = a;
        for(int k = 31; k >= 0; --k) {
            if(r[k][hotel] < b) {
                hotel = r[k][hotel];
                ans += 1 << k;
            }
        }

        if(hotel < b) {
            hotel = r[0][hotel];
            ++ans;
        }
        cout << ans << endl;
    }


    return 0;
}

Measured memory_bytes: 13816
#include<bits/stdc++.h>
#define inf 1000000000000ll
using namespace std;

struct edge{int go,next;long long s;} a[1000005];
int n,aa[1000],cnt,END[1100],f[1100],q[1100],s,t,id[1100],idd[1100];
long long td,ss,tdss;

inline void add(int u,int v,long long w){
	a[++cnt].go=v;a[cnt].s=w;a[cnt].next=END[u];END[u]=cnt;
	a[++cnt].go=u;a[cnt].s=0;a[cnt].next=END[v];END[v]=cnt;
}
inline bool bfs(){
	memset(f,-1,sizeof(f));
	int h=0,r=1;q[1]=s;f[s]=1;
	while (h<r){
		int now=q[++h];if (now==t) return 1;
		for (int i=END[now];i;i=a[i].next){
			int go=a[i].go;
			if (f[go]==-1&&a[i].s){
				f[go]=f[now]+1;
				q[++r]=go;
			}
		}
	}return 0;
}
long long dinic(int sta,long long sum){
	if (sta==t) return sum;long long os=sum;
	for (int i=END[sta];i&&os;i=a[i].next){
		int go=a[i].go;
		if (f[go]==f[sta]+1&&a[i].s){
			int minv=dinic(go,min(os,a[i].s));
			a[i].s-=minv;a[i^1].s+=minv;os-=minv;
		}
	}if (os==sum) f[sta]=-1;return sum-os;
}
int main(){
	scanf("%d",&n);cnt=1;
	for (int i=1;i<=n;i++){
		scanf("%d",&aa[i]);
		ss+=aa[i];
		aa[i]=-aa[i];
	}
	for (int i=1;i<=n;i++){
		for (int j=i*2;j<=n;j+=i){
			add(i,j,inf);
		}
	}
	for (int i=1;i<=n;i++){
		if (aa[i]>0){
			add(n+1,i,aa[i]);
			tdss+=aa[i];                         
		}
		else add(i,n+2,-aa[i]);
	}
	s=n+1;t=n+2;
	while (bfs()) td+=dinic(n+1,inf);
	printf("%lld",ss+(tdss-td));
}

Measured memory_bytes: 256
S = input()

sum_value = 0
for n in range(2 ** (len(S) - 1)):
	line = ""
	for i, s in enumerate(S):
		line += s
		if (i < (len(S) - 1)) and (n >> i & 1):
			line += "+"
	sum_value += eval(line)
	#print(line)
print(sum_value)


Measured memory_bytes: 40560
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include "bits/stdc++.h"
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

int main() {
    string a,b,c;
    cin>>a>>b>>c;
    bool flagA=1,flagB=0,flagC=0;
    for(int i=0;;i++){
        if(flagA){
            if(a.size()==0){
                cout<<"A"<<"\n";
                return 0;
            }
            if(a[0]=='b'){
                flagA=0;
                flagB=1;
            }   
            else if(a[0]=='c'){
                flagA=0;
                flagC=1;
            }
            a.erase(a.begin());

            }
        else if(flagB){
            if(b.size()==0){
                cout<<"B"<<"\n";
                return 0;
            }
            if(b[0]=='a'){
                flagA=1;
                flagB=0;
            }   
            else if(b[0]=='c'){
                flagB=0;
                flagC=1;
            }
            b.erase(b.begin());

            
        }
        else if(flagC){
            if(c.size()==0){
                cout<<"C"<<"\n";
                return 0;
            }
            if(c[0]=='a'){
                flagA=1;
                flagC=0;
            }   
            else if(c[0]=='b'){
                flagB=1;
                flagC=0;
            }
            c.erase(c.begin());

            
        }
        
        }
    }

Measured memory_bytes: 256
n = gets.chomp.to_i
as = gets.chomp.split.map(&:to_i)

bs = Array.new(n, 0)

(1..n).to_a.reverse.each do |num|
    cnt = 0
    (1..n/num).each do |t|
        cnt = cnt + bs[num * t - 1]
    end
    a = as[num - 1]
    if a != cnt % 2
        bs[num - 1] = 1
    end
end

res = bs.reduce(:+)
puts res
if res > 0
    puts bs.each_with_index
        .select { |b, i| b != 0 }
        .map { |b, i| i + 1 }
        .join(' ')
end


Measured memory_bytes: 30836
import  java.util.Scanner;
                               
                                        class Main{
                                        	public static void main(String[] args){
                                              Scanner sc = new Scanner(System.in);
                                              String str = "";
                                              str = sc.nextLine();
                                             //System.out.println(str);
                                               String[] str2 = str.split(" ");
                                              //System.out.println(str);
                                              //String[] str2;
                                              //str2 = new String[2];
                                              //str2 = str.split(" ");
                                              int num1 = Integer.parseInt(str2[0]);
                                               int num2 = Integer.parseInt(str2[1]);
                                                
                                               if(num1 >= 13){
                                                 System.out.println(String.valueOf(num2));
                                               }else if(num1 >= 6){
                                                 System.out.println(String.valueOf(num2/2));
                                               }else {
                                                 System.out.println(String.valueOf(0));
                                               }
                                            }
                                        }

Measured memory_bytes: 22996
import sys
input = sys.stdin.readline
n, k = map(int, input().split())
h = list(map(int, input().split()))
inf = float("inf")
dp = [inf]*n
dp[0] = 0
for i in range(1, n):
    for j in range(1, min(i, k)+1):
        dp[i] = min(dp[i], dp[i-j] + abs(h[i]-h[i-j]))

print(dp[-1])



Measured memory_bytes: 55004
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		String[] ans = new String[N];
		int c0 = 0, c1 = 0, c2 = 0, c3 = 0;

		for(int i=0;i<N;i++) {
			ans[i] = stdIn.next();
		}

		for(int i=0;i<N;i++) {
			if(ans[i].equals("AC")) {
				c0++;
			}else if(ans[i].equals("WA")) {
				c1++;
			}else if(ans[i].equals("TLE")) {
				c2++;
			}else if(ans[i].equals("RE")) {
				c3++;
			}
		}

		System.out.println("AC x " + c0);
		System.out.println("WA x " + c1);
		System.out.println("TLE x " + c2);
		System.out.println("RE x " + c3);

		stdIn.close();
	}

}


Measured memory_bytes: 65032
#include<stdio.h>

int main(void){
    int N;
    scanf("%d",&N);

    if(1<=N && N<=9){
        printf("%d",N);
    }else if(9<N && N<100){
        printf("9");
    }else if(100<=N && N<=999){
        printf("%d",N-90);
    }else if(999<N && N<10000){
        printf("909");
    }else if(10000<=N && N<=99999){
        printf("%d",N-9090);
    }else{
        printf("90909");
    }

    return 0;
}

Measured memory_bytes: 128
import numpy as np
from numba import *


N = int(input())
length = np.array(input().split(), np.int64)


length = np.sort(length)

@njit
def calc(length):
    cnt = 0
    
    for i in range(N):
        for j in range(i + 1, N):
            for k in range(j + 1, N):
                l1, l2, l3 = length[i], length[j], length[k]
                if (l1 != l2 and l1 != l3 and l2 != l3):
                    if (l1 + l2 > l3):
                        cnt += 1
    
    return (cnt)

ans = calc(length)
print(ans)


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

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

  int sheet[r+1][c+1];
  //?????????
  for(int i = 0; i <= r; i++){
    for(int j =0; j <= c; j++){
      sheet[i][j] = 0;
    }
  }

  for(int i = 0; i < r; i++){
    for(int j = 0; j < c; j++){
      cin >> sheet[i][j];
      sheet[i][c] += sheet[i][j];
      sheet[r][j] += sheet[i][j];
    }
  }

  for(int j = 0; j < c; j++){
    sheet[r][c] += sheet[r][j];
  }

  for(int i = 0; i<=r; i++){
    for(int j = 0; j<=c; j++){
      if(j == c){
        cout << sheet[i][j] << endl;
      }
      else{
        cout << sheet[i][j] << " ";
      }
    }
  }
  return 0;
}

Measured memory_bytes: 3108
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
public class Hello{
    public static void Main(){
        // Your code here!
        string[] input = Console.ReadLine().Split(' ');
        int k = Convert.ToInt32(input[1]);
        
        var list = Console.ReadLine().Split(' ').Select(value => Convert.ToInt32(value)).ToArray();
        Array.Sort(list);
        
        int ans = 0;
        for(int i = 0; i < k; i++){
            ans = ans + list[i];
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 19660
//https://atcoder.jp/contests/keyence2019/tasks/keyence2019_a
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#ifdef BTK
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww {cww() {CIN_ONLY{ios::sync_with_stdio(false); cin.tie(0);}}}star;
#define DEBUG if(0)
#endif
#define ALL(v) (v).begin(),(v).end()
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l, T r){bool a = l>r; if (a)l = r; return a;}
template <typename T>inline bool chmax(T &l, T r){bool a = l<r; if (a)l = r; return a;}
template <typename T>istream& operator>>(istream &is, vector<T> &v){for (auto &it : v)is >> it;return is;}
class range {private: struct I { int x; int operator*() { return x; }bool operator!=(I& lhs) { return x<lhs.x; }void operator++() { ++x; } }; I i, n;public:range(int n) :i({ 0 }), n({ n }) {}range(int i, int n) :i({ i }), n({ n }) {}I& begin() { return i; }I& end() { return n; }};


int main(){
    string s(4,'-');
    for(int i:range(4))cin>>s[i];
    sort(ALL(s));
    if(s=="1479")cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

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

const int MAX_M = 100007;

int N;
int M;
int X[MAX_M];


int main() {
  cin >> N >> M;
  for (int i = 0; i < M; i++) cin >> X[i];
  
  int Y[M];
  int ans = 0;

  sort(X, X + M);

  for (int i = 0; i < M - 1; i++) {
    Y[i] = fabs(X[i] - X[i + 1]);
  }

  sort(Y, Y + M - 1);

  for (int i = 0; i < M - N; i++) {
    ans += Y[i];
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i, s, n) for (int i = s; i < n; i++)
#define repe(i, s, n) for(int i = s;i<=n;i++)

int main() {
	ll n, x; cin >> n >> x;
	ll a[100001] = {};
	repe(i, 1, n)cin >> a[i];

	ll cnt = 0;
	rep(i, 0, n) {
		if (a[i] + a[i + 1] > x) {
			ll d = x - (a[i] + a[i + 1]);
			if (d < 0) {
				a[i + 1] += d;
				cnt += d;
			}
			if (a[i + 1] < 0) {
				cout << endl;
			}
		}
	}

	cout << -cnt << endl;

	return 0;
}

Measured memory_bytes: 1024
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <utility>
#include <memory>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <numeric>
#include <list>
#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


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

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll;
typedef vector<vector<long long> > vvll;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i,n) _rep2((i),0,(n))
#define _rep2(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define fi first
#define se second
#define mkp make_pair
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	int n,K;
	cin>>n>>K;
	int ans = 1;
	rep(i,n){
		ans = min(ans*2, ans+K);
	}
	cout<<ans<<endl;
}


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

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

using namespace std;
 
// macro
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define MOD 1000000007
#define M_PI 3.14159265358979323846
#define ll long long
#define ull unsigned long long
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define SORT(ary) sort(begin(ary), end(ary))
#define VL vector<ll>
#define VVL vector<VL>
#define PL pair<ll, ll>
#define VC vector<char>
#define VVC vector<VC>

// Factorial
// need init
ll factorial_memo[5001];
ll factorial(ll n) {
  factorial_memo[0] = 1;
  if(factorial_memo[n] != -1) return factorial_memo[n];
  factorial_memo[n] = (factorial(n-1) * n) % MOD;
  return factorial_memo[n];
}
 
// Combination(nCr)
// need init
ll nCr_memo[5001][5001];
ll nCr(ll n, ll r) {
  if(r*2 > n) r = n-r;
  if(r == 1) return n;
  if(r == 0) return 1;
  if(nCr_memo[n][r] != -1) return nCr_memo[n][r];
  nCr_memo[n][r] = (nCr(n-1, r) + nCr(n-1, r-1)) % MOD;
  return nCr_memo[n][r];
}

ll bridgeDfs(VVL& g, vector<PL>& res, ll v, ll& count, ll from, VL& low, VL& pre) {
  pre[v] = count++;
  low[v] = pre[v];
  for(auto to:g[v]) {
    if (pre[to] == -1) {
      low[v] = min(low[v], bridgeDfs(g, res, to, count, v, low, pre));
      if(low[to] == pre[to]) res.push_back(make_pair(v, to));
    } else {
      if(from == to) continue;
      low[v] = min(low[v], low[to]);
    }
  }
  return low[v];
}

vector<PL> bridges(VVL& g, ll N) {
  vector<PL> res;
  if (N > 0) {
    VL low(N, -1);
    VL pre(N, -1);
    ll count = 0;
    bridgeDfs(g, res, 0, count, -1, low, pre);
  }
  return res;
}

void solve() {
    string str;
    cin >> str;
    int i = 0;
    int j = str.size()-1;
    int count = 0;
    while(true) {
        if(i >= j) break;
        if(str.at(i) == str.at(j)) {
            i++;
            j--;
        } else if(str.at(i) != 'x' && str.at(j) != 'x') {
            cout << -1 << "\n";
            return;
        } else {
            count++;
            if(str.at(i) == 'x') i++;
            else j--;
        }
    }
    cout << count;
}



int main() {
  // init
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}


Measured memory_bytes: 512
a,b,c = map(int, input().split())
if a == b == c and all([x % 2 == 0 for x in (a,b,c)]):
    print(-1)
else:
    cnt = 0
    while all([x % 2 == 0 for x in (a,b,c)]):
        a, b, c = (b+c)/2, (a+c)/2, (a+b)/2
        cnt += 1
    print(cnt)


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

int main(){
    int d,t,s;
    cin >> d >> t >> s;
    if(d > t*s){
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 3592
#include <iostream>
#include <cmath>
#include <climits>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;
// scanf
#pragma warning(disable: 4996)
// v:vector  type:型  order:greater or less
#define _sort(v,type,order) do { sort(v.begin(),v.end(),order<type>()); } while(0)
// v:vector  default_value:初期値
#define _sum(v,default_value) accumulate(v.begin(),v.end(),default_value )
// 丸め
#define _round(v) round(v)
// 2乗 / 3乗
#define _square(v) pow(v,2)
#define _cube(v)   pow(v,3)
// 大小判定
#define _max(x,y) max(x,y)
#define _min(x,y) min(x,y)


int main()
{
	
	uint32_t n, a, b;
	cin >> n >> a >> b;

	uint32_t sum = 0;
	uint32_t result = 0;
	uint32_t temp;
	for (uint32_t i = 1; i <= n; i++) {
		temp = i;
		sum = 0;
		while (temp > 0) {
			sum += temp % 10;
			temp /= 10;
		}
		if (a <= sum && sum <= b) {
			result += i;
		}
	}
	printf("%d\n", result);

	return 0;
	//	std::cout << "Hello World!\n"; 
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<=n;++i)
int main(){
    string s,t;cin>>s>>t;
    string ans=t+s;
    cout<<ans<<endl;

    return 0;
}

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

 int main(){
	 int x,y,i,j;
	 while(1){
		 cin >> x >>y;
		 if(x==0&&y==0){
			 break;
		 }
		 for(i=0;i<x;i++){
			 for(j=0;j<y;j++){
				 cout<<"#";
			 }
			 cout << endl;
		 }
		 cout<<endl;
	 }
	 return 0;


 }






Measured memory_bytes: 3092
#include<bits/stdc++.h>
//#pragma GCC optimize("O3")
//#pragma GCC target ("sse4")
using namespace std;
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define MEM(x,a) memset((x),a,sizeof((x)))
#define F first
#define S second
#define imx INT_MAX
const long long MOD = (long long)(1e9+7);
const long long MMX = (long long)(1e18);
typedef long long LL;
typedef pair<int,int> pii;
LL n,ls[30],mx1,mx2,x[370][30],c[30],ans[370][30],a,la,val,mi[30];
int main()
{
    scanf("%lld",&n);
    for(int i=1;i<=26;i++)scanf("%lld",&c[i]),ls[i]=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=26;j++)
        {
            scanf("%lld",&x[i][j]);
        }
    }
    for(int st=1;st<=26;st++)
    {
        for(int i=1;i<=26;i++)ls[i]=0;
        ls[st]=1;
        ans[1][st]=st;
        mi[st]=c[st]+x[1][st];
        for(int i=2;i<=n;i++)
        {
            mx1=0,mx2=1;
            for(int j=1;j<=26;j++)
            {
                int k=((i-ls[j])*c[j])+x[i][j];
                if(mx1<k)mx1=k,mx2=j;
                else if(mx1==k)if(ls[j]<ls[mx2])mx2=j;
            }
            //printf("[%d]",mx1);
            ls[mx2]=i;
            ans[i][st]=mx2;
            mi[st]+=mx1;
        }
    }
    LL p1=INT_MIN,p2=1;
    for(int i=1;i<=n;i++)if(p1<mi[i])p1=mi[i],p2=i;
    for(int i=1;i<=n;i++)printf("%lld\n",ans[i][p2]);
}


Measured memory_bytes: 4000
#include <bits/stdc++.h>
using namespace std;
int a[2001];
bitset<4000000> dp(1);

int main()
{
    int n, sum = 0;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) scanf("%d", a + i);
    for (int i = 0; i < n; i++) sum += a[i], dp |= dp << a[i];
    for (int i = (sum + 1) / 2; i <= sum; i++)
        if (dp.test(i))
        {
            printf("%d\n", i);
            break;
        }
    return 0;
}


Measured memory_bytes: 1664
#include<stdio.h>
int main(void){
 int a,b;
 scanf("%d",&a);
 scanf("%d",&b);
 if(a>b){
  for(int i=0;i<a;i++){
   printf("%d",b);
  }
 }else{
  for(int i=0;i<b;i++){
   printf("%d",a);
  }
 }
 return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int main() {
   
   vector<long long> key;
    map<long long, int> M1,M2;
    long long N,M;
    cin >> N;
    for ( int i = 0; i < N; i++ ) {        
        long long a;
        cin >> a;
        M1[a]++;
    }
    cin >> M;
    for ( int i = 0; i < M; i++ ) {        
        long long a;
        cin >> a;        
        key.push_back(a);        
        M2[a]++;        
    }
   
   for ( int i = 0; i < key.size(); i++ ) {
       if ( !M1.count(key[i]) ) { cout << "NO" << endl; return 0; }
       if ( M1[key[i]] < M2[key[i]] ) { cout << "NO" << endl; return 0; }
   }
   
   cout << "YES" << endl;
   
    return 0;
}

Measured memory_bytes: 26864