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

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")


#define boost ios::sync_with_stdio(0); cin.tie(0);
#define int long long
const int N = 5 + 1000;

string s;
int out = 0 , n;
void go(int idx , int ans){
	if(idx >= n){
		out += ans;
		return;
	}

	string curr = "";

	for(int i = idx ; i < n ; ++i){
		curr += s[i];
		go(i+1,ans+stoll(curr));
	}
}


int32_t main(){
	boost;

    cin >> s;
    n = s.length();

    go(0,0);
    cout << out;
    
    return 0;
}

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

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

  int i = 1, ans = 0;
  while (1) {
    if (i > N - 1) break;
    ans += (N - 1) / i;
    i++;
  }

  cout << ans << endl;
}

Measured memory_bytes: 3576
import java.util.Scanner;

public class Main {
  public static void main(String[] main) {
    Scanner input = new Scanner(System.in);
    int n = Integer.parseInt(input.nextLine());
    String[] ss = input.nextLine().split(" ");
    int[] xs = new int[n];
    for (int i = 0; i < n-1; i++) {
      int x = Integer.parseInt(ss[i]) - 1;
      xs[x] += 1;
    }
    for (int i = 0; i < n; i++) {
      System.out.println(xs[i]);
    }
  }
}

Measured memory_bytes: 73244
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

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

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

fn main() {
    input!{
        h: usize,
        w: usize,
        a: [chars; h],
    }
    let mut board = vec![vec![h+w; w]; h];
    let mut points = VecDeque::new();
    for i in 0..h {
        for j in 0..w {
            if a[i][j] == '#' {
                board[i][j] = 0;
                points.push_back((i as i64, j as i64));
            }
        }
    }

    while let Some((i, j)) = points.pop_front() {
        for &(di, dj) in [(0, -1), (0, 1), (-1, 0), (1, 0)].iter() {
            let x = i + di;
            let y = j + dj;
            if !(x >= 0 && x < h as i64 && y >= 0 && y< w as i64) {
                continue;
            }
            if board[x as usize][y as usize] == h+w {
                board[x as usize][y as usize] = board[i as usize][j as usize] + 1;
                points.push_back((x, y));
            }
        }
    } 
    let ans = board.iter().map(|l| l.iter().max().unwrap()).max().unwrap();


    println!("{}", ans);
}


Measured memory_bytes: 31992
#include <iostream>
#include <string> 
using namespace std; 
int main(){

 string n1,n2,n3,n4;
 string N;
  cin >> N ;
  n1=N[0];
  n2=N[1];
  n3=N[2];
  n4=N[3];
  if(n1==n2 && n2==n3){
  	cout << "Yes" << endl;
  }else if(n2==n3 && n3==n4){
  	cout << "Yes" << endl;
  }else if(n1==n2 && n3==n4 && n1==n4){
   cout << "Yes" << endl;
  }else{
  	cout << "No" << endl;
  }
  

}


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

using namespace std;

int main(){
    int n,m;
    cin>>n>>m;
    vector<int> a(m);

    for(int i=0;i<n;i++){
        int k;
        cin>>k;
        for(int j=0;j<k;j++){
            int tmp;
            cin>>tmp;
            tmp--;
            a[tmp]++;
        }
    }
    int cnt=0;
    for(int i=0;i<m;i++){
        if(a[i]==n)
            cnt++;
    }
    cout<<cnt;
}


Measured memory_bytes: 256
#include <iostream>
#include <stack>

using namespace std;
int main(int ac, char **av) {
  stack<int> st;
  int t;

  while (cin >> t) {
    if (t == 0) {
      cout << st.top() << endl;
      st.pop();
    } else {
      st.push(t);
    }
  }
  return 0;
}

Measured memory_bytes: 3124
n,k=map(int,input().split())
d=dict()
for i in range(k):
    d[i]=0
for i in range(1,n+1):
    d[i%k]+=1
#print(d)
if k%2!=0:
    print(d[0]*d[0]*d[0])
