akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h> 

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

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

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll A, B;
    cin >> A >> B;

    cout << (A-1)*(B-1) << endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll;
typedef vector<int> vi; typedef vector<ll> vll; template<class T>using vv = vector<vector<T>>;
template<class T>vv<T> vvec(size_t n, size_t m, T v) { return vv<T>(n, vector<T>(m, v)); }
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; }
constexpr int INF = 1 << 28, MOD = 1e9 + 7; constexpr ll LINF = 1ll << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;
ll mpow(ll x, int n) { ll y = 1; for (; n > 0; n /= 2) { y = n % 2 ? y * x % MOD : y; x = x * x % MOD; } return y; }

int N;
vv<int> tree;
vi C;
int i_C;
vector<bool> visited;
vi ans;

int dfs(int v) {
    visited[v] = true;
    ans[v] = C[i_C];
    i_C++;

    for (int next : tree[v]) {
        if (!visited[next]) {
            dfs(next);
        }
    }
}

int main() {
    cin >> N;
    tree.resize(N);
    rep(i, N - 1) {
        int _a, _b;
        cin >> _a >> _b;
        _a--; _b--;
        tree[_a].push_back(_b);
        tree[_b].push_back(_a);
    }
    C.resize(N);
    rep(i, N) cin >> C[i];
    sort(all(C));
    reverse(all(C));
    
    i_C = 0;
    visited.resize(N, false);
    ans.resize(N);
    dfs(0);

    int sum = accumulate(all(C), 0);
    write(sum - C[0]);
    rep(i, N - 1) {
        cout << ans[i] << " ";
    }
    cout << ans[N - 1] << endl;
}

Measured memory_bytes: 1280
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <vector>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;

// 入出力
void print() { std::cout << '\n'; }
template <class T>void print(const T &x) {std::cout << x <<'\n';}
template <class T, class... Args>void print(const T &x, const Args &... args) {std::cout << x << " ";print(args...);}

const string YES = "Yes";
const string NO = "No";

void solve(long long A, long long B, long long C){
    if (C >= A && C <= B) print(YES);
    else print(NO);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    solve(A, B, C);
    return 0;
}


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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 29)
#define MOD 1000000007
//int dx[4] = {1,0,0,-1};
//int dy[4] = {0,1,-1,0};


int main(){
  
  ll res = 0;
  int a,b,c;
  cin >> a >> b >> c;
  if(a % 2 == b % 2 && a % 2 != c % 2)a++,b++,res++;
  if(a % 2 == c % 2 && a % 2 != b % 2)a++,c++,res++;
  if(c % 2 == b % 2 && b % 2 != a % 2)c++,b++,res++;
  if(a > b)swap(a,b);
  if(a > c)swap(a,c);
  if(b > c)swap(b,c);
  res += (c - b)/2;
  res += (c - a)/2;
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"unicode"
)

func main() {
	var N, K int
	var S string
	fmt.Scan(&N, &K)
	fmt.Scan(&S)
	fmt.Printf("%v%v%v\n", S[:K-1], string(unicode.ToLower(rune(S[K-1]))), S[K:])
}


Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<complex>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
#include <numeric>
using namespace std;
using Complex = complex<double>;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
const double EPS = 1e-10;
double PI = acos(-1.0);
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)


//ntt
ll mod = 998244353;
ll root = 3;
ll wlist[30];

ll modpow(ll a, ll n) {
	ll res = 1;
	a %= mod;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

vector<ll>dft(vector<ll>A,int N){
	//bit reverse
	int h = 0;
	for (int i = 0; (1 << i) < N; i++)h++;
	for (int i = 0; i < N; i++) {
		int j = 0;
		for (int k = 0; k < h; k++) j |= (i >> k & 1) << (h - 1 - k);
		if (i < j) swap(A[i], A[j]);
	}
	//

	//butterfly 
	int cnt = 1;
	for (int b = 1; b < N; b *= 2) {
		ll w = wlist[cnt];
		ll cur = 1;
		for (int j = 0; j < b; j++) {
			for (int k = 0; k < N; k += 2 * b) {
				ll s = A[j+k];
				ll t = A[j+k+b] * cur;
				A[j + k] = s + t;
				A[j+k+b] = s - t;
			}
			cur = (w * cur)%mod;
		}
		for (int i = 0; i < N; i++) {
			A[i] %= mod;
			if (A[i] < 0)A[i] += mod;
		}
		cnt++;
	}
	//

	return A;
}
vector<ll>inv_dft(vector<ll>A,int N) {
	vector<ll>arranged = dft(A, N);
	vector<ll>swapped(N);
	for (int i = 0; i < N; i++)swapped[i] = arranged[(N - i) % N];
	vector<ll>ret(N);
	ll rev = modpow(N,mod-2);
	for (int i = 0; i < N; i++)ret[i] = (rev*swapped[i]) % mod;
	return ret;
}

vector<ll>ntt(vector<ll>A,vector<ll>B){
	//calculate Nth root
	ll P = mod;
	P--;
	int N = 1;
	int cnt = 0;
	while (P % 2 == 0) {
		N *= 2;
		cnt++;
		P /= 2;
		if (A.size() + B.size() <= N)break;
	}
	ll Nroot = modpow(root,P);
	//

	//make list of root
	ll cur = Nroot;
	for (int i = cnt; i >= 0; i--) {
		wlist[i] = cur;
		cur = (cur*cur) % mod;
	}
	//

	A.resize(N);
	B.resize(N);

	A = dft(A,N);
	B = dft(B,N);

	vector<ll>F(N);
	for (int i = 0; i < N; i++) {
		F[i] = (A[i] * B[i]) % mod;
	}
	return inv_dft(F,N);
}
//nttここまで

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

	int N, M;
	cin >> N >> M;
	vector<ll>A(N), B(M);
	for (int i = 0; i < N; i++)cin >> A[i];
	for (int i = 0; i < M; i++)cin >> B[i];

	vector<ll>ans = ntt(A, B);
	for (int i = 0; i < N + M - 1; i++)cout << ans[i] << " ";
	puts("");


	return 0;
}

