akhauriyash/Code-Regression huggingface dataset:
//  RAKSHIT KADAM

 #include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> 3
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree< int ,  null_type ,  less<int> ,  rb_tree_tag ,  tree_order_statistics_node_update>
#warning check the size of arrays!!!
// NUMERIC DEFINITIONS :
    #define INF 1000000000000000005
    #define inf 1000000004
    #define MOD  1000000007
    #define mod 998244353
    #define MAX 300006
    #define pi 3.1415926535897932384626433832795
#define ld long double
 #define ll long long
 #define int long long
 #define P(gg) for(auto rax:gg){cout<<rax<<" ";}cout<<endl;
 #define Need_for_speed(activated) ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
 #define satisfy ll ter; cin>> ter; while(ter--)
 #define inp(n) int n;cin >> n
 #define mp make_pair
 #define pb push_back
 #define endl "\n"
 #define x first
 #define y second
 #define fore(i,a,b) for(ll i=a;i<b;i++)
 #define forci(i,n) for(ll i=0;i<n;i++)
 #define vi vector<ll>
 #define Endl endl
 #define lb lower_bound
 #define ub upper_bound
#define pii pair<ll,ll>
 
 #define input freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout)
 #define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;
 
ll gcd(ll a, ll b){if (b == 0)return a;return gcd(b, a % b);}

int power(int x, unsigned int y, unsigned int m){ if (y == 0) return 1;int p = power(x, y/2, m) % m;  p = (p * p) % m;return (y%2 == 0)? p : (x * p) % m;}
ll modInverse(int a, int m){{ return power(a, m-2, m);}}
const int maxn = 500003;
//ll fact[1000005];
//ll modIN[1000005];
//void facto()
//{
//    ll lim =1000005;fact[0]=1;
//    for(ll i=1;i<lim;i++)
//    {
//        fact[i]=(fact[i-1]*i)%MOD;
//    }
//    modIN[n]=modInverse(fact[n],MOD);
//    for(ll i=n-1;i>=1;i--)
//    {
//        modIN[i] = (modIN[i+1]*(i+1))%MOD;
//    }
//}
//ll ncr(ll a,ll b)
//{
//    ll ret = 0;
//    ret = fact[a]*(modIN[b]);
//    ret%=MOD;
//    ret*=modIN[a-b];
//    ret%=MOD;
//    return ret;
//}

void solve()
{
    vi v,w;
    ll n;cin>>n;
    for(ll i=0;i<n;i++)
    {
        ll a,b;cin>>a>>b;
        v.pb(a+b);
        w.pb(a-b);
    }
    sort(v.begin(),v.end());
    sort(w.begin(),w.end());
    
    cout<<max(v[v.size()-1]-v[0],abs(w[w.size()-1]-w[0]))<<endl;
}
signed main(){
   Need_for_speed(activated);
//
//    satisfy
//    {
// solve();
//    }
    
  
    solve();

    
    
    return 0;
}


Measured memory_bytes: 6680
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N=sc.nextInt();
		int[][] a=new int[2][N];
		for(int i=0;i<2;i++) {
			for(int j=0;j<N;j++) {
				a[i][j]=sc.nextInt();
			}
		}
		
		int ans=0;
		int c=0;
		for(int i=0;i<N;i++) {
			c=0;
			for(int j=0;j<=i;j++) {
				c+=a[0][j];
			}
			for(int j=i;j<N;j++) {
				c+=a[1][j];
			}
			if(ans<c)ans=c;
		}
		System.out.println(ans);

		}
	}


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

vector<int>x;
int a, b;

int main() {
	while (cin >> a >> b) {
		x.clear();
		if (a >= 1) { x.push_back(2); }
		if (a >= 2) { x.push_back(3); }
		for (int i = 2; i < a; i++) {
			x.push_back((x[i - 1] + x[i - 2]) % 1001);
		}
		sort(x.begin(), x.end());
		int cnt = 1;
		for (int i = 0; i < x.size() - 1; i++) {
			if (x[i + 1] - x[i] >= b) {
				cnt++;
			}
		}
		cout << cnt << endl;
	}
	return 0;
}

Measured memory_bytes: 1228
/******************************************
* AUTHOR : RAJAGOPALAN *
* NICK : ARNO *
* INSTITUTION : VIT *
******************************************/
#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define alli(a, n, k) (a+k),(a+n+k)
#define FP(i, a, b, k) for(__typeof(a) i = a;i < b;i += k)
#define FS(i, a, b, k) for(__typeof(a) i = a;i > b;i -= k)
#define IT(it, a) for(__typeof(a.begin()) it = a.begin();it != a.end(); ++it)

#define eps 1e-6
#define pi 3.141592653589793
using namespace std;

template<class T> inline T gcd(T x, T y) { if (!y) return x; return gcd(y, x%y);}
typedef vector<int> VII;
typedef vector<ll> VLL;
typedef pair<int, int> PII;
typedef vector< pair<int, int> > VPII;
typedef vector< pair<int, PII > > VPPI;
const int MOD = 1e9 + 7;
const int INF = 1e9;

inline ll modulo(ll a, ll m)
{
	return (a % m + m) % m;
}

inline ll modInverse(ll a, ll m)
{
	assert(__gcd(a, m) == 1);
	ll m0 = m;
	ll y = 0, x = 1;

	if (m == 1)
		return 0;

	while (a > 1)
	{
		ll q = a / m;
		ll t = m;

		m = a % m, a = t;
		t = y;

		y = x - q * y;
		x = t;
	}

	if (x < 0)
		x += m0;

	return x;
}

