akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int main(){
  int n;

  while(cin>>n,n){
    int maxSum = -1;
    int maxNum = -1;

    for(int i=0;i<n;i++){
      int p,d1,d2;
      cin>>p>>d1>>d2;
      if(maxSum < d1 + d2){
        maxSum = d1 + d2;
        maxNum = p;
      }
    }

    cout<<maxNum<<" "<<maxSum<<endl;
  }
}

Measured memory_bytes: 864
N, X, Y = map(int, input().split())

dis = [0 for _ in range(N)]
for i in range(1, N):
    for j in range(i + 1, N + 1):
        d = min(abs(i - j),
                abs(i - X) + 1 + abs(j - Y),
                abs(i - Y) + 1 + abs(j - X))
        dis[d] += 1

for k in range(1, N):
    print(dis[k])

Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define inf (ll)1e9
#define mod (ll)(1e9+7)
#define d(x) cerr<<#x<<"="<<x<<endl;
#define p(x) cout<<(x)<<endl
#define ps(x) cout<<(x);
#define pk(x) cout<<(x)<<" ";
#define pfix(d,x) cout << fixed << setprecision(d) << x << endl;
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define minel(v) *min_element(all(v))
#define minind(v) distance((v).begin(), min_element(all(v)))
#define maxel(v) *max_element(all(v))
#define maxind(v) distance((v).begin(), max_element(all(v)))
#define fi first
#define se second
ll a[501][501],b[27],c,d,n,m,x,y,z,h,w,sum,mi,ma,ans,s,t,l,r,res,tmp,itr,p,q;
bool flag;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int dx8[8]={1,1,0,-1,-1,-1,0,1},dy8[8]={0,1,1,1,0,-1,-1,-1};
char cha;
string st;
typedef map<ll, ll> imap;
typedef pair<ll, ll> P;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<pair<ll,ll> > VP;


int main(void){
    cin>>h>>w;
    rep(i,h)rep(j,w){
        cin>>a[i][j];
    }
    vector<string> v;
    rep(i,h)rep(j,w){
        if(i==h-1 && j==w-1)break;
        if(i%2){
            if(i==h-1 && j==w-1)break;
            if(a[i][w-1-j]%2==0)continue;
            c++;
            if(j==w-1){v.pb(to_string(i+1)+" "+to_string(w-j)+" "+to_string(i+2)+" "+to_string(w-j));a[i][w-1-j]--;a[i+1][w-1-j]++;}
            else {v.pb(to_string(i+1)+" "+to_string(w-j)+" "+to_string(i+1)+" "+to_string(w-1-j));a[i][w-1-j]--;a[i][w-2-j]++;}
        }
        else{
            if(a[i][j]%2==0)continue;
            c++;
            if(j==w-1){v.pb(to_string(i+1)+" "+to_string(j+1)+" "+to_string(i+2)+" "+to_string(j+1));a[i][j]--;a[i+1][j]++;}
            else {v.pb(to_string(i+1)+" "+to_string(j+1)+" "+to_string(i+1)+" "+to_string(j+2));a[i][j]--;a[i][j+1]++;}
        }
    }
    //rep(i,h){rep(j,w){
    //    pk(a[i][j]);
    //}p("");}
    p(c);
    rep(i,v.size())p(v[i]);
    return 0;
}


Measured memory_bytes: 12916
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <sstream>

using namespace std;

int main(){
	
	int N = 200000;
	
	bool a[200000];
	
	for(int i = 0; i < N; i++){
		a[i] = true;
	}
	
	a[0] = false;
	a[1] = false;
	
	for(int i = 2; i < N; i++){
		if(a[i]){
			for(int j = i * 2; j < N; j += i){
				a[j] = false;
			}
		}
	}
	
	int P;
	
	while(true){
		
		cin >> N >> P;
		
		if(P == -1){
			break;
		}
		
		int primes[100];
		
		int count = 0;
		
		while(true){
			N++;
			if(a[N]){
				primes[count] = N;
				count++;
			}
			if(count == 100){
				break;
			}
		}
		
		vector<int> v;
		
		for(int i = 0; i < 100; i++){
			for(int j = i; j < 100; j++){
				v.push_back(primes[i] + primes[j]);
			}
		}
		
		sort(v.begin(), v.end());
		
		cout << v[P - 1] << endl;
		
	}
	
	return 0;
}

Measured memory_bytes: 3292
import numpy as np
u = np.array(list(map(int, input().split())))
c = np.array(list(map(int, input().split())))
b = np.array(list(map(int, input().split())))
for l1 in range(u[0] + 1):
    u1 = u[0] - l1
    l2 = c[0] - u1
    l3 = b[0] - u1
    u2 = u[1] - l1
    u3 = u[2] - l1
    if c[1] == u2 + l2 and c[2] == u3 + l2 and b[1] == u2 + l3 and b[2] == u3 + l3:
        print("Yes")
        exit()
