akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<iostream>

using namespace std;

typedef long long ll;
ll a, b, x, ans;

int main(){
	char c;
	while(~scanf("%c", &c)){
		getchar();
		if(c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u')
			cout << "vowel" << endl;
		else
			cout << "consonant" << endl;
	}
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<long long>data(n);
  for(int i = 0;i < n;i++){
    cin >> data.at(i);
  }
  sort(data.begin(),data.end());
  for(int i = 1;i < n;i++){
    while(data.at(i)%data.at(0) != 0){
      if(data.at(i)%data.at(0) < data.at(0)){
        long long t = data.at(i)%data.at(0);
        data.at(i) = data.at(0);
        data.at(0) = t;
      }
      else{
        data.at(i) = data.at(i)%data.at(0);
      }
      if(data.at(0) == 1){
        cout << 1 << endl;
        return 0;
      }
      if(data.at(0) == 0){
        data.at(0) = data.at(i);
        break;
      }
    }
  }
  cout << data.at(0) << endl;
}


Measured memory_bytes: 1024
#![allow(non_snake_case)]
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;

fn main() {
    input!{
        r: String, g: String, b: String,
    }

    let rgb = format!("{}{}{}", r, g, b).parse::<usize>().unwrap();

    if rgb % 4 == 0 {
        println!("YES")
    } else {
        println!("NO")
    }
}


Measured memory_bytes: 2128
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int
#define ulli unsigned long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(lli i=a;i<b;i++)
#define initialize(array,size,value) for(lli i=0;i<size;i++) array[i]=value
#define couta(array,size) for(lli i=0;i<size;i++) cout<<array[i]<<" "
#define vl vector<lli>
#define vp vector< pair <lli,lli> >
#define sl set<lli>
#define msp multiset < pair < long long , long long > > S;
#define pll pair<lli, lli>
#define mll map<lli, lli>            //for( map<lli, lli>::iterator i=temp.begin();i!=temp.end();i++)cout<<i->fi<<" "<<i->se<<endl;
#define mvl map<lli, vl>
#define umll unordered_map<lli, lli>
#define vt vector<pair<lli, pll >  >
#define vf vector<pair<pll,pll > >
#define qu queue<lli>
#define pq priority_queue<lli>
#define dq deque <lli>
#define ptr vector<lli>::iterator
#define bs(array,x) binary_search(array.begin(),array.end(),x) // also valid for set and multiset
#define lb(array,x) lower_bound(array.begin(),array.end(),x)
#define ub(array,x) upper_bound(array.begin(),array.end(),x)
#define nobw(array,i,j) upper_bound(array.begin(), array.end(), j)-lower_bound(array.begin(), array.end(), i) //number of numbers between i & j
#define vc clear()
#define endl '\n'
#define sp system("pause");
#define INF 9223372036854775807
#define MINF -9223372036854775808
typedef tree<pll,null_type,less<pll>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
//string binary = bitset<32>(n).to_string();
int main()
{
 	ios::sync_with_stdio(0);
    cin.tie(0);
    lli n,m;
	cin>>n>>m;
	vl a;
	for(lli i=0;i<n;i++){
		lli x;cin>>x;
		a.pb(x);
	}
	vp cb;
	for(lli i=0;i<m;i++){
		lli b,c;
		cin>>b>>c;
		cb.pb(mp(c,b));
	}
	sort(cb.begin(),cb.end());
	reverse(cb.begin(),cb.end());
	vl temp;lli j=0;
	while(temp.size()<=n && j<m){
		lli te=cb[j].se;
		//cout<<te<<endl;
		while(temp.size()<=n && te!=0){
			te--;
			temp.pb(cb[j].fi);
		}
		j++;
	}
//	for(lli i=0;i<temp.size();i++){
//		cout<<temp[i]<<endl;
//
//	}
	for(lli i=0;i<temp.size();i++)a.pb(temp[i]);
	sort(a.begin(),a.end());
	reverse(a.begin(),a.end());
	lli sum=0;
	//for(lli i=0;i<a.size();i++)cout<<a[i]<<" ";
	//	cout<<endl;
	for(lli i=0;i<n;i++)sum+=a[i];
	cout<<sum;

    return 0;
}


Measured memory_bytes: 5744
#include "bits/stdc++.h"
using namespace std;
int f(int);
int main(){
  int s,i=1;
  cin >> s;
  if(s == 2 || s == 1){
    cout << 4;
    return 0;
  }
  while(s != 4){
    s = f(s);
    i++;
  }
cout << i+3;
}
int f(int n){
  if(n%2 == 0){
    return n/2;
  }else{
    return 3*n+1;
  }
}

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

#define int long long
//#define uint __int128_t

#define pb push_back
#define fi first
#define se second
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define low(a,b) lower_bound(all(a),(b))-(a).begin()
#define upp(a,b) upper_bound(all(a),(b))-(a).begin()
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<vint> vvint;
typedef vector<pint>vpint;
typedef pair<pint,int> P1;
typedef pair<int,pint> P2;
typedef pair<pint,pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD=1000000007;
const ll INF=1e18;

int N,a[100010],b[100010];
int cnt=0;
int ans[100010];
int asum=0;
int bsum=0;
signed main() {
    IOS();
    //(1ll<<N)シフト演算のオーバーフローに気をつける
    //MOD同士の引き算に注意
    cin>>N;
    rep(i,0,N){
        cin>>a[i];
        asum+=a[i];
    }
    rep(i,0,N){
        cin>>b[i];
        bsum+=b[i];
    }
    if(bsum>asum){
        cout<<-1<<endl;
        return 0;
    }
    int res=0;
    rep(i,0,N){
        if(b[i]>a[i]){
            cnt+=b[i]-a[i];
            res++;
        }
        else ans[i]=a[i]-b[i];
    }
    
    sort(ans,ans+N,greater<int>());
    rep(i,0,N){
        if(cnt==0)break;
        cnt-=ans[i];
        res++;
        if(cnt<=0)break;
        
    }
    cout<<res<<endl;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

void YN(bool flg){if(flg) cout << "YES" << endl; else cout << "NO" << endl;}
void Yn(bool flg){if(flg) cout << "Yes" << endl; else cout << "No" << endl;}
void yn(bool flg){if(flg) cout << "yes" << endl; else cout << "no" << endl;}

//GCD(最大公約数)
ll gcd(ll a, ll b) {
    return b ? gcd(b, a % b) : a;
}

//LCM(最小公倍数)
ll lcm(ll a, ll b) {
   return a / gcd(a, b) * b;  //オーバーフローする場合など 必要に応じて
}

int main() {
    ll a, b;
    cin >> a >> b;

    cout << lcm(a, b) << endl;
    
    return 0;
}


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

int main()
{
	int N,K;
	cin >> N >> K;
	string S;
	cin >> S;
	vector<int> A;
	int now = 1;
	int cnt = 0;
	rep(i,S.size())
	{
		if (S[i] != '0' + now)
		{
			A.push_back(cnt);
			cnt = 1;
			now = (now+1) % 2;
		}
		else 
		{
			cnt++;
		}
	}
	if (cnt != 0) 
	{
		A.push_back(cnt);
		now = (now+1) % 2;
	}
	if (now == 1) A.push_back(0);
	/*
	rep(i,A.size())
	{
		cout << A[i] << " ";
	}
	cout << endl;
	*/
	if (2*K+1 >= A.size())
	{
		cout << N << endl;
		return 0;
	}
	int sum = 0;
	rep(i,2*K+1)
	{
		sum += A[i];
	}
	int ans = sum;
	for (int i = 0; i < A.size()-(2*K+1); i += 2)
	{
		sum = sum - A[i] - A[i+1] + A[i+(2*K+1)] + A[i+(2*K+1)+1];
		ans = max(ans,sum);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4084
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>

using namespace std;

long long MOD = 1000000007;

long long gcd(long long N, long long M){
    while (true){
        if (min(N,M)==0){
            return max(N,M);
        }else if (N>M){
            N%=M;
        }else{
            M%=N;
        }
    }
}

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

    if(N==3){
        cout << "2 5 63" << endl;
        return 0;
    }

    int sum_=0;
    int cnt=0;

    for(int i=1; i<=30000; i++){
        if(cnt<N-1 && (i%2==0 || i%3==0)){
            sum_+=i;
            cout << i << ' ';
            cnt++;
            continue;
        }
        if(cnt==N-1){
            if((i+sum_)%6==0 && gcd((long long) sum_, (long long)i)!=1){
                cout << i << ' ' << endl;
                return 0;
            }
        }
    }

    for(int i=1; i<=30000; i++){
        if(!(i%2==0 || i%3==0)){
            if((i+sum_)%6==0 && gcd((long long) sum_, (long long)i)!=1){
                cout << i << ' ' << endl;
                return 0;
            }
        }
    }
    //cout << max_ << endl;
    return 1;
}

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

int main(){
	int n;	cin>>n;
	string s;	cin>>s;
	for(int i=0;i<s.length();i++){
		s[i]+=n;
		if(s[i]>'Z')s[i]-=26;
	}
	cout<<s<<endl;

	return 0;
}


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


using namespace std;

typedef long long ll;




int main(void)
{
    //ios_base::sync_with_stdio(false);
    //cin.tie(0);
    //cout.tie(0);


   int a,b,c,k;
   cin>>a>>b>>c>>k;
   bool flag1=false;
   bool flag2 = false;



   int x=0;
   while(b<=a)
   {
       b*=2;
       x++;
   }
   for(int i=0;i<k-x;i++)
   {
       c*=2;
   }
   if(c>b && b>a)
   {
       cout<<"Yes\n";
   }
   else
   {
       cout<<"No\n";
   }


}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n; cin>>n;
    if(n%10==3)cout<<"bon";
    else if(n%10==0||n%10==1||n%10==6||n%10==8)cout<<"pon";
    else cout<<"hon";
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <utility>
#include <climits>
#include <vector>
using namespace std;

const int MOD = 1000000007;

int main() {

	int A, B, C;
	long long int sum;

	cin >> A >> B >> C;

	for (int i = 1; i <= B; i++) {

		if ((A*i) % B == C) {

			cout << "YES" << endl;
			goto qwe;

		}

	}

	cout << "NO" << endl;

	qwe:

	return 0;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(ll i=0; i<n; i++)
#define repr(i, s, e) for(ll i=s; i>=e; i--)
#define reps(i, s, e) for(ll i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
void ans(bool b){ cout << (b ? "Yes" : "No") << endl; }
void ans2(bool b){ cout << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill((T*)array, (T*)(array+N), val);
}
template<typename T> void vdeb(T v){
    cout << "#vector set debug" << endl;
    for(auto vv : v) cout << vv << " ";
    cout << endl;
}
template<typename T1, typename T2> void adeb(T1 arr[], T2 n){
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}
template<typename T1> void mdeb(T1 mp){
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};


class DMazeMaster {
public:
	void solve(std::istream& in, std::ostream& out) {
        int h, w;
        in >> h >> w;
        char s[100][100];
        rep(i, h){
            rep(j, w){
                in >> s[i][j];
            }
        }

        ll res = 0;
        rep(si, h){
            rep(sj, w){
                if(s[si][sj] == '#') continue;
                rep(gi, h){
                    rep(gj, w){
                        if(s[gi][gj] == '#') continue;
                        queue<pair<int, int>> q;
                        q.push(make_pair(si, sj));
                        vector<vector<ll>> dist(h, vector<ll>(w, 0));
                        dist[si][sj] = 0;
                        while(!q.empty()){
                            pair<int, int> u = q.front(); q.pop();
                            rep(i, 4){
                                int dly = u.first + dy[i];
                                int dlx = u.second + dx[i];
                                if(dlx < 0 || dlx >= w || dly < 0 || dly >= h) continue;
                                if(dist[dly][dlx] || (si == dly && sj == dlx)) continue;
                                if(s[dly][dlx] == '#') continue;
                                dist[dly][dlx] = dist[u.first][u.second] + 1;
                                q.push(make_pair(dly, dlx));
                            }
                        }
                        chmax(res, dist[gi][gj]);
                    }
                }
            }
        }

        out << res << endl;
	}
};


int main() {
	DMazeMaster solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

#define M 1000000/* your task*/
#define L 14

char H[M][L]; /* Hash Table */

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key%M; }
int h2(int key){ return 1+key%(M-1); }


int find(char str[]) {
  long long key;
  int i ,position;
  key = getKey(str);
  for(i = 0; ; i++) {
    position = (h1(key) + i * h2(key)) % M;
    if(strcmp(H[position], str) == 0) {
      return 1;
    }
    else if(strlen(H[position]) == 0){
      return 0;
    }
  }
  return 0;
}
 

int insert(char str[]){
  long long key;
  int position,i;
  key=getKey(str);
  for(i=0; ;i++){
    position = (h1(key) + i * h2(key)) % M;
    if(H[position][0]=='\0'){
      strcpy(H[position],str);
      return 0;
    }
    else if(strcmp(H[position],str)==0)return 1;
  }

}

int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
    scanf("%d", &n);
    
    for ( i = 0; i < n; i++ ){
	scanf("%s %s", com, str);
	
	if ( com[0] == 'i' ){
	    insert(str);
	} else {
	    if (find(str)){
		printf("yes\n");
	    } else {
		printf("no\n");
	    }
	}
    }

    return 0;
}

Measured memory_bytes: 14280
#include <iostream>

using namespace std;

int rec(int n, int *h)
{
    int m, mp;
    int l[110],r[110];
    m = 200;
    if(n <= 0 ) return 0;
    if(n == 1) return h[0];

    for(int i = 0; i < n; i++) {
        if(h[i] < m) {
            m = h[i];
            mp = i;
        }
    }
    for(int i = 0; i < n; i++) {
        h[i] -= m;
    }

//    cout << "m:" << m << "mp:" << mp << endl;
    return rec(mp, h) + m + rec(n-mp-1, h + mp+1); 
}




int main(void)
{
    int n;
    int h[110];
    int cnt = 0;
    cin >> n;
    for(int i=0; i < n; i++) {
        cin >> h[i];
    }
    cnt = rec(n, h);
    cout << cnt << endl;
}


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

// generated from pow(4,i)+3*pow(2,i-1)+1 (prefixed with 1)

unsigned insertion_sort(unsigned a[], unsigned n, unsigned gap){
  unsigned count = 0;
  for(unsigned i = gap; i < n; i++){
    unsigned v = a[i];
    int j = i - gap;
    while(j >= 0 && a[j] > v){
      a[j+gap] = a[j];
      j -= gap;
      count++;
    }
    a[j+gap] = v;
  }
  return count;
}

void shell_sort(unsigned a[], unsigned n){
  const unsigned gaps[] = {1,8,23,77,281,1073,4193,16577,65921,262913,1050113};
  int i;
  unsigned gap_num = 11;
  while(gaps[--gap_num] > n);

  unsigned count = 0;
  for(i = gap_num; i >= 0; i--) count += insertion_sort(a,n,gaps[i]);

  cout << (gap_num+1) << '\n';

  for(i = gap_num; i; i--) cout << gaps[i] << ' ';
  cout << gaps[0] << '\n';

  cout << count << '\n';
}

int main(){
  std::ios::sync_with_stdio(false);
  unsigned n,i;
  cin >> n;
  auto a = new unsigned[n];
  for(i = 0; i < n; i++) cin >> a[i];
  shell_sort(a,n);
  for(i = 0; i < n; i++) cout << a[i] << '\n';
  delete[](a);
}

Measured memory_bytes: 4888
import sys
from collections import deque

N = int(sys.stdin.readline())
A = [int(i) for i in sys.stdin.readline().split(' ')]

A.sort(reverse=True)
max_value = A.pop(0)
diff = deque([max_value])
ans = 0
for i in A:
    ans = ans + diff.popleft()
    diff.append(i)
    diff.append(i)

print(ans)

Measured memory_bytes: 32496
#include <iostream>
#include <string>

using namespace std;

int main() {
  int H, W;
  int G[60][60];

  for (int h=0; h<60; h++) for (int w=0; w<60; w++) {
    G[h][w] = 0;
  }
  cin >> H >> W;
  for (int h=0; h<H; h++) {
    string l;
    cin >> l;
    for (int w=0; w<l.length(); w++) {
      if (l[w]=='#') G[h+5][w+5] = -1;
    }
  }

  bool OK = true;
  for (int h=0; h<H; h++) {
    for (int w=0; w<W; w++) {
      if (G[h+5][w+5] < 0) {
        OK &= ((G[h+5-1][w+5  ]<0)
              |(G[h+5+1][w+5  ]<0)
              |(G[h+5  ][w+5-1]<0)
              |(G[h+5  ][w+5+1]<0));
      }
    }
  }
  if (OK) cout << "Yes" << endl;
  else    cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string a;
  cin >> a;
  if(a.at(0) == 'A'){
    int key1 = 0;
    int key2 = 0;
    int key3 = 0;
    for(int i = 2;i<a.size()-1;i++){
      if(a.at(i) == 'C'){
        key1 = 1;
        key2 = i;
        break;
      }
    }
    if(key1 == 1){
      for(int i = 1;i<a.size();i++){
        if(i != key2){
          if('a' > a.at(i) || a.at(i) > 'z'){
            cout << "WA" << endl;
            key3 = 1;
            break;
          }
        }
      }
      if(key3 == 0){
        cout << "AC" << endl;
      }
    }
    else
    {
      cout << "WA" << endl;
    }
    
  }
  else
    {
      cout << "WA" << endl;
    }       
}


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

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

    cin >> a>>b>>x;

    if (x >=a && x<= a+b){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
    
    return 0;
}






Measured memory_bytes: 256
#include <iostream>
#include<string>
using namespace std;
#define ll long long int


int main ()
{
     long long int  n,t,i,k,sum=0,flag=0,z,cnt=0,m,a1,a2,k1,k2,neg=0,pos=0,j,q;
     cin>>n>>k>>q;
     ll a[q],b[n];
     for(i=0;i<n;i++)
     {
         b[i]=0;
     }
     for(i=0;i<q;i++)
     {
         cin>>a[i];
         b[a[i]-1]++;
     }
     for(i=0;i<n;i++)
     {
        if(k-q+b[i]>0)
        {
            cout<<"Yes"<<endl;
        }
        else
        {
            cout<<"No"<<endl;
        }
     }






return 0;
}


Measured memory_bytes: 2176
N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF = 10 ** 9

def dfs(cur, a, b, c):
    '''
    深さがNだったら使用MPを評価
    N本の竹を使うときに必要な合成回数はN-1のため，最後に-1*10*3(?)
    1本も竹を使用していなかったら棄却→MPを無限に使うこととしている
    '''
    if cur == N:
        return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF

    '''
    cur番目の竹に対して
        ret0:ABCどれにも使わない
        ret1:Aに使う（合成:MP+10）
        ret2:Bに使う（合成:MP+10）
        ret3:Cに使う（合成:MP+10）
    '''
    ret0 = dfs(cur + 1, a, b, c)
    ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
    ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
    ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
    return min(ret0, ret1, ret2, ret3)
print(dfs(0, 0, 0, 0))

Measured memory_bytes: 3064
N = int(input())
manhat = lambda x,y:abs(x[0]-y[0])+abs(x[1]-y[1])
flag = True
t_,x_,y_ = 0,0,0
for i in range(N):
  t,x,y = map(int, input().split())
  dt = t-t_
  dx = manhat((x,y), (x_,y_))
  if dt < dx or (dt - dx) % 2:
    flag = False
    break
  t_,x_,y_ = t,x,y

print('Yes' if flag else 'No')

Measured memory_bytes: 3064
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

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

using namespace std;

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

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "YES"; }
  string_type do_falsename() const { return "NO"; }
};

void solve(ll N, ll A, ll B, vector<ll> h) {
  ll lb = 0, ub = 1e9 + 10;
  while (ub - lb > 1) {
    const ll mid = (lb + ub) / 2;
    ll cnt = 0;
    REP(i,N) {
      ll rest = h[i] - mid * B;
      if (rest > 0) cnt += (rest + A - B - 1) / (A - B);
    }
    if (cnt > mid) lb = mid; else ub = mid;
  }
  cout << ub << endl;
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	ll A;
	ll B;
	ll N;
	scanf("%lld", &N);
	vector<ll> h(N-1+1);
	scanf("%lld", &A);
	scanf("%lld", &B);
	for (int i = 0 ; i <= N-1 ; i++) {
	  scanf("%lld", &h[i]);
	}
	solve(N, A, B, h);
	return 0;
}


Measured memory_bytes: 1792
#include"bits/stdc++.h"
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define INF 1e+9
 
 
int main() {
	string s;
	int n;
	cin >> s;
	cin >> n;
	for (int i = 0;i < s.length();i += n) {
		cout << s[i];
	}
	cout << endl;
 
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FORR(i, a, b)  for (int i = (a); i <= (b); ++i)
#define FORD(i, a, b)  for (int i = (b); i >= (a); --i)
#define REPP(i, a, b)  for (int i = (a); i < (b); ++i)
#define REPD(i, a, b)  for (int i = (b); i > (a); --i)
#define fi             first
#define se             second
#define mp             make_pair
#define pb             push_back
#define pf             push_front
#define cmin(a, b)     if ((a) > (b)) (a) = (b)
#define cmax(a, b)     if ((a) < (b)) (a) = (b)
#define BIT(x, i)      (((x) >> (i)) & 1)
#define MASK(i)        (1LL << (i))
#define debug(x)       cout << (x) << "\n"
#define endl           "\n"
#define ii             pair <int, int>
#define ll             long long
#define reset(x)       memset(x, 0, sizeof(x))
#define mem(a, x)      memset(x, (a), sizeof(x))
#define task           ""
#define IO             freopen (task".inp","r",stdin),freopen (task".out","w",stdout);

using namespace std;

const int mod = 1007050321;
const int base = 521;
const int MOD = 1e9 + 7;
const int inf = 2e9;
const int N = 1e5 + 5;

int n, x, ans = -1;
map<int, int> d;

int main() {
    ios_base :: sync_with_stdio(0),cin.tie(0),cout.tie(0);

    cin >> x >> n;
    for (int i = 1; i <= n; ++i) {
        int y;
        cin >> y;
        d[y] = 1;
    }
    for (int i = -1000; i <= 1000; ++i)
        if (abs(i - x) < abs(ans - x) && d[i] == 0)
            ans = i;
    cout << ans;
    return 0;
}


Measured memory_bytes: 3660
#include<bits/stdc++.h>
#define rep(i, n) for(int (i)=0 ;i <(n); ++(i))
#define REP(i,m,n) for(int (i) = (m); (i) <= (n); ++(i))
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)? "YES":"NO")
typedef long long ll;
using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if(a + b + c >= 22) cout << "bust" << endl;
  else cout << "win" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <set>
