akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        long H = scan.nextInt();
        int N = scan.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = scan.nextInt();
        }
        int sum = Arrays.stream(A).sum();
        if (H <= sum) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


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

int main() {
	long long n;
	cin >> n;
	
	long long height = log2(n);
	long long ans = 0;
	for(int i = 0; i <= height; i++)
		ans += pow(2, i);
	
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
import numpy as np
import sys

n, h = map(int, input().strip().split())
a = [0] * n
b = [0] * n
for i in range(n):
    a[i], b[i] = map(int, input().strip().split())

#arr_a = np.array(a)
#idx_a_max = arr_a.argmax()
#a_max = a[idx_a_max]
#b_tmp = b[idx_a_max]
#b[idx_a_max] = 0
#b.sort()

arr_a = np.array(a)
a_max = max(a)
idx_tmp = np.where(arr_a == a_max)[0]
b_min = b[idx_tmp[0]]
idx_b_min = idx_tmp[0]
for i in range(1, np.shape(idx_tmp)[0]):
    if b_min > b[idx_tmp[i]]:
        b_min = b[idx_tmp[i]]
        idx_b_min = idx_tmp[i]
b[idx_b_min] = 0
b.sort()

sum_b = 0
ans = 0

for i in range(n - 1):
    if b[-1 - i] < a_max:
        break
    sum_b += b[-1 - i]
    ans += 1
    if sum_b >= h:
        print(ans)
        sys.exit()

h_tmp = h - sum_b - b_min
ans += 1
if h_tmp > 0:
    ans += (h_tmp + a_max - 1) // a_max

print(ans)


Measured memory_bytes: 21604
import sys
pagos=0
lines = sys.stdin.readlines()
for linea in lines:
    c = linea.split()
    c = list(map(str,c))
list(c)
p = c[0]
texto = p
rever = texto[::-1]
if texto == rever:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    ll n,m;
    cin>>n>>m;
    if(n==1 && m==1)
        cout<<"0"<<"\n";
    else if(n!=1 && m==1)
    {
        ll x=(n*(n-1))/2;
        cout<<x<<"\n";
    }
    else if(n==1 && m!=1)
    {
        ll y=(m*(m-1))/2;
        cout<<y<<"\n";
    }
    else
    {
        ll p=(n*(n-1))/2;
        ll q=(m*(m-1))/2;
        cout<<p+q<<"\n";
    }
}


Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <unordered_map>
#include <climits>
#include <set>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

constexpr int MAX_N = 100010;

vector<int> G[MAX_N];

int bfs(int v, int d, vector<bool> &used, vector<int> &dist) {
    if (used[v]) return dist[v];
    int ret = 0;
    for (int i = 0; i < G[v].size(); i++) {
        int to = G[v][i];
        ret = max(bfs(to, d + 1, used, dist) + 1, ret);
    }
    used[v] = true;
    return dist[v] = ret;
}

int main() {

    int N, M;
    cin >> N >> M;

    for (int i = 0; i < M; i++) {
        int x, y;
        cin >> x >> y;
        x--, y--;
        G[x].push_back(y);
    }

    vector<bool> used(N, false);
    vector<int> dist(N, 0);
    int ans = 0;

    for (int i = 0; i < N; i++) if (!used[i]) bfs(i, 0, used, dist);

    cout << *max_element(dist.begin(), dist.end()) << endl;

    return 0;
}
















































Measured memory_bytes: 10240
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>
#include<math.h>
#define MAX 100002
int abs(int a){
    if(a>0) return a;
    else return a*(-1);
}
int min(int a,int b){
    if(a>b) return b;
    else return a;
}
int main(){
    int N;
    scanf("%d",&N);
    int h[MAX];
    for(int i=0;i<N;i++)
        scanf("%d",h+i);
    int DP[MAX]={0};
    DP[1]=abs(h[1]-h[0]);
    for(int i=2;i<N;i++){
        DP[i] =  min(DP[i-2]+abs(h[i]-h[i-2]),DP[i-1]+abs(h[i]-h[i-1]));
    }
    printf("%d",DP[N-1]);
}


Measured memory_bytes: 896
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 C = sc.nextInt();
   int D = sc.nextInt();
   
   if(A+B>C+D) System.out.println("Left");
   else if(A+B<C+D) System.out.println("Right");
   else System.out.println("Balanced");
 }
}

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

using namespace std;
const int N_CNTST = 26;
int D;
vector <long long> C;
vector <vector<long long> > S;
long long CSum = 0;

vector<int> LAST(26, 0);

