akhauriyash/Code-Regression huggingface dataset:
//
//  main.cpp
//  ITP1_2-D
//
//  Created by Saicj on 2015/07/13.
//  Copyright (c) 2015??´ saicj. All rights reserved.
//

/*
 x - r ???0 ???????°??????????????????????x + r ???W ????????§??????????????°No??¨?????????
 x - r ???0 ??\???????????????x + r ???W ??\???????????°Yes??¨?????????
 */

#include <iostream>

int main()
{

    int W,H,x,y,r ;
    
    bool xYes = false;
    bool yYes = false;
    
    std::cin >> W >> H >> x >> y >> r ;
    
    if ((x - r) < 0 || (x + r) > W){
        
        xYes = false;
        
    }else if ((x - r) >= 0 || (x + r ) <= W){
        xYes = true;
        
    }
    
    if (y - r < 0 || y + r > H ){
        
        yYes = false;
    }else if(y - r >= 0 || y + r <= H){
        yYes = true;
    }
    
    if (xYes && yYes){
        std::cout << "Yes" << "\n";
    }else{
        std::cout << "No" << "\n";
    }
    
    
    return 0;
}

Measured memory_bytes: 1128
import sys
import math

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prl = lambda x: print(*x ,sep='\n')

d,g = nm()
comp = [nl() for _ in range(d)]
ans = 10**10
check = set([i for i in range(d)])
for i in range(2**d):
    res = 0
    times = 0
    visited = set()
    for j in range(d):
        if (i >> j) & 1:
            res += 100 * (j+1)*comp[j][0] + comp[j][1]
            times += comp[j][0]
            visited.add(j)
    if res < g:
        ma = max(check-visited)
        waru =  100 * (ma+1)
        waru_times = math.ceil((g-res)/waru)
        res += 100*waru_times*waru
        if waru_times > comp[ma][0]-1 or res < g:
            continue
        times += waru_times
        if ans > times:
            ans = times
    elif res >= g:
        if ans > times:
            ans = times
print(ans)

Measured memory_bytes: 3316
/*
    ||S|A|M|R|A|T||
    Author:codingsamrat
*/
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long 
#define ld long double
#define INF LONG_MAX
#define pb push_back
#define gcd __gcd
#define f(i,a,b) for(int i=a;i<b;i++)
#define fe(i,a,b) for(int i=a;i<=b;i++)
#define vii vector<int>
#define vll vector<long long>
typedef long long  ll;
#define MAX 70

ll bpow(ll a, ll b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

int32_t main()
{	ios_base::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
//	#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
//    #endif
	ll n;
	cin>>n;
	char str[MAX];
    int i = 0; 
  
    while (n > 0) { 
        // Find remainder 
        int rem = n % 26; 
  
        // If remainder is 0, then a 'Z' must be there in output 
        if (rem == 0){ 
            str[i++] = 'z'; 
            n = (n / 26) - 1; 
        } 
        else // If remainder is non-zero 
        { 
            str[i++] = (rem - 1) + 'a'; 
            n = n / 26; 
        } 
    } 
    str[i] = '\0'; 
    reverse(str, str + strlen(str)); 
    cout<<str; 
  
	
return 0;

}


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

int main(){

    int N,X,T;

    cin>>N>>X>>T;

    if(N%X==0){
        cout<<T*(N/X)<<endl;
    }else{
        cout<<T*(N/X+1)<<endl;

    }
    
    return 0;

}

Measured memory_bytes: 3616
#include <iostream>

using namespace std;

void xyz(int a[], int n)
{
	if(a[n] == 0)
	{
		a[n] = 1;
	}
	else
	{
		a[n] = 0;
		xyz(a, n + 1);
	}
}

bool check(int a[])
{
	bool b = false;
	for(int i = 0; i < 3; i++)
	{
		if(a[i] == 0)
		{
			break;
		}
		else
		{
			if(i == 2)
			{
				b = true;
			}
		}
	}
	
	return b;
}

int main()
{
	int n;
	cin >> n;
	
	int data[4] = {0};
	for(int i = 0; i < 4; i++)
	{
		data[3 - i] = n % 10;
		n /= 10;
	}
	
	int che[3] = {0};
	
	while(check(che) != true)
	{
		int ans = 0;
		
		if(che[0] == 0)
		{
			ans += data[0] + data[1];
		}
		else
		{
			ans += data[0] - data[1];
		}
		
		if(che[1] == 0)
		{
			ans += data[2];
		}
		else
		{
			ans -= data[2];
		}
		
		if(che[2] == 0)
		{
			ans += data[3];
		}
		else
		{
			ans -= data[3];
		}
		
		if(ans == 7)
		{
			for(int i = 0; i < 3; i++)
			{
				cout << data[i];
				
				if(che[i] == 0)
				{
					cout << '+';
				}
				else
				{
					cout << '-';
				}
			}
			cout << data[3] << "=7" << endl;
			return 0;
		}
		
		xyz(che, 0);
	}
}

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

typedef long long ll;
typedef vector<int> vi;

const double PI=acos(-1.0);

int N; vector<string> S;
void input()
{
    cin>>N;
    for(int i=0;i<N;++i){
        string s; cin>>s; S.emplace_back(s);
    }
}

void solve()
{
    sort(S.begin(),S.end());
    string head=S[0]; int ans=1;
    for(int i=1;i<N;++i){
        if(head!=S[i]){
            ++ans; head=S[i];
        } else continue;
    }
    cout<<ans<<endl;
}

int main()
{
    cin.tie();
    ios::sync_with_stdio(false);
    input();
    solve();
    return 0;
}

Measured memory_bytes: 11692
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>

int main() {
	double a, b, c, d;
	std::cin >> a >> b >> c >> d;
	for (int i = 0;i < d-b;i++) {
		std::cout << 'U';
	}
	for (int i = 0;i < c - a;i++) {
		std::cout << 'R';
	}
	for (int i = 0;i < d - b;i++) {
		std::cout << 'D';
	}
	for (int i = 0;i < c - a + 1;i++) {
		std::cout << 'L';
	}
	for (int i = 0;i < d - b + 1;i++) {
		std::cout << 'U';
	}
	for (int i = 0;i < c - a + 1;i++) {
		std::cout << 'R';
	}
	for (int i = 0;i < 1;i++) {
		std::cout << 'D';
	}
	for (int i = 0;i < 1;i++) {
		std::cout << 'R';
	}
	for (int i = 0;i < d - b + 1;i++) {
		std::cout << 'D';
	}
	for (int i = 0;i < c - a + 1;i++) {
		std::cout << 'L';
	}
	for (int i = 0;i < 1;i++) {
		std::cout << 'U' << std::endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
map<string,int>m;
string gs()
{
  string t;
  cin>>t;
  return t;
}
int main(){
  int n;
  cin>>n;
  while(n--)
    m[gs()]++;
  cout<<"AC x "<<m["AC"]<<endl;
  cout<<"WA x "<<m["WA"]<<endl;
  cout<<"TLE x "<<m["TLE"]<<endl;
  cout<<"RE x "<<m["RE"]<<endl;
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>

using namespace std;

int main()
{
    int n;
    int k;
    int cr = 1;
    cin >> n >> k;
    for(int i = 1; i <= n; i ++)
    {
        cr = min(cr * 2, cr + k);
    }

    cout << cr << "\n";
    return 0;
}


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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

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

// Mod int
const int mod = 1000000007;
struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%mod+mod)%mod){}
  // mint(ll x):x(x){}
  mint& fix() { x = (x%mod+mod)%mod; return *this;}
  mint operator-() const { return mint(0) - *this;}
  mint& operator+=(const mint& a){ if((x+=a.x)>=mod) x-=mod; return *this;}
  mint& operator-=(const mint& a){ if((x+=mod-a.x)>=mod) x-=mod; return *this;}
  mint& operator*=(const mint& a){ (x*=a.x)%=mod; return *this;}
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
};
istream& operator>>(istream&i,mint&a){i>>a.x;return i;}
ostream& operator<<(ostream&o,const mint&a){o<<a.x;return o;}
typedef vector<mint> vm;
typedef vector<vm> vvm;
//

mint dp0[2005][2005];
mint dp1[2005][2005];

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,m;
  cin >> n >> m;
  VI s(n+1),t(m+1);
  rep(i,n) cin >> s[i];
  rep(i,m) cin >> t[i];
  dp0[0][0] = 1;
  rep(i,n+1)rep(j,m+1){
    dp0[i+1][j] += dp0[i][j];
    dp1[i][j] += dp0[i][j];
    dp1[i][j+1] += dp1[i][j];
    if(s[i] == t[j]) dp0[i+1][j+1] += dp1[i][j];
  }
  cout << dp1[n][m] << endl;
  return 0;
}


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

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

	if(n%2==0){
		cout << n*min({8*a,4*b,2*c,d})/2 << endl;
	}
	else{
		cout << (n-1)/2*min({8*a,4*b,2*c,d}) + min({4*a,2*b,c}) << endl;
	}
	return 0;
}

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

