akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

int ConvertInt(string s){ int a = 0; rep(i,s.size())if(s[i]!='-')a+=(s[i]-'0')*pow(10,(float)s.size()-i-1); return s[0]!='-'?a:-a;}

int main()
{
	int n;
	cin >> n;
	while(n--)
	{
		string str;
		cin >> str;

		string top = str, bottom = str;

		sort(ALL(top), greater<char>());
		sort(ALL(bottom));

		cout << ConvertInt(top) - ConvertInt(bottom) << endl;
	}
}

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

typedef long long ll;
#define rep(i, n) for(ll i=0; i<n; i++)
#define FOR(i, a, b) for(ll i=a; i<b; i++)
#define sz(v) ll(v.size)

int main(){
    ll A, B;
    cin >> A >> B;
    if (A == B) {
        cout << A + B << endl;
    } else {
        cout << 2 * max(A, B) - 1;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;
ll Mod = 1000000007;
int main() {
  int N;
  cin >> N;
  vector<P> work(N);
  bool ans = true;
  for (int i = 0; i < N; i++) {
    cin >> work[i].S >> work[i].F;
  }
  sort(work.begin(),work.end());
  ll R[N];
  R[0] = work[0].S;
  for (int i = 1; i < N; i++) {
    R[i] = R[i-1] + work[i].S;
  }
  for (int i = 0; i < N; i++) {
    if (R[i] > work[i].F) {
      ans = false;
    }
  }
  if (ans) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 7984
fn main() {
    let v = read_vec::<u32>();
    let a = v[0];
    let b = v[1];
    let c = v[2];

    for i in 1..1001 {
        if a * i % b == c {
            println!("YES");
            return;
        }
    }
    println!("NO");
}

#[allow(dead_code)]
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()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

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

		int N = sc.nextInt();
		String s = sc.next();

		Map<Character, Integer> map = new HashMap<>();

		map.put('R', 0);
		map.put('B', 0);
		for (int i = 0; i < s.length(); i++) {
			char c = s.charAt(i);
			if (c=='R') {
				int cnt = map.get('R') + 1;
				map.put('R', cnt);
			} else {
				int cnt = map.get('B') + 1;
				map.put('B', cnt);
			}
		}
		int r = map.get('R');
		int b = map.get('B');
		if (r > b) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 23636
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <cctype>    // isupper, islower, isdigit, toupper, tolower
#include <cstdint>   // int64_t, int*_t
#include <cstdio>    // printf
#include <deque>     // deque
#include <iomanip>
#include <iostream> // cout, endl, cin
#include <map>      // map
#include <math.h>
#include <numeric>
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <string>        // string, to_string, stoi
#include <tuple>         // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility>       // pair, make_pair
#include <vector>        // vector
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int INF = 1001001001;
const int BG = 1000000007;

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

    rep2(i, 1, N + 5)
    {
        int64_t nums = i * i;
        if (nums > N)
        {
            cout << (i - 1) * (i - 1) << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
n=int(input())
f=True
r=0
i=1
while r<n:
  i+=1
  r=i*(i-1)//2
  if r==n:
    f=False
if f:
  print("No")
else:
  ans=[[] for j in range(i)]
  j=1
  for a in range(i):
    for b in range(a+1,i):
      ans[a].append(j)
      ans[b].append(j)
      j+=1
  print("Yes")
  print(i)
  for a in range(i):
    print(" ".join(map(str,[len(ans[a])]+ans[a])))

Measured memory_bytes: 75204
#include<bits/stdc++.h>
#define to edge[i].v
#define mp make_pair
#define rint register int
#define debug(x) cerr<<#x<<"="<<x<<endl
#define fgx cerr<<"-------------"<<endl
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
int a[1000];
int main()
{	int n,id=0; double sum=0,mn=1e18; cin>>n;
	for(rint i=1;i<=n;i++) scanf("%d",&a[i]),sum+=a[i];
	sum=sum/n;
	for(rint i=1;i<=n;i++) if(fabs(sum-a[i])<mn) mn=fabs(sum-a[i]),id=i;
	cout<<id-1;
	return 0;
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
#define LL long long

using namespace std;

int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    if(a==2||b==2)
    {
        printf("No\n");
    }
    else
    {
        printf("Yes\n");
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(long long i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,N-1,0)
#define RREPS(i,n) RFOR(i,N,1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
const int INF=1e18;
const int MOD=1e9+7;
const int MAX_N=1e5;

signed main(){
    string S;cin>>S;
    int N=S.size();
    int pc=0;
    REP(i,N){
        if(S[i]=='p')pc++;
    }
    int d=N/2;
    cout<<d-pc<<endl;
}

Measured memory_bytes: 512
#include <stdio.h>

int
main(void)
{
    char ch;
    while ((ch = getchar()) != '0' && ch != EOF) {
        int n = 0;
        while (ch >= '0' && ch <= '9') {
            n += ch - '0';
            ch = getchar();
        }
        printf("%d\n", n);
    }
    return 0;
}


Measured memory_bytes: 2044
##from scipy.sparse.csgraph import csgraph_from_dense,floyd_warshall
##import numpy as np
from itertools import permutations
N,M,R = map(int,input().split())
r = list(map(int,input().split()))

"""
https://juppy.hatenablog.com/entry/2018/11/01/%E8%9F%BB%E6%9C%AC_python_%E5%85%A8%E7%82%B9%E5%AF%BE%E6%9C%80%E7%9F%AD%E7%B5%8C%E8%B7%AF%E6%B3%95%EF%BC%88%E3%83%AF%E3%83%BC%E3%82%B7%E3%83%A3%E3%83%AB%E3%83%95%E3%83%AD%E3%82%A4%E3%83%89%E6%B3%95
"""

def warshall_floyd(d):
    n = len(d)
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d

graph = [[float("inf") for i in range(N)] for j in range(N)] 
for i in range(M):
    A,B,C = map(int,input().split())
    graph[A-1][B-1] = C
    graph[B-1][A-1] = C

dist = warshall_floyd(graph)

ans = 1e10
for i in permutations(r):
    flag = True
    way = list(i)
    tmp = 0
    for i in range(len(way)-1):
        if dist[way[i]-1][way[i+1]-1] < 0:
            flag = False
            break
        tmp += dist[way[i]-1][way[i+1]-1]
    if flag:
        ans = min(tmp,ans)

print(ans)

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

int main(){
  int n;
  long long a[86];
  a[0] = 2;
  a[1] = 1;
  scanf("%d",&n);
  
  
  for(int i = 2; i <= n; i++)a[i] = a[i-1] + a[i-2];
    printf("%lld",a[n]);
}

Measured memory_bytes: 3820
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        int count=0;
        String w,t;
        w=scan.next();
        w=w.toLowerCase();
        while(true) {
        	t=scan.next();
        	if(t.equals("END_OF_TEXT")) {
        		break;
        	}
        	t=t.toLowerCase();
        	if(t.equals(w)) {
        		count++;
        	}
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 26216
H,W = map(int,input().split())
S = [list(input()) for i in range(H)]

G_jouge = []
G_sayu = []
for h in range(H):
    G_migi = []
    G_hidari = []
    r = 0
    l = 0
    for w in range(W):
        if S[h][w] == '.':
            G_migi.append(r)
            r += 1
        else:
            r = 0
            G_migi.append(r)
        if S[h][W-1-w] == '.':
            G_hidari.append(l)
            l += 1
        else:
            l = 0
            G_hidari.append(l)
    G_sayu.append([G_hidari[W-1-i]+G_migi[i] for i in range(W)])
for w in range(W):
    G_migi = []
    G_hidari = []
    r = 0
    l = 0
    for h in range(H):
        if S[h][w] == '.':
            G_migi.append(r)
            r += 1
        else:
            r = 0
            G_migi.append(r)
        if S[H-1-h][w] == '.':
            G_hidari.append(l)
            l += 1
        else:
            l = 0
            G_hidari.append(l)
    G_jouge.append([G_hidari[H-1-i]+G_migi[i] for i in range(H)])

ans = 0
for h in range(H):
    for w in range(W):
        ans = max(ans,G_sayu[h][w]+G_jouge[w][h])
print(ans+1)

Measured memory_bytes: 253004
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  ll N, K;
  cin>>N>>K;
  ll ans = 0;
  ll t;
  for(ll b=K+1;b<=N;++b) {
    t = (N+1)/b;
    ans += t*(b-K);
    if(t*b+K<=N) ans += (N-(t*b+K)+1);
  }
  if(K==0) ans -= N;
  cout<<ans<<endl;
}



Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include <unordered_map>
typedef long long ll;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i == n-1];}
#define printp(x,n) for(ll i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
const ll MOD = 1e9 + 7;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b,c;
    cin >> a >> b >> c;
    print(a+b+c-max(max(a,b),c));
}


Measured memory_bytes: 256
import java.util.Scanner;

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

	int n = scan.nextInt();
	int mae = n/10;
	int ato = n%1000;

	int flag = -1;
	for(int i = 0; i <= 9; i++){
	    if(mae == 111*i || ato == 111*i){
		flag = 1;
	    }
	}
	if(flag == 1){
	    System.out.println("Yes");
	}else{
	    System.out.println("No");
	}
	
    }
}


Measured memory_bytes: 21972
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>

#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <iostream>
#include <limits>
#include <numeric>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

map<int, int> cur;

int main() {


  int v;
  scanf("%d", &v);
  cur[v] = 1;
  for (int rep = 2; ; ++rep) {
    if (v & 1)
      v = v * 3 + 1;
    else
      v /= 2;
    if (cur[v]) {
      printf("%d\n", rep);
      return 0;
    }
    cur[v] = rep;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<61;
const ll mod=1e9+7;

const double pi=acos(-1);

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

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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int i,j;
	double r;
	cin>>r;
	cout<<fixed<<setprecision(10)<<r*2*pi<<endl;

}

Measured memory_bytes: 3804
a = [1,0,0]
idx = {"A"=>0,"B"=>1,"C"=>2,"A\n"=>0,"B\n"=>1,"C\n"=>2}

while str = gets do
b = []
b = str.split(",")
a[idx[b[0]]] , a[idx[b[1]]] = a[idx[b[1]]],a[idx[b[0]]]

end

if a[0] == 1
puts "A"
elsif a[1] == 1
puts"B"
else
puts"C"
end

Measured memory_bytes: 6096
/*
If you want to shine like a sun, first burn like a sun.
*/

#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;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ll long long int
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define v2i vector<vector<int>>
#define v2l vector<vector<ll>>
#define ppi pair<int,int>
#define ppl pair<ll,ll>
#define vpi vector<ppi>
#define vpl vector<ppl>
#define all(x) x.begin(),x.end()
#define ii int,int 
#define ff first    
#define ss second
#define forn(i,a,b) for(int i=a;i<b;i++)
#define forr(i,a,b) for(int i=a;i>=b;i--)
#define forv(i,m) for(auto i : m)
#define imx INT_MAX
#define imn INT_MIN
#define inf 9000000000000000000
#define minf -inf
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define sze size()
#define rvs reverse 
#define itr iterator 
#define pre cout<<fixed<<setprecision(10);
#define umap unordered_map
#define uset unordered_set
#define pi 3.141592653589793
#define MAXN 100005
#define test1(x) cout << #x " = " << x << endl;
#define test2(x,y) cout << #x " = " << x << " " << #y " = " << y << endl;
#define test3(x,y,z) cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << endl;
#define test4(w,x,y,z) cout << #w " = " << w << " " << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << endl;
const ll infinity = 9e18;

/*
#define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define MODM(a,b,md) ((a%md)*(b%md))%md
#define MODA(a,b,md) ((a%md)+(b%md))%md
#define ull unsigned long long int
*/

/*
bool compare(int a,int b) {return a > b;}
bool compare1(ppi a,ppi b) {return a.ff > b.ff;}
bool compare2(ppi a,ppi b) {return a.ss < b.ss;}
ll Npower(ll a,ll b) {ll product = 1; while(b){if(b&1){product = product*a;}a = a*a;b = b>>1;} return product;}
ll power(ll a,ll b,ll md) {ll product = 1; while(b){if(b&1){product = MODM(product,a,md);}a = MODM(a,a,md);b = b>>1;} return product%md;}
bool isprime(ll n){if(n < 2) return 0; ll i = 2; while(i*i <= n){if(n%i == 0) return 0; i++;} return 1;}
ll GCD(ll a,ll b) {return b==0 ? a:GCD(b,a%b);}
ll LCM(ll a,ll b) {return (a/GCD(a,b))*b; }
*/


int main()
{
    fast

/*
    #ifndef ONLINE_JUDGE
        freopen("input.txt",  "r",  stdin);
        freopen("output.txt", "w", stdout);
    #endif
//*/

    
    ll n;
    cin>>n;

    ll sum = 0;

    sum = (n*(n+1))/2;

    sum = sum - 3*((n/3)*((n/3)+1)/2);
    sum = sum - 5*((n/5)*((n/5)+1)/2);
    sum = sum + 15*((n/15)*((n/15)+1)/2);

    cout<<sum;





    return 0;
}

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

int main() {
  int N, K; cin >> N >> K; int aa, bb;
  priority_queue<int> p;
  vector<int> a[100001];
  for(int i=0; i<N; i++) {
    cin >> aa >> bb;
    a[aa].push_back(bb);
  }
  
  int ans = 0;
  
  for(int i=K-1; i>=0; i--) {
    for(int x:a[K-i]) p.push(x);
    if (p.empty()) continue;
    ans += p.top();
    //cout << p.top() << endl;
    p.pop();
  }
  
  cout << ans << endl;
}

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

#define ll long long
#define pb push_back
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define fr freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define mp make_pair
#define F first
#define S second

using namespace std;

const int N = 5e5 + 2;
const int mod = 1e9 + 7;

ll n;
int main ()
{
	speed;
	cin>>n;
	cout<<(n*(n+1))/2;
}



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


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

	long long stoles=0;
	int previous=0;
	int current;
	for (int i=0; i<n ; i++){
		cin >> current;

		int diff = current - previous;
		if (diff < 0){
			stoles -= diff;
			previous = current - diff;
		}else{
			previous = current;
		}

	}



	cout << stoles;
	return 0;
}



Measured memory_bytes: 3600
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define MOD 1000000007
int n;
int dp[1 << 21][21];
bool a[22][22];
ll allmask;

void add(int &a, int b) {
  a += b;
  a %= MOD;
}

ll solve(int mask, int i) {
  if (mask == allmask) return 1;
  if (i >= n) return 0;
  if (dp[mask][i] != -1) return dp[mask][i];
  dp[mask][i] = 0;
  for (int j = 0; j < n; j++) {
    if (a[i][j] && (mask & (1 << j)) == 0) {
      add(dp[mask][i], solve(mask | (1 << j), i + 1));
    }
  }
  return dp[mask][i];
}

int main() {
  int t = 1;
  while (t--) {
    cin >> n;
    memset(dp, -1, sizeof(dp));
    allmask = (1 << n) - 1;
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++)
        cin >> a[i][j];
    cout << solve(0, 0) << endl;
  }
}


Measured memory_bytes: 172416
#include <set>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
using std::min; using std::max;
using std::swap; using std::sort;
using std::unique; using std::lower_bound;
typedef long long ll;

template<typename T>
void read(T &x) {
	int flag = 1; x = 0; char ch = getchar();
	while(ch < '0' || ch > '9') { if(ch == '-') flag = -flag; ch = getchar(); }
	while(ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar(); x *= flag;
}
#if __cplusplus >= 201103l
template<typename T, typename... V>
void read(T &x, V&... v) { read(x), read(v...); }
#endif

const int _ = 1e5 + 10, Inf = 1e5;
int n, a[_], sum[_];
int c[_ << 1];
void add(int x) { for(; x <= (Inf << 1); x += x & -x) ++c[x]; }
ll que(int x) { ll y = 0; for(; x; x -= x & -x) y += c[x]; return y; }

bool check(int mid) {
	for(int i = 1; i <= (Inf << 1); ++i) c[i] = 0;
	for(int i = 1; i <= n; ++i)
		sum[i] = sum[i - 1] + (a[i] < mid ? -1 : 1);
	ll pair = 0;
	for(int i = 0; i <= n; ++i) {
		pair += que(sum[i] + Inf);
		add(sum[i] + Inf);
	}
	return pair >= 1ll * n * (n + 1) / 4;
}

int main () {
	read(n); int l = 0, r = 0;
	for(int i = 1; i <= n; ++i)
		read(a[i]), r = max(r, a[i]);
	while(l <= r) {
		int mid = (l + r) >> 1;
		if(check(mid)) l = mid + 1;
		else r = mid - 1;
	}
	return printf("%d\n", r), 0;
} 


Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
using namespace std;

typedef pair <int, int> pii;
typedef long long ll;

const ll inf = 1e14 + 1;
const double eps = 1e-9;
const int MAXN = 401;

int n;
ll a[MAXN];
ll pref[MAXN];
ll dp[MAXN][MAXN];

int main(){

    cin >> n;

    pref[0] = 0;
    for (int i = 0; i <= n; i++)
        for (int j = 0; j <= n; j++)
            dp[i][j] = inf;

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

    for (int i = 2; i <= n; i++){
        for (int j = 0; j <= n-i; j++){
            //dp[j][i]
            for (int dl = 1; dl < i; dl++){
                dp[j][i] = min(dp[j][i], dp[j][dl] + dp[j+dl][i-dl] + pref[j+dl] - pref[j] + pref[j+i] - pref[j+dl]);
            }
        }
    }

    cout << dp[0][n];

    return 0;

}


Measured memory_bytes: 1536
import java.util.Comparator;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		Map<Integer, Integer> map = new TreeMap<>(Comparator.reverseOrder());

		for (int i = 0; i < n; i++) {
			int tmp = scanner.nextInt();
			if (map.containsKey(tmp)) {
				map.put(tmp, map.get(tmp) + 1);

			} else {
				map.put(tmp, 1);
			}
		}

		int cnt = 0;
		int max1 = 0;
		int max2 = 0;
		int sq = 0;
		boolean judge = true;
		for (int i : map.keySet()) {
			int tar = map.get(i);
			if (tar >= 2 && cnt == 0) {
				max1 = i;
				cnt++;
			} else if (tar >= 2 && cnt == 1) {
				max2 = i;
				cnt++;
			}
			if (tar >= 4 && judge) {
				sq = i;
				judge = false;
			}
		}

		if (cnt == 2) {
			System.out.println(Math.max((long) max1 * max2, (long) sq * sq));
		} else if (sq != 0) {
			System.out.println((long) sq * sq);
		} else {
			System.out.println(0);
		}
	}
}