vector<int> T;
int main(){
    cin >> D;
    cin.ignore();
    
    long long tmp;
    for(int i = 0; i < N_CNTST; i++){
        cin >> tmp;
        C.push_back(tmp);
        CSum += tmp;
    }
    cin.ignore();
    for(int i = 0; i < D; i++){
        vector<long long> S_;
        for(int j = 0; j < N_CNTST; j++){
            cin >> tmp;
            S_.push_back(tmp);
        }
        cin.ignore();
        S.push_back(S_);
    }

    // tを算出
    long long sum = 0;
    long long msum = 0; // 減算Sum
    for(int i = 0; i < D; i++){
        //cin >> tmp;
        //T.push_back((int)tmp);
        //cin.ignore();
        
        int idx;
        long long ssum;
        long long  smsum;
        long long tmp_msum;
        long long max_sum = LLONG_MIN;
        for(int t_idx = 0; t_idx < N_CNTST; t_idx++){
            smsum = msum + CSum - C[t_idx] * (i - LAST[t_idx] + 1);
            ssum  = sum + S[i][t_idx] - smsum;
            if(max_sum < ssum || t_idx == 0){ // どれもいっしょかつマイナスの場合
                idx = t_idx;
                max_sum = ssum;
                tmp_msum = smsum;
            }
        }
        msum = tmp_msum;
        LAST[idx] = i+1;
        sum = max_sum;
        cout << idx + 1 << endl; // 0-origin -> 1-origin
        //cout << sum << endl;
    }
    return 0;
}

Measured memory_bytes: 3736
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

void insertion_sort(int A[],int N,int g,int *cnt) {
  for(int i=g;i<N;i++) {
    int v = A[i];
    int j = i - g;
    while(j >= 0 && A[j] > v) {
      A[j+g] = A[j];
      j = j - g;
      *cnt = *cnt + 1;
    }
    A[j+g] = v;
  }
}

void shell_sort(int A[],int N) {
  int cnt = 0;
  int m = 1;
  // h_i+1 = 3 * h_i + 1
  int G[13] = { 1, 4, 13, 40, 121, 364, 1093, 3280, 9841, 29524, 88573, 265720, 797161 };

  bool first = false;
  for(int i=12;i>=0;i--) {
    if(G[i] < N) {
      if(!first) {
        first = true;
        m = i + 1;
      }
      insertion_sort(A,N,G[i],&cnt);
    }
  }
  cout << m << endl;
  for(int i=m-1;i>=0;i--) {
    cout << G[i] << (i == 0 ? "" : " ");
  }
  cout << endl;

  cout << cnt << endl;
  for(int i=0;i<N;i++) {
    cout << A[i] << endl;
  }
}

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

  int N;
  int A[1000000];

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

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

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

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

  int n;
  cin >> n;

  vector<ll> h(n);
  rep(i, n) { cin >> h[i]; }

  vector<ll> diff(n - 1);
  rep(i, n - 1) { diff[i] = h[i + 1] - h[i]; }

  int max_cnt = 0;
  int cnt = 0;
  rep(i, n - 1) {
    // cout << "diff[" << i << "]: " << diff[i] << endl;
    // cout << "cnt: " << cnt << endl;
    if (diff[i] <= 0) {
      cnt++;
      if (max_cnt < cnt) {
        max_cnt = cnt;
      }
    } else {
      cnt = 0;
    }
    // cout << "diff[" << i << "]: " << diff[i] << endl;
    // cout << "cnt: " << cnt << endl;
  }

  cout << max_cnt << endl;
  return 0;
}


Measured memory_bytes: 1792
/* When Talent doesn't work, Hard work beats Talent*/

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include"bits/stdc++.h"

using namespace std;

#define Fast_D cout<<fixed<<setprecision(13);
#define FastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define nl "\n"
#define int long long
#define double long double
#define all(v) v.begin(),v.end()
#define scanstr(s) cin>>ws; getline(cin,s);

const double PI = 3.141592653589793;

void solve()
{
	int inf = 1e16;
	int n;
	cin >> n;
	int b[n];
	for(int i=0;i<n-1;i++)
	{
		cin >> b[i];
	}
	b[n-1] = inf;
	int ans = 0;
	ans += b[0];
	for(int i=0;i<n-1;i++)
	{
		ans += min(b[i],b[i+1]);
	}
	cout << ans ;
}

int32_t main()
{
	FastIO;
	Fast_D;
	int T;
	T=1;
	while(T--) solve();
	return 0;
}



Measured memory_bytes: 3656
import sys
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math
import copy
# from fractions import gcd

MOD = 10 ** 9 + 7
# MOD = 998244353
# sys.setrecursionlimit(10**8)

x, k, d = map(int, input().split())
x = abs(x)
if x - k*d >= 0:
    print(x - k*d)
else:
    k = k - x//d
    x = x % d
    if k%2 == 0:
        print(x)
    else:
        print(d - x)


Measured memory_bytes: 68068
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector as V
import qualified Data.ByteString.Char8 as C
import Debug.Trace
import Data.List
import Control.Monad
import Data.Ord
import qualified Data.Sequence as Seq
import qualified Data.IntSet as IS

r :: Int -> IO (U.Vector Int)
r n = U.unfoldrN n (C.readInt . C.dropWhile (==' ')) <$> C.getLine

r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine


main :: IO ()
main = do
    n <- readLn :: IO Int
    s <- C.getLine
    let lr = C.foldl' (\n c -> if c == '(' then n+1 else max 0 (n-1) ) 0 s
    let rl = C.foldr' (\c n -> if c == ')' then n+1 else max 0 (n-1) ) 0 s
    C.putStrLn $ C.concat [C.replicate rl '(', s, C.replicate lr ')']






Measured memory_bytes: 508
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;


unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

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

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

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

