akhauriyash/Code-Regression huggingface dataset:
//
// じょえチャンネル
// https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ
//
// Created by yamunaku on 2020/02/22.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

int main(){
    //CFS;
    int n;
    cin >> n;
    vi x(n);
    rep(i,n) cin >> x[i];
    int ans = IINF;
    rep(i,101){
        int tmp = 0;
        rep(j,n){
            tmp += (x[j]-i)*(x[j]-i);
        }
        ans = min(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
x = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K=int(input())
print(x[K-1])


Measured memory_bytes: 2940
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

class UnionFind
{
private:
	std::vector<LL>per, rank, cnt;

public:
	void init(LL size)
	{
		per.resize(size);
		rank.resize(size);
		cnt.resize(size);
		rep(i, size)
		{
			per[i] = i;
			rank[i] = 0;
			cnt[i] = 1;
		}
	}

	LL get_per(LL v)
	{
		if (per[v] == v) return v;
		return per[v] = get_per(per[v]);
	}

	bool is_united(LL u, LL v)
	{
		return get_per(u) == get_per(v);
	}

	void unite(LL u, LL v)
	{
		if (is_united(u, v)) return;
		LL u_per = get_per(u), v_per = get_per(v);
		if (rank[u_per] < rank[v_per])
		{
			per[u_per] = v_per;
			cnt[v_per] += cnt[u_per];
			cnt[u_per] = 0;
		}
		else
		{
			per[v_per] = u_per;
			cnt[u_per] += cnt[v_per];
			cnt[v_per] = 0;
			if (rank[u_per] == rank[v_per]) ++rank[u_per];
		}
	}
};

int main()
{
	LL n, q;
	in >> n >> q;

	UnionFind tree;
	tree.init(n);
	rep(loop, q)
	{
		LL com, x, y;
		in >> com >> x >> y;
		if (com == 0) tree.unite(x, y);
		else out << tree.is_united(x, y) << std::endl;
	}
}



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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a, b, x; cin >> a >> b >> x;
  ll n = (a%x==0 ? a/x : (a/x+1));
  ll m = b/x;
  ll ans = m-n+1;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

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

    int n, m; cin >> n >> m;
    vi a(n); for(auto& e : a) cin >> e;
    vi b(m); for(auto& e : b) cin >> e;

    vector<vll> dp(n+1, vll(m+1));
    rep(i, n+1) dp[i][0] = 1LL;
    rep(j, m+1) dp[0][j] = 1LL;

    ll res = 1LL;
    rep(i, 1, n+1){
        rep(j, 1, m+1){
            ll& cur = dp[i][j];

            if(a[i-1] == b[j-1]){
                cur = dp[i - 1][j - 1];
                res = ADD(res, cur, mod);
            }

            cur = ADD(cur, dp[i - 1][j], mod);
            cur = ADD(cur, dp[i][j - 1], mod);
            cur = SUB(cur, dp[i - 1][j - 1], mod);
        }
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 31616
#include<iostream>
#include<vector>
using namespace std;
#define REP(i, j) for(int i = 0; i < j; i++)

class C{
    public:
        int type, pay;
        double r;
        C(int _type, double _r, int _pay){
            type = _type;
            r = _r;
            pay = _pay;
        }
};

int main(){
    int m; cin >>m;
    REP(z, m){
        int yen, year, n; cin >>yen >>year >>n;
        vector<C> v;
        REP(i, n){
            int a, c;
            double b;
            cin >>a >>b >>c;
            v.push_back( C(a, b, c) );
        }

        int ans = 0;
        REP(i, n){
            int now = yen, tmp = 0;
            REP(j, year){
                (v[i].type? now : tmp) += (int)(now * v[i].r);
                now -= v[i].pay;
            }
            if(v[i].type == 0) now += tmp;
            ans = max(ans, now);
        }
        cout <<ans <<endl;
    }
    return 0;
}

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

int main(){
	int a,b,c,d;
	cin >> a >> b >> c;
	a = a * 100;
	b = b * 10;
	d = a + b + c;
	if(d % 4 == 0)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
	return 0;
}

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

int main() {
	int a,b,c;
	cin>>a>>b>>c;
	int k;cin>>k;
	int count=0;
	while(a>=b){
	    b=b*2;count++;
	}
	while(b>=c){
	    c*=2;
	    count++;
	}
	//cout<<count<<" "<<a<<" "<<b<<" "<<c;
	if(count<=k){cout<<"Yes"<<"\n";}
	else{cout<<"No"<<"\n";}
	return 0;
}


Measured memory_bytes: 3592
#include <stdio.h>

int main(int argc, char const *argv[]) {

    int n, m, l;
    scanf("%d %d %d", &n, &m, &l);
    int A[n][m];
    int B[m][l];
    long long int C[n][l];


    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            scanf("%d", &A[i][j]);
        }
    }

    for (int j = 0; j < m; j++) {
        for (int k = 0; k < l; k++) {
            scanf("%d", &B[j][k]);
        }
    }



    for (int i = 0; i < n; i++) {
        for (int k = 0; k < l; k++) {
            C[i][k] = 0;
            for (int j = 0; j < m; j++) {
                C[i][k] += A[i][j] * B[j][k]; 
            }
        }
    }


    for (int i = 0; i < n; i++) {
        for (int k = 0; k < l; k++) {
            if (k != 0) {
                printf(" %lld", C[i][k]);
            } else {
                printf("%lld", C[i][k]);
            }
        }
        printf("\n");
    }


    return 0;
}


Measured memory_bytes: 2104
n, m = map(int, input().split())
Adj_dict = {}
for i in range(n):
    new = {i: []}
    Adj_dict.update(new)
for _ in range(m):
    a, b = map(int, input().split())
    Adj_dict[a-1].append(b-1)
    Adj_dict[b-1].append(a-1)


for i in range(n):
    print(len(Adj_dict[i]))

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

const int X_END = 8;
const int Y_END = 8;

char m[Y_END][X_END + 1];

char whatFigure() {
    for (int y = 0; y < Y_END; y++) {
        for (int x = 0; x < X_END; x++) {
            if (m[y][x] == '1') {
                if (x+1 < X_END && y+1 < Y_END
                    && m[y][x+1] == '1' && m[y+1][x] == '1' && m[y+1][x+1] == '1') {
                    return 'A';
                } else if (y+3 < Y_END
                           && m[y+1][x] == '1' && m[y+2][x] == '1' && m[y+3][x] == '1') {
                    return 'B';
                } else if (x+3 < X_END
                           && m[y][x+1] == '1' && m[y][x+2] == '1' && m[y][x+3] == '1') {
                    return 'C';
                } else if (x >= 1 && y+2 < Y_END
                           && m[y+1][x] == '1' && m[y+1][x-1] == '1' && m[y+2][x-1] == '1') {
                    return 'D';
                } else if (x+2 < X_END && y+1 < Y_END
                           && m[y][x+1] == '1' && m[y+1][x+1] == '1' && m[y+1][x+2] == '1') {
                    return 'E';
                } else if (x+1 < X_END && y+2 < Y_END
                           && m[y+1][x] == '1' && m[y+1][x+1] == '1' && m[y+2][x+1] == '1') {
                    return 'F';
                } else if (x >= 1 && x+1 < X_END && y+1 < Y_END
                           && m[y][x+1] == '1' && m[y+1][x] == '1' && m[y+1][x-1] == '1') {
                    return 'G';
                }
            }
        }
    }
    return '0';
}

int main() {
    while (cin >> m[0]) {
        for (int i = 1; i < 8; i++) {
            cin >> m[i];
        }
        cout << whatFigure() << endl;
    }
}

Measured memory_bytes: 1128
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;

ll C[51][51];

void comb_table(int N){
    for(int i=0;i<=N;++i){
        for(int j=0;j<=i;++j){
            if(j==0 or j==i) C[i][j]=1ll;
            else C[i][j]=(C[i-1][j-1]+C[i-1][j]);
        }
    }
}

int main(int argc, char const *argv[]) {
    int n, a, b;
    cin >> n >> a >> b;
    vector<ll> v(n);
    REP(i,n) cin >> v[i];
    sort(v.begin(), v.end(), greater<>());
    double ave = 0.0;
    REP(i,a) ave += (double)v[i];
    ave = ave/(double)a;
    REP(i,51) REP(j,51) C[i][j] = 0;
    comb_table(n);
    int x = 0;
    int y = 0;
    REP(i,n) {
        if (v[i] == v[a-1]) {
            x++;
            if (i < a) y++;
        }
    }
    ll cnt = 0ll;
    if (y == a) for (int i = a; i <= b; ++i) cnt += C[x][i];
    else cnt += C[x][y];
    cout.precision(20);
    cout << fixed << ave << endl;
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define MOD 1000000007
const int INF = 1LL<<30;

int main(){
    int n,k;
    cin>>n>>k;
    vector<int> a(n);
    rep(i,n) cin>>a[i];
    int ng=0,ok=1e9+1;
    while(ok-ng>1){
        int mid=ng+(ok-ng)/2;
        int tk=0;
        rep(i,n) tk+=max(0,a[i]/mid-(a[i]%mid==0 ? 1 : 0));
        if(tk<=k) ok=mid;
        else ng=mid;
    }

    cout<<ok<<endl;
}

Measured memory_bytes: 3984
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cstdint>

using std::int64_t;  // （非本質） std::int64_t はちょっと長いのでこれだけ std:: を省略できるようにする。

// なんとなく， w はちょっぴり大きめに取っておく （競プロ勢の慣習）
int64_t n, k, w[100010];
// 説明の順番のためにプロトタイプ宣言しているけど，普通はここに実装も書いちゃって大丈夫。
int64_t solve(int64_t inf, int64_t sup);

int main(){
    // 入力
    std::cin >> n >> k;
    for(int64_t i=0; i < n; ++i)
        std::cin >> w[i];

    // 【考え方】
    // 　・Pがある値以上の時は「条件」が成立，ある値未満の時は条件が不成立になる。その境界を探す
    // 　・「条件」の計算が簡単 （今回は貪欲法で順番にトラックに詰めてみれば判定できる）
    // 　　　　　-> Pの値で二分探索しよう！

    // ！ 注意： 二分探索は半開区間で行うとバグりにくい ！
    // 半開区間をどちらに開かせるかは重要 (後半で解説している)
    // 上限：「荷物の総和」より積載量を大きくしてもしょうがないのでこれが上限
    // ！ 注意 ！ int (32bit整数) だとオーバーフローする。 0 も int64_t 型にキャストすること！
    // 　競プロでは，不幸な事故を避けるため，脳死で int64_t を使った方が無難。
    int64_t sup =
        std::accumulate(std::begin(w), std::end(w), static_cast<int64_t>(0)) + 1;
    // 下限 ：「荷物一つの重さの最大値」が本来の下限だが，1より小さくならない。
    // 　　　　半開区間の下界なので -1 して 0 にしている。
    int64_t inf = 0;

    // 二分探索して出力
    std::cout << solve(inf, sup) << std::endl;
}

// 二分探索の実装
int64_t solve(int64_t inf, int64_t sup){
    // 区間の大きさが既に1なら探索が終わっているので，そのまま返す。
    if(inf + 1 >= sup)
        return sup;

    // まず P_m を区間の中点に設定 (m は medium の頭文字)
    // ここから先は，(inf, sup] を (inf, P_m] と (P_m, sup] に分けて，
    // どちらに境界があるかを見ていく。

    const int64_t P_m = (inf + sup) / 2;

    // 注意点として， 仮に [inf, sup)を [inf, P_m) と [P_m, sup) に分ける実装だとして，
    // P_m で上手くいくことが判明した場合，欲しい値が上の区間にあるか下の区間にあるか分からない。
    // (P_mが真の答えの場合とそうじゃない場合を考えてみよう)

    // 逆に， (inf, sup] を (inf, P_m] と (P_m, sup] に分ける場合，
    // P_m の時にダメだったら答えは (P_m, sup] の中にあるし，大丈夫だったら答えは (inf, P_m] の中にある。
    // なのでこちら向きの半開区間にするのが正解。

    // ここまで考えればあとは貪欲法をやるだけ！
    // P = P_m としてトラックに積んでみる

    bool is_ok = true;  // 積めそうかどうか
    int64_t current_truck_weight = 0;  // 今のトラックに積んでいる量
    int64_t truck_needed = 0;  // 必要になるトラック数が入る

    // 荷物を順に for ループで積んでいく
    for(int64_t package_idx = 0; package_idx < n; ++package_idx){
        int64_t package_weight = w[package_idx];  // 今積んでいる荷物の重量

        // 荷物単体でトラックの積載量を超えたらアウト
        if(package_weight > P_m)
            is_ok = false;

        // 今のトラックに積みきれるか判定
        if(current_truck_weight + package_weight > P_m){
            ++truck_needed;  // 次のトラックを用意する
            current_truck_weight = package_weight;  // 新しいトラックに載せる
        } else {
            current_truck_weight += package_weight;
        }
    }

    // 積み終わった時点で最後のトラックに荷物が残っていたら出発させる
    if(current_truck_weight > 0){
        ++truck_needed;
        current_truck_weight = 0;
    }

    // 載せ終わった時点でトラックが足りていなかったことが分かったらアウト
    if(truck_needed > k)
        is_ok = false;

    if(is_ok)
        return solve(inf, P_m);  // 積み込めた場合は (inf, P_m] に答えがある
    else
        return solve(P_m, sup);  // 無理だった場合は (P_m, sup] に答えがある
}



Measured memory_bytes: 3860
import sys
import math
import heapq
from collections import defaultdict, deque
from decimal import *
def r():
    return int(input())
def rm():
    return map(int,input().split())
def rl():
    return list(map(int,input().split()))

ans=defaultdict(int)
n=r()
for i in range(1,100):
    for j in range(1,100):
        for k in range(1,100):
            add=(i+j+k)**2-(i*j)-(j*k)-(k*i)
            ans[add]+=1
for i in range(1,n+1):
    print(ans[i])

Measured memory_bytes: 83112
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1e9 + 7;
const ll INF = 1e9;
const ll LINF = 1LL << 60;

int main() {
  int a, b, k;
  cin >> k >> a >> b;
  for (int i = 1; i < 10000; ++i) {
    if (a <= i * k && i * k <= b) {
      cout << "OK" << endl;
      return 0;
    }
  }
  cout << "NG" << endl;
  return 0;
}


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

int main(void) {
    int64_t K,N;
    int64_t pos;
    int64_t start;
    int64_t ipos;
    cin >> K >> N;
    vector<int64_t> A(N);

    cin >> start;
    A[0] = 0;
    pos = start;
    for(int i=0;i<N-1;i++) {
        cin >> ipos;
        A[i] = ipos - pos;
        pos = ipos;
    }

    A[N-1] = K-pos + start;

    sort(A.begin(), A.end());   

    cout << K - A[A.size()-1] << "\n";

    return 0;
}


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

int main(){
	int n;
	int
		a=100000;
	cin >> n;
	for (int i = 0; i < n; i++){
		a = a*1.05;
		if (a % 1000!=0){
			a = a + 1000 - a % 1000;
		}
	}
	cout << a << endl;

}


Measured memory_bytes: 2992
import java.util.*;
public class Main {
	
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String S = sc.next();
		sc.close();
		
		int cnt = 0;
		String tmp = "";
		for(int i=0;i<1000;i++) {
			if(i>=100)tmp=Integer.toString(i);
			else if(i>=10)tmp = "0"+Integer.toString(i);
			else tmp = "00"+Integer.toString(i);
			
			int point=0;
			boolean broken = false;
			for(int j=0;j<3;j++) {
				char now = tmp.charAt(j);
				int first = S.indexOf(now, point);
				if(first == -1) {
					broken = true;
					break;
				}
				point = first+1;
			}
			if(!broken)cnt++;
			
		}
		System.out.println(cnt);
	}
	
}



Measured memory_bytes: 22100
#include<bits/stdc++.h>
# define  _deb(x) { cerr << "\033[94m"<< "[ " << #x << " = " << (x) << " ]\n\033[0m"; }
using namespace std;
#define int long long
vector<int>A;
int fac(int n , int k){
	int x = A.size();
	vector<int>d(x);
	int rs = 0;
	for(int i=0;i<x;i++){
		d[i] = A[i] % n;
		rs += d[i];
	}
	if(rs % n != 0) return 0;
    sort(d.begin(),d.end());
	int move = 0,ind = x-1;
	while(rs > 0 && x>=0){
		move += (n - d[ind]);
		rs -= n;
		ind--;

	}
	//_deb(k);_deb(move);_deb(rs);
     if(move <= k) return 1;

	 return 0;


}
signed main(){
	int n,k;
	cin >> n >> k;
	int sum = 0;
	for(int i=0;i<n;i++){
		int x;
		cin >> x;
		A.push_back(x);
		sum += x;
	}
	int mx = 0;
	for(int i=1;i*i<=sum;i++){
		if(sum % i==0){
		//	_deb(i);
		    int x = fac(i,k);
			if(x){
				mx = max(mx , i);
			}
			int y = fac(sum/i , k);
			if(y){
				mx = max(mx , sum/i);
			}

			//_deb(x);_deb(y);
		}
	}
	cout << mx << '\n';



}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

long findMinNumOperations(long candies[], int num_boxes, long max_sum) {
    long num_operations = 0;
    for(int i = 0; i < num_boxes; ++i) 
        if(candies[i] > max_sum) {
            num_operations += candies[i] - max_sum;
            candies[i] = max_sum;
        }
    for(int i = 0; i < num_boxes - 1; ++i) 
        if(candies[i] + candies[i + 1] > max_sum) {
            num_operations += (candies[i] + candies[i + 1]) - max_sum;
            candies[i + 1] = max_sum - candies[i];
        }
    return num_operations;
}
int main() {
    int num_boxes;
    long max_sum;
    cin >> num_boxes >> max_sum;
    long num_candies[num_boxes];
    for(auto i = 0; i < num_boxes; ++i)
        cin >> num_candies[i];
    cout << findMinNumOperations(num_candies, num_boxes, max_sum);
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(){
    int i, loop;
    scanf("%d", &loop);
    
    for(i = 3; i <= loop; i++){
        if(i % 3 == 0 || include_3(i))printf(" %d", i);
    }
    printf("\n");
}

int include_3(int x){
    if(x % 10 == 3)return 1;
    int next = x / 10;
    if(x) return include_3(next);
    return 0;
}


Measured memory_bytes: 2140
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define all(x) (x).begin(),(x).end()
typedef long long int ll;
using namespace std;
int main()
{
  int n;
  double t, a;
  cin >> n>> t >>a;
  double tmp;
  double maxval = 1e9;
  int ind;
  REP(i,n){
    cin >> tmp;
    tmp = t - tmp*0.006;
    if(maxval > abs(tmp - a)){
      maxval = abs(tmp - a);
      ind = i + 1;
    }
  }
  cout << ind << endl;
}


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

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define INFTY 999999

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

    scanf("%d %d %d", &a, &b,&c);

    int ans=(a*b)/2;

    printf("%d", ans);
    
    return 0;
    
}


Measured memory_bytes: 128
import java.util.*;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		s += s;
		String t = sc.next();
		if (s.contains(t)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 23636
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**20
def I(): return int(input())
def F(): return float(input())
def S(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()

def resolve():
    N, K = LI()
    A = LI()

    # 全部0の最遅ケースでもlog(N)*2くらいで収束する log(2*10**5)<50
    for _ in range(min(K, 50)):
        tmp = [0] * (N + 1)
        b = [0] * (N + 1)
        for i in range(N):
            tmp[max(i - A[i], 0)] += 1
            tmp[min(i + A[i] + 1, N)] -= 1
        for i in range(N):
            b[i+1] = tmp[i] + b[i]
        for i in range(N):
            A[i] = b[i+1] 
        # print(A)

    print(*A)

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 171512
import sys
import math
import itertools as it
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":pass
n = i()
s = [input() for _ in range(n)]
s.sort()
ss = list(set(s))
ss.sort()
a = [0]*len(ss)
i = 0
j = 0
while n-1 > i:
    if s[i] == s[i+1]:
        a[j] += 1
        i += 1
    else:
        i += 1
        j += 1
m = max(a)
for k in range(len(a)):
    if m == a[k]:
        print(ss[k])

Measured memory_bytes: 91608
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
#include<tuple>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int main(){
  ll n;
  cin >> n;
  vector<ll> t(n);
  ll ans = 1;
  rep(i, n) cin >> t[i];
  for(int i = 0; i < n; ++i){
    ans = lcm(ans, t[i]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) repd(i,0,n)
typedef long long ll;


int main(){
  string s,t;
  cin >> s >> t;
  rep(i, t.size()){
    cout << s[i] << t[i];
  }
  if(s.size() > t.size()){
    cout << s[s.size()-1];
  }
  cout << endl;
  
  return 0;
}



Measured memory_bytes: 888
#include <stdio.h>

#define H 500000

int parent(int);
int left(int);
int right(int);
void maxHeapify(int *,int);
void buildMaxHeap(int *);


int heap[H],n;

int main(){

  int i,j;

  scanf("%d",&n);

  for(i=1;i<=n;i++) scanf("%d",&heap[i]);

  buildMaxHeap(heap);

  for(j=1;j<=n;j++) printf(" %d",heap[j]);
  printf("\n");

  return 0;

}

int parent(int x){
  return (x/2);
}

int left(int x){
  return x*2;
}

int right(int x){
  return (x*2+1);
}

void maxHeapify(int h[],int x){

  int l,r;

  int largest,tmp;

  l=left(x);
  r=right(x);

  if(l<=n && h[l]>h[x]){
    largest=l;
  }
  else{
    largest=x;
  }

  if(r<=n && h[r]>h[largest]){
    largest=r;
  }

  if(largest!=x){

    tmp=h[x];
    h[x]=h[largest];
    h[largest]=tmp;
    // printf("%d\n",x);
    maxHeapify(h, largest);
  }

}

void buildMaxHeap(int h[]){

  int k;

  for(k=n/2;k!=0;k--) maxHeapify(h,k);
}

Measured memory_bytes: 2552
#include <iostream>
#include <ccomplex>
#include <vector>
#include <cassert>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>
#include <time.h>
#include <stack>
#include <locale>
#include <clocale>
#include <ctype.h>
#include <wchar.h>

using namespace std;
typedef long long int LL;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

int xcomp(vector<LL>& a, vector<LL>& b) {
	return a[0] < b[0];
}

#define XSORT(c) sort((c).begin(),(c).end(),xcomp)

#define ALL(x) (x).begin(),(x).end()
LL mod = 1000000007;

int main() {
	LL N;
	cin >> N;
	vector<LL> x(N, 0);
	REP(i, N) {
		cin >> x[i];

	}
	LL sum = 1;
	REP(i, x.size()) {
		if (x[i] <= 2 * i) {
			sum *= i + 1;
			sum = sum%mod;
			x.erase(x.begin());
			i--;
		}
	}
	REP(i, x.size()) {

		sum *= i + 1;
		sum = sum%mod;
	}
	cout << sum%mod << endl;
}


Measured memory_bytes: 1152
#include <iostream>
#include <fstream>
#include <algorithm>
#include <iomanip>
#include <random>
#include <ctime>
#include <bitset>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define ld long double
#define ull unsigned long long
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(x) x.begin(), x.end()
#define fast_io cout.tie(0), cin.tie(0), ios_base::sync_with_stdio(0)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
using namespace std;
ld eps = (ld)1 / 1e15;
ll inf = 1e18, mod2 = 998244353, mod1 = 1e9 + 7;
ll sqr(ll a) { return a * a; }
ll qb(ll a) { return a * a * a; }
ll gcd(ll a, ll b) { return !a ? b : gcd(b % a, a); }
ll binpow(ll a, ll b, ll mod) { return b ? (b % 2 ? (a * (sqr(binpow(a, b / 2, mod)) % mod)) % mod : sqr(binpow(a, b / 2, mod)) % mod) : 1; }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ll ar[100001], br[100001];

int main()
{
    //freopen("race.in", "r", stdin), freopen("race.out", "w", stdout);
    fast_io;
    ll a, b, x, y, z, m, i, ma = inf, mb = inf, ans = inf;
    cin >> a >> b >> m;
    for (i = 1; i <= a; i++) cin >> ar[i], ma = min(ma, ar[i]);
    for (i = 1; i <= b; i++) cin >> br[i], mb = min(mb, br[i]);
    for (i = 1; i <= m; i++)
    {
        cin >> x >> y >> z;
        ans = min(ans, ar[x] + br[y] - z);
    }
    ans = min(ans, ma + mb);
    cout << ans;
    return 0;
}

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

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

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define For(i,a,b) for(int i=a;i<b;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
#define debug(x) cerr << x << endl
#define Complex complex<double>
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    rep(i,n){
        cin >> a[i] >> b[i];
    }
    sort(all(a));
    sort(all(b));
    int ma=a[n/2];
    int mb=b[n/2];
    if(n%2==0){
        ma+=a[n/2-1];
        mb+=b[n/2-1];
    }
    cout << mb-ma+1;

}

/*



 */



Measured memory_bytes: 4852
#include<bits/stdc++.h>
#define x first
#define y second
#define ll long long
#define pii pair<int, int>
#define maxn 1005
#define dbg(n) cout << n << endl
using namespace std;

inline void read(int &x){
	int f = 1; x = 0; char s = getchar();
    while(s > '9' || s < '0'){
		if(s == '-') f = -1;
		s = getchar();
	}
    while(s <= '9' && s >= '0'){
		x = x * 10 + s - '0';
		s = getchar();
	}
    x = x * f;
}

int main(){
	int a, b, c, d;
	read(a); read(b); read(c); read(d);
	cout << max(a * b, c * d) << endl;
	return 0;
}


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



int main() {
	int P, Q, R;
	scanf("%d %d %d", &P, &Q, &R);
	int res = P + Q + R - (P < (Q < R ? R : Q) ? (Q < R ? R : Q) : P);
	printf("%d", res);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include<iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define MOD 1000000007
using namespace std;

bool pallin(string s) {
	ll l=0, r=s.length()-1;
	while(l<=r) {
		if(s[l]!=s[r]) return false;
		l++; r--;
	}
	return true;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 	
    string s;
    cin >> s;
    ll n=s.length()-1;
    if(pallin(s)) {
    	ll l=0, r=(n-1)/2, flag=1;
    	while(l<=r) {
    		if(s[l]!=s[r]) {
    			flag=0;
    			break;
    		}
    		l++; r--;
    	}
    	l=(n+3)/2; r=n;
    	while(l<=r) {
    		if(s[l]!=s[r]) {
    			flag=0;
    			break;
    		}
    		l++; r--;
    	}
    	if(flag) cout << "Yes";
    	else cout << "No";
    } else cout << "No";
    cout << "\n";
    return 0;
}



Measured memory_bytes: 256
// input! macro is published in the following URLs.
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
// https://github.com/tanakh/competitive-rs.git
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        h: usize,
        w: usize,
        a_ss: [chars; h],
    }

    for a_s in a_ss.iter() {
        if a_s.iter().any(|c| *c == '#') {
            for i in 0..w {
                let mut found = false;
                for j in 0..h {
                    if a_ss[j][i] == '#' {
                        found = true;
                        break;
                    }
                }
                if found {
                    print!("{}", a_s[i]);
                }
            }
            println!();
        }
    }
}


Measured memory_bytes: 4352
import math
import queue
import bisect
import heapq
import time
import itertools

mod = int(1e9+7)

def swap(a,b):
    return (b,a)

def gcd(a,b): #最大公約数
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

def lcm(a,b): #最小公倍数
    return a/gcd(a,b)*b

def divisors(a): # 約数列挙
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

def is_prime(a): #素数判定
    if a<2:
        return False
    elif a==2:
        return True
    elif a%2==0:
        return False
    sqrt_num = int(a**0.5)
    for i in range(3,sqrt_num+1,2):
        if a%i==0:
            return False
    return True

def prime_num(a): #素数列挙
    pn = [2]
    for i in range(3,int(a**0.5),2):
        prime = True
        for j in pn:
            if i%j==0:
                prime = False
                break
        if prime:
            pn.append(i)
    return pn

def prime_fact(a): #素因数分解
    sqrt = math.sqrt(a)
    res = []
    i = 2
    if is_prime(a):
        res.append(a)
    else:
        while a!=1:
            while a%i==0:
                res.append(i)
                a //= i
            i += 1
    return res

def main():
    k,x = map(int,input().split())
    if 500 * k < x:
        print('No')
    else:
        print('Yes')
    return

if __name__=='__main__':
    main()


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

using i64 = int64_t;

constexpr i64 MOD = 1e9 + 7;
const string ABC = "ABC";

i64 dp[100005][4]={0};

int main(){
    string s;
    cin >> s;
    for(int i=0;i<4;++i)dp[(int)s.size()][i] = (i == 3 ? 1 : 0);

    for(int i=(int)s.size()-1;i>=0;--i){
        dp[i][3] = dp[i+1][3] * (s[i] == '?' ? 3 : 1) % MOD;
        for(int j=2;j>=0;--j){
            dp[i][j] = dp[i+1][j] * (s[i] == '?' ? 3 : 1) % MOD;
            dp[i][j] += dp[i+1][j+1] * (s[i] == '?' || s[i] == ABC[j] ? 1 : 0);
            dp[i][j] %= MOD;
        }
    }

    cout << dp[0][0] << endl;

    return 0;
}


Measured memory_bytes: 3584
N,M=map(int,input().split())
li=[]
ans=0
for i in range(M):
    s=list(map(int,input().split()))
    li.append(s)
p=list(map(int,input().split()))

for j in range(2**N):
    j=bin(j)
    j=str(j)
    j=j[2:]
    while len(j)!=N:
        j="0"+j
    flash=0
    for k in range(M):
        temp=0
        for l in range(li[k][0]):
            if j[li[k][l+1]-1]=="1":
                temp+=1
        if temp%2==p[k]:
            flash+=1
    if flash==M:
        ans+=1
print(ans)
        
            


Measured memory_bytes: 8980
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_D main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions

#endif


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


    int N; cin >> N;
    vi A(N); REP(i, N) cin >> A[i];

    vector<pii> B;
    REP(i, N) B.push_back(pii(A[i], i));    
    sort(B.begin(), B.end());

    int lo = B[0].first, hi = B[N - 1].first;

    vector<pii> ans;
    if (lo >= 0) {
        for(int i=0; i<N-1; i++) {
            A[i + 1] += A[i];
            ans.push_back(pii(i + 1, i + 2));
        }
    } else if (hi <= 0) {
        for(int i=N-1; i>=1; i--) {
            A[i - 1] += A[i];
            ans.push_back(pii(i + 1, i));
        }
    } else {
        if (abs(lo) < abs(hi)) {
            int hiIdx = B[N - 1].second;
            REP(i,N) {
                if (i == hiIdx) continue;
                A[i] += hi;
                ans.push_back(pii(hiIdx + 1, i + 1));
            }

            for(int i=0; i<N-1; i++) {
                A[i + 1] += A[i];
                ans.push_back(pii(i + 1, i + 2));
            }
        } else {
            int loIdx = B[0].second;
            REP(i,N) {
                if (i == loIdx) continue;
                A[i] += lo;
                ans.push_back(pii(loIdx + 1, i + 1));
            }

            for(int i=N-1; i>=1; i--) {
                A[i - 1] += A[i];
                ans.push_back(pii(i + 1, i));
            }
        }
    }

    cout << ans.size() << endl;
    for(auto p : ans) {
        cout << p.first << " " << p.second << endl;
    }


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); i++)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
        return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

int main() {
        string s;
        cin >> s;
        
        if (s == "ABC") {
                cout << "ARC" << endl;
        } else {
                cout << "ABC" << endl;
        }

        return 0;
}


Measured memory_bytes: 3624
/**
 * C - Flip,Flip, and Flip......
 * https://atcoder.jp/contests/abc090/tasks/arc091_a
 **/
#include<iostream>

using namespace std;

int main() {
    long long N, M;
    cin >> N >> M;
    long long ans = 0;
    if(N==1&M==1) {
        ans = 1;
    } else if(N==1&M>2) {
        ans = M-2;
    } else if(M==1&N>2) {
        ans = N-2;
    } else if(N>2&M>2) {
        ans = (N-2)*(M-2);
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
using namespace std;

int h, w;
string s[100];

int m[100][100];

int main()
{
	cin >> h >> w;

	for (int i = 0; i < h; i++)
		cin >> s[i];

	memset(m, 0, sizeof(m));

	if (s[0][0] == '.')
		m[0][0] = 0;
	else
		m[0][0] = 1;

	for (int j = 1; j < w; j++) {
		m[0][j] = m[0][j - 1];

		if (s[0][j - 1] == '.' && s[0][j] == '#')
			m[0][j]++;
	}

	for (int i = 1; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (j == 0) {
				m[i][0] = m[i - 1][0];

				if (s[i - 1][0] == '.' && s[i][0] == '#')
					m[i][0]++;
			}
			else {
				int u = m[i - 1][j], l = m[i][j - 1];

				if (s[i - 1][j] == '.' && s[i][j] == '#')
					u++;

				if (s[i][j - 1] == '.' && s[i][j] == '#')
					l++;

				m[i][j] = min(l, u);
			}
		}
	}

	cout << m[h - 1][w - 1] << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const ll INF = 1ll<<30;
const ll longINF = 1ll<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;
const bool debug = 0;
//---------------------------------//

int H, W, A, B;
int ans[1000][1000];

int main() {
	cin >> H >> W >> A >> B;
	
	REP(i, B) REP(j, A) ans[i][j] = 1;
	FOR(i, B, H) FOR(j, A, W) ans[i][j] = 1;
	
	REP(i, H) REP(j, W) printf("%d%s", ans[i][j], j == W - 1 ? "\n" : "");
	
	return 0;
}


Measured memory_bytes: 5120
#include<bits/stdc++.h>
#define maxn 10000005
#define ll long long
using namespace std;
inline ll read(){
	ll x=0,c,f=1;while(!isdigit(c=getchar()))if(c=='-')f=-1;
	while(x=x*10+c-'0',isdigit(c=getchar()));
	return x*f;
}
int pri[maxn],vis[maxn];
inline void init(){
	for(int i=2;i<maxn;i++){
		if(!vis[i])pri[++pri[0]]=i;
		for(int j=1;j<=pri[0]&&1ll*pri[j]*i<maxn;j++){
			vis[i*pri[j]]=1;
			if(i%pri[j]==0)break;
		}
	}
}
int a[maxn];
int main(){
	init();ll n=read(),p=read(),ans=1ll;
	if(n==1){printf("%lld\n",p);return 0;}
	for(int i=1;i<=pri[0];i++)if(p%pri[i]==0){
		int tmp=0;
		while(p%pri[i]==0)tmp++,p/=pri[i];
		tmp=tmp/n;
		for(int j=1;j<=tmp;j++)ans=1ll*ans*pri[i];
	}printf("%lld\n",ans);return 0;
}

Measured memory_bytes: 43392
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef long long ll;
typedef long long integer;
//////////////////////////////////////////////////
int main(){
    set<string> S;
    int N;
    SCD(N);
    getchar();
    string W;
    char last;
    
    getline(cin,W);
    int l = W.length();
    last = W[l-1];
    S.insert(W);

    bool ans = true;

    REP(i,N-1){
        getline(cin,W);
        l = W.length();
        if (W[0] != last) ans = false;
        if (SIN(W,S)) ans = false;
        last = W[l-1];
        S.insert(W);
    }

    if (ans) printf("Yes\n");
    else printf("No\n");
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <cmath>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <numeric>

using namespace std;

typedef long long ll;
//typedef pair<ll, ll> P;

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

class edge {
public:
    int from, to;
    ll cost;

    edge(int t, ll c) : from(-1), to(t), cost(c) {}

    edge(int f, int t, ll c) : from(f), to(t), cost(c) {}

    bool operator<(const edge &e) const {
        return cost < e.cost;
    }

    bool operator>(const edge &e) const {
        return cost > e.cost;
    }
};

const ll INF = numeric_limits<ll>::max();

vector<ll> dijkstra(vector<vector<edge>> &g, int n, int s) {
    using P = pair<ll, int>;
    priority_queue<P, vector<P>, greater<P>> pque;
    vector<ll> d(n, INF);
    d[s] = 0;
    pque.push(P(0, s));
    while (!pque.empty()) {
        P p = pque.top();
        pque.pop();
        int v = p.second;
        if (d[v] < p.first) continue;
        for (auto &e : g[v]) {
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                pque.push(P(d[e.to], e.to));
            }
        }
    }
    return d;
}

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

    int n, m, s, t;
    cin >> n >> m >> s >> t;
    --s, --t;
    vector<vector<edge>> gs(n), gt(n);
    for (int i = 0; i < m; ++i) {
        int u, v;
        ll a, b;
        cin >> u >> v >> a >> b;
        --u, --v;
        gs[u].emplace_back(v, a);
        gs[v].emplace_back(u, a);
        gt[u].emplace_back(v, b);
        gt[v].emplace_back(u, b);
    }

    auto dist_s = dijkstra(gs, n, s);
    auto dist_t = dijkstra(gt, n, t);

    vector<ll> ans(n);
    ll cost = 0;
    for (int i = n - 1; i >= 0; --i) {
        cost = max(cost, (ll) 1e15 - dist_s[i] - dist_t[i]);
        ans[i] = cost;
    }

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

Measured memory_bytes: 19016
#include <iostream>

using namespace std;

int main(){

	string str;
	int data[10][10];
	while(cin>>str){
		for(int i=0;i<10;i++){
			data[0][i] = str[i]-'0';
		}
		for(int i=1;i<10;i++){
			for(int j=0;j<10-i;j++){
				data[i][j] = (data[i-1][j] + data[i-1][j+1] )%10;
			}
		}
		cout<<data[9][0]<<endl;
	}

	return 0;

}

/*
Sample Input
4823108376
1234567890
0123456789
Output for the Sample Input
5
6
4
*/

Measured memory_bytes: 1180
#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define PB push_back
using namespace std;
typedef pair<int, int> P1;
typedef pair<int, pair<int, int> > P2;
static const int INF = 1ll<<60;
static const int dx[] = { 1, -1, 0, 0, };
static const int dy[] = { 0, 0, 1, -1 };
static const int mod = 1000000007;

int N,M;
int v[3005],h[3005];
int t[3005],s[3005];

    //?????¨       //??????
int imos[3005];
int dp[1005][3005];

P1 min_pair(P1 a,P1 b){
    if(a.first<b.first)return a;
    else if(a.first>b.first)return b;
    else {
        if(a.second<b.second)return a;
        else if(a.second>b.second)return b;
        else return a;
    }
}

void solve(){

    for(int i=0;i<1005;++i)for(int j=0;j<3005;++j)dp[i][j]=-INF;

    dp[0][0]=0;

    for(int i=0;i<M;++i){
        for(int j=0;j<=N;++j){
            int cost;
            if(j)cost=imos[j-1];
            else cost=0;
            if(cost>t[i])continue;
            if(j>0){
                dp[i+1][j]=max(dp[i][j-1]+h[j-1],dp[i+1][j]);
            }
            if(j>1){
                dp[i+1][j]=max(dp[i+1][j-1]+h[j-1]+abs(h[j-2]-h[j-1]),dp[i+1][j]);
            }
        }
        for(int j=0;j<=N;++j)dp[i+1][j]=max(dp[i][j],dp[i+1][j]);
        for(int j=0;j<=N;++j){
            if(dp[i+1][j]<s[i])dp[i+1][j]=-INF;
        }
    }

    for(int i=0;i<=N;++i){
        if(dp[M][i]!=-INF){
            if(!i)cout<<t[M-1]<<endl;
            else cout<<t[M-1]-imos[i-1]<<endl;
            return ;
        }
    }
    cout<<-1<<endl;

}

signed main(){
    cin>>N>>M;
    for(int i=0;i<N;++i)cin>>v[i]>>h[i];
    for(int i=0;i<M;++i)cin>>t[i]>>s[i];
    for(int i=0;i<N;++i){
        if(!i){
            imos[i]=v[i];
        }
        else imos[i]=imos[i-1]+v[i];
    }
    solve();
    return 0;
}



Measured memory_bytes: 26812
#include<stdio.h>

int main(void){
    int N, M;
    int Human[30] = {0};
    int Food[30][30] = {0};
    int i, j, k, l, p;
    int minN = 31;
    int minIdx;
    int right = 0;
    int answer = 0;

    scanf("%d %d", &N, &M);
    for(i = 0; i < N; i++){
        scanf("%d", &Human[i]);
        for(j = 0; j < Human[i]; j++){
            scanf("%d", &Food[i][j]);
        }
        if(minN > Human[i]){
            minN = Human[i];
            minIdx = i;
        }
    }

    for(k = 0; k < minN; k++){
        for(l = 0; l < N; l++){
            for(p = 0; p < Human[l]; p++){
                if(Food[minIdx][k] == Food[l][p]){right++;}
            }
        }
        if(right == N){answer++;}
        right = 0;
    }
    
    printf("%d\n", answer);
    
    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;

#define MAX(a,b) ((a)>(b)?(a):(b))

void run (void) {
  i32 a, b, c;
  scanf ("%" SCNi32 "%" SCNi32 "%" SCNi32, &a, &b, &c);
  printf ("%" PRIi32 "\n", a + b + c - MAX(a, MAX(b, c)));
}

int main (void) {
  run();
  return 0;
}

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

int main() {
  int x, a, b;
  cin >> x >> a >> b;
  if(a >= b) cout << "delicious" << endl;
  else if(b-a <= x) cout << "safe" << endl;
  else cout << "dangerous" << endl;
  return 0;
}


Measured memory_bytes: 3600