Measured memory_bytes: 62908
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>

const int mod = 1e9 + 7;
const int kmax = 510000;

long long fact[kmax], fact_inv[kmax], inv[kmax];

int gcd(int a, int b)
{
    if (!b) {
        return a;
    }

    return gcd(b, a % b);
}

void init_comb()
{
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < kmax; i++) {
        fact[i] = fact[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
    }
}

long long comb(int n, int r)
{
    if (n < r) {
        return 0;
    }

    if (n < 0 || r < 0) {
        return 0;
    }

    return fact[n] * (fact_inv[r] * fact_inv[n - r] % mod) % mod;
}

template <typename T, T N>
class UnionFind {
    T parent_[N];
    T rank_[N];
    T size_[N];

public:
    UnionFind();
    T Root(T idx);
    bool IsSame(T x, T y);
    void Unite(T x, T y);
    T GetSize(T idx);
};

template <typename T, T N>
UnionFind<T, N>::UnionFind()
{
    for (T i = 0; i < N; i++) {
        parent_[i] = i;
        rank_[i] = 0;
        size_[i] = 1;
    }
}

template <typename T, T N>
T UnionFind<T, N>::Root(T idx)
{
    return parent_[idx] == idx ? idx : parent_[idx] = Root(parent_[idx]);
}

