akhauriyash/Code-Regression huggingface dataset:
/**
 * Koch Curve
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_5_B&lang=ja
 */

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

/*
merge(A, left, mid, right)
  n1 = mid - left;
  n2 = right - mid;
  L[0...n1], R[0...n2] を生成
  for i = 0 to n1-1
    L[i] = A[left + i]
  for i = 0 to n2-1
    R[i] = A[mid + i]
  L[n1] = INFTY
  R[n2] = INFTY
  i = 0
  j = 0
  for k = left to right-1
    if L[i] <= R[j]
      A[k] = L[i]
      i = i + 1
    else 
      A[k] = R[j]
      j = j + 1

mergeSort(A, left, right)
  if left+1 < right
    mid = (left + right)/2;
    mergeSort(A, left, mid)
    mergeSort(A, mid, right)
    merge(A, left, mid, right)
*/

int compareCount = 0;

void merge(vector<int> &A, int left, int mid, int right) {
  int n1 = mid - left;
  int n2 = right - mid;

  // L[0...n1], R[0...n2] を生成
  vector <int>L(n1 + 1);
  for (int i = 0; i < n1; i++) {
    L.at(i) = A.at(left + i);
  }
  vector <int>R(n2 + 1);
  for (int i = 0; i < n2; i++) {
    R.at(i) = A.at(mid + i);
  }

  L.at(n1) = INT_MAX;
  R.at(n2) = INT_MAX;
  int i = 0;
  int j = 0;
  for (int k = left; k < right; k++) {
    // 比較回数をカウントする
    compareCount++;

    if (L.at(i) <= R.at(j)) {
      A.at(k) = L.at(i);
      i = i + 1;
    } else {
      A.at(k) = R.at(j);
      j = j + 1;
    }
  }
}

void mergeSort(vector<int> &A, int left, int right) {
  if (left + 1 < right) {
    int mid = (left + right) / 2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}

int main(){
  // １行目に n、２行目に S を表す n 個の整数が与えられます。 
  int n;
  cin >> n;

  // 配列を受け取る
  vector<int> S(n);
  for (int i = 0; i < n; i++) {
    cin >> S.at(i);
  }

  // マージソートの実行
  mergeSort(S, 0, n);

  // 結果の出力
  for (int i = 0; i < n; i++) {
    if (i > 0) {
      cout << ' ';
    }

    cout << S.at(i);
	}
  cout << endl;

  cout << compareCount << endl;
}



Measured memory_bytes: 6792
use std::io::*;
use std::str::FromStr;
use std::cmp;
use std::collections::HashMap;
use std::collections::HashSet;
use std::char;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn gcd(a: u64, b: u64) -> u64 {
    if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}


fn read_tuple2<T: FromStr, S: FromStr>() -> (T, S) {
    let a = read();
    let b = read();
    (a, b)
}

fn main() {
    let (n, x):(u64, u64) = read_tuple2();
    let mut xs:Vec<u64> = (0..n).map(|_|read()).collect();
    xs.push(x);
    xs.sort();
    let diffs:Vec<u64> = (0..n).map(|i|xs[(i+1) as usize] - xs[i as usize]).collect();
    let ans = diffs.iter().fold(diffs[0], |acc, num|gcd(acc, *num));
    println!("{}", ans);
}



Measured memory_bytes: 3340
#include <bits/stdc++.h>
using namespace std;
 
namespace
{
const int MAX_N	= 100000;
bool bC[ 31 ][ MAX_N + 5 ];
}
 
int main( int argc, char *argv[] )
{
int i;
int j;
int N;
int C;
int s;
int t;
int c;
int iMax;
int iCnt;
 
	ios::sync_with_stdio( false );
	cin.tie( 0 );
 
	cin >> N;
	cin >> C;
	for( i = 1; i <= N; i++ )
	{
		cin >> s;
		cin >> t;
		cin >> c;
		for( j = s - 1; j < t; j++ )
			bC[ c ][ j ] = true;
	}
 
	iMax = 0;
	for( j = 1; j <= MAX_N; j++ )
	{
		iCnt = 0;
		for( i = 1; i <= C; i++ )
		{
			if( bC[ i ][ j ] ) iCnt++;
		}
 
		if( iMax < iCnt ) iMax = iCnt;
	}
 
	cout << iMax << endl;
 
	return 0;
}

Measured memory_bytes: 3200
import java.io.*;
public class Main{

    public static void main(String[] args){

        int a=0;
        int b=0;
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        try{
            String line = reader.readLine();
            String[] inp = line.split(" ", 0);
            a = Integer.parseInt(inp[0]);
            b = Integer.parseInt(inp[1]);
        
        }catch(IOException e){
        }

        System.out.println(a * b);

    }
}

Measured memory_bytes: 32684
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var inputs = Console.ReadLine().Split(' ');
        var X = int.Parse(inputs[0]);
        var N = int.Parse(inputs[1]);


        var nums = Console.ReadLine().Split(' ');
        var dict = new Dictionary<int, bool>();

        for(var i = 0; i <= 100; i++)
        {
            dict.Add(i, false); 
        }

        if (nums[0] != "")
        {
            foreach (var num in nums)
            {
                dict[int.Parse(num)] = true;
            }
        }

        var count = 0;
        var ans = X;
        while (true)
        {
            if(count == 0)
            {
                if (!dict[X])
                {
                    ans = X;
                    break;
                }
            }
            else
            {
                if(!dict.ContainsKey(X-count) || !dict[X - count])
                {
                    ans = X - count;
                    break;
                }
                if (!dict.ContainsKey(X + count) || !dict[X + count])
                {
                    ans = X + count;
                    break;
                }
            }

            count++;

        }


        Console.WriteLine(ans);
        Console.Read();
    }
}

