akhauriyash/Code-Regression huggingface dataset:
/**********************************************************************************************
******************************AUTHOR:**********************************************************
****************************ASHISH RANJAN******************************************************
***********************************************************************************************/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<chrono>
#include<vector>
#include<string>
#include<cstring>
using namespace std;
using namespace std::chrono;
/*
auto start = high_resolution_clock::now();
auto stop = high_resolution_clock::now();
  auto duration = duration_cast<microseconds>(stop - start); 
  
    cout << "Time taken by function: "
         << duration.count() << " microseconds" << endl;
*/
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll long long
#define mod 1000000007
#define fr(i,n) for(int i=0;i<(int)n;i++)
#define frs(i,a,b) for(int i = a;i<b;i++)
#define meme(a,b,c) memset(a,b,sizeof(c)); //works only for 0 and -1
int main(){
  fast();
  int a,b,h;
  cin>>a>>b>>h;
  cout<<(h*(a+b))/2;
 return 0;
  
}


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

int main() {
    ll a;
    double b;
    cin >> a >> b;
    int ib = b*100 + 0.5;
    a *= ib;
    a /= 100;
    cout << a << endl;
}

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

ll N, M;
ll dels=-1, delt=-1;

double updatedp(vector<vector<ll>> &g,vector<double> &dp,ll v){
	if(v==N-1)return 0.;
	if(dp[v]>-0.1)return dp[v];
	double ans=0.;
	ll gvsize=g[v].size();
	for(ll nextv:g[v]){	
		if(v==dels && nextv==delt){
			gvsize--;
			continue;
		}
		ans+=updatedp(g,dp,nextv);
	}
	return dp[v]=1.+ans/gvsize;
}

signed main() {
  	scanf("%lld%lld", &N, &M);
	vector<vector<ll>> g(N);
	for(ll i=0;i<M;i++){
		ll s,t;
		scanf("%lld%lld", &s, &t);
		s--;t--;
		g[s].push_back(t);
	}

	vector<double> dptmp(N,-1.);
	double ans=updatedp(g,dptmp,0);

	vector<pair<ll,ll>> delpath;
	for(ll v=0;v<N;v++){
		if(g[v].size()==1)continue;
		double maxval=0.;
		ll tmps=-1,tmpt=-1;
		for(ll nextv:g[v]){
			if(maxval<dptmp[nextv]){
				maxval=dptmp[nextv];
				tmps=v;
				tmpt=nextv;
			}
		}
		delpath.push_back({tmps,tmpt});
	}

	for(pair<ll,ll> path:delpath){
		dels=path.first,delt=path.second;
		vector<double> dp(N,-1.);
		double tmp=updatedp(g,dp,0);
		ans=min(ans,tmp);
	}

	printf("%.20f\n", ans);
	return 0;
}


Measured memory_bytes: 2560
/***************************************************
 * Problem Name : A.cpp
 * Problem Link :
 * OJ           :
 * Verdict      : Trying
 * Date         : 2019-12-22
 * Problem Type :
 * Author Name  : Saikat Sharma
 * University   : CSE, MBSTU
 ***************************************************/
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <list>
#include <unordered_map>
#include <unordered_set>
#include <cstdlib>
#include <deque>
#include <stack>
#include <bitset>
#include <cassert>
#include <map>
#include <set>
#include <cassert>
#include <iomanip>
#include <random>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;

#define __FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define __FileRead freopen ("input.txt", "r", stdin)
#define __FileWrite freopen ("output.txt", "w", stdout)
#define SET(a,v) memset(a,v,sizeof(a))
#define SZ(v) (int)v.size()
#define pii pair<int,int>
#define pil pair <int, ll>
#define pli pair <ll, int>
#define pll pair <ll, ll>
#define debug cout <<"######\n"
#define debug1(x) cout <<"### " << x << " ###\n"
#define debug2(x,y) cout <<"# " << x <<" : "<< y <<" #\n"
#define nl cout << "\n";
#define sp cout << " ";
#define sl(n) scanf("%lld", &n)
#define sf(n) scanf("%lf", &n)
#define si(n) scanf("%d", &n)
#define ss(n) scanf("%s", n)
#define pf(n) scanf("%d", n)
#define pfl(n) scanf("%lld", n)
#define all(v) v.begin(), v.end()
#define rall(v) v.begin(), v.end()
#define srt(v) sort(v.begin(), v.end())
#define r_srt(v) sort(v.rbegin(), v.rend())
#define rev(v) reverse(v.begin(), v.end())
#define Sqr(x) ((x)*(x))
#define Mod(x, m) ((((x) % (m)) + (m)) % (m))
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define pb push_back
#define mk make_pair
#define MAX 100005
#define INF 1000000009
#define MOD 1000000007

template<class T>
using min_heap = priority_queue<T, std::vector<T>, std::greater<T>>;
template<typename T>
using ordered_set  = tree<T, null_type, less<T>, rb_tree_tag,
      tree_order_statistics_node_update>;

template <typename T> string toString ( T Number ) {
    stringstream ss;
    ss << Number;
    return ss.str();
}
template<typename T> int toInt (T str) {
    stringstream ss;
    ss << str;
    int num;
    ss >> num;
    return num;
}
ll lcm (ll a, ll b) {
    return a * b / __gcd (a, b);
}
/************************************ Code Start Here ******************************************************/
int main () {
    //~ __FastIO;
    //~ cout << setprecision (10);
    //~ cout << fixed;
    int a, b;
    cin >> a >> b;

    if (a == 1) {
        if ( b == 2) cout << "3\n";
        else cout << 2 << "\n";

    } else if (a == 2) {
        if ( b == 1) cout << "3\n";
        else cout << 1 << "\n";

    } else {
        if ( b == 2) cout << "1\n";
        else cout << 2 << "\n";
    }

    return 0;
}


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