else:
    print("No")

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.141592653589793238462643383279;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353

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

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(void){
    int N; cin >> N;
    VI a(N); REP(i,N) cin >> a[i];
    VI a2i(N); REP(i,N) a2i[a[i]-1] = i+1;
    ll ans = 0;
    set<int> s; s.insert(0); s.insert(N+1);
    REP(i,N){
        ll idx = a2i[i];
        s.insert(idx);
        auto itr = s.find(idx);
        itr--;
        ll l = *itr;
        itr++; itr++;
        ll r = *itr;
        ans += (idx-l)*(r-idx)*(i+1);
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 29)
#define MOD 1000000007
//int dx[4] = {1,0,0,-1};
//int dy[4] = {0,1,-1,0};


int main(){
  
  int n;
  cin >> n;
  vector<int> v(n);
  REP(i,n)cin >> v[i];
  int res = 1;
  for(int i = 1;i < n;i++){
    if(v[i] >= *max_element(v.begin(),v.begin()+i))res++;
  }
  cout << res << endl;

  



  return 0;
}


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

int ctoi(char c);

int main() {
	int i, min, temp;
	char s[11];
	if (scanf("%s", s) == 0) return 1;
	int stoi() {
		return ctoi(s[i + 2]) + ctoi(s[i + 1]) * 10 + ctoi(s[i]) * 100;
	}
	min = 1000;
	for (i = 0; i < strlen(s) - 2; i++) {
		temp = abs(stoi() - 753);
		if (temp < min) min = temp;
	}
	printf("%d", min);
}

int ctoi(char c) {
	return c - '0';
}

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

using namespace std;

#define ll long long int
#define get(a) ll a; cin >> a;
#define show(a) cout << a << endl;
#define full(p) p.begin(), p.end()
#define sz(a) (ll)(a.size())
#define pb push_back

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.precision(10);
	cout<<fixed;
	////////////////////////////////
	get(a);
	get(b);

	ll ans = max(a,b);

	if(a == max(a,b))
	{
		cout << ans + max(a-1 , b) << endl;
	}	
	else
		cout << ans + max(a, b-1) << endl;

	return 0;
}

Measured memory_bytes: 3608
input = STDIN.read.split("\n").map{|l| l.split(" ").map{|a| a.to_i}}

N = input[0][0]
A = input[1]
B = input[2]

short_cnt = 0
short_score = 0

reserves = []

for i in 0..(A.length - 1)
    a = A[i]
    b = B[i]
    if a == b
        next
    end
    if a < b
        short_cnt = short_cnt + 1
        short_score = short_score + (b - a)
    else
        reserves.push(a - b)
    end
end

reserves =  reserves.sort.reverse

changed_cnt = 0
if short_cnt > 0 
    for i in 0..(reserves.length - 1)
        short_score = short_score - reserves[i]
        changed_cnt = changed_cnt + 1

        if short_score <= 0
            break
        end
    end
end

if short_score > 0
    puts -1
else
    puts (changed_cnt + short_cnt)
end


Measured memory_bytes: 18420
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define YY cout << "Yes" << endl;
#define NN cout << "No" << endl;
#define ve vector
#define pint pair<int,int>
const int INF = 1000000007;
const long double EPS = 1e-15;
const long double PI = acos(-1);
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
// *max_element(all(d))
int solve(){
  int h,w,n;
  cin >> h >> w >> n;
  vector<int>ans,v(n);
  rep(i,n)cin >> v[i];
  rep(i,n){
    rep(j,v[i])ans.push_back(i + 1);
  }
  ll now = 0;
  rep(i,h){
    if(i % 2){
      vector<int>s;
      rep(j,w){
        s.push_back(ans[now]);
        now++;
      }
      reverse(all(s));
      rep(j,w){
		cout << s[j] << " ";  
      }
    }
    else{
      rep(j,w){
        cout << ans[now] << " ";
        now++;
      }
    }
    cout << endl;
  }
  return 0; 
}
int main(){
  // ios::sync_with_stdio(false);cin.tie(nullptr);
  cout << fixed;cout << setprecision(16);
  solve();
  return 0;
}
//2 9,4 7,6 2

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n, m, u, v, a[52] = {};
    cin >> n >> m;
    while (m--) cin >> u >> v, a[u]++, a[v]++;
    for (int i = 1; i <= n; i++) cout << a[i] << '\n';
}


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

