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

int main() {
  string S;
  cin >> S;
  if(S  == "Sunny") {
    cout << "Cloudy" << endl;
  } else if(S == "Cloudy") {
    cout << "Rainy" << endl;
  } else {
    cout << "Sunny" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include <cassert>
using namespace std;
int main() {
	int a = 0, b = 0, c = 0, d = 0, e = 0, count = 0;
	char v[2];
	bool l = false,m=false,n=false;
	cin >> a >> b >> c;
	if (a + b >= c) {
		cout << "Yes" << endl;
	}
	else { cout << "No" << endl; }
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<bitset>
#include<iomanip>
#include<cctype>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
const int inf = 1001001000;

void print(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;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

//最大公約数を返す関数.未検証
long long int gcd(long long int x, long long int y){
    if (x < y) swap(x,y);
    while (y > 0){
        long long int r = x % y;
        x = y;
        y = r;
    }
    return x;
}
//最小公倍数を返す関数.未検証
long long int lcm(long long int x, long long int y){
    return x * y / gcd(x,y);
}


int main(){
	int n, m;
	cin >> n >> m;
	long long int lc = 1;
	int num2 = -1;
	int flag = 1;
	rep(i, n)
	{
		int a;
		cin >> a;
		int b = a;
		int num2t = 0;
		while (true)
		{
			if (b % 2 == 1){
				break;
			}
			b = b / 2;
			num2t++;
		}
		if (num2 == -1)
			num2 = num2t;
		else {
			if (num2 != num2t){
				cout << 0 << endl;
				return 0;
			}
		}
		lc = lcm(lc, a);
		if (lc > 2*m){
			cout << 0 << endl;
			return 0;
		}
	}
	
	lc = lc / 2;
	cout << (m / lc + 1) / 2 << endl;
 
	return 0;
}

Measured memory_bytes: 256
n, A, B = map(int, input().split())
s = input()

ab = 0
f = 0

for t in s:
    if t == "a":
        if ab < A + B:
            print("Yes")
            ab += 1
        else:
            print("No")
    elif t == "b":
        if ab < A + B and f < B:
            print("Yes")
            ab += 1
            f += 1
        else:
            print("No")
    else:
        print("No")

Measured memory_bytes: 4016
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v; return v;}

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector< vector<int> > Mat;
typedef tuple<int, int, int, int> T;

const int MOD = (int)1e9+7;
const int INF = (int)1e9;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

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

    char b;
    cin >> b;

    if(b == 'A') cout << 'T' << endl;
    if(b == 'T') cout << 'A' << endl;
    if(b == 'C') cout << 'G' << endl;
    if(b == 'G') cout << 'C' << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=1e6+5;
struct each{
	int cnt;
	char ch;
}a[3];
char A,B,C,s[N],t[N];
int n,vi[N],nex[N],bfe[N];
bool com(each x,each y){
	return x.cnt<y.cnt;
}
void erase(int x){
	nex[bfe[x]]=nex[x];
	bfe[nex[x]]=bfe[x];
	vi[x]=1;
}
bool check(int i,int j,char c1,char c2){
	if(!i||!j)	return false;
	if(s[i]==c1&&s[j]==c2)	return true;
	if(s[i]==c2&&s[j]==c1)	return true;
	return false;
}
bool is(int i,int j){
	if(!i||!j)	return true;
	return s[i]!=s[j];
}
void pri(){
	for(int i=1;i<=n;i++)
		if(!vi[i]){
			for(int j=i;j;j=nex[j])
				putchar(s[j]);
			return ;
		}
}
void solve(){
	int c1=a[0].cnt,c2=a[1].cnt,c3=a[2].cnt;
	for(int i=1;i<=n&&c2<c3;i++)
		if(!vi[i]&&s[i]==C&&is(bfe[i],nex[i]))	erase(i),--c3;
	if(c2<c3){
		for(int i=1;i<=n&&c2<c3;i++)
			if(!vi[i]&&check(i,nex[i],A,C)&&is(bfe[i],nex[nex[i]]))
				erase(nex[i]),erase(i),--c1,--c3;
	}
	for(int i=1;i<=n&&c1<c2;i++)
		if(!vi[i]&&check(i,nex[i],B,C)&&is(bfe[i],nex[nex[i]]))
			erase(nex[i]),erase(i),--c2,--c3;
	for(int i=1;i<=n&&c1<c2&&c1<c3;i++)
		if(!vi[i]&&is(bfe[i],nex[i])){
			if(s[i]==B)	--c2,erase(i);
			if(s[i]==C)	--c3,erase(i);
		}
	pri();
}
int main(){
	scanf("%s",s+1),n=strlen(s+1);
	a[0].ch='A',a[1].ch='B',a[2].ch='C';
	for(int i=1;i<=n;i++){
		bfe[i]=i-1;
		if(i!=n)	nex[i]=i+1;
	}
	for(int i=1;i<=n;i++)
		if(s[i]==s[i-1])	erase(i);
	for(int i=1;i<=n;i++){
		if(vi[i])	continue;
		if(s[i]=='A')	a[0].cnt++;
		else	if(s[i]=='B')	a[1].cnt++;
		else	a[2].cnt++;
	}
	sort(a,a+3,com);
	A=a[0].ch,B=a[1].ch,C=a[2].ch,solve();
	return 0;
}


Measured memory_bytes: 14464
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
typedef long long ll;
typedef pair<int,int> pi;
template <typename T> void chmax(T& a, T b) {a = max(a,b);}
template <typename T> void chmin(T& a, T b) {a = min(a,b);}
//#define cerr if (0) cout

int main() {
	ios_base::sync_with_stdio(0); 
	cin.tie(0);
	int sh, w;
	cin >> sh >> w;
	if (w>=sh) cout << "unsafe";
	else cout << "safe";
	return 0;
}


Measured memory_bytes: 3608
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


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

  cout << ((x == 7 || x == 5 || x == 3) ? "YES" : "NO") << endl;
  
  return 0;
}




Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 310
#define MAX_T 10000

int n, T;
vector<pair<int,int> > way[SIZE];
int a[SIZE], b[SIZE], t[SIZE], m[SIZE], v[SIZE];

void dfs(vector<ll> &dp, int now, int back=-1, int eid = -1){  
  if(eid >= 0){
    int w = max(0, m[eid] - 2) / 2;
    ll tmp_v = v[eid]*2, tmp_t = t[eid]*2; 
    for(int j=1;j<=w;j*=2){
      for(int i=T-tmp_t;i>=0;i--){
        dp[i+tmp_t] = max(dp[i+tmp_t], dp[i] + tmp_v);
      }
      w -= j;
      tmp_t *= 2;
      tmp_v *= 2;
    }
    tmp_v=v[eid]*2*w; tmp_t=t[eid]*2*w;
    for(int i=T-tmp_t;i>=0;i--){
      dp[i+tmp_t] = max(dp[i+tmp_t], dp[i] + tmp_v);
    }

    if(max(0, m[eid] - 2)%2){
      for(int i=T-t[eid]*2;i>=0;i--){
        dp[i+t[eid]*2] = max(dp[i+t[eid]*2], dp[i] + v[eid]);
      }
    }
  }
  
  for(int i=0;i<way[now].size();i++){
    if(way[now][i].first == back) continue;
    int id = way[now][i].second;

    vector<ll> dp_dfs(T+1, -LLINF);
    for(int j=0;j+t[id]*2<=T;j++) dp_dfs[j+t[id]*2] = dp[j];
    
    dfs(dp_dfs, way[now][i].first, now, id);

    for(int j=0;j<=T;j++) dp[j] = max(dp[j], dp_dfs[j] + v[id]*min(2, m[id]));
  }
  
}

int main(){

  scanf("%d%d", &n, &T);

  for(int i=0;i<n-1;i++){
    scanf("%d%d%d%d%d", a+i, b+i, t+i, m+i ,v+i);
    a[i]--; b[i]--;
    way[a[i]].push_back({b[i],i});
    way[b[i]].push_back({a[i],i});
  }

  vector<ll> dp(T + 1, -LLINF);

  dp[0] = 0;
  dfs(dp, 0);

  ll ans = 0;
  
  for(int i=0;i<=T;i++)
    ans = max(ans, dp[i]);

  printf("%lld\n", ans);
  
  return 0;
}



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

using namespace std;

int main(){
  long long N, A, B;
  cin >> N >> A >> B;
  long long ans;
  long long dif=B-A;
  if (dif%2){
    long long near=min(N-B,A-1);
    ans=near+1+(B-A-1)/2;
  }
  else ans=dif/2;
  cout << ans << endl;
  
  return 0;
}

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

int main() {
  long long n;
  vector<long long> a(5);
  cin >> n;
  long long min;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
  }
  min = *min_element(a.begin(), a.end());
  cout << 4 + (n + min - 1) / min << endl;
  return 0;
}

Measured memory_bytes: 256
#![allow(non_snake_case,unused_imports,dead_code)]
use std::cmp::max;
use std::cmp::min;
use std::str::FromStr;
use std::collections::{HashMap,HashSet,VecDeque,BinaryHeap};
use std::cmp::Ordering;

use proconio::input;
use proconio::marker::{Chars,Usize1,Isize1};

fn comp_f64(a: &f64, b: &f64) -> Ordering {
    if a < b {
        return Ordering::Less;
    } else if a > b {
        return Ordering::Greater;
    }
    Ordering::Equal
}

fn main() {
    input!{
        Q:usize,
        LR:[(usize,usize);Q],
    }

    let INF = 100_010;
    let mut N = vec![0;INF];
    for i in 2..INF/2{
        let i = i*2-1;
        let j = (i+1)/2;
        if is_prime(i) && is_prime(j){
            N[i] = 1;
        }
    }
    for i in 1..INF{
        N[i] += N[i-1];
    }
    for &(l,r) in &LR{
        println!("{}",N[r]-N[l-1]);
    }
}

fn is_prime(n:usize)->bool{
    if n<=1{return false;}
    for i in 2..n{
        if i*i>n{break;}
        if n%i==0{return false;}
    }
    true
}

Measured memory_bytes: 5144
#include <iostream>
#include <string>
#include <vector>

#define rep(i,n) for (int i = 0; i < (n); ++i)

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

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

  int mn = 1000;
  int mx = 0;
  int a;
  rep(i, N) {
    cin >> a;
    if (mn > a) mn = a;
    if (mx < a) mx = a;
  }

  cout << mx - mn << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

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

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
/*-------------------------------------------------*/
long long mod_inv(long long a, long long mod = MOD) {
  a %= mod;
  if (__gcd(a, mod) != 1) return -1;
  long long b = mod, x = 1, y = 0;
  while (b > 0) {
    long long tmp = a / b;
    a -= tmp * b;
    swap(a, b);
    x -= tmp * y;
    swap(x, y);
  }
  x %= mod;
  if (x < 0) x += mod;
  return x;
}

const int MAX = 10000000;
long long fact[MAX + 1], fact_inv[MAX + 1];
void nCk_init(int val = MAX, long long mod = MOD) {
  fact[0] = 1;
  FOR(i, 1, val + 1) fact[i] = fact[i - 1] * i % mod;
  fact_inv[val] = mod_inv(fact[val], mod);
  for (int i = val; i > 0; --i) fact_inv[i - 1] = fact_inv[i] * i % mod;
}

long long nCk(int n, int k, long long mod = MOD) {
  if (n < 0 || n < k || k < 0) return 0;
  return fact[n] * fact_inv[k] % mod * fact_inv[n - k] % mod;
}

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  nCk_init();
  int n, k; cin >> n >> k;
  if (n == k) {
    cout << 1 << '\n';
    FOR(i, 2, k + 1) cout << 0 << '\n';
    return 0;
  }
  int r = n - k;
  FOR(i, 1, k + 1) {
    long long ans = nCk(k - 1, i - 1);
    long long tmp = nCk(r - 1, i - 2);
    (tmp += nCk(r - 1, i - 1) * 2 % MOD) %= MOD;
    (tmp += nCk(r - 1, i)) %= MOD;
    (ans *= tmp) %= MOD;
    cout << ans << '\n';
  }
  return 0;
}