Measured memory_bytes: 3644
import java.util.Scanner;

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

		int ans = Integer.MAX_VALUE;
		for (int i = 0; i < s.length() - 2; i++) {
			int x = Integer.parseInt(s.substring(i, i + 3));
			ans = Math.min(ans, Math.abs(x - 753));
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 21588
li = list(input())

lik = li[1::2]
lig = li[0::2]
a = 0
b = 0


if 'L' in lig:
    a = a + 1

if 'R' in lik:
    b = b + 1

if a + b == 0:
    print('Yes')
else:
    print('No')

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

using namespace std;

#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long
static const ll MAX = 1000000;
static const ll INFTY = 1e12;
static const ll MOD = 1000000007;

template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };

struct edge {
    ll to, cost;
};

using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;


const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

// 深さ優先探索
vector<bool> seen;
vector<int> colors;

int H, W, N;
int sx, sy, gx, gy; 
vector<vector<char>> field;
vector<vector<int>> dist;
//vector<pair<int, int>> gx, gy;
deque<pair<int, int>> que;

typedef vector<vector<int> > Matrix;

const int INF = 100000000;


int main() {

 
  ll N, M;
  cin >> N >> M;
  vector<pair<ll, ll>> drink(N);
  REP(i, N){
    cin >> drink[i].first >> drink[i].second;
  }

  sort(drink.begin(), drink.end());

  ll ans = 0;
  ll count = 0;
  REP(i, N){
    if(count + drink[i].second >= M){
      ans += drink[i].first * (M-count);
      break;
    }
    ans += drink[i].first * drink[i].second;
    count += drink[i].second;
  }
  cout << ans << endl;
  
}


/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


Measured memory_bytes: 1792
using System;
class ABC131_A
{
    static void Main(string[] args)
    {
        string str = Console.ReadLine();
        if(str[0] != str[1] && str[1] != str[2] && str[2] != str[3])
        {
            Console.WriteLine("Good");
        }
        else { Console.WriteLine("Bad"); }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    if(a>b)
    {
        for(int i=1;i<=a;i++)
            cout<<b;
    }
    else
    {
       for(int i=1;i<=b;i++)
        cout<<a;
    }
}


Measured memory_bytes: 256
/*Kim Jong Il. Do you like him?*/

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<stdlib.h>
#include<limits.h>
using namespace std;

int main(){
  int n,n2,hn[1000][1000],sn[1000],xmax=0,xmin=0,ma[1000],mi[1000];

  cin >> n;
  for(int i=0;i<n;i++){
    cin >> n2;
    for(int j=0;j<n2;j++){
      cin >> hn[i][j];
     
      if(j>0 && hn[i][j]-hn[i][j-1]>0)xmax=max(xmax,(hn[i][j]-hn[i][j-1]));
      else if(j>0 && hn[i][j]-hn[i][j-1]<0)xmin=min(xmin,(hn[i][j]-hn[i][j-1]));
    }
    ma[i]=xmax;
    mi[i]=xmin;
    xmax=0;
    xmin=0;
    
  }
  for(int i=0;i<n;i++){
    cout << ma[i] << " " << -mi[i] << endl;

  }
  



}

Measured memory_bytes: 0
import sys
import math
input = sys.stdin.readline

N = int(input())

s = 0
for i in range(1, N+1):
  for j in range(1, N+1):
    for k in range(1, N+1):
    	g = math.gcd(i, j)
    	g = math.gcd(g, k)
    	s += g
print(s)


Measured memory_bytes: 67652
program ABC053B
    implicit none
    integer(8)::i,top,tail,s_len
    character(200000)::s
    read(5,*)s
    s_len=len_trim(s)
    do i=1,s_len
        if(s(i:i)=='A')then
            top=i
            exit
        end if
    end do

    do i=0,s_len-1
        if(s(s_len-i:s_len-i)=='Z')then
            tail=s_len-i
            exit
        end if
    end do

    print'(i0)',tail-top+1
end program ABC053B

Measured memory_bytes: 1084
MAX_VAL = 1000000000000001
alp = 'abcdefghijklmnopqrstuvwxyz'
N = int(input())

sum = 0
factor = 0
while sum < MAX_VAL:
    if sum <= N < sum + 26 ** factor:
        break
    sum += 26 ** factor
    factor += 1

N -= sum

ans = ''
while factor > 0:
    idx = N // (26 ** (factor-1))
    ans += alp[idx]
    N -= idx * 26 ** (factor - 1)
    factor -= 1

    #print(factor, ans)

print(ans)

Measured memory_bytes: 61860
#include <bits/stdc++.h>
#define int long long
#define all(c) (c).begin(),(c).end()
#define pii pair<long long,long long>
#define endl '\n'

using namespace std;

signed main(){
    std::ios::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    vector <int> A(m,0);
    int sum=0;
    for(int i=0;i<m;i++){
        cin >> A[i];
        sum+=A[i];
    }
    //cout << sum << n;
    if(n>=sum){
        cout << n-sum;
    }
    else cout << "-1";
    
}

Measured memory_bytes: 3728
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> k >> s;
  if (Size(s) <= k)
    Cout(s);
  else {
    string co = "";
    co += s.substr(0, k);
    co += "...";
    Cout(co);
  }