int main()
{
 int  i,j, k = 0;
 int a[100];
 
 cin >> j;

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

 for (i = 0; i < j; i++) {
	 if (a[i] % 2 == 0) {
		 if (a[i] % 3 == 0 || a[i] % 5 == 0) {

		 }
		 else { 
			 k = k + 1;
			  }

		 }
	 }
 
 if (k != 0) {
	 cout << "DENIED";
 }
 else {
	 cout << "APPROVED";
 }

}


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

#define REP(i, n) for (int i=0;i<int(n);++i)
#define FOR(i, a, b) for (int i=int(a);i<int(b);++i)
#define EACH(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

struct HeavyLight {
  vector<vector<int> > len, tree;
  int pathCount,n;
  vector<int>size,parent,in,out,path,pathSize,pathPos,pathRoot;

  HeavyLight(vector<vector<int> >tree)
    :tree(tree),n(tree.size()),size(n),parent(n),in(n),out(n),
     path(n),pathSize(n),pathPos(n),pathRoot(n){
    int time=0;
    dfs(0,-1,time);
    buildPaths(0,newPath(0));
    //cout << "Path Count = " << pathCount << "\n";
    len=vector<vector<int> >(pathCount);
    /*
    REP(i,pathCount){
      int m=pathSize[i];
      len[i].resize(2*m);
      fill(ALL(len[i]),0);
      fill(len[i].begin()+m,len[i].begin()+2*m,1);
      for(int j=2*m-1;j>1;j-=2)len[i][j>>1]=len[i][j]+len[i][j^1];
    }
    */
  }

  void dfs(int u, int p, int &k){
    in[u]=k++, parent[u]=p, size[u]=1;
    EACH(v,tree[u])if(*v!=p)dfs(*v, u, k),size[u]+=size[*v];
    out[u]=k++;
  }

  int newPath(int u){ pathRoot[pathCount]=u; return pathCount++; }

  void buildPaths(int u, int pt){
    path[u]=pt, pathPos[u]=pathSize[pt]++;
    EACH(v,tree[u])if(*v != parent[u])
      buildPaths(*v, 2*size[*v] >= size[u] ? pt : newPath(*v));
  }

  bool isAncestor(int p, int ch){
    return in[p] <= in[ch] && out[ch] <= out[p];
  }

  int lca(int a,int b){
    for(int root; !isAncestor(root=pathRoot[path[a]],b);a=parent[root]);
    for(int root; !isAncestor(root=pathRoot[path[b]],a);b=parent[root]);
    return isAncestor(a,b)?a:b;
  }
};


int main(void){
  ios::sync_with_stdio(false);

  int n;
  cin >> n;
  vector<vector<int> >tree(n);
  
  REP(i,n){
    int k;
    cin >> k;
    REP(j,k){
      int ch;
      cin >> ch;
      tree[i].push_back(ch);
    }
  }

  HeavyLight hl = HeavyLight(tree);

  int q;
  cin >> q;
  while(q--){
    int u,v;
    cin >> u >> v;
    cout << hl.lca(u,v) << "\n";
  }
  
  return 0;
}

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

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n,cnt = 0;
    double ans ;
    cin >> n;
    for(int i = 1;i <= n; ++i){
        if(i&1) cnt++;
    }
    ans = (1.0*cnt) / n;
    cout << ans ;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
struct Edge
{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w) {}
};
// using Graph = vector<vector<Edge>>;
using Graph = vector<vector<int>>;

const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

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

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N, D;
  cin >> N >> D;
  ll D_squared = D * D;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    ll X, Y;
    cin >> X >> Y;
    ll dist = X * X + Y * Y;
    if (dist <= D_squared)
      ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3688
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)

int main() {

	string s;
	cin >> s;

	int cnt = 0;
	char p;
	rep(i, 0, s.length()) {
		if (i == 0) p = s[i];
		if (p != s[i]) {
			cnt++;
			p = s[i];
		}
	}
	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 512
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("O2")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
////
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
#include <bits/stdc++.h>

#define all(x) (x).begin(), (x).end()
#define allp(x) (x)->begin(), (x)->end()

#define pb push_back


using namespace std;
void dout() { cerr << endl; }
//typedef long long ll;
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

using ll = long long;
//#ifdef __int128
//using hll = __int128;
//#endif
using pii = pair<ll, ll>;
using ld = long double;
using pll = pair<long long, long long>;

template <typename T>
void do_uniq(vector<T> vec){
    sort(all(vec));
    vec.resize(unique(all(vec)) - vec.begin());
}

clock_t timestamp_start = clock();
void time_calc()
{
    cerr << (ld)(clock() - timestamp_start) / CLOCKS_PER_SEC << "\n";
}


#ifdef _getchar_nolock
#else
#define _getchar_nolock getchar_unlocked
#endif

//#define solvsh
//#define multi

#ifdef solvsh
#else

ll mod = 1e9 + 7;

ll add(ll a, ll b){
    return (a + b) % mod;
}
ll ml(ll a, ll b) {
    return (a * b) % mod;
}

ll b_p(ll b, ll p) {
    if (p == 0) return 1;
    if (p & 1) return ml(b, b_p(b, p ^ 1));
    ll v = b_p(b, p >> 1);
    return ml(v, v);
}

const int MAXN = 1e4 + 25;

ll sub(ll a, ll b) {
    return add(a, mod - b);
}

void solve() {

    int n;

    cin >> n;

    if (n == 1) {
        cout << 0;
        return;
    }

    ll answr = b_p(10, n);

    answr = sub(answr, b_p(9, n));
    answr = sub(answr, b_p(9, n));
    answr = add(answr, b_p(8, n));

    cout << answr;
}

#endif

void multisolve() {
    int t;
    cin >> t;

    int i = 1;
    while (t--) {
        solve();
        i++;
    }
}

#define int int
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    cout << fixed << setprecision(20);

#ifndef ONLINE_JUDGE
#else
#endif
#ifdef multi
    //        gen();
    multisolve();
#else
    solve();
//    gen();
#endif
//    time_calc();
}


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