Measured memory_bytes: 18232
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;

namespace atcorder
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            char c = char.Parse(s) ;
            int i = Convert.ToInt32(c) + 1;
            char ans = Convert.ToChar(i);
            Console.WriteLine(ans);


            //Console.WriteLine((char)((int)Convert.ToChar(Console.ReadLine()) + 1));
        }
    }
}

//文字配列の取得
//string[] strArray = Console.ReadLine().Split(' ').ToArray();
//string S = strArray[0];
//string T = strArray[1];

//文字列の取得
//string s = Console.ReadLine();

//数字配列の取得
//int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
//int H = intArray[0];
//int W = intArray[1];

//数字の取得
//int N = int.Parse(Console.ReadLine());

//リスト型(int)の取得
//List<int> A = new List<int>(Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray());

//出力
//Console.WriteLine(ans);
//Console.WriteLine("Yes");
//Console.WriteLine("No");
//Console.WriteLine(cnt);



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

using namespace std;

int K;
string s;

int main(void)
{
	cin >> s;
	cin >> K;
	
	for(int i = 0; i < s.size(); i++){
		if(s[i] == 'a') continue;
		if(26 - (s[i] - 'a') <= K){
			K -= 26 - (s[i] - 'a');
			s[i] = 'a';
		}
	}
	s[s.size()-1] = (s[s.size()-1] - 'a' + K) % 26 + 'a';
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using longlong=long long;

int main(){
    std::cin.tie(nullptr);std::cin.sync_with_stdio(false);
    std::vector<char>a(6);
    for(int i=0;i<6;i++)std::cin>>a.at(i);
    std::cout<<(a==std::vector<char>(a.rbegin(),a.rend())?"YES":"NO")<<std::endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
const ll MOD = 1e9+7;
/*int dfs(vector<int> &T, vector<int> &C, int i, int sum, int g, int count){
   
}*/

int main(){
  int i, n;
  cin >> n;
  int64_t m = 0;
  int64_t a = 0;
  int64_t r = 0; 
  int64_t c = 0;
  int64_t h = 0;
  rep(i, n){
    string s;
    cin >> s;

    char t = s.at(0);
    //cout << t << endl;
    if(s.at(0)=='M') m++;
    else if(s.at(0)=='A') a++;
    else if(s.at(0)=='R') r++;
    else if(s.at(0)=='C') c++;
    else if(s.at(0)=='H') h++;
    //cout << m << endl;
  }
  //cout << m << endl;
  //cout << a << endl;
  int64_t g = m*a*(r+c+h) + m*r*(c+h) + m*c*h + a*r*(c+h) + a*c*h + r*c*h;
  cout << g << endl; 


}



Measured memory_bytes: 256
s = input()
n = len(s)

memo = [0] * 2019
memo[0] += 1

num = 0
t = 1
for i in reversed(s):
    num += int(i) * t
    num %= 2019
    t *= 10
    t %= 2019
    memo[num] += 1

ans = 0
for p in memo:
    ans += p*(p-1)//2

print(ans)

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

using namespace std;

int main(){

    int X, A, B;

    cin >> X >> A >> B;

    if(X+A+1 > B && (A+1)-B < 0){
        cout << "safe" << endl;
    }
    else if(X+A+1 > B && (A+1)-B >= 0){
        cout << "delicious" << endl;
    }
    else{
        cout << "dangerous" << endl;
    }

    return 0;

}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {

  long q,h,s,d,n;
  scanf("%ld %ld %ld %ld %ld", &q, &h, &s, &d, &n);
  long min = q*4;
  if (h*2 < min) {
    min = h*2;
  }
  if (s < min) {
    min = s;
  }
  long answer;
  if (min*2 <= d) {
    answer = min*n;
  } else {
    answer = d*(n/2);
    if (n%2 != 0) {
      answer += min;
    }
  }
  printf("%ld\n", answer);

  return 0;
}

Measured memory_bytes: 128
import fractions
n,x=map(int, input().split())
*l,=map(int, input().split())
l.append(x)
l.sort(reverse=True)
ans=0
sa1=0
sa2=0
if n==1:
    print(abs(x-(abs(x-sum(l)))))
else:
    for i in range(n-1):
        sa1=l[i]-l[i+1]
        sa2=l[i+1]-l[i+2]
        ans=fractions.gcd(fractions.gcd(sa1,sa2),ans)
    print(ans)

Measured memory_bytes: 16292
package main

import "fmt"

func main() {
	var n,num int
	fmt.Scan(&n)
	
	a := make(map[int]int,n)
	for i := 0; i < n; i++ {
		fmt.Scan(&num)
		a[num]++
	}
	if len(a) == n {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

Measured memory_bytes: 10240
#include "bits/stdc++.h"

using namespace std;

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

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3564
void main()
{
    long[] tmp = readln.split.to!(long[]);
    long k = tmp[0], t = tmp[1];
    long[] a = readln.split.to!(long[]);

    long day = 2 * a.reduce!max - a.sum - 1;
    writeln(day > 0 ? day : 0);
}

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: 380
li = [int(input()) for _ in range(5)]

li_div = [l%10 for l in li]

min_div = li[0] % 10
l_min_div = li[0]

for l in li:
  div = l % 10
  if div != 0 and div < min_div:
    min_div = div
    l_min_div = l
    
li.remove(l_min_div)

sum_time = 0
for l in li:
  x = l // 10
  if l % 10 != 0:
    sum_time += 10 * (x+1)
  else:
   	sum_time += 10 * x

print(sum_time + l_min_div)

Measured memory_bytes: 3064
#include <algorithm>
#include <array>
#include <iostream>
#include <string>
#include <vector>

int main()
{
    std::string S, T;
    std::cin >> S >> T;
    std::array<int, 46> al_s{};
    for (auto c : S) {
        al_s.at(c - 'a')++;
    }
    std::sort(al_s.begin(), al_s.end());
    std::reverse(al_s.begin(), al_s.end());
    std::array<int, 46> al_t{};
    for (auto c : T) {
        al_t.at(c - 'a')++;
    }
    std::sort(al_t.begin(), al_t.end());
    std::reverse(al_t.begin(), al_t.end());

    if (al_s == al_t) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }
    return 0;
}

Measured memory_bytes: 776
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;
using ll = long long;

#define REP(i, a) for (int i = 0; i < (a); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a)-1; i >= (b); --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define SIZE(obj) (int)(obj).sizeT()
#define YESNO(cond, yes, no) \
    { cout << ((cond) ? (yes) : (no)) << endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(), (list).rend())
#define ASSERT(cond, mes) assert(cond&& mes)

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template <typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())
    is >> v[i];
    return is;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a) n = a;
    if (n > b) n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

std::vector<int> enum_div(int n) {
    std::vector<int> ret;
    for (int i = 1; i * i <= n; ++i) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i != 1 && i * i != n) { ret.push_back(n / i); }
        }
    }
    return ret;
}