Measured memory_bytes: 156544
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    auto f = [&](int x, int y, int z) {
        return x * x + y * y + z * z + x * y + y * z + z * x;
    };
    for (int i = 1; i <= n; i++) {
        int ans = 0;
        for (int x = 1;; x++) {
            if (f(x, 1, 1) > i) {
                break;
            }
            for (int y = 1;; y++) {
                if (f(x, y, 1) > i) {
                    break;
                }
                for (int z = 1;; z++) {
                    if (f(x, y, z) == i) {
                        ans++;
                    } else if (f(x, y, z) > i) {
                        break;
                    }
                }
            }
        }
        cout << ans << '\n';
    }
    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
 
int main()
{
	ll n, k;
	cin>>n>>k;
	ll h[n+1];
	for(int i=1; i<=n; i++) cin>>h[i];
	ll dp[n+1];
// dp [i] denotes the cost to reach step i.
 
	dp[1] = 0;
 
	for(int i=2; i<= min(k+1,n); i++) dp[i] = abs(h[i]-h[1]);
 
	for(int i=k+2; i<=n; i++)
	{
		int min = INT_MAX;
		for(int j=i-1; j>=i-k; j--)
		{
			if( (abs(h[i]-h[j])+dp[j]) < min)
				min = abs(h[i]-h[j])+dp[j];
		}
		dp[i] = min;
	}
//	for(int i=1; i<=n; i++) cout<<dp[i]<<"\t";
//	cout<<endl;
	cout<<dp[n];
	return 0;
}