ll mod = 1000000007;
ll ans = 1<<29;

int main() {
    string a,b,c;
    cin >> a >>b >>c;
    if(a[a.size()-1]==b[0]&&b[b.size()-1]==c[0])cout<< "YES" <<endl;
    else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools
from math import factorial
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    n, p = LI()
    a = LI()
    odd = sum(map(lambda x: x & 1, a))
    even = sum(map(lambda x: (x ^ 1) & 1, a))
    t0 = 0
    t1 = 0
    for i in range(0, odd + 1, 2):
        a = factorial(odd)
        b = factorial(i)
        c = factorial(odd - i)
        t0 += a // b // c
    for i in range(1, odd + 1, 2):
        a = factorial(odd)
        b = factorial(i)
        c = factorial(odd - i)
        t1 += a // b // c
    print(2 ** even * t1 if p else 2 ** even * t0)
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 38768
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);

        final long l = sc.nextLong();
        final long r = sc.nextLong();

        long ans = Long.MAX_VALUE;

        if (r - l >= 2020) {
            ans = 0;
        } else {
            for (long i = l; i <= r; i++) {
                for (long j = l; j <= r; j++) {
                    if (i == j) continue;
                    ans = Math.min(ans, (i*j) % 2019);
                }
            }
        }

        System.out.println(ans);
    }
}


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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main() {
  int n ;
  cin >> n ;
  cout << (n+1)/2;


}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }     //最小公倍数
using Graph = vector<vector<ll>>;
ll inf=300000000000000000;
const double PI = 3.14159265358979323846;
int main(){
  int n;
  cin >> n;
  char c[2*n][2*n];
  rep(i,n){
    string s;
    cin >> s;
    rep(j,n){
      char e=s[j];
      c[i][j]=e;
      c[n+i][j]=e;
      c[i][j+n]=e;
      c[n+i][j+n]=e;
    }
  }
  int ans=0;
  rep(i,n){
    int u=0;
    rep(j,n)rep(o,n)if(c[j][o+i]==c[o][j+i])u++;
    if(u==n*n)ans=ans+n;
  }
  cout << ans << endl;
}   


Measured memory_bytes: 640
#include<iostream>
#include<set>
#include <bitset>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include <cstdio>
#include<algorithm>
#include <sstream>
#include<string>
#include<string.h>
#include <cmath>
#include <iomanip>
#include <string>
#include<list>
#include <limits>
#include <numeric>
#include <type_traits>
#include<bitset>
#define int long long
#define ll long long
#define mod  1000000007
#define inf 1e17
#define rep(i,j,n) for(int i=j;i<n;i++)
#define P pair<int,int>
double pi = 3.141592653589793;
using namespace std;
//ここから始めよう
int a[114514];
int n;  int b[114514]={};
int bit[1000010];
void add(int a, int w) {
    //cout<<67<<endl;
    for (int x = a; x <= n; x += x & -x) {
        bit[x] += w;
    }
}
int sum(int a) {
    int ret = 0;
    //cout<<45<<endl;
    for (int x = a; x > 0; x -= x & -x) ret += bit[x];
    return ret;
}
int solve(int k){
    int s[114514];
    int mini=0, maxi=0;
    rep(i,0,1000000){
        bit[i]=0;
    }
    //cout<<3<<endl;
    s[0]=1;
    rep(i,1,n+1){
        if(a[i-1]<=k)s[i]=s[i-1]+1;
        else s[i]=s[i-1]-1;
        mini=min(mini,s[i]);maxi=max(maxi,s[i]);
    }
    int rec=0;
    //cout<<3<<endl;
    rep(i,0,n+1){
        if(i==0)add(-mini+1,1);
        else {
            rec+=sum(s[i]-mini);
            add(s[i]-mini+1,1);
        }
        //cout<<3<<endl;
    }
    //cout<<3<<endl;
    return rec-1;
}
signed main(){
    cin>>n;
    rep(i,0,n){
        cin>>a[i];  b[i]=a[i];
    }
    sort(b,b+n);
    int sum=n*(n-1)/2+n;
    int l=-1,r=n-1;
    while(r-l>1){
        int mid=(l+r)/2;
        int h=solve(b[mid]);
        if(h>sum/2)r=mid;
        else l=mid;
        //cout<<l<<" "<<r<<" "<<h<<endl;
    }
    cout<<b[r]<<endl;
    return 0;
}

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


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

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