template <typename T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

struct ToUpper {
    char operator()(char c) {
        return toupper(c);
    }
};

struct ToLower {
    char operator()(char c) {
        return tolower(c);
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int A, B, C;
    cin >> A >> B >> C;
    YESNO(A == B && B == C, "Yes", "No");
    return 0;
}

Measured memory_bytes: 256
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, 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::collections::HashMap;
use std::cmp::{max,min};
fn main(){
    input!{
        mut pn:[usize;3],
    }
    pn.sort();
    println!("{}",pn[0] + pn[1]);
}

Measured memory_bytes: 4352
use std::cmp::*;
use std::collections::*;

fn main() {
    let s = read::<String>()
        .chars()
        .map(|x| x.to_digit(36).unwrap() - 10)
        .collect::<Vec<_>>();
    let n = s.len();
    let mut a = vec![0usize; n];
    a[0] = 1 << s[0];
    for i in 1..n {
        a[i] = a[i - 1] ^ (1 << s[i]);
    }
    let mut dp = HashMap::new();
    dp.insert(a[0], 1);
    for i in 1..n {
        if a[i].count_ones() <= 1 && !dp.contains_key(&a[i]) {
            dp.insert(a[i], 1);
            continue;
        }
        if !dp.contains_key(&a[i]) {
            dp.insert(a[i], std::i64::MAX);
        }
        for ci in 0..26 {
            let from = a[i] ^ (1 << ci);
            if !dp.contains_key(&from) {
                continue;
            }
            *dp.get_mut(&a[i]).unwrap() = min(dp[&a[i]], dp[&from] + 1);
        }
    }
    println!("{}", dp[&a[n - 1]]);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}


Measured memory_bytes: 18964
#include<stdio.h>
#include<stdlib.h>
int main(void) {
	int A, B, X, a = 0, b = 0, x, aiu = 0, minimum = 100000000;
	scanf("%d", &A);
	scanf("%d", &B);
	scanf("%d", &X);
	for (a = 0; a <= 40;a++) {
		for (b = 0; b <= 20;b++) {
			x = a * 500 + b * 1000;
			aiu = A*b + B*a;
			if (X <= x && minimum>aiu) {
				minimum = aiu;
			}
		}
	}
	printf("%d\n", minimum);
	return 0;
}


Measured memory_bytes: 2756
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <bitset>
#include <complex>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cout << #x << " = " << (x) << endl;
#define forauto(i, a) for(auto i : a)cout << i << " "; puts("");

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef pair<double, double> PDD;
typedef complex<double> CD;

map<LL, int> prime_factor(LL n) {
	map< LL, int > ret;
	for (LL i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}

int main() {
	LL n; cin >> n;
	LL ans = n;
	for (auto p : prime_factor(n)) {
		ans = ans - ans / p.first;
	}
	Cout(ans);
}


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

int main(){
  int N,j=0;
  cin>>N;
  for(int i=1;i<=N;i++){
    int p;
    cin>>p;
    if(p!=i)
      j++;
  }
  if(j<=2)
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
}

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

#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

int main() {
  ll a;
  double b;
  cin >> a >> b;

  cout << long(b * 100 + 0.1) * a / 100 << endl;
}


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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())

#define MAXPOS 30010
#define MAXLEN 4
#define CURRENT 1000

//pos:どの桁をみたか
//len:何文字残す？
//current:現時点で残すと決めた部分の文字列


bool dp[MAXPOS][MAXLEN][CURRENT];

signed main(){

	dp[0][0][0]=true;

	lli n;
	cin>>n;
	string s;
	cin>>s;

	REP(i,0,n+1){
		dp[i][0][0]=true;
	}

	REP(i,0,n){
		lli now = s.at(i)-'0';

		for(lli len=3;len>=0;len--){
			REP(current,0,1000){
				dp[i+1][len][current] |= dp[i][len][current];	
				if(len==3)continue;		
				dp[i+1][len+1][current*10+now] |= dp[i][len][current];
			}
		}
	}
	lli cnt=0;

	REP(i,0,CURRENT)if(dp[n][3][i])cnt++;
	cout<<cnt<<endl;
	
	return 0;
}

Measured memory_bytes: 117504
using System;
using System.Linq;
class Program
{
    public static void Main()
    {
        string[] imp = Console.ReadLine().Split(' ');
        int n, m;
        n = int.Parse(imp[0]);
        m = int.Parse(imp[1]);
        int[,] ab = new int[n, 2];
        for (int i = 0; i < n; i++)
        {
            imp = Console.ReadLine().Split(' ');
            ab[i, 0] = int.Parse(imp[0]);
            ab[i, 1] = int.Parse(imp[1]);
        }
        int[,] cd = new int[m, 2];
        for (int i = 0; i < m; i++)
        {
            imp = Console.ReadLine().Split(' ');
            cd[i, 0] = int.Parse(imp[0]);
            cd[i, 1] = int.Parse(imp[1]);
        }
        for (int i = 0; i < n; i++)
        {
            int dmin = int.MaxValue;
            int ans = 0;
            for (int j = 0; j < m; j++)
            {
                if (dmin > Math.Abs(ab[i, 0] - cd[j, 0]) + Math.Abs(ab[i, 1] - cd[j, 1]))
                {
                    dmin = Math.Abs(ab[i, 0] - cd[j, 0]) + Math.Abs(ab[i, 1] - cd[j, 1]);
                    ans = j + 1;
                }
            }
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <cmath>

using namespace std;
#define loop(i,a,b) for(int i=(a);i<int(b);i++)
#define rep(i,b) loop(i,0,b)

int N,W,H,S,T;
int y[500], x[500];

int solve(){
    int res = 0;
    for(int i=0;i<H-T+1;i++){
        for(int j=0;j<W-S+1;j++){
            int t=0;
            for(int k=0;k<N;k++){
                if(i <= y[k] && y[k] < i+T && j <= x[k] && x[k] < j+S){
                    t++;
                }
            }
            // cout << i << " " << j << " " << t << endl;
            res=max(t,res);
        }
    }
    return res;
}

int main(){
    while(cin>>N && N){
        W,H;cin>>W>>H;
        rep(i,N){
            cin>>x[i]>>y[i];
            x[i]--; y[i]--;
        }
        cin>>S>>T;
        cout<<solve()<<endl;
    }
}

Measured memory_bytes: 1164
s = str(input())
no = 0
while 1:
    for data in ["erase", "eraser", "dream", "dreamer"]:
        if s.endswith(data):
            s = s[: - len(data)]
        else:
            no += 1
    if not s:
        print("YES")
        exit()
    if no == 4:
        print("NO")
        exit()
    else:
        no = 0


Measured memory_bytes: 76552
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

#include <bits/stdc++.h>

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;

const int MXN = 2e5, IINF = 1e9 + 10, INF = 1e18 + IINF + 10, MOD = 1000000007;
const ld PI = 4.0 * atanl(1.0), PREC = .000001;
const char nl = '\n';

#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define rall(x) x.end(), x.begin()
#define lb lower_bound
#define ub upper_bound
#define sz(x) (int)(x).size()
#define ins insert

ll a[MXN];

void fast() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); }

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }

ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }

int main() {
  fast();
  ll n, k, q;
  map<ll, ll> mp;
  map<ll, ll> mp1;
  cin >> n >> k >> q;
  for (int i = 1; i <= n; ++i) mp[i] = k;
  for (int i = 0; i < q; ++i) {
    int x;
    cin >> x;
    ++mp1[x];
  }
  for (auto x : mp) mp[x.f] -= (q - mp1[x.f]);
  for (auto x : mp) x.s <= 0 ? cout << "No" << nl : cout << "Yes" << nl;
  return 0;
}



Measured memory_bytes: 16112
import java.util.*;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int h = sc.nextInt();
		int m = sc.nextInt();
		double t1 = (h + m / 60.0) / 12.0;
		double t2 = m / 60.0;
		// System.out.println(t1);
		// System.out.println(t2);
		double r = Math.toRadians(Math.abs(t2 - t1) * 360.0);
		// System.out.println(r);
		double ans = a * a + b * b - 2 * a * b * Math.cos(r);
		System.out.println(Math.sqrt(ans));
	}
}
 
 
 
 
 
 
 
 
 
 


Measured memory_bytes: 35808
#include<stdio.h>
#include<string.h>

#define N 100000

typedef struct {
  char name[10];
  int time;
}queue;

void initialize(queue);
void enqueue(queue);
queue dequeue();
//int isEmpty();
//int isFull();