Measured memory_bytes: 1792
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <cctype>    // isupper, islower, isdigit, toupper, tolower
#include <cstdint>   // int64_t, int*_t
#include <cstdio>    // printf
#include <cmath>     // pow
#include <deque>     // deque
#include <iomanip>   // setprecision
#include <iostream>  // cout, endl, cin
#include <map>       // map
#include <queue>     // queue, priority_queue
#include <set>       // set
#include <stack>     // stack
#include <string>    // string, to_string, stoi
#include <tuple>     // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility>       // pair, make_pair
#include <vector>        // vector
using namespace std;

int gcd(long long a, long long b) { return b != 0 ? gcd(b, a % b) : a; }
// cout << fixed << setprecision(10);
// vector<vector<int>> vec(H, vector<int>(W))    // int H*W

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

    int ans = 2147483647 ;
    for(int i=1; i<=100; i++){
        int sum = 0;
        for(size_t j=0; j<N; j++) {
            sum += pow((X[j]-i),2);
        }
        ans = min(ans, sum);
    }
    cout << ans << endl;
}


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

int main() {
  int A, B, C, D, N;
  cin >> N;
  
  A = N/1000;
  B = (N - 1000*A)/100;
  C = (N - 1000*A - 100*B)/10;
  D = N - 1000*A - 100*B - 10*C;

  if (A == B && C == B) {
    cout << "Yes" << endl;
  }
  else if (C == B && C == D) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main()
{
    string s,t;
    cin>>s>>t;
    sort(s.begin(),s.end());
    sort(t.begin(),t.end());
    reverse(t.begin(),t.end());
    if(s<t) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef vector<int> vi;
const int inf = 1e9+7;
const int INF = 1e18+7;
const int mod = 1e9+7;
//26

int a[] = {1, 100, 10000};
signed main(){
	int d, n;
	scanf("%lld%lld", &d, &n);
	if(n < 100)printf("%lld\n", n*a[d]);
	else printf("%lld\n", 101*a[d]);
	return 0;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long 
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define vi vector<int>
#define mod 1000000007
#define tc(t) 			int t;cin >> t;while(t--)
#define for0(i , n)		for(int i=0;i<n;i++)
#define loop(i , a, b)	for(int i=a;i<=b;i++)
#define endl '\n'

vector<int> dp(100001,-1);

int forgB(int ind , int k, int n, int a[]){
	if(ind == n-1){
		return 0;
	}

	if(dp[ind] != -1){
		return dp[ind];
	}

	int mini = INT_MAX;

	for(int i = ind+1 ; i <= min(n-1,ind+k); i++){
		int cost = abs(a[ind] - a[i]) + forgB(i,k,n,a);
		mini = min(cost,mini);
	}

	return dp[ind] = mini;
}

signed main() {

	ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
#ifndef ONLINE_JUDGE
	freopen("input.txt" , "r" , stdin);
	freopen("output.txt" , "w" , stdout);
#endif

	int n,k;
	cin >> n >> k;
	int a[n];

	for0(i,n){
		cin >> a[i];
	}

	cout << forgB(0,k,n,a) << endl;
	return 0;
}

Measured memory_bytes: 14256
#include<bits/stdc++.h>
using namespace std;
#define ran 111111
long long int q,sg;
char s[ran];
int L[ran],R[ran];
int Z;
long long int lowbit(long long int x){
	return x&-x;
}
void dfs(int x,int dep){
	if(L[x] == 0 && R[x] == 0)return;
	if(L[x] == 0){
		sg ^= lowbit(q-dep);
	}else
		dfs(L[x], dep+1);
	if(R[x] == 0){
		sg ^= lowbit(q-dep);
	}else
		dfs(R[x], dep+1);
}
int main(){
	int n;
	Z = 1;
	scanf("%d%lld",&n,&q);
	for(int i=0; i<n; i++){
		scanf("%s",s);
		int p = 1;
		for(int j=0; s[j]; j++){
			if(s[j] == '0'){
				if(L[p] == 0)L[p] = ++Z;
				p = L[p];
			}else{
				if(R[p] == 0)R[p] = ++Z;
				p = R[p];
			}
		}
	}
	sg=0;
	dfs(1,0);
	puts(sg?"Alice":"Bob");
	return 0;
}


Measured memory_bytes: 3456
PROGRAM ATCODER

implicit none
integer :: n,q,i,c_l=1,c_r
character(len=2*10**5) :: s,s_l='',s_r=''
character(len=1),allocatable :: d(:),t(:)

read*, n,q,s
allocate(t(q),d(q))
do i = 1, q, 1
  read*, t(i),d(i)
end do

do i = q, 1, -1
  if ( d(i) == 'L' ) then
    if ( s(c_l:c_l) == t(i) ) then
      c_l = c_l + 1
    end if
  else if ( d(i) == 'R' ) then
    if ( s(c_l-1:c_l-1) == t(i) .and. c_l > 1) then
      c_l = c_l - 1
    end if
  end if
end do

c_r = n
do i = q, 1, -1
  if ( d(i) == 'R' ) then
    if ( s(c_r:c_r) == t(i) .and. c_r >= 1 ) then
      c_r = c_r - 1
    end if
  else if ( d(i) == 'L' ) then
    if ( s(c_r+1:c_r+1) == t(i) .and. c_r+1 <= n ) then
      c_r = c_r + 1
    end if
  end if
end do

if ( n-(c_l-1)-(n-c_r) < 0 ) then
  print'(i0)',  0
  stop
end if

print'(i0)', n-(c_l-1)-(n-c_r)

contains
!!!!!! サブルーチンは↓
!!!!!!

END PROGRAM ATCODER

Measured memory_bytes: 1084
from collections import Counter

N = int(input())
V = list(map(int, input().split()))
V1 = Counter(V[::2]).most_common()
V2 = Counter(V[1::2]).most_common()
lengthV1 = (N+1)//2
lengthV2 = N//2

if V1[0][0] != V2[0][0]:
    print(N-V1[0][1] - V2[0][1])
else:
    if len(V2) > 1:
        ans1 = N - V1[0][1] - V2[1][1]
    else:
        ans1 = N - V1[0][1] - 0
    if len(V1) > 1:
        ans2 = N - V2[0][1] - V1[1][1]
    else:
        ans2 = N - V2[0][1] - 0
    print(min(ans1, ans2))


Measured memory_bytes: 20700
def way(h, w, k):
    if w == 1:
        return 1
    if [h, k] == [1, 1] or [h, k] == [1, 2]:
        return fibo[w - k]
    if h == 1:
        return 0
    if memo[h][k] != -1:
        return memo[h][k]
    re = way(h - 1, w, k) * fibo[k - 1] * fibo[w - k]
    if k != 1:
        re += way(h - 1, w, k - 1) * fibo[max(k - 2, 0)] * fibo[w - k]
    if k != w:
        re += way(h - 1, w, k + 1) * fibo[k - 1] * fibo[max(w - k - 1, 0)]
    memo[h][k] = re
    return re

h, w, k = map(int, input().split())
fibo = [1, 1]
for i in range(2, w):
    fibo += [fibo[i - 1] + fibo[i - 2]]
memo = [[-1] * (w + 1) for _ in range(h + 1)]

print(way(h, w, k) % 1000000007)


Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner();
		int n = sc.nextInt();
		int k = sc.nextInt();
		String s = sc.next();
		for(int i = 0; i < n; i++) {
			char c = s.charAt(i);
			if(i == k -1)
				c = Character.toLowerCase(c);
			System.out.print(c);
		}
		System.out.println();
	}
}

class Scanner {
	private static final int SPACE = (int)' ';
	private static final int LINE_END_0 = 13;
	private static final int LINE_END_1 = 10;
	private static final int BEFORE = -1;
	private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	
	public String next(){
		StringBuilder sb = new StringBuilder();
		
		int length = BEFORE;
		readLoop: while(true) {
			try {
				int value = br.read();
				switch(value) {
				case LINE_END_1:
					if(length == BEFORE)
						break;
					
					if((int)sb.charAt(length) == LINE_END_0)
						sb.deleteCharAt(length);
				case SPACE:
					break readLoop;
				}
				sb.append((char)value);
				length++;

			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return sb.toString();
	}
	
	public String[] nextArray(int length) {
		String[] array = new String[length];
		for(int i = 0; i < length; i++)
			array[i] = next();
		return array;
	}
	
	public double nextDouble() {
		return Double.parseDouble(next());
	}
	
	public double[] nextDoubleArray(int length) {
		double[] array = new double[length];
		for(int i = 0; i < length; i++)
			array[i] = nextDouble();
		return array;
	}
	
	public int nextInt() {
		return Integer.parseInt(next());
	}
	
	public int[] nextIntArray(int length) {
		int[] array = new int[length];
		for(int i = 0; i < length; i++)
			array[i] = nextInt();
		return array;
	}
	
	public long nextLong() {
		return Long.parseLong(next());
	}
	
	public long[] nextLongArray(int length) {
		long[] array = new long[length];
		for(int i = 0; i < length; i++)
			array[i] = nextLong();
		return array;
	}
	
	public boolean ready() {
		try {
			return br.ready();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return false;
	}
}


Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <utility>
#include <climits>
#include <iomanip>
using namespace std;
#define MAXSIZE 100005
#define MAXL 100
#define MOD_CONST 1000000007
typedef long long int lli;

int main(){
    int n;
    cin >> n;
    int ans = 0;
    for(int i = 1; i <= n; ++i){
        string i_str = to_string(i);
        
        if(i_str.length() % 2 == 1){
            ans++;
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
N = gets.to_i


v = 2

while true
	x = v * (v - 1) / 2
	if x == N
		break
	elsif x > N
		puts "No"
		exit
	end
	v += 1
end

puts "Yes"
puts v

table = v.times.collect{[]}

#p table
n = 1
v.times{|i|
	v.times{|j|
		if i < j
			table[i] << n
			table[j] << n
			n += 1
		end
	}
}
table.each{|list|
	puts "#{list.length} " + list.join(" ")
}



Measured memory_bytes: 5372
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n,x,i,j,k,base=0,ans=0;
  ll dp[2]={};
  cin>>n>>x;
  ll a[n+2],b[n+2];
  a[0]=a[n+1]=0;
  for(i=1;i<=n;i++){
    cin>>a[i];
    if(a[i]>x) base+=a[i]-x,a[i]=x;
  }
  for(i=1;i<=n;i++){
    if(!a[i]) ans+=min(dp[0],dp[1]),dp[0]=dp[1]=0;
    else dp[i%2]+=max(0LL,a[i]-min(x-a[i-1],x-a[i+1]));
  }
  ans+=min(dp[0],dp[1]);
  for(i=0;i<=n+1;i++) b[i]=a[i];
  k=0;
  for(i=1;i<=n;i++){
    if(b[i]+b[i+1]>x) j=b[i]+b[i+1]-x,b[i+1]-=j,k+=j;
  }
  ans=min(ans,k);
  for(i=0;i<=n+1;i++) b[i]=a[i];
  k=0;
  for(i=n;i>=1;i--){
    if(b[i]+b[i-1]>x) j=b[i]+b[i-1]-x,b[i-1]-=j,k+=j;
  }
  ans=min(ans,k);
  cout << base+ans << endl;
  return 0;
}


Measured memory_bytes: 1920
import sys
input = sys.stdin.readline
from collections import deque

nn = 200200
mod = 10**9+7

fa = [1] * (nn+1)
fainv = [1] * (nn+1)
inv = [1] * (nn+1)
for i in range(nn):
    fa[i+1] = fa[i] * (i+1) % mod
fainv[-1] = pow(fa[-1], mod-2, mod)
for i in range(nn)[::-1]:
    fainv[i] = fainv[i+1] * (i+1) % mod
for i in range(1, nn)[::-1]:
    inv[i] = fainv[i] * fa[i-1]

C = lambda a, b: fa[a] * fainv[b] % mod * fainv[a-b] % mod if 0 <= b <= a else 0

N = int(input())
X = [[] for i in range(N)]
for i in range(N-1):
    x, y = map(int, input().split())
    X[x-1].append(y-1)
    X[y-1].append(x-1)

P = [-1] * N
Q = deque([0])
R = []
while Q:
    i = deque.popleft(Q)
    R.append(i)
    for a in X[i]:
        if a != P[i]:
            P[a] = i
            X[a].remove(i)
            deque.append(Q, a)

BU = [1] * N
TD = [1] * N
SI = [1] * N
for i in R[::-1]:
    a = 1
    s = 1
    for j in X[i]:
        a = a * BU[j] % mod
        s += SI[j]
    SI[i] = s
    BU[i] = inv[s] * a % mod

for i in R:
    c = len(X[i])
    AL = [1] * (c + 1)
    AR = [1] * (c + 1)
    for k, j in enumerate(X[i]):
        AL[k+1] = AL[k] * BU[j] % mod
    for k in range(c-1, -1, -1):
        j = X[i][k]
        AR[k] = AR[k+1] * BU[j] % mod
    for k, j in enumerate(X[i]):
        TD[j] = TD[i] * AL[k] % mod * AR[k+1] % mod * inv[N - SI[j]] % mod

for i in range(N):
    print(BU[i] * fa[SI[i]] % mod * TD[i] % mod * fa[N - SI[i]] % mod * C(N-1, SI[i] - 1) % mod)

Measured memory_bytes: 126156
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;

vector<int> bfs(int s, int N, vector<vector<int>> &graph){
  vector<int> dist(N, INF);
  dist[s] = 0;
  queue<int> q;
  q.push(s);
  while(!q.empty()){
    int p = q.front(); q.pop();
    for(auto v : graph[p]){
      if(dist[v] != INF) continue;
      dist[v] = dist[p]+1;
      q.push(v);
    }
  }
  return dist;
}

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

  vector<vector<int>> graph(N);
  REP(i, N-1){
    int u, v;
    cin >> u >> v;
    u--; v--;
    graph[u].emplace_back(v);
    graph[v].emplace_back(u);
  }

  auto dist1 = bfs(0, N, graph);
  auto dist2 = bfs(N-1, N, graph);

  int cnt = 0;
  REP(i, N){
    if(dist1[i] <= dist2[i]) cnt++;
    else cnt--;
  }

  if(cnt > 0) cout << "Fennec" << endl;
  else cout << "Snuke" << endl;

  return 0;
}

Measured memory_bytes: 7876
#include <stdio.h>

int main(void){
	int i,j,tmp;
	int N,flag=1,count=0;
	int A[100];

	//input
	scanf("%d",&N);
	for(i=0;i<N;i++){
		scanf("%d",&A[i]);
	}

	//bubble sort
	while(flag){
		flag = 0;
		for(j=N-1;j>0;j--){
			if(A[j]<A[j-1]){
				tmp = A[j];
				A[j]=A[j-1];
				A[j-1]=tmp;
				flag = 1;
				count++;
			}
		}
	}

	//output
	for(i=0;i<N;i++){
		printf("%d",A[i]);
		if(i<N-1) printf(" ");
	}
	printf("\n");
	printf("%d\n",count);

return 0;

}

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


Measured memory_bytes: 256
N, C = map(int, input().split())
D = [tuple(map(int, input().split())) for _ in range(C)]
color = [tuple(map(int, input().split())) for _ in range(N)]

wrongness = [[0, 0, 0] for _ in range(C)]

for c in range(C):
    for i in range(N):
        for j in range(N):
            wrongness[c][(i + j) % 3] += D[color[i][j] - 1][c]

ans = 10**18

for c1 in range(C):
    for c2 in range(C):
        for c3 in range(C):
            if c1 == c2 or c2 == c3 or c3 == c1:
                continue
            ans = min(ans, wrongness[c1][0] + wrongness[c2][1] + wrongness[c3][2])

print(ans)

Measured memory_bytes: 48220
#include <iostream>

int main()
{
	int X;
	int Y;
	std::cin >> X;
		if (X < 1200)
		{
			std::cout << "ABC" << std::endl;
		}
		else if (X < 2800)
		{
			std::cout << "ARC" << std::endl;
		}
		else
		{
			std::cout << "AGC" << std::endl;
		}
}

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

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

    int N, M, X;
    vector<int> A;
    cin >> N >> M >> X;
    A.resize(M, 0);
    for(int i = 0; i < M; ++i){
        cin >> A[i];
    }

    int rightPath = 0, leftPath = 0;
    for(int i = X; i < N; ++i){
        for(int j = 0; j < M; ++j){
            if(i == A[j]){
                rightPath++;
            }
        }
    }
    for(int i = X; i > 0; --i){
        for(int j = 0; j < M; ++j){
            if(i == A[j]){
                leftPath++;
            }
        }
    }

    if(rightPath <= leftPath){
        cout << rightPath << "\n";
    }
    else{
        cout << leftPath << "\n";
    }

    return 0;
}


Measured memory_bytes: 256
/*
 * 17-04-08_ARC071_A.cpp
 *
 *  Created on: 2017/04/08
 *      Author: ryoma
 */

#include<iostream>
#include<algorithm>
#include<map>
#include<string>

using namespace std;

int n;
string S[60];
map<char,int> mp[60];
int main(){
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> S[i];
		for(int j=0;j<S[i].size();j++){
			mp[i][S[i][j]]++;
		}
	}
	for(int i=1;i<n;i++){
		for(auto itr=mp[0].begin();itr != mp[0].end();itr++){
			if(mp[i].find(itr->first) == mp[i].end()){
				mp[0].erase(itr);
				continue;
			}
			itr->second = min(itr->second,mp[i][itr->first]);
		}
	}
	S[0].clear();
	for(auto itr=mp[0].begin();itr != mp[0].end();itr++){
		//cout << itr->first << itr->second << endl;
		for(int i=0;i<itr->second;i++){
		S[0] += itr->first;
		}
	}

	cout << S[0] << endl;
	return 0;
}




Measured memory_bytes: 256
A, B, C = map(int, input().split())

sumA = 0
i = 1
ans = False

while sumA <= A * B + C :
    sumA += i * A
    if sumA % B == C :
        ans = True
        break
    #i += 1

if ans == True :
    print('YES')
else :
    print('NO')


Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define sort stable_sort 
using namespace std; 

int _; 

long long a,b,c,d,ans=-1e18;  

int main()
{	
	//for(scanf("%d",&_);_;_--)
	scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
	ans=max(a*c,ans);
	ans=max(b*c,ans);
	ans=max(a*d,ans);
	ans=max(b*d,ans);
	printf("%lld\n",ans);
	return 0;
}  

Measured memory_bytes: 3812
/*   三玖天下第一！！！  */
#include<bits/stdc++.h>
using namespace std;
const int maxn=5e3,maxm=200;
int n,m,b[maxm+5][maxn+5]={},L[maxn+5]={},R[maxn+5]={};
long long ans=0,temp,a[maxn+5]={},sum[maxn+5][maxn+5]={};
stack<int> st;
inline int dread()
{
	int x=0;bool f=1;char ch=getchar();
	for(;ch<'0'||ch>'9';ch=getchar())f^=(ch=='-');
	for(;ch>='0'&&ch<='9';ch=getchar())x=(x<<1)+(x<<3)+(ch^48);
	return f?x:-x;
}
inline long long dis(int xx,int yy){return abs(a[yy]-a[xx]);}
inline void Kaslana()
{
	n=dread();m=dread();
	for(int i=2;i<=n;i++) a[i]=dread()+a[i-1];
	for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) b[j][i]=dread();
}
inline void Raiden()
{
	for(int k=1;k<=m;k++)
	{
		for(int i=1;i<=n;st.push(i++)) for(;!st.empty()&&b[k][st.top()]<=b[k][i];st.pop()) R[st.top()]=i-1;
		for(;!st.empty();st.pop()) R[st.top()]=n;
		for(int i=n;i>=1;st.push(i--)) for(;!st.empty()&&b[k][st.top()]<=b[k][i];st.pop()) L[st.top()]=i+1;
		for(;!st.empty();st.pop()) L[st.top()]=1;
		for(int i=1;i<=n;i++) sum[L[i]][i]+=b[k][i],sum[L[i]][R[i]+1]-=b[k][i],sum[i+1][i]-=b[k][i],sum[i+1][R[i]+1]+=b[k][i];
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++) sum[i][j]+=sum[i][j-1];
		for(int j=1;j<=n;j++) sum[i][j]+=sum[i-1][j];
		for(int j=i;j<=n;j++) ans=max(ans,sum[i][j]-dis(i,j));
	}
}
inline void Zaychik()
{
	printf("%lld\n",ans);
}
int main()
{
    Kaslana(),Raiden(),Zaychik();return 0;
}


Measured memory_bytes: 199936
#pragma region template
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9 + 7, MAX = LLONG_MAX, larg = 1e5, INF = -1e9;
long long A, B, C, D, E, F, G, H, I, J, K, L, N, M, O, P, Q, R, S, T, U, V, W;
typedef long long ll;
typedef pair<ll, ll> Pa;

vector<int> to[100000];
int range[2][100000];

void dfs(int which, int curr, int prev){
    rep(i, to[curr].size()){
        int next = to[curr][i];
        if(prev == next) continue;
        range[which][next] = range[which][curr] + 1;
        dfs(which, next, curr);
    }
}

int main() {
    cin >> N;
    rep(i, N-1){
        cin >> A >> B; A--; B--;
        to[A].push_back(B);
        to[B].push_back(A);
    }
    dfs(0, 0, -1);
    dfs(1, N-1, -1);
    int point = 0;
    rep(i, N){
        if(range[0][i] <= range[1][i]) point++;
        else point--;
    }
    if(point > 0) cout << "Fennec";
    else cout << "Snuke";
}


Measured memory_bytes: 14336
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int s;
	for(int i=0;pow(2,i)<=n;i++)
	{
		s=pow(2,i);
	} 
	cout<<s<<endl;
 	return 0;
}


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