template <typename T, T N>
bool UnionFind<T, N>::IsSame(T x, T y)
{
    return Root(x) == Root(y);
}

template <typename T, T N>
void UnionFind<T, N>::Unite(T x, T y)
{
    x = Root(x);
    y = Root(y);
    if (x == y) {
        return;
    }

    if (rank_[x] < rank_[y]) {
        parent_[x] = y;
        size_[y] += size_[x];
    } else {
        parent_[y] = x;
        size_[x] += size_[y];
        if (rank_[x] == rank_[y]) {
            rank_[x]++;
        }
    }
}

template <typename T, T N>
T UnionFind<T, N>::GetSize(T idx)
{
    return size_[Root(idx)];
}

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

    std::vector<bool> dp(n + 1, false);
    dp[n] = true;

    for (int i = n; i >= 1; i--) {
        for (auto num : { 100, 101, 102, 103, 104, 105 }) {
            if (i - num >= 0) {
                dp[i - num] = dp[i] | dp[i - num];
            }
        }
    }

    std::cout << (dp[0] ? 1 : 0) << std::endl;
}


Measured memory_bytes: 888
package main

import (
	"fmt"
)

func main() {
	var N int
	fmt.Scan(&N)

	res := 0
	for i := 1; i <= N; i++ {
		res += f(N,i)
	}
	fmt.Println(res)
	
}