#define re register
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define ms(arr) memset(arr, 0, sizeof(arr))
const int inf = 0x3f3f3f3f;
int d[1001][1001],c[501][501],map[501][501],cost[3][31];
int ans,x,a,n,C,out=999999999;
int main() 
{
	cin>>n>>C;
	for(re int i=1;i<=C;i++)
		for(re int j=1;j<=C;j++)
		cin>>d[i][j];
	for(re int i=1;i<=n;i++)
		for(re int j=1;j<=n;j++){	
		cin>>c[i][j],map[i][j]=(i+j)%3;
			for(re int l=1;l<=C;l++)
				cost[(i+j)%3][l]+=d[c[i][j]][l];
	}
	for(re int i=1;i<=C;i++)
		for(re int j=1;j<=C;j++)
			for(re int k=1;k<=C;k++){
				if(i!=j&&j!=k&&k!=i)
				out=min(out,cost[0][i]+cost[1][j]+cost[2][k]);
			}
	cout<<out;
    return 0;
}

Measured memory_bytes: 4352
from collections import deque
dis = [[1, 0], [-1, 0], [0, 1], [0, -1]]
H, W = map(int, input().split())
A = []
count = 0
for i in range(H):
  a = input()
  A.append(a)
  count += a.count(".")
B = [[0 for j in range(W)] for i in range(H)]
D = deque([[0, 0]])
B[0][0] = 1
while len(D) > 0:
  d = D.popleft()
  for k in range(4):
    p = d[0] + dis[k][0]
    q = d[1] + dis[k][1]
    if 0 <= p < H and 0 <= q < W and A[p][q] == "." and B[p][q] == 0:
      B[p][q] = B[d[0]][d[1]] + 1
      D.append([p, q])