typedef long long ll;

using namespace std;

int main() {
    int x;
    cin >> x;
    cout << x * x * x << endl;
    return 0;
}




Measured memory_bytes: 3096
input()
n = [int(i) for i in input().split()]
l = []
ret = 0
for index, i in enumerate(n):
    if i > 0:
        if i in l:
            ret = index + 1
            break
        l.append(i)
    else:
        try:
            if l.pop(-1) != abs(i):
                ret = index + 1
                break
        except:
            ret = index + 1
            break
if ret == 0:
    print('OK')
else:
    print(ret)
            


Measured memory_bytes: 5620
open System.Linq
open System.Text.RegularExpressions

let input() = stdin.ReadLine()
let inputs() = input().Split()

let YN b = printfn "%s" (if b then "Yes" else "No")
let print x = printfn "%A" x
let printS (s: string) = printfn "%s" s


let N = int (input())

seq {
    for x in [ 1 .. N ] do
        if string(x).Length % 2 = 1 then yield 1
}
|> Seq.sum
|> print


Measured memory_bytes: 25300
#include <algorithm>
#include <iostream>
#include <sstream>
#include <vector>
#include <string>

using namespace std;

int gcd(int x, int y) {
  if (y == 0) {
    return x;
  } else {
    return gcd(y, x%y);
  }
}
int main() {
  string str;
  getline(cin, str);
  istringstream istr(str);
  vector<int> v;
  string tmp;
  while (getline(istr, tmp, ' ')) {
    v.push_back(stoi(tmp));
  }
  int a = v.front();
  int b = v.back();
  cout << gcd(max(a, b), min(a, b)) << endl;
}