func f(n, x int) int {
	y := n/x
	return (y*(y+1) *x)/2
}

Measured memory_bytes: 1792
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        
        if(N%2==0){
            System.out.println(N);
        }else{
            System.out.println(2*N);
        }
    }
}


Measured memory_bytes: 20820
from __future__ import division, print_function

def main():
    n = int(input())
    a = [list(map(int, input().split())) for _ in range(n)]
    dp = [[0 for _ in range(3)] for _ in range(n)]
    for i in range(n):
        if i == 0:
            dp[i][0] = a[i][0]
            dp[i][1] = a[i][1]
            dp[i][2] = a[i][2]
            continue
            
        dp[i][0] = a[i][0] + max(dp[i - 1][1], dp[i - 1][2])
        dp[i][1] = a[i][1] + max(dp[i - 1][0], dp[i - 1][2])
        dp[i][2] = a[i][2] + max(dp[i - 1][0], dp[i - 1][1])

    print(max(dp[n - 1][0], dp[n - 1][1], dp[n - 1][2]))


# PyPy 2 Fast IO
py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip
    range = xrange

import os, sys
from io import IOBase, BytesIO

BUFSIZE = 8192
class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill(): pass
        return super(FastIO,self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill(); self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s:self.buffer.write(s.encode('ascii'))
            self.read = lambda:self.buffer.read().decode('ascii')
            self.readline = lambda:self.buffer.readline().decode('ascii')

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')

# Importing Modules
import math
import collections

from collections import Counter
from math import fabs

if __name__ == "__main__":
    main()

Measured memory_bytes: 54816
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;

int main(){
	long a, b, x=0, count=0;
	double y=0;
	while( scanf(" %ld,%ld", &a, &b) != EOF ){
		x+=a*b;
		y+=b;
		++count;
	}
	printf("%ld\n%ld\n", x, lround(y/count));
	return 0;
}

Measured memory_bytes: 1188
#include<iostream>
#include<map>
#include<vector>
#include<cmath>
#include<string>
#include<algorithm> 
using namespace std;
 
# define p(s) std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
 
int main()
{
    int n;cin >> n;

    int al[26];
    for(int i=0;i<26;i++){
        al[i]=50;
    }

    int al_tmp[26]={};
    for(int i=0;i<n;i++){
        string s;cin >> s;

        for(int j=0;j<s.size();j++){
            al_tmp[(int)(s.at(j)-'a')]++;
        }
        for(int j=0;j<26;j++){
            al[j]=min(al[j],al_tmp[j]);
            al_tmp[j]=0;
        }
    }

    for(int i=0;i<26;i++){
        while(al[i]>0){
            cout << (char)('a'+i);
            al[i]--;
        }
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
 
int main() {
	int n,x,sum;
  	cin >>n>>x;
    int L[n];
  int i,j;

    for (i =1; i < n+1; i++ ) {
       cin>>L[i];
    }
   for (j =0;sum<=x  ; j++ ) {
      sum=sum+L[j+1];
    }
 
    cout<<j<<endl;
}

Measured memory_bytes: 256
from sys import exit

n = int(input())
b = list(map(int, input().split()))

cnt = [0] * n
done = [False] * n
ans = [0] * n
for i in range(n):
  for j in range(n-1, -1, -1):
    if done[j]:
      continue
    if b[j] == cnt[j] + 1:
      ans[i] = b[j]
      for k in range(j+1, n):
        cnt[k] += 1
      done[j] = True
      break
        
for i in range(n):
  if not done[i]:
    print(-1)
    exit()
    
for i in range(n):
  print(ans[i])

Measured memory_bytes: 3064
/******************
*  Author: BD747  *
******************/
#include<algorithm>
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<string>
#include<vector>
#include<bits/stdc++.h>
using namespace std;

int n,k,ans;
int h[100005];

int main(){
	ans=1e9;
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		cin>>h[i];
	}
	sort(h+1,h+1+n);
	for(int i=1;i<=n-k+1;i++){
		ans=min(ans,h[i+k-1]-h[i]);
	}
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mem(dp, v) memset(dp, v, sizeof dp)
using namespace std;
const ll N = 1e5 + 7, inf = 1e17;
ll ar[N], br[N];
//string s;
//ll foo(int i, int j)
//{//cout<<"dsa";
//    ll &ret = dp[i][j];
//    if(i == j) return 1;
//    if(i > j) return 0;
//    if(ret != -1) return ret;
//    ll ans = 0;
//    if(s[i] == s[j]) ans = (1 + foo(i + 1, j - 1)) + foo(i + 1, j) + foo(i, j - 1)- foo(i + 1, j - 1);
//    else ans = foo(i + 1, j) + foo(i, j - 1) - foo(i + 1, j - 1);
//    return ret = ans;
//}
int main()
{
    map<ll, ll>mp;
    string s;
    ll n, m, k, okay = 1;;
    cin>>n;
    for(int i = 0; i < n; i++)
    {
        ll x;
        cin>>x;
        if(mp[x])
        {
            okay = 0;
        }
        mp[x] = 1;
    }
    if(okay) puts("YES");
    else puts("NO");
    return 0;
}


Measured memory_bytes: 12800
#include<bits/stdc++.h>
#define endl "\n"
#define int long  long 

using namespace std ; 

void solve(int k )
{
	int N = 1e7 , n  =7; 
	for(int i = 1 ; i <= N ; ++i)
	{
		if(n%k == 0 )
		{
			cout << i << endl ; 
			exit(0) ; 	
		}
		else 
		{
			n = n*10 + 7 ;		
			n %= k 	; 
		}
	}
}

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL) ; 
	                         
	int n ;	 
	cin >> n ;	
	
	solve(n) ;	
	cout << -1 << endl ;
	      
}


Measured memory_bytes: 3620
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Math;
using static System.Console;
using static exMath;
using static exReadLine;


class Program
{
    static void Main(string[] args)
    {
        int N;
        intReadLine(out N);
        int[] A = ReadLine().Split().Select(int.Parse).ToArray();
        string ans = "APPROVED";
        for(int i = 0; i < N; i++)
        {
            if(A[i] % 2 == 0)
            {
                if(A[i] % 3 != 0 && A[i] % 5 != 0)
                {
                    ans = "DENIED";
                    break;
                }
            }
        }
        WriteLine(ans);
    }
}

static class exReadLine
{
    public static void intReadLine(out int a)
    {
        a = int.Parse(ReadLine());
    }
    public static void intReadLine(out int a, out int b)
    {
        int[] input = ReadLine().Split().Select(int.Parse).ToArray();
        a = input[0];
        b = input[1];
    }
    public static void intReadLine(out int a, out int b, out int c)
    {
        int[] input = ReadLine().Split().Select(int.Parse).ToArray();
        a = input[0];
        b = input[1];
        c = input[2];
    }
    public static void intReadLine(out int a, out int b, out int c, out int d)
    {
        int[] input = ReadLine().Split().Select(int.Parse).ToArray();
        a = input[0];
        b = input[1];
        c = input[2];
        d = input[3];
    }

    public static void longReadLine(out long a)
    {
        a = long.Parse(ReadLine());
    }
    public static void longReadLine(out long a, out long b)
    {
        long[] input = ReadLine().Split().Select(long.Parse).ToArray();
        a = input[0];
        b = input[1];
    }
    public static void longReadLine(out long a, out long b, out long c)
    {
        long[] input = ReadLine().Split().Select(long.Parse).ToArray();
        a = input[0];
        b = input[1];
        c = input[2];
    }
    public static void longReadLine(out long a, out long b, out long c, out long d)
    {
        long[] input = ReadLine().Split().Select(long.Parse).ToArray();
        a = input[0];
        b = input[1];
        c = input[2];
        d = input[3];
    }
}

static class exMath
{
    // 最大公約数
    public static int Gcd(int a, int b)
    {
        if (a < b) return Gcd(b, a);
        while (b != 0)
        {
            var r = a % b;
            a = b;
            b = r;
        }
        return a;
    }
    public static long Gcd(long a, long b)
    {
        if (a < b) return Gcd(b, a);
        while (b != 0)
        {
            var r = a % b;
            a = b;
            b = r;
        }
        return a;
    }

    // 最小公倍数
    public static long Lcm(int a, int b)
    {
        return BigMul(a, b) / Gcd(a, b);
    }
    public static long Lcm(long a, long b)
    {
        return a * b / Gcd(a, b);
    }
}

Measured memory_bytes: 13268
/*

夜店  本選2
D1a 10 大橋  恒輝

*/

#include <stdio.h>
#include <string.h>

#include <iostream>
#include <algorithm>

typedef unsigned int usi;

#define MACRO_typeA 100000 + 1
#define TIMEparDIV 3000+1

#define rep(x,y,z) for(int (x) = (y);(x) <= (z);++(x))
#define initialize(x,y) memset((x),(y),sizeof(x));

int a[MACRO_typeA + 1];
int b[MACRO_typeA + 1];
int dp[TIMEparDIV][TIMEparDIV];

int ZERO = 0;

int main() {

	int n, t, s;
	std::cin >> n >> t >> s;
	
	rep(i, 1, n) scanf("%d %d", a + i, b + i);
	initialize(dp, ZERO);


	int Max = ZERO;

	rep(i, 1, n) {
		rep(j, 0, t) {

			dp[i][j] = std::max(dp[i][j], dp[i - 1][j]);

			if (j - b[i] >= ZERO && j <= s || j - b[i] >= s) dp[i][j] = std::max(dp[i][j], a[i] + dp[i - 1][j - b[i]]);
			Max = std::max(Max,dp[i][j]);
		}
	}

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



Measured memory_bytes: 38408
#include <bits/stdc++.h>
using namespace std;
#define int long long
int INF = 1e9 +7;
signed main(){
   string a;
   cin >>a;
   int maxp=0,p=0;
   for(int i=0;i<a.length();i++){
       if(a[i]=='A'||a[i]=='T'||a[i]=='G'||a[i]=='C'){
           p++;
       }else{
           maxp=max(maxp,p);
           p=0;
       }
   }
   maxp=max(maxp,p);
   cout<<maxp;

    return 0;
}

Measured memory_bytes: 256
N, M, K = map(int, input().split())
INF = int(1e18)
A = list(map(int, input().split()))
B = list(map(int, input().split()))
i, j = 0, 0
mcnt = 0
tmp = M+1
ccnt = 0
while tmp != 0:
  ccnt += 1
  tmp //= 2
LA = [0 for _ in range(N+1)]
LB = [0 for _ in range(M+1)]
for i in range(N):
  LA[i+1] = LA[i] + A[i]
for i in range(M):
  LB[i+1] = LB[i] + B[i]
for i in range(N+1):
  l, r = 0, M+1
  d = (l + r) // 2
  if LA[i] <= K:
    if LB[M] + LA[i] <= K:
      mcnt = max(i + M, mcnt)
    else:
      for j in range(ccnt + 1):
        if LB[d] + LA[i] <= K:
          l = d
          d = (l + r) // 2
        else:
          r = d
          d = (l + r) // 2
      mcnt = max(i + d, mcnt)
  else:
    break
print(mcnt)


Measured memory_bytes: 47316
//
//  main.cpp
//  ITP1_3-D
//
//  Created by Saicj on 2015/07/14.
//  Copyright (c) 2015??´ saicj. All rights reserved.
//

#include <iostream>
using namespace std;

int main()
{

    int a,b,c;
    int count = 0;
    
    cin >> a >> b >> c;
    
    for (int i = a; i <= b ; i++) {
        if (c % i == 0){
            count++;
        }
    }
    
    
    cout << count << "\n";
    return 0;
}

Measured memory_bytes: 1168
use std::io::*;
use std::str::FromStr;
use num_rational::Rational64;
use text_io::read;
#[allow(dead_code)]
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")
}
#[allow(dead_code)]
struct Main {}
#[allow(dead_code)]
impl Main {}
fn main() {
    let a: i64 = read!();
    let b: String = read!();
    let ratio_a = Rational64::new_raw(a, 1);
    let bs: Vec<&str> = b.split(".").collect::<Vec<&str>>();
    let b1 = i64::from_str(bs[0]).unwrap();
    let b2 = i64::from_str(bs[1]).unwrap();
    let ratio_b = Rational64::new_raw(b1, 1) + Rational64::new_raw(b2, 100);
    let ratio_res: Rational64 = ratio_a * ratio_b;
    println!("{}", ratio_res.numer() / ratio_res.denom());
}

Measured memory_bytes: 2140
def main():
  while True:
    a, op, b = input().split(' ')
    a = int(a)
    b = int(b)
    
    if op == '+':
      print(a+b)
    elif op == '-':
      print(a-b)
    elif op == '*':
      print(a*b)
    elif op == '/':
      print(a//b)
    else:
      break
  
if __name__ == "__main__":
  main()



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

#define fi first
#define se second
#define show(x) cerr << #x << "=" << "\n"
typedef long long ll;
typedef unsigned long long ull;

using namespace std;
const ll llinf = LLONG_MAX;
const ull ullinf = ULLONG_MAX;

class union_find{
public:
    explicit union_find(int _n):n(_n){
        par.resize(static_cast<unsigned long>(_n));
        rank.resize(static_cast<unsigned long>(_n));
        sizes.resize(static_cast<unsigned long>(_n));
        for(int i=0;i<_n;i++){
            par[i]=i;
            rank[i]=0;
            sizes[i]=1;
        }
    }
    
    //親ノードを見つけます
    int find(int a){
        if(par[a]==a)return a;
        return par[a]=find(par[a]);
    }
    
    //aとbが同じグループかの判定
    bool same(int a,int b){
        return find(a)==find(b);
    }
    
    //aとbを同じグループにします
    void unite(int a,int b){
        link(find(a),find(b));
    }
    
    //aが属するグループの要素数を求めます
    int size(int a){
        return sizes[find(a)];
    }
    
    //全体がどのグループに属しているかがわかります
    void view(){
        for(int i=0;i<n;i++){
            cout<<" par"<<"["<<i<<"]="<<par[i]<<((i==n-1)?"\n":",");
        }
        for(int i=0;i<n;i++){
            cout<<"size"<<"["<<i<<"]="<<sizes[i]<<((i==n-1)?"\n":",");
        }
        cout<<endl;
    }

private:
    void link(int a,int b){
        if(same(a,b))return;
        if(rank[a]>rank[b]){
            par[b]=a;
            sizes[a]+=sizes[b];
            sizes[b]=0;
        }else{
            par[a]=b;
            if(rank[a]==rank[b])rank[b]++;
            sizes[b]+=sizes[a];
            sizes[a]=0;
        }
    }
    int n;
    vector<int> par;
    vector<int> rank;
    vector<int> sizes;
};

int n, m;
int p[100001];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;
#ifdef LOCAL_DEFINE
  FILE *stream1;
  //FILE *stream2;
  stream1 = freopen("in.txt", "r", stdin);
  //stream2 = freopen("out.txt", "w", stdout);
  if (stream1 == NULL) return 0;
  //if (stream2 == NULL) return 0;:w
#endif
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> p[i];
    p[i]--;
  }
  union_find uf(n);
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--; y--;
    uf.unite(x, y);
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (uf.same(i, p[i])) {
      ans++;
    }
  }
  cout << ans << endl;