int main() {
  int N, L;
  cin >> N >> L;
  vector<string> S(N);
  for (int i = 0; i < N; ++i) {
    cin >> S[i];
  }
  sort(S.begin(), S.end());
  for (int i = 0; i < N; ++i) {
    cout << S[i];
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>

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

using namespace std;
typedef long long int ll;
const int INF = 100000000;

int main()
{
    int k, n;
    int a[200000];
    cin >> k >> n;
    rep(i, n) cin >> a[i];

    int max_dist = 0.0;
    int max_dist_idx = 0;
    rep(i, n) {
        int dist = 0.0;
        if (i == (n-1)) dist = k - a[i] + a[0];
        else dist = a[i + 1] - a[i];
        if (dist > max_dist) {
            max_dist = dist;
            max_dist_idx = i;
        }
    }
    cout << k - max_dist << endl;
    return 0;
}

Measured memory_bytes: 1024
import sys
input = sys.stdin.readline

L,R = map(int,input().split())
lst = []

if L <= 2019 and R >= 2019:
    print(0)
else:
    for i in range(L,R+1):
        if i % 2019 == 0:
            lst.append(0)
            break
        for j in range(i+1,R+1):
            if j % 2019 == 0:
                lst.append(0)
                break
            lst.append((i * j) % 2019)
        else:
            continue
        break
    print(min(lst))


Measured memory_bytes: 75312
#include <iostream>
#include <string>
#include <vector>
#define range(i, r) for(int i=0;i<r;i++)
#define ranges(i, l, r) for(int i=l;i<r;i++)
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
typedef long long int ll;
using namespace std;

int main(int argc, char const *argv[]) {
  string A;
  std::cin >> A;
  ll N = A.length();
  ll ans =(N*(N+1))/2;
  std::vector<ll> count(26, 0);
  range(i, A.length()) count[A[i]-'a']++;
  range(i, 26) ans -= (count[i]*(count[i]+1))/2;
  std::cout << ans + 1 << '\n';
  return 0;
}


Measured memory_bytes: 832
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename X> ostream& operator << (ostream& x,const vector<X>& v){for(ll i=0;i<v.size();++i) x<<v[i]<<" ";return x;}
template <typename X> ostream& operator << (ostream& x,const set<X>& v){for(auto it:v) x<<it<<" ";return x;}
template <typename X, typename Y> ostream& operator << (ostream& x, const pair<X,Y>& v) {x<<v.ff<<" "<<v.ss;return x;}
template <typename T, typename S> ostream& operator << (ostream& os, const map<T, S>& v) { for (auto it : v) os << it.first << "=>" << it.second << endl; return os; }
struct pair_hash {inline std::size_t operator()(const std::pair<ll, ll> & v) const {return v.first*31+v.second;}};
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL)
#define pb push_back
#define fr first
#define sc second
#define prnt(m) for(auto it = m.begin() ; it != m.end() ; ++it){cout<<*it<<endl;}
#define tra(it,m) for(auto it=m.begin();it!=m.end();++it)
#define DBG(x) cout<<"# # #     "<<x<<'\n';
#define fri(i,s,n) for(int i=s;i<n;i++)
#define mod 1000000007LL
#define mod2 998244353
#define vct2 vector<vector<ll>>
#define vct vector<ll>
#define pll pair<ll,ll>
#define rz(n) resize(n)
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define arrin(a,n) for(ll i = 0; i < n ; i++){cin>>a[i];}
#define arrout(a,n) for(ll i = 0;i < n; i++){cout<<a[i]<<" ";}
#define ex(s) cout<<s<<endl,exit(0);
#define inf 1e18
#define five 100005;
#define six 1000005;
#define prllclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
//___________________________________________________________________________________________________________________________________________________________
int main()
{
       int n,kk;
       cin>>n>>kk;
       int xx = ((n-1)*(n-2))/2;
       if(xx<kk){
              cout<<-1<<endl;
              return 0;
       }
       xx -= kk;
       cout<<xx+n-1<<endl;
       fri(i,2,n+1){
              cout<<1<<" "<<i<<endl;
       }
       int xp = 0;
       fri(i,2,n+1){
              fri(j,i+1,n+1){
                     if(xp<xx){
                            cout<<i<<" "<<j<<endl;
                            xp++;
                     }
              }
       }
}


Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, char *argv[])
{
        int H, W;
        int i, j;

        while (1) {
                scanf("%d %d", &H, &W);
                if (H == 0 && W == 0) break;
                
                for (i = 0; i < H; i++) {
                        for (j = 0; j < W; j++) {
                                if (i % 2 == 0) {
                                        if (j % 2 == 0) printf("#");
                                        else printf(".");
                                } else {
                                        if (j % 2 == 0) printf(".");
                                        else printf("#");
                                }
                        }
                        printf("\n");
                }
                printf("\n");
        }

        return 0;
}