Measured memory_bytes: 1224
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ld = long double;
// constexpr auto mod = 1000000007;
using namespace std;

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

  vector<ll> L(N + 1);
  if (N == 1) {
    cout << 1 << endl;
  }
  else {
    L[0] = 2;
    L[1] = 1;
    FOR(i, 2, N + 1) {
      L[i] = L[i - 1] + L[i - 2];
    }
    cout << L[N] << endl;
  }
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
 
public class Hello{
    public static void Main(){
/*        string[] input = ReadLine().Split(' ');
        int n = int.Parse(input[0]);
        int m = int.Parse(input[1]);
//        int a = int.Parse(input[2]);
//        int b = int.Parse(input[3]);*/
//        string temp = ReadLine();
//        int a = int.Parse(ReadLine());
//        int b = int.Parse(ReadLine());
//        int c = int.Parse(ReadLine());
//        int d = int.Parse(ReadLine());
        string a = ReadLine();
//        string b = ReadLine();
//        string c = ReadLine();
//        string ko = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        string b = a.Substring(0,4) + " " + a.Substring(4);
            WriteLine(b);
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	string s;
	cin>>s;
	for(ll i=0;i<s.size();i++){
		cout << 'x';
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

int main() {
    int A, B;
    cin >> A >> B;
    bool c1 = A%3 == 0;
    bool c2 = B%3 == 0;
    bool c3 = (A+B)%3 == 0;
    cout << ((c1||c2||c3)?"Possible":"Impossible") << endl;
}


Measured memory_bytes: 3636
#include <iostream>
#include <stdio.h>

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

    scanf("%d %d %d", &a, &b, &c);
    if (a < b and b < c) {
        std::cout << "Yes\n";
    } else {
        std::cout << "No\n";
    }

    return 0;
}

Measured memory_bytes: 1172
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <bitset>
#include <math.h>
#include <iomanip>
#include <queue>
#define inp(X) cin >> X
#define out(X) cout << X << endl
#define out16(X) cout << setprecision(16) << X << endl
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define MAX(A) *max_element(A.begin(),A.end())
#define MIN(A) *min_element(A.begin(),A.end())
#define SORT(A) sort(A.begin(),A.end())
#define REV(A) reverse(A.begin(),A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vd = std::vector<double>;
using vvd = std::vector<std::vector<double>>;
using vll = std::vector<ll>;
using vvll = std::vector<std::vector<ll>>;
using namespace std;
#define MOD 1000000007
#define INF 1000000001
#define LL_INF 1001001001001001001

ll gcd(ll x, ll y){
	if(y==0) return x;
	return gcd(y,x%y);
}

bool bfs(vector<vector<int>> g, vector<int> &dist, int sv){
	queue<int> q;
	q.push(sv);
	dist[sv]=0;
	while(!q.empty()){
		int now = q.front(); q.pop();
		for(auto v : g[now]){
			if(dist[v]!=-1) continue;
			dist[v] = dist[now]+1;
			q.push(v);
		}
	}
}

int main(void) {
	ll a,b,k; cin >> a >> b >> k;
	ll t = min(a,k);
	a -= t;
	if(a==0) b -= min(b,k-t);
	cout << a << " " << b << endl;
}




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

#define ipair pair<int,int>
#define rep(i,n) for(i=0;i<n;i++)
#define repj(i,j,n) for(i=j;i<n;i++)

#define PB(a,i) (a).push_back(i)
#define ALL(a) (a).begin(),(a).end()
#define SIZE(a,n) (a).resize(n)
#define SORT(a) sort(ALL(a))
#define VSORT(a, type) sort(ALL(a),greater<type>())
#define MAPIN(a,i,j) (a).insert(make_pair(i,j))

#define OK(i) cout<<"OK "<<i<<endl
#define Yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define NO cout<<"NO"<<endl

using namespace std;

typedef long long int lli;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< vi > Matrix;

int main() {
	string s;
	char c;
	vll t;
	ll i, j, k, m, x;

	cin >> s;
	k = s.length();
	SIZE(t, s.length());

	rep(i, k) {
		if (s[i] == 'R') {
			m = 0;
			j = i;
			while (s[j] == 'R') {
				m++;
				j++;
			}
			if (m % 2 == 0) {
				t[j] += m / 2;
				x = j - 1;
				t[x] += m / 2;
				i = j;
			}
			else {
				x = j;
				j -= 1;
				t[j] += m / 2 + 1;
				t[x] += m / 2;
				i = x;
			}
		}
	}
	for (i = k - 1; i >= 0; i--) {
		if (s[i] == 'L') {
			m = 0;
			j = i;
			while (s[j] == 'L') {
				m++;
				j--;
			}
			if (m % 2 == 0) {
				t[j] += m / 2;
				x = j + 1;
				t[x] += m / 2;
				i = j;
			}
			else {
				x = j;
				j += 1;
				t[j] += m / 2 + 1;
				t[x] += m / 2;
				i = x;
			}
		}
	}

	rep(i, k) {
		cout << t[i] << " ";
	}
	

	return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin >> s ;
  vector<char> a;
  
  for(int i =0; i < s.size() ; i++){
    if(s.at(i) == '0') a.push_back('0');
    else if(s.at(i) == '1') a.push_back('1');
    else if(s.at(i) == 'B' && a.size() > 0) a.pop_back();
  }
  for(int i=0; i < a.size() ; i++) cout << a.at(i) ;
}

Measured memory_bytes: 3604
import java.util.*;
public class Main {
    public static void main(String args[]) {
        Scanner in=new Scanner(System.in);
        int n=in.nextInt(),d=0,cur=0;
        for(int i=0;i<n;i++){
            int d1=in.nextInt(),d2=in.nextInt();
            if(d1==d2){
                cur++;
            }
            else{
                d=Math.max(d,cur);
                cur=0;
            }
        }
        d=Math.max(cur,d);
        if(d>=3)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}

Measured memory_bytes: 36056
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str;
		String now = "A";
		while((str=br.readLine())!=null){
			String[] c = str.split(",");
			if(now.equals(c[0]))
				now=c[1];
			else if(now.equals(c[1]))
					now=c[0];
		}
		System.out.println(now);
	}
}

Measured memory_bytes: 16908
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
template<typename T>
int sz(const T &a){return (int)a.size();}
vector<char> ans;
string ins[(int)1e5+1];
vector<int> used[3];
int main(){
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);
    int n;
    lli a,b,c;
    cin>>n>>a>>b>>c;
    string in;
    bool work=true;
    for(int i=0;i<n;i++) {
        cin >> ins[i];
        used[ins[i][0]-'A'].push_back(i);
        used[ins[i][1]-'A'].push_back(i);
    }
    used[0].push_back(n+1);
    used[1].push_back(n+1);
    used[2].push_back(n+1);
    for(int i=0;i<n;i++){
        in =ins[i];
        if(in=="AB"){
            if(b==a){
                if(used[0][lower_bound(used[0].begin(),used[0].end(),i+1)-used[0].begin()]<used[1][lower_bound(used[1].begin(),used[1].end(),i+1)-used[1].begin()]){
                    a+=1;
                    b-=1;
                    ans.push_back('A');
                }
                else{
                    b+=1;
                    a-=1;
                    ans.push_back('B');
                }
            }
            else if(b<a){
                b+=1;
                a-=1;
                ans.push_back('B');
            }
            else{
                a+=1;
                b-=1;
                ans.push_back('A');
            }
        }
        else if(in=="AC"){
            if(c==a){
                if(used[0][lower_bound(used[0].begin(),used[0].end(),i+1)-used[0].begin()]<used[2][lower_bound(used[2].begin(),used[2].end(),i+1)-used[2].begin()]){
                    a+=1;
                    c-=1;
                    ans.push_back('A');
                }
                else{
                    c+=1;
                    a-=1;
                    ans.push_back('C');
                }
            }
            else if(c<a){
                c+=1;
                a-=1;
                ans.push_back('C');
            }
            else{
                a+=1;
                c-=1;
                ans.push_back('A');
            }
        }
        else{
            if(b==c){
                if(used[2][lower_bound(used[2].begin(),used[2].end(),i+1)-used[2].begin()]<used[1][lower_bound(used[1].begin(),used[1].end(),i+1)-used[1].begin()]){
                    c+=1;
                    b-=1;
                    ans.push_back('C');
                }
                else{
                    b+=1;
                    c-=1;
                    ans.push_back('B');
                }
            }
            else if(b<c){
                b+=1;
                c-=1;
                ans.push_back('B');
            }
            else{
                c+=1;
                b-=1;
                ans.push_back('C');
            }
        }
        if(a<0||b<0||c<0){
            work=false;
        }
    }
    if(work){
        printf("Yes\n");
        for(char x:ans)printf("%c\n",x);
    }
    else printf("No\n");
    return 0;
}

