akhauriyash/Code-Regression huggingface dataset:
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

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

/* Macros reg. ends here */

const ll INF = 1LL << 50;

int main() {
  // ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll n;
  cin >> n;

  vll as(n), bs(n);
  rep(i, n) cin >> as[i];
  rep(i, n) cin >> bs[i];

  ll chk = 0;
  rep(i, n) {
    if (as[i] > bs[i])
      chk += as[i] - bs[i];
    else
      chk -= (bs[i] - as[i]) / 2;
  }
  string ans = chk > 0 ? "No" : "Yes";

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3760
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>
using namespace std;


/*--- Macro ---*/
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define rep1(i, n) for(int i=1; i<(int)n; i++)
#define mp make_pair
#define pb push_back


/*---  Type ---*/
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;


/*--- Constants ---*/
template <typename T> const T INF = numeric_limits<T>::max() / 10;
const int MOD = (int)1e9 + 7;

// 4-direction
int dy4[] = {0,  1, -1,  0};
int dx4[] = {1,  0,  0, -1};

// 8-direction
int dy8[] = {0,  1,  1,  1,  0, -1, -1, -1};
int dx8[] = {1,  1,  0, -1, -1, -1,  0,  1};

// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

int main() {
  ll w, h, x, y;
  cin >> w >> h >> x >> y;

  int hoge = (2*y==h && 2*x==w) ? 1 : 0;
  printf("%.10f %d\n", (w/2.0)*h, hoge);

  return 0;
}

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

const long long INF = 1LL<<60;

int main() {
    int n, k;
    cin >> n >> k;
    int h[100100];
    for (int i = 0; i < n; i++) cin >> h[i];

    long long dp[100100];
    for (int i = 0; i < 100100; i++) dp[i] = INF;

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

    cout << dp[n - 1] << endl;
    return 0;
}

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

int main() {
 int i,k;
 string s;
 cin>>k>>s;

if(s.size()<=k){
  cout<<s<<endl;
}
else {
	for(i=0;i<k;i++){
		cout<<s.at(i);
	}
		cout<<"..."<<endl;
}	
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<vector<pii> > vvpii;

#define pb push_back
#define mp make_pair
#define endl '\n'
#define INF (ll)1e10

ll n, m;
ll dsu[100010], weight[100010], cnt[100010];

ll root(ll a){
	if(dsu[a] != a){
		dsu[a] = root(dsu[a]);
	}
	return dsu[a];
}

int main(){
	cin >> n >> m;
	for(ll i = 0; i < n; i++){
		cin >> weight[i];
		dsu[i] = i;
	}
	vector<pair< ll, pair<ll,ll> > > edges;
	for(ll i = 0; i < m; i++){
		ll x, y, z;
		cin >> x >> y >> z;
		edges.emplace_back( mp(z, mp(x-1, y-1) ) );
	}
	sort(edges.begin(), edges.end());
	ll good_edges = 0;
	for(ll i = 0; i < m; i++){
		ll w = edges[i].first;
		ll a = root( edges[i].second.first );
		ll b = root( edges[i].second.second );
		if(a!=b){
			dsu[a] = b;
			weight[b] = min(weight[b]+weight[a],INF);
			cnt[b] += cnt[a];
		}
		cnt[b]++;
		if(weight[b] >= w){
			good_edges += cnt[b];
			cnt[b] = 0;
		}
	}
	cout << m - good_edges;
}

Measured memory_bytes: 7540
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		bool[] fbd = new bool[N + 1];
		foreach(var n in A) fbd[n] = true;
		int[] dp = new int[N + 1];
		int mod = (int) 1e9 + 7;
		dp[0] = 1;
		for(int i=0;i<N;i++){
			for(int j=1;j<=2;j++){
				if(i + j <= N && !fbd[i + j]){
					dp[i + j] += dp[i];
					if(dp[i + j] >= mod) dp[i + j] -= mod;
				}
			}
		}
		
		Console.WriteLine(dp[N]);
		
	}
	int N,M;
	int[] A;
	public Sol(){
		var d = ria();
		N = d[0]; M = d[1];
		A = new int[M];
		for(int i=0;i<M;i++){
			A[i] = ri();
		}
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


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

#define int long long
#define ci(m)     for(int i=0;i<m;i++)
#define cj(m)     for(int j=0;j<m;j++)
#define ck(m)     for(int k=0;k<m;k++)
#define gcd            __gcd
#define endl           "\n"
#define pb             emplace_back
#define setbits(x)     __builtin_popcountll(x)
#define zrobits(x)     __builtin_ctzll(x)
#define mod            1000000007
#define mod2           998244353
#define maxe           *max_element
#define mine           *min_element
#define inf            1e18
#define deci(x, y)      fixed<<setprecision(y)<<x
#define w(t)           int t; cin>>t; while(t--)
#define nitin          ios_base::sync_with_stdio(false); cin.tie(NULL)
#define PI             3.141592653589793238
using namespace std;
int n,t;
pair<int,int> tr_f[3001];
int dp[3001][3001];
int solve(int idx,int bacha_hua)
{
    if(idx==n)
    {
        return 0;
    }
    if(bacha_hua<=0)
        return 0;
    if(dp[idx][bacha_hua]!=-1)
        return dp[idx][bacha_hua];
    int op1=solve(idx+1,bacha_hua);
    int op2=solve(idx+1,bacha_hua-tr_f[idx].first)+tr_f[idx].second;
    return dp[idx][bacha_hua]=max(op1,op2);
}
int32_t main() {
    nitin;
    for(auto &c:dp) for(auto &d:c) d=-1;
    cin>>n>>t;
    for(int i=0;i<n;i++)
    {
        cin>>tr_f[i].first>>tr_f[i].second;
    }
    sort(tr_f,tr_f+n);
//    for(int i=0;i<n;i++)
//    {
//        cout<<tr_f[i].first<<" "<<tr_f[]
//    }
    cout<<solve(0,t)<<endl;
    return 0;
}

Measured memory_bytes: 74192
#%%
import math 

a, b, x = map(int, input().split())
if x == a*a*b:
    print(0)
elif x >= a*a*b/2:
    y = 2*(b-x/(a**2))
    ans = math.degrees(math.atan(a/y))
    print(90 - ans)
else:
    y = 2*(x/(a*b))
    ans = math.degrees(math.atan(y/b))
    print(90 - ans)

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

const long long INF = 1LL << 60;

long long min(long long a, long long b) {
    if(a < b) {
        return a;
    } else {
        return b;
    }
}

int main() {
    int n;
    cin >> n;
    vector<long long> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    vector<long long> dp(n+2);

    dp[0] = 0;

    for (int i = 1; i < n+2; i++) {
        dp[i] = INF;
    }

    for (int i = 0; i < n; i++) {
        dp[i+1] = min(dp[i+1], dp[i] + abs(a[i+1] - a[i]));
        dp[i+2] = min(dp[i+2], dp[i] + abs(a[i+2] - a[i]));
    }
        cout << dp[n-1] << endl;

    return 0;
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		try(Scanner sc = new Scanner(System.in)) {
		
			int n = sc.nextInt();
			
			char[] stones = sc.next().toCharArray();
			
			
			//基本は入れ替えすればよい
			int lp = 0;
			int rp = n-1;
			
			int count = 0;
			while(true) {
				while( stones[lp] == 'R' && lp < n-1) {
					lp++;
				}
				while( stones[rp] == 'W' && rp > 0) {
					rp--;
				}
				
//				System.out.println(lp + " " + rp);
				
				if ( lp >= rp) {
					break;
				}
				
				if ( stones[lp] == 'W' && stones[rp] == 'R' ) { 
					stones[lp] = 'R';
					stones[rp] = 'W';
					count++;
				}

			}
			
			System.out.println(count);
			
		}
	}

}

Measured memory_bytes: 40948
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin>>n;
	int a[n+1];
	for (int i=1;i<=n;i++) cin>>a[i];
	ll ans=0;
	for (int i=2;i<=n;i++){
		if (a[i]<a[i-1]) ans+=a[i-1]-a[i],a[i]=a[i-1];
	}
	cout<<ans;
}