#ifdef LOCAL_DEFINE
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
  fclose(stream1);
  //fclose(stream2);
#endif
  return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int sum=0;
  sum += (N/100000000)%10;
  sum += (N/10000000)%10;
  sum += (N/1000000)%10;
  sum += (N/100000)%10;
  sum += (N/10000)%10;
  sum += (N/1000)%10;
  sum += (N/100)%10;
  sum += (N/10)%10;
  sum += N%10;
  if (N%sum == 0){
    cout << "Yes" << endl;
  }
  else cout << "No" << endl;
}
  

Measured memory_bytes: 256
#include <iostream>

int main()
{
	int W, H, x, y, r;

	std::cin >> W >> H >> x >> y >> r;

	if (x - r >= 0 && y - r >= 0 && x + r <= W && y + r <= H)
	{
		std::cout << "Yes" << std::endl;
	}

	else
	{
		std::cout << "No" << std::endl;
	}

	return 0;
}

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

const int MAX = 500000;
int H, i, A[MAX+1];

int parent(int i){
  return i/2;
}
int left(int i){
  return 2*i;
}
int right(int i){
  return 2*i + 1;
}
void maxHeapify(int *A, int i){
  int l = left(i);
  int r = right(i);
  int largest;
  if (l <= H && A[l] > A[i]){
    largest = l;
  } else {
    largest = i;
  }
  if (r <= H && A[r] > A[largest]){
    largest = r;
  }

  if ( largest != i){
    int tmp = A[i];
    A[i] = A[largest];
    A[largest] = tmp;
    maxHeapify(A, largest);
  }


}