priority_queue<int> A;
int N;
int M;

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

    cin >> N >> M;

    int temp;
    rep(i, N)
    {
        cin >> temp;
        A.push(temp);
    }

    int m = 0;
    while (m < M)
    {
        temp = A.top();
        if (temp == 0)
        {
            break;
        }
        else
        {
            A.pop();
            A.push(temp / 2);
            ++m;
        }
    }

    u64 ret = 0;
    while(!A.empty())
    {
        ret += A.top();
        A.pop();
    }

    cout << ret << "\n";

    return 0;
}



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

using namespace std;

bool prime[55556];

int main(int argc, char *argv[]) {
	int N;
	cin >> N;

	fill(begin(prime), end(prime), true);
	prime[0] = prime[1] = false;
	for (int i = 2; i < 236; i++) {
		if (!prime[i]) continue;
		for (int j = i + i; j < 55556; j += i)
			prime[j] = false;
	}

	vector<int> ans;
	for (int i = 2; i < 55536 && ans.size() < N; i += 5)
		if (prime[i])
			ans.push_back(i);

	for (auto n : ans)
		cout << n << " ";
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
 
public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        String[] number = line.split(" ");
        int n = Integer.parseInt(number[1] + number[2]);
        if(n % 4 == 0) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}

Measured memory_bytes: 23124
#include <algorithm>
#include <functional>
#include <iostream>
#include <vector>

int main() {
  int x, y;
  int a, b, c;
  std::cin >> x >> y;
  std::cin >> a >> b >> c;
  std::vector<long long> p(a), q(b), r(c);
  for (int i = 0; i < a; ++i)
    std::cin >> p[i];
  for (int i = 0; i < b; ++i)
    std::cin >> q[i];
  for (int i = 0; i < c; ++i)
    std::cin >> r[i];

  std::vector<std::pair<long long, int>> v;
  for (int i = 0; i < a; ++i)
    v.push_back(std::make_pair(p[i], 0));
  for (int i = 0; i < b; ++i)
    v.push_back(std::make_pair(q[i], 1));
  for (int i = 0; i < c; ++i)
    v.push_back(std::make_pair(r[i], 2));

  std::sort(v.begin(), v.end(), std::greater<std::pair<long long, int>>());

  int rem = x + y;
  int rem0 = x;
  int rem1 = y;
  long long res = 0;
  for (auto &val : v) {
    long long w = val.first;
    long long c = val.second;

    if (c == 0 && rem0 > 0) {
      res += w;
      rem0 -= 1;
      rem -= 1;
    }
    if (c == 1 && rem1 > 0) {
      res += w;
      rem1 -= 1;
      rem -= 1;
    }
    if (c == 2) {
      res += w;
      rem -= 1;
    }

    if (rem == 0)
      break;
  }
  std::cout << res << std::endl;
}


Measured memory_bytes: 14016
alphabet_list = [chr(ord('a')+i) for i in range(26)]
alphabet_string = ''.join(alphabet_list)
s = input()
for i in s:
    alphabet_string = alphabet_string.replace(i, '')
if len(alphabet_string) != 0:
    print(alphabet_string[0])
else:
    print('None')

Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size()) //unsignedのサイズをint型に変換
#define dump(x)  cerr << #x << " = " << (x) << endl;

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

 
int choice69(int n, int res)
{
	int ans = 0;
	while(n/res)
	{
		ans++;
		n = n/res;
	}
	return ans;
}


//ここから書き始める
int main(int argc, char const *argv[])
{
	int N;
	cin >> N;

	int memo[N+1];
	memo[0] = 0;
	memo[1] = 1;

	FOR(i,2,N+1)
	{
		//dump(i)
		int k_max6 = choice69(i,6);
		int k_max9 = choice69(i,9);

		int res = memo[i-1] + 1;

		FOR(j,1,k_max6+1)
		{
			int choice = pow(6,j);
			int kouho = memo[i-choice] + 1;
			if(res > kouho) res = kouho;

		}

		FOR(j,1, k_max9+1)
		{
			int choice = pow(9,j);
			int kouho = memo[i-choice] + 1;
			if(res > kouho) res = kouho;

		}
		//dump(res)

		memo[i] = res;

	}
	cout << memo[N] << endl;



}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] array = new int[N];
		for(int i = 0; i < N; i++) {
			array[i] = sc.nextInt();
		}

		// Gは狭めていく挿入ソートの間隔を要素として持つ配列
		int[] G = new int[15];
		int m = 0;
		for(int i = 1; i <= N; i = i*3+1) {
			G[m] = i;  //シェルソートの幅はこれが良いとされているらしい
			m++;
		}

		// 出力
		System.out.println(m);
		System.out.print(G[m-1]);
		for(int i = m-2; i >= 0; i--) {
			System.out.print(" " + G[i]);
		}
		System.out.println();
		System.out.println(shellSort(array, N, m, G));
		for(int i = 0; i < N; i++) {
			System.out.println(array[i]);
		}

		sc.close();
	}

	// 一定間隔gごとに挿入ソート
	private static int insertionSort(int[] a, int n, int g) {
		int cnt = 0;
		for(int i = g; i < n; i++) {
			int v = a[i];
			int j = i - g;
			while(j >= 0 && a[j] > v) {
				a[j+g] = a[j];
				j = j - g;
				cnt++;
			}
			a[j+g] = v;
		}
		return cnt;
	}

	public static int shellSort(int[] a, int n, int m, int[] G) {
		int cnt = 0;
		for(int i = m-1; i >= 0; i--) {
			cnt += insertionSort(a, n, G[i]);
		}
		return cnt;
	}
}


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