inline ll modPow(ll x, ll y, ll m)
{ //x^y % m
	if (y == 0)
		return 1LL;
	else if (y == 1)
		return x;
	else
	{
		ll ans = modPow(x, y / 2, m) % m;
		if (y & 1)
		{
			return (((ans * ans) % m) * x) % m;
		}
		else
		{
			return (ans * ans) % m;
		}
	}
}

int main(void){
     const int inf = 100000000;


     int n,m;
     cin >> n >> m;

     int a[1000],b[1000],c[1000],dist[100][100];

     for(int i = 0; i < m; ++i){
         cin >> a[i] >> b[i] >> c[i];
         a[i]--,b[i]--;
         }

     for(int i = 0; i < n; ++i){
        for(int j = 0; j < n; ++j){
            if(i==j)
                dist[i][j]=0;
             else
             dist[i][j]=inf;
             }
         }

     for(int i = 0; i < m; ++i){
         dist[a[i]][b[i]]=min(dist[a[i]][b[i]],c[i]);
         dist[b[i]][a[i]]=min(dist[b[i]][a[i]],c[i]);
         }

     for(int k = 0; k < n; ++k){
         for(int i = 0; i < n; ++i){
             for(int j = 0; j < n; ++j){
                 dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);
                 }
            }
        }

     int ans=m;
     for(int i = 0; i < m; ++i){
         bool shortest=false;
         for(int j = 0; j < n; ++j) if(dist[j][a[i]]+c[i]==dist[j][b[i]]) shortest=true;
         if(shortest==true){
             ans=ans-1;
             }
         }

     cout << ans << endl;
     }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;

/*
    場合の数
        n個の箱にm個のボールをいれる入れ方(ボールと箱を区別する)の数

        ボールそれぞれに対してm通りあるため
        m^b
*/

int main() {
    int n;
    cin >> n;
    vector<int> d(n, 0);
    rep(i, n){
        int tmp;
        cin >> tmp;
        if(i==0 and tmp!=0){
            cout << 0 << endl;
            return 0;
        }
        if(i>0 and tmp==0){
            cout << 0 << endl;
            return 0;
        }
        d[tmp]++;
    }
    ll ans = 1;
    bool flag = true;
    rep(i, n){
        if(i==0) continue;
        if(d[i]==0){
            flag = false;
            continue;
        }
        if(flag){
            rep(j, d[i]){
                ans = (ans*d[i-1]) % 998244353;
            }
        }else{
            cout << 0 << endl;
            return 0;
        }
    }

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

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6+5;
typedef long long ll;
typedef unsigned long long ull;
const int INF= 0x3f3f3f3f;

int main() {
	int x,k;
	cin>>x>>k;
	if(500*x>=k) puts("Yes");
	else puts("No");

    return 0;
}



Measured memory_bytes: 256
#define  _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <deque>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <functional>
#include <math.h>
#include <time.h>
#include <fstream>
#include <list>
#include <climits>
#include <iomanip>

using namespace std;

typedef long long int lld;
typedef long double ld;
typedef vector<int> vi;
typedef vector<char> vch;
typedef vector<lld> vlld;

typedef struct node
{
	int ed;
	lld val;
} node;

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

	int n, ok = 0, a, b;

	cin >> n;

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

		if (a == b)
		{
			ok++;

			if (ok == 3)
			{
				ok = -1;

				break;
			}
		}
		else
			ok = 0;
	}

	if (ok == -1)
		cout << "Yes";
	else
		cout << "No";

	cout << '\n';

	return 0;
}


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

void boost(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

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

Measured memory_bytes: 3652
# -*- coding: utf-8 -*-
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys

def s():
    return raw_input().strip()
def n():
    return int(raw_input())
def d():
    return float(raw_input())

def ls():
    return raw_input().strip().split()
def ln():
    return map(int, raw_input().strip().split())
def ld():
    return map(float, raw_input().strip().split())

def fs():
    return [raw_input().strip() for i in xrange(input())]
def fn():
    return [int(raw_input().strip()) for i in xrange(input())]
def fd():
    return [float(raw_input().strip()) for i in xrange(input())]

N = n()

z, x = ln()

for i in xrange(N - 1):
    t, a = ln()
    q = t + a
    r1 = (z + x) / q
    if (z + x) % q != 0:
        r1 += 1
    r2 = z / t
    if z % t != 0:
        r2 += 1
    r3 = x / a
    if x % a != 0:
        r3 += 1
    m = max(r1, r2, r3)
    z = t * m
    x = a * m

print z + x




Measured memory_bytes: 4516
object Main {
  def main(args : Array[String]) {
    val K = readLine().toInt
    var Q = new scala.collection.mutable.Queue[Long]
    for(i <- 1L to 9L) Q += i

    var x = 0L
    for(i <- 0 until K) {
      x = Q.dequeue
      val R = x % 10
      val E = 10 * x + R
      if(R != 0) Q += E - 1
      Q += E
      if(R != 9) Q += E + 1
    }

    println(x)
  }
}

Measured memory_bytes: 50340
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){

    int ans=0;
    int a1,a2;
    cin>>a1>>a2;
    for(int i=a1;i<=a2;i++){
        string s;
        int h=i;
        rep(j,5){
            
            char c='0'+h%10;
            s+=c;
            h=h/10;
        }
        //cout<<s<<endl;
        if(i==atoi(&s[0])){
            ans+=1;
        }
        
    }
    cout<<ans<<endl;
    

return 0;
}

Measured memory_bytes: 256
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn main() {
    let line = read_vec::<i32>();
    let A = line[0];
    let B = line[1];
    let T = line[2];

    println!("{}", T / A * B);
}


Measured memory_bytes: 4352
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <iomanip>
#include <iostream>
#include <limits>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;