int main() {
    ios::sync_with_stdio(false);
    cin >> H;
    for(i=1; i<=H; i++) cin >> A[i];
    for(i=H/2; i>=1; i--){
      maxHeapify(A, i);
    }
    for(i=1; i<=H; i++) cout << " " << A[i];
    cout << endl;


}

Measured memory_bytes: 3160
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = scanInt()
	}
	return a
}

func debug(a ...interface{}) {
	if os.Getenv("ONLINE_JUDGE") == "false" {
		fmt.Fprintln(os.Stderr, a...)
	}
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	x := scanInt()
	fmt.Fprintln(wr, 1-x)
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

const int INF = (1<<30);

int dp[1<<26];

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

    REP(i, 1<<26) dp[i] = INF;

    string s;
    cin >> s;
    int n = s.size();

    int now = 0;
    dp[0] = 0;
    REP(i, n){
        int moji = s[i] - 'a';
        now ^= (1<<moji);
        int mi = INF;
        REP(j, 26){
            int val = (1<<j);
            mi = min(mi, dp[now^val]);
        }
        mi = min(mi, dp[now^0]);
        dp[now] = min(mi+1, dp[now]);
        if(i==n-1) cout << mi+1 << endl;
    }
    
    return 0;
}

Measured memory_bytes: 262992
import copy