Measured memory_bytes: 7764
#include<iostream>
using namespace std;
static const int MAX=100;
static const int INFTY=(1<<21);
static const int WHITE=0;
static const int GRAY=1;
static const int BLACK=2;

int n,m[MAX][MAX];

int prim(){
  int u,minv;
  int d[MAX],p[MAX],color[MAX];

  for(int i=0;i<n;i++){
    d[i]=INFTY;
    p[i]=-1;
    color[i]=WHITE;
  }

  d[0]=0;

  while(1){
    minv=INFTY;
    u=-1;
    for(int i=0;i<n;i++){
      if(minv>d[i]&&color[i]!=BLACK){
	u=i;
	minv=d[i];
      }
    }
    if(u==-1) break;
    color[u]=BLACK;
    for(int v=0;v<n;v++){
      if(color[v]!=BLACK&&m[u][v]!=INFTY){
	if(d[v]>m[u][v]){
	  d[v]=m[u][v];
	  p[v]=u;
	  color[v]=GRAY;
	}
      }
    }
  }
  int sum=0;
  for(int i=0;i<n;i++){
    if(p[i]!=-1) sum+=m[i][p[i]];
  }
  return sum;
}

int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      int e;
      cin>>e;
      m[i][j]=(e==-1)?INFTY:e;
    }
  }
  cout<<prim()<<endl;

  return 0;
}



Measured memory_bytes: 3128
#include<iostream>
#include<math.h>
#include<string.h>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<deque>
using namespace std;
 
int main(){
	string s;
	cin >> s;
	if(s=="ABC")cout << "ARC" << endl;
	else cout << "ABC" << endl;
	return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include<map>
#define REPD(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) REPD(i, 0, n)

using namespace std;
#define fin(ans) cout << (ans) << '\n'
int main()
{
    int N,A,B;
    cin >> N >> A >> B;
    fin((B > N*A)? N*A:B);
    return 0;
}

Measured memory_bytes: 3196