Measured memory_bytes: 4388
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{
    long A;
    long B;
    long C;
    long K;

    scanf("%ld %ld %ld %ld", &A, &B, &C, &K);

    if (K < A) {
        printf("%ld\n", K);
    } else if (K <= A + B) {
        printf("%ld\n", A);
    } else {
        printf("%ld\n", A - (K - (A + B)));
    }

    return 0;
}

Measured memory_bytes: 2172
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin>>s;
	int ans=0,n=s.size();
	vl v(n+1);
	rep(i,n){
		v[i+1]=v[i]+(s[i]=='R'?1:-1);
	}
	vl md;
	rep(i,n+1){
		if(v[i]%4==0)md.push_back(v[i]/4);
	}
	range(i,1,md.size())ans+=max(0,md[i]-md[i-1]);
	cout<<ans<<endl;
}



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

int main() {
  int n,m;
  cin >> n >> m;
  int a[n];
  memset(a,0,sizeof(a));
  for(int i=0; i<m; i++) {
    int x,y;
    cin >> x >> y;
    for(int j=x; j<x+y; j++) a[j%n]=1;
  }
  map<int,int> ans;
  for(int i=0; i<n; i++) {
    if(!a[i]) continue;
    int cnt=1;
    queue<int> que;
    que.push(i);
    a[i]=0;
    while(!que.empty()) {
      int x=que.front();que.pop();
      for(int i=-1; i<=1; i++) {
        int y=(x+i+n)%n;
        if(a[y]) {
          que.push(y);
          a[y]=0;
          cnt++;
        }
      }
    }
    ans[cnt]++;
  }
  for(map<int,int>::reverse_iterator it=ans.rbegin(); it!=ans.rend(); it++) cout << it->first << " " << it->second << endl;
  return 0;
}


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

using namespace std;

