akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<climits>
#include<cmath>
#include<functional>

using namespace std;

int main() {
   int N;
   cin >> N;
   int a[ N ];
   long long total = 0;
   for( int i = 0; i < N; i++ ) {
      cin >> a[ i ];
      total += a[ i ];
   }

   /*long long *** dp = ( long long *** ) malloc( sizeof( long long *** ) * 2 );
   for( int i = 0; i < 2; i++ ) {
      dp[ i ] = ( long long ** ) malloc( sizeof( long long ** ) * N );
      for( int j = 0; j < N; j++ ) {
         dp[ i ][ j ] = ( long long * ) malloc( sizeof( long long * ) * N );
         for( int k = 0; k < N; k++ ) {
            dp[ i ][ j ][ k ] = LONG_MAX;
         }
      }
   }

   function< long long( int, int, int )> getDp;
   getDp = [ & ]( int t, int i, int j ) -> long long {
      if( i == j ) {
         return t == 0 ? a[ i ] : 0;
      }
      if( dp[ t ][ i ][ j ] != LONG_MAX ) {
         return dp[ t ][ i ][ j ];
      }
      auto val1 = getDp( 1 - t, i + 1, j );
      auto val2 = getDp( 1 - t, i, j - 1 );
      if( t == 0 ) {
         if( val1 + a[ i ] > val2 + a[ j ] ) {
            dp[ t ][ i ][ j ] = a[ i ] + val1 ;
         } else {
            dp[ t ][ i ][ j ] = a[ j ] + val2 ;
         }
      } else {
         dp[ t ][ i ][ j ] = min( val1, val2 );
      }
      return dp[ t ][ i ][ j ];
   };
   auto x = getDp( 0, 0, N - 1 );
   cout << ( x - total + x );
   */

   // can be made better by considering only A and coputing B's outcome at A's
   // recursion
   // A: ( i, j )
   //             B: (i+1, j)
   //                            A: (i+2, j)
   //                            A: (i+1, j-1)
   //             B: (i, j-1 )
   //                            A:(i+1, j-1)
   //                            A:(i, j-2)
   long long ** dp2 = ( long long ** ) malloc( sizeof( long long ** ) * N );
   for( int i = 0; i < N; i++ ) {
      dp2[ i ] = ( long long * ) malloc( sizeof( long long * ) * N );
      for( int j = 0; j < N; j++ ) {
         dp2[ i ][ j ] = LONG_MAX;
      }
   }
   function< long long( int, int )> getDp2;
   getDp2 = [ & ]( int i, int j ) -> long long {
      if( i == j ) {
         return a[ i ];
      }
      if( i + 1 == j ) {
         return max( a[ i ], a[ j ] );
      }
      if( i + 2 == j ) {
         return max( a[ i ] + min( a[ i + 1 ], a[ j ] ),
                     min( a[ i ], a[ i + 1 ] ) + a[ j ] );
      }
      if( dp2[ i ][ j ] != LONG_MAX ) {
         return dp2[ i ][ j ];
      }
      //Computing B(i+1, j)
      auto x = min( getDp2( i + 2, j ), getDp2( i + 1, j - 1 ) );
      //Computing B(i, j-1)
      auto y = min( getDp2( i + 1, j - 1 ), getDp2( i, j - 2 ) );
      if( x + a[ i ] > y + a[ j ] ) {
         dp2[ i ][ j ] = x + a[ i ];
      } else {
         dp2[ i ][ j ] = y + a[ j ];
      }
      return dp2[ i ][ j ];
   };

   auto x = getDp2( 0, N - 1 );
   cout << ( x - total + x );
   return 0;
}


Measured memory_bytes: 70784
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iterator>
#include <functional>
#include <numeric>
using namespace std;

#define ll long long
#define forn(i,n)for(i=0;i<n;i++)
#define forc(i,c,n)for(i=c;i<=n;i++)
typedef list<ll> LST;
typedef vector<ll> VEC;
typedef map<ll, ll> MAP;