  return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;

int main()
{
        int A, B, C, D;
        cin >> A >> B >> C >> D;
        if (A == C && B == D) cout << B-A << endl;
        else if (A <= C && C < B && B <= D) {
                cout << B - C << endl;
        }
        else if (A <= C && D <= B) {
                cout << D - C << endl;
        }
        else if (C <= A && B <= D) {
                cout << B - A << endl;
        }
        else if (C <= A && A < D && D <= B) {
                cout << D - A << endl;
        }
        else {
                cout << 0 << endl;
        }


}


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

using namespace std;

int main(void) {
    int n;
    map<int,int> a;
    cin>>n;

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

    long long int sum = 0;
    for(map<int,int>::iterator it = a.begin();it != a.end();it++) {
        if(it->second < it->first) {
            sum += it->second;
        } else {
            sum += it->second-it->first;
        }
    }

    cout<<sum<<endl;

    return 0;
}


Measured memory_bytes: 4736
import java.util.ArrayDeque;
import java.util.Scanner;
import java.util.function.IntConsumer;
import java.util.function.LongSupplier;
import java.util.stream.IntStream;

public class Main{
	static final Scanner s=new Scanner(System.in);
	static final long[] fal_rnd(long[] ar,LongSupplier sp){
		int l=-1,r=ar.length;
		while(l+1!=r)
			ar[Math.random()<0.5?++l:--r]=sp.getAsLong();
		return ar;
	}
	static final void REP(int t,IntConsumer i){
		for(int v=0;v<t;v++)
			i.accept(v);
	}
	static final void REPR(int t,IntConsumer i){
		for(int v=t-1;v>=0;v--)
			i.accept(v);
	}
	static final IntStream REPS(int v){
		return IntStream.range(0,v);
	};
	public static void main(String[] __){
		int n=s.nextInt(),t=s.nextInt(),count=0;
		ArrayDeque<Integer> d=new ArrayDeque<>(n+1);
		REP(n,i->d.add(s.nextInt()));
		while(d.size()!=1){
			count+=Math.min(-(d.poll()-d.peek()),t);
		}
		count+=t;
		System.out.println(count);
	}
}


Measured memory_bytes: 96624
H, W, K = map(int, input().split())

C = [list(input()) for _ in range(H)]

ans = 0
for ii in range(2**H):
    for jj in range(2**W):
        tmp = 0
        for i in range(H):
            for j in range(W):
                # print(ii>>i, jj>>j)
                if (ii>>i)&1 or (jj>>j)&1:
                    continue
                if C[i][j] =="#":
                    tmp += 1
        if tmp == K:
            ans += 1
print(ans)

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

class M{static void Main(String[] _){
  int N = int.Parse(Console.ReadLine());
  
  var L1 = new List<int>();
  var L2 = new List<int>();
  
  for(int I=2;I<55555;++I){ 
    if( !L1.Any( a => I % a == 0 ) ) L1.Add(I); 
  }
  
  for(int I=0;I<L1.Count();++I){ 
    if( L1[I] % 10 == 1 ) L2.Add(L1[I]); 
  }
  