int main() {
	int N, X, m, min = 10E5, sum = 0, answer = 0;
	vector<int> vm;
	cin >> N >> X;
	for (int i = 0; i < N; i++) {
		cin >> m;
		vm.push_back(m);
	}

	for (int i = 0; i < N; i++) {
		if (vm[i] < min) min = vm[i];
		sum += vm[i];
	}

	if (X < sum) {
		cout << answer;
		return 0;
	}else {
		X -= sum;
		answer = N;
	}

	answer += X / min;

	cout << answer;
	char x;
	cin >> x;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
 
int main(){
  int number;
  int numCase = 1;
  
  while(true) {
    cin >> number;
    
    if(number == 0) {
      break;
    }
    
    cout << "Case " << numCase << ": " << number << endl;
    numCase++;
  }
  return 0;
}

Measured memory_bytes: 2956
/*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<long long> vll;
typedef vector<int> vi;

#define io ios_base::sync_with_stdio(false)
#define pb push_back

#define eb emplace_back
#define mod   1000000007
#define PI 2*acos(0.0)
#define all(r)(r).begin(),(r).end()
#define dbg(a) cout<<#a<<" ->->->-> "<<a<<"\n"
#define inf 1000000000000000000
#define N 2000
int dirx[] = {1, -1,0, 0}, diry[] = {0, 0, 1, -1};



//=============================================ASIFAZAD==============================================//

int32_t main()
{
    io;
    int n;
    cin>>n;
    vi inp(n);
    for(auto& x: inp) cin>>x;
    vi suf(n+1);
    for(int i = n-1; i >= 0; i--)
        suf[i] = (suf[i+1] + inp[i])%mod;
    ll ans = 0;
    for(int i = 0; i< n; i++)
        ans = (ans + 1LL*inp[i]*suf[i+1])%mod;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 4840
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#include<deque>
#include<map>
using namespace std;
typedef long long ll;

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    
    ll ans = 0;
    ll mod = 1e9+7;
    for (int i = 0; i <= 60; i++)
    {
        int tmp = 0;
        for (int j = 0; j < n; j++)
        {
            if ((a[j]>>i) & 1) tmp++;
        }
        ans = (ans + (1ll<<i)%mod*tmp%mod*(n-tmp))%mod;
    }
    
    cout << ans << endl;
    return 0;
}


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

int main(void){
  int h, n;
  cin >> h >> n;
  int sum = 0;
  rep(i,n) {
    int a;
    cin >> a;
    sum += a;
  }
  if(sum >= h) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3632
//In The Name Of Allah
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x.size())
#define double long double 
#define fi first
#define se second
#define pii pair<int, int>

const int N = 1e5 + 100, mod = 1e9 + 7;
vector<vector<int>> g(N);
int dp[N][2];

void dfs(int v, int p) {
	for (auto &u : g[v]) {
		if (u != p) {
			dfs(u, v);
		}
	}
	dp[v][0] = dp[v][1] = 1;
	for (auto &u : g[v]) {
		if (u != p) {
			dp[v][0] *= (dp[u][0] + dp[u][1]);
			dp[v][0] %= mod;
			dp[v][1] *= dp[u][0];
			dp[v][1] %= mod;
		}
	}
}
signed main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
	int n;
	cin >> n;
	for (int i = 1; i < n; i++) {
		int u, v;
		cin >> u >> v;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	dfs(1, 0);
	cout << (dp[1][0] + dp[1][1]) % mod << "\n";
}



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

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int n,s;
  cin>>n>>s;
  vector<Int> x(n),p(n);
  for(Int i=0;i<n;i++) cin>>x[i]>>p[i];
  Int l=0,r=n-1;
  vector<Int> dp(n,0);
  while(x[l]<s&&s<x[r]){
    if(p[l]>=p[r]){
      p[l]+=p[r];
      chmax(dp[l],dp[r]+abs(x[r]-x[l]));
      r--;
    }else{
      p[r]+=p[l];
      chmax(dp[r],dp[l]+abs(x[r]-x[l]));
      l++;
    }
  }
  Int ans=0;
  for(Int i=0;i<n;i++) chmax(ans,dp[i]+abs(s-x[i]));
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 2560
#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
	int n,i,t,sum=0;
	int a[210]={};
	while(~scanf("%d",&n)){
		t=2*n;
		for(i=0;i<2*n;i++){
			scanf("%d",&a[i]);
		}sort(a,a+t);
		for(i=0;i<2*n;i+=2){
			sum+=a[i];
		}printf("%d\n",sum);
		sum=0;
	}
}

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

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll T;
	cin >> T;
	map<string,int> mp;
	mp["AC"] = 0;
	mp["WA"] = 0;
	mp["TLE"] = 0;
	mp["RE"] = 0;
	while(T--)
	{
		string s;
		cin >>s;
		mp[s]++;
	}
	cout<<"AC x "<<mp["AC"]<<endl;
	cout<<"WA x "<<mp["WA"]<<endl;
	cout<<"TLE x "<<mp["TLE"]<<endl;
	cout<<"RE x "<<mp["RE"]<<endl;


}


Measured memory_bytes: 3668
def main():
    N = int(input())
    lst_a = list(map(int, input().split()))
    ans = set()

    for i in range(N - 1, -1, -1):
        a = lst_a[i]
        for j in range(i + 1, N + 1, i + 1):
            if j in ans:
                a += 1
        if a % 2:
            ans.add(i + 1)
    
    print(len(ans))
    print(*ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 70108
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		String s = sc.next();
		boolean flag = true;
		for(int i=0 ; i<a+b ; i++) {
			if(i == a) {
				flag &= s.charAt(i) == '-';
			}else {
				flag &= Character.isDigit(s.charAt(i));
			}
		}
		System.out.println(flag ? "Yes":"No");
		
	}
}


Measured memory_bytes: 23636
O = input()
E = input()

if len(O) > len(E):
    for i in range(len(E)):
        print(O[i],end="")
        print(E[i],end="")
    print(O[i+1])
elif len(O) < len(E):
    for i in range(len(O)):
        print(E[i],end="")
        print(O[i],end="")
    print(O[i+1])
else:
    for i in range(len(O)):
        print(O[i],end="")
        print(E[i],end="")

Measured memory_bytes: 3064
import sys
import math  # noqa
import bisect  # noqa
import queue  # noqa


def input():
    return sys.stdin.readline().rstrip()


def main():
    N, K = map(int, input().split())
    S = input()

    cnt = 0
    for i in range(1, N):
        if (S[i - 1] == S[i]):
            cnt += 1

    print(min(cnt + 2 * K, N - 1))


if __name__ == '__main__':
    main()


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

#define pb push_back
const int N = 311;
vector <int> u[N], v[N];
int cnt[N];
bool vis[N];

bool check(int n, int m, int lim) {
	memset(cnt, 0, sizeof cnt);
	memset(vis, 0, sizeof vis);
	for(int i = 1; i <= n; i ++) {
		u[i] = v[i];
		cnt[u[i].back()] ++;
	}
	while(1) {
		int p = max_element(cnt + 1, cnt + m + 1) - cnt;
		if(cnt[p] <= lim) return 1;
		vis[p] = 1;
		for(int i = 1; i <= n; i ++) if(u[i].back() == p) {
			cnt[p] --;
			while(u[i].size() && vis[u[i].back()])
				u[i].pop_back();
			if(u[i].size()) {
				cnt[u[i].back()] ++;
			} else
				return 0;
		}
	}
}

int main() {
	ios :: sync_with_stdio(0);
	int n, m; cin >> n >> m;
	for(int i = 1; i <= n; i ++) {
		for(int j = 1; j <= m; j ++) {
			int x; cin >> x;
			v[i].pb(x);
		}
		reverse(v[i].begin(), v[i].end());
	}
	
	int l = 1, r = n + 1;

	while(l + 1 < r) {
		int im = (l + r) / 2;
		if(check(n, m, im - 1))
			r = im;
		else
			l = im;
	}
	cout << l << '\n';
}

Measured memory_bytes: 1280
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
using namespace std;
int main()
{
    int n,a,b;
    scanf("%d %d %d",&n,&a,&b);
    if((b-a)%2==0) printf("Alice\n");
    else printf("Borys\n");
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
	
	int A,B,C,i,gcd=0;
	scanf("%d %d %d",&A,&B,&C);
	
	while(gcd!=1){
	for(i=100;i>=1;i--){
		if(A%i==0&&B%i==0){
			gcd=i;
			if(gcd==1){
				printf("\nYES\n");
				return 0;
			}
			break;
		}
	}
	A/=gcd;
	B/=gcd;
	if(C%gcd==0){
		C/=gcd;
	}else {
		printf("\nNO\n");
		return 0;
	}
	}
	
}

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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define REPV(iter, v) for(auto (iter)=(v).begin(); (iter)!=(v).end();++(iter))
#define ALL(v) (v).begin(),(v).end()

#define MOD 1000000007

using namespace std;

typedef long long ll;

const ll MAX = 2000001;

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

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main()
{
    ll K;
    cin >> K;
    string S;
    cin >> S;
    ll N = S.size();
    COMinit();

    vector<ll> p25(K + 1), p26(K + 1);
    p25[0] = 1;
    p26[0] = 1;
    REP(i, K)
    {
        p25[i + 1] = (p25[i] * 25) % MOD;
        p26[i + 1] = (p26[i] * 26) % MOD;
    }
    ll ans = 0;
    REP(i, K + 1)
    {
        ll t;
        t = (p25[K - i] * p26[i]) % MOD;
        t = (t * (COM(K - i + N - 1, N - 1))) % MOD;
        ans = (ans + t) % MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 66784
n = int(input())
x_list = []
for _ in range(n):
    x, l = map(int, input().split())
    x_list.append((x + l, x - l))
x_list.sort()
ans = 0
for i in range(n):
    x_max, x_min = x_list[i]
    if i == 0:
        t = x_max
        continue
    if x_min < t:
        ans += 1
        continue
    t = x_max
print(n - ans)

Measured memory_bytes: 16988
#include<stdio.h>

int main() {
	int N;
	scanf("%d", &N);
	if(N >= 64) { printf("64"); return 0; }
	else if (N >= 32) { printf("32"); return 0; }
	else if (N >= 16) { printf("16"); return 0; }
	else if (N >= 8) { printf("8"); return 0; }
	else if (N >= 4) { printf("4"); return 0; }
	else if (N >= 2) { printf("2"); return 0; }
	else if (N == 1) { printf("1"); return 0; }
}

Measured memory_bytes: 128
/**/
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <queue>

typedef long long LL;
typedef unsigned long long ULL;
using namespace std;

int A, B, C;

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	cin >> A >> B >> C;
	if(B < A) { printf("0"); return 0;}
	int n = B / A;
	int ans = min(n, C);
	printf("%d", ans);
	return 0;
}
/**/

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P = pair<string,int>;
const double PI = acos(-1);