int main() {
	ifstream fin("Text.txt");
	int i, j, k;
	ll a, b,t, c, e, n,x,y, m, r, d, q,ans=0;
	cin >> n;
	t = 0;
	forn(i, n) {
		cin >> a;
		if (a == i + 1) {
			t++;
		}
		else {
			ans += (t + 1) >> 1;
			t = 0;
		}
	}
	ans += (t + 1) >> 1;

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

Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Data.List

ds2int :: [Int] -> Int
ds2int = read . concatMap show

main :: IO ()
main = do
    [n, _] <- fmap read . words <$> getLine :: IO [Int]
    ds <- fmap read . words <$> getLine :: IO [Int]

    let cs = [0 .. 9] \\ ds
    let c  = head $ dropWhile (== 0) cs
    let a1 = c : replicate 4 (if 0 `elem` cs then 0 else c)

    let cs' = concatMap show cs
    let f x = all (`elem` cs') (show x)
    let a2 = filter f [n .. 9999]

    if null a2
        then print $ ds2int a1
        else print $ head a2

Measured memory_bytes: 1020
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
using namespace std;
using ll = long long;
using vl = vector<long long>;
using vs = vector<string>;
using ii = vector<vector<long long>>;
int main() {
    ll n, k;
    cin >> n >> k;
    vl hp(n);
    for (int i = 0; i < n; i++) {
        cin >> hp[i];
    }
    bool a = true;
    sort(hp.begin(), hp.end());
    if (k >= n) {
        cout << 0 << endl;
        a = false;
    }
    ll count = 0;
    if (a) {
        for (int i = 0; i < n - k; i++) {
            count += hp[i];
        }
        cout << count << endl;
    }
}

Measured memory_bytes: 4840
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;


class Main {
    public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    public static PrintWriter pw = new PrintWriter(System.out);
    public static String line;
    public static StringTokenizer st;
    public static ArrayList<ArrayList<Pair>> adjList;
    public static int[] dx = {-1, 0, 1, 0, -1, 1, 1, -1};
    public static int[] dy = {0, 1, 0, -1, 1, 1, -1, -1};
    public static int INF = 0x3f3f3f3f;
    public static long LINF = 0x3f3f3f3f3f3f3f3fL;
    public static int MOD = 1000000007;

    public static void main(String[] args) throws Exception{
        int N = Integer.parseInt(br.readLine());
        st = new StringTokenizer(br.readLine());
        int[] A = new int[N];
        long total = 0;
        for(int i = 0; i < N; i++){
            A[i] = Integer.parseInt(st.nextToken());
            total += A[i];
        }
        long ans = LINF;
        long a = 0;
        for(int i = 0; i < N - 1; i++){
            a += A[i];
            long b = total - a;
            ans = Math.min(ans, Math.abs(a - b));
        }

        pw.print(ans + "\n");



        pw.close(); 
        br.close();
    }
}

class Pair {
    public int a;
    public long b;

    Pair(int a, long b){
        this.a = a;
        this.b = b;
    }

}

Measured memory_bytes: 48988
#[allow(dead_code)]
fn is_whitespace(c: &char) -> bool {
    c.is_whitespace()
}

#[allow(dead_code)]
fn is_eol(c: &char) -> bool {
    ['\r', '\n'].contains(c)
}

#[allow(unused_macros)]
macro_rules! input {
    ($var:ident, $($r:tt)*) => {
        input_inner!{$var, $($r)*}
    };

    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        #[allow(unused_mut, unused_variables, bare_trait_objects)]
        let mut next = move |f: &Fn(&char)->bool| -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|f(&c))
                .take_while(|c|!f(&c))
                .collect()
        };
        input_inner!{next, $($r)*};
    };
}

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

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

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

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

    ($next:expr, [ $t:tt ; eol ]) => {
        $next(&is_eol).split(' ').map(|x| x.parse::<$t>().unwrap()).collect::<Vec<_>>()
    };

    ($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, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

    ($next:expr, parser) => {
        $next
    };

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

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap};

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;
#[allow(dead_code)]
const M: usize = 1e9 as usize + 9;

fn main() {
    input! {
        n: usize,
        s: chars,
    }

    let mut c = 0;
    for i in 0..s.len() - 2 {
        if s[i..i + 3].iter().cloned().collect::<String>() == "ABC" {
            c += 1;
        }
    }
    println!("{}", c);
}


Measured memory_bytes: 4352
// 上限値を見ていなかった
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();

        int k = sc.nextInt();

        long sum = 0;
        for (int i = 1; i <= k; i++) {
            for (int j = 1; j <= k; j++) {
                for (int l = 1; l <= k; l++) {
                    long tmp = gcd(i, j);
                    sum += gcd(l, tmp);
                }
            }
        }

        System.out.println(sum);
    }

    public static long gcd(long a, long b) {
        long max = Math.max(a, b);
        long min = Math.min(a, b);

        long re = max % min;
        if (re == 0)
            return min;
        return gcd(min, re);
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }

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

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

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

int main() {
  int N = 0, A = 0;
  
  cin >> N >> A;
  N %= 500;
  
  if ( N <= A ) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
import scala.io.StdIn
import Math.{abs,pow,sqrt,cbrt}
/**
  * AOJ
  */

sealed trait Side

object Up extends Side
object North extends Side
object East extends Side
object West extends Side
object South extends Side
object Under extends Side

object Main {

  def main(args: Array[String]): Unit = {

    val diceMap = List(Up,North,East,West,South,Under).zip(StdIn.readLine().split(" ").map(_.toInt)).toMap
    val cmdList = StdIn.readLine().toCharArray
    println(cmdList.foldLeft(diceMap){(x,y) => getNextStatus(y,x)}(Up))
  }

  def getNextStatus(cmd:Char,dice:Map[Side,Int]): Map[Side,Int] = {
    cmd match {
      case 'E' => Map(Up -> dice(West),North -> dice(North),East -> dice(Up),West -> dice(Under),South -> dice(South),Under -> dice(East))
      case 'N' => Map(Up -> dice(North),North -> dice(Under),East -> dice(East),West -> dice(West),South -> dice(Up),Under -> dice(South))
      case 'S' => Map(Up -> dice(South),North -> dice(Up),East -> dice(East),West -> dice(West),South -> dice(Under),Under -> dice(North))
      case 'W' => Map(Up -> dice(East),North -> dice(North),East -> dice(Under),West -> dice(Up),South -> dice(South),Under -> dice(West))
    }
  }
}

Measured memory_bytes: 44328
import java.util.HashSet;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int N = sc.nextInt();
            int[] A = new int[N];
            for (int i = 0; i < N; i++) {
                A[i] = sc.nextInt();
            }

            HashSet<Integer> set = new HashSet<Integer>();
            for (int i = 0; i < N; i++) {
                set.add(A[i]);
            }

            System.out.println(set.size() == N ? "YES" : "NO");
        }
    }
}

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

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

vector<int>Z_Algorithm(const string&s) {
    int n=s.size();
    vector<int>z(n);
    int l = 0, r = 0;
    for (int i=1; i<n; i++) {
	if (i > r) {
	    l = r = i;
	    while (r<n && s[r-l] == s[r]) r++;
	    z[i] = r-l; r--;
	} else {
	    int k = i-l;
	    if (z[k] < r-i+1) z[i] = z[k];
	    else {
		l = i;
		while (r<n && s[r-l] == s[r]) r++;
		z[i] = r-l; r--;
	    }
	}
    }
    return z;
}
char buf[500011];
string S, T;

int nxt[61][500011];