  for(int I=0;I<N;++I) {
    Console.WriteLine( L2[I] );
  }
  
}}


Measured memory_bytes: 17396
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<cctype>
#include<stack>
#define ld long double
#define ll long long int
#define ull unsigned long long int
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long INF=1LL<<60;
//set<int>::iterator it;

int main(void){
    int n;
    cin>>n;
    int w[100];
    for(int i=0;i<n;i++){
        cin>>w[i];
    }
    int sum[100];
    int buf = 0;
    for(int i=0;i<n;i++){
        buf += w[i];
        sum[i] = buf;
        // cout<<sum[i]<<endl;
    }
    int ans = sum[n-1];
    for(int i=0;i<n;i++){
        int buf;
        buf = sum[n-1] - sum[i];
        ans = min(ans,abs(buf-sum[i]));
    }
    cout<<ans<<endl;
    return 0;
}


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

typedef long long ll;

int main() {
	int n;
	cin >> n;
	int cnt = 0;
	for (int i = 1; i <= n; i += 2) {
		int p = 0;
		for (int j = 1; j * j <= i; ++j) {
			if (i % j == 0) {
				if (j * j != i) {
					p++;
				}
				p++;
			}
		}
		if (p == 8) {
			cnt++;
		}
	}
    cout << cnt;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
#include <functional>
 
using namespace std;
typedef long long ll;
const ll INF = 1e18;

# define rep(i, n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(ll i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(ll i=((int)(n)); i>0; --i)
# define all(x) (x).begin(), (x).end()
# define pb push_back
 
ll N,X,Y;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    cin >> N >> X >> Y;
    X--; Y--;
    
    vector<ll> k(N);
    
    rep(i, N) {
        for(ll j=i+1; j<N; j++) {
            // j-i はふつうに渡ったときの距離
            // abs(X-i) + 1 + abs(Y-j) は X と Y を結ぶルートを使ったときの距離
            ll d = min(j-i, abs(X-i) + 1 + abs(Y-j));
            k[d]++;
        }
    }
    
    reps(i, N-1) {
        cout << k[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <cmath>
#include <string>
#include <iostream>
#include <queue>
#define lson l, m, rt << 1
#define rson m + 1, r, rt << 1| 1
#define maxn 200009
using namespace std;
int n;
int a[maxn], pos[maxn];
int L[maxn][25], R[maxn][25], LG[maxn];
const int INF = 1e9;
priority_queue<int>Q;
vector<int>ans;

struct segment{
	int tree[maxn << 2], lazy[maxn << 2];
	void pushdown(int rt){
		if(lazy[rt] == -1)
			return;
		tree[rt << 1] = lazy[rt];
		tree[rt << 1 | 1] = lazy[rt];
		lazy[rt << 1] = lazy[rt];
		lazy[rt << 1 | 1] = lazy[rt];
		lazy[rt] = -1;
	}

	void build(int x, int l, int r, int rt){
		lazy[rt] = -1;
		if(l == r){
			tree[rt] = x;
			return;
		}
		int m = (l + r) >> 1;
		build(x, lson);
		build(x, rson);
	}
	
	void update(int L, int R, int x, int l, int r, int rt){
		if(L <= l && r <= R){
			tree[rt] = x;
			lazy[rt] = x;
			return;
		}
		int m = (l + r) >> 1;
		pushdown(rt);
		if(L <= m)
			update(L, R, x, lson);
		if(R > m)
			update(L, R, x, rson);
	}
	
	int query(int L, int R, int l, int r, int rt){
		if(L <= l && r <= R)
			return tree[rt];
		int m = (l + r) >> 1;
		pushdown(rt);
		if(L <= m)
			return query(L, R, lson);
		else
			return query(L, R, rson);
	}
}t1,t2;

void init(){
	for(int i = 1; i <= n; i++){
		if(i & 1){
			L[i][0] = a[i];
			R[i][0] = INF;
		}
		else{
			L[i][0] = INF;
			R[i][0] = a[i];
		}
	}
	
	for(int j = 1; 1 << j <= n; j++){
		for(int i = 1; i + (1 << j) - 1 <= n; i++){
			L[i][j] = min(L[i][j - 1], L[i + (1 << (j - 1))][j - 1]);
			R[i][j] = min(R[i][j - 1], R[i + (1 << (j - 1))][j - 1]);
		}
	}
}

int RMQ(int x, int l, int r){
	int k = LG[r - l + 1];
	if(x == 1){
		return min(L[l][k], L[r - (1 << k) + 1][k]);
	}
	else{
		return min(R[l][k], R[r - (1 << k) + 1][k]);
	}
}

void modify(int l, int r){
	//cout << l << " " << r << endl;
	int mi = 0;
	if(l & 1){
		mi = RMQ(1, l ,r);
	}
	else{
		mi = RMQ(2, l, r);
	}
	Q.push(-mi);
	t1.update(l, r, l, 1, n, 1);
	t2.update(l, r, r, 1, n, 1);
}

int main(){
	for(int i = 1; i < maxn; i++)
		LG[i] = log2(i);
	cin >> n;
	for(int i = 1; i <= n; i++){
		scanf("%d", &a[i]);
		pos[a[i]] = i;
	}
	t1.build(1, 1, n, 1);
	t2.build(n, 1, n, 1);
	init();
	
	Q.push(-RMQ(1, 1, n));
	while(!Q.empty()){
		int cur = Q.top();
		Q.pop();
		cur = -cur;
		int p = pos[cur];
		int pp = p;
		int ed = t2.query(p, p, 1, n, 1);
		int bg = t1.query(p, p, 1, n, 1);
		ans.push_back(cur);
		int mi;
		if(p & 1){
			//printf("query %d %d\n", p, ed);
			 mi = RMQ(2, p, ed);
		}
		else{
			 mi = RMQ(1, p, ed);
		}
		ans.push_back(mi);	
		pp = pos[mi];
		//printf(">>>>%d %d %d\n", p, pp, mi);
		if(bg < p)
			modify(bg, p - 1);
		if(pp - 1 >= p + 1)
			modify(p + 1, pp - 1);
		if(pp < ed)
			modify(pp + 1, ed);
		//int tt; cin >> tt;
	}
	for(int i = 0; i < ans.size(); i++){
		printf("%d", ans[i]);
		if(i == n - 1) puts("");
		else printf(" ");
	}
	return 0;
}


Measured memory_bytes: 56564
#include <bits/stdc++.h>
using namespace std ;
int main () {
  int N;
  cin>>N;
  string ans = "Hello World";
  if(N == 1){
    cout<<ans<<endl;
  }else if(N == 2){
    int A, B;
    cin>>A>>B;
    cout<< A+B <<endl;
  }
  
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
#include <climits>
#include <iterator>
#include <iomanip>
#include <stack>
#include <set>
#include <bitset>
#include <functional>
using namespace std;
const constexpr int INF = 1e9;
//typedef std::pair<std::string,double> P;


#define FOR(i, a, n) for (ll i = (ll)a; i<(ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long ll;
typedef vector<int> VI;
const constexpr ll MOD = 1e9+7;
vector<pair<int, int> > vp;
 
struct Less {
    bool operator()(const pair<int, int>& x, const pair<int, int>& y) const {
        return x.first > y.first;
    }
};

ll GCD(ll a, ll b){
    if(b==0) return a;
    return GCD(b, a%b);
}


//グラフの隣接リスト
VI g[200010];
//頂点の入次数を管理
int h[100010];
ll N, C, K;
ll t[100010];
int main(void) {
    ll n, m, d; cin >> n >> m >> d;
    if(d==0){
        cout << fixed <<setprecision(10) << (double)(m-1)/n << endl;
        return 0;
    }else{
        cout << fixed << setprecision(10) << (double)(m-1)*2*(n-d)/(n*n) << endl;
    }
    return 0;
}

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

int main() {
  int x,a,b;cin>>x>>a>>b;
  string ans;
  if (a - b >= 0) ans = "delicious";
  else if ((b - a) - x <= 0) ans = "safe";  
  else ans = "dangerous";
  cout << ans << endl;
}

Measured memory_bytes: 3520
#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>
#include <queue>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define S2(x,y) scanf("%d%d",&x,&y)
#define P(x) printf("%d\n",x)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second
#define pb push_back
#define mp make_pair

typedef long long int LL;
typedef pair<int, int > pii;
typedef vector<int > vi;

const int N = 100005;

int A[N];

int main() {
  int n;
  S(n);
  while(n--) {
    int x;
    S(x);
    A[x]++;
  }
  int ans = A[0] + A[1];
  rep(i,1,100000) {
    ans = max(ans, A[i] + A[i-1] + A[i+1]);
  }
  P(ans);
  return 0;
}

Measured memory_bytes: 640
N = int(input())

if N==0:
    print(0)
    exit()

ans = []
t = 1
p = 1

while N!=0:
    if N%(p*2)!=0:
        ans.append(1)
    else:
        ans.append(0)

    N -= ans[-1]*p*t
    t *= -1
    p *= 2

print(''.join(map(str, ans[::-1])))

Measured memory_bytes: 38640
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    string s; cin>>s;
    stack<int> st;
    REP(i,s.size()){
        if(st.empty()) st.push(s[i]);
        else{
            if(st.top()==s[i]) st.push(s[i]);
            else st.pop();
        }
    }
    cout<<s.size()-st.size()<<endl;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
const long long INF = 1e15;

//繰り返し二乗法
ll EX(ll x,ll n){
    if(n == 0) return 1;
    else if(n%2 == 1) return EX(x,n-1)*x;
    else return EX(x*x,n/2);
}

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

    int n;
    cin >> n;

    int dp[100000+10];
    int d[2] = {6,9};

    for(int i = 0; i <= n; i++) dp[i] = i;
    for(int i = 1; i <= n; i++){
        for(int j = 0; j < 2; j++){
            for(int k = 0; k < 10; k++){
                if(EX(d[j],k) <= i) dp[i] = min(dp[i],dp[i-EX(d[j],k)]+1); 
            }
        }
    }
    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 4004
import fractions
a,b,c,d = map(int, input().split())
lcm = (c*d)//fractions.gcd(c,d)
sum = b-a+1
x = (b//c) - ((a-1)//c)
y = (b//d) - ((a-1)//d)
z = (b//lcm) - ((a-1)//lcm)
n_i = x+y-z
print(int(sum-n_i))

Measured memory_bytes: 5348
import java.util.Scanner;

public class Main {

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

        int a = sc.nextInt();
        String s = sc.next();
        if (a >= 3200) {
            System.out.println(s);
        } else {
            System.out.println("red");
        }

    }

}

Measured memory_bytes: 21716
#include <cstdio>

int main (){
    int N;
    scanf("%d",&N);
    int a[N],b[N];
    for (int i = 0; i < N; i++){
        scanf("%d",&a[i]);
        b[a[i]-1]=i+1;
    }
    for (int i = 0; i < N; i++){
        printf("%d ",b[i]);
    }
}

Measured memory_bytes: 1536
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var Ai = Sarray().OrderByDescending(a => a).ToArray();
            var cst = 0L;
            for (var i = 1; i < 3; ++i)
                cst += Abs(Ai[i] - Ai[i - 1]);
            WriteLine(cst);
        }
 
        static long Mod = 998244353;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

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

int main() {
    int n,AC=0,WA=0,TLE=0,RE=0;
    cin >> n;
    for (int i = 0; i < n; i++){
        string s;
        cin >> s;
        if(s == "AC")AC++;
        if(s == "WA")WA++;
        if(s == "TLE")TLE++;
        if(s == "RE")RE++;
    }
    cout << "AC x " << AC << endl;
    cout << "WA x " << WA << endl;
    cout << "TLE x " << TLE << endl;
    cout << "RE x " << RE << endl;
}

Measured memory_bytes: 3592
#include <iostream>
using namespace std ;
int main (){
    int D, N, a, b;
    cin >> D >> N ;
    a = 2 * N + 1 ;
    b = D / a ;
    if(D%a == 0){
        cout << b << '\n' ;
    }
    if(D%a >= 1){
        cout << b + 1 << '\n' ;
    }

    return 0 ;
}

Measured memory_bytes: 256
K = int(input())

S = list(range(1, 10))
A = S[:]

cnt = 0
while len(A) < K:
    T = []
    for s in S:
        q, r = divmod(s, 10)
        if r != 0:
            T.append(s * 10 + r - 1)
        T.append(s * 10 + r)
        if r != 9:
            T.append(s * 10 + r + 1)
    S = T
    A += T

print(A[K - 1])

Measured memory_bytes: 12700
loop do
  n, m, a = gets.chomp.split.map &:to_i
  break if n == 0 && m == 0 && a == 0

  lines = Array.new
  n.times do |i|
    lines[i] = Array.new
  end

  m.times do
    h, p, q = gets.chomp.split.map &:to_i
    lines[p-1][h] = q-1
    lines[q-1][h] = p-1
  end

  current = a-1
  1000.downto(1) do |h|
    current = lines[current][h] unless lines[current][h].nil?
  end

  puts current+1
end

Measured memory_bytes: 8700
#include<iostream>
#include<cstring>
using namespace std;
#define ll long long int
 
ll dp[100005];
ll a[100005];
ll n;
ll jump(ll i)
{
    if(i==n)
    return 0;
    if(i>n)
    return 1000000009;
    
    
    if(dp[i]!=-1)
    return dp[i];
    
    dp[i]=min(abs(a[i]-a[i+1])+jump(i+1),abs(a[i]-a[i+2])+jump(i+2));
    
    return dp[i]; 
    
    
}
int main() 
{
    memset(dp,-1,sizeof(dp));
    
    cin>>n;
 
    for(ll i=1;i<=n;i++)
    cin>>a[i];
    dp[0]=0;
    ll res=jump(1);
    cout<<res<<endl;
    
 
	return 0;
}

Measured memory_bytes: 4992
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
int getDigit(int n);            // 数字の桁数を取得する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。
vector<pair<long long,long long>> prime_factorize(long long p); // 素因数分解

// class
// ------------------------------------------------
class Combi {
  public:
    Combi();
    long long Combination(long long n, long long k);
    long long nPk_modp(long long n, long long k, long long p);
  private:
    map<long long, map<long long, long long>> memo;
    long long n_num;
    long long k_num;
};

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(long long(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(long long(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<long> vll;
// code
// ------------------------------------------------
int main() {

    ll x;
    cin  >> x;

    ll ans = (LCM(360,(int)x)) / x;

    cout << ans << endl;


    return 0;

}
// funcの実体
// ------------------------------------------------
int getDigit(int n) {
  int i = 1;
  while(1) {
    n = n / 10;
    if(n == 1)
      break;
    i++;
  }
  return i;
}
int CalcSumOfDigit(int n) {
  int s = 0;
  while(n) {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str) {
  for(auto itr = str.begin();itr != str.end() ; itr++) {
    if(97 <= *itr && *itr <= 122) {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str) {
  for(auto itr = str.begin();itr != str.end() ; itr++) {
    if(65 <= *itr && *itr <= 90) {
      *itr = *itr + 32;
    }
  }
  return str;
}


Combi::Combi() {
  n_num = -1;
  k_num = -1;
};

ll Combi::Combination(ll n, ll k) {

  ll ret;
  if(memo[n][k] != 0) {
    ret = memo[n][k];
  } else if(n == k || k == 0) {
    memo[n][k] = 1;
    ret = 1;
  } else {
    ret = Combination(n - 1, k - 1) + Combination(n - 1, k);
    memo[n][k] = ret;
  }
  return ret;
}

long long Combi::nPk_modp(long long n, long long k, long long p) {
  ll ans = 1;
  for(long long i = k; i <= n; i++) {
    ans = (ans * i) % p;
  }

  return ans;
};

vector<pair<long long,long long>> prime_factorize(long long p) {
    vector<pair<long long,long long>> ret;

    for(long long x = 2; x * x <= p; ++x) {
        if(p % x != 0) continue;
        long long num = 0;
        while(p % x == 0) {
            num++;
            p /= x;
        }
        ret.push_back(make_pair(x,num));
    }

    if(p != 1) ret.push_back(make_pair(p, 1));
    
    return ret;
}

Measured memory_bytes: 3528
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ld long double
#define fi first
#define se second
#define all(uiet) uiet.begin(),uiet.end()
#define read(UIET) for(int i = 0; i < n; ++i) cin >> UIET[i]
#define out(UIET) for(int i = 0; i < n; ++i) cout << UIET[i]
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vpp vector<pair< int, int > >
#define pll pair<int , int >
#define ppll pair < pll , pll >
#define debug(n1) cout << n1 << endl
#define len(a) ((int) (a).size())
#define endl "\n"
#define mod 1000000007
const int INF=(1LL<<60)-1;
int32_t main(){
    SPEED;
    int k, s;
    cin >> k >> s;
    int res = 0;
    for(int i = 0; i <= k; ++i){
        for(int j = 0; j <= k; ++j){
            int ans = s - (i + j);
            if(ans >= 0 && ans <= k) res++;
        }
    }
    cout << res << endl;
}

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

int main () {

int n = -1, max = 0, cum = 0;


cin >> n;

int foo[5000];

    while (n) {

    for (int i = 0; i < n; i++) {

        cin >> foo [i];

        if (i == 0)
            max = foo [i];

        if (cum < 0)
            cum = 0;

            cum += foo[i];


        if (cum > max)
            max = cum;

        }

    cout << max << endl;

    max = 0;
    cum = 0;

    cin >> n;

    }


    return 0;

}

Measured memory_bytes: 1176
N=int(input())
Red=[[int(s) for s in input().split()] for _ in range(N)]
Blue=[[int(s) for s in input().split()] for _ in range(N)]

#x座標が小さい順->y座標が大きい順にソート
Blue=sorted(Blue,key=lambda x:(x[0],-x[1]))

#y座標が大きい順にソート
Red =sorted(Red ,key=lambda x:-x[1])

ans=0
for x,y in Blue:
  for i,point in enumerate(Red):
    a,b=point
    if a<x and b<y:
      ans+=1
      del Red[i]
      break
print(ans)
  
  

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string t;
    cin >> t;
    for (int i = 0; i < t.size(); ++i)
    {
        if (t[i] == '?')
            t[i] = 'D';
    }
    cout << t << endl;
}

Measured memory_bytes: 3680
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n = f()[0]
    ans = 1
    mod = 1000*1000*1000 + 7
    for i in range(1, n+1):
        ans *= (i%mod)
        ans %= mod
    print(ans)

solve()


Measured memory_bytes: 2940
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <math.h> // sqrt()
#define rep(i , n) for (int i = 1; i <= (int)(n); i++)
#define repz(i , n) for (int i = 0; i < (int) n; i++)
#define repi(i , r, n) for (int i = r; i <= (int)(n); i++)
#define repd(i , r, n) for (int i = r; i >= (int)(n); i--)

using namespace std;

int main(){
    int64_t a , b , c , k;
    cin >> a >> b >> c >> k;
    if ( abs( a - b)  <= pow( 10 ,18 )){
        if ( k % 2 )cout << b - a << endl;
        else cout << a - b << endl;
        return 0;
    }
    else
        cout << "Unfair" << endl;
    return 0;
    
}

Measured memory_bytes: 3680
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve(long long N, long long K, std::vector<long long> t, std::vector<long long> d){
    vector<pair<ll,ll >> sushi(N); //(val,id)
    for (ll i=0;i<N;i++){
        sushi[i] = make_pair(d[i],t[i]);
    }
    vector<bool> used(N+1,false);
    vector<ll> surplus_sushi;
    ll count = 0;
    ll value_sum = 0;
    sort(sushi.begin(),sushi.end());
    for (int i=0;i<K;i++){

        if(!used[sushi[N-1-i].second]){
            used[sushi[N-1-i].second] = true;
            value_sum += sushi[N-1-i].first;
            count++;
        }else{
            value_sum += sushi[N-1-i].first;
            surplus_sushi.push_back(-sushi[N-1-i].first);
        }
    }
    sort(surplus_sushi.begin(),surplus_sushi.end());
    ll id = K;
    ll maximum = value_sum + count *count;
    while(!surplus_sushi.empty()&& (N-1-id >= 0)){
        if (!used[sushi[N-1-id].second]){
            used[sushi[N-1-id].second]=true;
            value_sum+=surplus_sushi.back() + sushi[N-1-id].first;
            surplus_sushi.pop_back();
            count++;
            maximum = max(maximum,value_sum+count*count);
        } 
        id++;
    }
    printf("%lld\n",maximum);


}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> t(N);
    std::vector<long long> d(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&t[i]);
        scanf("%lld",&d[i]);
    }
    solve(N, K, std::move(t), std::move(d));
    return 0;
}


Measured memory_bytes: 3968
#include<iostream>
#include<cmath>
using namespace std;
int main() {
    string ss; cin >> ss;
    int a[10];
    //cout << (char)97 << endl;
    //cout << ss << endl;
    for (int i = 0; ss[i]; i++) {
        a[i] = (ss[i] + 2 ) % 10;
    }
    /*for (int i = 0; i < ss.length(); i++) {
     cout << a[i];
     }
    cout << endl;*/
    int n = (int)ss.length();
    int ans = a[n-3]*100 + a[n-2]*10 + a[n-1];
    //cout << "ans " << ans << endl;
    for (int i = 1; i < n - 2; i++) {
        int b = a[n - 1 - i] + a[n - 1 - i - 1] * 10 + a[n - 1 - i -2] * 100;
        if (fabs(ans - 753) > fabs(b - 753) ) ans = b;
    }
    cout << fabs(ans - 753) << endl;
}


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

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

  int d;cin>>d;
  cout<<"Christmas";
  for(int i=d;i<25;i++){
    cout<<" Eve";
  }
  cout<<endl;

  return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
class Main
{
  public static void main(String args[])throws Exception
  {
    Scanner Sc=new Scanner(System.in);
    int n=Sc.nextInt();
    double sum=0;
    ArrayList<Integer> list=new ArrayList<>();
    for(int i=0;i<n;i++)
    {
      list.add(Sc.nextInt());
    }
    Collections.sort(list);
    sum=list.get(0);
    for(int i=1;i<n;i++)
    {
        int a=list.get(i);
        sum=(sum+a)/2;
    }
    System.out.println(sum);
  }
}

Measured memory_bytes: 23508