Measured memory_bytes: 68876
fn main() {
    let s = read_line();
    let a: i64 = s.parse().expect("error");
    println!("{}", a + a * a + a * a * a);
}
fn read_line() -> String {
    let s = {
        let mut s = String::new(); // バッファを確保
        std::io::stdin().read_line(&mut s).unwrap(); // 一行読む。失敗を無視
        s.trim_right().to_owned() // 改行コードが末尾にくっついてくるので削る
    };
    s
}


Measured memory_bytes: 2124
/*input
4 1
5 4 2 1
*/
/*

**************************
*						 *
* AUTHOR :: knight_coder *
*						 *
**************************

*/
#include<bits/stdc++.h>
#define lld          long long int
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<lld,lld>
#define msi         map<string,lld>
#define mis         map<lld, string>
#define mpi         map<pair<lld ,lld >,lld >
#define pii         pair<lld,lld>
#define vi          vector<lld>
#define vpi 		vector<pii>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (lld)x.size()
#define hell        1000000007
#define rrep(i,m,n)	for(lld i=m;i>=n;i--)
#define rep(i,m,n)	for(lld i=m;i<n;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
#define pr(x) 		cout<< x << " ";
#define pre(x)		cout<< x << endl ;
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>; 
//change null_type to get ordered_map
#define N  100005
#define DEC(N)	cout << std::fixed; cout << setprecision(N);
void solve()
{
	lld n,m;
	cin >> n >> m;
	vi v;
	v.resize(n);
	lld tot=0;
	for(auto &i:v){
		cin >> i;
		tot+=i;
	}
	sort(all(v));
	if(v[n-m]>=((tot+4*m-1)/(4*m))){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
}
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int tests=1;
	//cin>>tests;
	while(tests--)
	{
		solve();
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<utility>//swapでaとbの値を入れ替える
#define rep(i,n) for(int i=0;i<(n);i++)
#define ll long long
#define sort(s) sort(s.begin(),s.end())
#define r(s) reverse(s.begin(),s.end())
using namespace std;
int abc(int a,int b) {
	int x = 0;
	for (int i = b; i <= a; i++) {
		for (int j = b; j <= a; j++) {
			if (j % i >= b)x++;
		}

	}
	return x;
}

int main() {
	int a;
	cin >> a;
	cout << a / 3 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
typedef long long unsigned int LU;
#define incID(i, l, r) for(LL i = (l)    ; i <  (r); ++i)
#define incII(i, l, r) for(LL i = (l)    ; i <= (r); ++i)
#define decID(i, l, r) for(LL i = (r) - 1; i >= (l); --i)
#define decII(i, l, r) for(LL i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
template<typename T> bool setmin  (T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmax  (T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
LL mo(LL a, LL b) { assert(b > 0); a %= b; if(a < 0) { a += b; } return a; }
LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); }
LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC static_cast
#define SI(v) SC<int>(v.size())
#define SL(v) SC<LL >(v.size())
#define RF(e, v) for(auto & e: v)
#define ef else if
#define UR assert(false)

// ---- ----

int main() {
	int k, x, y;
	cin >> k >> x >> y;
	
	bool X = (x < 0);
	bool Y = (y < 0);
	if(X) { x *= -1; }
	if(Y) { y *= -1; }
	
	if(k % 2 == 0 && (x + y) % 2 != 0) { cout << -1 << endl; return 0; }
	
	vector<pair<int, int>> ans;
	while(true) {
		assert(x >= 0 && y >= 0);
		ans.EB(x, y);
		
		int d = x + y;
		if(d == k) { break; }
		if(d <= 2 * k && d % 2 == 0) {
			int m = (x + y) / 2;
			if(x >= y) {
				ans.EB(m, m - k);
			} else {
				ans.EB(m - k, m);
			}
			break;
		}
		
		if(d > k) {
			y -= k;
			if(y < 0) { x += y; y = 0; }
		} else {
			x += k;
		}
	}
	
	if(X) { RF(e, ans) { e.FI *= -1; } }
	if(Y) { RF(e, ans) { e.SE *= -1; } }
	
	reverse(ALL(ans));
	cout << SI(ans) << endl;
	RF(e, ans) { cout << e.FI << " " << e.SE << "\n"; }
	
	return 0;
}


Measured memory_bytes: 3952
def dfs(target, graph, visited):
    stack = []
    stack.append(target)
    visited[target] = True
    ans = 0
    while len(stack) > 0: 
        root = stack.pop()
        ans += 1
        for dst in graph[root]:
            if visited[dst] is False:
                visited[dst] = True
                stack.append(dst)
                pass 
    return ans 

n, m = map(int, input().split())
graph = {i:set() for i in range(n)}
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    graph[a].add(b)
    graph[b].add(a)
visited = [False]*n
ans = 1
for target in graph:
    if visited[target] is False:
        score = dfs(target, graph, visited)
        ans = max(ans, score)

print(ans)

Measured memory_bytes: 87772
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    long MOD = 998244353L;
    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] ds = new int[n];
        int first = sc.nextInt();
        ds[first]++;
        for (int i = 1; i < n; i++) {
            ds[sc.nextInt()]++;
        }

            if (ds[0] != 1 || first != 0) {
            System.out.println(0);
            return;
        }
        long cnt = 1;

        for (int i = 1; i < n; i++) {
            cnt = (cnt * pow(ds[i - 1], ds[i])) % MOD;
            if (cnt < 0) cnt += MOD;
        }
        System.out.println(cnt);
    }

    long pow(long a, long p) {
        long x = 1;
        while (p > 0) {
            if ((p & 1) == 1) x = x * a % MOD;
            a = a * a % MOD;
            if (x < 0) x += MOD;
            if (a < 0) a += MOD;
            p >>= 1;
        }
        return x;
    }

    void debug(Object...os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }

}