int main() {
int a,b;
cin >> a >>b;
if(a+b==15)cout<<"+"<<endl;
else if(a*b==15)cout <<"*"<< endl;
else cout <<"x"<< endl;
}


Measured memory_bytes: 3580
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();
        
        int[] r = new int[3];
        r[0] = a + b;
        r[1] = a - b;
        r[2] = a * b;
        int max = r[0];

        for (int i = 1; i < 3; i++) {
            max = Math.max(max, r[i]);
        }

        System.out.println(max);

    }
}

Measured memory_bytes: 24916
#include <iostream>
using namespace std;
long long K, A, B;

int main(void) {
    // insert code here...
    cin >> K >> A >> B;
    if((B-A)<3){
        cout << 1+K << endl;
    }else{
        long long s = K - (A-1);
        if(s<=0){
            cout << A << endl;
        }else{
            cout << A + (s/2)*(B-A) + s%2 << endl;
        }
        
    }
    
    return 0;
}


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

#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

signed main(){
	int k;
	cin >> k;
	int a, b;
	cin >> a >> b;
	if(b/k > (a-1) / k){
		cout << "OK" << endl;
	}else{
		cout << "NG" << endl;
	}
	return 0;
}


Measured memory_bytes: 3636
#include <stdio.h>

int main () {
  int x,y,i;
  while (1) {
    scanf ("%d %d",&x,&y);
    if (x == 0 && y == 0) break;
    if (x > y) {
      i = x;
      x = y;
      y = i;
    }
    printf ("%d %d\n",x,y);
  }
  return 0;
}