void MAIN() {
    scanf("%s", buf);
    S = buf;
    scanf("%s", buf);
    T = buf;

    string g = T + S + S;
    while (g.size() < 2*T.size() + S.size()) g += S;

    memset(nxt, -1, sizeof nxt);
    VI Z = Z_Algorithm(g);
    REP (i, S.size()) {
	if (Z[T.size()+i] >= (int)T.size()) {
	    nxt[0][i] = (i + T.size()) % S.size();
	}
    }

    REP (t, 60) REP (i, S.size()) {
	int a = nxt[t][i];
	if (a >= 0) {
	    nxt[t+1][i] = nxt[t][nxt[t][i]];
	}
    }

    REP (i, S.size()) if (nxt[60][i] >= 0) {
	puts("-1");
	return;
    }
    LL ans = 0;
    REP (i, S.size()) {
	LL tmp = 0;
	int pos = i;
	for (int t=61; t--;) if (nxt[t][pos] >= 0) {
	    pos = nxt[t][pos];
	    tmp += 1LL<<t;
	}

	amax(ans, tmp);
    }

    printf("%lld\n", ans);
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 130604
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <iomanip>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <complex>
#include <ctime>


using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(ll i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

using Graph = vector<vector<ll>>;

#define ketasitei setprecision(15) //15桁表示

const ll MOD = 1000000007;
const double PI = 3.1415926535897932;

const long long TIME_LIMIT=10000;

ll scorecalc(vector<vector<ll>> a, vector<ll> los, ll d, vector<ll> an)
{
    ll ans = 0;
    
    vector<ll> last(los.size(), 0);
    for (int i = 0; i < an.size(); i++)
    {
        ll loss = 0;
        for (int j = 0; j < 26; j++)
        {
            if (j == an[i] - 1)
                continue;

            loss += los[j] * (i+1LL - last[j]);
        }
        ans += a[i][an[i] - 1] - loss;
        last[an[i] - 1] = i + 1LL;
    }

    return ans;
}

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

    ll d;
    cin >> d;
    vector<ll> c(26);
    rep(i, 26)
    {
        cin >> c[i];
    }
    vector<vector<ll>> s(d, vector<ll>(26));
    rep(i, d)
    {
        rep(j, 26)
            cin >> s[i][j];
    }

    vector<ll> ans(d);

    vector<ll> last(26, 0);

    for (ll i = 0; i < d; i++)
    {
        ll lost = 0;
        for (int j = 0; j < 26; j++)
        {
            lost += c[j] * (i + 1 - last[j]);
        }
        ll man = s[i][0] - lost + c[0] * (i + 1 - last[0]);
        ll manu = 1;
        for (int j = 0; j < 26; j++)
        {
            if (man <= s[i][j] - lost + c[j] * (i + 1 - last[j]))
            {
                man = s[i][j] - lost + c[j] * (i + 1 - last[j]);
                manu = j + 1LL;
                last[j] = i + 1;
            }
        }
        ans[i] = manu;
    }
    ll score = scorecalc(s, c, d, ans);
    ll times = 0;
    while (times < 70000)
    {
        ll tmpD = (ll)rand() % d;
        ll tmpN = ans[tmpD];
        ans[tmpD] = (ll)rand() % 26 + 1;

        if (score >= scorecalc(s, c, d, ans))
            ans[tmpD] = tmpN;
        else
            score = scorecalc(s, c, d, ans);

        times++;
    }

    rep(i, d)
    {
        cout << ans[i] << endl;
    }

	return 0;

}

Measured memory_bytes: 3868
#include <stdio.h>

int main(void)
{
    int i, j, H, W;
    
    while (1){

        scanf("%d %d", &H, &W);

        if (H == 0 && W ==0)
            break;

        for (i = 0; i < H; ++i ){
            for (j = 0; j < W; ++j)
                printf("#");
        
            printf("\n");
        }
        
    printf("\n");
 
    }  

    return 0;

}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
using namespace std;

int main(){
    int n,c=0;
    cin>>n;
    vector<int> a(n),b(n);
    rep(i,n){
        cin>>a[i];
        b[i] = i+1;
        if (a[i]!=b[i]) c++;
    }
    if (c==0 || c==2) {
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

typedef long long ll;

const int N=3e3+5,Mo=1e9+7,i2=Mo+1>>1;

int n,q,a[N],x,y;
ll f[N][N],g[N][N];

int main() {
	scanf("%d%d",&n,&q);
	fo(i,1,n) scanf("%d",&a[i]);
	fo(i,1,n) fo(j,1,n) f[i][j]=a[i]>a[j];
	ll pw=1;
	for(;q;q--) {
		scanf("%d%d",&x,&y);
		if (x>y) swap(x,y);

		fo(i,1,n) {
			if (i==x||i==y) continue;
			f[x][i]=f[y][i]=(f[x][i]+f[y][i])*i2%Mo;
			f[i][x]=f[i][y]=(f[i][x]+f[i][y])*i2%Mo;
		}
		f[x][y]=f[y][x]=(f[x][y]+f[y][x])*i2%Mo;

		pw=(pw<<1)%Mo;
	}
	ll ans=0;
	fo(i,1,n) fo(j,i+1,n) (ans+=f[i][j]*pw)%=Mo;
	printf("%lld\n",(ans+Mo)%Mo);
	return 0;
}

Measured memory_bytes: 71552
//#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<list>
using namespace std;

typedef long long ll;

#define MOD 1000000007

class Comb{
private:
  ll *fac,*finv,*inv;
public:
  Comb(){
    fac = new ll[1000000];
    finv = new ll[1000000];
    inv = new ll[1000000];
    fac[0] = 1;
    for(int i=1;i<1000000;i++){
      fac[i] = i*fac[i-1];
      fac[i] %= MOD;
    }
    inv[1] = 1;
    for(int i=2;i<1000000;i++){
      inv[i] = MOD-inv[MOD%i]*(MOD/i)%MOD;
    }
    finv[0] = 1;
    for(int i=1;i<1000000;i++){
      finv[i] = inv[i]*finv[i-1];
      finv[i] %= MOD;
    }
  }
  ll calc(ll n,ll k){
    ll c = fac[n];
    c *= finv[k];c %= MOD;
    c *= finv[n-k];c %= MOD;
    return c;
  }
};

int main(){
  int s,w;
  cin >> s >> w;
  if(s <= w) cout << "unsafe" << endl;
  else cout << "safe" << endl;
  return 0;
}


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

int main()
{
    std::string s;
    std::cin >> s;

    std::string y = s.substr(0, 4);
    std::string m = s.substr(5, 2);
    std::string d = s.substr(8, 2);
    int yyyy = std::stoi(y);
    int mm = std::stoi(m);
    int dd = std::stoi(d);

    std::string ans = "Heisei";
    if (yyyy > 2019) {
        ans = "TBD";
    }
    else if (yyyy == 2019 && mm > 4) {
        ans = "TBD";
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// マクロ
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
// 型エイリアス
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vvs = vector<vs>;

int main() {
    int n;
    cin >> n;
    vi a(n);
    rep(i,n) cin >> a[i];
    vi b(100002, 0);
    for(int i = 0; i < n; i++) {
        b[a[i]] += 1;
        b[a[i] + 1] += 1;
        b[a[i] + 2] += 1;
    }
    sort(b.rbegin(), b.rend());
    cout << b[0] << endl;
}

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

long long int N, x, y, h;
vector<tuple<long long, long long, long long>> info;

int main(){
    scanf("%lld", &N);
    for(int i = 0; i < N; ++i){
        scanf("%lld%lld%lld", &x, &y, &h);
        info.emplace_back(h, x, y);
    }
    sort(info.rbegin(), info.rend());
    long long tx, ty, th;
    tie(th, tx, ty) = info[0];
    for(x = 0; x < 101; ++x){
        for(y = 0; y < 101; ++y){
            h = abs(x - tx) + abs(y - ty) + th;
            if(h <= 0)continue;
            for(auto i : info){
                tie(th, tx, ty) = i;
                if(max(h - abs(x - tx) - abs(y - ty), 0LL) != th)goto label;
            }
            cout << x << " " << y << " " << h << endl;
            return 0;
            label:
            continue;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>

// #define int long long int
constexpr int INF = std::numeric_limits<int>::max();
constexpr int NINF = std::numeric_limits<int>::min();
using namespace std;

void solve() {
  int N, H;
  cin >> N >> H;

  int A = 0;
  vector<int> B(N);
  for (int &b : B) {
    int a;
    cin >> a >> b;
    A = max(a, A);
  }

  sort(B.begin(), B.end(), std::greater<int>());
  int i = 0;
  while (H > 0 && B[i] > A) {
    H -= B[i];
    i++;
  }
  H = max(0, H);

  i += (H + (A - 1)) / A;
  cout << i << endl;
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}


Measured memory_bytes: 640
s = list(input())
l = len(s)
maru = 0
batu = 0
for a in s:
    if a == "o":
        maru += 1
    else:
        batu += 1
nokori = 15-l
if (nokori+maru)>=8:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 2940
def dfs(v):
    cnt = [0, 0]
    if v < OFFSET:
        cnt[0] += 1
    else:
        cnt[1] += 1
    visited[v] = True
    stack = [v]
    while stack:
        v = stack.pop()
        for nxt_v in graph[v]:
            if visited[nxt_v]:
                continue
            if nxt_v < OFFSET:
                cnt[0] += 1
            else:
                cnt[1] += 1
            visited[nxt_v] = True
            stack.append(nxt_v)
    return cnt[0] * cnt[1]

n = int(input())
info = [list(map(int, input().split())) for i in range(n)]
OFFSET = 10 ** 5

graph = [[] for i in range(2 * OFFSET)]
for x, y in info:
    x -= 1
    y -= 1
    y += OFFSET
    graph[x].append(y)
    graph[y].append(x)

ans = 0
visited = [False] * (2 * OFFSET)
for v in range(2 * OFFSET):
    if visited[v]:
        continue
    else:
        ans += dfs(v)
print(ans - n)

Measured memory_bytes: 81956
import copy
N = int(input())
A = [int(i) for i in input().split()]
A=list(set(A))
A.sort()

while True:
    B=copy.deepcopy(A)
    for i in range(1, len(A)):
        A[i] = A[i] % A[0] if not A[i] % A[0] ==0 else A[i]

    if B==A or len(A)==1:
        print(min(A))
        exit(0)
    A = list(set(A))
    A.sort()


Measured memory_bytes: 92260
x, y = map(int, input().split())
mod = 10**9 + 7
if (x + y) % 3:
    print(0)
    exit()
n = (x + y) // 3
a = (2 * y - x) // 3
b = (2 * x - y) // 3
if a < 0 or b < 0:
    print(0)
    exit()
if a == 0 or b == 0:
    print(1)
    exit()


def neko(n, r):
    if n < r:
        return 0
    if n < 0 or r < 0:
        return 0
    r = min(n - r, r)
    ans = 1
    inv = [1] * (r + 1)
    if r >= 1:
        ans *= (n - r + 1) % mod
    for i in range(2, r + 1):
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        ans = ans * (n - r + i) * inv[i] % mod
    return ans


r = min(a, b)
print(neko(n, r))


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

int main(){
  int N;
  cin >> N;
  int n = N / 1000;
  // もし1000円札で払い切れなかった場合は1000円札を余分に1まい出す必要がある
  if (N % 1000 != 0) n++;
  // お釣りを計算
  cout << 1000*(n) - N << endl;
}


Measured memory_bytes: 3532
#include <stdio.h>
int main(void){
int W,H,i,j;
    while(1){
        scanf("%d %d",&H,&W);
        if(H==0&&W==0){
            break;
        }
for ( i = 0; i < H; i++ ){
    for ( j = 0; j < W; j++ ){
        if(i==0||i==H-1){
            printf("#");
        }
        else if(j==0||j==W-1) {
            printf("#");
        }
                  else{
                      printf(".");
    }
    }
    printf("\n");
}
        printf("\n");
    }
return 0;
}

Measured memory_bytes: 572
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def root(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.root(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.root(x)
        y = self.root(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.root(x)]

    def is_same(self, x, y):
        return self.root(x) == self.root(y)

    def members(self, x):
        root = self.root(x)
        return [i for i in range(self.n) if self.root(i) == root]

    def all_roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


n, m, k = map(int, input().split())
uf = UnionFind(n)
ab = [tuple(map(int,input().split())) for i in range(m)]
cd = [tuple(map(int,input().split())) for i in range(k)]
es1 = [[] for i in range(n)]
for i, (a,b) in enumerate(ab):
    a,b = a-1,b-1
    es1[a].append(b)
    es1[b].append(a)
    uf.union(a,b)

es_block_in_union = [[] for i in range(n)]
for i, (c,d) in enumerate(cd):
    c,d = c-1,d-1
    if uf.is_same(c,d):
        es_block_in_union[c].append(d)
        es_block_in_union[d].append(c)


ans = [0]*n
for i in range(n):
    ans[i] =  uf.size(i) - len(es_block_in_union[i])  - len(es1[i]) -1

print(*ans, sep=' ')


Measured memory_bytes: 73796
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main{
    public static void main(String[] args){
        int n = 0;
        int[] d = null;
        int[] b = new int[101];
        try{
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            String s = reader.readLine();
            n = Integer.parseInt(s);
            d = new int[n];
            for(int i=0;i<n;i++){
                d[i] = Integer.parseInt(reader.readLine());
            }
        } catch (IOException e){
            e.printStackTrace();
        }
        int c=0;
        for(int i=0;i<n;i++){
            b[d[i]]++;
            if(b[d[i]] == 1){
                c++;
            }
        }
        System.out.println(c);
    }
}

Measured memory_bytes: 22484
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;
 
const static int tx[] = {0,1,1,1,0,-1,-1,-1};
const static int ty[] = {-1,-1,0,1,1,1,0,-1};
 
static const double EPS = 1e-8;


int num_of_notes;
int num_of_beauty;
ll force_of_repulsion;
ll sum[200001];
ll dp[2001][2001];
int notes[2001];
ll beauty[100001];

ll compute(int i,int j){
  ll lhs = sum[notes[i]];
  ll rhs = (notes[j] - 1 < 0 ? 0 : sum[notes[j] - 1]);

  return (lhs - rhs) / force_of_repulsion;
}

int main(){
  while(~scanf("%d %d %lld",
               &num_of_notes,
               &num_of_beauty,
               &force_of_repulsion)){

    for(int note_idx = 0; note_idx < num_of_notes; note_idx++){
      scanf("%d",notes + note_idx);
      notes[note_idx]--;
    }

    memset(sum,0,sizeof(sum));

    for(int beauty_idx = 0; beauty_idx < num_of_beauty; beauty_idx++){
      scanf("%d",beauty + beauty_idx);
      sum[beauty_idx] = (beauty_idx - 1 >= 0 ? sum[beauty_idx - 1] : 0) + beauty[beauty_idx];
    }

    sort(notes,notes + num_of_notes);
    reverse(notes,notes + num_of_notes);

    memset(dp,0x3f,sizeof(dp));

    dp[0][0] = 0;
    for(int i=0;i<num_of_notes;i++){
      int next = i + 1;
      for(int j=0;j<=i;j++){
        dp[next][j]
          = min(dp[next][j],dp[i][j] + compute(i,next));

        dp[next][i]
          = min(dp[next][i],dp[i][j] + compute(j,next));
      }
    }

    ll res = LINF;
    for(int i=0;i<num_of_notes;i++){
      res = min(dp[num_of_notes - 1][i] + compute(i,num_of_notes - 1),res);
    }
    
    printf("%lld\n",res);
  }
}

Measured memory_bytes: 34844
const N=parse(Int,readline())
const U=Int[]
const V=Int[]
const G=[Int[] for _=1:N]
for i=1:N-1
	u,v=map(x->parse(Int,x),split(readline()))
	push!(U,u)
	push!(V,v)
	push!(G[u],v)
	push!(G[v],u)
end
const depth=zeros(Int,N)
const subtree=zeros(Int,N)
function dfs(u,p,d)
	depth[u]=d
	subtree[u]=2^u
	for v=G[u]
		if v!=p
			subtree[u]+=dfs(v,u,d+1)
		end
	end
	subtree[u]
end
dfs(1,0,0)
const M=parse(Int,readline())
const check=zeros(Int,N-1)
for i=1:M
	a,b=map(x->parse(Int,x),split(readline()))
	test=2^a+2^b
	for j=1:N-1
		w=depth[U[j]]<depth[V[j]] ? V[j] : U[j]
		x=test&subtree[w]
		if x!=test&&x!=0
			check[j]+=2^(i-1)
		end
	end
end
function main()
	ans=0
	for i=0:2^M-1
		cnt=N-1
		for j=1:N-1
			if (check[j]&i)!=0
				cnt-=1
			end
		end
		now=2^cnt
		parity=0
		for j=0:M-1
			if (i>>j)%2==1
				parity+=1
			end
		end
		ans+=parity%2==0 ? now : -now
	end
	println(ans)
end
main()


Measured memory_bytes: 173336
#if defined(LOCAL)
// #define RANDOM_TEST
#define PROBLEM_NAME "E"
const double _max_double_error = 1e-9;
#include "testutils.h"
#endif
#include <bits/stdc++.h>

using namespace std;

using vi = vector<int>; using vvi = vector<vi>;
using ii = pair<int,int>; using vii = vector<ii>;
using l = long long; using vl = vector<l>; using vvl = vector<vl>;
using ll = pair<l,l>; using vll = vector<ll>; using vvll = vector<vll>;
using lu = unsigned long long;
using vb = vector<bool>; using vvb = vector<vb>;
using vd = vector<double>; using vvd = vector<vd>;
using mll = unordered_map<l, l>;
const l INF = numeric_limits<int>::max();
const double EPS = 1e-10; static constexpr auto PI = acos(-1);
const l e0=1, e3=1000, e5=100000, e6=10*e5, e7=10*e6, e8=10*e7, e9=10*e8;
const char lf = '\n';
#define all(x) begin(x), end(x)
#define F(a,b,c) for (l a = l(b); a < l(c); a++)
#define B(a,b,c) for (l a = l(b); a > l(c); a--)

#if defined(LOCAL)
bool local = true;
#define L(x...) debug(x)
#else
bool local = false;
#define L(x, ...) (x)
#endif
struct VoidStream { void operator&(std::ostream&) { } };
#define LOG !(local) ? (void) 0 : VoidStream() & cerr

bool on_border(l x, l y, l R, l C) {
  return (x == 0) or (x == R) or (y == 0) or (y == C);
}

l position(l x, l y, l R, l C) {
  if (y == 0) return x;
  if (x == R) return y + R;
  if (y == C) return 2 * R - x + C;
  return 2 * R + 2 * C - y;
}

void solve(istream& cin, ostream& cout) {
  l R, C, N;
  while (cin >> R >> C >> N) {
    vll border;
    F(i, 0, N) {
      l x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
      if (on_border(x1, y1, R, C) and on_border(x2, y2, R, C)) {
        l from = position(x1, y1, R, C);
        l to = position(x2, y2, R, C);
        border.emplace_back(from, i);
        border.emplace_back(to, i);
      }
    }
    sort(all(border));
    stack<l> s;
    for (auto b : border) {
      if (not s.empty() and s.top() == b.second) {
        s.pop();
      } else {
        s.push(b.second);
      }
    }
    cout << (s.empty() ? "YES" : "NO") << lf;
  }
}

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  cout << fixed << setprecision(15);
#if defined(LOCAL)
  maybe_run_tests(cin, cout);
#else
  solve(cin, cout);
#endif
}


Measured memory_bytes: 6384
#include<iostream>

using namespace std;

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

Measured memory_bytes: 3624
#include "bits/stdc++.h"
#define PRECISION(x) cout << fixed << setprecision(x)
#define FAST_IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define ALLR(X) (X).rbegin(), (X).rend()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define F first
#define S second

using namespace std;

template<class T> void max_self(T & a, const T & b) { if(a < b) a = b; }
template<class T> void min_self(T & a, const T & b) { if(a > b) a = b; }
typedef long long LL;
const int INF = 1e9 + 7;
const double PI = acos(-1.0);
const double EPS = (1e-9);


int main(){
  FAST_IO  

  LL a = 2, b = 1, N, c;
  cin >> N;

  for(int rep = 0; rep < N - 1; ++rep){
    c = a + b;
    a = b;
    b = c;
  }

  cout << b;
  return 0;
}

Measured memory_bytes: 3640
#include<stdio.h>

int main(){
	int N,i,count=0,ans=0;
	char A[101],B[101],C[101];
	scanf("%d\n%s\n%s\n%s",&N,A,B,C);



    for(i=0;i<N;i++){
    	count = 0 ;
    	if(A[i]==B[i]) count++;
    	if(B[i]==C[i]) count++;
    	if(A[i]==C[i]) count++;

    	if(count == 0) ans += 2;
    	if(count == 1) ans += 1;

    }

    printf("%d\n",ans);

	return 0;
}

Measured memory_bytes: 128
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
	int n,l;
	scanf("%d%d",&n,&l);
	int ans=(l+n+l-1)*n/2;
	if(l>0)ans-=l;
	if(n+l-1<0)ans-=n+l-1;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include "time.h"
#include "unistd.h"
#include "string.h"
#include <math.h>
int ans;
int main(int argc, char* argv[]){
  long int a,b,c;
  scanf("%ld %ld",&a,&b);
  printf("%d\n",(a-1)*(b-1));
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <tuple>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <string>
#include <climits>
#include <map>
#include <set>
#include <queue>
using namespace std;
#define Rep(i, n) for (int i = 0; i < (n); ++i)
#define InitRep(i, begin, n) for (int i = (begin); i < (n); ++i)
#define RepItr(it, begin, end) for (auto it = (begin); it != (end); ++it)
using int64 = long long;
using vint = vector<int>;
using vint64 = vector<int64>;
const static double PI = ::acos(-1);


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

    if (a + b + c > 21)
    {
        cout << "bust" << endl;
    }
    else
    {
        cout << "win" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define arep(a,i,n) for(ll i=(a);i<(n);i++)
#define rep(i,n) for(ll i=0;i<(n);i++)
#define cinf(x,n) for(ll i=0;i<(n);i++)cin>>x[i];
#define coutf(x,n) for(ll i=0;i<(n);i++)cout<<x[i]<<endl;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using namespace std;

ll sum=0;

int main(){
	ll n,k;
	cin >> n >> k;
	ll l[n];
	cinf(l,n);
	sort(l,l+n);
	rep(i,k){
		sum+=l[n-i-1];
	}
	cout << sum << endl;
}

Measured memory_bytes: 3540
#include <iostream>
 
using namespace std;
 
int main () {
 
  int a[3000][2];
  int i=0;
  int x,y;
 
  while(1) {
      cin >> x >> y;
      if (x==0 && y==0){
          break;
      }
      if (x<y){
          a[i][0]=x;
          a[i][1]=y;
      }else{
          a[i][0]=y;
          a[i][1]=x;
      }
      
      i++;
  }
  for(int j=0; j <i ;j++){
      cout << a[j][0] << " " << a[j][1] << endl;
  }
}


Measured memory_bytes: 3104
#include <iostream>
#include <algorithm>
#include <cfloat>
#include <cmath>
using namespace std;

int main(){
    while(1){
        int d, e;
        cin >> d >> e;
        if(d==0) break;

        double ermin=DBL_MAX;
        for(int i=0; i*2<=d; i++){
            double error;
            error= fabs(sqrt(i*i + (d-i)*(d-i)) -e );
            ermin = min(ermin, error);
        }
        cout << ermin << endl;
    }
    return 0;
}

Measured memory_bytes: 3264
// ███▓▓▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓╬╬╬╬╬╬▓█
// ███▓███████▓▓╬╬╬╬╬╬╬╬╬╬╬╬▓███▓▓▓▓█▓╬╬╬▓█
// ███████▓█████▓▓╬╬╬╬╬╬╬╬▓███▓╬╬╬╬╬╬╬▓╬╬▓█
// ████▓▓▓▓╬╬▓█████╬╬╬╬╬╬███▓╬╬╬╬╬╬╬╬╬╬╬╬╬█
// ███▓▓▓▓╬╬╬╬╬╬▓██╬╬╬╬╬╬▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
// ████▓▓▓╬╬╬╬╬╬╬▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
// ███▓█▓███████▓▓███▓╬╬╬╬╬╬▓███████▓╬╬╬╬▓█
// ████████████████▓█▓╬╬╬╬╬▓▓▓▓▓▓▓▓╬╬╬╬╬╬╬█
// ███▓▓▓▓▓▓▓╬╬▓▓▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
// ████▓▓▓╬╬╬╬▓▓▓▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
// ███▓█▓▓▓▓▓▓▓▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
// █████▓▓▓▓▓▓▓▓█▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
// █████▓▓▓▓▓▓▓██▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
// █████▓▓▓▓▓████▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
// ████▓█▓▓▓▓██▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
// ████▓▓███▓▓▓▓▓▓▓██▓╬╬╬╬╬╬╬╬╬╬╬╬█▓╬▓╬╬▓██
// █████▓███▓▓▓▓▓▓▓▓████▓▓╬╬╬╬╬╬╬█▓╬╬╬╬╬▓██
// █████▓▓█▓███▓▓▓████╬▓█▓▓╬╬╬▓▓█▓╬╬╬╬╬╬███
// ██████▓██▓███████▓╬╬╬▓▓╬▓▓██▓╬╬╬╬╬╬╬▓███
// ███████▓██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬████
// ███████▓▓██▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓████
// ████████▓▓▓█████▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█████
// █████████▓▓▓█▓▓▓▓▓███▓╬╬╬╬╬╬╬╬╬╬╬▓██████
// ██████████▓▓▓█▓▓▓╬▓██╬╬╬╬╬╬╬╬╬╬╬▓███████
// ███████████▓▓█▓▓▓▓███▓╬╬╬╬╬╬╬╬╬▓████████
// ██████████████▓▓▓███▓▓╬╬╬╬╬╬╬╬██████████
// ███████████████▓▓▓██▓▓╬╬╬╬╬╬▓███████████
//#include "grader.h"
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <deque>
#include <cassert>
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define read(FILENAME) assert(freopen((FILENAME + ".in").c_str(), "r", stdin))
#define write(FILENAME) assert(freopen((FILENAME + ".out").c_str(), "w", stdout))
#define files(FILENAME) read(FILENAME), write(FILENAME)
using namespace std;
template <typename A, typename B> void chkmin(A &x, B y) {if (x > y) x = y;}
template <typename A, typename B> void chkmax(A &x, B y) {if (x < y) x = y;}
     
typedef pair <int, int> point;
     
const string FILENAME = "input";
const int MAXN = 1e5, p = 1e9 + 7;

int H, W, h, w;

int main() {
	//read(FILENAME);
	cin >> H >> W >> h >> w;
	if (H % h == 0 && W % w == 0) {
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;
	long long B = 999999999 / (h * w - 1);
	long long A = B * (h * w - 1) + 1;
	for (int i = 1; i <= H; ++i) {
		for (int j = 1; j <= W; ++j) {
			if (i % h == 0 && j % w == 0) {
				cout << -A << ' ';
			} else {
				cout << B << ' ';
			}
		}
		cout << endl;
	}
}








Measured memory_bytes: 2944
#import<iostream>
#define l long
l N,M,c,n=1,i=2,o=1e9+7,r,d;l m(l a){l g=1,h=2*o-4;for(;h/=2;h&1?g=g*a%o:0,a=a*a%o);return g;}l C(l b){for(;b;r=r*(N-1+b)%o,d=d*b--%o);return r*m(d)%o;}main(){for(std::cin>>N>>M;i*i<=M;++i,r=1,d=1,n=n*C(c)%o)for(c=0;M%i<1;++c,M/=i);std::cout<<n*(M^1?N:1)%o<<std::endl;}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long long i=0; i<(long long)(n); i++)
#define all(a) (a).begin(), (a).end()
typedef long long ll;
template<class T> bool chmax(T&x,T y){if(x<y){x=y;return true;}return false;}

int main(){
	int N; cin >> N;
	vector<int> L(N), R(N);
	rep(i, N) cin >> L[i] >> R[i];
	sort(all(L), greater<int>());
	sort(all(R));
	ll K = 0, s = 0;
	rep(i, N){
		chmax(K, s+L[i]);
		chmax(K, s-R[i]);
		chmax(K, s+L[i]-R[i]);
		s += L[i] - R[i];
	}
	cout << 2*K << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
 
int main()
{
        int a, b;
        int d, r;
        double f;
         
        scanf("%d %d", &a, &b);
        d = a / b;
        r = a % b;
        f = (double)a / (double)b;
        printf("%d %d %f\n", d, r, f);
 
        return 0;
}

Measured memory_bytes: 636
#include <stdio.h>
int main(){
  int i,j;
  while(1){
    scanf("%d %d",&i,&j);
    if(i == 0 && j == 0){
      break;
    }
    if(i > j){
      printf("%d %d\n",j,i);
    }
    else if(i <= j){
      printf("%d %d\n",i,j);
    }
  }
  return(0);
}

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

int main() {
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());

    char c;
    cin >> c;

    if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {
        cout << "vowel" << endl;
    } else {
        cout << "consonant" << endl;
    }
}


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

#define ll long long
#define pll pair<ll, ll>
#define rep(x, l, r) for (x = l; x < r; x++)

const ll mod=1000000007;
const char nl='\n';


void solve()
{
	ll i, j, k, l, m, n, u, v,x,y,z,c,r,g;
    cin>>n;
    map< string,ll > mp;
    mp["AC"]=0;
    mp["TLE"]=0;
    mp["WA"]=0;
    mp["RE"]=0;
    while(n--){
        string s;
        cin>>s;
        mp[s]++;
    }
    cout<<"AC x "<<mp["AC"]<<nl;
    cout<<"WA x "<<mp["WA"]<<nl;
    cout<<"TLE x "<<mp["TLE"]<<nl;
    cout<<"RE x "<<mp["RE"]<<nl;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t = 1;
//    cin >> t;
	while (t--)
	{
		solve();

	}
	return 0;
}
/*
10
1 0
0 0
0 1
1000 0
0 1000
999 999
882 456
345 234
12 45
345 56
*/


Measured memory_bytes: 3668
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define googletestcase(x) cout<<"CASE #"<<x<<": ";
using namespace __gnu_pbds;
using namespace std;
template <class T> using Tree = tree<T, null_type, less<T>,
rb_tree_tag, tree_order_statistics_node_update>;
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
#define readint(x) scanf("%d", &x)
#define readll(x) scanf("%lld", &x)
#define readstring(x) readint(x)
#define loop(i, a, b) for(int i=a;i<b;i++)
#define loop0(i, a) for(int i=0;i<a;i++)
#define loopi(i, a, b) for(int i=a;i<=b;i++)
#define trav(i, x) for(auto i: x)
#define travedit(i, x) for(auto &i: x)
#define sz(x) (long long)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define debug(a, x) cout<<a<<" IS "<<x<<'\n';
#define all(x) x.begin(), x.end()
#define ins insert
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define fast ios_base::sync_with_stdio(0); cin.tie(0);
const int MOD=1000000007;//1e9+7
const int MX=1000001;
void setio(string s) {
	//ios_base::sync_with_stdio(0); cin.tie(0);
	freopen((s+".in").c_str(),"r",stdin);
	freopen((s+".out").c_str(),"w",stdout);
}
struct BIT{
    ll nput;
    int bit[MX];
    void init(){
        for(int i=0;i<=nput+9;i++){
            bit[i]=0;
        }
    }
    void update(ll k, ll x){
        while(k<=nput){
            bit[k]+=x;
            k+=k&-k;
        }
    }
    ll sum(ll k){
        ll sum1=0;
        while(k>=1){
            sum1+=bit[k];
            k-=k&-k;
        }
        return sum1;
    }
    ll query(ll a, ll b){
        return sum(b)-sum(a-1);
    }
};
struct DSU{
	int nput;
	int dsu[MX+1];
	int sizes[MX+1];
	void init() {
		for(int i=0;i<=nput;i++) {
			dsu[i]=i;
			sizes[i]=1;
		}
	}
	int find(int a) {
		if(dsu[a]==a)
			return a;
		return(dsu[a]=find(dsu[a]));
	}
	void join(int a, int b) {
		a=find(a);
		b=find(b);
		if(a!=b){
			if(sizes[a]<sizes[b]){
				dsu[a]=b;
				sizes[b]+=sizes[a];
			}
			else{
				dsu[b]=a;
				sizes[a]+=sizes[b];
			}
		}
	}
	bool sameset(int a, int b){
		return find(a)==find(b);
	}
};
//dp[i][0]->day i ending at activity a
//etc
int dp[1000000][3];
int n;
int val[1000000][3];
int main(){
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>val[i][0]>>val[i][1]>>val[i][2];
    }
    dp[1][0]=val[1][0], dp[1][1]=val[1][1], dp[1][2]=val[1][2];
    for(int i=2;i<=n;i++){
        dp[i][0]=val[i][0]+max(dp[i-1][1], dp[i-1][2]);
        dp[i][1]=val[i][1]+max(dp[i-1][0], dp[i-1][2]);
        dp[i][2]=val[i][2]+max(dp[i-1][0], dp[i-1][1]);
    }
    cout<<max(max(dp[n][0], dp[n][1]), dp[n][2]);
}


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

int main(){
  int h,w;
  cin >> h >> w;
  
  vector<vector<char>> a(h+2,vector<char>(w+2));
  
  for(int i =0;i<h+2;i++){
  a.at(i).at(0)='#';
      a.at(i).at(w+1)='#';
    
    for(int j=1;j<w+1;j++){
    if(i==0||i==h+1){a.at(i).at(j)='#';}
      else{
           cin >>a.at(i).at(j);
        
      }
    }
  
  
  }
  
 for(int i=0;i<h+2;i++){
 for(int j=0;j<w+2;j++){
 cout << a.at(i).at(j);
   if(j==w+1){cout<<endl;}
 
 
 }}
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;
using vpii=vector<pair<int,int>>;
using plli=pair<ll,int>;
using vplli=vector<pair<ll,int>>;
using pllll=pair<ll,ll>;
using vpllll=vector<pair<ll,ll>>;

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

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i-1; i >= (ll)end_i; i--)

long long INF = 1LL<<60;
int main( ){
    ll N;
    cin>>N;
    ll K;
    cin>>K;
    vvi doubling(N+1,vi (64,0));
    rep(i,1,N+1)cin>>doubling[i][0];
    rep(j,1,64){
        rep(i,1,N+1)
            doubling[i][j]=doubling[doubling[i][j-1]][j-1];
    }
    int ans=1;
    rep(i,0,64){
        if(K>>i&1)ans=doubling[ans][i];
    }
    cout<<ans<<endl;
    return 0;
}




Measured memory_bytes: 61076