Measured memory_bytes: 50684
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define RREP(i,a,n) for(int i=(a),i##_len=(n);i<i##_len;++i)

int N;
int S[101];

int main() {
  cin >> N;
  REP(i,N) {
    cin >> S[i+1];
    S[i+1] += S[i];
  }
  int ans = INT_MAX;
  RREP(i,1,N) {
    int diff = abs(S[N] - S[i]*2);
    if (diff < ans) ans = diff;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
# N, W = 3, 8
# ARR = [
#     [3, 30],
#     [4, 50],
#     [5, 60],
# ]
#
N, W, = 6, 15
ARR = [
    [6, 5],
    [5, 6],
    [6, 4],
    [6, 6],
    [3, 5],
    [7, 2],
]


N,W = map(int,input().split())
ARR = []

for i in range(N):
    ARR.append(list(map(int,input().split())))


def calculate(n, w, arr):
    srr = [[0] * (w + 1) for i in range (n + 1)]

    for i in range(1, n + 1):
        for j in range(1, w + 1):
            if (j - arr[i-1][0]) >= 0:
                s1 = srr[i-1][j - arr[i-1][0]] + arr[i-1][1]
                s2 = srr[i-1][j]
                srr[i][j] = max(s1, s2)
            else:
                srr[i][j] = srr[i - 1][j]

    print(srr[-1][-1])


calculate(N, W, ARR)


Measured memory_bytes: 119792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll k, a[55];
int main()
{
    scanf("%lld", &k);
    printf("50\n");
    ll ceng = k / 50, md = k % 50;
    ll tmp = 49 + ceng, qita;
    qita = tmp - md;
    ll add = md / 10, yu = md % 10;
    for (int i = 0; i < add; i++) {
        a[i] = 500;
    }
    a[add] = yu * 50;
    for (int i = 0; i < add; i++) {
        a[i] += qita + 10;
    }
    a[add] += qita + yu;
    for (int i = add + 1; i < 50; i++) {
        a[i] += qita;
    }
    for (int i = 0; i < 50; i++) {
        printf("%lld%c", a[i], i == 49 ? '\n' : ' ');
    }
    return 0;
}


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

int main()
{
    string b;
    cin>>b;
    bool a[26];
    memset(a,0,sizeof(a));
    int k=b.length();
    for(int i=0; i<k; i++)
    {
        a[b[i]-'a']=1;
    }
    int s=0;
    while(a[s]==1)
        s++;
    if(s<=k&&s!=26)
    {
        char t=s+'a';
        cout<<b<<t<<endl;
    }
    else
    {
        int p=k-1;
        for(; p>=0; p--)
        {
            a[b[p]-'a']=0;
            b[p]++;
            while(a[b[p]-'a']==1)
            {
                b[p]++;
                if(b[p]>'z')
                    break;
            }
            if(b[p]<='z')
                break;
        }
        if(p==-1)
            printf("-1\n");
        else
        {
            for(int i=0; i<k; i++)
                if(b[i]<='z')
                    printf("%c",b[i]);
                else break;
            printf("\n");
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
#define pb push_back
#define mp make_pair
#define int long long
#define mod 1000000007
#define DEBUG cout<<"Hello1\n";
#define all(v) (v).begin(),(v).end()
#define clr(x) memset(x,0,sizeof(x))
#define deb(...) debug(#__VA_ARGS__, __VA_ARGS__);
const int N = 1e6 + 5;
const double pi =  acosl(-1);
const long long inf = 1e18 + 5;
using namespace std;
template<typename T> void debug(string s, T x) {cout << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cout << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}
template<class T> void print_container(T &container) { for (auto &t : container) { cout << t << " ";} cout << endl;}
template<class T> void printArr(T &a , int n) { for (int i = 0; i < n; i++) {cout << a[i] << " ";} cout << endl;}
typedef long long ll;
typedef pair<int, int> pii;

//Template Ends
int n;

void solve() {
	cin >> n;

	if (n >= 400 && n <= 599) {
		cout << 8 << endl;
	}
	if (n >= 600 && n <= 799) {
		cout << 7 << endl;
	}
	if (n >= 800 && n <= 999) {
		cout << 6 << endl;
	}
	if (n >= 1000 && n <= 1199) {
		cout << 5 << endl;
	}
	if (n >= 1200 && n <= 1399) {
		cout << 4 << endl;
	}
	if (n >= 1400 && n <= 1599) {
		cout << 3 << endl;
	}
	if (n >= 1600 && n <= 1799) {
		cout << 2 << endl;
	}
	if (n >= 1800 && n <= 1999) {
		cout << 1 << endl;
	}
}

int32_t main() {
	IOS;
// #ifndef ONLINE_JUDGE
// 	freopen("../../input.txt", "r", stdin);
// 	freopen("../../output.txt", "w", stdout);
// #endif


	solve();

	return 0;
}




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

int maxSelf(int a, int b) {
	return a > b ? a : b;
}
int minSelf(int a, int b) {
	return a < b ? a : b;
}

int main(void) {
	int a, b, c;
	cin >> a >> b >> c;
	cout << minSelf(a, minSelf(b, c)) << " " << maxSelf(a, maxSelf(b, c)) << endl;
}


Measured memory_bytes: 3116
#include<stdio.h>

int main(){
	int N;
	int v[50];
	int i,j;
	float sum;
	scanf("%d",&N);
	for(i=0;i < N;i++){
		scanf("%d",&v[i]);
	}
	for(i = 0;i<N;i++){
		for(int j=i+1;j<N;j++){
			if(v[i]>v[j]){
				int tmp = v[i];
				v[i] = v[j];
				v[j] = tmp;
			}
		}
	}
	sum = (float)v[0];
	for(i=1;i<N;i++){
		sum = (sum + v[i])/2.0;
	}
	printf("%f\n",sum);
	return 0;
}

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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;

  int sum = 0;

  if (a <= b) {
    sum += a;
  } else {
    sum += b;
  }
  if (c <= d) {
    sum += c;
  } else {
    sum += d;
  }

  cout << sum << endl;
}


Measured memory_bytes: 3548
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <random>

#define _overload(a, b, c, d, ...) d
#define _rep1(X, A, Y) for (int (X) = (A);(X) <= (Y);++(X))
#define _rep2(X, Y) for (int (X) = 0;(X) < (Y);++(X))
#define rep(...) _overload(__VA_ARGS__, _rep1, _rep2)(__VA_ARGS__)
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define all(X) (X).begin(),(X).end()
#define len(X) ((int)(X).size())
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MAX_N = 50;
int N;
ll x[MAX_N], y[MAX_N];

bool used[MAX_N];

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

  cin >> N;
  rep(i, N) cin >> x[i] >> y[i];

  set<Pll> st;
  for (int i = 0; i < N; ++i) {
    for (int j = i+1; j < N; ++j) {
      st.insert(Pll(x[i]-x[j], y[i]-y[j]));
      st.insert(Pll(x[j]-x[i], y[j]-y[i]));
    }
  }

  ll ans = 0;
  for (Pll pll : st) {
    ll p = pll.fi, q = pll.sc;
    memset(used, false, sizeof(used));
    ll tmp = 0;
    for (int i = 0; i < N; ++i) {
      if (used[i]) continue;
      for (int j = 0; j < N; ++j) {
        if (i == j) continue;
        if (x[j]-x[i] == p && y[j]-y[i] == q)  {
          ++tmp; used[i] = true;
          break;
        }
      }
    }
    ans = max(ans, tmp);
  }

  ans = N - ans;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <utility>
#include <stdint.h>
#include <string>

using namespace std;

int main()
{
  string S;
  cin >> S;

  uint16_t maxCount = 0;
  uint16_t count = 0;
  for (char c : S) {
    if (c=='A'||c=='C'||c=='T'||c=='G')
      ++count;
    else
      count = 0;
    maxCount = max(count,maxCount);
  }

  cout << maxCount << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#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>
#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<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<57;
const double pi=acos(-1);
const double eps=1e-6;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,-0};
const int DX[8]={-1,-1,-1,0,1,1,1,0},DY[8]={1,0,-1,-1,-1,0,1,1};

int k;
vi a;

class Graph{
	private:
	int V;
	vvi List;
	int res=0;
	int dfs(int v){
		int l=0;
		for(int i=0;i<List[v].size();i++) l=max(l,dfs(List[v][i])+1);
		if(!v) return 0;
		if(l==k-1&&a[v]!=0){
			res++;
			l=-1;
		}
		return l;
	}
	public:
	Graph(int v){
		V=v;
		List=vvi(v);
	}
	void add_edge(int s,int t){
		List[s].push_back(t);
	}
	int solve(){
		dfs(0);
		return res+(a[0]!=0);
	}
};

int n;

int main(){
	cin>>n>>k;
	a=vi(n);
	Graph g(n);
	int tmp=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		a[i]--;
		if(i) g.add_edge(a[i],i);
	}
	cout<<g.solve()<<endl;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
#define ll long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define deb(x) cout<<#x<<"="<<x<<endl;
#define endl '\n'
#define M 1000000007
#define int long long
#define max_n 1000000

using namespace std;

void solve()
{
	ll n;
	cin>>n;
	ll ans=1LL;
	ll a[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
	}
	sort(a,a+n);
	for (int i = 0; i < n; ++i)
	{
		double thre=((double)1e18)/ans;
		if((double)a[i]>thre){cout<<-1<<endl;return;}
		else ans=ans*a[i];
	}
	if(ans>(ll)1e18 || ans<0)cout<<-1<<endl;
	else 
	cout<<ans<<endl;
}

int32_t main() 
{
	IOS	
	ll T=1;
	// cin>>T;
	for(ll i=1;i<=T;++i)
	{		
		// cout<<"Case #"<<i<<": ";
    	solve();
	}
	return 0;
}


Measured memory_bytes: 4440
/* *****fireice**** */

#include<bits/stdc++.h>

#define ll long long int
#define vi vector<int>
#define vc vector<char>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define vll vector<pair<ll,ll>>
#define pii pair<int,int>
#define pb push_back
#define el '\n'
#define N 1000000007
#define re return
#define INF INT_MAX
#define F first
#define S second
#define L length
#define mp make_pair
#define PI 3.14159265
#define all(a) (a).begin(),(a).end()
#define forup(i,n) for(int i=0;i<n;i++)
#define forf(i,x,n) for(int i=x;i<n;i++)
#define ford(i,n) for(int (i)=(n)-1;i>=0;(i)--)
#define take(a,n) forup(i,n) cin>>a[i];
using namespace std;

int gcdExtended(int a, int b, int *x, int *y)
{
    // Base Case
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    int x1, y1; // To store results of recursive call
    int gcd = gcdExtended(b%a, a, &x1, &y1);

    // Update x and y using results of recursive
    // call
    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

ll modInverse(int a, int m)
{
    int x, y;
    int g = gcdExtended(a, m, &x, &y);
        // m is added to handle negative x
    ll res = ((ll)x%m + (ll)m) % m;

    return res;
}

ll poww(ll x,ll n)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return poww(x*x,n/2);
    else                             //n is odd
        return x*poww(x*x,(n-1)/2);
}

ll modularExponentiation(ll x,ll n,ll M)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}

inline ll max(ll a, ll b)
{
  if(a>b) re a;
  else re b;
}

inline ll min(ll a, ll b)
{
  if(a>b) re b;
  else re a;
}

int gcd(int a, int b)
{
    if (a == 0)
       return b;
    if (b == 0)
       return a;

    if (a == b)
        return a;

    if (a > b)
        return gcd(a-b, b);
    else return gcd(a, b-a);
}

ll ncr(int n,int r)
{
  ll ans=1;
  r=min(r,n-r);
  forup(i,r)
  {
    ans=(ans*(n-i)/(i+1))%N;
  }
  re ans;
}

ll n,m,k,x,y;
vi adj[2000];



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

  int t=1;
  //cin>>t;
  while(t--)
  {

    cin>>n>>x>>y;
    forup(i,n-1)
    {
      adj[i].pb(i+1);
      adj[i+1].pb(i);
    }
    adj[x-1].pb(y-1);
    adj[y-1].pb(x-1);
    int a[n]={0};
    forup(i,n-1)
    {
      queue<pii> q;
      bool visited[n]={0};
      visited[i]=1;
      q.push({i,0});
      while(!q.empty())
      {
        pii x=q.front();
        q.pop();
        for(auto z:adj[x.F])
        {
          if(!visited[z])
          {
            if(z>i) {a[x.S+1]++;}
            // cout<<x.F+1<<" "<<z+1<<" "<<x.S+1<<el;}
            visited[z]=1;
            q.push({z,x.S+1});
          }
        }

      }



    }
    int i=1;
    while(i<n)
    {
      cout<<a[i]<<el;
      i++;
    }



  }


  return 0;
}


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

const int maxn=1e6+10;
int n,h[maxn],ans;
char s[maxn],t[maxn];
int size[maxn<<2],tag[maxn<<2];

inline void push_up(int rt){
	size[rt]=size[rt<<1]+size[rt<<1|1];
}
inline void push_down(int rt){
	if(tag[rt]){
		tag[rt<<1]+=tag[rt];
		tag[rt<<1|1]+=tag[rt];
		tag[rt]=0;
	}
}
void build(int rt,int l,int r){
	if(l==r){
		size[rt]=1;
		return;
	}
	int mid=l+r>>1;
	build(rt<<1,l,mid);
	build(rt<<1|1,mid+1,r);
	push_up(rt);
}
void add(int rt,int x,int y){
	if(x==1&&y==size[rt]){
		++tag[rt];
		return;
	}
	push_down(rt);
	int mid=size[rt<<1];
	if(y<=mid)
		add(rt<<1,x,y);
	else if(x>mid)
		add(rt<<1|1,x-mid,y-mid);
	else
		add(rt<<1,x,mid),add(rt<<1|1,1,y-mid);
}
void del(int rt,int l,int r,int pos){
	if(l==r){
		size[rt]=0;
		return;
	}
	push_down(rt);
	int mid=size[rt<<1];
	if(pos<=mid)
		del(rt<<1,l,l+r>>1,pos);
	else
		del(rt<<1|1,(l+r>>1)+1,r,pos-mid);
	push_up(rt);
}
int query(int rt,int l,int r,int pos){
	if(l==r)
		return tag[rt];
	push_down(rt);
	int mid=size[rt<<1];
	if(pos<=mid)
		return query(rt<<1,l,l+r>>1,pos);
	else
		return query(rt<<1|1,(l+r>>1)+1,r,pos-mid);
}

int main(){
	cin>>n>>(s+1)>>(t+1);
	if(!strcmp(s+1,t+1)){
		puts("0");
		return 0;
	}
	build(1,1,n);
	for(int i=n,p=n;i;--i){
		if(i==1||t[i]!=t[i-1]){
			if(p>i)
				p=i;
			while(p&&(query(1,1,n,p)||s[p]!=t[i]))
				--p;
			if(!p){
				puts("-1");
				return 0;
			}
			if(p==i)
				continue;
			del(1,1,n,p);
			add(1,p,i-1);
			ans=max(ans,query(1,1,n,i-1));
//			for(int j=p;j<i;++j)
//				h[j]=h[j+1]+1;
//			if(h[i-1]>ans)
//				ans=h[i-1];
		}
		else
			ans=max(ans,query(1,1,n,i));
//			if(h[i]>ans)
//				ans=h[i];
	}
	printf("%d\n",ans+1);
	return 0;
}

Measured memory_bytes: 24832
#include <stdio.h>
#include <iostream>
#include <string>
#include <cstdlib>

using namespace std;

int digitsum(int n){
	int m = n;
	int sum = 0;
	while(m!=0){
		sum += m%10;
		m /= 10;
	}
	return sum;
}

int main(){
	int N, A, B;
	cin >> N >> A >> B;
	int sum = 0;
	for(int i = 1; i <= N; i++){
		int ds = digitsum(i);
		if(A <= ds && ds <= B){
			sum += i;
		}
	}
	cout << sum << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lowbit(x) ((x)&(-(x)))
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int INF = 0x3f3f3f3f;
const LL LINF = 0x3f3f3f3f3f3f3f3f;
const int MOD = 1e9 + 7;
const int maxn = 1e5 + 10;
int N, cnt[4];
char s[maxn];
int main()
{
    scanf("%d", &N);
    for(int i = 1; i <= N; i++)
    {
        scanf("%s", &s);
        switch(s[0])
        {
            case 'A': cnt[0]++; break;
            case 'W': cnt[1]++; break;
            case 'T': cnt[2]++; break;
            case 'R': cnt[3]++;
        }
    }
    printf("AC x %d\nWA x %d\nTLE x %d\nRE x %d\n", cnt[0], cnt[1], cnt[2], cnt[3]);
    return 0;
}


Measured memory_bytes: 3828
#include <stdio.h>

int main() {
  int N, T, c, t;

  int i, min = 1001;

  scanf("%d %d", &N, &T);
  for (i = 0; i < N; i++) {
    scanf("%d %d", &c, &t);
    if (t <= T && c < min) {
      min = c;
    }
  }
  if (min <= 1000) {
    printf("%d\n", min);
  } else {
    printf("TLE\n");
  }
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <limits>
#include <cstdlib>
#include <regex>
using namespace std;

double inf = numeric_limits<double>::infinity();

#define REP(i,n) for(int i=0;i<n;i++)
using LL = long long int;
LL GCD(LL a,LL b){ if(a<b) return GCD(b,a); else if(a%b==0) return b; else return GCD(b,a%b); }
LL LCM(LL a,LL b){ return (a/GCD(a,b))*b; }


int main() {
    string s;
    cin >> s;
    int cnt = 0;
    REP(i,6) {
        if (s[i] == '1') cnt++;
    }
    
    cout << cnt << endl;
}


Measured memory_bytes: 768
function Puzzle(){
   var obj={};
   var arrA="012,123,234,345,456,567,678".split(",");
   var arrB="000,111,222,333,444,555,666,777,888".split(",");
   var arrAB=arrA.concat(arrB);
   var arrC="00,11,22,33,44,55,66,77,88".split(",");
   for(var i=0;i<16;i++)for(var j=0;j<16;j++)for(var k=0;k<16;k++)for(var l=0;l<16;l++)for(var m=0;m<9;m++){
      var str=arrAB[i]+arrAB[j]+arrAB[k]+arrAB[l]+arrC[m];
      str=str.split("").map(Number).sort(function(a,b){return a-b;}).join("");
      obj[str]=true;
   }
   return obj;
}
var P=Puzzle();
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
while(true){
   if(Arr.length==0)break;
   var str=Arr.shift();
   var ans=[];
   for(var i=0;i<9;i++){
      var arr=str.split("").map(Number);
      arr=arr.map(function(v){return v-1;});
      arr.push(i);
      arr.sort(function(a,b){return a-b;});
      var b=[0,0,0,0,0,0,0,0,0];
      arr.forEach(function(v){b[v]++;});
      var max=Math.max.apply(null,b);
      if(max>=5)continue;
      if(P.hasOwnProperty(arr.join("")))ans.push(i+1);
   }
   console.log((ans.length==0)?"0":ans.join(" "));
}

Measured memory_bytes: 50064
from __future__ import print_function
# import numpy as np
# import numpypy as np
import sys
input = sys.stdin.readline

def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)

# import math
# import string
# import fractions
# from fractions import Fraction
# from fractions import gcd
# def lcm(n,m):
#     return int(n*m/gcd(n,m))

# import re
# import array
# import copy
# import functools
# import operator

# import collections
# import itertools
# import bisect
# import heapq


# from heapq import heappush
# from heapq import heappop
# from heapq import heappushpop
# from heapq import heapify
# from heapq import heapreplace

# from queue import PriorityQueue as pq

# # from itertools import accumulate
# # from collections import deque
# import random


def main():
    n,m = map(int, input().split()) # n represents switch, m represents lights
    lights=[]
    for i in range(m):
        ll=list(map(int, input().split()))
        lights.append(ll[1:])
    p = list(map(int, input().split()))
    eprint(lights)
    # eprint(s)
    # l=s
    # l[1]=[]
    # eprint(l,s)
    
    # cnt_ans=0
    ans=0
    for case in range((1<<n)):
        eprint(bin(case))
        # cnt_switch_on = 0
        ii=0
        f_flag=0
        for light in lights:
            cnt_on=0
            for i in light:
                if (case>>(i-1))&1:
                    cnt_on+=1
            eprint(cnt_on,p[ii])
            if  cnt_on%2!=p[ii]:
                f_flag=1
            ii+=1
        if f_flag==0:
            ans+=1
    print(ans)

        
    #     for i in range(n):
    #         if (case>>i)&1:
    #             cnt_switch_on +=1
    #             eprint("cnt_switch_on",cnt_switch_on)
    #     f_flag=0
    #     for light in range(m):
    #         if cnt_switch_on % 2 == p[light]:
    #             eprint("剰余",cnt_switch_on % 2,"p",p[light])
    #         else:
    #             f_flag=1
    #     if f_flag==0:
    #         cnt_ans+=1
    #     eprint("cnt_ans",cnt_ans)
    
    # print(cnt_ans)


    
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 59868
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define pb push_back
#define pr pair<int,int>
#define mod 1000000007
#define endl "\n"

void add(int &a,int b)
{
	a=(a+b)%mod;
}
 
void solve()
{
	int ans=0,i,j,k,n;
	cin>>n;
	for(i=1;i<=n;i++)
		for(j=1;j<=n;j++)
			for(k=1;k<=n;k++)
				add(ans,__gcd(__gcd(k,j),i));
	cout<<ans<<endl;
}
 
int32_t main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
    	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr long long MOD = 1000000007;
constexpr long long INF = 1LL << 60;
const long double PI = acosl(-1.0);
constexpr long double EPS = 1e-11;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
//O(k)愚直,nは大きいがkがそうでもないときに思い出す
long long modpow(long long x,long long n,long long mod){
    long long res = 1;
    while(n > 0) {
        if(n & 1) (res *= x) %= mod;
        (x *= x) %= mod;
        n >>= 1;
    }
    return res;
}
long long modinv(long long x, long long mod){
     return modpow(x, mod - 2, mod); }
long long modcomb(long long n,long long r,long long mod){
    long long numerator = 1;
    for(long long i = 0; i < r; i++) {
        (numerator *= (n - i)) %= mod;
    }
    long long denominator = 1;
    for(long long i = 1; i <= r; i++) {
        (denominator *= i) %= mod;
    }
    denominator = modinv(denominator, mod);
    return numerator * denominator % mod;
}
void factorization(long long n,map<long long ,long long>& mp){
    for(long long i=2;i*i<=n;i++){
        while(n%i==0){
            mp[i]++;
            n /= i;
        }
     }
     if(!(n == 1)) mp[n]++;
}
int main(){
    ll n, m;
    cin >> n >> m;
    map<ll, ll> mp;
    factorization(m, mp);
    ll ans = 1;
    for (auto i : mp){
        ans *= modcomb(i.second + n - 1, i.second, MOD);
        ans %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,a,b) for(int i=(a),_end_=(b);i<=_end_;i++)
#define DREP(i,a,b) for(int i=(a),_end_=(b);i>=_end_;i--)
#define EREP(i,u) for(int i=start[u];i;i=e[i].next)
#define fi first
#define se second
#define mkr(a,b) make_pair(a,b)
#define SZ(A) ((int)A.size())
template<class T>inline void chkmin(T &a,T b){ if(a>b)a=b;}
template<class T>inline void chkmax(T &a,T b){ if(a<b)a=b;}
inline void myassert(bool a,string s){ if(!a)cerr<<s<<endl,exit(0);}
inline int read()
{
	int s=0,f=1;char ch=getchar();
	while(!isdigit(ch) && ch!='-')ch=getchar();
	if(ch=='-')ch=getchar(),f=-1;
	while(isdigit(ch))s=s*10+ch-'0',ch=getchar();
	return ~f?s:-s;
}

const int maxn=52;

int n,X,D;
int v[maxn];
ll w[maxn];
int fa[maxn],id[maxn];

inline void init()
{
	n=read();X=read();D=read();
	REP(i,1,n)
	{
		id[i]=i;
		w[i]=read();v[i]=1;
		if(i>1)fa[i]=read();
	}
	DREP(i,n,2)v[fa[i]]+=v[i],w[fa[i]]+=w[i];
	sort(id+1,id+n+1,[](int a,int b){ return (ll)w[a]*v[b]<(ll)w[b]*v[a];});
}

ll f[maxn*maxn*maxn];

#define pli pair<ll,int>
pli q[maxn*maxn*maxn];
int head,tail,LIM;

inline void doing()
{
	memset(f,63,sizeof(f));
	f[0]=0; LIM=min(D,50);
	int sum=0;
	REP(i,1,n)
	{
		int V=v[i];
		ll W=w[i];
		sum+=V*LIM;
		REP(rest,0,V-1)
		{
			head=1; tail=0;
			
			for(int x=rest,j=0;x<=sum;x+=V,j++)//REP(j,0,sum/V)
			{
				pli add=mkr(f[x]-(ll)j*W,j);
				while(head<=tail && q[tail].fi>=add.fi)--tail;
				q[++tail]=add;
				while(head<=tail && j-q[head].se>LIM)++head;
				f[x]=q[head].fi+(ll)j*W;
			}
		}
	}
	ll ans=0;
	D-=LIM;
	REP(j,0,sum)if(f[j]<=X)
	{
		ll num=j;
		ll rest=X-f[j];
		REP(i,1,n)
		{
			int x=id[i];
			ll DD=D;
			if(x>1 && DD<=rest/w[x])rest-=DD*w[x],num+=DD*v[x];
			else { num+=(rest/w[x])*v[x]; rest%=w[x];}
		}
		chkmax(ans,num);
	}
	printf("%lld\n",ans);
}

int main()
{
	init();
	doing();
	return 0;
}


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

int main()
{
    ll N, M;
    cin >> N >> M;
    vector<ll> pena(N,0);
    vector<ll> ok(N,0);
    ll res1=0;
    ll res2=0;
    for (int i = 0; i < M; i++)
    {
        ll p;
        string status;
        cin >> p >> status;--p;
        if(status=="AC"){
            if(!ok[p]){
                ++res1;res2+=pena[p];ok[p]=true;
            }
        }
        else pena[p]++;
    }
    cout<<res1<<" "<<res2;
    return 0;
}

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

using namespace std;

#define N 200005

int n, k, c, maxn[N], f[N], g[N], p[N];

char s[N];

bool is[N];

int main()
{
    scanf("%d%d%d", &n, &k, &c);
    scanf("%s", (s + 1));
    for(int i = 1; i <= n; i++)
        if(s[i] == 'x')
        {
            is[i] = 1;
        }
    for(int i = 1; i <= n; i++)
    {
        maxn[i] = maxn[i - 1];
        f[i] = f[i - 1];
        if(i > maxn[i] && !is[i]) 
        {
            f[i]++;
            maxn[i] = i + c;
        }
    }
    p[n + 1] = n + 1;
    for(int i = n; i >= 1; i--)
    {
        g[i] = g[i + 1];
        p[i] = p[i + 1];
        if(i < p[i] && !is[i]) 
        {
            g[i]++;
            p[i] = i - c;
        }
    }
    for(int i = 1; i <= n; i++)
    {
        // cout << i << ' ' << f[i] << ' ' << g[i] << endl;
        if(!is[i])
        {
            if(f[i - 1] + g[max(maxn[i - 1] + 1, i + 1)] < k)
            {
                printf("%d\n", i);
            }
        }
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) x.begin() , x.end()
int tt = 1;

void ok() {
  int a,x;
  cin >> x >> a;
  cout<<((x<a)?0:10)<<"\n";
}

int32_t main() {


  int t = 1;
  //cin >> t;
  int c = 0;
  while (t--) {
    
    ok();
  }
  return 0;
}


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

#define int long long
using P=pair<int,int>;

const int MOD=1e9+7;
const int INF=(int)(1)<<62;
const int MAX=1e5;

//int hw[1000][1000];
int a,b;
int h,w;


void solve(){
    cin>>h>>w;
    cin>>a>>b;
    if(a==0 && b==0){
        for(int i=0; i<h; i++){
            for(int j=0; j<w; j++){
                cout<<1;
            }
            cout<<endl;
        }
        return;
    }

    if((b==0 && h!=1)||(a==0 && w!=1)){
        cout<<"No"<<endl;
        return;
    }
    if(h<b*2||w<a*2){
        cout<<"No"<<endl;
        return;
    }
    if(a==0){
        for(int i=0; i<b; i++){
            cout<<1<<endl;
        }
        for(int i=0; i<h-b; i++){
            cout<<0<<endl;
        }
        return;
    }
    if(b==0){
        for(int i=0; i<a; i++){
            cout<<1;
        }
        for(int i=0; i<w-a; i++){
            cout<<0;
        }
        cout<<endl;
        return;
    }
    if(h/b==w/a && h%b==0 && w%a==0){
        for(int i=0; i<h/b; i++){
            for(int j=0; j<b; j++){
                for(int k=0; k<a*i; k++){
                    cout<<0;
                }
                for(int k=0; k<a; k++){
                    cout<<1;
                }
                for(int k=0; k<w-a*(i+1); k++){
                    cout<<0;
                }
                cout<<endl;
            }
        }
        return;
    }
    if(w>a*3 || h>b*3){
        cout<<"No"<<endl;
        return;
    }
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            if((i%(2*b))<b && (j%(2*a))<a){
                //cout<<i<<" "<<i%(2*h)<<" "<<endl;
                //cout<<j<<" "<<j%(2*w)<<" "<<w<<endl;
                cout<<1;
            }else if(!((i%(2*b))<b) && !((j%(2*a))<a)){
                cout<<1;
            }
            else{
                cout<<0;
            }
        }
        cout<<endl;
    }
}


void solve2(){
    cin>>h>>w>>a>>b;
    if(h<b*2 || w<a*2){
        cout<<"No"<<endl;
    }
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            if((i<b) ^ (j<a)){
                cout<<1;
            }
            else{
                cout<<0;
            }
        }
        cout<<endl;
    }
}


signed main(){
    solve2();
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1e9+7,INF=mod*mod*3;//M_PI
#define rep(i,N) for(ll i=0; i<(N); i++)
#define rep1(i,N) for(ll i=1; i<(N); i++)
#define pb push_back

ll N,M;
ll dp[1005][9000];
ll a[1005];
ll b[1005];
ll c[1005][15];

int main(){

cin.tie(0);
ios::sync_with_stdio(false);

cin>>N>>M;
rep(i,M){
    cin>>a[i]>>b[i];
    rep(j,b[i]){
        cin>>c[i][j];
        c[i][j]--;
    }
}
rep(i,1005) rep(j,4100) dp[i][j]=INF;
dp[0][0]=0;
ll sn=0;
rep(k,15){
    rep(i,b[0]){
        if(k==c[0][i]) sn+=(1<<k);
    }
}
dp[0][sn]=a[0];
rep1(m,M){
    rep(i,4100){
        ll ii=i;
        string s="000000000000000"; 
        ll st=0;
        while(ii){
            if(ii%2) s[st]='1';
            ii/=2; 
            st++;
        }
        rep(k,b[m]){
            s[c[m][k]]='1';
        }
        ll nm=0;
        rep(k,N){
            if(s[k]=='1') nm+=(1<<k);
        }
        dp[m][nm]=min(dp[m][nm],dp[m-1][i]+a[m]);
        dp[m][i]=min(dp[m][i],dp[m-1][i]);
    }
}
ll nmax=0;
rep(i,N) nmax+=(1<<i);
cout<<(dp[M-1][nmax]==INF?-1:dp[M-1][nmax])<<endl;



}
    


Measured memory_bytes: 39904
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);  
	cin.tie(NULL);
	int n;cin>>n;
	vector<pair<ll,ll> > v;
	for(int i=0;i<n;i++){
		ll a;cin>>a;
		v.push_back(make_pair(a,i+1));
	}
	vector<ll> count;
	vector<ll> u;
	map<ll,ll> mp;
	for(int i=0;i<n;i++){
		count.push_back(v[i].second-v[i].first);
		u.push_back(v[i].first+v[i].second);
		mp[v[i].first+v[i].second] = 0;
	}
	for(int i=0;i<n;i++){
		mp[u[i]]++;
	}
	ll counter=0;
	for(int i=0;i<n;i++){
		counter += mp[count[i]];
	}
	cout<<counter<<endl;
}

Measured memory_bytes: 32188
#!/usr/bin/env python3

def main():
    a,b = map(int, input().split())
    tousa = b-a
    higashi_tou = 0
    for i in range(1,tousa+1):
        higashi_tou += i
    yuki = higashi_tou - b
    print(yuki)

if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		char s = sc.next().charAt(0);
		sc.close();

		if ('A' <= s && s <= 'Z') {
			System.out.println("A");
		} else {
			System.out.println("a");
		}
	}
}


