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

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

int a, b;
string s, t, u;

int main() {

    cin >> s >> t;
    cin >> a >> b;
    cin >> u;

    if (u == s) cout << a - 1 << ' ' << b << endl;
    else cout << a << ' ' << b - 1 << endl;

    return 0;
}

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

int main()
{
    int n, m;
    cin >> n >> m;
    map<int, int> mp;
    rep(i, 0, n){
        int k;
        cin >> k;
        vector<int> a(k);
        rep(j, 0, k){
            cin >> a[j];
            mp[a[j]]++;
        }
    }
    int ans = 0;
    for(auto i : mp){
        if(i.second == n) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3636
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).ok();
    let v: Vec<usize> = buf.split_whitespace().map(|x| x.parse().unwrap()).collect();
    if (v[2] - v[1]) % 2 == 0 {
        println!("Alice");
    } else {
        println!("Borys");
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const ll INF = LLONG_MAX;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

//comb(fac, ifac, n, k, MOD)でnCk
ll comb(ll fac[], ll ifac[], int n, int k, ll m){
    ll c = fac[n];
    c *= ifac[n-k], c %= m;
    c *= ifac[k], c %= m;
    return c;
}

int main(){
    int N, M;
    cin >> N >> M;
    ll A[N], B[M];
    rep(i, N) cin >> A[i];
    rep(i, M) cin >> B[i];
    sort(A, A+N);
    sort(B, B+M);
    rep(i, N-1){
        if(A[i] == A[i+1]){
            cout << 0 << endl;
            exit(0);
        }
    }
    rep(i, M-1){
        if(B[i] == B[i+1]){
            cout << 0 << endl;
            exit(0);
        }
    }
    rep(i, N){
        if(A[i] < (i+1)*M){
            cout << 0 << endl;
            exit(0);
        }
    }
    rep(i, M){
        if(B[i] < (i+1)*N){
            cout << 0 << endl;
            exit(0);
        }
    }
    //1〜nまでのmod(m)における逆元
    ll n = N*M, m = MOD, inv[n+1];
    rep2(i, 1, n){
        inv[i] = 1;
        ll e[31];
        e[0] = i;
        rep2(j, 1, 30) e[j] = (e[j-1]*e[j-1]) % m;
        ll k = m-2;
        int cnt = 0;
        while(k > 0){
            if(k % 2 == 1) inv[i] *= e[cnt], inv[i] %= m;
            k /= 2;
            cnt++;
        }
    }
    //i!とi!の逆元
    ll fac[n+1], ifac[n+1];
    fac[0] = 1, ifac[0] = 1;
    rep2(i, 1, n){
        fac[i] = (fac[i-1]*i) % m;
        ifac[i] = (ifac[i-1]*inv[i]) % m;
    }
    ll sum = 0, ans = 1;
    int h = 0, w = 0;
    while(h < N-1 || w < M-1){
        if(h < N-1 && A[h] < B[w]){
            int a = A[h]-sum-1, b = M-w-1;
            if(a < b){
                cout << 0 << endl;
                exit(0);
            }
            ans *= M-w, ans %= MOD;
            ans *= fac[a], ans %= MOD;
            ans *= ifac[a-b], ans %= MOD;
            sum += M-w;
            h++;
        }
        elif(A[h] == B[w]){
            int a = A[h]-sum-1, b = M-w-1+N-h-1;
            if(a < b){
                cout << 0 << endl;
                exit(0);
            }
            ans *= fac[a], ans %= MOD;
            ans *= ifac[a-b], ans %= MOD;
            sum += M-w+N-h-1;
            h++, w++;
        }
        else{
            int a = B[w]-sum-1, b = N-h-1;
            if(a < b){
                cout << 0 << endl;
                exit(0);
            }
            ans *= N-h, ans %= MOD;
            ans *= fac[a], ans %= MOD;
            ans *= ifac[a-b], ans %= MOD;
            sum += N-h;
            w++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 23680
/*
                    author         : TAPAN SAVANI
                    codeforces     : savanitapan2001
                    codechef       : savanitapan17
*/

/*
------------------------------------------------------------------------

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

------------------------------------------------------------------------
*/

#include <bits/stdc++.h>
using namespace std;

#define HAPPY_CODING                                                           \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(NULL);                                                               \
  cout.tie(NULL);
#define pb push_back
#define mp make_pair
#define Debug(x) cout << #x " = " << (x) << endl
#define SORT(a) sort(a.begin(), a.end())
#define SORTR(a) sort(a.rbegin(), a.rend())
#define mod 1000000007
#define pi 3.141592653589793238
#define ll long long int
#define ull unsigned long long
#define be begin()
#define en end()
#define FOR(i, a, b) for (long long int i = a; i < b; i++)
#define FORI(i, a, b) for (int i = a; i >= b; i--)

typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
typedef pair<ll, ll> PL;
typedef vector<PI> VPI;

int main() {
  HAPPY_CODING;

  long long int h, w;
  cin >> h >> w;

  char s[h][w];
  FOR(i,0,h){
	FOR(j,0,w)
    	cin >> s[i][j];
  }

  long long int dp[h][w], i=0;
  memset(dp, 0, sizeof(dp));

  while(s[0][i]!='#' && i<w)
  {
    	dp[0][i] = 1;
    	i++;
  }

  i=0;
  while(s[i][0] != '#' && i<h)
  {
	  	dp[i][0] = 1;
    	i++;
  }

  FOR(i,1,h)
  {
	  FOR(j,1,w)
	  {
			if(s[i][j] != '#')
			{
				if(s[i-1][j] == '#')
				{
					dp[i][j] = dp[i][j-1];
				}
				else if(s[i][j-1] == '#')
				{
					dp[i][j] = dp[i-1][j];
				}
				else 
				{
					dp[i][j] = (dp[i-1][j] + dp[i][j-1])%mod;
				}
			}
			// cout << dp[i][j] << " ";
	  }
	//   cout << "\n";
  }

	cout << (dp[h-1][w-1])%mod << "\n";

  return 0;
}


Measured memory_bytes: 12360
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>
#include <list>

using namespace std;

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

#define _upgrade ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

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

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

const ll MOD = 1e9 + 7;
const ll INF = 1e9;
const long double PI = 3.14159265358979323846;







// ****************************************CODE***************************************//
//





const ll MAX = 4005;

ll fac[MAX], finv[MAX], inv[MAX];

//テーブル前処理
//通常階乗、逆元階乗を作成
void COMinit(){
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for(int i = 2; i < MAX; i++){
                fac[i] = fac[i-1] * i % MOD;
                inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
                finv[i] = finv[i-1] * inv[i] % MOD;
        }
}

//二項係数計算
ll COM(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;
}

ll f2(int n, int k){
        return COM(n+k-1,k-1);
}
ll f(int n, int k){
        if(n < k) return 0;
        if(n == 0 && k == 0) return 1;
        if(k < 1) return 0;
        return f2(n-k,k);
}


int main(){
        COMinit();
        ll n, k;
        cin >> n >> k;
        for(int i = 1; i <= k; i++){
                ll blue = f(k,i);
                //ll red = f2(n-k-(i-1),i+1);
                ll red = 0;
                {
                        red += f(n-k,i-1);
                        red %= MOD;
                        red += f(n-k,i);
                        red %= MOD;
                        red += f(n-k,i);
                        red %= MOD;
                        red += f(n-k,i+1);
                        red %= MOD;
                }
                ll ans = blue * red % MOD;
                cout << ans << endl;
        }
        return 0;
}










Measured memory_bytes: 384
#include <algorithm>
#include <iomanip>
#include <iostream>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  string s, t;
  cin >> s >> t;
  sort(s.begin(), s.end());
  sort(t.rbegin(), t.rend());
  if (s < t)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


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

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

struct segtree{
    static const int SEG=1<<14;
    vint dat,put;

    segtree():dat(SEG*2),put(SEG*2){}
    inline void push(int k){
        if(put[k]==0)return;
        dat[k]+=put[k];
        if(k<SEG-1){
            put[k*2+1]+=put[k];
            put[k*2+2]+=put[k];
        }
        put[k]=0;
    }

    void add(int a,int b,int x,int k=0,int l=0,int r=SEG){
        push(k);
        if(r<=a||b<=l)return;
        if(a<=l&&r<=b){
            put[k]+=x;
            push(k);
            return;
        }
        add(a,b,x,k*2+1,l,(l+r)/2);
        add(a,b,x,k*2+2,(l+r)/2,r);
        dat[k]=max(dat[k*2+1],dat[k*2+2]);
    }
    int query(int a,int b,int k=0,int l=0,int r=SEG){
        push(k);
        if(r<=a||b<=l)return -1001001001001001001ll;
        if(a<=l&&r<=b)return dat[k];
        return max(query(a,b,k*2+1,l,(l+r)/2),query(a,b,k*2+2,(l+r)/2,r));
    }
};

const int INF=1001001001001001001ll;
int N,M;
int A[11111];
int B[200][11111];
signed main(){
    cin>>N>>M;
    for(int i=0;i<N-1;i++){
        cin>>A[i+1];
        A[i+1]+=A[i];
    }

    rep(i,N)rep(j,M)cin>>B[j][i];
    rep(i,M)B[i][N]=INF;
    vector<stack<int>>latte(M);
    rep(i,M)latte[i].push(N);
    segtree seg;
    int ans=0;
    for(int i=N-1;i>=0;i--){
        for(int j=0;j<M;j++){
            while(B[j][latte[j].top()]<=B[j][i]){
                int tmp=latte[j].top();
                latte[j].pop();
                seg.add(tmp,latte[j].top(),-B[j][tmp]);
            }
            seg.add(i,latte[j].top(),B[j][i]);
            latte[j].push(i);
        }
        seg.add(i,i+1,-A[i]);
        chmax(ans,seg.query(i,N)+A[i]);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  int r,g,b,n;
  cin >> r >> g >> b >> n;
  int cnt = 0;
  for(int i=0;i*r<=n;i++){
    for(int j=0;i*r+j*g<=n;j++){
      if((n-(i*r+j*g))%b == 0) cnt++;
    }
  }
  cout << cnt << endl;
}

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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 10000000000
#define MOD 1000000007
using ll = long long;
using Graph = vector<vector<int>>;

int main(){
    int N; cin>>N;
    vector<pair<int,int>> res;
    int B = N;
    if(N%2) B--;

    rep1(i,N){
        rep1(j,N){
            if(j<=i||j==B)continue;
            res.push_back({i,j});
        }
        B--;
    }
    cout<<res.size()<<endl;
    for(auto p: res)cout<<p.first<<" "<<p.second<<endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
int main()
{
int n,t,k;
cin>>n>>k>>t;
if(n%k==0)
{
    cout<<(n/k)*t;
}
else
cout<<((n/k)+1)*t;
return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int N,K;
    cin >> N >> K;
    vector<int> v(N);
    int count = 0;
    for(int i = 0;i < N;i++)
    {
        cin >> v[i];
        if(v[i] >= K)
        {
            count++;
        }
    }
    cout << count;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    ll t=1,i,j,k=0,q,p,x,y,n,a,b,d;
    //cin>>t;
    while(t--)
    {
       string s;
       cin>>s;
       cout<<s;
       if(s[s.length()-1]!='s')
        cout<<"s"<<endl;
       else
        cout<<"es"<<endl;
    }

    return 0;
}


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


int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
//    return *(long long*)a - *(long long*)b;
}
//  qsort(A, b, sizeof(int), compare_int);

int compare_string(const void *a, const void *b) {
  return strcmp(*(const char **)a, *(const char **)b);
}
//  qsort(names, 3, sizeof *names, compare_string);

//long long  factorial(long long n) {
//    if (n > 0) {
//        return n * factorial(n - 1);
//    } else {
//        return 1;
//    }
//}
long long  factorial(long long n, long long depth) {
    if (n > 1) {
        depth++;
        return factorial(n / 2, depth);
    } else {
        return depth;
    }
}

int min(int a, int b) {
    if (a > b)
        return b;
    else
        return a;
}

int distance(int a, int b) {
  return abs(a-b)*abs(a-b);
}



//int ()
/*
int triangle(int a, int b, int c){
  if(a<b+c){
    if(b<c+a){
      if(c<a+b){
        printf("1\n");
        return 1;
      }
    }
  }
  printf("1\n");
  return 0;
}
*/

int main()
{
//  int  a, b, c, d, e, X, Y ,r;
  unsigned long long a, b, c, d, e, X, Y;
  //  double  c;
// long long  A[200003]={};
  int  A[200003]={};
  int  B[100003]={};
//  int  C[100003][100001]={};
  int  C[100003]={};

  int  flg=0;

//  char s[101][101]={};
  char s[10000001]={};
  char t[100001]={};
//  int N, M;
//  int A[1000000001]={};
//  long long  C[101]={};
  int i,j,k;
  long long p=0,q=0;
  int sosuu[46] ={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199};
  int min =100000001;
  int len=0;
  int l=0;
  int cnt=0;
  int num=0;
  int num1=0;
  int num2=0;
  long long  ans=0;
  int ans_ac=0;
  int ans_wa=0;
  int max=0;
  long long sum=0;
  int addr=0;
  int ptn=0;
  int  tmp=0;
  double per=0; 
//  bool on_off[100]={};
  
//  char alp[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
  b=100;
  //  a=0;
  scanf("%lld%lld%lld%lld", &a, &b, &c, &d);
  if(d<=a)  printf("%lld\n", d);
  else if(d<=a+b)  printf("%lld\n", a);
  else if(d<a+b+c)  printf("%lld\n", a-(d-a-b));
  else   printf("%lld\n", a-c);
  
return 0;
}


Measured memory_bytes: 1732
import sys
rl = sys.stdin.readline

rows = 3
cols = 3
a11,a12,a13 = [int(x) for x in rl().split(' ')]
a21,a22,a23 = [int(x) for x in rl().split(' ')]
a31,a32,a33 = [int(x) for x in rl().split(' ')]

n = int(rl())
b = []

for i in range(n):
    b.append(int(rl()))

#####################

card = [a11,a12,a13,a21,a22,a23,a31,a32,a33]

for num in b:
    for i in range(len(card)):
        if card[i] == num:
            card[i] = 0


def check(card):
    for y in range(rows):
        if all([card[y*rows+x] == 0 for x in range(cols)]):
            return True

    # col
    for x in range(cols):
        if all([card[y*rows+x] == 0 for y in range(rows)]):
            return True

    # diagonal
    if all([card[xy*rows+xy] == 0 for xy in range(rows)]):
            return True

    if all([card[xy*rows+cols-1-xy] == 0 for xy in range(rows)]):
            return True

    return False


if check(card):
    print("Yes")
else:
    print("No")


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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

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

//main code

int main(int argc, char const* argv[])
{
    int n;
    cin >> n;
    VI num(100002,0);
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        num[a]++;
    }

    int sum_max = 0;
    for (int i = 1; i < 100001; i++) {
        int tmp = num[i-1] + num[i] + num[i+1];
        if (sum_max < tmp) {
            sum_max = tmp;
        }
    }
    cout << sum_max << endl;
    return 0;
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)n; ++i)
#define RREP(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define FOR(i, s, n) for (int i = s; i < (int)n; ++i)
#define RFOR(i, s, n) for (int i = (int)n - 1; i >= s; --i)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
template<class T>inline void out(T t){cout << t << "\n";}
template<class T,class... Ts>inline void out(T t,Ts... ts){cout << t << " ";out(ts...);}
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;}
constexpr int INF = 1e18;



signed main(){
	vector<int>a(5);
	REP(i,5)cin>>a[i];
	REP(i,5){
		if(a[i] == 0){
			out(i + 1);
			return 0;
		}
	}
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#include <iostream>
#include <string.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<ld> vd;
typedef vector<char> vc;
#define mp make_pair
#define pb push_back
#define read(array,n) for(ll i=0;i<n;i++) cin>>array[i];
#define f(i,n) for(i=0;i<n;i++)
#define F(i,n) for(i=1;i<=n;i++)
#define inf 1000000007;
// function to transform string to lowercase --> transform(s.begin(),s.end(),s.begin(),::tolower)
//(a + b ) % m = (a % m + b % m ) %m
//(a - b ) % m = ( ((//(//(a - b ) % m = ( (a % m - b % m ) + m ) %m
// a % m - b % m ) + m ) %m
//(a * b ) % m = (a % m * b % m ) %m
//(a / b ) % m = (a % m * inv(b) ) %m where inv(b) = pow(b,m,m-2)

ll power(ll i,ll j){
	ll prod=1;
	while(j>0){
		if(j&1){
			prod=prod*i;
		}
		j=j>>1;
		i=i*i;
	}
	return prod;
}
void solve(){
	ll i,j,n,k,m;
	cin>>n;
	if(n<600){
		cout<<"8\n";
	}
	else if(n<800){
		cout<<"7\n";
	}
	else if(n<1000){
		cout<<"6\n";
	}
	else if(n<1200){
		cout<<"5\n";
	}
	else if(n<1400){
		cout<<"4\n";
	}
	else if(n<1600){
		cout<<"3\n";
	}
	else if(n<1800){
		cout<<"2\n";
	}
	else if(n<2000){
		cout<<"1\n";
	}
}
int main(){
	// freopen("input.txt","r",stdin);
	solve();
	// ll t;
	// cin>>t;
	// while(t--){
	// 	solve();
	// }
}


Measured memory_bytes: 3672
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using ll = long long; 
using ld = long double;
#define endl "\n"
//#define int long long
#define all(V) V.begin(),V.end()
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
const int MOD = 1e9 + 7;
const ll INF = 1LL << 60;
const int inf = 1 << 25;
constexpr long double pi = 3.141592653589793238462643383279;
int dx[] = { 1,0,-1,0 };
int dy[] = { 0,1,0,-1 };
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;
}
ll fact_mod(ll n, ll mod) {
    ll f = 1; for (int i = 2; i <= n; i++) f = f * (i % mod) % mod;
    return f;
}
ll gcd(ll a, ll b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
    return a * b / gcd(a, b);
}
ll keta(ll n) {
    if (n == 0) return 1;
    ll count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {
    ll sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
ll mch(ll n) {
    if (n == 1) return 1;
    else return n * mch(n - 1);
}
ll pow_mod(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = (res * x) % mod; //ビット演算(最下位ビットが1のとき)
        x = (x * x) % mod;
        n >>= 1; //右シフト(n = n >> 1)
    }
    return res;
}
ll inv_mod(ll a, ll mod) { //逆元
    ll b = mod, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= mod;
    if (u < 0) u += mod;
    return u;
}
bool is_prime(const unsigned n) {
    switch (n) {
    case 0: // fall-through
    case 1: return false;
    case 2: // fall-through
    case 3: return true;
    } // n > 3 が保証された
    if (n % 2 == 0 || n % 3 == 0) return false;
    for (unsigned i = 5; i * i <= n; i += 6) {
        if (n % i == 0) return false; // (6の倍数)-1
        if (n % (i + 2) == 0) return false; // (6の倍数)+1
    }
    return true;
}

//宣言とか

/*signed*/int main(void) {
    ll a;
    cin >> a;
    rep(i, a) {
        cout << "ACL";
    }
    cout << endl;
    return 0;
}

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

#define For(i, l, r) for(register int i = (l), i##end = (int)(r); i <= i##end; ++i)
#define Fordown(i, r, l) for(register int i = (r), i##end = (int)(l); i >= i##end; --i)
#define Set(a, v) memset(a, v, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define debug(x) cout << #x << ": " << (x) << endl
#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#define pb push_back

using namespace std;

template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, T b) { return b > a ? a = b, 1 : 0; }

inline int read() {
    int x(0), sgn(1); char ch(getchar());
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') sgn = -1;
    for (; isdigit(ch); ch = getchar()) x = (x * 10) + (ch ^ 48);
    return x * sgn;
}

void File() {
#ifdef zjp_shadow
	freopen ("E.in", "r", stdin);
	freopen ("E.out", "w", stdout);
#endif
}

const int N = 1e5 + 1e3, inf = 0x3f3f3f3f;

vector<int> G[N];

int root, n, l[N], r[N], val[N];

void Dfs(int u, int fa, int odd) {
	if (~val[u]) {
		if ((val[u] & 1) != odd) {
			puts("No"); exit(0);
		}
		l[u] = r[u] = val[u];
	} else l[u] = -1e6, r[u] = 1e6;

	for (int v : G[u]) if (v != fa) {
		Dfs(v, u, odd ^ 1);
		chkmax(l[u], l[v] - 1);
		chkmin(r[u], r[v] + 1);
	}
	if (l[u] > r[u]) {
		puts("No"); exit(0);
	}
}

int ans[N];
void Get_Ans(int u, int fa) {
	for (int v : G[u]) if (v != fa) {
		ans[v] = ans[u] + 1;
		if (ans[v] > r[v])
			ans[v] = ans[u] - 1;
		Get_Ans(v, u);
	}
}

int main () {

	File();

	Set(val, -1);

	n = read();
	For (i, 1, n - 1) {
		int u = read(), v = read();
		G[u].pb(v); G[v].pb(u);
	}

	int root = 0, k = read();
	For (i, 1, k) {
		root = read();
		val[root] = read();
	}
	Dfs(root, 0, val[root] & 1);

	puts("Yes");
	ans[root] = val[root];
	Get_Ans(root, 0);
	For (i, 1, n)
		printf ("%d\n", ans[i]);

	return 0;

}


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

int n, d;
int m[110];
vector<int> c[110];
int sum[110], pos[110];

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  while (cin >> n >> d, n) {
    for (int i = 0; i < n; i++) {
      c[i].clear();
      sum[i] = pos[i] = 0;
    }
    for (int i = 0; i < n; i++) {
      cin >> m[i];
      c[i].resize(m[i]);
      for (int j = 0; j < m[i]; j++) {
        cin >> c[i][j];
      }
    }

    bool update = true;
    while (update) {
      update = false;
      for (int i = 0; i < n; i++) {
        if (pos[i] == (int)c[i].size()) continue;
        int ns = sum[i] + c[i][pos[i]];
        bool no = false;
        for (int j = 0; j < n; j++) {
          if (j == i) continue;
          no |= abs(ns - sum[j]) > d;
        }
        if (no) continue;
        sum[i] += c[i][pos[i]++];
        update = true;
      }
    }
    string ans = "Yes";
    for (int i = 0; i < n; i++) {
      if (pos[i] == (int)c[i].size()) continue;
      ans = "No";
    }
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 3236
#include <stdio.h>
int main ( void ) {
   int height[10] , max[3] = {0} , i , j;
   
   for ( i = 0; i < 10; i++ )
      scanf("%d",&height[i]);
   
   for ( i = 0; i < 10; i++ ) {
      if ( max[0] < height[i] ) {
         max[2] = max[1];
         max[1] = max[0];
         max[0] = height[i];
      } else if ( max[1] < height[i] ) {
         max[2] = max[1];
         max[1] = height[i];
      }else if ( max[2] < height[i] )
         max[2] = height[i];
   }
   printf("%d\n%d\n%d\n",max[0],max[1],max[2]);
   return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int>a;
    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        a.push_back(x);
    }
    sort (a.begin(), a.end());
    int cnt=1;
    for(int i=1;i<a.size();i++)
        if(a[i]!=a[i-1])
          cnt++;
    cout<<cnt<<endl;
}


Measured memory_bytes: 256
n = int(input())
s = list(map(int, input().split()))
t = []
if n % 2 == 0:
    for i in range(n // 2):
        t.append(s[-(i * 2 + 1)])
    for i in range(n // 2):
        t.append(s[i * 2])
else:
    for i in range(n // 2 + 1):
        t.append(s[-(i * 2 + 1)])
    for i in range(n // 2):
        t.append(s[i * 2 + 1])
r = ''
for n in t:
    r += str(n) + ' '
print(r)


Measured memory_bytes: 26180
#include <cmath>
#include<iostream>
#include<algorithm>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll inf = 1000000007;
int n, k;
ll coin(ll x) {
	ll count = 0;
	while (x < k) {
		x = x * 2;
		count++;
	}
	return count;
}
int main() {
	cin >> n >> k;
	double ans = 0;
	double index =(double) 1 / n;
	for (int i = 1; i <= n; i++) {
		ans += (double)index * (1 / pow(2, coin(i)));
		
	}
	cout << fixed << setprecision(15) << ans << endl;
	return 0;
}

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

int main(int argc, char const *argv[])
{
    int n, m, b;
    vector<vector<int>> a;
    vector<int> input_b;
    int c;

    cin >> n >> m;

    a.resize(n, vector<int>(m));

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

    for (int i = 0; i < m; i++)
    {
        cin >> b;
        input_b.emplace_back(b);
    }

    for (int i = 0; i < n; i++)
    {
        c = 0;
        for (int j = 0; j < m; j++)
        {
            c += a[i][j] * input_b[j];
        }
        cout << c << endl;
    }

    return 0;
}



Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
template <typename T> using vec = vector<T>;

int main()
{
    string s;
    cin >> s;
    smatch smatch;
    if (regex_search(s,smatch,regex("^A[a-z]+C[a-z]+$")))
    {
        cout << "AC" << endl;
    }
    else
    {
        cout << "WA" << endl;
    }
}

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

typedef long long ll;

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

int main() {
	ll a, b;
	cin >> a >> b;

	ll g = gcd(a, b);
	cout <<  a/g * b << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;

typedef long long ll;
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define memset(v, h) memset((v), h, sizeof(v))
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using P = pair<ll, ll>;

ll m[20][20];

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

struct node
{
    public: ll x;
    public: ll y;

    node(ll xx, ll yy)
    {
        x = xx;
        y = yy;
    }
};

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

    string k = "";

    rep(i, s.length())k+="x";
    

    cout << k << endl;
    return 0;
}

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

int main()
{
    string s;
    cin >> s;
    set <int> frc;

    for (auto i : s)
        frc.insert(i);

    if (s.size() < 26) {
        for (int i('a'); i <= 'z'; i++) {
            if (frc.find(i) == frc.end()) {
                cout << s << (char)i << '\n';
                return 0;
            }
        }
    }

    frc = set <int> ();

    for (int i(s.size() - 1); i >= 0; i--) {
        if (frc.lower_bound(s[i]) != frc.end()) {
            s[i] = *frc.lower_bound(s[i]);
            cout << s << '\n';
            return 0;
        }
        frc.insert(s[i]);
        s.resize(i);
    }

    cout << -1 << '\n';
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<set>
using namespace std;
int main(){
	int a,b,c,d,e;
	char x;
	while(cin>>a>>x>>b>>x>>c>>x>>d>>x>>e){
		string ans="null";
	int ta[14]={0};
	ta[a]++,ta[b]++,ta[c]++,ta[d]++,ta[e]++;
	int two=0,three=0,four=0;
	for(int i=1;i<=13;i++){if(ta[i]==2)two++;if(ta[i]==3)three++;if(ta[i]==4)four++;}
		if(two==1)ans="one pair";
		if(two==2)ans="two pair";
		if(three==1)ans="three card";
		for(int i=1;i<=13-4;i++)if(ta[i]==1&&ta[i+1]==1&&ta[i+2]==1&&ta[i+3]==1&&ta[i+4]==1)ans="straight";
		
		if(ta[10]==1&&ta[11]==1&&ta[12]==1&&ta[13]==1&&ta[1]==1)ans="straight";
		if(two==1&&three==1)ans="full house";
		if(four==1)ans="four card";
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 1200
#include <iostream>

using namespace std;

int main(){
  int n;
  cin >> n;
  bool a[4]={};
  int i;
  char x;
  for(i=0;i<n;i++){
    cin >> x;
    if(x=='G')a[0]=true;
    if(x=='W')a[1]=true;
    if(x=='Y')a[2]=true;
    if(x=='P')a[3]=true;
  }
  int ans=0;
  for(i=0;i<4;i++){
    if(a[i]==1)ans++;
  }
  if(ans==3)cout<<"Three";
  else cout<<"Four";
  cout << endl;
  return 0;
}


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

using namespace std;

int main() {
    while (1) {
        int h, w;
        cin >> h >> w;
        if (h == 0 && w == 0) break;
        int m = h * h +  w * w;
        bool end = false;
        for (int m = h * h + w * w; m <= 45000; ++m) {
            //cout << m << endl;
            int bh = m == h * h + w * w ? h + 1 : 1;
            for (; bh <= 150; ++bh) {
                
                if (m > bh * bh) {
                    int r = m - bh * bh;
                    int bw = int(floor(sqrt(r)));
                    //cout << bh << " " << bw << endl;
                    if (bw * bw == r) {
                        if (bw <= bh) break;
                        cout << bh << " " << bw << endl;
                        end = true;
                        break;
                    }
                }
            }
            if(end)break;
        }
        
    }
}


Measured memory_bytes: 3104
//#include<bits\stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<string>
#include<ctime>
#include<cmath>
#include<cctype>
#include<cstdlib>
#include<queue>
#include<deque>
#include<stack>
#include<vector>
#include<algorithm>	
#include<utility>
#include<bitset>
#include<set>
#include<map>
#define ll long long
#define db double
#define ld long double
#define put(x) printf("%d\n",x)
#define min(x,y) ((x)>(y)?(y):(x))
#define max(x,y) ((x)>(y)?(x):(y))
#define EPS 1e-8
#define mod 1000000007
#define INF 1000000010
using namespace std;
char *fs,*ft,buf[1<<15];
inline char getc()
{
	return (fs==ft&&(ft=(fs=buf)+fread(buf,1,1<<15,stdin),fs==ft))?0:*fs++;
}
inline int read()
{
    int x=0,f=1;char ch=getc();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getc();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getc();}
    return x*f;
}
const int MAXN=100010;
struct wy
{
	int x,y;
	int friend operator <(wy a,wy b)
	{
		return a.x<b.x;
	}
}t[MAXN];
//f[i]表示第i个必选的最大数量
int n;
int f[MAXN],ans,cnt,num;
int b[MAXN<<1];
int c[MAXN<<1];
inline void discrete()
{
	sort(b+1,b+1+cnt);
	for(int i=1;i<=cnt;++i)if(i==1||b[i]!=b[i-1])b[++num]=b[i];
	for(int i=1;i<=n;++i)
	{
		t[i].x=lower_bound(b+1,b+1+num,t[i].x)-b;
		t[i].y=lower_bound(b+1,b+1+num,t[i].y)-b;
	}
}
inline void add(int x,int y)
{
	while(x<=cnt)
	{
		c[x]=max(c[x],y);
		x+=x&(-x);
	}
}
inline int ask(int x)
{
	int w=0;
	while(x)
	{
		w=max(w,c[x]);
		x-=x&(-x);
	}
	return w;
}
int main()
{
	//freopen("1.in","r",stdin);
	n=read();
	for(int i=1;i<=n;++i)
	{
		int x,y;
		x=read();y=read();
		t[i]=(wy){x-y,x+y};
		b[++cnt]=t[i].x;
		b[++cnt]=t[i].y;
	}
	discrete();
	sort(t+1,t+1+n);
	for(int i=1;i<=n;++i)
	{
		f[i]=ask(t[i].x)+1;
		add(t[i].y,f[i]);
		ans=max(ans,f[i]);
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 2944
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] A = new int[N];
    for(int i = 0;i<N;i++){
      A[i]=sc.nextInt();
    }
    long sum = 0;
    int Kijun = 0;
    for(int i2=0;i2<N-1;i2++){
      Kijun = A[i2];
      if(A[i2+1]<Kijun){
        sum+=(long)(Kijun-A[i2+1]);
        A[i2+1]=Kijun;
      }
    }
    System.out.println(sum);
  }
}

Measured memory_bytes: 61212
#include<cstdio>
#include<iostream>
#include<set>

using namespace std;

int N, K;
//map<int, int> record;
set<int> record;

int main() {
    scanf("%d%d", &N, &K);
    int num;
    for (int i = 0; i < K; i++) {
        cin >> num;
        record.insert(num);
    }
    for (int i = N;;i++) {
        int j = i;
        bool flag = true;
        while(0 < j) {
            int digit = j % 10;
            j /= 10;
            if(record.find(digit) != record.end())
                flag = false;
        }
        if(flag) {
            num = i;
            break;
        }
    }

    printf("%d\n", num);
    return 0;
}

Measured memory_bytes: 3784
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <stack>
#include <queue>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (int i=0;i<N;i++)

int main() {

	int H,W;
	cin >> H >> W;

	bool wall[50][50];
	int dist[50][50];
	int white = 0;

	rep(i, H) rep(j, W) {
		char input;
		cin >> input;
		if (input == '.') {
			wall[i][j] = false;
			white++;
		}
		else {
			wall[i][j] = true;
		}
		dist[i][j] = -1;
	}

	queue<pair<int, int>> Queue;
	pair<int, int> Pair, Pair2;

	Pair.first = 0; Pair.second = 0;
	Queue.push(Pair);
	wall[Pair.first][Pair.second] = true;
	dist[Pair.first][Pair.second] = 1;

	while (Queue.size() != 0) {
		Pair = Queue.front();
		Queue.pop();

		//cout << "->" << Pair.first << ":" << Pair.second << endl;

		if (Pair.first == H - 1 && Pair.second == W - 1) {
			break;
		}

		if (Pair.first > 0 && wall[Pair.first-1][Pair.second] == false) {
			Pair2 = Pair;
			Pair2.first--;
			Queue.push(Pair2);
			wall[Pair2.first][Pair2.second] = true;
			dist[Pair2.first][Pair2.second] = dist[Pair.first][Pair.second] + 1;
		}
		if (Pair.first < H-1 && wall[Pair.first + 1][Pair.second] == false) {
			Pair2 = Pair;
			Pair2.first++;
			Queue.push(Pair2);
			wall[Pair2.first][Pair2.second] = true;
			dist[Pair2.first][Pair2.second] = dist[Pair.first][Pair.second] + 1;
		}
		if (Pair.second > 0 && wall[Pair.first][Pair.second-1] == false) {
			Pair2 = Pair;
			Pair2.second--;
			Queue.push(Pair2);
			wall[Pair2.first][Pair2.second] = true;
			dist[Pair2.first][Pair2.second] = dist[Pair.first][Pair.second] + 1;
		}
		if (Pair.second < W-1 && wall[Pair.first][Pair.second+1] == false) {
			Pair2 = Pair;
			Pair2.second++;
			Queue.push(Pair2);
			wall[Pair2.first][Pair2.second] = true;
			dist[Pair2.first][Pair2.second] = dist[Pair.first][Pair.second] + 1;
		}

	}

	if (dist[H - 1][W - 1] == -1) {
		cout << "-1" << endl;
	}
	else {
		cout << white - dist[H - 1][W - 1] << endl;
	}

	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;cin>>s;
    ll ans=0;
    for(int i=0;i<(1<<s.size()-1);i++){
        ll sum=0;
        string t="";
        for(int j=0;j<s.size();j++){
            t+=s[j];
            if(i&(1<<j)){
                sum+=stoll(t);
                t="";
            }
        }
        if(t!="")sum+=stoll(t);
        ans+=sum;
    }
    cout<<ans<<endl;
    return 0;
}

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

from collections import defaultdict
d = defaultdict(int)

for i in range(n):
  k = input()
  d[k] += 1

m = max(d.values())
ans = []
for k,v in d.items():
  if v == m:
    ans.append(k)
for i in sorted(ans):
  print(i)

Measured memory_bytes: 33380
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    S = input()
    ACGT = set(['A', 'C', 'G', 'T'])

    c = 0
    ans = 0
    for s in list(S):
        if s in ACGT:
            c += 1
        else:
            ans = max(ans, c)
            c = 0
    print(max(ans, c))

if __name__ == '__main__':
    main()


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

int main(){
  int n, x; cin >> n >> x;
  vector< int > v;
  v.push_back(x);
  int y = 0;
  for(int i = 0; i < n; ++i){
    cin >> y;
    v.push_back(y);
  }
  sort(v.begin(),v.end());
  int z = v[1] - v[0];
  int ans = z;
  for(int i = 2; i < (int)v.size(); ++i){
     ans = __gcd(ans,v[i] - v[i - 1]);
  }
  cout << ans << '\n';
}

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

int main() {
	int x = 1,i = 1;
	
	while (x != 0) {
			cin >> x;
			if (x == 0) break;
			cout << "Case " << i << ": " << x << endl;
			i++;
		
	}
	return 0;
}

Measured memory_bytes: 3080
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<vector>
#include<queue>
#include<map>
using namespace std;
#define pi acos(-1.0)
#define maxd 1000000007
typedef long long ll;
int n;
double d,x;

int read()
{
	int x=0,f=1;char ch=getchar();
	while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
	while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
	return x*f;
}

int main()
{
	n=read();scanf("%lf%lf",&x,&d);
	double ans=0.0,m=2*n;
	while (m)
	{
		ans+=1.0*(2*x+d*(m-1))/2;
		x=((m+2)*x+5*d)*1.0/m;
		d=(m+4)*d*1.0/m;
		m-=2;
	}
	printf("%0.10lf",ans);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
int main(void) {
	std::string s;
	std::cin >> s;
	if (s == "Sunny") { std::cout << "Cloudy" << std::endl; }
	if (s == "Cloudy"){ std::cout << "Rainy" << std::endl; }
	if (s == "Rainy") { std::cout << "Sunny" << std::endl; }
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll n, d, q;std::cin >> n >> d;
  vll a(n);re(i, n) scanf("%lld", &a[i]);
  vll x(n+1, 0);
  x[0] = d;
  ll fa = -1;

  for(int i=1;i<=n;i++){
    x[i] = min(x[i-1], abs(x[i-1] - a[i-1]));
    if(x[i]==0&&fa==-1) fa = i;
  }

  std::cin >> q;
  if(fa==-1){
    re(i, q) std::cin >> n;
    re(i, q) std::cout << "YES" << '\n';
    return 0;
  }

  ll las = 1;
  vector<bool> ans(n+1, false);
  for(int i=n;i>0;i--){
    if(fa>=i&&x[i-1]>=las) ans[i] = true;
    ll num = a[i-1];
    if(num/2<las) las += num;
  }
  for(int i=0;i<q;i++){
    ll tmp;std::cin >> tmp;
    std::cout << (ans[tmp]?"YES":"NO") << '\n';
  }
  return 0;
}


Measured memory_bytes: 11648
#include<bits/stdc++.h>
using namespace std;
const int N=100+2;
int A[N],ans=0;
int main(){
	int n;
	if (scanf("%d", &n)) {
    /* code */
	}
	for(int i=0;i<n-1;i++) {
		if (scanf("%d", &A[i])) {
		    /* code */
		}
	}
	ans+=A[0];
	for(int i=0;i<n-2;i++) {
		ans+=std::min(A[i],A[i+1]);
	}
	ans+=A[n-2];
	//std::min(3.14,2.72)
	printf("%d",ans);
	return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main()
{
	int a, b, c;
	cin >> a >> b >> c;

	int d = c - (a - b);

	if(d < 0) cout << '0' << endl;
	else cout << d << endl;

	return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, StdoutLock, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , bytes ) => { read_value ! ( $ next , String ) . into_bytes ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }
#[allow(dead_code)]
pub fn with_bufwriter<F: FnOnce(BufWriter<StdoutLock>) -> ()>(f: F) {
    let out = stdout();
    let writer = BufWriter::new(out.lock());
    f(writer)
}
#[allow(unused_macros)]
macro_rules ! debug { ( $ ( $ a : expr ) ,* ) => { eprintln ! ( concat ! ( $ ( stringify ! ( $ a ) , " = {:?}, " ) ,* ) , $ ( $ a ) ,* ) } ; }
#[allow(dead_code)]
fn main() {
    input!{
        n: usize,
        a: [u64; n],
    }
    let mut a = a;
    a.sort();
    let mut ans = 1;
    let mut one = false;
    let mut i = n-1;
    let mut can = false;
    while i > 0 {
        if a[i] == a[i-1] {
            ans *= a[i];
            i -= 1;
            if one {
                can = true;
                break;
            }
            if !one {
                one = true;
            }
        }
        i -= 1;
        //debug!(ans);
    }
    if can {
        println!("{}", ans);
    } else {
        println!("{}", 0);
    }
}

Measured memory_bytes: 4352
// priority_queue is generally max heap to make it min heap use priority_queue<int,vector<int>,greater<int>> pq;"
#include <bits/stdc++.h>
#define int                 long long int
#define double              long double
#define get(a,n)            for(int i=0;i<n;i++){cin>>a[i];}
#define maxm(a)             int maxi=LLONG_MIN;int index;for(int i=0;i<n;i++){if(maxi<a[i]){maxi=a[i];index=i;}}
#define minm(a)             int mini=LLONG_MAX;int index;for(int i=0;i<n;i++){if(mini>a[i]){mini=a[i];index=i;}}
#define db(x)               cout<<"["<<x<<"]"<<endl;
#define vv                  vector
#define endl                "\n"
#define PI                  acos(-1)
#define half(a)             a%2?(a/2+1):a/2
#define array               int a[n];for(int i=0;i<n;i++){cin>>a[i];}
#define pb                push_back
#define all(a)              a.begin(),a.end()
#define mod                 1000000007
#define no                  "NO"
#define yes                 "YES"
using namespace std;
template <typename T>
void printvec(vector<T>& vec){
	for(int i=0;i<vec.size();i++) cout<<vec[i]<<" ";
	cout<<endl;
}
vector<bool> is_prime(100000+1, true);
void seive(int n)
{
    is_prime[0] = is_prime[1] = false;
    for (int i = 2; i * i <= n; i++) {
        if (is_prime[i]) {
            for (int j = i * i; j <= n; j += i)
                is_prime[j] = false;
        }
    }
}
//this function returns 0 indexing array if the required element
//is less than minimum it returns -1 and greater than max it returns n.
int special_binary(int *a,int n,int x)
{
    int l=0;int r=n-1;int m=0;int f=x;int c=0;
     while(l<=r)
     {
       if(f>a[n-1])
        return n;
       m=(l+r)/2;
       if(a[m]<=f)
       {
           c=m+1;
           l=m+1;
       }
       else
       {
           r=m-1;
       }
     }
     return c-1;
}
void show(int *a,int n)
{
    int size = n;
    for(int i=0;i<size;i++)
    {
            cout<<a[i]<<" ";
    }   
    cout<<endl;
}
int binary_search(int *a,int n,int e)
{
    int f,l,m;f=0;l=n-1;
    while(f<=l)
    {//returns index of that value.
        m=(f+l)/2;
        if(e==a[m])
            return(m);
        else if(e>a[m])
                f=m+1;
            else
                l=m-1;
    }
    return -1;
}
bool cmp(const pair<int,int> &a,const pair<int,int> &b)
{
    return (a.second<b.second);
}
void solve()
{
    int n,weight;
    cin>>n>>weight;
    int w[n+1],v[n+1];
    for(int i=1;i<=n;i++)
    {
        cin>>w[i]>>v[i];
    }
    int dp[n+1][weight+1]={};
    for(int i=0;i<=n;i++)
    {
        for(int we=0;we<=weight;we++)
        {
            if(we==0||i==0)
            {
                dp[i][we]=0;
                dp[i][we]=0;
            }
            else
            {
                dp[i][we]=max(we>=w[i]?dp[i-1][we-w[i]]+v[i]:0,dp[i-1][we]);
            }
        }
    }
    cout<<dp[n][weight]<<endl;
    
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout << fixed << setprecision(15);
    int t=1;
    //cin>>t;
    //seive(100000);
    while(t--)
    {
        solve();
        
    }
   

  
}

Measured memory_bytes: 82500