Measured memory_bytes: 600
#include<cstdio>
#include<iostream>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<deque>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<limits>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::multiprecision;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef long long ll;
typedef unsigned long long ull;
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;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}
template<class T>inline void outs(vector<T> V){int n=V.size();rep(i,n)cout<<V[i]<<" \n"[i==n-1];}
inline void solve(void){
  int N,M;in(N,M);
  map<int,int>c,f;
  rep(i,M){
    int p;string s;in(p,s);
    if(f[p]==0&&s=="WA")c[p]++;
    if(f[p]==0&&s=="AC")f[p]++;
  }
  cpp_int cnt=0;
  for(auto e:c){
    if(f[e.ft])cnt+=e.sd;
  }
  cpp_int cnt2=0;
  for(auto e:f)if(e.sd>0)cnt2++;
  cout<<cnt2<<" "<<cnt<<endl;
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 6144
import scala.io.StdIn.readLine

object Main {

  def loop(max:Int, sum:Int, i:Int):Int = {
    i match {
      case 0 => if( sum > max ) sum else max
      case i =>
        val m = readLine().toInt
        val (x,y) =
          if(sum < 0 && m > sum) (max,m)
          else if(m < 0 && sum > max) (sum,sum+m)
          else (max, sum+m)
        loop(x,y,i-1)
    }
  }

  def main(args: Array[String]) = {
    val b = new StringBuilder

    var n = readLine().toInt
    while(n!= 0) {
      b.append(loop(-100000, readLine().toInt, n-1).toString)
      b.append("\n")
      n = readLine().toInt
    }

    print(b.result)
  }
}

Measured memory_bytes: 44164
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<numeric>
#include<algorithm>
#include<tuple>
#include<cmath>
#include <iomanip>

typedef unsigned long long ull;
typedef long long ll;

ll DENOM = 1000000000LL + 7LL;

using namespace std;

ll n, m, k;
ll h, w;

int main(){
    cin >> n;
    ll ret = 0;
    for (int i=1; i<n; ++i){
        ret += (n-1)/i;
    }
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int h , w;
  cin >> h >> w;
  vector<string> a(h);
  for(int i = 0 ; i < h ; i++){
    cin >> a.at(i) ;
  }
  for(int i = 0 ; i < w + 2 ; i++){
    cout << '#' ;
  }
  cout << endl;
  for(int i = 0 ; i < h ; i++){
    cout << '#' << a.at(i) << '#' << endl;
  }
    for(int i = 0 ; i < w + 2 ; i++){
    cout << '#' ;
  }
  cout << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(void) {
	char buffer[2][256], *src, *dest, *tmp;
	int m, i, h, l;
	while (scanf("%255s", buffer[0]) == 1 && strcmp(buffer[0], "-") != 0) {
		src = buffer[0];
		dest = buffer[1];
		l = strlen(src);
		dest[l] = '\0';
		if (scanf("%d", &m) != 1) return 1;
		for (i = 0; i < m; i++) {
			if (scanf("%d", &h) != 1) return 1;
			memcpy(dest + l - h, src, h);
			memcpy(dest, src + h, l - h);
			tmp = src;
			src = dest;
			dest = tmp;
		}
		puts(src);
	}
	return 0;
}




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


int main(){
  string s;
  cin>>s;
  if(s=="hi"||s=="hihi"||s=="hihihi"||s=="hihihihi"||s=="hihihihihi") cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

    
  


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 0x3f3f3f
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define F first
#define S second
#define PB push_back
#define GCD __gcd
#define COUNT1 __builtin_popcount
#define FORJ(i,j,k) for(int i=j; i<k; ++i)
#define FOR(i,k) FORJ(i,0,k)
#define FORR(i,k) for(int i=k; i>=0; --i)
#define FORE(x,v) for(auto &x : v)
#define FORG(y,x,g) FOR(y, sz(g)) FOR(x, sz2(g))
#define CIN(a) int a; cin>>a;
#define CINC(a) char a; cin>>a;
#define CINS(a) string a; cin>>a;
#define CIND(a) double a; cin>>a;
#define CINL(a) ll a; cin>>a;
#define CINP(a) PII a; cin>>a.F>>a.S;
#define CINLINE(a) string a; getline(cin, a);
#define CIN2(a,b) int a,b; cin>>a>>b;
#define CIN3(a,b,c) int a,b,c; cin>>a>>b>>c;
#define CIN4(a,b,c,d) int a,b,c,d; cin>>a>>b>>c>>d;
#define CINV(n,a) VI a; FOR(i,n) { CIN(x); a.PB(x); }
#define CINV2(n,a,b) VI a,b; FOR(i,n) { CIN2(x,y); a.PB(x); b.PB(y);}
#define CINVP(n,a) VP a; FOR(i,n) { CINP(p); a.PB(p);}
#define ALL(x) x.begin(), x.end()
#define INS(x) inserter(x, x.begin())
#define D(x) cout<<#x<<": "<<(x)<<endl
#define H cout<<"H"<<hcnt++<<endl;

using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<bool> VB;
typedef vector<string> VS;
typedef vector<PII> VP;
typedef vector<VI> GI;
typedef vector<VB> GB;
typedef vector<vector<char> > GC;
typedef map<char,int> MC;
typedef map<int,int> MI;
typedef map<string,int> MS;

void OUT(auto x) { cout<<x<<endl; }
void OUTP(const PII &p) { cout<<p.F<<" "<<p.S<<endl; }
void OUTB(int x) { cout<<bitset<32>(x)<<endl; }
void OUTN(const auto &x) { cout<<x->d<<endl; }
void OUTV(const auto &x) { FORE(d,x) cout<<d<<" "; cout<<endl; }
void OUTVP(const VP &x) { FORE(d,x) cout<<d.F<<" "<<d.S<<endl; }
void OUTVN(const auto &x) { FORE(d,x) cout<<d->d<<" "; cout<<endl; }
void OUTG(const auto &x) { FORE(v,x) { FORE(u,v) cout<<u; cout<<endl; } }
void OUTM(const auto &x) {FORE(p,x) cout<<p.F<<":"<<p.S<<" "; cout<<endl;}
PII operator+(const PII &l, const PII &r) { return {l.F+r.F, l.S+r.S}; }
void amin(auto &x, auto y) { if(y < x) x = y; }
void amax(auto &x, auto y) { if(x < y) x = y; }
bool bet(auto x, auto l, auto r) { return x>=l && x<r; }
auto mod(auto x, auto m) { return ((x % m) + m) % m; }
bool IsSameSign(auto a, auto b) { return ((a>=0) ^ (b<0)); }
int sz(const auto &x) { return (int)x.size(); }
int sz2(const auto &x) { return (int)x[0].size(); }
bool IsSafe(const auto &x, int i) { return bet(i,0,sz(x)); }
auto Safe(const auto &x, int i) { return IsSafe(x,i) ? x[i] : 0; }
bool Find(const auto &x, auto y) { return x.find(y) != x.end(); }
void Tally(const auto &v, auto &m) { FORE(x,v) m[x]++; }

int hcnt=1;
VP nb4 = {{0,1}, {1,0}, {0,-1}, {-1,0}};
VP nb8 = {{0,1}, {1,1}, {1,0}, {1,-1}, {0,-1}, {-1,-1}, {-1,0}, {-1,1}};

int main() {
  CIN(n);
  MC m;
  FOR(i,n) {
    CINC(c);
    m[c]=1;
  }
  if(sz(m)==3) OUT("Three"); else OUT("Four");
}


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

typedef struct _Monster {
    int Life;  /* 体力 */
    int Attack;/* 攻撃力 */
}Monster;

int main(void)
{
    Monster monster_Takahashi;
    Monster monster_Aoki;

    cin >> monster_Takahashi.Life >> monster_Takahashi.Attack;
    cin >> monster_Aoki.Life >> monster_Aoki.Attack;
  
    while( (monster_Takahashi.Life > 0) && (monster_Aoki.Life > 0 ) )
    {
        monster_Aoki.Life -= monster_Takahashi.Attack;
        if(monster_Aoki.Life > 0)
        {
            monster_Takahashi.Life -= monster_Aoki.Attack;
        }
        else
        {
            cout << "Yes" << endl;
            return 0;
        }
    }
  
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+10;
ll a[maxn],n,sum,tmp,ans_1=0,ans_2=0;
int main(){
    cin>>n;
    for (int i=1; i<=n ;i++) cin>>a[i];
    sum=0;
    for (ll d,tmp,i=1; i<=n ;i++){
        if(i%2){
            if(sum+a[i]>0) {
                sum+=a[i];
                continue;
            }
            d=abs(sum+a[i])+1;
            ans_1+=d;
            sum=1;
        }
        else {
            if(sum+a[i]<0) {
                sum+=a[i];
                continue;
            }
            d=abs(sum+a[i])+1;
            ans_1+=d;
            sum=-1;
        }
    }
    sum=0;
    for (ll d,tmp,i=1; i<=n ;i++){
        if(i%2==0){
            if(sum+a[i]>0) {
                sum+=a[i];
                continue;
            }
            d=abs(sum+a[i])+1;
            ans_2+=d;
            sum=1;
        }
        else {
            if(sum+a[i]<0) {
                sum+=a[i];
                continue;
            }
            d=abs(sum+a[i])+1;
            ans_2+=d;
            sum=-1;
        }
    }
    cout<<min(ans_1,ans_2)<<endl;
    return 0;
}

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

bool pal(string s){
  string t(s.rbegin(),s.rend());
  return s==t;
}

int main(){
  string s,a,b; cin>>s;
  int n=s.length();
  a=s.substr(0,n/2);
  b=s.substr(n/2+1,n/2);
  cout<<(pal(s)&&pal(a)&&pal(b)?"Yes":"No");
}


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

#define LL long long
#define LD long double
#define SC(t,x) static_cast<t>(x)
#define AR(t) vector < t >
#define PII pair < int, int >
#define PLL pair < LL, LL >
#define PIL pair < int, LL >
#define PLI pair < LL, int >
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define PRF first
#define PRS second
#define INIT(ar,val) memset ( ar, val, sizeof ( ar ) )
#define lp(loop,start,end) for ( int loop = start; loop < end; ++loop )
#define lpd(loop,start,end) for ( int loop = start; loop > end; --loop )
#define lpi(loop,start,end) for ( int loop = start; loop <= end; ++loop )
#define lpdi(loop,start,end) for ( int loop = start; loop >= end; --loop )
#define qmax(a,b) (((a)>(b))?(a):(b))
#define qmin(a,b) (((a)<(b))?(a):(b))
#define qabs(a) (((a)>=0)?(a):(-(a)))

const int INF = 0x3fffffff;
const int SINF = 0x7fffffff;
const long long LINF = 0x3fffffffffffffff;
const long long SLINF = 0x7fffffffffffffff;
const int MAXN = 22;
const int MAXS = ( 1 << 19 ) + 7;
const int MOD = 1e9 + 7;

int n, m, ms;
bool ok[MAXN][MAXS];
int dp[MAXS], pre[MAXN][MAXS];
int qlg[MAXS], bp[MAXS];

void init ();
void input ();
void work ();

int add ( int x, int y )
{
	x += y;
	if ( x >= MOD ) x -= MOD;
	return x;
}

void addv ( int &x, int y )
{
	x += y;
	if ( x >= MOD ) x -= MOD;
}

int dec ( int x, int y )
{
	x -= y;
	if ( x < 0 ) x += MOD;
	return x;
}

void decv ( int &x, int y )
{
	x -= y;
	if ( x < 0 ) x += MOD;
}



int main()
{
	init();
	input();
	work();
}



void init ()
{
	// Init Everything Here
	
	ios::sync_with_stdio ( false );
	
	qlg[0] = qlg[1] = 0;
	lp ( i, 2, MAXS ) qlg[i] = qlg[i>>1] + 1;
	
	lp ( i, 0, MAXS ){
		bp[i] = i;
		lpdi ( j, qlg[i], 0 ){
			if ( ! ( i >> j & 1 ) ){
				bp[i] |= 1 << j;
				break;
			}
		}
		bp[i] ^= 1 << qlg[i];
	}
}

void input ()
{
	// input method
	
	int k;
	scanf ( "%d%d%d", &n, &m, &k );
	--n;
	ms = 1 << n;
	int a, b, c;
	INIT ( ok, true );
	lp ( i, 0, k ){
		scanf ( "%d%d%d", &a, &b, &c );
		b = n - b;
		lp ( j, 0, ms ) if ( ( j >> b & 1 ) ^ c ) ok[a][j] = false;
	}
}

void work ()
{
	// main work
	
	dp[0] = 1;
	int ts;
	lpi ( i, 1, m ){
		lp ( j, 0, ms ) pre[n][j] = dp[j];
		lpdi ( j, n-1, 0 ){
			lp ( k, 0, ms ){
				ts = k & ( ( 1 << ( n - j ) ) - 1 );
				pre[j][k] = ( ts >> ( n - j - 1 ) & 1 ) ? add ( pre[j+1][k], pre[j+1][(k>>(n-j)<<(n-j))|bp[ts]] ) : pre[j+1][k];
			}
		}
		
//		cerr << "pre " << i-1 << endl;
//		lpi ( j, 0, n ){
//			lp ( k, 0, ms ) cerr << pre[j][k] << " ";
//			cerr << endl;
//		}
		
		lp ( j, 0, ms ){
			dp[j] = ok[i][j] ? pre[0][j] : 0;
		}
		
//		cerr << "dp " << i << endl;
//		lp ( j, 0, ms ) cerr << dp[j] << " ";
//		cerr << endl;
	}
	
	int ans = 0;
	lp ( i, 0, ms ) addv ( ans, dp[i] );
	
	cout << ans << endl;
}

Measured memory_bytes: 60800
S = input()
lst = ["dreamer", "dream", "eraser", "erase"]
n = 0

while len(S) != 0:
    i = 0
    for s in lst:
        i = S.find(s, n)
        if i == 0:
            if s == lst[0] and S.find(lst[3], n) == 5:
                pass
            else:
                S = S[len(s) :]
                break
    if i != 0:
        print("NO")
        exit()

print("YES")


Measured memory_bytes: 3244
import heapq

x,y,z,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

a.sort(reverse = True)
b.sort(reverse = True)
c.sort(reverse = True)

l = []

for p in range(0,x):
    for q in range(0,y):
        for r in range(0,z):
            if len(l) > k and a[p]+b[q]+c[r] <= l[0]:
                break
            elif len(l) > k:
                heapq.heappushpop(l,a[p]+b[q]+c[r])
            else:
                heapq.heappush(l,a[p]+b[q]+c[r])

l.sort()

for i in range(1,k+1):
    print(l[-i])

Measured memory_bytes: 3700
import java.util.*;

public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    String  S = sc.next();
    String  T = sc.next();

	if(T.substring(0,S.length()). equals (S)){
		System.out.println("Yes");
	}else{
		System.out.println("No");
	}
	}
}


Measured memory_bytes: 35696
package main

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

func ceil(a interface{}) float64 {
	if a, ok := a.(int); ok {

		return math.Ceil(float64(a))
	}
	if a, ok := a.(float64); ok {
		return math.Ceil(float64(a))
	}
	return 0
}

func main() {
	var scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	var A, B int
	if scanner.Scan() {
		A, _ = strconv.Atoi(scanner.Text())
	}
	if scanner.Scan() {
		B, _ = strconv.Atoi(scanner.Text())
	}
	var ans int
	if (B-1)%(A-1) == 0 {
		ans = (B - 1) / (A - 1)
	} else {
		ans = (B-1)/(A-1) + 1
	}
	var wtr = bufio.NewWriter(os.Stdout)
	fmt.Fprintln(wtr, ans)
	_ = wtr.Flush()
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}


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

int main(void)
{
    int n,m;
    cin >> n >> m;
    vector<int> c(m);
    REP(i, m){
        cin >> c[i];
    }
    SORT(c);

    vector<int> dp(n+1, INF);

    dp[0] = 0;
    REP(i, n){
        for(auto&& ci : c){
            if(i+ci <= n) chmin(dp[i+ci], dp[i]+1);
            // if(i+ci <= n){
            //     // dp[i+ci] = min(dp[i+ci], dp[i] + 1);
            // }
        }
    }
    pr(dp[n]);
}


Measured memory_bytes: 3176
#include "bits/stdc++.h"
using namespace std;

typedef long long int ll;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(v,a,b) v.begin(a),v.end(b)
#define in cin>>
#define out cout<<
#define en <<endl
constexpr auto INF = 100000000000000;

int main()
{
	string S;
	in S;
	vector<char> S1(S.size() / 2);
	vector<char> S2(S.size() / 2);
	int count = 0;
	rep(i, S.size() / 2)
	{
		S1.at(i) = S.at(i);
		S2.at(i) = S.at(S.length() - 1 - i);
		if (S1.at(i) != S2.at(i))
		{
			count++;
		}
	}
	out count en;
}


Measured memory_bytes: 256
class Node():
    def __init__(self, key, pri):
        self.key = key
        self.pri = pri
        self.left = self.right = None
         
 
def insert(t, key, pri):
    if t == None:
        return Node(key, pri) 
    if key == t.key:
        return t                             
 
    if key < t.key:
        t.left = insert(t.left, key, pri)
        if t.pri < t.left.pri:
            t = rightRotate(t)
    else:
        t.right = insert(t.right, key, pri)
        if t.pri < t.right.pri:
            t = leftRotate(t)
 
    return t
         
def rightRotate(node):
    global root
    a = node.left
    node.left = a.right
    a.right = node
    if node == root:
        root = a
    return a
 
def leftRotate(node):
    global root
    a = node.right
    node.right = a.left
    a.left = node
    if node == root:
        root = a
    return a
     
         
def pre(node):
    if node == None:return
    print('',node.key, end = '');pre(node.left);pre(node.right)
     
def ino(node):
    if node == None:return
    ino(node.left);print('',node.key,end='');ino(node.right)
 
def find(node, key):
    if node == None:
        print('no');return
    if node.key == key:
        print('yes');return
    elif node.key > key:
        find(node.left, key)
    else:
        find(node.right, key)
 
def delete(t, key):
    global root
    if t == None:
        return None
    if key < t.key:
        t.left = delete(t.left, key)
    elif key > t.key:
        t.right = delete(t.right, key)
    elif key == t.key:
        if t.left == None and t.right == None:
            return None
        elif t.left == None:
            t = leftRotate(t)
        elif t.right == None:
            t = rightRotate(t)
        else:
            if t.left.pri > t.right.pri:
                t = rightRotate(t)
            else:
                t = leftRotate(t)
        return delete(t, key)
    return t
 
     
 
n = int(input())


root = None


for j in range(n):
    s, *i = input().split()
    if s[0] == 'i':root = insert(root,int(i[0]), int(i[1]))
    elif s[0] == 'f':
        find(root, int(i[0]))
    elif s[0] == 'd':
        delete(root, int(i[0]))
    else:
        ino(root);print();pre(root);print()
         


Measured memory_bytes: 52324
NM = list(map(int,input().strip().split()))
N = NM[0]
M = NM[1]
ABs = []
for i in range(0,N):
    AB =list(map(int,input().strip().split()))
    ABs.append(AB)

ABs = sorted(ABs, key=lambda x: x[0])

ene_num = 0
cost = 0
for ab in ABs:
    nums = min(ab[1], M)
    cost += ab[0] * nums
    M -= nums
    if M <= 0:
        break


print(cost)

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

#define x first
#define y second
#define pb push_back
#define mp make_pair
#define inf (0x3f3f3f3f)
#define Set(a, b) memset(a, b, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define Rep(i, a) for (int i = 0; i < a; ++ i)
#define For(i, a, b) for (int i = a; i <= b; ++ i)
#define Forr(i, a, b) for (int i = a; i >= b; -- i)
#define Travel(i, x) for (int i = head[x]; i; i = nxt[i])

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;

template<class T>inline T read(T &_) {
	T __ = getchar(), ___ = 1; _ = 0;
	for (; !isdigit(__); __ = getchar()) if (__ == '-') ___ = -1;
	for (; isdigit(__); __ = getchar()) _ = (_ << 3) + (_ << 1) + (__ ^ 48);
	return _ *= ___;
}

template<class T>inline bool chkmax(T &_, T __) { return _ < __ ? _ = __, 1 : 0; }
template<class T>inline bool chkmin(T &_, T __) { return _ > __ ? _ = __, 1 : 0; }

inline void proStatus() {
	ifstream t("/proc/self/status");
	cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>());
}

const int N = 3000 + 3;
const int mod = 1e9 + 7;

int qpow(int a, int x) { 
	int ret = 1; 
	while (x) {
		if (x & 1) ret = ret * (ll)a % mod;
		x >>= 1, a = a * (ll)a % mod;
	}
	return ret; 
}

int f[N][N], a[N], ans;

int main() {
	int n, q, x, y;

	read(n), read(q);
	For(i, 1, n) read(a[i]);
	For(i, 1, n) For(j, 1, n) f[i][j] = a[i] < a[j];

	For(cas, 1, q) { 
		read(x), read(y);
		f[x][y] = f[y][x] = 500000004ll * (f[x][y] + f[y][x]) % mod;
		For(i, 1, n) if (i ^ x && i ^ y) {
			f[x][i] = f[y][i] = 500000004ll * (f[x][i] + f[y][i]) % mod;
			f[i][x] = f[i][y] = 500000004ll * (f[i][x] + f[i][y]) % mod;
		}
	}

	For(i, 1, n) For(j, i + 1, n) (ans += f[j][i]) %= mod;
	cout << 1ll * ans * qpow(2, q) % mod << endl;

	return 0;
}


Measured memory_bytes: 35456