Measured memory_bytes: 35744
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:https://onlinejudge.u-aizu.ac.jp/services/room.html#ACPC2018Day2/problems/E>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

double solve(){
    double res = 0;
    double W,H,w,h,x,y; cin >> W >> H >> w >> h >> x >> y;
    if((x+w/2 <= W/2) and (y+h/2 <= H/2)){
        res = y/x;
    }else{
        if(x+w/2 > W/2){
            x = (x-w/2+W/2)/2;
        }
        if(y+h/2 > H/2){
            y = (y-h/2+H/2)/2;
        }
        res = y/x;
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(12) << solve() << endl;
    return 0;
}



Measured memory_bytes: 3300
require 'pp'
# IS_DEBUG = true
IS_DEBUG = false
def dputs str
	if(IS_DEBUG)
		puts str
	end
end
def dpp str
	if(IS_DEBUG)
		pp str
	end
end
def gcd(a,b)
	if(a>b)
		return gcd(b,a)
	end
	if(b%a == 0)
		return a
	else
		return gcd(a,b%a)
	end
end
def lcm(a,b)
	a/gcd(a,b)*b
end
def ngcd(arr)
	tmp = arr[0]
	if(arr.size==1)
		return tmp
	end
	1.upto(arr.size-1){|i|
		tmp = gcd(tmp, arr[i])
	}
	tmp
end

N,K=gets.chomp.split(' ').map{|n| n.to_i}
A=gets.chomp.split(' ').map{|n| n.to_i}
gcd = ngcd(A)
max = A.max
if(K <= max && K%gcd==0)
	puts "POSSIBLE"
else
	puts "IMPOSSIBLE"
end


Measured memory_bytes: 9708