int main(){
    int n, d;
    cin >> n >> d;
    int now = n;
    int cnt = 0;
    for (int i = 0; i < n; ++i){
        now -= 2*d+1;
        cnt+=1;
        if (now<=0){
            break;
        }
    }
    cout << cnt << endl;
}

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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<double> x(n), y(n);
  for (int i = 0; i < n; ++i) {
    cin >> x[i] >> y[i];
  }
  auto d = [&](double cx, double cy) {
    double res = 0;
    for (int i = 0; i < n; ++i) {
      res = max(res, hypot(x[i] - cx, y[i] - cy));
    }
    return res;
  };
  auto fn = [&](double a) {
    double ly = 0, ry = 1000;
    for (int _ = 100; _--; ) {
      double mly = (2 * ly + ry) / 3, mry = (ly + 2 * ry) / 3;
      if (d(a, mly) < d(a, mry)) {
        ry = mry;
      } else {
        ly = mly;
      }
    }
    return d(a, ly);
  };
  double lx = 0, rx = 1000;
  for (int _ = 100; _--; ) {
    double mlx = (2 * lx + rx) / 3, mrx = (lx + 2 * rx) / 3;
    if (fn(mlx) < fn(mrx)) {
      rx = mrx;
    } else {
      lx = mlx;
    }
  }
  cout << fixed << setprecision(20);
  cout << fn(lx) << '\n';
}


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

struct UnionFind {
    vector<int64_t> par;
    vector<int64_t> count;
    
    UnionFind (int64_t n): par(n+1), count(n+1) {
        for ( int64_t i = 0; i < n; ++i){
            par[i] = i;
            count[i] = 1;
        }
    }
    
    int64_t root (int64_t x){
        if (par[x] == x){
            return x;
        } else {
            return par[x] = root(par[x]);
        }
    }
    
    void unite (int64_t x, int64_t y){
        int64_t rx = root(x);
        int64_t ry = root(y);
        if ( rx == ry ) return;
        if ( rx > ry ){
            count[rx] += count[ry];
            par[ry] = rx;
        } else {
            count[ry] += count[rx];
            par[rx] = ry;
        }
    }
    
    bool same ( int64_t x, int64_t y){
        int64_t rx = root(x);
        int64_t ry = root(y);
        return rx == ry;
    }
    
    int64_t size ( int64_t x ){
        return count[root(x)];
    }
};

int main(){
    int64_t N, M, K;
    cin >> N >> M >> K;
    
    vector<int64_t> A(M), B(M), C(K), D(K);
    int64_t x,y;
    for ( int64_t i = 0; i < M; ++i){
        cin >> x >> y;
        A.at(i) = x - 1;
        B.at(i) = y - 1;
    }
    for ( int64_t i = 0; i < K; ++i){
        cin >> x >> y;
        C.at(i) = x - 1;
        D.at(i) = y - 1;
    }
    
    UnionFind tree(N);
    
    for ( int64_t i = 0; i < M; ++i){
        tree.unite(A.at(i), B.at(i));
    }
    
    vector<set<int64_t>> forb(N);
    
    for ( int64_t i = 0; i < M; ++i){
        int64_t a,b;
        a = A.at(i); b = B.at(i);
        forb[a].insert(b);
        forb[b].insert(a);
    }
    for ( int64_t i = 0; i < K; ++i){
        int64_t c,d;
        c = C.at(i); d = D.at(i);
        if ( tree.same(c,d) ){
            forb[c].insert(d);
            forb[d].insert(c);
        }
    }
    
    int64_t ans;
    for ( int64_t i = 0; i < N; ++i){
        ans = tree.size(i) - forb[i].size() - 1;
        cout << ans << endl;
    }
    
    
    return 0;
}