template<typename T>
vector<T> make_vec_nd(T init, ll size) {
    return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, ll size, Args... rest) {
    auto inner = make_vec_nd(init, rest...);
    return vector<decltype(inner)>(size, inner);
}

#define rep(i,a,b) for(ll i=(a);i<(b);i++)
#define rrep(i,a,b) for(ll i=(a)-1;i>=(b);i--)

int main() {
    ll N, M;
    cin >> N >> M;
    struct Bridge {
        ll A;
        ll B;
    };
    vector<Bridge> bridges(M);
    rep(i,0,M) {
        ll A, B;
        cin >> A >> B;
        A--;
        B--;
        bridges[i] = {A, B};
    }
    vector<set<ll>> groups;
    vector<ll> group_idx(N);
    rep(i,0,N) {
        groups.push_back(set<ll>{i});
        group_idx[i] = i;
    }
    vector<ll> ans;
    ans.push_back((N*(N-1))/2);
    ll convenience = 0;
    rrep(i,M,0) {
        ll conv_after = 0;
        ll conv_before = 0;
        ll set_a_idx = group_idx[bridges[i].A];
        ll set_b_idx = group_idx[bridges[i].B];
        if (set_a_idx != set_b_idx) {
            set<ll>* set_a = &groups[set_a_idx];
            set<ll>* set_b = &groups[set_b_idx];
            if (set_b->size() < set_a->size()) {
                swap(set_a, set_b);
                swap(set_a_idx, set_b_idx);
            }
            conv_before = (set_a->size() * (set_a->size() - 1)) / 2 + (set_b->size() * (set_b->size() - 1)) / 2;
            for (ll island : *set_a) {
                group_idx[island] = set_b_idx;
                set_b->insert(island);
            }
            conv_after = (set_b->size() * (set_b->size() - 1)) / 2;
        }
        convenience += conv_after - conv_before;
        ans.push_back((N*(N-1))/2 - convenience);
    }
    rrep(i,M,0) {
        cout << ans[i] << endl;
    }
}



Measured memory_bytes: 40240
#include <iostream>
#include<bits/stdc++.h>
#include<string>
#define ll long long

using namespace std;

int main()
{
   ll a,b,k;
   cin>>a>>b>>k;
   if(k>=a)
   {
       
       ll k1=k-a;
       b=b-k1;
       if(b<=0)
       b=0;
     a=0;
       
   }
   else
   {
       a=a-k;
       
   }
   cout<<a<<" "<<b<<endl;
   
   return 0;
}

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

██╗    ██╗██████╗ ██╗████████╗████████╗███████╗███╗   ██╗    ██████╗ ██╗   ██╗
██║    ██║██╔══██╗██║╚══██╔══╝╚══██╔══╝██╔════╝████╗  ██║    ██╔══██╗╚██╗ ██╔╝
██║ █╗ ██║██████╔╝██║   ██║      ██║   █████╗  ██╔██╗ ██║    ██████╔╝ ╚████╔╝
██║███╗██║██╔══██╗██║   ██║      ██║   ██╔══╝  ██║╚██╗██║    ██╔══██╗  ╚██╔╝
╚███╔███╔╝██║  ██║██║   ██║      ██║   ███████╗██║ ╚████║    ██████╔╝   ██║
 ╚══╝╚══╝ ╚═╝  ╚═╝╚═╝   ╚═╝      ╚═╝   ╚══════╝╚═╝  ╚═══╝    ╚═════╝    ╚═╝

     ███╗   ███╗   ██╗██████╗ ██████╗  █████╗ ██╗  ██╗██╗███╗   ███╗
     ████╗ ████║   ██║██╔══██╗██╔══██╗██╔══██╗██║  ██║██║████╗ ████║
     ██╔████╔██║   ██║██████╔╝██████╔╝███████║███████║██║██╔████╔██║
     ██║╚██╔╝██║   ██║██╔══██╗██╔══██╗██╔══██║██╔══██║██║██║╚██╔╝██║
     ██║ ╚═╝ ██║██╗██║██████╔╝██║  ██║██║  ██║██║  ██║██║██║ ╚═╝ ██║
     ╚═╝     ╚═╝╚═╝╚═╝╚═════╝ ╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝╚═╝     ╚═╝
*/
#define speed  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FOR(n) for(int i=0;i<n;i++)
#define For(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define E "\n"
#define all(e) e.begin(),e.end()
#define F first
#define S second
#define pi (acos(-1))
#define rad(x) ((x*pi)/(ld)(180))
#define perc(x) fixed<<setprecision(x)
/*****
#define cross(a, b) ((conj(a) * (b)).Y)
#define dot(a, b) ((conj(a) * (b)).X)
#define vec(a,b) ((b) - (a))
#define rot(p,angle) (p)*polar((double)(1),angle)
#define rot2(p,angle,a) ((p)-(a)) *(polar((ld)(1),angle)+ (a))
#define x real()
#define y imag()
*****/
typedef long long int ll; typedef unsigned long long ull; typedef long double ld;typedef complex<ld> point; typedef tuple<double,double,double> line;
ll gcd(ll x,ll y){if(!y)return x; return gcd(y,x%y);};   ll lcm(ll x,ll y){return (x*y)/__gcd(x,y);}

ll dp[100005][4],n,arr[100005][3];

ll solve(int i,int j)
{
    if(dp[i][j]!=-1 and i!=0)return dp[i][j];
    if(i==n)return 0;

    ll ret = -1;

    if(j!=0)
    ret = max(ret,solve(i+1,0)+arr[i][0]);
    if(j!=1)
    ret = max(ret,solve(i+1,1)+arr[i][1]);
    if(j!=2)
    ret = max(ret,solve(i+1,2)+arr[i][2]);

    return dp[i][j]=ret;
}