queue Q[N];
int head,tail,n;


/*void initialize(struct queue *q){
  int i;

  q->head=0;
  q->tail=0;
  for(i=0; i < N; ++i){
    q->name[i]=' ';
    q->time=0;
  }
  }*/

void enqueue(queue x){
  Q[tail]=x;
  tail = (tail+1)%N;
  }

queue dequeue(){
  queue x = Q[head];
  head = (head + 1)%N;
  return x;
}

int min(int a,int b){return a<b ? a:b;}

int main(){
  int elaps = 0,c;
  int i,q;
  queue u;
  scanf("%d %d",&n,&q);

  for(i=1; i<= n;i++){
    scanf("%s",Q[i].name);
    scanf("%d",&Q[i].time);

  }

  head = 1; tail = n+1;

  while(head != tail){
    u = dequeue();
    c = min(q,u.time);
    u.time -= c;
    elaps += c;
    if(u.time > 0)enqueue(u);
    else{
      printf("%s %d\n",u.name,elaps);
    }
  }
  return 0;
}

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define loop(i,b,n) for(int i=b;i<(n);++i)
#define each(e,v) for(auto &&e : v)

#define all(v) (v).begin(),(v).end()
#define sz(v) (int)v.size()

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;

const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const double EPS = 1e-9;
const ll MOD = 1000000007;

template<typename A,typename B> inline void chmin(A &a,B b){ if(a>b) a=b; }
template<typename A,typename B> inline void chmax(A &a,B b){ if(a<b) a=b; }
template <typename T> inline void print(const T& x) { cout << x << endl; }

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

    n = n%1000;
    print(n>0 ? 1000-n : 0);

    return 0;
}


Measured memory_bytes: 3632
/*
    問題をよく読もう！
    論理的に考えよう！
    サンプルを確認しよう!
    絶対に諦めるな！
    工夫をしろ！
    配列は少し多めにとっておく

    Twitterは終わるまでログアウト！
    （間違えて解法をツイートしてはいけないから）

*/
//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include<cstring>
//namespace
using namespace std;
//繰り返し
#define REP(i, m, n) for(int i=(int)m; i<(int)n; ++i)
#define rep(i, n) REP(i, 0, n)
//イテレータ
#define all_range(C) begin(C), end(C)
//簡略化
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
typedef pair<string,int> pst;

const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
//最大最小
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) {if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) {if(a<b) a=b;}

//関数

//最大公約数を求める
ll my_gcd(ll x, ll y) {
  ll r;

  while(y!=0) {
    r = x%y;
    x = y;
    y = r;
  }

  return x;
}

//最小公約数を求める
ll my_lcm(ll x, ll y) {

  return (x*y)/my_gcd(x,y);
}

//xのy乗を求める ※参考：10^18乗まで
ll my_pow(ll x, ll y) {
  ll sum = 1;

  while(y>0) {
    sum *= x;
  }

  return sum;
}

/*考えを書くスペース

*/
//main.cpp----------------------------
#define max_n 200000

void solve();

ll n;
ll x[max_n+1];
ll y[max_n+1];

int main() {
  cin >> n;
  rep(i, n) {
    cin >> x[i];
    y[i] = x[i];
  }

  solve();

  return 0;
}

void solve() {

  sort(y, y+n);
  ll central = n/2;

  rep(i, n) {
    if(y[central]>x[i]) {
      cout << y[central] << endl;
    }else {
      cout << y[central-1] << endl;
    }
  }

  return;
}


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

int main() {
        int k; cin >> k;
        int sum=0, maxDigit, maxNum;
        ll ans;
        bool isFinished = false;
        // ルンルン数を、最も大きい位の数字ごとに分けて考える
        vector<vector<ll> > lunlunEachDigit(18,vector<ll>(10));
        lunlunEachDigit[1].assign(10,1);
        // 1桁までのルンルン数の総数
        sum = 9;
        // もし入力が9までなら、その数字をそのまま出力
        if(k<=9) {
          cout << k << endl;
          return 0;
        }
        for(int i=2;; i++) {
                for(int j=0; j<=9; j++) {
                        // 0,9とそれ以外では処理が異なる
                        // もし処理中の桁が最大桁になる場合、0はカウントしないので、最後に足す
                        if(j==0) {
                                lunlunEachDigit[i][j]+=(lunlunEachDigit[i-1][j]+lunlunEachDigit[i-1][j+1]);
                        } else {
                                if(j==9) {
                                        lunlunEachDigit[i][j]+=(lunlunEachDigit[i-1][j]+lunlunEachDigit[i-1][j-1]);
                                } else {
                                        for(int k=-1; k<=1; k++) lunlunEachDigit[i][j]+=lunlunEachDigit[i-1][j+k];
                                }
                                sum+=lunlunEachDigit[i][j];
                        }
                        if(sum>=k) {
                          isFinished=true;
                          maxDigit=i;
                          maxNum=j;
                          break;
                        }
                }
                if(isFinished) break;
        }
        int lunlunOrder = lunlunEachDigit[maxDigit][maxNum]-(sum-k);
        ans = maxNum;
        for(int i=maxDigit-1; i>=1; i--) {
          if(maxNum==0) {
            for(int j=0; j<=1; j++){
              // もし要素数が範囲内なら
              if(lunlunOrder-lunlunEachDigit[i][j]<=0) {
                maxNum=j;
                break;
              }
              lunlunOrder-=lunlunEachDigit[i][j];
            }
          } else
          if(maxNum==9) {
            for(int j=8; j<=9; i++) {
              if(lunlunOrder-lunlunEachDigit[i][j]<=0) {
                maxNum=j;
                break;
              }
              lunlunOrder-=lunlunEachDigit[i][j];
            }
          } else {
            for(int j=maxNum-1; j<=maxNum+1; j++) {
              if(lunlunOrder-lunlunEachDigit[i][j]<=0) {
                maxNum=j;
                break;
              }
              lunlunOrder-=lunlunEachDigit[i][j];
            }
          }
          ans = ans*10+maxNum;
        }
        cout << ans << endl;
}