int main(){
    int m,n;//lifetime, blocks
    while(cin>>m>>n,m){
        bool o[7368799];
        fill(o,o+7368799,false);
        int count=0;
        for(int i=m;;i++){
            if(!o[i]){
                if(count<n){
                    count++;
                    for(int j=1;j*i<7368799;j++){
                        o[i*j]=true;
                    }
                } else {
                    cout<<i<<endl;
                    break;
                }
            }
        }
    }
    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

int k,n;
vector<int> res;

int main(){
  cin>>k>>n;
  if(k%2==0){
    res.push_back(k/2);
    repl(i,1,n)res.push_back(k);
  }else{
    rep(i,n)res.push_back((k+1)/2);
    rep(i,n/2){
      if(res.back()==1){
        res.pop_back();
      }else{
        res.back()--;
        while(res.size()<n)res.push_back(k);
      }
    }
  }

  rep(i,res.size())cout<<res[i]<<" ";
  cout<<endl;
  return 0;
}


Measured memory_bytes: 3568
N,M=gets.split.map(&:to_i)
s,c=M.times.map{gets.split.map(&:to_i)}.transpose
arr=Array.new(N,nil)

if M!=0
    s.each_index {|a|
        if arr[s[a]-1].nil?
            arr[s[a]-1]=c[a]
        elsif arr[s[a]-1]!=c[a]
            arr=-1
            break
        end    
    }
end

def convertNil(arr)
    while arr.index(nil)
        if arr.index(nil)==0
            arr[arr.index(nil)]=1 if arr.length!=1
            arr[arr.index(nil)]=0 if arr.length==1
        else
            arr[arr.index(nil)]=0
        end
    end
end

if arr==-1
    puts arr
else
    convertNil(arr)
    arr=arr.join.to_i
    if arr.to_s.chars.length==N
        puts arr
    else
        arr=-1
        puts arr
    end
end


Measured memory_bytes: 1788
N = int(input())
if N >= 1 and N <= 1000:
  print(1000 - N)
elif N >= 1001 and N <= 2000:
  print(2000 - N)
elif N >= 2001 and N <= 3000:
  print(3000 - N)
elif N >= 3001 and N <= 4000:
  print(4000 - N)
elif N >= 4001 and N <= 5000:
  print(5000 - N)
elif N >= 5001 and N <= 6000:
  print(6000 - N)
elif N >= 6001 and N <= 7000:
  print(7000 - N)
elif N >= 7001 and N <= 8000:
  print(8000 - N)
elif N >= 8001 and N <= 9000:
  print(9000 - N)
else:
  print(10000 - N)

Measured memory_bytes: 9176
#include<iostream>
#include<cstdio>
#include<cstring>
#define ull unsigned long long
using namespace std;
const int N=2*(1e5)+10;
const ull inf=1ULL<<63;
ull a[N],mn[N],val[N],sum[N];
int n;
ull ans,cost;
ull Sum(int l,int r){return sum[r]-sum[max(l-1,0)];}

int main(){
#ifndef ONLINE_JUDGE
	//freopen("a.in","r",stdin);
#endif
	ull tmp;
	scanf("%d",&n); cin>>cost;
	sum[0]=0;
	for (int i=1;i<=n;++i) cin>>a[i],sum[i]=sum[i-1]+a[i];
	for (int i=2;i<=n;++i) val[i]=2LL*i+1;
	val[1]=5;
	ans=inf;
	for (int k=1;k<=n;++k){
		tmp=0;
		for (int loc=n,i=1;loc>=1;loc-=k,++i)
			tmp+=val[i]*Sum(loc-k+1,loc);	
		ans=min(ans,tmp+cost*k);
	}
	cout<<ans+cost*n<<endl;
}


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

int main(){
  int a[3], i;
  for(i=0; i<3; i++) cin >> a[i];
  sort(a, a+3);
  cout << a[0] << " " << a[1] << " " << a[2] << endl;
  return 0;
}

Measured memory_bytes: 3080
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner stdIn=new Scanner(System.in);
		int N=stdIn.nextInt();
		int B[]=new int[N-1];
		int A[]=new int[N];
		int z=0;
		long ans=0;
		while(z<N-1){
			B[z]=stdIn.nextInt();
			z++;
		}z=1;
		ans+=B[0]*2;
		A[0]=B[0];
		A[1]=B[0];
		while(z<N-1){
			if(B[z-1]>B[z]){
				ans-=B[z-1]-B[z];
				ans+=B[z];
				A[z]=B[z];
			}
			else
				ans+=B[z];
			A[z+1]=B[z];
			z++;
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 21844
const Main = (ary: string): void => {
	const input = ary.split("")
	let ret = 0
	for (let i = 0; i < input.length; i++) {
		if (input[i] === "+") {
			ret++
		} else if (input[i] === "-") {
			ret--
		}
	}
	console.log(ret)
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"))


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

int main(void){
  int M, K; cin >> M >> K;
  if(K >= (1 << M)){
    cout << -1 << endl;
    return 0;
  }
  if(M == 0){
    cout << "0 0" << endl;
    return 0;
  }
  if(M == 1){
    if(K == 0){
      cout << "0 0 1 1" << endl;
    }else{
      cout << -1 << endl;
    }
    return 0;
  }

  for(int i = 0; i < (1 << M); i++){
    if(i == K) continue;
    cout << i << " ";
  }
  cout << K << " ";
  for(int i = (1 << M)-1; i >= 0; i--){
    if(i == K) continue;
    cout << i << " ";
  }
  cout << K;
  cout << endl;
}


Measured memory_bytes: 1920
#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;

const int MAX = 4001;
 
int dp[MAX][MAX];
 
int main(){
    string s1,s2;
 
    while(cin >> s1 >> s2){
	memset(dp,0,sizeof(dp));
 
	int n = s1.size() ,m = s2.size();
	int ans = 0; 
	for(int i = 0 ; i < n ; i++){
	    for(int j = 0 ; j < m ; j++){
		if(s1[i] == s2[j]){
		    dp[i+1][j+1] = dp[i][j] + 1;
		}
		ans = max(ans,dp[i+1][j+1]);
	    }
	}
	cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 65560
import sys
import  math
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

D,T,S=nm()
print('Yes' if D<=S*T else 'No')

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

list_grid = []
for i in range(H):
  list_grid.extend(list(input().split()))

# 行を見る
for i, record in enumerate(list_grid):
  if record == '.' * W:
    list_grid[i] = ''

list_grid = list(filter(lambda s:len(s)>0, list_grid))

import copy
ans = copy.copy(list_grid)

# 列を見る
row = 0
flg = True
while flg:
  tmp = []
  for record in ans:
    tmp.append(record[row])
  
  # 対象列に白しかない場合、その列を削除
  if not ('#' in tmp):
    for i in range(len(ans)):     
      ans[i] = ans[i][:row] + ans[i][row+1:]
  else:
    row += 1
      
  if row == len(ans[0]):
    flg = False


# 出力
for record in ans:
  print(record)

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

#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) do{}while(0)
#endif




bool can_drop( ll w, ll sc, char L, char R, string s, string t ){
	int len = s.size();
	int pos = sc-1;
	int l = 0;
	int r = w;
	
	// posが[l,r) にあるなら駒が残る
	for ( int i = len-1; i >= 0; i-- ){
		// 後手 許容範囲を広げる
		if ( t[i] == R && 0 < l ) l--;
		if ( t[i] == L && r < w ) r++;
		
		// 先手 許容範囲を狭める
		if ( s[i] == R ) r--;
		if ( s[i] == L ) l++;
		
		if ( r <= l )
			return true;
	}
	if ( pos < l || r <= pos )
		return true;
	
	return false;
}



int main(){
	ll h, w, n, sr, sc;
	string s, t;
	
	cin >> h >> w >> n;
	cin >> sr >> sc;
	cin >> s;
	cin >> t;
	
	if ( can_drop( h, sr, 'U', 'D', s, t ) ||
	     can_drop( w, sc, 'L', 'R', s, t ) )
		cout << "NO" << endl;
	else
		cout << "YES" << endl;
	
	
	return 0;
}




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



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

int main() {
	int n, k;
	cin >> n >> k;
	vector<int> x(n);
	rep(i, n) cin >> x[i];
	ll ans = 1LL << 60;
	vector<ll> neg, pos;
	rep(i, n) {
		if(x[i] > 0) pos.push_back(x[i]);
		else if(x[i] == 0) k--;
		else neg.push_back(-x[i]);
	}
	reverse(all(neg));
	if(k == 0) {
		cout << 0 << endl;
		return 0;
	}
	rep(i, pos.size()) {
		if(i > k - 1) continue;
		if(i == k-1) {
			ans = min(ans, pos[i]);
			continue;
		}
		if(k-i-2 >= neg.size()) continue;
		ll now = pos[i] * 2 + neg[k-i-2];
		ans = min(ans, now);
		// cout << pos[i] << " " << neg[k-i-2] << endl;;
	}
	rep(i, neg.size()) {
		if(i > k - 1) continue;
		if(i == k-1) {
			ans = min(ans, neg[i]);
			continue;
		}
		if(k-i-2 >= pos.size()) continue;
		ll now = neg[i] * 2 + pos[k-i-2];
		ans = min(ans, now);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2040
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>ordered_set;
*/
/////////////////// TYPES & MACROS ///////////////////////////////
#define mp make_pair
#define eb emplace_back
#define pb push_back
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define vv vector
#define exist(s,e) (s.find(e)!=s.end())
using ll=long long int; using dd=double;
using pii=pair<int,int>; using pll=pair<ll,ll>;
typedef vector<int> vi;
const ll INFLL=(ll)2e18, MOD=1'000'000'007;
const int INF=0x3f3fffff ;
/////////////////// DEBUG /////////////////////////////////////////
#define D(x) cerr<<#x<<" is: "<<x<<'\n';
#define DD(x,y) cerr<<"("<<#x<<","<<#y<<") are: "<<x<<" "<<y<<'\n';
/////////////////// VARIABLES & FUNCTIONS//////////////////////////
vector<vector<int>> adj,dp; vector<int> vis;
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1},dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};
inline ll mexp(ll x,ll n,ll m){ll res=1;while(n){if(n&1)res=(res*x)%m;n>>=1;x=((x%m)*(x%m))%m;}return res;}
bool ispow2(ll x){ return x && (!(x&(x-1)));}
ll gcd(ll x, ll y){ pll p{x,y}; while(p.ss) p={p.ss,p.ff%p.ss}; return p.ff;}


/////////////////// MAIN STARTS //////////////////////////////////
int main(){
  ios_base::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
  cout<<fixed;cerr<<fixed; cout<<setprecision(10); cerr<<setprecision(3);
  random_device rd; mt19937 genr(rd());

#ifdef DEBUG
  auto tStart = chrono::system_clock::now();
  //freopen("op.txt","w",stdout);
#endif

int n,m; cin>>n>>m;
vv<pii> v(m);
for (int i=0;i<m;i++){
  cin>>v[i].ff>>v[i].ss;
}
sort(all(v),[](pii a, pii b){return a.ss==b.ss?a.ff<b.ff:a.ss<b.ss;});
int l=0,ans=0;
for (int i=0;i<m;i++){
  if(l<v[i].ff){
    l=v[i].ss-1;
    ans++;
  }
}
cout<<ans<<"\n";

#ifdef DEBUG
  auto diff=chrono::system_clock::now()-tStart;
	cerr<<"\nExecution time: "<<chrono::duration<dd,milli>(diff).count()<<" ms.\n";
#endif
return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n, i, j, k, ct = 0;
	cin >> n;
	for (i = 1; i <= 9; i++) {
		if (i <= n) ct++;
	}
	for (i = 100; i <= 999; i++) {
		if (i <= n) ct++;
	}
	for (i = 10000; i <= 99999; i++) {
		if (i <= n) ct++;
	}

	cout << ct << "\n";

	return 0;
}


Measured memory_bytes: 256
n = int(input())
p = list(map(int, input().split()))
p_min = p[0]
p_sum = 1

# リストの前から最小値を検索
for i in range(1, n):
    
    # 最小値を見つけた場合
    if p_min > p[i]:
        p_sum += 1
        # 最小値を更新
        p_min = p[i]

print(p_sum)

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

int main() {
  int a, b;
  cin >> a >> b;
  if(a > b) swap(a, b);
  if(a == 1 && b == 2) cout << 3 << endl;
  if(a == 1 && b == 3) cout << 2 << endl;
  if(a == 2 && b == 3) cout << 1 << endl;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int n, a, pattern[100000];
long long ans = 0;

int main(){
	cin >> n;

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

		pattern[a]++;
	}

	if (n % 2 == 0){
		if (pattern[0] == 0){
			ans = 1;
		}

		for (int i = 1; i < n; i++){
			if (i % 2 == 1){
				if (pattern[i] == 2){
					ans = ans*pattern[i];

					if (ans > 1000000007){
						ans -= 1000000007;
					}
				}
				else{
					ans = 0;
				}
			}
			else{
				if (pattern[i] != 0){
					ans = 0;
				}
			}
		}
	}
	else{
		if (pattern[0] == 1){
			ans = 1;
		}

		for (int i = 1; i < n; i++){
			if (i % 2 == 0){
				if (pattern[i] == 2){
					ans = ans*pattern[i];

					if (ans > 1000000007){
						ans -= 1000000007;
					}
				}
				else{
					ans = 0;
				}
			}
			else{
				if (pattern[i] != 0){
					ans = 0;
				}
			}
		}
	}

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
const int MOD = 1000000007;
using namespace std;
typedef long long ll;

bool isPrime(int n){
  if(n<2) return false;
  else if(n==2) return true;
  else if(n % 2 == 0) return false;

  for(int i = 3; i*i <= n; i += 2){
    if(n % i == 0) return false;
  }
  return true;
}

int main()
{
  int N;
  int a[1100]={0};
  ll res=1;
  cin >> N;

  FOR(i,2,N) {
    FOR(j,2,i) {
      if(isPrime(j)){
	int num = i;
	while(num>0){
          if(num%j==0) a[j]++;
          else break;
          num /= j;
	}
      }
    }
  }
  FOR(i,2,N){
    res = (res * ((ll)a[i]+1)) % MOD;
  }

  cout << res << endl;
}


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

using namespace std;

constexpr long long INF64 = 1e18;

using Weight=long long;

struct Edge{
    int src,dst;
    Edge(int src,int dst):
    src(src),dst(dst){}
};

using Edges=vector<Edge>;
using Graph=vector<Edges>;

vector<int> tarjan(const Graph& g) {
	int n = g.size(), idx = 0, k = 0, s = 0;
	vector<int>ord(n, -1), low(n), onS(n), cmp(n), stk(n);
	function<void(int)>dfs;
	dfs = [&](int v) {
		ord[v] = low[v] = idx++;
		stk[s++] = v;
		onS[v] = true;
		for (auto &e : g[v]) {
			int w = e.dst;
			if (ord[w] == -1) {
				dfs(w);
				low[v] = min(low[v], low[w]);
			}
			else if (onS[w]) {
				low[v] = min(low[v], ord[w]);
			}
		}
		if (low[v] == ord[v]) {
			while (1) {
				int w = stk[--s];
				onS[w] = false;
				cmp[w] = k;
				if (w == v)break;
			}
			++k;
		}
	};
	for (int v = 0; v<n; ++v)
		if (ord[v] == -1)dfs(v);
	return cmp;
}

int dfs(const Graph &g,int s,vector<int> &memo){
	int ret=1;
	if(memo[s])return memo[s];
	for(auto e:g[s]){
		ret=max(dfs(g,e.dst,memo)+1,ret);
	}
	//cout<<"t"<<endl;
	return memo[s]=ret;
}

int main(){
	int n;
	cin>>n;
	Graph g(n);
	vector<pair<int,int>>contri(n);
	vector<vector<pair<int,int>>>friends(n);
	for(int i=0;i<n;++i){
		int a;
		cin>>a;
		contri[i]=make_pair(a,i);
		friends[i].push_back(contri[i]);
	}
	int m;
	cin>>m;
	for(int i=0;i<m;++i){
		int a,b;
		cin>>a>>b;
		--a;
		--b;
		//if(contri[a].first>=contri[b].first)g[a].emplace_back(a,b);
		//if(contri[a].first<=contri[b].first)g[b].emplace_back(b,a);
		friends[a].push_back(contri[b]);
		friends[b].push_back(contri[a]);
	}
	for(auto x:friends){
		sort(x.begin(),x.end(),greater<pair<int,int>>());
		for(int i=0;i<x.size()-1;++i){
			g[x[i].second].emplace_back(x[i].second,x[i+1].second);
			//cout<<x[i].second<<x[i+1].second<<endl;
			if(x[i].first==x[i+1].first){
				g[x[i+1].second].emplace_back(x[i+1].second,x[i].second);
				//cout<<x[i+1].second<<x[i].second<<endl;
			}
		}
	}
	vector<int>idx=tarjan(g);
	for(int x:idx){
		//cout<<x<<endl;
	}
	Graph ng(n);
	for(auto es:g){
		for(auto e:es){
			if(idx[e.src]==idx[e.dst])continue;
			ng[idx[e.src]].emplace_back(idx[e.src],idx[e.dst]);
		}
	}
	vector<int>memo(n,0);
	for(auto es:ng){
		if(es.size()>=1)dfs(ng,es[0].src,memo);
	}
	Weight ans=0;
	for(auto x:idx){
		//cout<<memo[x]<<endl;
		if(!memo[x])memo[x]=1;
		ans+=memo[x];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 31324
#include<bits/stdc++.h>
    using namespace std;
    
    #define ll long long
    #define pb push_back
    #define printV(v) for(int i=0;i<v._size();i++){cout << v[i]<< " ";} cout << endl
    #define printRev(v) for(int i=v._size()-1;i >= 0;i--){cout << v[i] << " ";} cout << endl
    #define sortV(v) sort(v.begin(),v.end())
    #define revV(v) reverse(v.begin(),v.end())
    #define FOR(i,from,n) for(int i=from;i<n;i++)
    #define FOL(i,from,n) for(int i=from;i >= n;i--)

        ll a,b,c,d,e,f,g,n,m,k,t,x,h,w,p,q,y;
        string str = "";
        ll mod = 1e9 + 7;

        ll pow(ll base, ll q, ll mod){
            ll answer = 1;
            while(q > 0){
                if(q & 1LL)
                    answer = (answer * base) % mod;

                q = q >> 1LL;
                base = (base*base) % mod;
            }
            return answer % mod;
        }
        

        
        
        void solve(){
           cin >>a ;
           cout << a + a*a + a*a*a << endl;
        }



            



        int main(){
            ios_base::sync_with_stdio(false);

          
            

            int cases = 1;
            //cin >> cases;

            while(cases--) solve();
            return 0;

        }

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

int dsum(int n)
{
	int sum = 0;
	while ( n > 0 ) {
		sum += n % 10;
		n /= 10;
	}
	return ( sum );
}
int main()
{
	int N, A, B;
	int sum = 0;
	cin >> N >> A >> B;

	for ( int i = 1; i <= N; i++ ) {
		int s = dsum(i);
		if ( A <= s && s <= B ) {
			sum += i;
		}
	}
	cout << sum << endl;
	return ( 0 );
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
using namespace std;
int main(void){
    double w;
    while(cin >> w){
        if(w<=48.0) cout << "light fly" << endl;
        else if(48.0 < w && w <= 51.0) cout << "fly" << endl;
        else if(51.0 < w && w <= 54.0) cout << "bantam" << endl;
        else if(54.0 < w && w <= 57.0) cout << "feather" << endl;
        else if(57.0 < w && w <= 60.0) cout << "light" << endl;
        else if(60.0 < w && w <= 64.0) cout << "light welter" << endl;
        else if(64.0 < w && w <= 69.0) cout << "welter" << endl;
        else if(69.0 < w && w <= 75.0) cout << "light middle" << endl;
        else if(75.0 < w && w <= 81.0) cout << "middle" << endl;
        else if(81.0 < w && w <= 91.0) cout << "light heavy" << endl;
        else if(91.0 < w) cout << "heavy" << endl;
    }
    return 0;
}



Measured memory_bytes: 3120
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#define rep(i,a,b) for (int i = (a); i < (b); i++)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const int inf = 2e9;



int main() {
	string s; cin >> s;
	int a = s[0] - '0';
	int b = s[1] - '0';
	int c = s[2] - '0';
	int d = s[3] - '0';
	b += 10 * a; d += 10 * c;
	if (b >= 1 && b < 13) {
		if (d >= 1 && d< 13) {
			printf("AMBIGUOUS");
		}
		else {
			printf("MMYY");
		}
	}
	else {
		if (d >= 1 && d < 13) {
			printf("YYMM");
		}
		else {
			printf("NA");
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
	int n;
	scanf("%d",&n);
	n%=10;
	if(n==2||n==4||n==5||n==7||n==9)cout<<"hon";
	else if(n==0||n==1||n==6||n==8)cout<<"pon";
	else if(n==3)cout<<"bon";
	return 0;
}

Measured memory_bytes: 3776
H, N = map(int, input().split())

attack_list = []
mp_list = []
for i in range(N):
    a, m = map(int, input().split())
    attack_list.append(a)
    mp_list.append(m)

inf = float('inf')
max_hp = H+max(attack_list)
dp = [inf for i in range(max_hp)]
dp[0] = 0

for i in range(H):
    for j in range(N):
        next_i = i + attack_list[j]
        dp[next_i] = min(dp[next_i], dp[i] + mp_list[j])

print(min(dp[H:max_hp+1]))


Measured memory_bytes: 42716
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;

class Solver {
    Scanner sc = new Scanner();
   
    public void Solve() {
        var A = sc.nextInt();
        var B = sc.nextInt();
        if (A >= 13) {
            WriteLine(B);
        } else if (A >= 6) {
            WriteLine(B / 2);
        } else {
            WriteLine(0);
        }
    }
}


class Scanner {
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble() {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0) {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Program {
    static void Main(string[] args) {
        Solver s = new Solver();
        s.Solve();
    }
}


Measured memory_bytes: 13140
#define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define IREP(i, v) for(auto i = (v).begin(); i != (v).end(); ++i)
#define IRREP(i, v) for(auto i = (v).rbegin(); i != (v).rend(); ++i)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(RALL(v))
#define SZ(x) ((int)(x).size())
#define REV(x) reverse(ALL(x))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ld = long double;
using ll = long long;
using ui = unsigned int;
using ull = unsigned long long;
using Pi_i = pair<int, int>;
using Pll_ll = pair<ll, ll>;
using VB = vector<bool>;
using VC = vector<char>;
using VD = vector<double>;
using VI = vector<int>;
using VLL = vector<ll>;
using VS = vector<string>;
using VSH = vector<short>;
using VULL = vector<ull>;

const int MOD = 1000000007; 
const int INF = 1000000000; //1e9
const int NIL = -1;
const ll LINF = 1000000000000000000; // 1e18
const double EPS = 1E-10;

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




int main(){
    int N; cin >> N;
    vector<Pi_i> red(N), blue(N);
    REP(i, N) cin >> red[i].first >> red[i].second;
    REP(i, N) cin >> blue[i].first >> blue[i].second;
    SORT(red); SORT(blue);
    VB used(N, false);
    int cnt(0);
    REP(i, N){
        int id(-1), mxY(-1);
        REP(j, N){
            if(blue[i].first <= red[j].first) break;
            if(used[j] || (blue[i].second <= red[j].second)) continue;
            if(chmax(mxY, red[j].second)) id = j;
        }
        if(id != -1){
            ++cnt; used[id] = true;
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{long long n,w,i,j,item,weight;
cin>>n>>w;
vector<long long> dp(w+1,0),witem(n+1),p(n+1);
for(i=0;i<n;i++)
{cin>>witem[i]>>p[i];
}
//dp[i] - gives the profit for weight i



	for(item=0;item<n;item++)
{	for(weight=w;weight>0;weight--)
		if(weight-witem[item]>=0)
		{
		dp[weight]=max(dp[weight-witem[item]]+p[item],dp[weight]);
		}
	}

long long ans=0;
for(i=0;i<=w;i++)
{
if(dp[i]>ans)
ans=dp[i];
}
cout<<"\n"<<ans;

return 0;
}
/*
3 8
3 30
4 50
5 60

*/

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

int main(){
    string s;
    cin >> s;
    int n;
    n = s.size();
    vector<int> ans(n);
    rep(j,2){
        int cnt = 0;
        rep(i,n){
            if(s[i] == 'R')cnt++;
            else{
                ans[i] += cnt/2;
                ans[i-1] += (cnt+1)/2;
                cnt = 0;
            }
        }
        reverse(ans.begin(),ans.end());
        reverse(s.begin(),s.end());
        rep(i,n){
            if(s[i] == 'L') s[i] = 'R';
            else s[i] = 'L';
        }
    }
    rep(i,n){
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 1152
import sys
S = input()
L = len(S)
i = 0
while i < L:
  if S[i] not in ['R','U','D']:
    print('No')
    sys.exit(0)
  i+=2
i = 1
while i < L:
  if S[i] not in ['L','U','D']:
    print('No')
    sys.exit(0)
  i += 2
print('Yes')

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

int main(void) {
    char tmp[1000];
    //???????????\???
    while(scanf("%s",&tmp)){
        //-????????????break
        if(tmp[0]=='-')break;
    	//???????????°??\???
        int loop,i,num,sum=0;
        scanf("%d",&loop);
        
        for (i=0;i<loop;i++){
            scanf("%d",&num);
            sum+=num;
        }
        //?????£???????????°
        sum=sum%strlen(tmp);
        //printf("%d",strlen(tmp));

        //?????£???????????????????????????
        for(i=sum;i<strlen(tmp);i++)  printf("%c",tmp[i]);
        for(i=0;i<sum;i++) printf("%c",tmp[i]);
        printf("\n");

    }
	return 0;
}

Measured memory_bytes: 568
#include<bits/stdc++.h>
#define regi register int
#define ll long long
using namespace std;
ll a,b;
ll childcost;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>a>>b;
    childcost=b/2;
    if (a<=5) cout<<"0"<<endl;
        else if (a>=6&&a<=12) cout<<childcost<<endl;
            else cout<<b<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define IOS ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define pf push_front
#define PI acos(-1)
#define EPS 1e-5
#define sz(v) ((int)(v).size())
#define all(v) v.begin(),v.end()
#define forn(i, n) for(ll i=0;i<(ll)n;i++)
#define fi first
#define se second
 

int main() {
	int n;
	cin >> n;
	cout << (n+1)/2 << endl;
	return 0;
}



Measured memory_bytes: 3588
#include <iostream>

using namespace std;

int main()
{
	int width, high, x, y, r;

	cin >> width >> high >> x >> y >> r;
	if (x - r >= 0 && x + r <= width && y - r >= 0 && y + r <= high) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 3116
#include <iostream>

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

 long long* yaku=new long long[N+1];
 for(int i=0;i<N+1;i++){
  yaku[i]=0;
 }
 for(int i=1;i<=N;i++){
  for(int j=i;j<=N;j=j+i){
   yaku[j]++;
  }
 }
 
 long long ans=0;
 for(int i=1;i<=N;i++){
  ans+=i*yaku[i];
 }
 
 std::cout<<ans<<std::endl;

 return 0;
}

Measured memory_bytes: 81688
#include <stdio.h>
int main(void){
    // Your code here!
    int l, r, d, ans;
    scanf("%d%d%d", &l,&r,&d);
    ans = r/d - l/d;
    if (l%d == 0 && r % d == 00)
        ans++;
    printf("%d", ans);
}


Measured memory_bytes: 1732
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <cassert>
#include <string>
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;
using ld = long double;

#define st first
#define nd second

const int MAXN = 1e6 + 5, inf = 1e9;
const ll INF = 1e18;
const ld PI = 3.1415926535897932384626433832795;

int cnt[MAXN];
ll dp[MAXN], tab[MAXN];
bool vis[MAXN], used[MAXN];

vector<int> G[MAXN];
vector<ll> V;
set<ll> S;
map<ll, int> M;
stack<ll> St;
queue<ll> Q;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout << setprecision(13) << fixed;

    //////////////////////////////////////////
    //////////////////////////////////////////

    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    a =  min(a, b);
    c = min(c, d);
    cout << a + c << "\n";
}


Measured memory_bytes: 24832
def prime_factorize(n):
    a = {}
    while n % 2 == 0:
        if 2 not in a:
            a[2] = 1
        else:
            a[2] += 1
        n //= 2
    f = 3
    while f * f <= n:
        while n % f == 0:
            if f not in a:
                a[f] = 1
            else:
                a[f] += 1
            n //= f
        f += 2
    if n != 1:
        if f not in a:
            a[f] = 1
        else:
            a[f] += 1
    return a

x = int(input())
y = prime_factorize(x)

num = 0
for v in y.values():
    now_v = v
    i = 1
    while True:
        if now_v < i:
            break
        now_v -= i
        num += 1
        i += 1

print(num)

Measured memory_bytes: 9196
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using li = unsigned long long int;
using namespace std;

int main() {
    fastIO;
    string s;
    cin >> s;
    cout << s.front() << s.size() - 2 << s.back() << endl;
}

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

typedef vector<int> veci;
typedef pair<int, int> pii;
typedef vector<pii> vecii;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vecl;
typedef vector<pll> vecll;
#define EPS (1e-9)
#define MOD (1e9 + 7)
#define fi first
#define se second
#define endl '\n'

void solve() {
    ll n, d, a;
    cin >> n >> d >> a;

    vecl vx(n), vh(n);
    veci idx(n);
    for (int i = 0; i < n; ++i) {
        cin >> vx[i] >> vh[i];
        idx[i] = i;
    }

    sort(idx.begin(), idx.end(), [&vx](int l, int r) { return vx[l] < vx[r]; });

    int k = 0;
    ll ans = 0;
    ll total = 0;
    queue<ll> damage;
    queue<int> rng;

    while (k < n) {
        while (!rng.empty() && vx[idx[k]]>rng.front()) {
            total -= damage.front();
            damage.pop();
            rng.pop();
        }

        if (vh[idx[k]]>total) {
            ll cnt = ((vh[idx[k]]-total) / a) + ((vh[idx[k]]-total) % a == 0 ? 0 : 1);
            damage.push(cnt*a);
            rng.push(vx[idx[k]]+d+d);
            total += cnt*a;

            ans += cnt;
        }
        k += 1;
    }
    cout << ans << endl;
}

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef LOCAL_TEST
    (void)argc;
    const string strpath = string(argv[0]) + string("-test.in");
    freopen(strpath.c_str(), "r", stdin);
    int tcs;
    cin >> tcs;
    while (tcs-- > 0)
#endif
        solve();
}


Measured memory_bytes: 5376
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
const int MAX = 6100000;

ll fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for(int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

// 二項係数計算
long long COM(int n, int k) {
  if(n < k)
    return 0;
  if(n < 0 || k < 0)
    return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
ll modpow(ll x, ll n) {
  ll ans = 1;
  while(n > 0) {
    if(n % 2 == 1) {
      ans *= x;
      ans %= MOD;
    }
    x *= x;
    x %= MOD;
    n >>= 1;
  }
  return ans;
}

int main() {
  int k;
  string s;
  cin >> k >> s;
  int n = s.length();
  ll ans = 0;
  COMinit();
  for(int i = n - 1; i < n + k; i++) {
    int x = n + k - i - 1;
    ans += COM(n + k - x - 1, n - 1) * modpow(25, k - x) % MOD * modpow(26, x);
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 147324
import java.util.Scanner;

class Main{
	static int G;
	static int D;
	static int[] p;
	static int[] c;
	static boolean[] used;
	static long ans = 1000000000;


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		String ss = sc.next();
		long[][] dp = new long[ss.length()+1][4];
		dp[0][0] = 1;
		long mod = 1000000007;
		for(int i = 0;i < ss.length();i++){
			if(ss.charAt(i) == 'A' ){
				dp[i+1][0] += dp[i][0] %mod;			//Aが入っている
				dp[i+1][1] += dp[i][1] % mod;			//Aが入っている
				dp[i+1][2] += dp[i][2] % mod;			//Aが入っている
				dp[i+1][3] += dp[i][3] % mod;			//Aが入っている
				dp[i+1][1] += dp[i][0] % mod;

			}else if(ss.charAt(i) == 'B'){
				dp[i+1][0] += dp[i][0] % mod;			//Aが入っている
				dp[i+1][1] += dp[i][1] % mod;			//Aが入っている
				dp[i+1][2] += dp[i][2] % mod;			//Aが入っている
				dp[i+1][3] += dp[i][3] % mod;			//Aが入っている
				dp[i+1][2] += dp[i][1] % mod;
			}else if(ss.charAt(i) == 'C'){
				dp[i+1][0] += dp[i][0] % mod;			//Aが入っている
				dp[i+1][1] += dp[i][1] % mod;			//Aが入っている
				dp[i+1][2] += dp[i][2] % mod;			//Aが入っている
				dp[i+1][3] += dp[i][3] % mod;			//Aが入っている
				dp[i+1][3] += dp[i][2] % mod;
			}
			if( ss.charAt(i) == '?'){
				dp[i+1][0] +=3*dp[i][0] % mod;			//Aが入っている
				dp[i+1][1] +=3*dp[i][1] % mod;			//Aが入っている
				dp[i+1][2] +=3*dp[i][2] % mod;			//Aが入っている
				dp[i+1][3] +=3*dp[i][3] % mod;	
				
				
				dp[i+1][1] += dp[i][0] % mod;
				dp[i+1][2] += dp[i][1] % mod;
				dp[i+1][3] += dp[i][2] % mod;



			}
//			System.out.println(dp[i+1][0] + " "+dp[i+1][1] + " "+dp[i+1][2] +" "+dp[i+1][3] );
		}

		System.out.println(dp[ss.length()][3] % mod);


	}


}

class Pair implements Comparable{
	int from;		//p
	int end;		//y
	int num;
	int bango;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return from - otherpair.from;
	}
}



Measured memory_bytes: 30420
#include<bits/stdc++.h>
#define two(a) (1<<(a))
#define LINF (1ll<<61)
#define EPS (1e-14)
#define Lshift(a,b) ((a)<<(b))
#define Rshift(a,b) ((a)>>(b))
#define rep(a,b) for(a=0 ; a<b ; a++)
#define xrep(a,b,c) for(a=b ; a<c ; a++)
#define INF (1<<29)
#define sz(a) int(a.size())
#define mset(x) memset(x, 0, sizeof(x))
#define swap(a,b) ( (a^=b) , (b^=a) , (a^=b) )
#define GET(x) (mark[x>>5]>>(x&31)&1)
#define SET(x) (mark[x>>5]|=1<<(x&31))
#define maxL (10000000>>5)+1
#define mod 1000000007
#define vi vector<int>
#define pii pair<int, int>
#define mii map<int, int>
#define si set<int>
#define pb push_back
typedef long long ll;
using namespace std;
 
 
int main() {
    int x, y, w, h;
    cin >> w >> h >> x >> y;
    double area = double(w) * h / 2.0;
    printf("%.11lf ", area + EPS);
    if (x + x == w && y + y == h) {
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }
}

Measured memory_bytes: 3736