H, W, K = map(int, input().split())
C = [list(input()) for i in range(H)]
ans = 0

for n in range(1 << (H + W)):
    c = copy.deepcopy(C)
    for i in range(H):  # Hに対してbit
        if (n >> i) & 1 == 1:
            for w in range(W):  # 一致していたらその行を全てRED
                c[i][w] = "r"
    for j in range(H, H + W):
        if (n >> j) & 1 == 1:
            for h in range(H):
                c[h][j - H] = "r"

    cnt = 0
    for i in range(H):
        for j in range(W):
            if c[i][j] == "#":
                cnt += 1
    if cnt == K:
        ans += 1

print(ans)


Measured memory_bytes: 9376
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <string.h>
#include <ctype.h>
#include <algorithm>
#include <math.h>

using namespace std;

int main() {
  int k;
  string s;
  cin >> k >> s;

  if(k >= s.size()) cout << s << endl;
  else {
    s = s.substr(0,k) + "...";
    cout << s << endl;
  }
}

Measured memory_bytes: 3636
package main

import (
	"fmt"
	"sort"
)

func main()  {
	var n int
	fmt.Scan(&n)

	d := make([]int, n)
	for i:=0;i<n;i++ {
		fmt.Scan(&d[i])
	}

	sort.Ints(d)
	dv := len(d)/2
	fmt.Println(d[dv] - d[dv-1])
}

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

int main(void){
    int A, B, C, D;
    
    cin >> A >> B >> C >> D;
    
    while(1){
        C -= B;
        if(C <= 0){
            cout << "Yes" << endl;
            break;
        }
        
        A -= D;
        if(A <= 0){
            cout << "No" << endl;
            break;
        }
    }
    
    return 0;
}


Measured memory_bytes: 3652
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <cmath>

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF
constexpr int INTINF {1000000000};//int = 2*INTINF

#define  rep(i,n)   for(int i = 0; i < (n); ++i)
#define rrep(i,n)   for(int i = 1; i <= (n); ++i)
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T&& y) {
  x=std::max(x,y);
}
template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T&& y) {
  x=std::min(x,y);
}
template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}

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

  int n;
  cin >> n;
  std::vector<int> a(n);
  rep(i, n) cin >> a[i];

  int k = a[0];
  ull ans {};
  srep(i, 1, n) {
    if (k > a[i]) {
      ans += k - a[i];
    } else {
      k = a[i];
    }
  }
  cout << ans << '\n';
}


Measured memory_bytes: 3960