akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<typename T> using Graph = vector<vector<T>>;
 
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define EACH(i, a) for (auto i: a)
#define ITR(x, a) for (__typeof(a.begin()) x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define endl '\n'
#define to first
#define cost second
 
int n;
bool used[100005];
vector<pair<int, int>> tr[100005];
 
pair<int, int> dfs1(int s, int d) {
  used[s] = true;
  pair<int, int> res = {s, d};
  for (auto p: tr[s]) {
    if (used[p.to]) continue;
    auto tp = dfs1(p.to, d + p.cost);
    if (tp.cost > res.cost) res = tp;
  }
  return res;
}
 
int dfs2(int s) {
  used[s] = true;
  int res = 0;
  for (auto p: tr[s]) {
    if (used[p.to]) continue;
    res = max(res, dfs2(p.to) + p.cost);
  }
  return res;
}
 
int diameter() {
  auto p = dfs1(0, 0);
  rep(i, n) used[i] = false;
  return dfs2(p.to);
}
 
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
 
  cin >> n;
  rep(i, n - 1) {
    int s, t, w;
    cin >> s >> t >> w;
    tr[s].push_back({t, w});
    tr[t].push_back({s, w});
  }
 
  cout << diameter() << endl;
 
  return 0;
}

Measured memory_bytes: 13264
N,K=list(map(int,input().split()))
l=input()
n=l[0]
cnt=0
ans=[]
for i in l:
   if i != n:
      ans.append(cnt)
      cnt=1
      n=i
   else:
      cnt+=1
ans.append(cnt)
if l[0] == "0":
   sum_n=sum(ans[0:K*2])
   now=1
   end=K*2
   plus=0
else:
   sum_n=sum(ans[0:K*2+1])
   now=0
   end=K*2+1
   plus=1
max_n=sum_n
for i in range(len(ans)-end+plus):
   sum_n-=ans[i]
   if now==0:
      now=1
   else:
      try:
         sum_n=sum_n+ans[end]+ans[end+1]
         end+=2
      except IndexError:
         sum_n+=ans[end]
         max_n=max(sum_n,max_n)
         print(max_n)
         exit()
      now=0
   max_n=max(sum_n,max_n)
print(max_n)

Measured memory_bytes: 4476
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int a,b,c,n,flag=1;
	while(1){
		cin>>a>>b>>c;
		if(a==0 && b==0 && c==0)
		break;
		cin>>n;
		int p=0,w[n],x[n],y[n],z[n],ans[a+b+c+1];
		for(int i=0;i<a+b+c+1;i++)
			ans[i]=2;
		for(int i=0;i<n;i++){
			cin>>w[i]>>x[i]>>y[i]>>z[i];
			if(z[i]==1){
				ans[w[i]]=1;
				ans[x[i]]=1;
				ans[y[i]]=1;
			}
		}
		for(int i=0;i<n;i++){
			if(z[i]==0){
				if(ans[w[i]]==1 && ans[x[i]]==1 && ans[y[i]]==2)
				ans[y[i]]=0;
				if(ans[w[i]]==1 && ans[x[i]]==2 && ans[y[i]]==1)
				ans[x[i]]=0;
				if(ans[w[i]]==2 && ans[x[i]]==1 && ans[y[i]]==1)
				ans[w[i]]=0;
			}
		}
		for(int i=1;i<=a+b+c;i++)
		cout<<ans[i]<<endl;
		}
	return 0;
}

Measured memory_bytes: 1176
def main():
    L, R = map(int, input().split())

    ans = 2018
    for i in range(L, min(R, L + 2018) + 1):
        p = i % 2019
        for j in range(i + 1, min(R, L + 2018) + 1):
            q = j % 2019
            t = p * q % 2019
            if ans > t:
                ans = t
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9196
//## MohK
#include<bits/stdc++.h>
using namespace std;
int main()
{
     int b;
     cin>>b;
     int a[b];
     int max=0;
     int ans=0;
     for(int i=0;i<b;i++)
     {
        cin>>a[i];
        if(a[i]>=max)
        {
            max=a[i];
        }
        ans=ans+a[i];
     }
     int d=ans-max;

     if(d>max)
     {
         cout<<"Yes";
     }
     else
     {
         cout<<"No";
     }




    return 0;
}


Measured memory_bytes: 256
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
import bisect
import copy
import fractions
import itertools
import math
import queue
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))


def f(v, c):
    for next_v, w in graph[v]:
        if seen[next_v] == -1:
            seen[next_v] = (c + w) & 1
            f(next_v, c + w)


n = II()
node = [LI() for _ in range(n - 1)]
graph = [[] for _ in range(n)]
seen = [-1] * n
for u, v, w in node:
    graph[u - 1].append((v - 1, w))
    graph[v - 1].append((u - 1, w))

seen[0] = 0
f(0, 0)
for i in seen:
    print(i)


Measured memory_bytes: 166872
#include <stdio.h>
#include <algorithm>

int N, K, D[11];
char temp[112345];
bool match_flag = false;
int ans;

int GetDigit(int num)
{
	int res = 0;
	while (num != 0)
	{
		num /= 10;
		++res;
	}
	return res;
}