if B[H-1][W-1] == 0:
  print(-1)
else:
  print(count - B[H-1][W-1])

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

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

	vector<int> v(n); for (int i = 0; i < n; i++) { cin >> v[i]; }
	vector<int> c(n); for (int i = 0; i < n; i++) { cin >> c[i]; }

	int ans = 0;

	for (int i = 0; i < n; i++) { 
		
		if (c[i] < v[i]) {

			ans += v[i] - c[i];

		}	
	
	}

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define long long long
using namespace std;
const int N=1e6,inf=1e9;
int main()
{
  ios_base::sync_with_stdio(0);cin.tie(0);
  int n;cin>>n;set<int>st;
  for(int i=1;i<=n;i++)
  {
    int x;cin>>x;st.insert(x);
  }
  if(st.size()==n)cout<<"YES\n";
  else cout<<"NO\n";
  
  return 0;
}

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

int main(int argc, char const *argv[])
{
	int l, n;
	cin >> l >> n;
	int tx, tw, lw=0, rw=0;
	for (int i = 0; i < n; ++i)
	{
		cin >> tx >> tw;
		if (tx>0)
		{
			rw += tw * tx;
		}
		else if (tx<0)
		{
			lw += tw * abs(tx);
		}
	}
	if (lw == rw)
	{
		cout << 0 << endl;
	}
	else if(lw > rw)
	{
		cout << abs(lw-rw) << endl;
		for (int i = 0; i < abs(lw-rw); ++i)
		{
			printf("1 1\n");
		}
	}
	else
	{
		cout << abs(lw-rw) << endl;
		for (int i = 0; i < abs(lw-rw); ++i)
		{
			printf("-1 1\n");
		}
	}
	return 0;
}


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