Measured memory_bytes: 572
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = 1LL << 60;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(10);

}

signed main() {
	ll n, a, b;
	ll sum1 = 0;
	ll sum2 = 0;
	ll sa = 0;
	ll sb = 0;

	cin >> n;

	vector<ll> v(n, 0);
	vector<ll> vv(n, 0);

	REP(i, n) {
		cin >> a;
		v[i] = a;
		sa += a;
	}

	REP(i, n) {
		cin >> b;
		vv[i] = b;
		sb += b;
	}

	REP(i, n) {
		if (v[i] > vv[i]) {
			sum1 += v[i] - vv[i];
		}
		else {
			sum2 += ceil((vv[i] - v[i]) / 2.0);
		}
	}

	if (sum1 <= sb - sa && sum2 <= sb - sa) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

ll a,b,n;

int main(void){
	scanf("%lld%lld%lld",&a,&b,&n);
	ll ans=a*(n)/b-a*((n)/b);
	for(ll i=b-1;i<=min(n,a*b);i+=b){
		ans=max(ans,a*i/b-a*(i/b));
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 3824
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N;
  cin >> N;
  int a, b, tmp, r;
  cin >> a >> b;
  if(a < b) {
    tmp = a;
    a = b;
    b = tmp;
  }
  r = a % b;
  while(r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  for(int i = 0; i < N - 2; i++) {
    if (b == 1) {
      cout << b << endl;
      return 0;
    }
    a = b;
    cin >> b;
    if(a < b) {
    tmp = a;
    a = b;
    b = tmp;
    }
    r = a % b;
    while(r != 0) {
    a = b;
    b = r;
    r = a % b;
    }
    
  }
  cout << b << endl;
  return 0;
}

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

const long long MOD = 1000000007LL;

int main(){

    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);

    string s;
    cin >> s;

    long long a = 0, b = 0, c = 0, q = 1, INV = 333333336;

    for(auto i : s){
        if(i == 'A'){
            ++a;
        } else if(i == 'B'){
            b += a;
        } else if(i == 'C'){
            c += b;
        } else {
            c += b * INV; b += a * INV; a += INV; q *= 3;
            if(q > MOD)
                q %= MOD;
        }
        if(a > MOD) a %= MOD;
        if(b > MOD) b %= MOD;
        if(c > MOD) c %= MOD;
    }

    cout << c * q % MOD << "\n";

    return 0;

}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<(n);++i)
#define rep2(i,a,b) for (ll i=(a);i<(b);++i)
#define debug(x) cout << #x << '=' << x << endl
#define all(v) (v).begin(),(v).end()
//const ll MOD=1e9+7;
const ll MOD=998244353;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-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;
}

const int MAX = 510000;
vector<ll> fac(MAX),finv(MAX),inv(MAX);