else:
    print(d[0]*d[0]*d[0]+d[k//2]*d[k//2]*d[k//2])




Measured memory_bytes: 27112
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <algorithm>

int main() {
 int N,i,j,a,b,c;
  cin>>N;
  int A[N];
  int x;
  for(i=0;i<N;i++){
  cin>>A[i];
  }
  
 // sort(A,A+N);
  x=A[0];
  for(i=0;i<N;i++){
      a=max(A[i],x);
      b=min(A[i],x);      
    for(;;){

      
if(a%b==0){
  x=b;
break;
}else{
  c=a%b;
a=max(b,c);
  b=min(b,c);
}
    }
  }
  cout<<x<<endl;
}

Measured memory_bytes: 640
//phoenix




#include <bits/stdc++.h>
using namespace std;


#define spdio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define pp pop_back
#define mp make_pair
#define fr(i,j,n) for(ll i=j; i<n; i++)
#define rfr(i,j,n) for(ll i=n-1; i>=0; i--)
#define vsort(v) sort(v.begin(),v.end())
#define asort(a) sort(a,a+n);


typedef long double ld;
typedef long long int ll;


//getline(cin,string);
const ll inf = (ll) 1e18 + 19;




ll solveDp(ll i,ll w[],ll v[],ll n,ll wt,vector <vector <ll> > &dp) {
    if(i>=n || wt<0)
        return 0;
    if(dp[i][wt]!=-1)
        return dp[i][wt];
    else if(wt<w[i])
        return dp[i][wt]=solveDp(i+1,w,v,n,wt,dp);
    else
        return dp[i][wt]=max(solveDp(i+1,w,v,n,wt,dp),v[i]+solveDp(i+1,w,v,n,wt-w[i],dp));
}




void cazz() {
    ll t,n,i,j,k,ans=0,f=0,b,wt;
    cin>>n>>wt;
    ll w[n],v[n];
    fr(i,0,n) cin>>w[i]>>v[i];
    vector <vector <ll> > dp(n,vector <ll> (wt+1,-1));
    cout<<solveDp(0,w,v,n,wt,dp)<<"\n";
}




int main() {
    spdio;
	cazz();
	return 0;
}



Measured memory_bytes: 79488
using System;

public class ABC156_B {
    private static void Main(string[] args) {
        var inputs = Console.ReadLine().Trim().Split();
        var n = int.Parse(inputs[0]);
        var k = int.Parse(inputs[1]);

      	var logKN = Math.Log(n, k);
      	var answer = (logKN == (int)logKN) ? ((int)logKN + 1) : Math.Ceiling(logKN);
        Console.WriteLine(answer);
    }
}

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

using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef pair<ll, ll> P;

bool chk(int x){
    int cnt=0;
    while(0<x){
        cnt += 1;
        x /= 10;
    }
    if(cnt%2) return true;
    return false;
}

int main(){
    int n;
        cin >> n;
    int cnt=0;
        for(int i=1; i<=n; i++){
            if(chk(i)) cnt += 1;
        }
        cout << cnt << endl;
}

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

#define pb push_back
#define pob pop_back
#define mp make_pair
#define f first
#define s second

typedef long long ll;
const ll INF = 1e18;
const ll mod = 1e9 + 7;

void solve(){
	int n,l;
	cin>>n>>l;
	int sum=0;
	for(int i=1;i<=n;i++){
		sum += l+i-1;
	}
	int ans=sum-(l),diff=abs(l);
	//cout<<ans<<" "<<diff<<"\n";
	for(int i=2;i<=n;i++){
		if(diff > abs(l+i-1)){
			diff = abs(l+i-1);
			ans = sum-(l+i-1);
		}
		//cout<<ans<<" "<<diff<<"\n";
	}
	cout<<ans<<"\n";
}

int main(){
	ios_base::sync_with_stdio(0);
  cin.tie(0);
		solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a, b, k;
    cin >> a >> b >> k;
    int count=0;
    for(int i=min(a,b); i>0; i--){
        if(a%i==0 && b%i==0){
            count++;
        }
        if(count==k){
            cout << i << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define loop(n) for(ll i = 0; i<n; i++)
#define sort(a) sort(a.begin(), a.end())
using namespace std;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int n, k, x, from; cin>>n>>k;
    bool dp[k+1] = {0};//dp[i] = true if taro wins with i stones
    vector<int> s(n);
    loop(n) cin>>s[i];

    for(int stones = 0; stones<=k; stones++){
        for(int i = 0; i<n; i++){
            x = s[i];
            if(stones>=x && !dp[stones-x]) dp[stones] = true;
        }
    }

    cout<<(dp[k]?"First\n":"Second\n");
    return 0;
}

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

int main() {
	long long x,y,i,sum=0,tempmax=-1000000,tempmin=1000000;
	cin >> x;
	for (i = 1; i <= x; i++) {
		cin >> y;
		sum += y;
		if (tempmax <= y) {
			tempmax = y;
		}
		if (tempmin >= y) {
			tempmin = y;
		}
	}
		cout << tempmin << " " << tempmax << " " << sum << "\n";
	return 0;
	}


Measured memory_bytes: 3112
void main()
{
    long[] tmp = readln.split.to!(long[]);
    long a = tmp[0], b = tmp[1], c = tmp[2];

    writeln(a + b >= c - 1 ? b + c : 2 * b + a + 1);
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int main() {
    
    int N;
    cin >> N;
    vector<int> A(N);
    vector<int> X(20,-1);

    for ( int i = 0; i < N; i++ ) {
        cin >> A[i];
    }

    long long ans = 0;
    int l,r;
    l = r = 0;
    int a = 0;
    while ( r < N ) {

        // cout << l << " " << r << endl;

        if ( a&A[r] ) {
            a ^= A[l];
            l++;
            while ( a&A[r] ) {                
                ans += r-l;
                a ^= A[l];              
                l++;
            }
            ans += r-l;
        }
        else {
            a |= A[r];
            ans++;
            r++;
        }
    }
    l++;
    while ( l < N ) {
        ans += r-l;
        l++;
    }

    cout << ans << endl;

}



Measured memory_bytes: 1024
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

use std::cmp::min;
fn main() {
    input!{
        a: u64,
        b: u64,
        c: u64,
        d: u64,
    }
    println!("{}", min(a , b) + min(c, d));
}


Measured memory_bytes: 4352
#import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
N, M = LI()
A = [I() for _ in range(M)]
md = 10**9+7


dp = [0] * (N+1)
dp[0] = 1
chk = [True] * (N+1)
for a in A:
  chk[a] = False

for now in range(N):
  for next in range(now+1, now+3):
    if next == N:
      dp[next] += dp[now]
      dp[next] %= md
      break
    if not chk[next]:
      continue
    else:
      dp[next] += dp[now]
      dp[next] %= md

print(dp[N])

Measured memory_bytes: 8616
package main

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

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	n, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return n
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	a := nextInt(sc)
	b := nextInt(sc)
	c := nextInt(sc)
	if a < b && b < c {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}



Measured memory_bytes: 1076
D, G = map(int, input().split())
probs = [tuple(map(int, input().split())) for _ in range(D)]
res = 10 ** 4
for i in range(1 << D):
    comps = []
    idx = -1
    for j in range(D):
        if (i >> j) & 1:
            comps.append(j)
        else:
            idx = j
    g = G
    tmp = 0
    for c in comps:
        g -= 100 * (c + 1) * probs[c][0] + probs[c][1]
        tmp += probs[c][0]
    if g <= 0:
        res = min(res, tmp)
        continue
    else:
        t = (g + 100 * (idx + 1) - 1) // (100 * (idx + 1))
        if t <= probs[idx][0]:
            tmp += t
            res = min(res, tmp)
print(res)


Measured memory_bytes: 8960
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
ll MOD = 1000000007LL;
ll inv(ll K) {
  ll A = MOD - 2;
  ll ret = 1;
  ll D = K;
  while (A > 0) {
    if (A % 2 == 1) {
      ret = (ret * D) % MOD;
    }
    D = (D * D) % MOD;
    A /= 2;
  }
  return ret;
}
ll FC[400005];
ll IFC[400005];
ll initFC(int N) {
  FC[0] = 1;
  for (ll i=1; i<=N; i++) {
    FC[i] = (FC[i-1] * i) % MOD;
  }
  IFC[N] = inv(FC[N]);
  for (ll i=N; i>=0; i--) {
    IFC[i-1] = (IFC[i] * i) % MOD;
  }
}

ll combFC(ll N, ll K) {
  ll ret = (FC[N] * IFC[K]) % MOD;
  ret = (ret * IFC[N-K]) % MOD;
  return ret;
}

ll modSum(ll& N, ll B) {
  N = (N + B % MOD + MOD) % MOD;
}
int main() {
  ios::sync_with_stdio(false);
  ll N, K;
  cin >> N >> K;
  initFC(400003);
  ll ret = 1;
  for (ll i=1; i<=min(N-1,K); i++) {
    ll d = combFC(N, i);
    d = (d * combFC(i + N-i-1, i)) % MOD;
    modSum(ret, d);
  }
  cout << ret << endl;
}

Measured memory_bytes: 6528
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;

int a, b, c, n;
string s;



int main()
{
   cin>>a>>b;
  cout<<a+b/2<<endl;
	
}


Measured memory_bytes: 256
//AUTHOR - NAVEEN KUMAR(@naveen19991124)
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#inlcude<boost/multiprecision/cpp_dec_float.hpp>
#define ll long long
#define pb push_back
#define f(a) for(ll i = 0;i<a;i++)
#define rep(i,a,b) for(ll i = a;i<b;i++)
#define rrep(i,a,b) for(ll i = a;i>b;i--)
#define v vector<ll>
#define mp make_pair
#define fir first
#define sec second
#define _fast_ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
//using boost :: multiprecision :: cpp_int;
//using boost :: multiprecision :: cpp_dec_float_50;
//using boost :: multiprecision :: cpp_dec_float_100;
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}

ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1;
a *= a; a %= mod;} return p % mod;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
int main()
{
	_fast_
	ll t = 1;
//	cin>>t;
	while(t--){
	ll n,m;
	cin>>n>>m;
	ll arr[m];
	ll sum = 0;
	f(m)
	{
		cin>>arr[i];
		sum  += arr[i];
	}
	if(sum>=n)
	{
		cout<<"Yes\n";
	}
	else
	{
		cout<<"No\n";
	}
	}
	return 0;
}

Measured memory_bytes: 1024
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 15 17:00:46 2020

@author: saito
"""

# %% import phase

# %% define phase

# %% input phase
n = int(input())
a = list(map(int, input().split()))

# %% process phase
ans = 0
f = 0
for ai in a:
    if f <= ai:
        f = ai
    else:
        ans += f - ai


# %%output phase
print(ans)

Measured memory_bytes: 31000
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MAXN 1000010
#define rep(i, n) for(int i = 0; i < (n); ++i)
const ll mod = 1e9 + 7;

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;
}

bool pairCompare(const P &firstElof, const P &secondElof) {
    return firstElof.second < secondElof.second;
}

int main() {
    int x;
    cin >> x;
    if(x >= 30) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3628
// {{{ Templates
#include <bits/stdc++.h>

#define show(x) cerr << #x << " = " << x << endl

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v)
{
    os << "sz:" << v.size() << "\n[";
    for (const auto& p : v) {
        os << p << ",";
    }
    os << "]\n";
    return os;
}

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


constexpr ll MOD = (ll)1e9 + 7LL;

template <typename T>
constexpr T INF = numeric_limits<T>::max() / 100;

// }}}

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

    ll Q, H, S, D;
    cin >> Q >> H >> S >> D;
    ll N;
    cin >> N;
    N *= 4;
    const ll min8L = min(8LL * Q, min(4LL * H, min(2LL * S, D)));
    const ll min4L = min(4LL * Q, min(2LL * H, S));
    const ll min2L = min(2LL * Q, H);
    const ll min1L = Q;

    ll sum = 0;
    sum += (N / 8) * min8L;
    N = N % 8;
    sum += (N / 4) * min4L;
    N = N % 4;
    sum += (N / 2) * min2L;
    N = N % 2;
    sum += N * min1L;

    cout << sum << endl;
    return 0;
}


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

#define debug(x) cout <<"DEBUG"<<" "<<#x<<":"<<x<<'\n'

//↓0-originか1-originでn回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   //0-origin昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) //1-origin昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  //0-origin降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   //1-origin降順
//rep2 -> 第二引数 m から n 回繰り返し ex) m=5 n=3 なら i=5,i=6,i=7 まで
#define rep2(i,m,n) for(int i = ((int)(m)); i < ((int)(n))+((int)(m)); i++)
#define SIZE(x) ((int)((x).size()))
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii; //2次元配列
typedef vector<ll> vll;
typedef vector<string> vs;
template<typename T> bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1;} return 0;}
template<typename T> bool chmin(T &a, const T &b){ if(a>b){ a=b; return 1;} return 0;}


/*FUNCs=================================================*/


/*MAIN==================================================*/
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化

    int a, b; cin >> a >> b;


    cout << (a-2*b>=0? a-2*b : 0) << '\n';
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <functional>
#include <string>
#include <string.h>
#include <math.h>
#include <map>
#include <time.h>
using namespace std;

int main(){ 
	int N, A, B, P[100], a = 0, b = 0, c = 0, ans;

	cin >> N >> A >> B;

	for (int i = 0; i < N; ++i)
		cin >> P[i];

	for (int i = 0; i < N; ++i){
		if (P[i] <= A)
			++a;
		else if (P[i] <= B)
			++b;
		else
			++c;
	}

	ans = min(min(a, b), c);

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

Measured memory_bytes: 256
int m,n,X[10],Y[10];
int D[101][101];//ツ甘ケツ静敖コツδ督ビツニツづづ個催短ツ仰猟猟」
#define INF 1e9
int dist(x0,y0,x1,y1){
	int dx,dy,vl,vr;
	dy=abs(y0-y1);
	if(y0%2==0){
		vl=dy/2;
		vr=(dy+1)/2;
	}else{
		vl=(dy+1)/2;
		vr=dy/2;
	}
	if(x1<x0-vl)
		dx=x0-vl-x1;
	else if(x1>x0+vr)
		dx=x1-x0-vr;
	else
		dx=0;
	return dx+dy;
}
int main(){
	int s,i,x,y,d;
	int t,p,q,c,best;
	for(;scanf("%d%d%d",&m,&n,&s),m;){
		for(i=0;i<s;i++)
			scanf("%d%d",X+i,Y+i);
		for(y=1;y<=n;y++){
			for(x=1;x<=m;x++){
				D[x][y]=INF;
				for(i=0;i<s;i++){
					d=dist(x,y,X[i],Y[i]);
					if(d<D[x][y])
						D[x][y]=d;
				}
			}
		}
		scanf("%d",&t);
		best=0;
		for(;t--;){
			scanf("%d%d",&p,&q);
			c=0;
			for(y=1;y<=n;y++){
				for(x=1;x<=m;x++){
					d=dist(x,y,p,q);
					if(d<D[x][y])
						c++;
				}
			}
			if(c>best)
				best=c;
		}
		printf("%d\n",best);
	}
	exit(0);
}

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

//オーバーフロー
//コーナーケース

typedef long long ll;

string s[14] = {"SUN","MON","TUE","WED","THU","FRI","SAT","SUN","MON","TUE","WED","THU","FRI","SAT"};

int main() {
    string ss;
    cin >> ss;
    for (int i = 0; i < 14; i++) {
        if (s[i] == ss) {
            for (int j = 1; i + j < 14; j++) {
                if (s[i + j] == "SUN") {
                    cout << j << endl;
                    return 0;
                }
            }
        }
    }
    return 0;
}


Measured memory_bytes: 256
N, T = [int(n) for n in input().split()]
A = [int(n) for n in input().split()]

current_min = 100000000000000000
current_max_diff = -10000000000000000
max_diff_cnt = 0
for a in A:
  if a - current_min == current_max_diff:
    max_diff_cnt += 1
  if a - current_min > current_max_diff:
    current_max_diff = a - current_min
    max_diff_cnt = 1
  if a < current_min:
    current_min = a

print(max_diff_cnt)

Measured memory_bytes: 14252
while True:
    h,w = map(int, input().split())
    if (h==0 and w==0):
        break
    for i in range(h):
        for j in range(w):
            if (i+j)%2 == 0:
                print("#", end='')
            elif (i+j)%2 != 0:
                print(".", end='')
        print()
    print()


Measured memory_bytes: 7000
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    string s, t;
    cin >> s >> t;

    sort(s.begin(), s.end());
    sort(t.rbegin(), t.rend());

    if(s < t){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

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

#define MAX 50

int main(void) {
	int N, K, i = 0, j, temp, ans = 0;
	char *l;
	char str[65535];
	int token[MAX];
	
	scanf("%d %d", &N, &K);
	gets(str);
	gets(str);
	l = strtok(str, ". ");
	token[i] = atoi(l);
	i++;
	while (l != NULL) {
		l = strtok(NULL, ". ");
		if(l != NULL) {
			token[i] = atoi(l);
			i++;
		}
	}

	for(i=0; i<N; i++) {
		for(j=0; j<N-1; j++) {
			if(token[j] > token[j+1]) {
				temp = token[j];
				token[j] = token[j+1];
				token[j+1] = temp;
			}
		}
	}

	for(i=0; i<K; i++) {
		ans += token[N-1-i];
	}

	printf("%d", ans);

	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.10f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e18;
const ll MAX_N = 201010;

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i;
	}
}

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


//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };
ll dp[10101][110];

//long longしか使わない
//素数は1より大きい
//lower_boundは指定したkey以上の要素の一番左のイテレータをかえす
//upper_boundは指定したkeyより大きい要素の一番左のイテレータをかえす
int main() {
	ll n, p;
	cin >> n >> p;
	vector<ll>a(n);
	ll even = 0, odd = 0;
	ll total = 0;
	rep(i, n) {
		cin >> a[i];
		total += a[i];
		if (a[i] % 2)odd++;
		else {
			even++;
		}
	}
	if (total % 2 == p) {
		ll ans = 0;
		ans += pow(2, even);
		if (odd) {
			ans *= pow(2, odd - 1);
		}
		cout << ans << endl;
	}
	else {
		ll ans = 0;
		if (odd) {
			ans += pow(2, odd - 1);
		}
		ans *= pow(2, even);
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 4040
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ld long double
 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
 
template <typename T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
string to_string(char c) {
	return string(1, c);
}
string to_string(bool b) {
	return b ? "true" : "false";
}
string to_string(const char* s) {
	return string(s);
}
string to_string(string s) {
	return s;
}
string to_string(vector<bool> v) {
	string res;
	for(int i = 0; i < (int) v.size(); i++)
		res += char('0' + v[i]);
	return res;
}
 
template<size_t S> string to_string(bitset<S> b) {
	string res;
	for(int i = 0; i < S; i++)
		res += char('0' + b[i]);
	return res;
}

template<class T> string to_string(T v) {
    bool f = 1;
    string res;
    for(auto& x : v) {
		if(!f)
			res += ' ';
		f = 0;
		res += to_string(x);
	}
    return res;
}
 
void DBG() {
	cerr << "]" << endl;
}

template<class H, class... T> void DBG(H h, T... t) {
	cerr << to_string(h);
	if(sizeof...(t))
		cerr << ", ";
	DBG(t...);
}

#ifdef _DEBUG
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
#endif

const int d4i[4] = {-1, 0, 1, 0}, d4j[4] = {0, 1, 0, -1};
const int d8i[8] = {-1, -1, 0, 1, 1, 1, 0, -1}, d8j[8] = {0, 1, 1, 1, 0, -1, -1, -1};

void solve() {
	int x;
	cin >> x;
	if(x == 0) cout << 1;
	else if(x == 1) cout << 0;
}	
 
int main() {
	
	ios::sync_with_stdio(0);
	cin.tie(0);
 	
	int t = 1;
	//cin >> t;
	for(int i = 1; i <= t; i++) {
		//cout << "Case #" << i << ": ";
		solve();
	}
}

Measured memory_bytes: 3652
#include <stdio.h>

const char lin[] = "####################";

int main(void) {
    int n, b, f, r, v, tbl[4][3][10] = {};
    for(scanf("%d", &n); n--; tbl[~-b][~-f][~-r] += v) {
        scanf("%d %d %d %d", &b, &f, &r, &v);
    }
    for(b = 0; b < 4; b++) {
        for(f = 0; f < 3; f++) {
            for(r = 0; r < 10; r++) {
                printf("%2d", tbl[b][f][r]);
            }
            printf("\n");
        }
        b < 3 && (printf("%s\n", lin));
    }
    return 0;
}

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

int main() {

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

  long long int s=0;
  long long int t=0;

  for(long long int i=0; i<n; i++){
    if(b[i] >= a[i]) {
      s+=a[i];
      b[i] = b[i] - a[i];
      if (b[i] >= a[i+1]) {
        s+=a[i+1];
        b[i] = b[i] - a[i];
        a[i+1] = 0;
      } else if (i!= (n-1)){
        a[i+1] = a[i+1] - b[i];
        s+=b[i];
        b[i] = 0;
      } else if(i== (n-1)) {
        s+=b[i];
      }
    } else {
      s+=b[i];
      b[i] = 0;
    }
  }
  cout<<s;
  return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<string>
#include<map>
#include<cmath>
#include<queue>
#include<vector>
//#include<Windows.h>
using namespace std;
#define ll long long int
#define LL ll
#define INF 0x3f3f3f3f
const int maxn = 15;
int n, m;
int p[maxn];
int ans = 0;
int vis[maxn][maxn];
int sz[maxn];
int res[maxn];
int main() {
	scanf("%d %d", &n, &m); 
	memset(sz, 0, sizeof sz);
	memset(vis, 0, sizeof vis);
	memset(res, 0, sizeof res);
	for (int i = 1; i <= m; i++) {
		scanf("%d", &sz[i]);
		for (int j = 1; j <= sz[i]; j++) {
			int tmp;
			scanf("%d", &tmp); vis[i][tmp] = 1;
		}
	}
	for (int i = 1; i <= m; i++) {
		scanf("%d", &p[i]);
	}
	int Max = pow(2, n) - 1;
	
	for (int i = 0; i <= Max; i++) {
		int kz = 1; int tmp = i; int flag = 1;
		while (kz <= n) {
			res[kz] = tmp % 2;
			tmp /= 2;
			kz++;
		}
		for (int j = 1; j <= m; j++) {
			int cnt = 0;
			for (int k = 1; k <= n; k++) {
				if (vis[j][k] && res[k]) cnt++;
			}
			if (cnt % 2 != p[j]) {
				flag = 0; break;
			}
		}
		if (flag) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
const int inf=1e9;
const ll Inf=1e18;
const int mod=0;
int gi() {
    int x=0,o=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
template<typename T> bool chkmax(T &a,T b) { return a<b?a=b,1:0; };
template<typename T> bool chkmin(T &a,T b) { return a>b?a=b,1:0; };
int add(int a,int b) { return a+b>=mod?a+b-mod:a+b; }
int sub(int a,int b) { return a-b<0?a-b+mod:a-b; }
void inc(int &a,int b) { a=(a+b>=mod?a+b-mod:a+b); }
void dec(int &a,int b) { a=(a-b<0?a-b+mod:a-b); }
int a,b,c;
int main() {
    int ans=0;
    cin>>a>>b>>c;
    while(1) {
        if((a&1)||(b&1)||(c&1)) return printf("%d\n",ans),0;
        else if(a==b&&b==c) return puts("-1"),0;
        else {
            ans++;
            int aa=a,bb=b,cc=c;
            a=(bb+cc)/2;b=(aa+cc)/2;c=(aa+bb)/2;
        }
    }
    return 0;
}


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

int f(int n){
	int sum = 0;
	while(n>0){
		sum += n%10;
		n /= 10;
	}
	return sum;
}

int main(){
	int n,a,b;
	cin >> n >> a >> b;
	int ans = 0;
	
	for(int i = 1; i <= n; ++i){
		int anko = f(i); //各桁の和
		if(anko >= a && anko <= b){
			ans += i;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
#define fi first
#define se second
#define endl '\n'
#define y1 holyshit
#define all(x) x.begin(),x.end()
const int inf=0x3f3f3f3f;

int N,d[200010],A[200010],B[200010],cnt[500010];

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>N;
    vector<int> comp;
    for(int i=1;i<=N;i++){
        cin>>d[i];
        A[i]=-d[i]-i;
        B[i]=d[i]-i;
        comp.push_back(A[i]);
        comp.push_back(B[i]);
    }
    sort(all(comp)); comp.erase(unique(all(comp)),comp.end());
    for(int i=1;i<=N;i++){
        A[i]=lower_bound(all(comp),A[i])-comp.begin();
        B[i]=lower_bound(all(comp),B[i])-comp.begin();
        cnt[B[i]]++;
    }
    ll ans=0;
    for(int i=1;i<=N;i++){
        cnt[B[i]]--;
        ans+=cnt[A[i]];
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 8216
#include<iostream>
using namespace std;
int main(void){
    int x,a,b = 0;
    int cnt = 0;
    cin >> x >> a >> b;
    x = x-a;
    do
    {
        x -= b;
    }while (x > 0);
    
    if(x < 0){
        cout << x+b;
    }else{
        cout << x;
    }
    

}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>

int main()
{
  int k, x;
  std::cin >> k >> x;

  const int left = std::max(-1000000, x - k + 1);
  const int right = std::min(1000000, x + k - 1);

  std::cout << left;
  for (int i = left + 1; i <= right; ++i) {
    std::cout << ' ' << i;
  }
}


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

#define ll long long
#define pb push_back
#define mp make_pair
#define ld long double
#define F first
#define S second
#define pii pair<ll,ll> 

using namespace :: std;

const ll mod=1e9+7;
const ll maxn=1e5+500;
const ll inf=1e9+900;

bool is_good(ll h,ll sh,string s,string t){
    for(ll i=0;i<(ll)s.size();i++){
	if(s[i]){
	    sh++;
	}
	if(sh>h)return 1;
	if(t[i] && sh!=1){
	    sh--;
	}
    }	
    return 0;
}
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll h,w,n;
    cin>>h>>w>>n;
    ll sh,sw;
    cin>>sh>>sw;
    string s,t,ss,tt;
    cin>>s>>t;
    ss=s;
    tt=t;
    for(ll i=0;i<n;i++){
	if(s[i]=='D')ss[i]=1;
	else         ss[i]=0;
	
    	if(t[i]=='U')tt[i]=1;
	else         tt[i]=0;
    }
    if(is_good(h,sh,ss,tt)){
	cout<<"NO"<<endl;
	return 0;
    }


    for(ll i=0;i<n;i++){
	if(s[i]=='U')ss[i]=1;
	else         ss[i]=0;
	
    	if(t[i]=='D')tt[i]=1;
	else         tt[i]=0;
    }
    if(is_good(h,h-sh+1,ss,tt)){
	cout<<"NO"<<endl;
	return 0;
    }


    for(ll i=0;i<n;i++){
	if(s[i]=='R')ss[i]=1;
	else         ss[i]=0;
	
    	if(t[i]=='L')tt[i]=1;
	else         tt[i]=0;
    }
    if(is_good(w,sw,ss,tt)){
	cout<<"NO"<<endl;
	return 0;
    }

    for(ll i=0;i<n;i++){
	if(s[i]=='L')ss[i]=1;
	else         ss[i]=0;
	
    	if(t[i]=='R')tt[i]=1;
	else         tt[i]=0;
    }
    if(is_good(w,w-sw+1,ss,tt)){
	cout<<"NO"<<endl;
	return 0;
    }
    cout<<"YES";

}


Measured memory_bytes: 1560
# ABC 088 C - Takahashi's Information
"""
高橋君の提示している条件内では、ai,biが不定でも問題ないことがポイントです。
つまり、cii = ai+biを満たせばよいので、aiをx増やしたらbiをx減らせばciiは同様に成り立ちます。
一般化すると
(𝑎1, 𝑎2, 𝑎3, 𝑏1, 𝑏2, 𝑏3) = (𝑝1, 𝑝2, 𝑝3, 𝑞1, 𝑞2, 𝑞3)から
(𝑎1, 𝑎2, 𝑎3, 𝑏1, 𝑏2, 𝑏3) = (𝑝1 + 𝑥, 𝑝2 +𝑥, 𝑝3 + 𝑥, 𝑞1 − 𝑥, 𝑞2 − 𝑥, 𝑞3 − 𝑥)にしても問題ないです。
この性質を利用して𝑎1 = 0とすると、c11=a1+b1=b1,　c12=a1+b2=b2,　c13=a1+b3=b3
が成立します。b1がわかれば上記と同様にa2,a3はわかります(c21=a2+b1,c31=a3+b1から)。
(1)a = 0として、b1,b2,b3を求める
(2)a2 = c21-b1, a3 = c31-b1からa2,a3を求める
(3)求めたa1~3とb1~3を使ってcijの我が正しいか判定する
"""
C = [list(map(int,input().split())) for __ in range(3)]

a=[0]*3
b=[0]*3
b[0],b[1],b[2]=C[0]
a[0],a[1],a[2]=0,C[1][0]-b[0],C[2][0]-b[0]
flag = True
for i in range(3):
    if flag == False:
        break
    for j in range(3):
        if C[i][j] != a[i]+b[j]:
            print("No")
            flag = False
            break
if flag == True:
    print("Yes")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string KUROE;
  int YUNI, TIERU, OOT = 0;
  int JNY;
  JNY = -1;
  bool COCCOLO = true;
  double PKRN;
  cin >> YUNI >> TIERU;
  
  cout << YUNI * TIERU << endl;
}

Measured memory_bytes: 3624
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <iomanip>

using namespace std;

#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL); 
#define endl "\n"

typedef long long int  ll;
typedef unsigned long long int ull;


int main()
{
	FAST;
	string str[101];
	int r,c;
	cin >> r >> c;

	for(int i=0 ; i<r ; i++)
		cin >> str[i];


	for(int i=0 ; i<r ; i++)
	{
		bool flag = false;
		for(int j=0 ; j<c ; j++)
		{
			if(str[i][j] == '#' )
				flag = true;
		}

		if(!flag)
		{
			for(int j=0 ; j<c ; j++)
			{
				str[i][j] = '1';
			}
		}
	}

	for(int i=0 ; i<c ; i++)
	{
		bool flag = false;
		for(int j=0 ; j<r ; j++)
		{
			if(str[j][i] == '#')
				flag = true;
		}

		if(!flag)
		{
			for(int j=0 ; j<r ; j++)
				str[j][i] = '1';
		}
	}

	for(int i=0 ; i<r ; i++)
	{
		bool flag = true;
		for(int j=0 ; j<c ; j++)
		{
			if(str[i][j] != '1')
			{
				flag = false;
				cout << str[i][j];
			}
		}
		if(!flag)	cout << "\n";
	}
	return 0;
}

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

int main() 
{
    int n;
    cin >> n;
    int x = n;
    int sum = 0;
    while (x!=0)
    {
        sum+=x%10;
        x/=10;
    }
    // cout << sum << endl;
    cout << (n%sum==0?"Yes":"No");    
    return 0;
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func rcvInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	n, m, c := rcvInt(), rcvInt(), rcvInt()

	b := make([]int, m)
	for i := 0; i < m; i++ {
		b[i] = rcvInt()
	}

	var ans, temp int
	for i := 0; i < n; i++ {
		for j := 0; j < m; j++ {
			a := rcvInt()
			temp += a * b[j]
		}
		if temp+c > 0 {
			ans++
		}
		temp = 0
	}

	fmt.Println(ans)
}


Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
//typedef __int64 LL;
//typedef long long int LL;
typedef pair<int,int> P;
//typedef pair<LL,LL> PL;

const int MOD=1000000007;

	
int main()
{
	int h,w;cin>>h>>w;
	int a,b;cin>>a>>b;
	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			if((j<a && i<b)||(j>=a && i>=b))cout<<0;
			else cout<<1;
		}
		cout<<"\n";
	}
	return 0;
}

Measured memory_bytes: 1280
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main(void)
{
    int i;
    int cnt = 0;
    int len;
 
    char W[10];
    char T[1001];
    char *pT;
    
    pT = T;
    
    for(i = 0; i < 10; i++)
    {
        W[i] = '\0';
    }
    for(i = 0; i < 1001; i++)
    {
        T[i] = '\0';
    }
    
    scanf("%s", W);
    


    while(1)
    {
        scanf("%s", T);
        
        if(strstr(T, "END_OF_TEXT" ))
        {
            break;
        }
        
        len = strlen(T);
        //printf("%d\n", len);
        pT = T;

        for(i = 0; i < len; i++)
        {

            //printf("upper %c\n", *pT);
            memset(pT, tolower(*pT), 1);
            //printf("upper %c\n", *pT);
            pT++;
        }
        pT++;
        //printf("%s\n", T);
        
        if(strstr(T, W) && strlen(W) == strlen(T))
        {
            cnt++;
        }
    }
    printf("%d\n", cnt);
    
    return 0;
}

Measured memory_bytes: 552
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
using namespace std;
typedef long long ll;
const ll INF = 1e15;
int main() {
  ll x, y;
  cin >> x >> y;
  ll ans = INF;
  if (x <= y) ans = min(ans, y - x);
  if (-x <= y) ans = min(ans, 1 + y + x);
  if (x <= -y) ans = min(ans, 1 - y - x);
  if (-x <= -y) ans = min(ans, 2 - y + x);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void) {
    int a,b,i;
    char op;
    
    for(i=1;i>0;i++){
        scanf("%d %c %d",&a,&op,&b);
        
        if(op=='+') 
            printf("%d\n",a+b);
        else if(op=='-') 
            printf("%d\n",a-b); 
        else if(op=='*') 
            printf("%d\n",a*b); 
        else if(op=='/')
            printf("%d\n",a/b); 
        else if(op=='?') 
            break; 
    }
    
    return 0; 
    
}


Measured memory_bytes: 2108
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std ;
ll a[100100];
int main()
{
    ios_base::sync_with_stdio(false);
    ll n,x;
    cin>>n>>x;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    ll tot=0;
    for(int i=1;i<n;i++)
    {
            ll t=a[i]+a[i-1];
            if(t>x)
            {
                ll r=t-x;
                tot+=r;
                if(a[i]>=r)
                {
                    a[i]-=r;
                }
                else
                {
                    ll y=r-a[i];
                    a[i]=0;
                    a[i-1]-=y;
                }
            }
    }
    cout<<tot<<endl;
}


Measured memory_bytes: 1024
import java.util.*;
public class Main {
	public static void main(String[] args){
	  Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int ans = 10000000;
      for(int i=1;i<n;i++){
        int j = n - i;
        int tmp = 0;
        tmp += NumOfDigits(i);
        tmp += NumOfDigits(j);
        if(tmp<ans){
          ans = tmp;
        }
        
      }
      System.out.println(ans);
    }
    public static int NumOfDigits(long num){
    int n = NOfDigits(num);
    int sol = 0;
    for(int i=0;i<n;i++){
      sol += (int)( num / Math.pow(10,n-i-1) );
      num %= (long)Math.pow(10,n-i-1);
    }
    return sol;
  }
  
    public static int NOfDigits(long num){
    int n = 1;
    while(true){
      if( num > Math.pow(10,n) ){
        n++;
      }else{
        break;
      }
    }
    return n;
  }
}

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

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int N;
int A[210000];

signed main() {
    cin >> N;
    int sum = 0;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    for (int i = 1; i < N; i++) {
        A[i] += A[i - 1];
    }
    int ans = LLONG_MAX;
    for (int i = 2; i <= N - 2; i++) {
        int a = lower_bound(A, A + i, A[i - 1] / 2) - A;
        int x = A[a];
        if (a != 0 && abs(A[a] - (A[i - 1] - A[a])) > abs(A[a - 1] - (A[i - 1] - A[a - 1]))) {
            x = A[a - 1];
        }
        int b = lower_bound(A + i, A + N, (A[N - 1] - A[i - 1]) / 2 + A[i - 1]) - A;
        int y = A[b];
        if (b != i && abs((A[b] - A[i - 1]) - (A[N - 1] - A[b])) > abs((A[b - 1] - A[i - 1]) - (A[N - 1] - A[b - 1]))) {
            y = A[b - 1];
        }
        int up = max(max(x, A[i - 1] - x), max(y - A[i - 1], A[N - 1] - y));
        int down = min(min(x, A[i - 1] - x), min(y - A[i - 1], A[N - 1] - y));
        ans = min(ans, up - down);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
using System;

class BetweenAAndB {
    static void Main() {
        string input = Console.ReadLine();

        long begin_value  = long.Parse(input.Split(' ')[0]);
        long end_value    = long.Parse(input.Split(' ')[1]);
        long divide_value = long.Parse(input.Split(' ')[2]);

        long zero_to_begin_answer = Division1(begin_value - 1, divide_value);
        long zero_to_end_answer   = Division1(end_value, divide_value);

        long answer = zero_to_end_answer - zero_to_begin_answer;

        Console.WriteLine(answer);
    }

    static long Division1(long l1, long l2) {
        if (l1 < 0)
            return 0;
        return l1 / l2 + 1;
    }
    
}

Measured memory_bytes: 2648
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <cstdio>
#include <cmath>

using namespace std;

int main(){
    int n;
  cin>>n;
  if(n==1){
	cout<<1;
  }else if(n<4){
    cout<<2;
  }else if(n<8){
	cout<<4;
  }else if(n<16){
    cout<<8;
  }else if(n<32){
    cout<<16;
  }else if(n<64){
    cout<<32;
  }else{
    cout<<64;
  }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int x;
	int h,m,s;
	scanf("%d",&x);
	
	h = x/3600;
	m = (x - 3600*h)/60;
	s = x - h*3600 - m*60;
	
	printf("%d:%d:%d\n",h,m,s);


return 0;
}

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

int main()
{
   char s[200][200];
   int i,n,j,m;
   while(~scanf("%d %d\n",&n,&m))
   {
       for(i=0;i<n;i++)
       {
           for(j=0;j<m;j++)
           {
               scanf("%c",&s[i][j]);
           }
           getchar();
       }
       for(i=0;i<n;i++)
       {
           for(j=0;j<m;j++)
           {
               printf("%c",s[i][j]);
           }
           printf("\n");
           for(j=0;j<m;j++)
           {
               printf("%c",s[i][j]);
           }
           printf("\n");
       }
   }
    return 0;
}

Measured memory_bytes: 1632
def main():
    import sys
    input = sys.stdin.readline
    s = str(input().rstrip())
    q =int(input())
    ten = 0
    r = []
    l = []
    la = l.append
    ra =r.append
    for _ in range(q):
        ls = tuple(map(str, sys.stdin.readline().split()))
        if len(ls)==1:
            ten +=1
        else:
            if ls[1] =='1':
                if ten%2 ==0:
                    la(ls[2])
                else:
                    ra(ls[2])
            else:
                if ten%2 ==1:
                    la(ls[2])
                else:
                    ra(ls[2])
    s = ''.join(reversed(l))+s+''.join(r)
    if ten%2 ==1:
        s = s[::-1]
    print(s)
if __name__ == '__main__':
    main()

Measured memory_bytes: 12280
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;

#define INF (1e9)

int N, T;

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

    vi A(N), B(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i] >> B[i];  // A:time, B:score
    }

    vvvi dp(N + 10, vvi(T + 10, vi(2, 0)));

    for (int i = 0; i < N; ++i) {
        for (int t = 0; t <= T; ++t) {
            vi x = dp[i][t];  // 1.食べない
            vi y(2);
            y[0] = dp[i][t][0], y[1] = B[i];  // 2.時間外に食べる
            if (x[0] + x[1] > y[0] + y[1]) {
                dp[i + 1][t] = x;
            } else {
                dp[i + 1][t] = y;
            }

            if (t >= A[i]) {  // i番目食べられる
                vi z(2);
                z[0] = dp[i][t - A[i]][0] + B[i], z[1] = dp[i][t - A[i]][1];  // 3.時間内に食べる
                if (dp[i + 1][t][0] + dp[i + 1][t][1] <= z[0] + z[1]) {
                    dp[i + 1][t] = z;
                }
            }
        }
    }

    cout << dp[N][T - 1][0] + dp[N][T - 1][1] << endl;
    return 0;
}


Measured memory_bytes: 498048
#include<stdio.h>

int main(void)
{
  int n,s,i;double sa;
  scanf("%d",&n);
  s=100;sa=100;
  for(i;i<n;i++)
    if((s*=1.05)!=(sa*=1.05)){
      s+=1;sa=s;
    }
  s*=10*10*10;
  printf("%d\n",s);
  return(0);
}
    
      

Measured memory_bytes: 588
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vp;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin() , v.end()
#define inputv(v,n) rep(i,n){\
    ll x;\
    cin>>x;\
    v.push_back(x);\
    }
const ll INF=99999999999999;
const ll MOD=1000000007;
 
int main() {
 ll a,b;
  cin >> a >> b;
  if(b==1){
    cout << 0;
    return 0;
  }
  rep(i,100){
    if(((i+1)*a - i) >= b){
      cout << i+1;
      return 0;
    }
  }
}


Measured memory_bytes: 256