Measured memory_bytes: 3588
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

// vectorの重複削除
// std::sort(test.begin(), test.end());
// test.erase(std::unique(test.begin(), test.end()), test.end());

using namespace std;
using ll = long long;
using P = pair<int, int>; // vector<P> ba(n); みたいな感じですぐ使える ba[i] = P(a, b); make_pairをしなくてもいい
// typedef vector<int> v;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}
#define rep(i, c) for(int i = 0; i < int(c); i++)
#define ALL(x) (x).begin(), (x).end() //sort(ALL(obj))みたいな
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値
#define pb push_back //
// const int MOD = 1000000007;
// string alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
// printf("%.20f\n", ans); あれ
// const double PI = 3.141592653589793238462643383;

int main() {
  int r; cin>>r;
  cout << 3*r*r << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if(a>b){
    if(c>d){
      cout<<b+d<<endl;
    }
    if(c<=d){
      cout<<b+c<<endl;
    }
  }
  if(a<=b){
    if(c>d){
      cout<<a+d<<endl;
    }
    if(c<=d){
      cout<<c+a<<endl;
    }
  }
}


Measured memory_bytes: 256
/*2019/10/19 */
/*template*/
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#define MOD 1000000007
#define MIN 999999999
#define MAX -999999999
typedef long long int ll;
typedef unsigned long long int ull;
void llswap(ll *x,ll *y){ll tmp;tmp=*x;*x=*y;*y=tmp;}
void swap(int *x,int *y){int tmp;tmp=*x;*x=*y;*y=tmp;}
int rmax(int x,int y){return x>y?x:y;}
int rmin(int x,int y){return x>y?y:x;}
ll llrmax(ll x,ll y){return x>y?x:y;}
ll llrmin(ll x,ll y){return x>y?y:x;}
int asc(const void *a,const void *b){if(*(int*)a < *(int*)b)return -1;else if(*(int*)a == *(int*)b)return 0;else return 1;}
int desc(const void *a,const void *b){if(*(int*)a < *(int*)b)return 1;else if(*(int*)a == *(int*)b)return 0;else return -1;}
int llasc(const void *a,const void *b){if(*(ll*)a < *(ll*)b)return -1;else if(*(ll*)a == *(ll*)b)return 0;else return 1;}
int lldesc(const void *a,const void *b){if(*(ll*)a < *(ll*)b)return 1;else if(*(ll*)a == *(ll*)b)return 0;else return -1;}
int gcd(int x,int y){if(y==0)return x;return gcd(y,x%y);}
 
//int asc_t(const void *a,const void *b){if(((pair_t*)a)->d < ((pair_t*)b)->d)return -1;else if(((pair_t*)a)->d == ((pair_t*)b)->d)return 0;else return 1;}
//int asc_t(const void *a,const void *b){if(((pair_t*)a)->d < ((pair_t*)b)->d)return 1;else if(((pair_t*)a)->d == ((pair_t*)b)->d)return 0;else return -1;}
double to_deg(double r) {
    return r * 180.0 / (atan(1.0) * 4.0);
}
int main(){
    double a,b,x;
    scanf("%lf %lf %lf",&a,&b,&x);
    double x1;
    double ans=atan2(b,x1);
    if(a*a*b/2>=x){
        x1=(2.0*x)/(a*b);
        ans=atan2(b,x1);
    }else{
        x1=b-x/(a*a);
        ans=atan2(x1*2.0,a);
    }
    //printf("x1=%lf\n",x1);
    
    ans=to_deg(ans);
    printf("%.12lf\n",ans);
    return 0;
}

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


int main(){
    int n;
    cin >> n;
    vector<long long> r(n, 0);
    rep(i, n){
        cin >> r[i];
    }
    long long maxval = -1001001001, minn = r[0];
    for (int i = 1; i<n; i++) {
        maxval = max(maxval, r[i] - minn);
        minn = min(minn, r[i]);
    }
    cout << maxval <<endl;
    return 0;
}