void COMinit(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    rep2(i,2,MAX){
        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(int n,int k){
    if (n<k) return 0;
    if (n<0||k<0) return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    int N=S.size();
    vector<int> sum(N+1);
    sum[0]=0;
    rep(i,N){
        sum[i+1]=sum[i];
        if (S[i]=='0') sum[i+1]+=2;
        if (S[i]=='1') ++sum[i+1];
    }
    vector<vector<ll>> dp(N+1,vector<ll>(N+1,0));
    dp[0][0]=1;
    rep(i,N){
        rep(j,N+1){
            if (sum[i+1]>=j+1) dp[i+1][j+1]=(dp[i+1][j+1]+dp[i][j])%MOD;
            if (2*(i+1)-sum[i+1]>=i-j+1) dp[i+1][j]=(dp[i+1][j]+dp[i][j])%MOD;
        }
    }
    ll ans=0,s=sum[N];
    COMinit();
    rep(i,N+1) ans=(ans+dp[N][i]*COM(N,s-i)%MOD)%MOD;
    cout << ans << endl;
}

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

int dc;
char inp[20];

int main() {
   scanf("%s", inp);
   dc = strlen(inp);
   int mx = 0, ss = 0;
   for(int i = 0; i < dc; i++) {
      int d = inp[i] - '0';
      if(d > 0) mx = max(mx, ss + (d - 1) + 9 * (dc - i - 1));
      ss += d;
   }
   mx = max(mx, ss);
   printf("%d\n", mx);
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
    
    
int main(){
  int n;
  cin>>n;
  int a[n];

  for (int i = 0; i < n; i++)
  {
    if (((i+1)%3==0)||((i+1)%5==0))
    {
      a[i]=0;
    }
    else
    {
      a[i]=i+1;
    }
    
  }
  long int x=0;

  for (int i = 0; i < n; i++)
  {
    x=x+a[i];
  }
  cout<<x<<endl;
    return 0;
}

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

int main(){
    using namespace std;
    unsigned long X, Y, A, B, C;
    cin >> X >> Y >> A >> B >> C;
    vector<unsigned long> p(A), q(B), r(C);
    for(auto& i : p)cin >> i;
    for(auto& i : q)cin >> i;
    for(auto& i : r)cin >> i;
    sort(p.begin(), p.end());
    sort(q.begin(), q.end());
    sort(r.begin(), r.end());
    vector<unsigned long> pq(X + Y);
    merge(p.end() - X, p.end(), q.end() - Y, q.end(), pq.begin());
    r.push_back(0);
    pq.push_back(0);
    reverse(r.begin(), r.end());
    reverse(pq.begin(), pq.end());
    partial_sum(r.begin(), r.end(), r.begin());
    partial_sum(pq.begin(), pq.end(), pq.begin());
    unsigned long K{min(X + Y, C) + 1};
    vector<unsigned long> ans(K);
    transform(pq.rbegin(), pq.rbegin() + K, r.begin(), ans.begin(), plus<>());
    cout << *max_element(ans.begin(), ans.end()) << endl;
    return 0;
}

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



int main(void){
    int n, a = (int)'a';
    string s;
    cin >> n >> s;
    int words[26];
    fill(words, words+26, 1);
    for(char x: s)
        words[(int)x - a]++;
    long long ans = 1;

    for(int x: words)
        ans =(ans* x)%(int)(1E9+7);
    cout << --ans%(int)(1E9+7) << endl;
    return 0;
}

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

long long int tasu(long long int u){
    long long int a=0;
    for(int i=0;i<=u;i++){
        a+=i;
    }
    return a;
}

int main(){
    
    long long int N;
    cin>>N;
    vector<long long int> S(N+1,0);
    for(long long int i=0;i<N;i++){
        long long int a;cin>>a;
        S[i+1]=S[i]+a;
    }
    sort(S.begin(),S.end());
    long long int ans=0;
    long long int i=0;
    while(i<N){
        long long int cnt=0;
        long long int j=i+1;
        while(j<=N&&S[i]==S[j]){
            cnt++;
            j++;
        }
        ans+=tasu(cnt);
        i=j;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip> 
#include <complex> 
#include <string>
#include <vector> 
#include <list>
#include <deque> 
#include <stack> 
#include <queue> 
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm> 
#include <numeric> 
#include <typeinfo> 
#include <cstdio>
#include <cstdlib> 
#include <cstring>
#include <cmath>
#include <climits> 
#include <ctime>

using namespace std;

int main(void){
	long long int n;
	while(1){
		cin >> n;
		if(n==0)break;
		long long int ans=0;
		while(n>=5){
			ans+=n/5;
			n=n/5;
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 0
#define LOCAL

#undef _GLIBCXX_DEBUG

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

#define IOS ios::sync_with_stdio(false);cin.tie(0)
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
#define MOD 1000000007LL
#define LLINF 100000000000000005LL
#define INF (int)1e9+1

// Copied from Gennady-Korotkevich's template

template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
	return '"' + s + '"';
}

string to_string(const char* s) {
	return to_string((string)s);
}

string to_string(bool b) {
	return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
	bool first = true;
	string res = "{";
	for (int i = 0; i < static_cast<int>(v.size()); i++) {
		if (!first) {
			res += ", ";
		}
		first = false;
		res += to_string(v[i]);
	}
	res += "}\n";
	return res;
}

template <size_t N>
string to_string(bitset<N> v) {
	string res = "";
	for (size_t i = 0; i < N; i++) {
		res += static_cast<char>('0' + v[i]);
	}
	return res;
}

template <typename A>
string to_string(A v) {
	bool first = true;
	string res = "{";
	for (const auto& x : v) {
		if (!first) {
			res += ", ";
		}
		first = false;
		res += to_string(x);
	}
	res += "}\n";
	return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
	return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
	return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
	return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

template <typename A, typename B, typename C, typename D, typename E>
string to_string(tuple<A, B, C, D, E> p) {
	return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + "," + to_string(get<4>(p)) + ")";
}

void debug_out() {
	cerr << endl;
}

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
	cerr << " " << to_string(H);
	debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "\n[" << #__VA_ARGS__ << "]:\n", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

// End of Gennady-Korotkevich's template 

using llong = long long;
using PII = pair<int, int>;
using db = double;

int n;
vector<llong> a;
vector<vector<llong>> dp;

llong dfs(int first, int last) {
	llong& ret = dp[first][last];
	if (ret != INF) return ret;
	if (first == last) return ret = a[first];
	llong ret1 = a[first] - dfs(first + 1, last);
	llong ret2 = a[last] - dfs(first, last - 1);
	return ret = max(ret1, ret2);
}

int main() {
	IOS;
	cin >> n;
	a = vector<llong>(n); 
	dp = vector<vector<llong>>(n, vector<llong>(n, INF));
	for (int i = 0; i < n; i++) cin >> a[i];
	cout << dfs(0, n - 1);
}

Measured memory_bytes: 73860
w[4444][4444],b[4444][4444];
n,k;i,j,x,y,c;ans;now;f;
g(u,v,p){
return p?w[u+k][v+k]-w[u][v+k]-w[u+k][v]+w[u][v]:b[u+k][v+k]-b[u][v+k]-b[u+k][v]+b[u][v];
}
main(){
scanf("%d%d",&n,&k);
for(i=0;i<n;i++){
scanf("%d%d %c\n",&x,&y,&c);
x%=2*k,y%=2*k;x<0&&(x+=2*k);y<0&&(y+=2*k);
if(c=='W')w[x+1+k][y+1+k]++;
else b[x+1+k][y+1+k]++;
}
for(i=1;i<=4*k;i++)for(j=1;j<=4*k;j++){
w[i][j]+=w[i-1][j]+w[i][j-1]-w[i-1][j-1];
b[i][j]+=b[i-1][j]+b[i][j-1]-b[i-1][j-1];
}
for(i=0;i<k;i++)for(j=0;j<k;j++)for(f=0;f<2;f++){
now=g(i+2*k,j+2*k,f)+g(i+k,j+2*k,!f)+g(i,j+2*k,f)+g(i+2*k,j+k,!f)+g(i+k,j+k,f)+g(i,j+k,!f)+g(i+2*k,j,f)+g(i+k,j,!f)+g(i,j,f);
if(ans<now)ans=now;
}
printf("%d\n",ans);
}

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

int n;
int s[128];

int main() {
  for(;;) {
    scanf("%d", &n);
    if( n == 0 ) break;
    for(int i = 0; i < n; ++i) {
      scanf("%d", &s[i]);
    }
    std::sort(s, s + n);
    int total = 0;
    for(int i = 1; i < (n - 1); ++i) {
      total += s[i];
    }
    total /= (n - 2);
    printf("%d\n", total);
  }

  return 0;
}

Measured memory_bytes: 3292
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Iterator;


public class Main {
	//template code, C343, 2019


	static class Graph {
		int timer = 1;
		
		
		private int totalVertex;
		
		ArrayList<Integer> visitHistory = new ArrayList<Integer>();
		

		
		private LinkedList<LinkedList<Integer>> adjList;
		//adjacency list of edges
		
		public Graph() { totalVertex = 0; }
		
		public void loadAdjList() {
			
			Scanner in = new Scanner(System.in);
			totalVertex = in.nextInt();
			adjList = new LinkedList<LinkedList<Integer>>();
			
			for(int i = 0; i < totalVertex; i ++) {
				
				LinkedList<Integer> tmp = new LinkedList<Integer>();
				int idx1 = in.nextInt() - 1;
				int degree = in.nextInt();
				
				//System.out.println("mark idx1 = " + idx1 + " degree = " + degree);
				for(int j = 0; j < degree; j ++) {
					int idx2 = in.nextInt() - 1;
					tmp.add(idx2);
				}	
				
				adjList.add(tmp);
			}
			
			in.close();
		}
		
		//do an iterator
		//ID, neighbor, actual neighbors following neighbors
		public void printAdjMatrix() {
			int[][] adjMatrix = new int[totalVertex][totalVertex];
			
			Iterator<LinkedList<Integer>> iter = adjList.iterator();
			
			
			
			for(int i = 0; i < adjList.size(); i++) {
				LinkedList<Integer> currList = iter.next();
				Iterator<Integer> currListIter = currList.iterator();
				
				for(int j = 0; j < currList.size(); j++) {
					adjMatrix[i][currList.get(j)] = 1; 
				}
			}
			
			for(int k = 0; k < adjList.size(); k++) {
				for(int l = 0; l < adjList.size(); l++) {
					if(l < adjList.size()-1) {
						System.out.print(adjMatrix[k][l] + " ");
					} else if(l == adjList.size()-1) {
						System.out.print(adjMatrix[k][l]);
						System.out.println();
					}
				}
			}
		}
		
		
		
		public void DFS() {
			int[] d = new int[totalVertex];
			int[] f = new int[totalVertex];
			for(int i = 0; i < totalVertex; i++) {
				if(!visited(i)) {
					DFS(i, d, f);
				}
				System.out.println(i+1 + " " + d[i] + " " + f[i]);
			}
			
		}
		
		public void DFS(int v, int[] d, int[] f) {
			d[v] = timer++;
			
			//setVisited thingy
			visitHistory.add(v);
			
			
			LinkedList<Integer> neighbors = getNeighbors(v, adjList);
			for(int i = 0; i < neighbors.size(); i++) {
				int v1 = neighbors.get(i);
				if(visited(v1) == false) {
					DFS(v1, d, f);
				}
			}
		
			f[v] = timer++;
			
		}
		
		public boolean visited(int v) {
			if(visitHistory.contains(v)) {
				return true;
			} else if(!visitHistory.contains(v)) {
				return false;
			} else {
				return false;
			}
		}
		
		public LinkedList<Integer> getNeighbors(int v, LinkedList<LinkedList<Integer>> topList) {
			return topList.get(v);
			
			//return null;
			
		}
		
			
		
		
	}
	public static void main(String[] args) {
		Graph g = new Graph();
		g.loadAdjList();
		g.DFS();
	}

}




Measured memory_bytes: 28544
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	
	public static void main(String[] args){
		new Main();
	}
	public Main(){
		new A().doIt();
	}
	class A{
		long euclid(long a, long b){
		    long temp;

		    if(a < b) { 
		    	temp = a;
		    	a = b;
		    	b = temp;
		    }
		    if(a % b == 0) return b;
		    return euclid( b, a % b );
		}
		void doIt(){
			int n = sc.nextInt();
			long A = 1;
			long B = 1;
			for(int i = 0;i < n;i++){
				long aa = sc.nextLong();
				long bb = sc.nextLong();
				if(A % aa != 0)A = A + aa - (A % aa);
				if(B % bb != 0)B = B + bb - (B % bb);
				long max = Math.max(A/aa,B/bb);
				A = max * aa;
				B = max * bb;
//				System.out.println(A+" "+B);
			}
			System.out.println(A+B);
		}
	}
}


Measured memory_bytes: 13396
#include <stdio.h>

int main(void) {
	int N;
	char A[128], B[128], C[128];
	int i;
	int nakamayukie = 0;
	if (scanf("%d", &N) != 1) return 1;
	if (scanf("%127s", A) != 1) return 1;
	if (scanf("%127s", B) != 1) return 1;
	if (scanf("%127s", C) != 1) return 1;
	for (i = 0; i < N; i++) {
		nakamayukie += A[i] != B[i];
		nakamayukie += A[i] != C[i] && B[i] != C[i];
	}
	printf("%d\n", nakamayukie);
	return 0;
}


Measured memory_bytes: 1736
#include <iostream>
#include <vector>
#include <algorithm>

int n, m;
std::vector< std::vector<short> > table;

int calc() {
  if(m == 1)
    return 1;

  std::vector<bool> rm(m, false);
  int min = 1000;
  for(int i = 0; i < m - 1; i++) {
    std::vector<short> ranks(m, 0);
    for(int j = 0; j < n; j++) {
      int x = 0;
      while(rm[table[j][x]])
        x++;
      int best = table[j][x];
      ranks[best]++;
    }
    int max_ranked = -1;
    int max_ind = -1;
    for(int k = 0; k < m; k++) {
      if(rm[k])
        continue;
      if(max_ranked < ranks[k]) {
        max_ranked = ranks[k];
        max_ind = k;
      }
    }
    min = max_ranked < min ? max_ranked : min;
    rm[max_ind] = true;
  }

  return min;
}
 
int main() {
  std::cin >> n;
  std::cin >> m;
  table.resize(n);
  for(int i = 0; i < n; i++) {
    table[i].resize(m);
    for(int j = 0; j < m; j++) {
      int x;
      std::cin >> x;
      table[i][j] = x - 1;
    }
  }
  std::cout << calc() << "\n";
}

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

int f(int x){
    if(x == 0) return 1;
    if(x == 1) return 10;
    int ret = 1;
    ret *= f(x/2);
    ret *= ret;
    ret %= 2019;
    if(x%2) ret *= 10;
    return ret%2019;
}

int main(){
    string s; cin >> s;
    int n = s.size();
    vector<int> d(n+1);
    d[0] = 0;
    for(int i = 0; i < n; ++i){
        d[i+1] = (d[i] + f(i)*(s[n-i-1]-'0'))%2019;
    }
    map<int,int> mp;
    rep(i,n+1){
        mp[d[i]]++;
    }
    ll ans = 0;
    for(auto itr = mp.begin(); itr != mp.end(); ++itr){
        int a = itr->second;
        ans += a*(a-1)/2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4352
#include <stdio.h>
#include <stdlib.h>

int compare_int(const void *a, const void *b) {
	return *(int*)b - *(int*)a;
}

int main() {
	int N;
	scanf("%d", &N);
	int a[N];
	for (int i = 0; i < N; i++) scanf("%d", &a[i]);
	qsort(a, N, sizeof(int), compare_int);
	
	int ans = 0;
	for (int i = 0; i < N; i++) {
		if ((i % 2) == 0) ans += a[i];
		else ans -= a[i];
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define mod 1000000007
#define FT() int t; scanf("%d",&t); while(t--)
#define pb push_back
#define nl printf("\n")
#define fi(i,start,end) for(int i=start; i < (int)end ; ++i)
#define ip(n)   scanf("%d",&n)
#define mz(a)   memset(a,0,sizeof(a))
#define inpArr(A,n) fi(i,0,n)   ip(A[i]);
#define print(a)  for(auto i : a)   cout<<i<<" "; nl;
#define Fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
ll max(ll a,ll b) { return a>b?a:b;}
ll min(ll a,ll b) { return a<b?a:b;}
//std::cout << std::fixed;
//std::cout << std::setprecision(6);
int main() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    #endif
    
    string s,t;
    cin>>s>>t;
    int n = s.length();
    int c=0;
    fi(i,0,n)
    {
      c+=(s[i]!=t[i]);
    }
    cout<<c;
    

    #ifndef ONLINE_JUDGE
    cout<<"\nTime Elapsed : " << 1.0*clock() / CLOCKS_PER_SEC << " s";
    #endif
    
    return 0;
}


Measured memory_bytes: 3852
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

// *: ab = gcd(a,b) * lcm(a,b)

ll gcd(ll a, ll b)
{
	if (b == 0)
	{
		return a;
	}

	return gcd(b, a % b);
}

ll lcm(ll a, ll b)
{
	ll g = gcd(a, b);
	return a / g * b;
}

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

	int N;
	
	cin >> N;

	ll T[N];
	ll ans = 1LL;
	rep(i, N)
	{
		cin >> T[i];
		ans = lcm(ans, T[i]);
	}

	cout << ans << endl;

	
	return 0;
}


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


int main(){
    
    int n,ans=0;
    cin >> n;
    vector<char> s(n);
    for(int i=0;i<n;i++){
        cin >> s.at(i);
    }
    int b=0;
    for(int i=0;i<n;i++){

        if(b==0){
            if(s.at(i)=='A'){b=1;}
        }else if(b==1){
            if(s.at(i)=='B'){b=2;}else{b=0;if(s.at(i)=='A'){b=1;}}
        }else if(b==2){
            if(s.at(i)=='C'){ans++;b=0;}else{b=0;if(s.at(i)=='A'){b=1;}}
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
using System;

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine();
        var num = 0;
        for(var i = 0; i < input.Length; i++)
        {
            if (input.Substring(i, 1) == "+") num++;
            else num--;
        }
        Console.WriteLine(num);
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <set>
#include <cassert>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <map>

using namespace std;

int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	const int64_t MOD = 1000000007;
	//vector<vector<int64_t>> cnt(2*n + 1, vector<int64_t>(n+1,0));
	vector<int64_t> cnt(2*n+1,0);
	cnt[0] = 1;
	int64_t cont = 0;
	//cnt[0][0] = 1;
	for (int i = 0; i < 2*n; ++i) {
		char cc = s[i];
		int c = 0;
		if (cc == 'W') {
			c = 0;
		}
		else {
			c = 1;
		}
		int64_t j = cont;
		if (c == j % 2) {
			// close
			if (j > 0) {
				cnt[i + 1] += cnt[i] * j;
				cnt[i + 1] %=MOD;
				cont -= 1;
			}
			else {
				cout << 0 << endl;
				return 0;
			}
		}
		else {
			// open
			if (j < n) {
				cnt[i + 1] += cnt[i];
				cnt[i + 1] %= MOD;
				cont += 1;
			}
			else {
				cout << 0 << endl;
				return 0;
			}
		}
	}
	if (cont != 0) {
		cout << 0 << endl;
		return 0;
	}
	int64_t ord = cnt[2*n];
	for (int i = 1; i <= n; i++) {
		ord *= i;
		ord %= MOD;
	}
	cout << ord << endl;
}

Measured memory_bytes: 2180
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	string s; cin>>s;
	int ct[3]={};
	for(int i=0; i<s.size(); i++) ct[s[i]-'a']++;
	sort(ct, ct+3);
	if(ct[2]-ct[0]<=1) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 512
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
	
def main():
	N = int(input())
	A = list(map(int, input().split(" ")))
	
	L = []
	for i, val in enumerate(A):
		if i == 0:
			L.append(val)
			continue
		tmp = gcd(val, L[i-1])
		L.append(tmp)
		
	R = []
	for i, val in enumerate(reversed(A)):
		if i == 0:
			R.append(val)
			continue
		tmp = gcd(val, R[i-1])
		R.append(tmp)
		
	ans = 0
	for i, val in enumerate(A):
		if i == 0:
			tmp = R[len(A)-2]
		elif i == len(A)-1:
			tmp = L[len(A)-2]
		else:
			tmp = gcd(L[i-1], R[len(A)-i-2])
			
		if tmp > ans:
			ans = tmp
		
	print(ans)
	
def gcd(a, b):
	if a > b:
		a, b = b, a
		
	while a > 0:
		a, b = b % a, a
	return b
	
if __name__ == "__main__":
	main()


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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;

const int INF = 1e9;
const ld EPS = 1e-8;

int main(){
  int N, L;
  cin >> N >> L;
  vector<string> S(N);
  REP(i,N) cin >> S[i];
  sort(ALL(S));
  string res;
  REP(i,N) res += S[i];
  cout << res << endl;
  return 0;
}



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

//C++14 (GCC 5.4.1)

#define LLINF (1LL<<60)
typedef long long ll;
#define mod 1000000007

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define rrepd(i,a,b) for(int i=(a);i>=(b);i--)

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

template<typename T> inline T divrup(T a, T b) { if (a % b) return a/b+1; else return a/b;}

#define dbg_v1(i,V) do{cout<<"-v1----\n";rep(i,V.size())cout<<" "<<i<<"\t:"<<V[i]<<endl;cout<<endl;}while(0)
#define dbg_v2(i,k,V) do{cout<<"-v2----\n";rep(i,V.size()){rep(k,V[0].size())cout<<" "<<V[i][k];cout<<endl;}}while(0)

int main() {
    ios::sync_with_stdio(false);//stdoutとcoutの同期解除
    cin.tie(nullptr);//cinとcoutの同期解除
    
    double W,H,x,y;
    cin >>W>>H>>x>>y;

    //-----------------------------------
    double ans=(W*H)/2;
    bool is=(y==H/2 && x==W/2 );

    printf("%f %d",ans,(is)? 1 : 0);
    return (0);
}

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

int main()
{
  int a,b,c; cin >> a >> b >> c;
  if (a+b+1 >= c) 
  {
    cout << b + c << endl;
  }
  else
  {
    cout << b + a + b + 1 << endl;
  }
}


Measured memory_bytes: 3632
package main

import (
	"fmt"
	"math"
	"sort"
)

type item struct {
	weight int
	value int
}

func main() {
	var N, W int
	_, _ = fmt.Scan(&N, &W)
	items := make([]item, N)
	for i := 0; i < N; i++{
		_, _ = fmt.Scan(&items[i].weight, &items[i].value)
	}
	C := make([][]int, 4)
	base := items[0].weight
	for i := 0; i < N; i++ {
		C[items[i].weight-base] = append(C[items[i].weight-base], items[i].value)
	}
	for i := 0; i < 4; i++ {
		if C[i] == nil {
			C[i] = append(C[i], 0)
		} else {
			C[i] = append(C[i], C[i][0])
			C[i][0] = 0
			sort.Sort(sort.Reverse(sort.IntSlice(C[i][1:])))
			for j := 1; j < len(C[i]); j++ {
				C[i][j] += C[i][j-1]
			}
		}
	}
	ans := 0
	for i := 0; i < len(C[0]); i++ {
		for j := 0; j < len(C[1]); j++ {
			for k := 0; k < len(C[2]); k++ {
				cost := int64(i)*int64(base+0)+int64(j)*int64(base+1)+int64(k)*int64(base+2)
				if cost <= int64(W) {
					ans = max(ans, C[0][i]+C[1][j]+C[2][k]+C[3][min((W-int(cost))/(base+3), len(C[3])-1)])
				}
			}
		}
	}
	fmt.Printf("%d\n", ans)
}

func min(nums ...int) int {
	res := float64(nums[0])
	for i := 1; i < len(nums); i++ {
		res = math.Min(res, float64(nums[i]))
	}
	return int(res)
}

func max(nums ...int) int {
	res := float64(nums[0])
	for i := 1; i < len(nums); i++ {
		res = math.Max(res, float64(nums[i]))
	}
	return int(res)
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <numeric>

int main(int argc, char const *argv[]) {

    int N,K;
    std::cin >> N >> K;

    std::vector<int> snake_bodys;
    for(int times = 0 ; times < N ; times++ )
    {
        int snake_body_length;
        std::cin >> snake_body_length;
        snake_bodys.push_back(snake_body_length);
    }

    std::sort(snake_bodys.begin(),snake_bodys.end(),std::greater<int>());

    int snake_length = 0;
    snake_length = std::accumulate(snake_bodys.begin(), snake_bodys.begin()+K,0);

    std::cout << snake_length << '\n';

    return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <string>

using namespace std;

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;

    string ans;
    if (A + B > C + D) ans = "Left";
    else if (A + B == C + D) ans = "Balanced";
    else ans = "Right";

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

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 # 998244353
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    A=list(map(int,input().split()))
    A.sort()
    print("YES" if(A==[1,4,7,9]) else "NO")
resolve()

Measured memory_bytes: 38256
#include "bits/stdc++.h"
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;++i)
#define END(x) (*(x.end()-1))
#define INF INT_MAX/2

using namespace std;
typedef long long ll;


template<typename T>
T gcd(T a, T b){
   if (a%b == 0){
       return(b);
   }
   else{
       return(gcd(b, a%b));
   }
}

template<typename T>
T lcm(T a,T b){
    return a/gcd(a,b)/b;
}

int main(void){
    ll N,K;
    cin>>N>>K;
    vector<ll>H(N);
    rep(i,N){
        cin>>H[i];
    }
    sort(ALL(H));
    ll ans=0;
    rep(i,N-K){
        ans+=H[i];
    }
    cout<<ans;
}
/*

*/

Measured memory_bytes: 1920
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define rep(i, n) for (long long i = 0; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<string, ll>;

void vprint(vector<P>);

int main() {
  ll N, u, now = 0;
  cin >> N >> u;
  vector<P> process(N, P("", 0));
  vector<P> answers;
  rep(i, N) cin >> process[i].first >> process[i].second;

  queue<P> q;
  rep(i, N) q.push(process[i]);

  while (q.size() != 0) {
    P tmp = q.front();
    q.pop();

    if (tmp.second - u > 0) {
      tmp.second -= u;
      now += u;
      q.push(tmp);
    }
    else if (tmp.second - u <= 0) {
      now += tmp.second;
      answers.push_back(P(tmp.first, now));
    }
  }

  rep(i, N) cout << answers[i].first << " " << answers[i].second << endl;
  return 0;
}

void vprint(vector<P> x) {
  rep(i, x.size()) {
    cout << x[i].first << " " << x[i].second << " || ";
  }
  cout << endl;
}



Measured memory_bytes: 7832
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
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;
}

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
int N;
char c[4005];
int a[4005];
int black[4005][2002];
int white[4005][2002];
int dp[2005][2005];
int pos[2005][2];

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    for(int i = 1; i <= 2 * N; i++) {
        cin >> c[i] >> a[i];
        if(c[i] == 'B') pos[a[i]][0] = i;
        else pos[a[i]][1] = i;
    }
    for(int val = 0; val <= N + 1; val++) {
        for(int index = 1; index <= 2 * N; index++) {
            black[index][val] = black[index-1][val];
            white[index][val] = white[index-1][val];
            if(val <= a[index]) {
                if(c[index] == 'W') white[index][val]++;
                else black[index][val]++;
            }
        }
    }
    int inv = 0;
    for(int i = 1; i <= 2 * N; i++) {
        if(c[i] == 'W') inv += white[i-1][a[i]];
        if(c[i] == 'B') inv += black[i-1][a[i]];
    }
    cerr << inv << endl;
    for(int w = 0; w <= N; w++) {
        for(int b = 0; b <= N; b++) {
            if(w == 0 && b == 0) continue;
            dp[w][b] = 1e9;
            if(w > 0) chmin(dp[w][b], dp[w-1][b] + (black[pos[w][1]-1][b+1]));
            if(b > 0) chmin(dp[w][b], dp[w][b-1] + (white[pos[b][0]-1][w+1]));
            //cerr << w << " " << b << " " << dp[w][b] << endl;
        }
    }
    cout << inv + dp[N][N] << endl;
    return 0;
}

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

int top,s[1000];

void push(int x){
  s[++top]=x;
}

int pop(){
  top--;
  return s[top+1];
}

int main(){
  int a,b;
  top=0;
  char s[100];

  while( scanf("%s",s) != EOF){
    if(s[0] == '+'){
      a=pop();
      b=pop();
      push(a+b);
    }else if(s[0]=='-'){
      b=pop();
      a=pop();
      push(a-b);
    }else if(s[0]=='*'){
      a=pop();
      b=pop();
      push(a*b);
    }else {
      push(atoi(s));
    }
  }
  printf("%d\n",pop());

  return 0;
}



Measured memory_bytes: 2104
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()


using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;

int n, m, sum, a[105];

int main(void) {
    cin >> n >> m;
    rep(i, 0, n) {
        cin >> a[i];
        sum += a[i];
    }
    sort(a, a+n, greater<int>());

    int c = 0;
    rep(i, 0, n) {
        if (a[i]*4*m>=sum) c++;
    }
    

    if (c>=m) cout << "Yes" << endl;
    else cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 256
n = int(input())
a = [int(i) for i in input().split(" ")]

def count_two(n):
    r = 0
    while n % 2 == 0:
        n = n // 2
        r += 1
    return r

s = 0
for i in range(0, n):
    s += count_two(a[i])
    
print(s)

Measured memory_bytes: 4152
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		int n = s.length();
		for (int i = 1; i <= n; i++) {
			if ((i % 2 == 1 && s.charAt(i - 1) == 'L') || (i % 2 == 0 && s.charAt(i - 1) == 'R')) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}

}


Measured memory_bytes: 23636
function Main(input) {
	var studentsN = parseInt(input)
	console.log(Math.floor(studentsN / 3))
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 22076