int main(void)
{
	scanf("%d%d", &N, &K);
	for (int i = 0; i < K; ++i) { scanf("%d", &D[i]); }

	for (int i = N; i <= 10 * N; ++i)
	{
		sprintf(temp, "%d", i);
		for (int j = 0; j < GetDigit(i); ++j)
		{
			for (int k = 0; k < K; ++k)
			{
				if ((temp[j] - '0') == D[k])
				{
					match_flag = true;
					break;
				}
			}
			if (match_flag == true)
			{
				break;
			}
		}
		if (match_flag == false)
		{
			ans = i;
			break;
		}
		match_flag = false;
	}

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

Measured memory_bytes: 128
import java.util.Scanner;

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

        int A = sc.nextInt(), B = sc.nextInt(), C = sc.nextInt();
        if (C >= A && C <= B) {
            System.out.println("Yes");
        } else if (C >= B && C <= A) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    long double total = 0;
    for (int i = 0; i < n; ++i) {
        long double x;
        string currency;
        cin >> x >> currency;
        if (currency == "JPY") {
            total += x;
        } else {
            total += x * 380000;
        }
    }
    cout << setprecision(20) << total << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define chmax(a,b) ((a)=(a)>(b)?(a):(b))
#define chmin(a,b) ((a)=(a)<(b)?(a):(b))
#define abs(p) ((p)>=(0)?(p):(-(p)))
#define MOD 1000000007
ll powll(ll a,ll b){ll r=1;rep(i,b){r*=a;}return r;}
#define swap(a,b) do{ll w=(a);(a)=(b);(b)=w;}while(0)
#define swapd(a,b) do{double w=(a);(a)=(b);(b)=w}while(0)
#define in(a) scanf("%lld", &(a))
#define in2(a,b) scanf("%lld %lld",&(a),&(b))
#define in3(a,b,c) scanf("%lld %lld %lld",&(a),&(b),&(c))
#define ind(a) scanf("%lf", &(a))
#define ins(a) scanf("%s", (a))
#define put(a) printf("%lld\n", (a))
#define putd(a) printf("%.15f\n", (a))
//      puts(a) printf("%s\n", a) 文字はこっち
//your code here!
int main(void){
    ll A, B, C, X, ans=0;
    in3(A,B,C); in(X);
    rep(yen500, A+1){
        rep(yen100, B+1){
            rep(yen50, C+1){
                if(500*yen500+100*yen100+50*yen50==X) ans++;
            }
        }
    }
    put(ans);
    return 0;
}


Measured memory_bytes: 128
n,m = [int(i) for i in input().split()]

l = [[int(i) for i in input().split()][1:] for _ in range(m)]

p = [int(i) for i in input().split()]

ans = 0
for i in range(1<<n):
    check = [0 for _ in range(m)]
    for idx,j in enumerate(l):
        ct = 0
        for k in j:
            if (i >> k-1) & 1:
                ct += 1
        
        if ct % 2 == p[idx]:check[idx] = 1
        
    if all(check):
        ans += 1
        
print(ans)
        
       

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P std::pair<int,int>
#define PiP std::pair<int,std::pair<int,int>>
#define all(v) v.begin(),v.end()
#define mkp std::make_pair
#define prique(T) std::priority_queue<T,vector<T>,greater<T>>
using namespace std;
template<class T> inline void chmax(T& a, T b) { a = std::max(a, b); }
template<class T> inline void chmin(T& a, T b) { a = std::min(a, b); }

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
int get_rand(int MIN, int MAX) {
	std::random_device rnd;
	std::mt19937_64 mt64(rnd());
	std::uniform_int_distribution<int>engine(MIN, MAX);
	return engine(mt64);
}
/*--------Library Zone!--------*/


signed main() {
	int a, b; cin >> a >> b;
	cout << max(0ll, a - b * 2) << endl;
}


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

int main() {
  int N;
  cin >> N;
  
  vector<int> vec(N);
  
  for (int i = 0; i < N; i++ ) {
    cin >> vec.at(i);
  }
  
  int y = 0;
  int a = N;
  
  for ( int i = 0; i < N; i++ ) {
    
    if ( vec.at(i) <= a ) {
      a = vec.at(i);
      y++;
      }
  }
  cout << y << endl;
}   

Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//typedef
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//conversion
inline LL toLong(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define PUTS(x) cout << (x) << endl;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    bool yymm=false;
    bool mmyy=false;
    LL x = toLong(s.substr(0,2));
    LL y = toLong(s.substr(2,2));
    if(0<=x && x<=99 && 1<=y && y <= 12)yymm=true;
    if(0<=y && y<=99 && 1<=x && x <= 12)mmyy=true;

    if(yymm){
        if(mmyy){
            PUTS("AMBIGUOUS");
        }else{
            PUTS("YYMM");
        }
    }else if(mmyy){
        PUTS("MMYY");
    }else{
        PUTS("NA");
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;

struct N {
  int cnt, v;
};

bool operator<(const N &l, const N &r) { return l.cnt > r.cnt; }

int main() {
  int n, odd = 0, even = 0;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++)
    cin >> v[i];
  map<int, int> om, em;
  for (int i = 0; i < n; i++) {
    if (i % 2 == 0) {
      em[v[i]]++;
      even++;
    } else {
      om[v[i]]++;
      odd++;
    }
  }
  vector<N> o, e;
  for (auto i = om.begin(); i != om.end(); i++) {
    o.push_back(N{i->second, i->first});
  }

  for (auto i = em.begin(); i != em.end(); i++) {
    e.push_back(N{i->second, i->first});
  }
  sort(o.begin(), o.end());
  sort(e.begin(), e.end());
  if (o.size() == 1 && e.size() == 1) {
    if (o[0].v == e[0].v)
      cout << n / 2 << endl;
    else
      cout << 0 << endl;
    return 0;
  }
  if (o.size() == 1) {
    if (o[0].v != e[0].v)
      cout << even - e[0].cnt << endl;
    else
      cout << even - e[1].cnt << endl;
  } else if (e.size() == 1) {
    if (e[0].v != o[0].v)
      cout << odd - o[0].cnt << endl;
    else
      cout << odd - o[1].cnt << endl;
  } else {
    if (e[0].v != o[0].v) {
      cout << n - e[0].cnt - o[0].cnt << endl;
    } else {
      cout << min(n - e[0].cnt - o[1].cnt, n - e[1].cnt - o[0].cnt) << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 6520
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <complex>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<58;
const double pi=acos(-1);
const double eps=1e-7;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

vd Gauss(vvd A,vd b){
	int n=A.size();
	vvd B=A;
	for(int i=0;i<n;i++) B[i].push_back(b[i]);
	for(int i=0;i<n;i++){
		int I=i;
		for(int j=i;j<n;j++){
			if(fabs(B[j][i])>fabs(B[I][i])) I=j;
		}
		swap(B[i],B[I]);
		if(fabs(B[i][i])<eps) return vd();
		for(int j=i+1;j<=n;j++) B[i][j]/=B[i][i];
		for(int j=0;j<n;j++) if(i!=j){
			for(int k=i+1;k<=n;k++) B[j][k]-=B[j][i]*B[i][k];
		}
	}
	vd x(n);
	for(int i=0;i<n;i++) x[i]=B[i][n];
	return x;
}

int n,s,t;
vi a;
vvi g,d;

inline bool f(int i,int j){
	return i!=j&&g[i][j]!=inf;
}

int main(){
	while(1){
		cin>>n>>s>>t;
		if(!n) break;
		s--;t--;
		a=vi(n);
		g=vvi(n,vi(n));
		for(int i=0;i<n;i++) cin>>a[i];
		for(int i=0;i<n;i++) for(int j=0;j<n;j++){
			int D;
			cin>>D;
			if(i!=j) g[i][j]=(D?D:inf);
		}
		d=g;
		for(int k=0;k<n;k++) for(int i=0;i<n;i++) for(int j=0;j<n;j++) d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
		vvd A(n,vd(n));
		vd b(n);
		for(int i=0;i<n;i++){
			if(i==t) A[i][i]+=1;
			else{
				int cnt=0,sum=0;
				vi G;
				if(a[i]){
					int m=inf-1;
					for(int j=0;j<n;j++) if(f(i,j)) m=min(m,d[j][t]+g[i][j]);
					for(int j=0;j<n;j++) if(f(i,j)&&m==d[j][t]+g[i][j]){
						G.push_back(j);
						cnt++;
						sum+=g[i][j];
					}
				}
				else{
					for(int j=0;j<n;j++) if(f(i,j)){
						G.push_back(j);
						cnt++;
						sum+=g[i][j];
					}
				}
				if(cnt){
					A[i][i]=cnt;
					int S=G.size();
					for(int j=0;j<S;j++) A[i][G[j]]=-1;
					b[i]=sum;
				}
				else{
					A[i][i]=1;
					b[i]=inf;
				}
			}
		}
		vd x=Gauss(A,b);
		if(x[s]+eps>inf/10) cout<<-1<<endl;
		else cout<<syosu(11)<<x[s]<<endl;
	}
}

Measured memory_bytes: 3504
H, W = map(int, input().split())
a = [input() for _ in range(H)]
row = []
col = []
for i in range(H):
    if a[i] != '.' * W:
        row.append(i)
for j in range(W):
    if any(a[i][j] == '#' for i in range(H)):
        col.append(j)
ans = [''.join(a[r][c] for c in col) for r in row]
print(*ans, sep='\n')

Measured memory_bytes: 39024
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long int
#define ld long double
#define ordered_set tree < ll ,  null_type ,  less<ll> ,  rb_tree_tag ,  tree_order_statistics_node_update >
//added two more functions to set
//(1)*(set.find_by_order(k))[kth element in the sorted set] 
//(2)set.order_of_key(k)[count of elements strictly less than k]

typedef vector< int > vi;
typedef vector<long long> lvi;
typedef vector< vector<int> > vvi;
typedef vector< vector<long long> > lvvi;
typedef pair< int,int > ii;
typedef pair< long long,long long > lii;
typedef vector<pair<int,int>> vii;
typedef vector<pair<long long,long long>> lvii;
typedef vector<vector<pair<int,int>>> vvii;
typedef vector<vector<pair<long long,long long>>> lvvii;
typedef vector<bool> vb;

// #ifdef ONLINE_JUDGE 
// #define endl '\n'
// #endif
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)//remember i is an iterator
#define tc(t) int (t); cin>>(t);while((t)--)
#define ff first
#define ss second
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " is " << a << endl;
	err(++it, args...);
}

//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
const long long mod = 1e9 + 7;
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------

long long mos() { return 0LL; }
template<typename T, typename... Args>
T mos(T a, Args... args) { return ((a + mos(args...))%mod + mod)%mod; }

long long mop() { return 1LL; }
template<typename T, typename... Args>
T mop(T a, Args... args) { return (a*mop(args...))%mod; }
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------



signed main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);	
	ll n,x,t;
	cin>>n>>x>>t;
	cout<<t*((n+x-1)/x)<<endl;
	return 0;
}	


// WA
// 1. overflow
// 2. re-initialize global variables for every test case.
// 3. edge cases like n=1

// Run time error
// 1. division by zero.
// 2. array bounds.

// TLE
// 1. uncomment that #define endl '\n' line

Measured memory_bytes: 3608
#import"cstdio"
int n,m;
int d(long a,int f){if(a<=n)m+=f==7,a*=10,d(a+ 3,f|1),d(a+5,f|2),d(a+7,f|4);}
main(){scanf("%d",&n);d(0,0);printf("%d",m);}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <list>

using namespace std;


int main() {

    string str;
    for(int i=0;i<3;i++){
        cin>>str;
        printf("%c",str[i]);
    }

    return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
const int mod = 1e9 + 7;
int n;
int num[27] = {0};
int main()
{
	std::ios::sync_with_stdio(false);
	cin >> n;
	string s;
	cin >> s;
	for(int i = 0; i < s.size(); i ++)
		num[s[i] - 'a'] ++;
	long long ans = 1;
	for(int i = 0; i < 26; i ++)
		(ans *= (num[i] + 1)) %= mod;
	cout << (ans + mod - 1) % mod << endl;
	return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		
		int a = scan.nextInt();
		int b = scan.nextInt();
		
		int c = a * b;
		
		if(c % 2 == 0) {
			System.out.println("Even");
		}else {
			System.out.println("Odd");
		}

	}

}


Measured memory_bytes: 35684
import fractions 
n = int(input())
t = [int(input()) for i in range(n)]
def lcm(a, b):
  return (a * b) // fractions.gcd(a, b)

#入力tについて、最小公倍数を求めればそれが答えとなる
if n == 1:
  print(t[0])
else:
  ans = lcm(t[0], t[1])
  for i in range(2, n):
    ans = lcm(ans, t[i])
  print(ans)



Measured memory_bytes: 5304
h,n=map(int,input().split())
AB=[]
for _ in range(n):
    AB.append(list(map(int,input().split())))
dp=[0]+[float("INF")]*h
for i in range(1,h+1):
    for a,b in AB:
        if i<=a:
            dp[i]=min(dp[i],b)
        else:
            dp[i]=min(dp[i],b+dp[i-a])
print(dp[-1])

Measured memory_bytes: 43116
#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <algorithm>

#define MOD_BIG 1000000007
#define MOD_BIG2 998244353
using std::string;
using std::cin;
using std::cout;
using std::cerr;
using std::endl;
using ll = long long;
using std::vector;

#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

//////////////////////////////////////



//////////////////////////////////////

int main() {
    
    ll S;
    cin >> S;
    
    ll sq = std::ceil(std::sqrt(S));
    ll amr = sq*sq - S;
    ll y2 = 1;
    if (amr == 0) y2 = 0;
    
    printf("%d %d %lld %lld %lld %lld\n",0, 0, y2, sq, sq, amr);
    
    return 0;
}


Measured memory_bytes: 256
h,w=map(int,input().split())
b=["n"*(w+2)]
for i in range(h):b.append("n"+input()+"n")
b.append(b[0])
def num(i,j):
  a=0
  def same(i,j):
    global b
    if b[i][j]=="#":return 1
    return 0
  a+=same(i-1,j-1)
  a+=same(i-1,j)
  a+=same(i-1,j+1)
  a+=same(i,j-1)
  a+=same(i,j+1)
  a+=same(i+1,j-1)
  a+=same(i+1,j)
  a+=same(i+1,j+1)
  return a
for i in range(len(b)):
  if 0<i<h+1:
    for j in range(len(b[i])):
      if b[i][j]==".":b[i]=b[i][:j]+str(num(i,j))+b[i][j+1:]
for i in range(1,h+1):print(b[i][1:w+1])

Measured memory_bytes: 3064
#include"bits/stdc++.h"
using namespace std;
#define ll long long
#define mod 1000000007
#define prec(n) fixed<<setprecision(n)
int N;
int x[10], y[10];
 
double dist(int i, int j) {
    double dx = x[i] - x[j];
    double dy = y[i] - y[j];
    return pow(dx * dx + dy * dy, 0.5);
}
 
void solve() {
    cin >> N;
    for(int i = 1; i <= N; i++) cin >> x[i] >> y[i];

    double dsum = 0.0;
	
	for (int i = 1 ;i<=N; ++i) {
		for (int j = i+1; j<=N;++j) {
			dsum += dist(i, j) * 2 / N;
		}
	}

	cout << prec(10) << dsum << "\n";

    return;
}
 
int main() {
    solve();
    return 0;
}

Measured memory_bytes: 4196
a, b, c, x, y = map(int,input().split())
ans = a * x + b * y
z = 0
while x != 0 or y != 0:
    if x > 0:
        x -= 1
    if y > 0:
        y -= 1 
    z += 2
    ans = min(ans, a * x + b * y + c * z)
print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF ((long long)1e18)
#define MOD ((int)1e9+7)
#define endl "\n"

#define yn(f) ((f)?"Yes":"No")
#define YN(f) ((f)?"YES":"NO")

#define MAX 110000

class union_find
{
	int *par, *nume;
	int _size, _setnum;

public:
	union_find(){
		par = nume = NULL;
	}
	
	union_find(int x){
		par = nume = NULL;
		resize(x);
	}
	
	~union_find(){
		clear();
	}
	
	void clear(){
		_size = _setnum = 0;
		delete par;
		delete nume;
		par = nume = NULL;
	}
	
	void init(){
		_setnum = _size;
		for(int i = 0; i < _size; i++){
			par[i] = i;
			nume[i] = 1;
		}
	}
	
	void resize(int x){
		clear();
		
		_size = x;
		
		par = new int[x];
		nume = new int[x];
		
		init();
	}

	int find(int x){
		return par[x] == x ? x : par[x] = find(par[x]);
	}

	void unite(int x, int y){
		x = find(x);
		y = find(y);
	
		if(x == y)return;
		
		_setnum--;
		
		if(nume[x] > nume[y]) std::swap(x,y);
		
		par[x] = y;
		nume[y] += nume[x];
	}
	
	bool same(int x, int y){
		return find(x) == find(y);
	}
	
	int numel(int x){
		return nume[find(x)];
	}
	
	int size(){
		return _size;
	}
	
	int setnum(){
		return _setnum;
	}
};

int used[MAX];
signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int N, M;
	int x, y, z;
	int ans = 0;
	
	cin>>N>>M;
	
	union_find uf(N+10);
	
	
	for(int i = 0; i < M; i++){
		cin>>x>>y>>z;
		
		uf.unite(x,y);
	}
	
	for(int i = 1; i <= N; i++){
		if(used[uf.find(i)]) continue;
		used[uf.find(i)] = true;
		
		ans++;
	}
	
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 2560
import sys

def resolve():
    input = sys.stdin.readline
    N,Y=map(int,input().split())
    #print(str(x)+str(y)+str(z) for x in range(N+1) for y in range(N+1-x) for z in range(N+1-x-y)
    #if 10000*x+5000*y+1000*z==Y)
    
    if (10000*N<Y):
        print("-1 -1 -1")
        return

    for x in range(N+1): 
        for y in range(N+1-x): 
            if (10000*x+5000*y+1000*(N-x-y)==Y):
                print(str(x)+str(" ")+str(y)+str(" ")+str(N-x-y))
                return
    print("-1 -1 -1")

import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """9 45000"""
        output = """4 0 5"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """20 196000"""
        output = """-1 -1 -1"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """1000 1234000"""
        output = """14 27 959"""
        self.assertIO(input, output)
    def test_入力例_4(self):
        input = """2000 20000000"""
        output = """2000 0 0"""
        self.assertIO(input, output)

if __name__ == "__main__":
    #unittest.main()
    resolve()

Measured memory_bytes: 5800
#include<iostream>
#include <algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<queue>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;

int main() {
  int N;
  cin >> N;
  int X[N];
  rep(i,N) cin >> X[i];

  int mx = 0;
  rep(i,N) mx = max(mx, X[i]);
  ll ans = INF;
  rep1(i,mx+1) {
    ll sum = 0;
    rep(j,N) {
      sum += pow(X[j] - i, 2);
    }
    ans = min(ans, sum);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
number_tako= int(input())
tako_taste= list(map(int,input().split()))
sum_taste=0

for index_first,taste_1 in enumerate(tako_taste):
	for index_second,taste_2 in enumerate(tako_taste):
		if index_first < index_second:
			sum_taste=sum_taste+taste_1*taste_2

print(sum_taste)

Measured memory_bytes: 2940
n,m=map(int,input().split())
a=set([int(input()) for i in range(m)])
dp=[0]*(n+1)
dp[0]=1
for i in range(1,n+1):
    dp[i]=(dp[i-1]+dp[i-2])%(10**9+7)
    if i in a:
        dp[i]=0
print(dp[n])

Measured memory_bytes: 56664
#include<iostream>
#include<string.h>
#include<algorithm>
#include<queue>
#include<stdio.h>
#include<vector>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  int c=a+b;
  puts((c%3==0 || a%3==0 || b%3==0)?"Possible":"Impossible");
  return 0;
}
  

Measured memory_bytes: 256
# -*- coding:utf-8 -*-
N, M = map(int, input().split())
list_a, list_b, ans = ( [], [], [] )
num = [ tmp for tmp in range(1,N+1) ]
for tmp in range(M):
    a, b = map(int, input().split())
    list_a.append(a)
    list_b.append(b)

for tmp in range(len(num)):
    x = list_a.count(num[tmp])
    y = list_b.count(num[tmp])
    ans.append(x+y)

for tmp in range(len(ans)):
    print(ans[tmp])

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

using namespace std;

int main()
{
	string s;
	cin >> s;
	if (s[0] == 'R') {
		if (s[1] == 'R') {
			if (s[2] == 'R') {
				cout << 3 << endl;
			} else {
				cout << 2 << endl;
			}
		} else {
			if (s[2] == 'R') {
				cout << 1 << endl;
			} else {
				cout << 1 << endl;
			}
		}
	} else {
		if (s[1] == 'R') {
			if (s[2] == 'R') {
				cout << 2 << endl;
			} else {
				cout << 1 << endl;
			}
		} else {
			if (s[2] == 'R') {
				cout << 1 << endl;
			} else {
				cout << 0 << endl;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 3620
#include <iostream>
using namespace std;
int min_cost(int h[][3],int n){
    int dp[n][3];
    dp[0][0]=h[0][0];
    dp[0][1]=h[0][1];
    dp[0][2]=h[0][2];
    for(int i=1;i<n;i++){
        for(int j=0;j<3;j++)
        dp[i][j]=h[i][j]+max(dp[i-1][(j+1)%3],dp[i-1][(j+2)%3]);
    }
    return max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    int h[n][3];
    for(int i=0;i<n;i++) cin>>h[i][0]>>h[i][1]>>h[i][2];
    cout<<min_cost(h,n);
	return 0;
}

Measured memory_bytes: 5904
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;


int main() {
int n;
cin >> n;
int ans = 0,cnt=0;
for(int i=1;i*2-1<=n;i++) {
  cnt = 0;
  for(int j=1;j<=i*2-1;j++) {
    if((i*2-1)%j==0) cnt++;
  }
  if(cnt==8) ans++;
} 
cout << ans << endl;
return 0;
}


Measured memory_bytes: 256
#include <stdio.h>          // printf(), scanf()
#include <stdbool.h>

int
main(int argc, char** argv)
{
	while (true)
	{
		int m, n;

		scanf("%d %d", &m, &n);
		if (m == 0 && n == 0)
			break;

		int i;
		for (i = 0; i < m; ++i)
		{
			int j;
			for (j = 0; j < n; ++j)
				printf("#");

			printf("\n");
		}

		printf("\n");
	}

	return 0;
}

Measured memory_bytes: 572
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define vl vaector<long>
#define vll vector<long long int>
#define vC  vector<char>
#define FastIO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__)
ll pow(ll x, ll y,ll m) { ll res = 1;x=x%m; while (y > 0) { if (y & 1) res = ((res%m) * (x%m))%m; y = y >> 1; x = ((x%m) * (x%m))%m; } return res%m; }
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1){std::cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}
const ll INF = 0xFFFFFFFFFFFFFFFL;
clock_t time_p=clock();
void abhigyan10()
{time_p=clock()-time_p;cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";}
ll seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline ll rnd(ll l=0,ll r=INF){return uniform_int_distribution<ll>(l,r)(rng);}
#define clrbuf cin.ignore(numeric_limits<streamsize>::max(),'\n');
#define preciset(x) cout<<setprecision(x)<<fixed;
const ll mod =1000000007;
int main()
{

        FastIO
        string a,b;
        cin>>a>>b;
        if(a.length()>b.length())
        	{cout<<"GREATER";return 0;}
        if(b.length()>a.length())
        {cout<<"LESS";return 0;}
    	if(a.length()==b.length())
    	{
    		if(a>b)
    			{cout<<"GREATER";return 0;}
    		if(b>a)
    		{
    			cout<<"LESS";return 0;
    		}
    		else
    			{cout<<"EQUAL";return 0;}
    	}

    	return 0;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long 
#define all(x) x.begin(),x.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);

signed main() {
	IOS;	
	string s,t;
	
	
	cin>>s;
	rep(i,s.size()){
		if(s.at(i)=='7'){
			t="Yes";
			break;
		}
	}
	if(t=="Yes"){
		cout<<t<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	

}


Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int main(void){
    char s,t; cin>>s>>t;
    int x=s-'A',y=t-'A';
    if(x<y){
        cout<<"<"<<endl;
    }else if(x>y){
        cout<<">"<<endl;
    }else{
        cout<<"="<<endl;
    }
    
}


Measured memory_bytes: 3556
/*
	  Chase
	   Your
	  Legend

	英雄志逐传奇
*/

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <stdio.h>

#define rep(i, n) for(int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;


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

	vector<int>vec(N);
	rep(i, N) {
		cin >> vec[i];
	}

	int sum = 0;
	for(int i=0;i<N;i++){
		while (vec[i] % 2 == 0) {
			vec[i] = vec[i] / 2;
			sum++;
		}
	}
	cout << sum << endl;
}


Measured memory_bytes: 256
A2Z="abcdefghijklmnopqrstuvwxyz"

def affine(msg, a, b):
    s=""
    for c in msg: s+=(A2Z[(A2Z.index(c)*a+b)%26] if "a"<=c<="z" else c)
    return s

def checkkey(s):
    for i in range(26):
        a = 0
        x = affine(s,i,0)
        c = A2Z.index(x[0])
        if c!=19:
            a = (19-c)%26
            x = affine(x,1,a)
        if x in['this','that']: return i,a
    return -1,-1

n = input()
while n:
    n-=1
    s = raw_input()
    for w in s.split():
        if len(w)==4:
            a,b = checkkey(w)
            if a!=-1: break
    print affine(s,a,b)

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

using namespace std;

int main ()
{
  string k;
  cin >> k;
  for (int i = 0; i < k.length(); i++)
  {
    if (k[i] == '7')
    {
      cout << "Yes";
      return 0;
    }
  }
  
  cout << "No";
  return 0;
}

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

using namespace std;

#define rep(i, a, b)  for(int i = (a); i < (b); i++)
#define rrep(i, a, b) for(int i = (a); i > (b); i--)
#define sq(x) ((x) * (x))
#define bit(x) bitset<8>(x)
#define vsort(v)  sort(v.begin(), v.end())
#define rvsort(v) sort(v.begin(), v.end(), greater<int>())
#define debug(x) cout << #x << " " << (x) << endl
#define ci cin
#define co cout
#define en endl
#define ln cout<< '\n'
#define pb push_back
#define fi first
#define se second
#define MOD 1e9+7

typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<llint, llint> pll;
typedef vector<int> vi;
typedef vector<llint> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;



int main()
{
    string s;
    ci >> s;

    int ans = 0;
    string str = "";
    str += s[0];
    
    for(int i = 1; i < s.size(); i++) {
	string tmp = "";
	tmp += s[i];
	
	if(str == tmp) {
	    if(i + 1 == s.size()) break;
	    str = (tmp + s[i + 1]);
	    i++;
	} else {
	    str = tmp;
	}
	ans++;
    }

    co << ans + 1 << en;
    
    return 0;
}


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

const int N = 100005;

using ll = long long;
int n;
ll a[N], s, e;

int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];
	reverse(a, a + n);
	s = e = 2;
	for(int i = 0; i < n; i++){
		ll ts = (s + a[i] - 1) / a[i] * a[i];
		ll te = e / a[i] * a[i];
		if(ts > te){ cout << "-1\n"; return 0; }
		s = ts;
		e = te + a[i] - 1;
	}
	cout << s << ' ' << e << endl;
}


Measured memory_bytes: 1024
s = int(input())

a = s
l = set()
l.add(int(a))
cnt = 1
for i in range(1, 1000000):
  if a%2 == 0:
    a = a//2
  else:
    a = 3*a + 1
  cnt += 1
  if a in l:
    break
  l.add(int(a))
  i += 1

print(int(cnt))


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

using namespace std;
#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

int main(){
  int n, q;
  cin >> n >> q;
  vector< queue<int> > v(n);
  rep_i(i, n){
    queue<int> a;
    v.push_back(a);
  }

  int tmp, tmp2, tmp3;
  rep_i(i, q){
    cin >> tmp;
    switch (tmp)
    {
    case 0:
      cin >> tmp2 >> tmp3;
      v[tmp2].push(tmp3);
      break;
    case 1:
      cin >> tmp2;
      if(v[tmp2].empty()){
        break;
      }
      say(v[tmp2].front());
      break;
    case 2:
      cin >> tmp2;
      if(v[tmp2].empty()){
        break;
      }
      v[tmp2].pop();
      break;
    default:
      break;
    }
  }
}


Measured memory_bytes: 4932
#!/usr/bin/env python3
N, K = map(int, input().split())
a = [i for i in range(1, N + 1)]
ans = 0
for b in range(1, N + 1):
    if K >= b:
        continue
    else:
        if K != 0:
            ans += (N // b) * (b - K) + max((N % b) - K + 1, 0)
        else:
            ans += N
print(ans)

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

int main() {
  int H_1, M_1, H_2, M_2, K;
  cin >> H_1 >> M_1 >> H_2 >> M_2 >> K;
  int a = (60 * H_1) + M_1;
  int b = (60 * H_2) + M_2;
  
  if(b - a >= K){
    cout << b - a - K << endl;
  }
  else if(b - a < K){
    cout << 0 << endl;
  }
}


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

ll a,b;

int main(){
    cin>>a>>b;
    if(b>=a) cout<<a<<"\n";
    else cout<<a-1<<"\n";
    return 0;
}

Measured memory_bytes: 3636
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

H, W, A, B = list(map(int, sys.stdin.buffer.readline().split()))

ans = np.zeros((H, W), dtype='U1')
ans[:B, :A] = '1'
ans[:B, A:] = '0'
ans[B:, A:] = '1'
ans[B:, :A] = '0'
print('\n'.join(map(lambda r: ''.join(r), ans)))


Measured memory_bytes: 20608
import java.util.Scanner;

/**
 * https://abc049.contest.atcoder.jp/tasks/arc065_a
 */
public class Main {
	
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		sc.close();
		
		String ans = "YES";
		int i=0;
		while(i<s.length){
			if(s[i]=='e'){
				if(!((++i)<s.length && s[i]=='r')){ ans = "NO"; break; }
				if(!((++i)<s.length && s[i]=='a')){ ans = "NO"; break; }
				if(!((++i)<s.length && s[i]=='s')){ ans = "NO"; break; }
				if(!((++i)<s.length && s[i]=='e')){ ans = "NO"; break; }
				if((++i)<s.length && s[i]=='r') i++;
			}else if(s[i]=='d'){
				if(!((++i)<s.length && s[i]=='r')){ ans = "NO"; break; }
				if(!((++i)<s.length && s[i]=='e')){ ans = "NO"; break; }
				if(!((++i)<s.length && s[i]=='a')){ ans = "NO"; break; }
				if(!((++i)<s.length && s[i]=='m')){ ans = "NO"; break; }
				if((++i)<s.length &&s[i] =='e'){
					if(!((i+1)<s.length && s[i+1]=='r')) { ans = "NO"; break; }
					if((i+2)>=s.length || s[i+2]!='a'){
						i = i+2;
					}
				}
			}else{
				ans ="NO";
				break;
			}
		}
		System.out.println(ans);

	}

}


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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int32 di[4] = {0,1,0,-1};
int32 dj[4] = {1,0,-1,0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 h,w;
    cin >> h >> w;
    vector<string> s(h);
    REP(i,h)cin >> s[i];
    vector<vector<int32>> dist;
    int32 ans = 0;
    REP(si,h)REP(sj,w){
        if(s[si][sj] == '#')continue;
        queue<pii> que;
        que.emplace(si,sj);
        dist = vector<vector<int32>>(h, vector<int32>(w,INF));
        dist[si][sj] = 0;
        while(!que.empty()){
            int32 ci,cj;
            tie(ci,cj) = que.front();que.pop();
            REP(i,4){
                int32 ni = ci + di[i];
                int32 nj = cj + dj[i];
                if(ni < 0 || h <= ni)continue;
                if(nj < 0 || w <= nj)continue;
                if(s[ni][nj] == '#')continue;
                if(dist[ni][nj] > dist[ci][cj] + 1){
                    dist[ni][nj] =  dist[ci][cj] + 1;
                    que.emplace(ni,nj);
                }
            }
            
        }
        REP(i,h)REP(j,w){
            if(dist[i][j] != INF && dist[i][j] > ans){
                ans = dist[i][j];
            }
        }
    }
    ANS(ans);
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
using namespace std;
/****************************/
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define qi queue<int>
#define mii map<int,int>
#define msi map<string,int>
#define vs vector<string>
#define vc vector<char>
/****************************/
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define rep3(i,a,n) for(ll i=(a);i<(n);i++)
#define rep4(i,a,n) for(ll i=(n)-1;i>=a;i--)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define pi 3.1415926535897932384626433832795
#define zero(n) memset(n,0,sizeof(n));
#define SZ(n) n.size()
#define mod 1000000007
#define INF 1000000000000000000
int dx[4]={0,-1,0,1};
int dy[4]={1,0,-1,0};
/********************************************************************************/
int n,m,k;
int a,b,c,d;
int a2[100010];
string s;
vs v;
set<string> s2;
map<ll,ll> m_p;
int main()
{
	cin>>s;
	ll now=0;
	ll ans=0;
	ll cnt=1;
	m_p[0]=1;
	rep2(i,SZ(s))
	{
		now+=(s[i]-'0')*cnt;
		now%=2019;
		ans+=m_p[now];
		m_p[now]++;
		cnt*=10;
		cnt%=2019;
		//cout<<now<<" "<<m_p[now]<<" "<<ans<<endl;
	}
	cout<<ans;
    return 0;
}

Measured memory_bytes: 3736
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;

template <class T>
using gp_queue=priority_queue<T, deque<T>, less<T>>;

using Weight=int;
using DArray=vector<Weight>;
using DMatrix=vector<DArray>;

static const Weight INF=1<<29;

struct Edge {
    size_t src, dst;
    Weight weight;
    Edge() {}
    Edge(size_t src, size_t dst, Weight weight=1):
        src(src), dst(dst), weight(weight)
    {}
};

bool operator<(const Edge &e, const Edge &f) {
    if (e.weight != f.weight) {
        return e.weight > f.weight;
    } else {
        return e.src!=f.src? e.src<f.src : e.dst<f.dst;
    }
}

using Edges=vector<Edge>;
using Vertex=vector<Edge>;
using Graph=vector<Vertex>;

void join(Graph &g, size_t s, size_t d, Weight w=1) {
    // non-directed
    g[s].push_back(Edge(s, d, w));
    g[d].push_back(Edge(d, s, w));
}

void connect(Graph &g, size_t s, size_t d, Weight w=1) {
    // directed
    g[s].push_back(Edge(s, d, w));
}

pair<Weight, Edges> minimum_spanning_tree(const Graph &g, size_t s=0) {
    /* Prim */
    size_t V=g.size();
    Edges T;
    Weight total=0;

    vector<bool> visited(V);
    gp_queue<Edge> q; q.push(Edge(-1, s, 0));
    while (!q.empty()) {
        Edge e=q.top(); q.pop();
        if (visited[e.dst]) continue;

        T.push_back(e);
        total += e.weight;
        visited[e.dst] = true;
        for (const Edge &f: g[e.dst])
            if (!visited[f.dst])
                q.push(f);
    }

    return make_pair(total, T);
}

int main() {
    size_t n;
    scanf("%zu", &n);

    Graph g(n);
    for (size_t i=0; i<n; ++i)
        for (size_t j=0; j<n; ++j) {
            Weight a;
            scanf("%d", &a);

            if (a > -1)
                connect(g, i, j, a);
        }

    printf("%d\n", minimum_spanning_tree(g).first);
    return 0;
}

Measured memory_bytes: 2856
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

ll fc(ll n){
  ll x = n/4*4;
  ll res = 0;
  for(ll i = x; i <= n; i++){
    res ^= i;
  }
  return res;
}

int main(){
  ll a, b;
  cin >> a >> b;
  ll ans = fc(b);
  if(a > 0) ans ^= fc(a-1);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3640