akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define rbg rbegin()
#define red rend()
#define all(x) x.bg,x.ed
#define rall(x) x.rbg,x.red
#define pb push_back
#define pf push_front
#define eb emplace_back
using namespace std;
typedef long long ll;
template<class t,class u> bool chmax(t&a,u b){if(a<b){a=b; return true;} return false;}
template<class t,class u> bool chmin(t&a,u b){if(a>b){a=b; return true;} return false;}
template<class t,class u> t MAX(t a,u b){if(a>=b) return a; return b;}
template<class t,class u> t MIN(t a,u b){if(a<=b) return a; return b;}
template<class t> int SIZE(t s){return (int)s.size();}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using vvi=vc<vc<int>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
const long long INF = 1LL << 60;

int main(){
    cout << fixed << setprecision(20);
    int a; cin >> a;
    string s; cin >> s;
    if(a >= 3200) cout << s << endl;
    else cout << "red" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))//memset only use to initialize 0 or -1 no other number.
#define pii pair<int,int>
#define pll pair<ll,ll>
#define INF 1e9
#define INFL 1e18
#define mod 1000000007
//#define mod 998244353
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
using namespace __gnu_pbds; 
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> os;
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> os_pair;

ll power(ll x,ll n){ll res =1;while(n>0){if(n%2==1){res=res*x;}x=x*x;n=n/2;}return res;}
ll powm(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

//cout<< fixed << setprecision(10)

int main(){

    fast;
    int T;
    T=1;
    //cin>>T;
    while(T--){
    	int n,i,j;
    	cin>>n;
    	int a[n+1];
    	int cnt=0;
    	for(i=1;i<n+1;i++)
    	{
    		cin>>a[i];
    		if(i%2==1&&a[i]%2==1)
    		cnt++;
		}
		cout<<cnt;
    	
    	

    }

}

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

#define REP(i,m,n) for(int i=(m); i<(int)(n); i++)
#define RREP(i,m,n) for(int i=(int)((n)-1); i>=m; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define fi first
#define se second
#define debug(...) {cerr<<"[L"<<__LINE__<<"] "; _debug(__VA_ARGS__);}

template<typename T>
string join(const vector<T>&v, string del=", "){ stringstream s;
    for(auto x : v) s << del << x; return s.str().substr(del.size());
}
template<typename T>
ostream& operator<<(ostream& o, const vector<T>&v){
    if(v.size()) o << "[" << join(v) << "]"; return o;
}
template<typename T>
ostream& operator<<(ostream& o, const vector<vector<T> >&vv){
    int l = vv.size();
    if(l){ o<<endl; rep(i,l) o << (i==0 ? "[ " : ",\n  " ) << vv[i] << (i==l-1 ? " ]" : ""); }
    return o;
}
template<typename T1, typename T2>
ostream& operator<<(ostream& o, const pair<T1, T2>& p){
    return o << "(" << p.first << ", " << p.second << ")";
}
inline void _debug(){cerr<<endl;}
template<class First, class... Rest>
void _debug(const First& first, const Rest&... rest){cerr<<first<<" ";_debug(rest...);}

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

const double PI = (1*acos(0.0));
const double EPS = 1e-9;
const int INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const ll mod = 1e9 + 7;

inline void finput(string filename) {
    freopen(filename.c_str(), "r", stdin);
}

template<typename T>
struct BIT{
    int n;
    vector<T> dat;
    BIT(int n) : n(n), dat(n+1,0){}
    void add(int x, T val){
        for(int i = x+1; i <= n; i += (i & -i)) dat[i] += val;
    }
    T sum(int x){
        T ret = 0;
        for(int i = x+1; i > 0; i -= (i & -i)) ret += dat[i];
        return ret;
    }
    T sum(int a, int b){
        return sum(b) - sum(a-1);
    }
};

int main(){
    ios_base::sync_with_stdio(0);
    // finput("./input");
    int n; cin >> n;
    vi a(n),b(n);
    rep(i,n) cin >> a[i];
    rep(i,n) cin >> b[i];

    int ans = INF;
    rep(bit,1<<n){
        if(__builtin_popcountll(bit) & 1) continue;
        vector<pii> odd, even;
        rep(i,n){
            int x = (bit>>i & 1) ? b[i] : a[i];
            if(bit>>i&1 ^ (i+1)&1){
                odd.emplace_back(x, i);
            }else{
                even.emplace_back(x, i);
            }
        }

        if(odd.size() == (n+1)/2){
            bool ok = true;
            sort(all(odd));
            sort(all(even));
            auto bit = BIT<int>(n+1);
            int pre = 0, res = 0;
            rep(i,n){
                vector<pii> v = (i % 2 == 0) ? odd : even;
                if(v[i/2].fi < pre) ok = false;
                pre = v[i/2].fi;
                res += bit.sum(v[i/2].se+1,n);
                bit.add(v[i/2].se, 1);
            }
            if(ok) ans = min(ans, res);
        }
    }
    if(ans == INF) cout << -1 << endl;
    else cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3552
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1

struct Future {
  i64 n, cost;
  Future(i64 n, i64 cost) :n(n), cost(cost) {}
};

bool fcmp(const Future& l, const Future& r) {
  return (long double)l.n * l.cost < (long double)r.n* r.cost;
}

i64 calc(i64 N, i64 A, i64 B, i64 C, i64 D) {

  // A:x2 B:x3 C:x5 D:+-1

  unordered_map<i64, i64> dp;

  auto dfs = [&](auto dfs, i64 n, i64 cost)->void {

    auto it = dp.find(n);
    if (it != dp.end() && it->second <= cost) return;

    dp[n] = cost;
    if (n == 0) return;

    i64 t;

    if (n % 5 == 0) {
      dfs(dfs, n / 5, cost + C);
    }
    else {
      t = n / 5;
      dfs(dfs, t, cost + C + (n - t * 5) * D);
      t = n / 5 + 1;
      dfs(dfs, t, cost + C + (t * 5 - n) * D);
    }
    if (n % 3 == 0) {
      dfs(dfs, n / 3, cost + B);
    }
    else {
      t = n / 3;
      dfs(dfs, t, cost + B + (n - t * 3) * D);
      t = n / 3 + 1;
      dfs(dfs, t, cost + B + (t * 3 - n) * D);
    }
    if (n % 2 == 0) {
      dfs(dfs, n / 2, cost + A);
    }
    else {
      t = n / 2;
      dfs(dfs, t, cost + A + (n - t * 2) * D);
      t = n / 2 + 1;
      dfs(dfs, t, cost + A + (t * 2 - n) * D);
    }

    if (n < (INT64_MAX - cost) / D) {
      dfs(dfs, 0, cost + n * D);
    }
  };
  dfs(dfs, N, 0);

  return dp[0];
}

// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  // 3^12 = 531,441

  /*
  0
  1:2
  2:1

  3:10:20:6
  4:11:22:8
  5:12:21:7
  6:20:10:3
  7:21:12:5
  8:22:11:4

  9:100

  27:1000

  46:1201:2102:65


  */

  int T;
  i64 N, A, B, C, D;
  cin >> T;
  F0R(i, T) {
    cin >> N >> A >> B >> C >> D;
    cout << calc(N, A, B, C, D) << newl;
  }
}
#endif


Measured memory_bytes: 4076
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define int long long


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

    int n; cin >> n;

    vector<int> ans(100001,100000);
    ans.at(0) = 0;

    for(int i = 1;i < 100001;i ++){
        ans.at(i) = min(ans.at(i-1) + 1,ans.at(i));

        int pow6 = 6,pow9 = 9;

        while(i - pow6 >= 0){
            ans.at(i) = min(ans.at(i-pow6) + 1,ans.at(i));
            pow6 *= 6;
        }

        while(i - pow9 >= 0){
            ans.at(i) = min(ans.at(i-pow9) + 1,ans.at(i));
            pow9 *= 9;
        }
    }

    cout << ans.at(n) << endl;
}

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