Measured memory_bytes: 4428
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
typedef vector<vector<P>> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<ll> vec;
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30);
const int INF = (1LL << 60);
const double EPS = (1 >> 30);
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}



signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    int h,w;
    cin>>h>>w;
    int a[h][w];
    int b[h][w];
    rep(i,h){
        rep(j,w){
            cin>>a[i][j];
        }
    }
    rep(i,h){
        rep(j,w){
            cin>>b[i][j];
        }
    }
    
    bool dp[h][w][14000];
    rep(i,h){
        rep(j,w){
            rep(k,14000){
                dp[i][j][k]=false;
            }
        }
    }
    dp[0][0][abs(a[0][0]-b[0][0])]=true;
    int g;
    rep(i,h){
        rep(j,w){
            rep(k,14000){
                if(dp[i][j][k]){
                    if(i+1<h){
                        g=k+abs(a[i+1][j]-b[i+1][j]);
                        if(range(g,0,14000)){
                            dp[i+1][j][g]=true;
                        }
                        g=abs(k-abs(a[i+1][j]-b[i+1][j]));
                        if(range(g,0,14000)){
                            dp[i+1][j][g]=true;
                        }
                    }
                    if(j+1<w){
                        g=k+abs(a[i][j+1]-b[i][j+1]);
                        if(range(g,0,14000)){
                            dp[i][j+1][g]=true;
                        }
                        g=abs(k-abs(a[i][j+1]-b[i][j+1]));
                        if(range(g,0,14000)){
                            dp[i][j+1][g]=true;
                        }
                    }
                }
            }
        }
    }
    rep(k,14000){
        if(dp[h-1][w-1][k]){
            cout<<k<<endl;
            break;
        }
    }
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)

ll A[4000];
ll DP[4000][4000][2];
int main(){
    int N;
    cin >> N;
    REP(i,N){
        ll a;
        cin >> a;
        A[i] = a;
    }

    for(int i = N-1; i >= 0; i--){
        for(int j = 0; j < N; j++){
            if(i > j) DP[i][j][0] = DP[i][j][1] = 0;
            else{
                DP[i][j][0] = max(DP[i+1][j][1]+A[i], DP[i][j-1][1]+A[j]);
                DP[i][j][1] = min(DP[i+1][j][0]-A[i], DP[i][j-1][0]-A[j]);
            }
        }
    }

    //for(int i = 0; i < N; i++){
    //    for(int j = 0; j < N; j++){
    //        printf("%3lld ", DP[i][j][0]);
    //    }
    //    printf("\n");
    //}
    //for(int i = 0; i < N; i++){
    //    for(int j = 0; j < N; j++){
    //        printf("%3lld ", DP[i][j][1]);
    //    }
    //    printf("\n");
    //}
    //

    cout << DP[0][N-1][0] << endl;

    return 0;
}


Measured memory_bytes: 188288
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

constexpr ll MOD = 998244353;

ll MODpow(ll n, ll m) {
    ll result = 1;
    while (m) {
        if (m % 2 == 1) {
            result *= n;
            result %= MOD;
        }

        m /= 2;
        n *= n;
        n %= MOD;
    }

    return result;
}

int main() {
    ll N;
    cin >> N;
    vector<ll> D(N);
    for (ll i = 0; i < N; i++) {
        cin >> D[i];
    }

    if (D[0] != 0) {
        cout << 0 << endl;
        return 0;
    }

    const ll max_D = *max_element(D.begin(), D.end());
    
    vector<ll> num(max_D + 1, 0);
    for (ll i = 0; i < N; i++) {
        num[D[i]]++;
    }

    if (num[0] > 1) {
        cout << 0 << endl;
        return 0;
    }

    ll ans = 1;
    for (ll i = 1; i <= max_D; i++) {
        (ans *= MODpow(num[i - 1], num[i])) %= MOD;
    }

    cout << ans << endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#define M 1000000007
using namespace std;
int main()
{
    int n, m;
    cin >> n >> m;
  
    vector<int> skip(n+1, false);
    int tmp;
    for (int i = 0; i < m; i++) {
      cin >> tmp;
      skip[tmp] = true;
    }
  
    int bef1 = 0;
    int bef2 = 0;
    int now = 1;
    for (int i = 1; i <= n; i++) {
      tmp = (now + bef1) % M;
      bef2 = bef1;
      bef1 = now;
      now = tmp;
      if (skip[i]) now = 0;
    }
    cout << now << endl;
    return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int W = sc.nextInt();
int H = sc.nextInt();
int x = sc.nextInt();
int y = sc.nextInt();
int r = sc.nextInt();
if(x - r < 0 || y - r < 0 || x + r > W || y + r > H){
System.out.println("No");
}
else if(x - r >= 0 || y - r >=0 && x + r <= W || y + r <= H){
System.out.println("Yes");
}
sc.close();
}
}




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

using namespace std;

int n, m, l;

int a[110][110];
int b[110][110];
long long c[110][110];
int main()
{
    cin >> n >> m >> l;
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= m; j++)
        {
            scanf("%d", &a[i][j]);
        }
    }

    for (int i = 1; i <= m; i++)
    {
        for (int j = 1; j <= l; j++)
        {
            scanf("%d", &b[i][j]);
        }
    }

    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= l; j++)
        {
            for (int k = 1; k <= m; k++)
            {
                c[i][j] += a[i][k] * b[k][j];
            }
        }
    }

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

    return 0;
}