Measured memory_bytes: 29056
def f(k):
    k = str(k)

    for i in range(len(k) // 2):
        if k[i] != k[len(k) - i - 1]:
            return False

    return True

def main():
    A, B = [int(i) for i in input().split()]

    ans = 0
    for k in range(A, B + 1):
        if f(k):
            ans += 1

    print(ans)

main()


Measured memory_bytes: 3060
#include <stdio.h>
#define N 10000
#define NIL -1

struct Node {
  int parent;
  int left;
  int right;
};
struct Node T[N];
int depth[N], height[N];

int setDepth(int );
int setSibling(int );
void print(int );
int main(){
  int n, i, id, c, parent, left, right;
	scanf("%d", &n);
    
  for( i = 0; i < n; i++ ) {
		T[i].parent = NIL;
	}
  for( i = 0; i < n; i++ ) {
   	scanf("%d %d %d", &id, &left, &right);
		T[id].left = left;
		T[id].right = right;
		if( left != NIL ){
			T[left].parent = id;
		}
		if( right != NIL ){
			T[right].parent = id;
		}
	}

	for( i = 0; i < n; i++ ) {
		depth[i] = setDepth(i);
		height[i] = 0;
	}

	for( i = 0; i < n; i++ ){
		if( T[i].left == NIL && T[i].right == NIL ){
			height[i] = 0;
			parent = T[i].parent;
			c = 1;
			while( 1 ){
				if( parent == NIL ){
					break;
				}
				if( height[parent] < c ){
					height[parent] = c;
				}
				c++;
				parent = T[parent].parent;
			}
		}
	}
	for( i = 0; i < n; i++ ){
		print(i);
	}

  return 0;
}

int setDepth(int id){
	int i = 0;
	while(1){
		id = T[id].parent;
		if( id == NIL ) {
			break;
		}
		i++;
	}
	return i;
}

int setSibling(int id){
	if(T[id].parent == NIL){
		return NIL;
	}
	if(T[T[id].parent].left != id && T[T[id].parent].left != NIL){
		return T[T[id].parent].left;
	}
	if(T[T[id].parent].right != id && T[T[id].parent].right != NIL){
		return T[T[id].parent].right;
	}
	return NIL;
}

void print(int id){
	int degree = 0;
	printf("node %d: parent = %d, sibling = %d, ", id, T[id].parent, setSibling(id));
	if(T[id].left != NIL){
		degree++;
	}
	if(T[id].right != NIL){
		degree++;
	}
	printf("degree = %d, depth = %d, height = %d, ", degree, depth[id], height[id]);

	if( T[id].parent == NIL ){
		printf("root\n");
	}
	else if( T[id].left == NIL && T[id].right == NIL ){
		printf("leaf\n");
	}
	else{
		printf("internal node\n");
	}
}


Measured memory_bytes: 2088
#include<iostream>
using namespace std;
int main() {
	int a, b;
	while (cin >> a >> b&&a&&b) {
		int cnt[3] = {};
		int x = b - a;
		cnt[2] = x / 1000;
		x %= 1000;
		cnt[1] = x / 500;
		x %= 500;
		cnt[0] = x / 100;
		cout << cnt[0] << " " << cnt[1] << " " << cnt[2] << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
using System;
using System.IO;

class Program{
    static void Main(string[] args){
        var arr = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
        long N = arr[0], K = arr[1];
        long answer;
        var mod = N % K;
        if (mod == 0) answer = 0;
        else { long absMin = Math.Abs(mod - K); answer = mod < absMin ? mod : absMin; }
        var writer = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(writer);
        Console.WriteLine(answer);
        Console.Out.Flush();}}

Measured memory_bytes: 27452
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

int n,a[100010];

signed main(){
	cin >> n;
	vector<int> lis;
	for(int i = 0;i < n;i++){
		cin >> a[i];
		if(!i) lis.pb(-a[i]);
		else{
			int ind = upper_bound(all(lis),-a[i]) - lis.begin();
			if(ind == lis.size()) lis.pb(-a[i]);
			else lis[ind] = -a[i];
		}
	}
	cout << lis.size() << endl;
}


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

//#define int long long
#define ll long long
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    map<char,ll> mp;
    int n;string s;
    cin >> n >> s;
    rep(i,n)mp[s[i]]++;
    ll r = mp['R'];
    ll g = mp['G'];
    ll b = mp['B'];
    if(r == 0 || g == 0 || b == 0){
        cout << 0 << endl;
        return 0;
    }
    ll res = r*g*b;
    for(int j=0;j<n;j++){
        //int ki = 2*j;
        for(int k=j+1;k<n;k++){
            int i = j-abs(k-j);
            if(j-i != k-j)continue;
            if(i<0 || k>=n)continue;
            if(s[i] != s[j] && s[j] != s[k] && s[k] != s[i])res--;
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 3652
import java.util.*;
import java.math.*;
import java.lang.*;

public class Main {

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

    double a = sc.nextDouble();
    double b = sc.nextDouble();

    double h = sc.nextDouble();
    double m = sc.nextDouble();

    double s = h/12*360;
    double l = m/60*360;

    s += l/12;

    double res = Math.abs(s-l);
    res = Math.min(360-res,res);

    double r = Math.sqrt(Math.pow(a,2)+Math.pow(b,2)-2*a*b*Math.cos(Math.toRadians(res)));

    System.out.println(r);

  }

}


Measured memory_bytes: 37496
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int K = scan.nextInt();
		int sum = 0;

		for (int i = 1; i <= K; i++) {
			for (int j = 1; j <= K; j++) {
				for (int k = 1; k <= K; k++) {
					sum += gcd(i, gcd(j , k));
				}
			}
			
		}
		System.out.println(sum);
	}

	static int gcd(int p, int q) {
		if (p % q == 0) {
			return q;
		}
		return gcd(q, p % q);
	}
}

Measured memory_bytes: 27264
#include <stdio.h>
#include <string.h>
#define N 1001
int main(){
  char T[N],P[N];
  int i,j,n,m,flag;
  
  scanf("%s",T);
  scanf("%s",P);
  
  n=strlen(T);
  m=strlen(P);
  
  for(i=0;i<n;i++){
    flag=0;
    for(j=0;j<m;j++){
      if(T[i+j]==P[j]) flag++;
  
    }
    if(flag==m) printf("%d\n",i);
  }

  return 0;
}

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

using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n); i > 0; i--)
#define print(n) cout << n << "\n"