using namespace std;
int a[2000005],n,k;
int jg(int t)//判断能否经过最多k次全部化为小于t的
{
    int cnt=0;
    for(int i=0; i<n; i++)
    {
        cnt+=(a[i]/t);
        if(a[i]%t==0&&a[i]>0)
            cnt--;
        if(cnt>k)
            return 0;
    }
    return 1;
}
int main()
{
    cin>>n>>k;
    int l,r=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        r=max(r,a[i]);
    }
    l=1;
    while(l<=r)
    {
        int mid=(l+r)>>1;
        if(jg(mid)) r=mid-1;
        else l=mid+1;
    }
    cout<<l<<endl;

}


Measured memory_bytes: 4356
import kotlin.math.max

fun longList() = readLine()?.split(" ")?.map(String::toLong) ?: TODO()
fun main(args: Array<String>) {
    val (n, m, k) = longList()
    val a = longList()
    val b = longList()
    var t = 0L
    var count = 0
    run {
        a.forEach {
            t += it
            if (t >= k) {
                if (t == k) {
                    count++
                } else {
                    t -= it
                }
                return@run
            }
            count++
        }
    }
    var countMax = count
    var count2 = count
    run {
        b.forEach {
            t += it
            while (t > k) {
                if (count2 == 0) {
                    return@run
                } else {
                    count2--
                    count--
                    t -= a[count2]
                }
            }
            count++
            countMax = max(count, countMax)
        }
    }
    println((countMax).toString())
}