int main(){ speed;
memset(dp,-1,sizeof dp);

cin>>n;

FOR(n)cin>>arr[i][0]>>arr[i][1]>>arr[i][2];

dp[0][0]=arr[0][0],
dp[0][1]=arr[0][1],
dp[0][2]=arr[0][2];

for(int i=1;i<n;i++)
{
    int ret = -1;
    for(int j=0;j<3;j++)
    {
        if(!j)
        ret = max(dp[i-1][1]+arr[i][j],dp[i-1][2]+arr[i][j]);

        if(j==1)
        ret = max(dp[i-1][0]+arr[i][j],dp[i-1][2]+arr[i][j]);

        if(j==2)
        ret = max(dp[i-1][0]+arr[i][j],dp[i-1][1]+arr[i][j]);
        dp[i][j]=ret;
    }

}

cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
return 0;}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin >> n;
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		if (i % 2 == 0) {}
		else{
			int count = 0;
			for (int j = 1; j <= i; j++) {
				if (i % j == 0) count++;
			}
			if (count == 8) {
				ans++;
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 384
a,b=gets.chomp.split(" ").map { |e| e.to_i }
s=gets.chomp.split("").map { |e| e.to_s }

if s[a] != "-"
  puts "No"
  exit
end

for i in 0..9 do
  s.delete(i.to_s)
end


if s.length == 1
  puts "Yes"
else
  puts "No"
end


Measured memory_bytes: 3836
h,w = map(int,input().split())
grid = []
grid_num1 = []
grid_num2 = []
for i in range(h):
    lst = list(input())
    lst.append("#")
    grid.append(lst)
    grid_num1.append([0]*w)
grid.append(["#"]*(w+1))
for j in range(w):
    grid_num2.append([0]*h)

grid_t = [list(x) for x in zip(*grid)]

for i in range(h):
    sw = []
    tar_row = grid[i]
    for j in range(w+1):
        if j == 0 and tar_row[j] == ".":
            sw.append(j)
        elif tar_row[j] == "." and tar_row[j-1] == "#":
            sw.append(j)
        elif tar_row[j] == "#" and tar_row[j-1] == ".":
            sw.append(j)
    for j in range(0,len(sw),2):
        l = sw[j]
        r = sw[j+1]
        for k in range(l, r):
            grid_num1[i][k] += r-l

for i in range(w):
    sw = []
    tar_row = grid_t[i]
    for j in range(h+1):
        if j == 0 and tar_row[j] == ".":
            sw.append(j)
        elif tar_row[j] == "." and tar_row[j-1] == "#":
            sw.append(j)
        elif tar_row[j] == "#" and tar_row[j-1] == ".":
            sw.append(j)
    for j in range(0,len(sw),2):
        l = sw[j]
        r = sw[j+1]
        for k in range(l, r):
            grid_num2[i][k] += r-l
# grid_num2 = [list(x) for x in zip(*grid_num2)]

ans = 0
for i in range(h):
    for j in range(w):
        ans = max(ans, grid_num1[i][j] + grid_num2[j][i]-1)
print(ans)



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

typedef long long ll;

const ll MOD = 1000000007;

ll ncr[2005][2005];
ll cu1[2005][2005];
ll cu2[2005][2005];
ll cac[2005][2005];
bool vi[2005][2005];
ll ans;

ll slv(int n, int b)
{
	if (vi[n][b]) return cac[n][b];
	vi[n][b] = true;
	int a = n - b;
	if (a == 0 || b == 0) return 1;
	cac[n][b] = cu1[b-1][b-1];
	if (b-a-2 > 0) cac[n][b] -= cu1[b-1][b-a-3];
	cac[n][b] += MOD; cac[n][b] %= MOD;
	cac[n][b] *= (a-b+2); cac[n][b] %= MOD;
	cac[n][b] += cu2[b-1][b-1];
	if (b-a-2 > 0) cac[n][b] -= cu2[b-1][b-a-3];
	return cac[n][b];
}

int main()
{
	int a, b; scanf("%d%d", &a, &b);
	if (a == 0 || b == 0) return !printf("1\n");
	for (int i = 0;i < 2005;i++) for (int j = 0;j < 2005;j++)
	{
		if (i == 0 || j == 0 || i == j) ncr[i][j] = 1;
		else if (j > i) ncr[i][j] = 0;
		else ncr[i][j] = (ncr[i-1][j]+ncr[i-1][j-1])%MOD;
		cu1[i][j] = 1;
		cu2[i][j] = 0;
		if (j)
		{
			cu1[i][j] = (ncr[i][j]+cu1[i][j-1])%MOD;
			cu2[i][j] = (ncr[i][j]*j+cu2[i][j-1])%MOD;
		}
	}
	for (int x = 0;x <= a;x++) for (int y = max(1, b-a+x);y <= b;y++)
	{
		ans += ncr[b-1][y-1]*slv(a-x, b-y);
		ans %= MOD;
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 129792
#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <sstream>
#include <climits>
#include <cmath>
#include <list>
#include <functional>
#include <map>
#include <stack>
using namespace std;
#define M_PI 3.141592
#define FOR(i,n) for(int i=0;i<(int)n;i++)
#define FORI(i,k,n) for(int i=k;i<(int)n;i++)
#define toRad 2.0*M_PI/360.0
#define inin(x) int x;cin>>x;
#define all(x) x.begin(),x.end()
#define debug(x) cout<<#x<<" :"<<x<<endl;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define EPS 1e-12
#define pri_max 60000
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };

/* 
bool memo[pri_max] = {};
vector<int> pri;
void calc()
{
	for (int i = 2; i < pri_max; i++)
	{
		if (memo[i] == false)
		{
			pri.push_back(i);
			for (int l = i; l < pri_max; l += i)
			{
				memo[l] = true;
			}
		}
	}
}*/
double len(pdd a, pdd b)
{
	return sqrt((b.first - a.first)*(b.first - a.first) + (b.second - a.second)*(b.second - a.second));
}



int main()
{
	string s;
	while (getline(cin, s))
	{
		stringstream ss(s);
		stack<double> st;
		while (getline(ss, s, ' '))
		{
			if (s == "+" || s == "-" || s == "*" || s == "/")
			{
				double a, b;
				a = st.top(); st.pop();
				b = st.top(); st.pop();
				switch (s[0])
				{
				case '+':
					st.push(b + a);
					break;
				case'-':
					st.push(b - a);
					break;
				case'/':
					st.push(b / a);
					break;
				case'*':
					st.push(b*a);
					break;
				}
			}
			else
			{
				st.push(atoi(s.c_str()));
			}
		}
		printf("%.5lf\n", st.top());
	}
}

Measured memory_bytes: 1268
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <map>
#include <set>
#include <iomanip>

using namespace std;
using ll = long long;

int main() {
    string S;
    cin >> S;
    
    vector<string> tenki;
    tenki.push_back("Sunny");
    tenki.push_back("Cloudy");
    tenki.push_back("Rainy");
    tenki.push_back("Sunny");
    
    for(int i=0;i<3;i++){
        if(S==tenki[i]){
            cout << tenki[i+1] << endl;
        }
    }
    return 0;
}


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

using namespace std;

const long long int INF = 1LL<<60;
const long long int mod = 1e9 + 7;

int main() {
  int N, M, X;
  cin >> N >> M >> X;
  vector<int> C(N+1);
  vector<vector<int>> A(N+1, vector<int>(M+1, 0));
  vector<long long> sum_a(M+1, 0);
  for(int i=1; i<=N; i++) {
    cin >> C[i];
    for(int j=1; j<=M; j++) {
      cin >> A[i][j];
      sum_a[j] += A[i][j];
    }
  }

  bool possible=true;
  for(int j=1; j<=M; j++) {
    if(sum_a[j] < X) {
      possible = false;
      break;
    }
  }
  if(!possible) {
    cout << -1 << endl;
    return 0;
  }

  long long all_patterns = (long long)(pow(2, N+1))-2;
  vector<vector<long long>> state(all_patterns+1, vector<long long>(M+1, 0));
  vector<long long> cumulative_cost(all_patterns+1);
  vector<long long> ok(all_patterns+1, false);

  long long pattern=2;
  long long pos = 1;
  for(int i=1; i<=N; i++) {
    long long prev_ref = pos - pattern / 2;
    for(int j=1; j<=pattern; j++) {
      if(j%2 == 0) {
        for(long long k=1; k<=M; k++) {
          state[pos][k] = state[prev_ref][k];
          state[pos][k] += A[i][k];
        }

        cumulative_cost[pos] = cumulative_cost[prev_ref] + C[i];
        bool possible=true;
        for(int k=1; k<=M; k++) {
          possible = possible && (state[pos][k] >= X);
        }
        ok[pos] = possible;
        prev_ref++;
      }else {
        for(int k=1; k<=M; k++) {
          state[pos][k] = state[prev_ref][k];
        }
        cumulative_cost[pos] = cumulative_cost[prev_ref];
        ok[pos] = ok[prev_ref];
      }
      pos++;
    }
    pattern *= 2;
  }

  long long ans=1200000 + 1;
  for(long long i=1; i<=all_patterns; i++) {
    if(ok[i]) {
      ans = min(ans, cumulative_cost[i]);
    }
  }

  cout << ans << endl;

  return 0;
}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	vector<pii> a(n);
	rep(i,n) cin >> a.at(i).first >> a.at(i).second;
	sort(a.begin(),a.end());
	int ans=a[n-1].first-a[0].first+1;
	ans+=a[0].first-1;
	ans+=a[n-1].second;
	cout << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

using namespace std;
typedef long long int ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define print(x) cout << x << endl

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

ll MOD = 1000000007;

int main()
{
    ll N;
    cin >> N;
    vector<ll> H(N);
    rep(i, N) cin >> H[i];
    ll ma = 0;
    ll cnt = 0;
    rep(i, N)
    {
        if (ma <= H[i]) {
            cnt++;
            ma = H[i];
        }
    }
    print(cnt);
    return 0;
}


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

int a[100000][4];

int main(){
	int f=1,i,j,n;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>a[i][1]>>a[i][2]>>a[i][3];
		if((a[i][2]+a[i][3]>a[i][1])||a[i][1]%2!=(a[i][2]+a[i][3])%2)
			f=0;
	}
	if(f==1)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
}

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

using namespace std;

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

    long long int A, B, C, D;
    cin >> A >> B >> C >> D;

    long long int a = C;
    long long int b = D;

    long long int x = a * b;

    long long int C_count;
    long long int D_count;
    long long int CD_count;
 
    /* 自然数 a > b を確認・入替 */
    if(a < b){
        long long int tmp = a;
        a = b;
        b = tmp;
    }
 
    /* ユークリッドの互除法 */
    long long int r = a % b;
    while(r != 0){
        a = b;
        b = r;
        r = a % b;
    }

    long long int sai = x / b;
/*
    if(A % C == 0)
    {
        C_count = ((B + 1) - A) / C;
    } else {
        long long int min = 0;
        if(A > C)
        {
            min = C - (A % C);
            cout << min << endl;
        }
        C_count = ((B + 1) - (A + min)) / C;
        if(B % C == 0)
        {
            C_count++;
        }
    }

    cout << C_count << endl;

    if(A % D == 0)
    {
        D_count = ((B + 1) - A) / D;
    } else {
        long long int min = 0;
        if(A > D)
        {
            min = D - (A % D);
            cout << min << endl;
        }
        D_count = ((B + 1) - (A + min)) / D;
        if(B % D == 0)
        {
            D_count++;
        }
    }

    cout << D_count << endl;

    if(A % sai == 0)
    {
        CD_count = ((B + 1) - A) / sai;
    } else {
        long long int min = 0;
        if(A > sai)
        {
            min = sai - (A % sai);
        }
        CD_count = ((B + 1) - (A + min)) / sai;
        if(B % sai == 0)
        {
            CD_count++;
        }
    }

    cout << CD_count << endl;
*/

    C_count = B / C - (A - 1) / C;
    D_count = B / D - (A - 1) / D;
    CD_count = B / sai - (A - 1) / sai;

    cout << B + 1 - A - C_count - D_count + CD_count << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>

using namespace std;

int main () {
    vector<int> inputs;
    int n, s;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> s;
        inputs.push_back(s);
    }
    array<bool, 100001> dp{};
    dp[0] = true;
    for (int i = 0; i < inputs.size(); ++i) {
        for (int j = dp.size()-1; j >= 0; --j) {
            if (dp[j]) {
                dp[j + inputs[i]] = true;
            }
        }
    }
    int res = 0;
    for (int i = dp.size()-1; i >= 0; --i) {
        if(dp[i] && (i % 10 != 0)) {
            res = i;
            break;
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 384
using System;
using System.Windows;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;

class Program
{
    static string S;
    static void Main(string[] args)
    {
      //入力を受け取る
      var NK = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
      var N = NK[0];
      var K = NK[1];
      var h = new long[N];
      
      for(int i = 0 ; i < N ; i++){
        h[i] = int.Parse(Console.ReadLine());
      }
      
      Array.Sort(h);
      
      var can = new long[N-K+1];
      
      for(int i = 0 ; i+K-1 < N ; i++){
         can[i] = h[i+K-1]-h[i];
      }
      Console.WriteLine(can.Min());
    }
  
}




Measured memory_bytes: 16988
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;

#define ll long long
#define P pair<int, int>
#define FOR(i, N) for (int i = 0; i < (int)N; i++)
#define FORIN(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define GI(name) \
  int(name);     \
  scanf("%d", &(name))
#define GI2(name1, name2) \
  int(name1), (name2);    \
  scanf("%d %d", &(name1), &(name2))
#define GI3(name1, name2, name3) \
  int(name1), (name2), (name3);  \
  scanf("%d %d %d", &(name1), &(name2), &(name3))
#define GVI(name, size)    \
  vector<int>(name)(size); \
  FOR(i, (size)) scanf("%d", &(name)[i])
#define GS(name) \
  string(name);  \
  cin >> (name);
#define MOD 1000000007
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

string to_string(string s) {
  return s;
}

template <class T>
string to_string(vector<T> v) {
  string ret = "{";
  FOR(i, v.size() - 1) { ret += to_string(v[i]) + ","; }
  if (v.size() > 0) {
    ret += to_string(v.back());
  }
  ret += "}";
  return ret;
}

void debug() {
  cerr << endl;
}

template <class Head, class... Tail>
void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}

void print() {
  cout << endl;
}

template <class Head, class... Tail>
void print(Head head, Tail... tail) {
  cout << to_string(head);
  print(tail...);
}

int main() {
  GS(S);
  print((S[0] == S[1] || S[2] == S[1] || S[2] == S[3]) ? "Bad" : "Good");
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <set>
#include <unordered_map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <deque>
#include <bitset>
#include <climits>
#include <cstdio>
#include <list>
#include <iomanip>
using namespace std;

#define ll long long int
#define mp make_pair
#define pb push_back
#define fi first
#define si second
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define F(a,n) for(int i=0;i<n;i++){cin>>a[i];}
#define F1(a,n) for(int i=1;i<=n;i++){cin>>a[i];}
#define P(a,n) for(int i=0;i<n;i++){cout<<a[i]<<' ';}cout<<endl;
#define P1(a,n) for(int i=1;i<=n;i++){cout<<a[i]<<' ';}cout<<endl;
#define NF(a,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cin>>a[i][j];}}
#define NF1(a,n,m) for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cin>>a[i][j];}}
#define PNF(a,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
#define PNF1(a,n,m) for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
#define AS 200001
#define mod 1000000007
#define inf 1e9+1;
struct item
{
	int wt, val;
};

int solve(vector<item>&ar, int n, int w) {
	ll maxval = n * 1000;
	ll dp[n + 1][maxval + 1];
	for (int val = 0; val <= maxval; val++)
		dp[1][val] = inf;
	dp[1][0] = 0;
	dp[1][ar[1].val] = ar[1].wt;
	for (int i = 2; i <= n; i++) {
		for (int v = 0; v <= maxval; v++) {
			dp[i][v] = dp[i - 1][v];
			if (ar[i].val  > v) {
				continue;
			}
			dp[i][v] = min(dp[i][v], ar[i].wt + dp[i - 1][v - ar[i].val]);
		}

	}
	int ans = 0;
	for (int x = 0; x <= maxval; x++) {
		if (dp[n][x] <= w) {
			ans = x;
		}
	}
	return ans;
}
int main() {
	fastIO

	int n;
	cin >> n;
	int W;
	cin >> W;
	vector<item>ar;
	ar.resize(n + 1);
	for (int i = 1; i <= n; i++) {
		cin >> ar[i].wt >> ar[i].val;
	}
	cout << solve(ar, n, W) << endl;
}

Measured memory_bytes: 78336
#include <iostream>
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include<math.h>
using namespace std;
//#define int long long
#define m_p make_pair
#define mod 1000000007
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define all(v)  v.begin(),v.end()
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>vec[i];
using namespace std;

int jousu(int, int);
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int kurai(int x00, int y00) {
	int z00 = (x00 % jousu(10, y00)) / jousu(10, y00 - 1);
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}



int main() {
	int n;
	double ans;
	cin >> n;
	vector<int>vec(n);
	vecin(vec);
	sort(all(vec));
	ans = vec[0];
	for (int i = 1; i < n; i++) {
		ans = (ans + vec[i]) / 2.0;
	}
	printf("%.10lf", ans);
}


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

double f(int st, int h) {
    return ceil((double)h / st);
}

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

    int A, B, C, D;
    cin >> A >> B >> C >> D;

    cout << (f(B, C) <= f(D, A) ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 3652
from collections import defaultdict
n,k=map(int,input().split())
r,s,p=map(int,input().split())
S=input()
d=defaultdict(int)
d['r']=p
d['s']=r
d['p']=s
total=0
f=[True]*n
#print(d['r'])
for i in range(n):
    #print(d[S[i]])
    
    if i<k or f[i-k] == False:
        total+=d[S[i]]
    else:
        b=S[i]
        a=S[i-k]
        if b==a:
            f[i]=False
        else :
            total+=d[b]
    #print(total,S[i])

print(total)

Measured memory_bytes: 41836
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()


int main(){
    string s;
    cin>>s;
    
    int n=s.size();
    deque<char> dq;
    rep(i,n){
        if(s[i]=='0') dq.push_back('0');
        else if(s[i]=='1') dq.push_back('1');
        else{
            if(dq.empty()) continue;
            dq.pop_back();
        }
    }

    while(!dq.empty()){
        cout<<dq.front();
        dq.pop_front();
    }
    cout<<endl;
}



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

string s;
vector<int> alphabet(26);
vector<int> alphabet_half(26);
vector<int> loc_c(26);
vector<int> a;
vector<int> b;
vector<int> c;

vector<int> s_to_i;
vector<int> ss_to_i;

vector<vector<int> > table(26,vector<int>());


vector<int> locate(26,0);
vector<int> bable;
vector<int> binary_indexed_tree(300000,0);

void make_table(){
  int count=0;
  for(int i=0;i<ss_to_i.size();i++){
    int num = (int) ss_to_i[i];
    table[num].push_back(count);
    count+=1;
  }
}

ll sum_b(int b,int n){
  ll ans=0;
  while(b>0){
    ans+=(ll)binary_indexed_tree[b];
    b-=b&-b;
  }
  return ans;
}

void add_b(int b,int n){
  while(b <= n){
    binary_indexed_tree[b]+=1;
    b+=b&-b;
  }
}

ll count_bable_sort(){
  make_table();
  for(int i=0;i<s_to_i.size();i++){
    int num = (int) s_to_i[i];
    int num2 = table[num].at(locate[num]);
    locate[num]+=1;
    bable.push_back(num2);
  }
  int n = bable.size();
  ll ans=0;
  //cout << n << endl;
  for(int j=0;j<n;j++){
    ll num_x = sum_b(bable[j]+1,n);
    ans+=(ll)(j-num_x);
    add_b(bable[j]+1,n);
  }
  return ans;
}

bool odd_check(string s){
  for(int i=0;i<(int) s.size();i++){
    char ch = s[i];
    int num = ch - 97;
    //cout << num << endl;
    alphabet[num]+=1;
  }
  int count =0;
  for(int i=0;i<26;i++){
    if(alphabet[i]%2==1){
      loc_c[i]=1;
      count += 1;
    }
    else{
      loc_c[i]=0;
    }
  }
  if(count > 1){
    return true;
  }
  return false;
}
int main(){
  cin >> s;
  if(odd_check(s)){
    cout << -1 << endl;
    return 0;
  }
  for(int i=0;i<26;i++){
    alphabet_half[i]=alphabet[i]/2;
    //cout << alphabet[i] << endl;
  }
  for(int i=0;i<(int)s.size();i++){
    int num = s[i] - 97;
    int num_i = alphabet[num];
    int num_j = alphabet_half[num];
    if(loc_c[num]){
      if(num_i>num_j+1){
        a.push_back(num);
        alphabet[num]-=1;
      }
      else if(num_i==num_j+1){
        b.push_back(num);
        alphabet[num]-=1;
      }
      else{
        c.push_back(num);
        alphabet[num]-=1;
      }
    }
    else{
      if(num_i>num_j){
        a.push_back(num);
        alphabet[num]-=1;
      }
      else{
        c.push_back(num);
        alphabet[num]-=1;
      }
    }
  }
  c=a;
  reverse(c.begin(),c.end());
  string ss;
  for(int i=0;i<a.size();i++){
    ss+=(char) (a[i]+97);
  }
  for(int i=0;i<b.size();i++){
    ss+=(char (b[i]+97));
  }
  for(int i=0;i<c.size();i++){
    ss+=(char (c[i]+97));
  }
  //cout << ss << endl;

  for(int i=0;i<s.size();i++){
    s_to_i.push_back((int) s[i] - 97);
    ss_to_i.push_back((int) ss[i] - 97);
  }
  ll count=count_bable_sort();
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 7220
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <functional>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define REP(i,n) for(int i=0,_n=(n);(i)<(int)_n;++i)
#define RANGE(i,a,b) for(int i=(int)a,_b=(int)(b);(i)<_b;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define PRINT1(table, D0) REP(d0, D0) cout<<table[d0]<<" "; cout<<"\n";
#define PRINT2(table, D0, D1) REP(d0, D0) { REP(d1, D1) cout<<table[d0][d1]<<" "; cout<<"\n"; }
#define PRINT3(table, D0, D1, D2) REP(d0, D0) { REP(d1, D1) { REP(d2, D2) cout<<table[d0][d1][d2]<<" "; cout<<"\n"; } cout<<"\n"; }
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }

#define MOD 1000000007LL
#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,a,b;
	string s;
	while(cin>>N) {
		ll t = 0, o = 0;
		VI A(N), B(N);
		REP(i, N) cin>>A[i];
		REP(i, N) cin>>B[i];
		REP(i, N) {
			ll d = A[i]-B[i];
			ll lo=0, lt=0;
			if(d>0) lo=d;
			else {
				lt = (-d+1)/2;
				if(d+lt*2) lo=1;
			}
			o+=lo;
			t+=lt;
		}
		ll sum = 0;
		if(t>o) sum = -(t-o);
		else sum = (o-t)*2;
		string ans = "No";
		if(sum<=0) ans="Yes";
		
		cout<<ans<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 384
N = int(input())
num_list = list(map(int, input().split()))

student = {str(i + 1):num_list[i] for i in range(N)}

# returnはリスト 型になる
sorted_student = sorted(student.items(), key=lambda x:x[1])

result = ""
for j in range(N):
    result += sorted_student[j][0] + " "

print(result.strip())

Measured memory_bytes: 28764
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    int A,B,C;
    R(A,B,C);
    W(A+B+C-max({A,B,C}));
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main() {
	var aLength, bLength, hour, min float64
	fmt.Scan(&aLength, &bLength, &hour, &min)
	var hourAngle, minAngle float64
	minAngle = 6 * min
	hourAngle = 30 * hour + 30 * min / 60
	angle := minAngle - hourAngle

	if angle < 0 {
		angle *= -1
	}
	if angle > 180 {
		angle = 360 - angle
	}
	//fmt.Println(angle)
	angleRad := angle * math.Pi/180
	//fmt.Println(math.Cos(angleRad))
	cLength2 := aLength * aLength + bLength * bLength - 2 * aLength * bLength * math.Cos(angleRad)
	fmt.Println(math.Sqrt(cLength2))
}


Measured memory_bytes: 1824
import java.util.*;

// UVa 11504

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		
		char[] c = in.next().toCharArray();
		int[] num = new int[26];
		
		for (int i = 0; i < c.length; i++) {
			num[c[i] - 'a']++;
		}
		
		boolean isBeautiful = true;
		for (int i = 0; i < num.length; i++) {
			if (num[i] % 2 != 0) {
				isBeautiful = false;
				break;
			}
		}
		
		System.out.println(isBeautiful ? "Yes" : "No");
	}
}

Measured memory_bytes: 20948
#include <stdio.h>
#include <stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define min(p,q)((p)<(q)?(p):(q))
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
#define invp(a,p)pom(a,p-2,p)
#define M 1000000007

ll fact[1010];
ll invfact[1010];
ll dp[1010][1010];
//dp[i][j]=i人以下のグループを決めてまだj人余ってる場合の数

int main(){
	int n,a,b,c,d;
	scanf("%d%d%d%d%d",&n,&a,&b,&c,&d);
	fact[0]=1;
	rep(i,1,1005)fact[i]=fact[i-1]*i%M;
	invfact[1000]=invp(fact[1000],M);
	for(int i=999;i>=0;i--)invfact[i]=invfact[i+1]*(i+1)%M;
	
	dp[a-1][n]=1;
	rep(g,a,b+1){
		rep(rest,0,n+1){
			dp[g][rest]=(dp[g][rest]+dp[g-1][rest])%M;
			//残りのrest人からg人グループをcnt個作る
			//rest人から(g*cnt)人選んで、グループの順列がcnt!、グループ内の人の順列が(g!)^cnt
			rep(cnt,c,min(d,rest/g)+1){
				dp[g][rest-g*cnt]=(dp[g][rest-g*cnt]
								   +dp[g-1][rest]
								   *(fact[rest]*invfact[rest-g*cnt]%M)%M
								   *invfact[cnt]%M
								   *pom(invfact[g],cnt,M)
								  )%M;
			}
		}
	}
	printf("%lld\n",dp[b][0]);
	return 0;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
int I, J, G[200][100];

int main(void){
	//IO("test.in", "test.out");
	scanf("%d%d", &I, &J), cin.get();
	for(int i = 0; i < I; i++){
		for(int j = 0; j < J; j++){
			G[i * 2][j] = cin.get();
			G[i * 2 + 1][j] = G[i * 2][j];
		}
		cin.get();
	}
	for(int i = 0; i < I * 2; i++){
		for(int j = 0; j < J; j++) printf("%c", G[i][j]);
		printf("\n");
	}
}

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

int main(){
 int n;
 cin >> n;
 set<string> st;
 rep(i,n){
   string s;
   cin >> s;
   st.insert(s);
 }
 cout << st.size() << endl;
}
  
  
    


Measured memory_bytes: 19192
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        String s = buildStr(a, b);
        String t = buildStr(b, a);
        String ans = (s.compareTo(t) < 0) ? s : t;
        System.out.println(ans);
    }

    static String buildStr(int a, int b) {
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < b; ++i) sb.append(a);
        return sb.toString();
    }
}

Measured memory_bytes: 23124
import Data.List.Split

main = do line <- getLine
          putStrLn $ range line

range :: String -> String
range line
  | a < b && b < c = "Yes"
  | otherwise = "No"
  where splited = splitOn " " line
        a = read $ splited!!0 :: Int
        b = read $ splited!!1 :: Int
        c = read $ splited!!2 :: Int

Measured memory_bytes: 3640