int main(){
    ll n;
    cin >> n;

    ll k = 2, nn;
    unordered_set<ll> ans={n};
    if(n>2) ans.insert(n-1);
    while(k*k<=n){
        if(n % k == 0){
            nn = n;
            while(nn % k == 0) nn /= k;
            if(nn % k == 1) ans.insert(k);
        }
        if(n % k == 1){
            ans.insert(k);
            ans.insert((n-1)/k);
        }
        k++;
    }
    
    print(ans.size());
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<algorithm>
#define ll long long
#define vel vector<int>
#define vvel vector<vel>
#define veb vector<bool>
#define pin pair<int,int>
#define mp make_pair 
#define int long long
using namespace std;
void mmin(int &a, int b) { a = min(a, b); }
signed main() {
	int n; cin >> n;
	vel a(n);
	for (int i = 0; i < n; i++) { cin >> a[i]; }
	sort(a.begin(), a.end());
	int mi = a[0]; int ma = a[n - 1];
	if (ma == mi) {
		if (mi == n - 1 or mi <= n / 2) { cout << "Yes" << endl; }
		else { cout << "No" << endl; }
	}
	else if (ma == mi + 1) {
		int k = 0;
		for (int i = 0; i < n; i++) { if (a[i] == mi) { k++; } }
		if (n - k >=2*(ma - k) and ma>k) { cout << "Yes" << endl; }
		else { cout << "No" << endl; }
	}
	else { cout << "No" << endl; }
	return 0;
}

Measured memory_bytes: 1152
#ifndef ONLINE_JUDGE
#define _GLIBCXX_DEBUG //checks for container overflows
#pragma GCC optimize "trapv" //to chcek for int overflow
#pragma -Wduplicated-cond //dupilcate conditions
#endif
#include "bits/stdc++.h"
using namespace std;
using namespace chrono;
typedef unsigned long long int ull;
typedef long long ll;
#define F first
#define S second
#define nl '\n'
#define de1(x) cerr << #x << ":" << x <<nl;
#define de2(x,y) cerr << #x << ":" << x << " " << #y << ":" << y << nl
#define de3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<nl
#define de4(x,y,z,w) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#w<<": "<<w<<nl
#define all(x) x.begin(), x.end()
#define rt return 0;
#define vvi vector<vector<int>>
#define vi vector<int>
#define fast ios_base::sync_with_stdio(0); cin.tie(0);
#define pb push_back

int main()
{
#ifndef ONLINE_JUDGE
    auto start = high_resolution_clock::now();
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast
    register int  i, cnt = 0;
    int d, n;

    cin >> n >> d;
    ull a, b;

    for (i = 0; i < n; i++)
    {
        cin >> a >> b;
        //cout << sqrt(a * a + b * b) << "\n";
        if (ceil(sqrt(a * a + b * b)) <= d)
            cnt++;
    }

    cout << cnt << "\n";


#ifndef ONLINE_JUDGE
    auto end = high_resolution_clock::now();
    double time_taken = duration_cast<nanoseconds>(end - start).count();
    time_taken *= 1e-9;
    cerr << "Time : " << fixed << time_taken << setprecision(9) << nl;
#endif
    return 0;
}

Measured memory_bytes: 3696
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ll n,a,b;
cin>>a>>b;
ll cnt = 0;
ll x =a;
for( int i = 1 ; i <= 10000 ; i++)
{

 x = a*pow(2,i-1);
if(x<=b) cnt++;
else break;
}
cout<<cnt;
return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <math.h>
#include <algorithm>
#include <deque>
#include <queue>
#include <climits>
#include <set>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ve vector
#define umap unordered_map
#define iter iterator

bool mp[26];
void solve() {
    string s;cin>>s;
    for(int i=0;i<s.length();i++) {
        mp[s[i]-'a'] = 1;
    }
    for(int i=0;i<26;i++) {
        if(!mp[i]) {
            cout << (char)(i+'a') << endl;
            return;
        }
    }
    cout<<"None\n";
}

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

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF=1e9;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
 
int main(){
  int n;
  cin>>n;
  ll ans=0;
  for(int i=1;i<=n-1;i++){
    ans+=i;
  }
  cout<<ans<<endl;
}


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

int main() {
  string str;
  cin >> str;
  for(int i = 0; str[i] != '\0'; ++i) {
    if(str[i] != ',') {
      cout << str[i] << flush;
    } else {
      cout << " " << flush;
    }
  }
  cout << endl;
}

Measured memory_bytes: 256
s = list(input())
n = len(s)

if (
    s[: (n - 1) // 2] == s[: (n - 1) // 2][::-1]
    and s[(n + 1) // 2 :] == s[(n + 1) // 2 :][::-1]
    and s == s[::-1]
):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 9068
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<queue>
#include <algorithm>
#include<functional>
#include<cstdlib>
#include<cmath>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define CI cin >>
#define CO cout <<
#define E << endl;

using namespace std;

typedef pair<int, int> P;
typedef pair<long, long> LP;
typedef pair<int, P> PP;
typedef pair<long, LP> LPP;



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

int A = 0, B = 0, C = 0, K = 0, S = 0, T = 0, W = 0, N = 0,H = 0;
int n = 0;
double ar = 0, br = 0, cr = 0;
int answer = 0;

string c;
string sA, strB;
vector<vector<char>> map;
vector<int> population;


void input() {
	CI W >> H;
	
	map.resize(W);
	REP(i, W) {
		map[i].resize(H);
	}
	REP(i, W) {
		REP(j, H) {
			CI map[i][j];
		}
	}
}

void proce() {
	int posn[2] = { 0,0 };
	vector<vector<bool>> check(W, vector<bool>(H, false));
	

	while (map[posn[0]][posn[1]] != '.') {
		check[posn[0]][posn[1]] = true;
		if (map[posn[0]][posn[1]] == '>') {
			posn[1]++;
		}
		else {
			if (map[posn[0]][posn[1]] == 'v') {
				posn[0]++;
			}
			else {
				if (map[posn[0]][posn[1]] == '<') {
					posn[1]--;
				}
				else {
					if (map[posn[0]][posn[1]] == '^') {
						posn[0]--;
					}
				}
			}
		}
		if (check[posn[0]][posn[1]] == true) {
			CO "LOOP" E
			return;
		}
	}
	CO posn[1] << " " << posn[0] E


}

int main(void) {
	
	while (true) {
		input();
		if (W == 0 && H == 0) {
			break;
		}
		proce();
	}

	return 0;
}

Measured memory_bytes: 3132
#include <stdio.h>

int main(int argc, char const *argv[])
{
	int n;
	int a;
	scanf("%d",&n);
	int even = 0,odd = 0;
	for(int i = 0;i<n;i++){
		scanf("%d",&a);
		if(a % 2){
			odd++;
		}else{
			even++;
		}

		if(odd == 2){
			odd = 0;
			even++;
		}
		if(even==2)even = 1;
	}

	if((even + odd) == 1){
		printf("YES\n");
	}else{
		printf("NO\n");
	}

	return 0;
}

Measured memory_bytes: 128
#include<iostream>
int main(){
  int n,m; std::cin >> n >> m;
  int* a; a=new int[n];
  int s=0;
  for(int i=0;i<n;i++){
    std::cin >> a[i];
    s+=a[i];
  }
  int cnt=0;
  for(int i=0;i<n;i++){
  	if( a[i]>= (float)s/(4*m) ){
    	cnt++;
    }
  }
  if(cnt>=m) std::cout << "Yes" << std::endl;
  else std::cout << "No" << std::endl;
  return 0;
}


Measured memory_bytes: 384
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int X = sc.nextInt();
        int[] L = new int[N];
        int[] D = new int[N+1];
        
        for (int i=0; i<N; i++) {
            L[i] = sc.nextInt();
        }
        
        D[0] = 0;
        int ans = 1;
        for (int i=1; i<N+1; i++) {
            D[i] = D[i-1] + L[i-1];
            if (D[i] <= X) {
                ans = ans + 1;
            }
        }
        System.out.println(ans);
    }
}


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

vector<int> to[2505];
vector<int> rto[2505];
const ll INF = 1e18;
bool reachableFrom1[2505];
bool reachableToN[2505];
bool ok[2505];
void dfs(int v) {
    if (reachableFrom1[v]) return;
    reachableFrom1[v] = true;
    for (int u : to[v]) {
        dfs(u);
    }
}
void rdfs(int v) {
    if (reachableToN[v]) return;
    reachableToN[v] = true;
    for (int u : rto[v]) {
        rdfs(u);
    }
}
int main() {
    int n, m; cin >> n >> m;
    vector<tuple<int,int,int>> edges;
    rep(i, m) {
        int a, b, c; cin >> a >> b >> c;
        a--; b--; c = -c;
        edges.emplace_back(a, b, c);
        to[a].push_back(b);
        rto[b].push_back(a);
    }
    dfs(0); rdfs(n-1);
    rep(i, n) ok[i] = reachableFrom1[i]&reachableToN[i];
    {//Bellman-Ford
        vector<ll> d(n, INF);
        d[0] = 0;
        bool upd = true;
        int step = 0;
        while(upd) {
            upd = false;
            rep(i,m) {
                int a, b, c;
                tie(a,b,c) = edges[i];
                if(!ok[a]) continue;
                if(!ok[b]) continue;
                ll newD = (ll)(d[a] + c);
                if(newD < d[b]) {
                    upd = true;
                    d[b] = newD;
                }
            }
            step++;
            if(step > n){
                puts("inf");
                return 0;
            }
        }
        ll ans = -d[n-1];
        //ans = max(ans, 0ll);
        cout << ans << endl;
    }
}


Measured memory_bytes: 512
#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;
}