int main(void){
    long k, n;
    cin >> n >> k;
    /*
    vector<long> a(n);
    long ind_one = -1;
    for(long i=0; i<n; i++){
        cin >> a[i];
        if(a[i]==1){
            ind_one = i;
        }
    }
    */
    long mini = (n-1+k-2)/(k-1);
    cout << mini << endl;
    return 0;
}


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

int main() {
  int A, B,C,D;
  cin >> A >> B >> C >> D;
  if((A+B) > (C+D))
  {
      cout << "Left" << endl;
  }
  else if((A+B) == (C+D))
  {
     cout << "Balanced" << endl;
  }
  else
  {
    cout << "Right" << endl;
  }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#include <unistd.h>
#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
#define vecin(a) rep(i,a.size())cin >> a[i]
#define vecout(a) rep(i,a.size())cout << a[i] << " ";cout << "\n"
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const ld pi = 3.14159265358;
const ll mod = 1000000007;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
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;}
template<class T> inline bool change(T a,T b){if(a > b){swap(a,b);return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
const ll cmax = 1000000;
ll fac[cmax], finv[cmax], inv[cmax];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < cmax; 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;
    }
}

// 二項係数計算
ll nCk(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logN)
ll modpow(ll n,ll m,ll MOD){
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}

//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/

//    cout << fixed << setprecision(15);
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N;
    cin >> N;
    vector<ll> ketawa(N + 1);
    rep(i,N + 1){
        ll res = 0,n = i;
        while(n){
            res += n % 10;
            n /= 10;
        }
        ketawa[i] = res;
    }
    ll ans = INF;
    for(ll i = 1;i < N;i++){
        ans = min(ketawa[i] + ketawa[N - i],ans);
    }
    cout << ans << endl;
}

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

#define rep(i,n) for(int i = 0; i < n; i++)
#define Rep(i,n) for(int i = 1; i <= n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
template<class T> using V = vector<T>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }



int main(){

    int n, x, t;
    cin >> n >> x >> t;
    int ans = ceil(n,x) * t;
    cout << ans << endl;
}

Measured memory_bytes: 3572
n = int(input())
if n == 3:
    print("2 5 63")
elif n == 4:
    print("2 5 20 63")
elif n == 5:
    print("3 4 6 8 9")
elif n == 6:
    print("2 3 4 8 9 10")
elif n == 7:
    print("2 3 4 6 8 9 10")