Measured memory_bytes: 83416
#include<iostream>
#include<map>
#include<unordered_map>
#include<set>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<queue>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef long double ld;
#define mp make_pair
#define pb push_back
const ll mod = 1000000007;
// const ll mod = 998244353;
 
const ll LLMAX = numeric_limits<long long>::max();

int main() {
  ll N;
  cin >> N;
  vi A(N), B(N);
  for(int i = 0; i< N; i++){
    cin >> A[i];
  }  
  for(int i = 0; i< N; i++){
    cin >> B[i];
  }
  bool done = false;
  ll count = 0;
  
  while(!done){
    // for(auto a : B) cout << a << " ";cout <<endl;
    done = true;  //change to false
    for(ll i = 0; i < N; i++){
      ll im = (i==0) ? N-1 : i-1;
      ll ip = (i==N-1) ? 0 : i+1;
      ll wi = B[im] + B[ip];
      if(B[i] - A[i] >= wi){
        count += (B[i] - A[i]) / wi;
        B[i] = (B[i] - A[i]) % wi + A[i];
        done = false;
        
        for(ll j = i-1; j >= 0; j--){
          ll jm = (j==0) ? N-1 : j-1;
          ll jp = (j==N-1) ? 0 : j+1;
          ll wj = B[jm] + B[jp];
          if(B[j] - A[j] >= wj){
             count += (B[j] - A[j]) / wj;
             B[j] = (B[j] - A[j]) % wj + A[j];
          }else{
            break;
          }
        }
      }
    }
  }
  
  for(ll i = 0; i < N; i++){
    if(A[i] != B[i]){
      cout << -1 << endl;
      return 0;
    }
  }
  
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mod 1000000007
#define ff first
#define ss second
using namespace std;
//ll arr[1000002];
/*ll power(ll x,ll y)
{
    ll res=1;
    while(y>0)
    {
        if(y%2==1)
            res=(res*x)%mod;
        x=(x*x)%mod;
        y=y/2;
    }
    return res;
}*/
int main()
{
ll n,a,b,c,d,i;
cin>>n>>a>>b>>c>>d;
string s,s1;
cin>>s1;
s.pb('0');
for(i=0;i<s1.size();i++)
    s.pb(s1[i]);
if(d>c)
{
    while(b<d)
    {
        if(s[b+1]=='.')
            b++;
        else if(s[b+1]=='#' && s[b+2]=='.')
        b=b+2;
        else if(s[b+1]=='#' && s[b+2]=='#')
        {
            cout<<"No"<<endl;
            return 0;
        }

    }
    while(a<c)
    {

        if(s[a+1]=='.')
            a++;
        else if(s[a+1]=='#' && s[a+2]=='.')
        a=a+2;
        else if(s[a+1]=='#' && s[a+2]=='#')
        {
            cout<<"No"<<endl;
            return 0;
        }

    }
    cout<<"Yes"<<endl;
}
else if(c>d)
{
    while(b<d && (s[b+1]=='#' || s[b-1]=='#'))
    {
        if(s[b+1]=='.')
            b++;
        else if(s[b+1]=='#' && s[b+2]=='.')
        b=b+2;
        else if(s[b+1]=='#' && s[b+2]=='#')
        {
            cout<<"No"<<endl;
            return 0;
        }
    }
    if(s[b+1]=='#' || s[b-1]=='#')
    {
         cout<<"No"<<endl;
            return 0;
    }
    while(a<c)
    {

        if(s[a+1]=='.' && a+1!=b)
            a++;
        else if(s[a+1]=='#' && s[a+2]=='.' && a+2!=b)
        a=a+2;
        else if(a+1==b && s[a+2]=='.')
            a=a+2;
        else if(a+1==b && s[a+2]=='#')
        {
             cout<<"No"<<endl;
            return 0;
        }
        else if(a+2==b && s[a+1]=='#')
        {
            cout<<"No"<<endl;
            return 0;
        }
        else if(s[a+1]=='#' && s[a+2]=='#')
        {
            cout<<"No"<<endl;
            return 0;
        }

    }
    while(b<d)
    {
         if(s[b+1]=='.')
            b++;
        else if(s[b+1]=='#' && s[b+2]=='.')
        b=b+2;
        else if(s[b+1]=='#' && s[b+2]=='#')
        {
            cout<<"No"<<endl;
            return 0;
        }

    }
    cout<<"Yes"<<endl;
}
}


Measured memory_bytes: 776
import java.util.Scanner;

public class Main {

	public static void main (String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		int[] a = new int[n];
		for(int i = 0; i < a.length; i++) {

			a[i] = sc.nextInt();

		}

		for(int i = a.length-1; i >= 0; i--) {
			System.out.print(a[i]);

			if(i != 0) System.out.print(" ");

		}
		System.out.println();
	}

}





Measured memory_bytes: 26376
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
typedef long long ll;

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

	vector<int> b(n);
	for (int i = 0; i < n; i++) {
		b[a[i]-1] = i+1;
	}

	for (int i = 0; i < n; i++) {
		cout << b[i] << " " << endl;
	}
}