Measured memory_bytes: 3300
#include<bits/stdc++.h>
using namespace std;
#define pb          push_back
#define mp          make_pair
#define ll          long long int
#define hmap        unordered_map
#define pii         pair<int,int>
#define pdd         pair<double, double> 
#define M           1000000007
#define MOD         998244353
#define fast        ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test        ll t; cin>>t; while(t--)
#define inp(a,n)    int a[n]; for(int i=0;i<n;i++)  cin>>a[i];
#define inpl(a,n)   ll a[n];  for(ll i=0;i<n;i++)   cin>>a[i];
#define out(a,n)    for(int i=0;i<n;i++) cout<<a[i]<<" "; cout<<endl;
#define outl(a,n)   for(ll i=0;i<n;i++)  cout<<a[i]<<" "; cout<<endl;
#define outv(v)     for(int i=0;i<v.size();i++) cout<<v[i]<<" ";  cout<<endl;
#define all(s)      (s).begin(),(s).end()

struct pair_hash {
    template <class T1, class T2>
    std::size_t operator () (const std::pair<T1,T2> &p) const {
        auto h1 = std::hash<T1>{}(p.first);
        auto h2 = std::hash<T2>{}(p.second);
        return h1 ^ h2;  
    }
};
using vote = pair<ll,ll>;
using Unordered_map = unordered_map<vote, ll, pair_hash>;

int main()
{
      fast
      int n;
      cin>>n;
      inp(a,n)
      int dp[n]={};
      
      dp[0]= 0;
      dp[1] = abs(a[1]-a[0]);
      
      for(int i=2;i<n;i++)
      {
            dp[i] = min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
      }
      cout<<dp[n-1];      
      
      
      
      
}

Measured memory_bytes: 1024
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {

		FastScanner sc = new FastScanner();
		int N = sc.nextInt();
		int X = sc.nextInt();
		int[] L = new int[N];
		for (int i = 0; i < N; i++)
			L[i] = sc.nextInt();

		int b = 0;
		for (int i = 0; i < N; i++)
			b += L[i];

		if (X >= b) {
			System.out.println(N+1);
			return;
		}

		int a = 0;
		for (int i = 0; i < N; i++) {
			a += L[i];
			if (X < a) {
				System.out.println(i + 1);
				return;
			}

		}

	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 22484
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<unordered_map>
#include<set>
#include<cstring>
#include<iomanip> //cout << fixed << setprecision(15) << x << endl;

using namespace std;
typedef long long ll;
const ll INF = 1e9 + 6;
const ll MOD = 1e9 + 7;
const ll LLINF = 1e18;
#define Pint pair<ll, ll>
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rnr(i,a,b) for(int i=int(a);i>=int(b);i--)
#define rep(i,b) rng(i,0,b)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
/* -- template -- */

int main() {
    int N; cin >> N;
    deque<ll> A(N);
    rep(i, N) cin >> A[i];
    deque<ll> B = A;
    sort(all(A));
    sort(all(B));
    deque<ll> dQ;
    deque<ll> dQt;
    dQ.pb(A[0]);A.pop_front();
    int cnt = 0;
    while(!A.empty()) {
        if(cnt % 4 < 2) {
            if(cnt % 2 == 0) {
                dQ.pb(A.back());
            }else {
                dQ.push_front(A.back());
            }
            A.pop_back();
        }else {
            if(cnt % 2 == 0) {
                dQ.pb(A.front());
            }else {
                dQ.push_front(A.front());
            }
            A.pop_front();
        }
        ++cnt;
    }
    ll ans = 0;
    rep(i, N - 1) {
        ans += abs(dQ[i] - dQ[i + 1]);
    }

    dQt.pb(B[N - 1]);B.pop_back();
    cnt = 0;
    while(!B.empty()) {
        if(cnt % 4 >= 2) {
            if(cnt % 2 == 0) {
                dQt.pb(B.back());
            }else {
                dQt.push_front(B.back());
            }
            B.pop_back();
        }else {
            if(cnt % 2 == 0) {
                dQt.pb(B.front());
            }else {
                dQt.push_front(B.front());
            }
            B.pop_front();
        }
        ++cnt;
    }
    ll anst = 0;
    rep(i, N - 1) {
        anst += abs(dQt[i] - dQt[i + 1]);
    }
    cout << max(ans, anst) << endl;
}


Measured memory_bytes: 1920
#include <iostream>
#include<algorithm>
#include<string>
#include<vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
using namespace std;


int main()
{
	int a, b, c, k;
	cin >> a >> b >> c >> k;
	vector<int>n{a,b,c};
	sort(n.begin(), n.end());
	cout << n[2]*pow(2,k) + n[0] + n[1] << endl;
}


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

ll powe(ll a , ll b)
{
  ll res = 1 ;
  
  while(b > 0)
  {
    if(b&1)
      res = res * a ;
    
    a = a*a;
    b = b >> 1;
  }
  
  return res;
}
  

int main()
{
	
  ll h ;
  cin >> h;
  ll b = log2(h);
  b++;
  
  ll ans = powe(2,b) - 1;
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256