else:
    ans = []
    for i in range(n // 8):
        ans += [12 * i + 2, 12 * i + 3, 12 * i + 4, 12 * i + 6, 12 * i + 8, 12 * i + 9, 12 * i + 10, 12 * i + 12]
    if n % 8 == 1:
        ans += [ans[-1] + 6]
    elif n % 8 == 2:
        ans += [ans[-1] + 4, ans[-1] + 8]
    elif n % 8 == 3:
        ans += [ans[-1] + 4, ans[-1] + 6, ans[-1] + 8]
    elif n % 8 == 4:
        ans += [ans[-1] + 2, ans[-1] + 4, ans[-1] + 8, ans[-1] + 10]
    elif n % 8 == 5:
        ans += [ans[-1] + 3, ans[-1] + 4, ans[-1] + 6, ans[-1] + 8, ans[-1] + 9]
    elif n % 8 == 6:
        ans += [ans[-1] + 2, ans[-1] + 3, ans[-1] + 4, ans[-1] + 8, ans[-1] + 9, ans[-1] + 10]
    elif n % 8 == 7:
        ans += [ans[-1] + 2, ans[-1] + 3, ans[-1] + 4, ans[-1] + 6, ans[-1] + 8, ans[-1] + 9, ans[-1] + 10]

    print(" ".join(list(map(str, ans))))


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

int main(){

    int N;
    cin >> N;
    vector<long long> A(N), B(N), AB(N);
    for(int i = 0; i < N; i++) cin >> A[i] >> B[i];

    for(int i = 0; i < N; i++) AB[i] = A[i] + B[i];
    sort(AB.rbegin(), AB.rend());

    long long eatAB = 0, Bsum = 0;
    for(int i = 0; i < N; i++){
        if(i % 2 == 0) eatAB += AB[i];
        Bsum += B[i];
    }

    cout << eatAB - Bsum << endl;

    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,C;
  cin >> A >> B >> C;
  
  int M = max(max(A, B),C);
  int D = 3*M - (A+B+C);
  
  if (D%2 == 0){
    cout << D/2 << endl;
  }
  else {
    cout << (D+3)/2 << endl;
  }
}

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

using namespace std;
typedef long long ll;

double A,B,H,M;

double calc(){
    double m = 2.0*M_PI * M / 60.0;
    double h = 2.0*M_PI * H / 12.0 + 2*M_PI * M / 60.0 / 12.0;
    double d = abs(m-h);
    return min(d,2*M_PI-d);
}

int main(){
    cin >> A >> B >> H >> M;
    double t = calc();
    double rr = 2*A*B*cos(t) - A*A - B*B;
    cout << fixed << setprecision(15) << sqrt(abs(rr)) << endl;
    return 0;
}

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

#define vi vector<int>
#define vl vector<long>
#define vvi vector<vector<int>>
#define vvl vector<vector<long>>
#define pint pair<int, int>
#define plong pair<long, long>

int main() {
    int N, K;
    cin>>N>>K;
    vector<bool> Sn(N, false);
    REP(i, 0, K){
        int d;
        cin >> d;
        REP(j, 0, d){
            int A;
            cin >> A;
            A--;
            Sn[A] = true;
        }
    }
    int count = 0;
    REP(i, 0, N){
        if(Sn[i] == false) count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 3596
#include <stdio.h>
#include <string.h>
int main (){
	char a[3][35];
	int length [3];
	for (int i = 0;i<3;i++){
	scanf ("%s", a[i]);
	length[i]=strlen(a[i]);
	}
	if(a[0][length[0]-1]== a[1][0] &&a[1][length[1]-1]==a[2][0]){
		printf("YES");
	}else{
		printf("NO");
	}
	return 0;
}

Measured memory_bytes: 1716
//------------------------------------//
#include <bits/stdc++.h>
#define cube(x) (x*x*x)
#define sqr(x) (x*x)
#define pi acos(-1)
//-------------------------------------//
typedef unsigned long long ull;
typedef long long int lld;
typedef long double ld;
using namespace std;
//------------------------------------//
int f, i, j, k;

int main()
{
    int k, a, b, n=1, x;
    f=1;
    cin >>k >>a >>b;
    while(1)
    {
        x = k*n;
        if(x>=a && x<=b)
        {
            f=0;
            break;
        }
        else if(x>b)
        {
            f=2;
            break;
        }
        else
        {
            n++;
        }
    }
    if(f==0)
    {
        cout <<"OK" <<endl;
    }
    else if(f==2)
    {
        cout <<"NG" <<endl;
    }
    return 0;
}


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

typedef long long                   ll;
typedef long double                 ld;
typedef pair<ll,ll>                 pll;
typedef pair<ld,ld>                 pld;


#define all(x)          (x).begin(),(x).end()
#define Sort(x)         sort(all(x))
#define sep             ' '
#define endl            '\n'
#define tab             '\t'
#define X               first
#define Y               second
#define fast_io         ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io         freopen("in.txt" , "r" , stdin) ; freopen("out.txt" , "w" , stdout);
#define set_random      mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const ll MOD = 1e9 + 7,
         MAXN= 3e3+10,
         INF=1e18;
ll n;
ld p[MAXN],dp[MAXN][MAXN],ans;
int main()
{
    fast_io;
    cin>>n;
    for(ll i=1;i<=n;i++){
        cin>>p[i];
    }
    dp[0][0]=1;
    for(ll i=1;i<=n;i++){
        for(ll j=0;j<=n;j++){
            if(j==0){
                dp[i][0]=dp[i-1][0]*(1-p[i]);
                continue;
            }
            dp[i][j]=dp[i-1][j-1]*p[i]+dp[i-1][j]*(1-p[i]);

        }
    }
    for(ll i=(n+1)/2;i<=n;i++){
        ans+=dp[n][i];
        //cout<<dp[n][i];
    }
    cout<<setprecision(10)<<fixed<<ans<<endl;
    return 0;
}


Measured memory_bytes: 141568
#include <iostream>
#include <fstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <cstdio>
#include <stack>

using namespace std;

int main()
{
	int n;
	cin >> n;
	
	if (n % 2 == 0) cout << n << endl;
	else cout << 2 * n << endl;


	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<iomanip>
using lint=int64_t;
using namespace std;

int Cnt(lint *ar,int l,int r,lint val)
{
	int ret=0;
	for(int i=l;i<=r;i++)
		if(ar[i]==val)
			ret++;

	return ret;
}

lint com[55][55];

int main()
{
	com[0][0]=1;
	for(int i=0;i<55;i++)
	{
		for(int j=0;j<=i;j++)
		{
			if(j==0 || j==i)
				com[i][j]=1;
			else
				com[i][j]=com[i-1][j]+com[i-1][j-1];
		}
	}


	int N,A,B;
	lint v[55]={};

	cin >> N >> A >> B;
	for(int i=0;i<N;i++)
		cin >> v[i];
	
	sort(v,v+N,greater<lint>());

	double ave=0;
	for(int i=0;i<A;i++)
		ave+=(double)v[i]/A;

	lint ans=0;
	if(v[0]==v[A-1])
	{
		int cnt=Cnt(v,0,N-1,v[0]);
		for(int i=A;i<=min(B,cnt);i++)
			ans+=com[cnt][i];
	}
	else
	{
		int cnt=Cnt(v,0,N-1,v[A-1]);
		int acnt=Cnt(v,0,A-1,v[A-1]);
		ans=com[cnt][acnt];
	}

	cout << fixed << setprecision(10);
	cout << ave << endl;
	cout << ans << endl;
	return 0;
}


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

using namespace std;

void solve2() {
	int H, W;
	cin >> H >> W;
	for (int i = 0; i < H + 2; i++)
	{
		if (i == 0 || i == H + 1) {
			for (int j = 0; j < W+2; j++)
			{
				cout << "#";
			}
			cout << endl;
		} else {
			cout << "#";
			for (int j = 0; j < W; j++)
			{
				char x;
				cin >> x;
				cout << x;
			}
			cout << "#" << endl;
		}
		
	}

}


void solve1() {
	int x, y;
	cin >> x >> y;

	int A[] = { 1,3,5,7,8,10,12 };
	int B[] = { 4,6,9,11 };
	if (x == 2 || y == 2) {
		cout << "No" << endl;
		return;
	}
	bool _x = false, _y= false;
	for (int i = 0; i < 8; i++)
	{
		if (A[i] == x)
			_x = true;
		if (A[i] == y)
			_y = true;
	}
	if ((_x == true &&_y == true) || (_x == false && _y == false)) {
		cout << "Yes" << endl;
		return;
	}
	else {
		cout << "No" << endl;
		return;
	}

}

int main() {
	solve2();
	return 0;
}

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

using namespace std;

int main(){
    float N;
    float ans;
    cin >> N;
    int n = (int)N;
    if(n%2 == 0){
        ans = 0.5000000000;
    }else{
        ans = (n/2 + 1) / N;
    }

    cout << setprecision(7) << ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define pb push_back
#define MOD 1000000007
int a[100010];
int dp[100010];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n=0,k=0;
    cin>>n>>k;
    for(int i=0;i<n;++i)
        cin>>a[i];
    dp[0]=0;
    dp[1]=abs(a[1]-a[0]);
    for(int i=2;i<n;++i)
    {
        dp[i]=dp[i-1]+abs(a[i]-a[i-1]);
        for(int j=2;j<=k;++j)
        {
            if(i<j)
                break;
            dp[i]=min(dp[i],dp[i-j]+abs(a[i]-a[i-j]));
        }
    }
    cout<<dp[n-1]<<endl;
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
const int N  = 100010;
bool vis[N];
int in[N];
ll dp[N];

void tsort(int n,int now,int *in,vector<int> &a){
  if (vis[now])return;
  vis[now] = true;
  if (now-1 >= 0             && in[now] > in[now-1])tsort(n,now-1,in,a);
  if (now+1 != n && in[now] > in[now+1])tsort(n,now+1,in,a);
  a.push_back(now);
}

main(){
  int n;
  ll l;
  while(cin>>n>>l && n){
    for(int i=0;i<n;i++)cin>>in[i],vis[i]=false;
    vector<int> a;
    for(int i=0;i<n;i++)if (!vis[i])tsort(n,i,in,a);
    reverse(a.begin(),a.end());
    ll ans = 0;
    for(int i=0;i<n;i++){
      int now = a[i];
      ll t = 0;
      if (now != 0   && in[now-1] > in[now])t = max(t,dp[now-1]);
      if (now != n-1 && in[now+1] > in[now])t = max(t,dp[now+1]);
      dp[now] = t+l-in[now];
      ans = max(ans,dp[now]);
    }
    cout << ans << endl;
  }
}

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

using namespace std;

int main()
{
    long long int i , n , count=0 ;
    cin>>n;
    for(i=1;i<=n;++i)
    {
      if((i%3==0&&i%5==0)||(i%3==0)||(i%5==0))
      {

      }
      else
      {
          count+=i;
      }
      
    }
    cout<<count;
}

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

int n, m;
 
set<pair<int, int>> edges;
 
int main(){
    ios_base::sync_with_stdio(false);
    cin >> n >> m;
    int a, b;
    for (int i = 1; i <= m; i++){
        cin >> a >> b;
        edges.insert({a, b});
    }
    vector<int> v;
    for (int i = 1; i <= n; i++){
    	v.push_back(i);
    }
    int ans = 0;
    do{
    	int ok = true;
    	for (int i = 0; i < n - 1; i++){
    		int a = min(v[i], v[i + 1]);
    		int b = max(v[i], v[i + 1]);
    		if (edges.find({a,b}) == edges.end()){
    			ok = false; break;	
    		}
    	}
    	if (ok) ans++;
    }while(next_permutation(v.begin() + 1, v.end()));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <utility>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int INF=1<<29;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a,b;
	cin>>a>>b;
	if(a>=13){
		cout<<b<<endl;
	}else if(a<=12 && a>=6){
		cout<<b/2<<endl;
	}else{
		cout<<0<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
def main():

    N = int(input())
    A = list(map(int, input().split()))
    student = [0 for _ in range(N)]
    for i in range(N):
        student[A[i]-1] = i+1
    return " ".join(map(str, student))

if __name__ == '__main__':
    print(main())

Measured memory_bytes: 18376
#include<map>
#include<ctime>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

long long n,a,b;
long long now,nxt,ans;

int main()
{
	scanf("%lld%lld%lld",&n,&a,&b);
	scanf("%lld",&now);
	for(int i=2;i<=n;i++)
	{
		scanf("%lld",&nxt);
		ans+=min(a*(nxt-now),b);
        now=nxt;
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 384
#define KAKUSUKO
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <random>

#define _overload(a, b, c, d, ...) d
#define _rep1(X, A, Y) for (int (X) = (A);(X) <= (Y);++(X))
#define _rep2(X, Y) for (int (X) = 0;(X) < (Y);++(X))
#define rep(...) _overload(__VA_ARGS__, _rep1, _rep2)(__VA_ARGS__)
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define all(X) (X).begin(),(X).end()
#define len(X) ((int)(X).size())
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MAX_N = 2000;
ll N, K;

ll fact[MAX_N+1];
ll inv_fact[MAX_N+1];

//整数a,bに対し、ax + by = gcd(a,b) を満たす整数x,y,gcd(a,b) を計算する
ll extgcd(ll a, ll b, ll& x, ll& y) {
  ll d = a;
  if (b != 0) {
    d = extgcd(b, a%b, y, x);
    y -= (a/b) * x;
  } else {
    x = 1; y = 0;
  }
  return d;
}

//ax ≡ gcd(a,m) (mod m) を満たすxを計算する。
ll mod_inverse(ll a, ll m) {
  ll x, y;
  extgcd(a, m, x, y);
  return (m + x%m) % m;
}


void init(ll n, ll mod) {
  fact[0] = 1;
  for (int i = 1; i <= n; ++i) fact[i] = (fact[i-1]*i)%mod;

  for (int i = 0; i <= n; ++i) inv_fact[i] = mod_inverse(fact[i], mod);
}

ll mod_comb(ll n, ll r, ll mod) {
  return fact[n]*inv_fact[r]%mod*inv_fact[n-r]%mod;
}

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

  cin >> N >> K;
  init(N, MOD);

  for (ll i = 1; i <= K; ++i) {
    if (i-1 > N-K) {
      cout << 0 << endl;
    } else {
      cout << mod(mod_comb(K-1, i-1, MOD)*mod_comb(N-K+1, i, MOD), MOD) << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(R: int):
    if R < 1200:
        print("ABC")
    elif R < 2800:
        print("ARC")
    else:
        print("AGC")
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    R = int(next(tokens))  # type: int
    solve(R)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

m,n,k = map(int,readline().split())

def comb(n, r, mod):
    r = min(r, n-r)
    mol = 1
    deno = 1
    for i in range(1, r+1):
        mol = mol * (n-r+i) % mod
        deno = deno * i % mod
    ret = mol * pow(deno, mod-2, mod) % mod
    return ret

ans = m*n*(m+n)*(m*n-1)//3

ans = (ans * comb(m*n-2,k-2,mod))%mod
ans = ans*pow(2,mod-2,mod)%mod

print(ans)



Measured memory_bytes: 9476
import java.util.*;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a1 = sc.nextInt();
        int a2 = sc.nextInt();
        int a3 = sc.nextInt();

        if(a1 + a2 + a3 >= 22) System.out.println("bust");
        else System.out.println("win");
    }
}

Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
//#define int long long  
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    cout << a+b+c - max(a,(int)max(b,c)) << endl;
	return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(4100000)
import math




N = int(input())


import fractions
a = list(map(int, input().split()))
koubai = a[0]
small = []
for i in range(0, N//2):
    small.append(a[2*i + 1] * a[2*i] // fractions.gcd(a[2*i + 1], a[2*i]))

small.append(a[-1])
for i in range(len(small)):
    koubai = koubai * small[i] // fractions.gcd(koubai, small[i])


ans = int(0)
for i in range(N):
    ans += koubai // a[i]
    
ans %= 1000000007

print(ans)

Measured memory_bytes: 69592
//https://onlinejudge.u-aizu.ac.jp/problems/ALDS1_5_B
//p156.cpp

#include<iostream>
using namespace std;
#define MAX 500000
#define SENTINEL 2000000000
//上記のマクロだと、実行すると勝手に落ちる（メモリ不足？）
//#define MAX 5000
//#define SENTINEL 20000000


int L[MAX/2+2] , R[MAX/2+2];
int cnt;

void merge(int A[] , int n , int left , int mid , int right){
  int n1 = mid - left;
  int n2 = right - mid;
  for(int i = 0; i < n1 ; i++) L[i] = A[left + i];
  for(int i = 0; i < n2 ; i++) R[i] = A[mid + i];
  L[n1] = R[n2] = SENTINEL;
  int i = 0 , j = 0;
  for( int k = left; k < right ; k++ ){
    cnt++;
    if( L[i] <= R[j] ){
      A[k] = L[i++];
    }else{
      A[k] = R[j++];
    }
  }
}

void mergeSort(int A[] , int n, int left, int right){
  if( left+1 < right ){
    int mid = ( left + right ) / 2;
    mergeSort(A,n,left,mid);
    mergeSort(A,n,mid,right);
    merge(A,n,left,mid,right);
  }
}

int main(){
  int A[MAX],n,i;
  cnt = 0;

  cin >> n;
  for( i = 0 ; i < n ; i++ ) cin >> A[i];

  mergeSort(A,n,0,n);

  for( i = 0 ; i < n ; i++ ){
    if( i ) cout << " ";
    cout << A[i];
  }
  cout << endl;

  cout << cnt << endl;

  return 0;
}




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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long x, y, z, k;
  cin >> x >> y >> z >> k;
  long long ans = min(k, x);
  k -= ans;
  if (k == 0) {
    cout << ans << '\n';
    return 0;
  }
  long long foo = min(k, y);
  k -= foo;
  if (k == 0) {
    cout << ans << '\n';
    return 0;
  }
  foo = min(z, k);
  ans -= foo;
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3660
#include <iostream>
#include <list>
#include <set>
#include <string>

using namespace std;

void solve()
{
	int n;
	cin >> n;
	while(n--)
	{
		list<char> List;
		set<char> Set;
		string str;
		cin >> str;
		List.push_back(str[0]);
		Set.insert(str[0]);
		for(int i = 2; i < str.size(); ++i)
		{
			if('a' <= str[i] && str[i] <= 'z')
			{
				if(!Set.count(str[i]))
				{
					if(str[i - 1] == '>')
					{
						List.push_back(str[i]);
					}
					else
					{
						List.push_front(str[i]);
					}
					Set.insert(str[i]);
				}
			}
		}
		for(list<char>::iterator Ite = List.begin(); Ite != List.end(); ++Ite)
		{
			cout << *Ite;
		}
		cout << endl;
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 0
import java.util.*;
import java.io.PrintWriter;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int mirs=0;
		int[] irs=new int[200001];
		for(int i=0; i<n; i++){
			int p=sc.nextInt();
			irs[p]=irs[p-1]+1;
			mirs=Math.max(mirs,irs[p]);
		}
		System.out.println(n-mirs);
	}
}


Measured memory_bytes: 85040
import sys
input = sys.stdin.buffer.readline
def main():
    n, m = map(int, input().split())
    p = list(map(int, input().split()))
    parent = list(range(n+1))
    rank = [0]*(n+1)
    cnt = 0
    
    def root(x):
        if parent[x] == x:
            return x
        parent[x] = root(parent[x])
        return parent[x]
    
    def unite(x, y):
        x = root(x)
        y = root(y)
        if x != y:
            if rank[x] < rank[y]:
                parent[x] = y
            elif rank[x] > rank[y]:
                parent[y] = x
            else:
                parent[y] = x
                rank[x] += 1

    for _ in range(m):
        x, y = map(int, input().split())
        x = root(x)
        y = root(y)
        if x != y:
            parent[y] = x
    for i, pi in enumerate(p, 1):
        if root(i) == root(pi):
            cnt += 1
    print(cnt)

if __name__ == "__main__":
    main()


Measured memory_bytes: 12392
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC127A
{
    class Program
    {
        static void Main(string[] args)
        {
            int A, B, C;
            var word = Console.ReadLine().Split(' ');

            A = int.Parse(word[0]);
            B = int.Parse(word[1]);

            C = B / 2;

            if (A >= 13)
                Console.WriteLine(B);
            else if (A >= 6 && A <= 12)
                Console.WriteLine(C);
            else
                Console.WriteLine(0);
            Console.ReadKey();

        }
    }
}


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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};


void solve(long long A, long long B, long long C, long long K){
    LL ans =0;
    ans += min(A, K);
    K = max(0LL, K - A);
    K = max(0LL, K - B);
    ans -= min(C, K);

    cout << ans << endl;
}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    long long K;
    scanf("%lld",&K);
    solve(A, B, C, K);
    return 0;
}


Measured memory_bytes: 3764
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;

public class Main {
	
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        
        long[] map = new long[N];
		for (int i = 0; i < N; i++) {
			map[i] = sc.nextLong();
		}
		
		long[] sum = new long[N+1];
		for (int i = 1; i <= N; i++) {
			sum[i] = map[i-1] + sum[i-1];
		}
		
		Map<Long, Integer> table = new HashMap<>();
		for (long total : sum) {
			if (table.containsKey(total)) {
				table.put(total, table.get(total)+1);
			} else {
				table.put(total, 1);
			}
		}
		
		long ans = 0;
		for (long key: table.keySet()) {
			if (table.get(key) > 1) {
				long num = table.get(key);
				ans += (num * (num-1) / 2);
			}
		}
        
        System.out.println(ans);
    }
}




Measured memory_bytes: 92096
#include<bits/stdc++.h>
using namespace std;
int read() {
	int x; scanf("%d", &x); return x;	
}
const int maxn = 2e5 + 10;
const int INF = 1e9;
int n, m, K;
char a[100][100], b[100][100];
char s[100];
void paintI(int x) {
	for (int j = 1; j <= m; ++j) {
		b[x][j] = '.';	
	}
}
void paintJ(int x) {
	for (int j = 1; j <= n; ++j) {
		b[j][x] = '.';	
	}
}
int main() {
	#ifdef LOCAL
		freopen("1.in", "r", stdin);
	#endif
	n = read(), m = read(), K = read();
	for (int i = 1; i <= n; ++i) {
		scanf("%s", a[i] + 1);
	}
	int ans = 0;
	for (int i = 0; i < (1 << n); ++i) {
		for (int j = 0; j < (1 << m); ++j) {
			for (int k = 0; k <= n; ++k) for (int p = 0; p <= m; ++p) b[k][p] = a[k][p];
			
			for (int k = 1; k <= n; ++k) if (i & (1 << k - 1)) paintI(k);
			for (int k = 1; k <= m; ++k) if (j & (1 << k - 1)) paintJ(k);
			
			//	cout<< i<<' ' <<j <<endl;
			//	for (int k = 1; k <= n; ++k) {for (int j = 1; j <= m; ++j) cout << b[k][j] << ' ';cout<<endl;}
			//	cout<<endl;
				
			int T = 0;
			for (int k = 1; k <= n; ++k) for (int j = 1; j <= m; ++j) T += b[k][j] == '#';
			if (T == K) ans++;
			
		}
	}
	cout << ans << endl;
	return 0;		
}

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

#if DEBUG && !ONLINE_JUDGE
  #include "header.h"
#else
  #define debug(args...)
#endif

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long lli;
typedef long double ld;

#define pb push_back
#define all(x) x.begin(),x.end()
#define SZ(x) (int)(x).size()
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b) for(auto i=(a);i<b;i++)

#define INF (int)1e9
#define EPS 1e-9
#define MOD 1000000007
void preprocess(void) {
  return;
}

vector<vi> adj;
vector<lli> up, ans;
lli sum = 0;
void dfs(int v, int par = -1) {
  sum += up[v];
  ans[v] = sum;
  for(auto x: adj[v]) {
    if(x == par) continue;
    dfs(x, v);
  }
  sum -= up[v];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(20);
  //freopen("input.txt","r",stdin);
  //freopen("output.txt","w",stdout);
  preprocess();
  int n, q; cin>>n>>q;
  adj.resize(n+1, vi(0));
  up.resize(n+1);
  ans.resize(n+1);
  rep(i,0,n-1) {
    int x, y; cin>>x>>y;
    adj[x].pb(y);
    adj[y].pb(x);
  }
  rep(i,0,q) {
    int x, y; cin>>x>>y;
    up[x] += y;
  }
  dfs(1, -1);
  rep(i,1,n+1) cout<<ans[i]<<" ";
  cout<<endl;

}



Measured memory_bytes: 25856
#include <stdio.h>
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>

using namespace std;

int main()
{

	int a,b = 0;

	std::cin >> a >> b;
    
    int i = b - a;
    int hight = 0;

    for(int j = 1; j < i + 1 ; j++){
        hight += j;
    }

    std::cout << hight - b << std::endl;

	return 0;

}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ALL(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v) {
  for (T& x: v) s >> x;
  return s;
}
inline void Yes(bool f=true){cout<<(f?"Yes":"No")<<endl;}
inline void YES(bool f=true){cout<<(f?"YES":"NO")<<endl;}
#define ANS(a) cout<<a<<endl

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

    string s; cin >>s;
    string ans;
    if (s[0]==s[1] || s[1]==s[2] || s[2]==s[3])
        ans = "Bad";
    else
        ans="Good";
    cout << ans << endl;
}


Measured memory_bytes: 256
import sys
#import numpy as np
#from collections import defaultdict
import math
#from collections import deque

input = sys.stdin.readline
#import numpy as n



def main():

    N = int(input())
    ans =0
    for i in range(1,N+1):
        num =  int(N/i)
        ans += int(num*(num+1)/2 *i)

    print(ans)





if __name__ == "__main__":
    main()

Measured memory_bytes: 64488
n, W = map(int, input().split())
dp = [[[0] * 301 for _ in range(n + 1)] for _ in range(n + 1)]
li = [list(map(int, input().split())) for _ in range(n)]
p = li[0][0]
for i, x in enumerate(li):
    w, v = x
    w -= p
    for j in range(i + 1):
        for k in range(301):
            if k >= w:
                if dp[i][j][k - w] + v > dp[i][j + 1][k]:
                    dp[i + 1][j + 1][k] = dp[i][j][k - w] + v
                else:
                    dp[i + 1][j + 1][k] = dp[i][j + 1][k]
            else:
                dp[i + 1][j + 1][k] = dp[i][j + 1][k]
ans = 0
for i in range(n + 1):
    for k in range(301):
        if i * p + k <= W:
            ans = max(dp[n][i][k], ans)
print(ans)


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

int main() {

int n,k;
cin >> n >> k;
vector<int> p(n);
rep(i,n)cin>>p[i];
sort(p.begin(),p.end());

ll ans = 0;
rep(i,k)ans += p[i];
cout << ans << endl;



}
/*vector <int> a(3);
for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }*/

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

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

    


Measured memory_bytes: 3116
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
 
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
 
using namespace std;
 
using ll = long long;
using ld = long double;
 
template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }
 
template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }
 
template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}
 
struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "Yes"; }
  string_type do_falsename() const { return "No"; }
};
 
void solve(ll N, ll Z, ll W, vector<ll> a) {
  ll res = abs(a.back() - W);
  if (N > 1) chmax(res, abs(a[N - 2] - a[N - 1]));
  cout << res << endl;
}
 
int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	ll N;
	ll Z;
	ll W;
	scanf("%lld", &N);
	vector<ll> a(N-1+1);
	scanf("%lld", &Z);
	scanf("%lld", &W);
	for (int i = 0 ; i <= N-1 ; i++) {
	  scanf("%lld", &a[i]);
	}
	solve(N, Z, W, a);
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<stdlib.h>
#include<iostream>
using namespace std;
char s[100010];
int a[26];
int main(void)
{
	int i,j,k,n,m;
	scanf("%s",s);
	memset(a,0,sizeof(a));
	for(i=0;i<strlen(s);i++)
	{
		a[s[i]-'a']++;
	}
	k=0;
	for(i=0;i<26;i++)
	{
		if(a[i]==0)
		{
			printf("%c",i+'a');
			k=1;
			break;
		}
	}
	if(k==0)
	printf("None\n");
	return 0;
}

Measured memory_bytes: 384
/*
 * atcoder/nomura2020/a.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

int h1, m1, h2, m2, k;
void solve() {
  cin >> h1 >> m1 >> h2 >> m2 >> k;

  int t = (m1 > m2) ? (h2 - h1 - 1) * 60 : (h2 - h1) * 60;
  t += m1 > m2 ? 60 - m1 + m2 : m2 - m1;

  cout << max(0, t - k) << endl;
}
int main() {
  // cout.precision(15); cout << fixed;

  solve();

  return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    double arr[n+1];

    for (int i=1 ; i<=n ; i++){
        cin >> arr[i];
    }

    double dp[n+1][n+1];

    for (int i=1 ; i<=n ; i++){
        for (int j=0 ; j<=n ; j++){
            if (i==1 && j==0){
                dp[i][j] = (1-arr[i]);
            }
            else if (i==1 && j==1){
                dp[i][j] = arr[i];
            }
            else if (i<j){
                dp[i][j] = 0;
            }
            else if (j==0){
                dp[i][j] = (1-arr[i])*dp[i-1][j];
            }
            else{
                dp[i][j] = dp[i-1][j-1]*arr[i] + dp[i-1][j]*(1-arr[i]);
            }
        }
        //cout << "\n";
    }
    double ans = 0;

    for (int i=(n/2)+1 ; i<=n ; i++){
        ans += dp[n][i];
    }
    printf("%.10f\n",ans);
    return 0;
}

Measured memory_bytes: 70528
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<map>

using namespace std;

int a,b;

int main(){

    cin >> a >> b;
    if(a > b){
        for(int i=0;i<a;i++){
            cout << b ;
        }
        cout << endl;
        return 0;
    }
    else{
        for(int i=0;i<b;i++){
            cout << a;
        }
        cout << endl;
        return 0;
    }

    return 0;
}

Measured memory_bytes: 888
import java.util.Arrays;
import java.util.Scanner;

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

    int N = scanner.nextInt();
    int[] a = new int[N];
    int[] b = new int[N];

    for (int i = 0; i < N; i++) a[i] = scanner.nextInt();
    for (int i = 0; i < N; i++) b[i] = scanner.nextInt();

    int res = 0;

    for (int k = 0; k < 30; k++) {
      int m = 1 << (k + 1);

      int[] br = new int[N];
      for (int i = 0; i < N; i++) br[i] = b[i] % m;
      Arrays.sort(br);

      int[] br2 = new int[N * 2];
      System.arraycopy(br, 0, br2, 0, N);
      for (int i = 0; i < N; i++) br2[i + N] = br[i] + m;

      int t = 1 << k;
      long count = 0;
      for (int i = 0; i < N; i++) {
        int ar = a[i] % m;
        int left = find(br2, t * 3 - ar);
        int right = find(br2, t * 4 - ar);
        count += right - left;
      }
      if (count % 2 == 1) res += 1 << k;
    }

    System.out.println(res);
  }

  private static int find(int[] b, int t) {
    int left = -1;
    int right = b.length;
    while (right - left > 1) {
      int mid = (left + right) / 2;
      if (b[mid] < t) {
        left = mid;
      } else {
        right = mid;
      }
    }
    return left;
  }
}


Measured memory_bytes: 153144
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <utility>
#include <random>
#include <chrono>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>

using namespace std;

using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
using PIL = pair<int, LL>;
using PLL = pair<LL, LL>;
// const int mod = 1e9 + 7;
// const int mod = 998244353;

inline void quickread() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}
// Si is AC, WA, TLE, or RE.
inline void work() {
    map<string, int> mp = { {"AC", 0}, {"WA", 0}, {"TLE", 0}, {"RE", 0} };
    string s;
    int N;
    cin >> N;
    for (int i = 0; i < N; ++i) {
        cin >> s;
        mp[s]++;
    }
    cout << "AC x " + to_string(mp["AC"]) << endl;
    cout << "WA x " + to_string(mp["WA"]) << endl;
    cout << "TLE x " + to_string(mp["TLE"]) << endl;
    cout << "RE x " + to_string(mp["RE"]) << endl;
}

int main() {
    // freopen(".txt", "r", stdin);
    quickread();
    work();
    return 0;
}

Measured memory_bytes: 3628