Measured memory_bytes: 1664
import bisect

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

Primes = primes(10 ** 5)
Ans = []
for i in Primes:
    if (i + 1) // 2 in Primes:
        Ans.append(i)

Q = int(input())
for _ in range(Q):
    l, r = map(int,input().split())
    l_index = bisect.bisect_left(Ans, l)
    r_index = bisect.bisect_right(Ans, r)
    print(r_index - l_index)

Measured memory_bytes: 56280
function Main(s) {
  s = s.split(" ").map(a => +a);
  var a = s[0];
  var b = s[1];
  var c = s[2];
  var ans = 0;
  while(a !== b || a !== c){
    var d = Math.min(a, b, c);
    if(a === d){
      if(a === b){a++;b++;}
      else if(a === c){a++;c++;}
      else a += 2;
    }else if(b === d){
      if(b === c){b++;c++;}
      else b += 2;
    }else c += 2;
    ans++;
  }
	console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin","utf8"));

Measured memory_bytes: 21064
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define all(cont) cont.begin(), cont.end()
#define foreach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define fore(i,a,b) for(int i=a,almo5t=b;i<almo5t;++i)
#define SZ(x) ((int)x.size())
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define FIN std::ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

const int N = 0;

typedef long long int ll;

using namespace std;

int main(){
    string palindrom;cin>>palindrom;
    int s = SZ(palindrom);
    int mid = s/2;
    int ans = 0;
    fore(i,0,mid){
        if(palindrom[i] != palindrom[s-1-i]){
            ans++;
        }
    } 
    cout<<ans;
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main() {
	// Code for C - Tax Increase
	var A, B float64
	fmt.Scanf("%f %f", &A, &B)

	var flag int
	for i := 0; i < 10000; i++ {
		if math.Floor(float64(i)*0.08) == A && math.Floor(float64(i)*0.1) == B {
			fmt.Println(i)
			flag = 1
			break
		}
	}

	if flag == 0 {
		fmt.Println("-1")
	}
}


Measured memory_bytes: 1840
#include<iostream>
#include<cctype>
#include<string>
#include<cstdio>
using namespace std;
int main(){
		char ch;

		for (int i = 0; i < 1204; i++){
			scanf("%c", &ch);
			if (islower(ch)){
				printf("%c", toupper(ch));
			}
			else if (isupper(ch)){
				printf("%c", tolower(ch));
			}
			else if (ch == '\n'){
				break;
			}
			else{
				printf("%c", ch);
			}
		}
	cout << endl;
	return 0;
}


Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi   = vector<int>;
using vll  = vector<ll>;
using vc   = vector<char>;
using vvll  = vector<vll>;
using vvi  = vector<vi>;
using vvc  = vector<vc>;
using vb   = vector<bool>;
using vvb  = vector<vb>;
using pii  = pair<int,int>;
using vpii = vector<pii>;
using posteriority_queue = priority_queue<int, vi, greater<int>>;

int main() {
    int N; cin >> N;
    int chk = 0, ans = 0;
    for (int i = 0; i < N; i++){
        int a, b; cin >> a >> b;
        if(a == b) chk++;
        else chk = 0;

        if(chk==3) {
           ans = 1;
        }
    }
    if(ans == 1) cout << "Yes";
    else cout << "No";
}


Measured memory_bytes: 3620
a, b = map(int, input().split())

if a <= 0 and b >= 0:
    ans = 0

elif a < 0 and b < 0 :
    if (abs(a) + abs(b)) % 2:
        ans = 1
    else:
        ans = 2
else:
    ans = 1
    
if ans == 0:
    print("Zero")
elif ans == 1:
    print("Positive")
elif ans == 2:
    print("Negative")
    

Measured memory_bytes: 3060
M=998244353
N,*A=map(int,open(0))
d=[0]*90001
d[0]=1
e=[0]*90001
e[0]=1
z=1
s=0
for a in A:
	i=s
	while i>=0:
		d[i+a]+=d[i]%M
		d[i]*=2
		e[i+a]+=e[i]%M
		i-=1
	s+=a
	z=z*3%M
for i in range(s+1>>1,s+1):
	z-=d[i]*3
	z%=M
print([(z+e[s//2]*3)%M,z][s%2])

Measured memory_bytes: 141900
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main {
	static final int MOD = (int)1e9 + 7;
	int N,M;
	char[] ch;
	int[] r,l,newR,sum;
	long[][] dp;

	/*
	 * L 文字列Sの位置L-1まで見た
	 * C 位置L-1までに配置した1の数
	 */
	public long dfs(int L,int C){
		//System.err.println("L="+L+" C="+C);

		if(L == N){
			if(sum[L-1] == C)return 1L;
			else return 0L;
		}

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

		long ret = 0;

		//0を配置する
		if(C <= sum[newR[L]] && sum[newR[L]] - C <= newR[L] - L){
			ret += dfs(L + 1,C) % MOD;
		}

		//1を配置
		if(C + 1 <= sum[newR[L]] && sum[newR[L]] - C - 1 <= newR[L] - L){
			ret += dfs(L+1,C+1) % MOD;
		}

		//System.err.println("after: L="+L+" C="+C);
		ret %= MOD;
		return dp[L][C]=ret%MOD;
	}

	public void solve() {
		N = nextInt();
		M = nextInt();
		ch = next().toCharArray();

		l = new int[M];
		r = new int[M];
		for(int i = 0;i < M;i++){
			l[i] = nextInt() - 1;
			r[i] = nextInt() - 1;
		}

		newR = new int[N];
		for(int i = 0;i < N;i++){
			newR[i] = i;
		}
		for(int i = 0;i < M;i++){
			newR[l[i]] = l[i];
		}
		for(int i = 0;i < M;i++){
			newR[l[i]] = Math.max(newR[l[i]],r[i]);
		}
		for(int i = 1;i < N;i++){
			newR[i] = Math.max(newR[i], newR[i-1]);
		}

		sum = new int[N];
		for(int i = 0;i < N;i++){
			sum[i] = ch[i] - '0';
		}
		for(int i = 0;i < N - 1;i++){
			sum[i + 1] += sum[i];
		}

		dp = new long[N + 1][N + 1];
		for(int i = 0;i < N + 1;i++){
			Arrays.fill(dp[i], -1);
		}

		out.println(dfs(0,0));
	}

	public static void main(String[] args) {
		out.flush();
		new Main().solve();
		out.close();
	}

	/* Input */
	private static final InputStream in = System.in;
	private static final PrintWriter out = new PrintWriter(System.out);
	private final byte[] buffer = new byte[2048];
	private int p = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (p < buflen)
			return true;
		p = 0;
		try {
			buflen = in.read(buffer);
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (buflen <= 0)
			return false;
		return true;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrint(buffer[p])) {
			p++;
		}
		return hasNextByte();
	}

	private boolean isPrint(int ch) {
		if (ch >= '!' && ch <= '~')
			return true;
		return false;
	}

	private int nextByte() {
		if (!hasNextByte())
			return -1;
		return buffer[p++];
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = -1;
		while (isPrint((b = nextByte()))) {
			sb.appendCodePoint(b);
		}
		return sb.toString();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

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

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

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

#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/

// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
	os << "(" << pair_var.first << ", " << pair_var.second << ")";
	return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
	os << "{";
	for (int i = 0; i < vec.size(); i++) {
		os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
	}
	os << "}";
	return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
	os << "{";
	repi(itr, map_var) {
		os << *itr;
		itr++;
		if (itr != map_var.end()) os << ", ";
		itr--;
	}
	os << "}";
	return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
	os << "{";
	repi(itr, set_var) {
		os << *itr;
		itr++;
		if (itr != set_var.end()) os << ", ";
		itr--;
	}
	os << "}";
	return os;
}

#define DUMPOUT cerr

void dump_func() {
	DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
	DUMPOUT << head;
	if (sizeof...(Tail) > 0) {
		DUMPOUT << ", ";
	}
	dump_func(std::move(tail)...);
}
#ifdef _DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif


signed main() {

	int H,W,A,B;
	cin >> H>>W>>A>>B;

	if (H == 1) {
		rep(i, W) if (i < A) cout << 1;
		else cout << 0;
		cout << endl;
		return 0;
	}
	else if (W == 1) {
		rep(i, H) if (i < B) cout << 1 << endl;
		else cout << 0 << endl;
		return 0;
	}


	rep(h, H){
		rep(w, W) {
			if ((h < B) ^ (w < A)) cout << 0;
			else cout << 1;
		}
		cout << endl;
	}
	
	return 0;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
float avg(float a, float b){
  float ans= a + b;
  return  ans/2;
}
int main(){
  int n;
  cin >> n;
  float arr[n];
  for(int i = 0 ; i < n ; i++)
    cin >> arr[i];
  sort(arr,arr+n);
  float g = arr[0];
  for(int i = 1 ; i < n-1 ; i++){
    g = avg(g,arr[i]);
  }
  //cout << g << endl;
 // printf("%0.5f", avg(g,arr[n-1]));
  cout << avg(g,arr[n-1]) << endl;
  return 0;
  
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#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 ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    int n;
    cin >> n;
    vector<int> f[n];
    vector<ll> p[n];
    ll answer = INT_FAST64_MIN;
    REP(i,n){
        REP(j,10){
            int tmp;
            cin >> tmp;
            f[i].push_back(tmp);
        }
    }
    REP(i,n){
        REP(j,11){
            int tmp;
            cin >> tmp;
            p[i].push_back(tmp);
        }
    }
    for(int bit = 1; bit < (1<<10);++bit){
        vector<int>s(10);
        ll benefit = 0;
        
        REP(i,10){
            if(bit & (1<<i)){
                s[i]=1;
            }
            else{
                s[i]=0;
            }
        }
        REP(i,n){
            int match = 0;
            REP(j,10){
                if(f[i][j]*s[j])match++;
            }
            benefit+=p[i][match];
        }
        answer = max(answer,benefit);
    }
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<bitset>
#define MP make_pair
#define fi first
#define se second
#define rep(i,a,b) for(i=a;i<=b;i++)
using namespace std;
typedef pair<int,int> pii;
const int N=100010,M=4000010;
int a[N];int n;
bitset<M> b;
int sum,lim;

int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	int i,j,l,r;
	scanf("%d",&n);
	rep(i,1,n)	scanf("%d",&a[i]),sum+=a[i];
	sort(a+1,a+1+n);
	b[0]=1;
	rep(i,1,n)	b|=(b<<a[i]);	
	lim=sum/2+(sum&1);
	rep(i,lim,sum) if(b[i]){
		printf("%d\n",i);return 0;
	}
}
		
		
		
		
		
		
		
			
		
		
		
		
		
		
		
		
		
		
		

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define rep(i,n) for(long long i=0; i<n; i++)
#define Rep(i,n) for(long long i=1; i<n; i++)
#define ll long long
#include <math.h>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <vector>


using namespace std;
#define PI acos(-1)

int main(){
	string S,M;
	cin >>S>>M;
	string a="Yes";
    rep(i,S.size())if(S[i]!=M[i])a="No";
    cout<<a<<endl;
}



Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(var,cnt) for(int (var)=0; (var)<(int)(cnt); ++(var))
#define Rep(var,init,cnt) for(int (var)=(init); (var)<(cnt); ++(var))
#define ran(var,vec) for(auto &(var):(vec))
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define SORT(v) sort(all(v))
#define RSORT(v) sort(rall(v))
#define SUM(v) accumulate(all(v),0)
#define tget(tp,idx) get<idx>(tp)
#define TF(flag) (flag)?1:0
#define yn(f) cout<<(f?"yes":"no")<<endl
#define Yn(f) cout<<(f?"Yes":"No")<<endl
#define YN(f) cout<<(f?"YES":"NO")<<endl
#define COUT(x) cout<<(x)<<endl
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pi = pair<int,int>;
using pl = pair<ll,ll>;
using ti = tuple<int,int,int>;
using tl = tuple<ll,ll,ll>;

template<typename T>
using vec = vector<T>;
template<typename T>
using mat = vector<vec<T>>;
template<typename T>
using cub = vector<mat<T>>;
template<typename T>
using val = valarray<T>;

template<typename T>
using pq = priority_queue<T>;
template<typename T>
using rpq = priority_queue<T,vec<T>,greater<T>>;

template<typename T1,typename T2>
ostream &operator<<(ostream &os, const pair<T1,T2> &p){
  os<<"P("<<p.first<<", "<<p.second<<") ";
  return os;
}

template<typename T1,typename T2>
istream &operator>>(istream &is, pair<T1,T2> &p){
  is>>p.first>>p.second;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  cout<<"V{";
  for(int i=0; i<(int)v.size(); ++i){
    os<<v[i]<<(i+1!=v.size()?" ":"");
  }
  cout<<"}";
  return os;
}

template<typename T>
istream &operator>>(istream &is, vector<T> &v){
  for(T &in:v) is>>in;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const valarray<T> &v){
  cout<<"V{";
  for(int i=0; i<(int)v.size(); ++i){
    os<<v[i]<<(i+1!=v.size()?" ":"");
  }
  cout<<"}";
  return os;
}

template<typename T>
istream &operator>>(istream &is, valarray<T> &v){
  for(T &in:v) is>>in;
  return is;
}

// Usual Template End ================================================

// Template End ======================================================

constexpr int MOD=1e9+7;

int main(void){
  int a,b; cin>>a>>b; COUT((a*b)%2==0?"Even":"Odd");
}













Measured memory_bytes: 256