const ll INF = 1e18;
const ll MOD = 998244353;
const ll MX = 1000001;

string S;

void solve() {  
	cin >> S;
	for (int i = 0; i < S.size(); i++) {
		if (i % 2 && S[i] == 'R') {
			cout << "No";
			return;
		} else if (!(i % 2) && S[i] == 'L') {
			cout << "No";
			return;
		}
	}  
	cout << "Yes";
}

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
    ll T = 1; // cin >> T;
    while (T--) solve();
    return 0;
    // You should actually read the stuff at the bottom
}

/* Stuff to Look For
 * -----------------
 * Int overflow, array bounds
 * Initializing all variables, avoid weird behavior
 * Edge cases(n = 0, n = 1)
 * Just return 0 after result
 */


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

    int m, k;
    cin >> m >> k;

    if (k == 0)
    {
        REP(i, 1 << m)
        {
            cout << i << " " << i << (i == (1 << m) - 1 ? "\n" : " ");
        }
        return 0;
    }

    if (k > (1 << m) - 1)
    {
        cout << -1 << endl;
        return 0;
    }

    int x = 0;
    REP(i, 1 << m)
    {
        if (i != k)
            x ^= i;
    }

    if (x != k)
    {
        cout << -1 << endl;
        return 0;
    }

    cout << 0 << " " << k << " " << 0 << " ";

    for (int i = 1; i < (1 << m); i++)
    {
        if (i != k)
            cout << i << " ";
    }
    cout << k << " ";
    for (int i = (1 << m) - 1; i >= 1; i--)
    {
        if (i != k)
            cout << i << (i == 1 ? "\n" : " ");
    }

    return 0;
}

Measured memory_bytes: 1792