akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

using namespace std;

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

template<typename V> class segtree{
private:
    int n,sz;
    vector<V> node;
public:
    segtree(vector<V>& v){
        sz = (int)v.size();
        n = 1;
        while(n < sz){
            n *= 2;
        }
        node.resize(2*n-1);
        rep(i,sz){
            node[i+n-1] = v[i];
        }
        for(int i=n-2; i>=0; i--){
            node[i] = min(node[i*2+1],node[i*2+2]);
        }
    }
    void update(int k,V a){
    	k += n-1;
    	node[k] = a;
    	while(k>0){
    		k = (k-1)/2;
    		node[k] = min(node[2*k+1],node[2*k+2]);
    	}
    }
    V query(int a,int b,int k=0,int l=0,int r=-1){
        if(r < 0) r = n;
    	if(r <= a || b <= l){
    		return numeric_limits<V>::max();
    	}
    	if(a <= l && r <= b){
    		return node[k];
    	}else{
    		V vl = query(a,b,2*k+1,l,(l+r)/2);
    		V vr = query(a,b,2*k+2,(l+r)/2,r);
    		return min(vl,vr);
    	}
    }
    void print(){rep(i,sz)cout<<query(i,i+1)<< " ";cout<<endl;}
};

signed main(){

  int n,c;
  cin >> n >> c;
  vector<ll> xc(n+1),xg(n+1),v(n+1),vg(n+1);
  xc[0]=0;xg[0]=0;v[0]=0;vg[0]=0;
  rep(i,n)cin >> xc[i+1] >> v[i+1];
  rep(i,n)xg[i+1]=c-xc[n-i];
  rep(i,n)vg[i+1]=v[n-i];

  vector<ll> cxL(n+1),cxR(n+1),cvL(n+1),cvR(n+1);
  cvL[0] = 0; cvR[0] = 0;
  rep(i,n){
    cvL[i+1] = cvL[i]+vg[i+1];
    cvR[i+1] = cvR[i]+v[i+1];
  }
  vector<ll> cc(n+1),ccr(n+1);
  cc[0] = 0;ccr[0] = 0;
  rep(i,n+1){
    cc[i] = -(cvR[i]-xc[i]);
  }
  rep(i,n+1){
    ccr[i] = -(cvL[i]-xg[i]);
  }

  // cout << "------" << endl;
  // rep(i,n+1)cout << xg[i] << endl;
  // cout << "------" << endl;
  //
  // rep(i,n+1)cout << cc[i] << endl;
  segtree<ll> st(cc),st2(ccr);

  ll maxlcost=0;
  rep(l,n+1){
    ll tmpcost=cvL[l]-2*xg[l]; // 反時計でlまで行って戻った時のカロリー
    ll zlcost=cvL[l]-xg[l]; // lまで行って出る時のカロリー
    // cout << "left "<<tmpcost << endl;
    ll minrcost = -st.query(0,n-l+1);
    // cout << minrcost << " " << tmpcost << endl;
    if(maxlcost < max(zlcost,tmpcost+minrcost))maxlcost = max(zlcost,tmpcost+minrcost);
  }

  ll maxrcost=0;
  rep(r,n+1){
    ll tmpcost=cvR[r]-2*xc[r];
    ll zrcost=cvR[r]-xc[r];
    ll minlcost = -st2.query(0,n-r+1);
    if(maxrcost < max(zrcost,tmpcost+minlcost))maxrcost = max(zrcost,tmpcost+minlcost);
  }
  
  cout << max(maxlcost,maxrcost) << endl;

  return 0;
}


Measured memory_bytes: 12160
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,l,r) for(ll i=(l);i<(r);i++)
int main(){
    int player=0;
    string a,b,c;
    cin>>a>>b>>c;
    while(true){
        if(player==0){
            if(!a.size()){
                cout<<'A';
                return 0;
            }
            player=a[0]-'a';
            a.erase(0,1);
        }
        if(player==1){
            if(!b.size()){
                cout<<'B';
                return 0;
            }
            player=b[0]-'a';
            b.erase(0,1);
        }
        if(player==2){
            if(!c.size()){
                cout<<'C';
                return 0;
            }
            player=c[0]-'a';
            c.erase(0,1);
        }
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		System.out.println(Math.min(a+b, Math.min(a+c, b+c)));
		
		
	}

}


Measured memory_bytes: 21844
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
using namespace std;
int main(){
    int n,d;
    cin >> n >> d;
    vector<vector<int>> x(n, vector<int>(d));
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < d; ++j)
        {
            cin >> x[i][j];
        }
        
    }
    int ans = 0;
    for (int i = 0; i < n; ++i)
    {
        for (int j = i+1; j < n; ++j)
        {
            int norm = 0;
            for (int k = 0; k < d; ++k)
            {
                int diff = abs(x[i][k] - x[j][k]);
                norm += diff * diff;
            }
            bool flag = false;
            for (int k = 0; k <= norm; ++k)
            {
                if(k * k == norm){
                    flag = true;
                }
            }
            if(flag) ++ans;
        }
        
    }
    cout << ans << endl;
    return 0;
}

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

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

int main(){
    int n;
    cin >> n;
    vi a(n);
    rep(i, n) cin >> a[i];
    int sum = 0;
    rep(i, n) sum ^= a[i];
    rep(i, n) {
        printf("%d%c", sum^a[i], (i<n-1?' ':'\n'));
    }
    return 0;
}


Measured memory_bytes: 3940
# https://atcoder.jp/contests/abc086/tasks/abc086_b

import itertools
import collections
import bisect
import math

def main():
    a, b = map(int, input().split())
    val = int("{}{}".format(a, b))

    print("Yes" if math.sqrt(val).is_integer() else "No")

if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#include "bits/stdc++.h"
using namespace std;

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

	if ((S[0] == S[1] && S[2] == S[3] && S[0] != S[2]) || 
		(S[0] == S[2] && S[1] == S[3] && S[0] != S[1]) ||
		(S[0] == S[3] && S[1] == S[2] && S[0] != S[1]) )
	{
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef unsigned long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
 
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;
}

int main(){
    int n;
    cin >> n;
    vector<unsigned long long> a(n);
    rep(i,n) cin >> a[i];
    ll INF = (unsigned long long)1000000000000000001;
    ll res = 1;
    rep(i,n){
        if(a[i]==0){
            cout << 0 << endl;
            return 0;
        }
    }
    rep(i,n){
        if((INF+a[i]-1)/a[i]<=res){
            cout << -1 << endl;
            return 0;
        }else{
            res *= a[i];
        }
    }
    cout << res << endl;
    return 0;
}

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

int main(){
	long long a[3];
	for(int i = 0;i < 3 && cin >> a[i];i++) if(!(a[i] & 1)){
		cout << 0 << endl;
		return 0;
	}
	sort(a,a + 3);
	cout << a[0] * a[1] << endl;
}

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

long long pow(long long x, long long n) {
    long long ret = 1;
    while (n > 0) {
        if (n & 1) ret *= x;  // n の最下位bitが 1 ならば x^(2^i) をかける
        x *= x;
        n >>= 1;  // n を1bit 左にずらす
    }
    return ret;
}

int main(){
    ll h;
    cin >> h;
    ll n = 0;
    while(h){
        n++;
        h /= 2;
    }
    ll ans = pow(2,n) - 1;
    cout << ans << endl;
}

Measured memory_bytes: 4056
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=200005;
const ll INF=1LL<<60;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;cin>>N;
    cout<<(N+1)/2<<endl;
}



Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int n,K,ret=1;
	cin>>n>>K;
	while (ret<=K&&n) ret<<=1,--n;
	while (n--) ret+=K;
	cout<<ret<<endl;
	return 0;
}

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

int bubbleSort(int A[], int N){
   int sw = 0;
   bool flag = 1;

   for(int i=0; flag; i++){;
      flag = 0;
      for(int j=N-1; j>=i; j--){
         if(A[j]<A[j-1]){
            swap(A[j], A[j-1]);
            flag = 1;
            sw++;
         }
      }
   }
   return sw;
}



int selectionSort(int A[], int N){
   int sw = 0;
   int minj;

   for(int i=0; i<N; i++){
      minj = i;
      for(int j=i; j<N; j++){
         if (A[minj]>A[j])  minj = j;
      }
      swap(A[i], A[minj]);
      if(i!=minj) sw++;
   }
   return sw;
}

int main(){
   int N, i, j, sw;
   int A[100];

   // data input
   cin >> N;
   for(i=0; i<N; i++) cin >> A[i];
  //  N = 6;
  //  A[0] = 5; A[1] = 6; A[2] = 4; A[3] = 2; A[4] = 1; A[5] = 3;

   // execution
   // sw = bubbleSort(A, N);
   sw = selectionSort(A, N);

   // output
   for(i=0; i<N; i++){
      if (i) cout << " ";
      cout << A[i];
   }
   cout << endl;
   cout << sw << endl;

  return 0;
}







Measured memory_bytes: 3120
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<stack>
using namespace std;

#define REP(i,n) for(int i=0;(i)<(n);(i)++)
#define ll long long

int main() {
	int n;
	string S[60];
	cin >> n;
	REP(i, n) {
		cin >> S[i];
	}

	int alp[26];
	REP(i, 26) alp[i] = 1000;


	int alps[26];

	REP(i, n) {

		REP(t, 26) alps[t] = 0;

		REP(j, S[i].length()) {
			for (char c = 'a';c <= 'z';c++) {
				if (S[i][j] == c) {
					alps[c - 'a']++;
					break;
				}
			}
		}

		//REP(aaa, 26) cout << alps[aaa]; cout << endl;

		REP(k, 26) {
			alp[k] = min(alp[k], alps[k]);
		}
	}

	for (char c = 'a'; c <= 'z'; c++) {
		REP(j, alp[c - 'a']) {
			cout << c;
		}
	}

	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define reps(i,a,b) for(int i=a;i<b;++i)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
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(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    int n;
    cin >> n;
    set<pair<char, int>> st;
    rep(i, n) {
        char c; int x;
        cin >> c >> x;
        st.insert(make_pair(c, x));
    }
    for (char c : {'S', 'H', 'C', 'D'}) {
        for (int i = 1; i <= 13; ++i) {
            if (!st.count(make_pair(c, i))) cout << c << " " << i << endl;
        }
    }
}



Measured memory_bytes: 3140
#include<iostream>
#include <list>
#include<stack>
#include<queue>
#include <vector>
#include <set>
#include <map>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include"time.h"
using namespace std;

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long
#define CLR(a) memset((a),0,sizeof(a))
#define SZ(x) (int((x).size()))
#define dump(x)  cerr << #x << " = " << (x) << endl

//毎回変える場所
#define N_MAX 200


//問題文のとおり
const LL INF = 1000000007;
int N,i=0;
LL ans;
string A,B;

int main() {
	cin>>N>>A>>B;
	if(A[i]==B[i]){
		ans=3;
		i++;
	}
	else{
		ans=6;
		i += 2;
	}
	for(  ;i<N;i++) {
		if(A[i]==B[i]){
			if(A[i-1]==B[i-1])ans*=2;
		}
		else {
			if(A[i-1]==B[i-1])ans*=2;
			else ans*=3;
			i++;
		}
		ans%=INF;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long lli;
typedef double lld;
#define mod 1000000007
#define mod2 998244353
#define fori(n) for (int i = 0; i < n; i++)
#define forj(n) for (int j = 0; j < n; j++)
#define pb push_back
#define F first
#define S second
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
template <typename T, typename U>ostream &operator<<(ostream &out, const pair<T, U> &p){out << "(" << p.first << ", " << p.second << ")";return out;}
template <template <typename, typename...> class ContainerType, typename ValueType, typename... Args>void print(const ContainerType<ValueType, Args...> &c){for (const auto &v : c)cout << v << ' ';cout << '\n';} void print(){cout<<'\n';}
template <typename T, typename... Args>void print(T a, Args... args){cout << a << " ";print(args...);}
lli llipower(lli x, lli y, lli p = LLONG_MAX){lli res = 1;x = x % p;while (y > 0){if (y & 1)res = (res * x) % p;y = y >> 1;x = (x * x) % p;}return res;}

//8====================================D
int main(){
    int ans=0;
    string s,t;
    cin>>s>>t;
    for(int i=0;i<s.size();i++){
        if(s[i]!=t[i]) ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3916
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		sc.useDelimiter("\\s");
		int a = sc.nextInt();
		int b = sc.nextInt();
		if(a < b){
			System.out.println("a < b");
		}
		if(a > b){
			System.out.println("a > b");
		}
		if(a == b){
			System.out.println("a == b");
		}

	}

}

Measured memory_bytes: 26344
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int K = sc.nextInt();

		sc.close();

		if(K <= A){
			System.out.println(K);
		}else if(A+B >= K){
			System.out.println(A);
		}else if(A+B+C >= K) {
			System.out.println(A - (K-A-B));
		}

	}

}


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

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

using namespace std;

int main(){
	int h,w; cin>>h>>w;
	string B[50];
	rep(i,h) cin>>B[i];

	rep(i,h) rep(j,w) if(B[i][j]=='.') {
		int cnt=0;
		rep(k,3) rep(l,3) {
			int y=i+k-1,x=j+l-1;
			if(0<=y && y<h && 0<=x && x<w && B[y][x]=='#') cnt++;
		}
		B[i][j]='0'+cnt;
	}

	rep(i,h) cout<<B[i]<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))
#define SET(a,c) memset(a,c,sizeof(a))

#define DEBUG(x) cout<<"#x"<<": "<<x<<endl

using namespace std;

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

const int INF = INT_MAX/3;
const int MOD = 1000000007;
const double EPS = 1e-14;
const int dx[] = {1,0,-1,0} , dy[] = {0,1,0,-1};

int main(){
    int w,h;
    int s[31][31];
    int d[5][31][31];
    int c[5];
    while(true){
	cin >> w >> h;
	if(w == 0 && h == 0) break;
	REP(i,h)REP(j,w){
	    cin >> s[i][j];
	    REP(k,5)
		d[k][i][j] = INF;
	}
	REP(i,4) cin >> c[i];
	c[4] = 0;

	queue< pair<int,int> > qxy;
	queue<int> qv;
	queue<int> qs;
	qxy.push(MP(0,0));
	qv.push(0);
	qs.push(0);
	while(!qxy.empty()){
	    int x = qxy.front().first;
	    int y = qxy.front().second;
	    int v = qv.front();
	    int st = qs.front();
	    qxy.pop();
	    qv.pop();
	    qs.pop();
	    REP(i,5){
		int nx,ny;
		int nv = v;
		int nst;
		if( i < 4 ){
		    nst = (st+i)%4;
		    nx = x + dx[nst];
		    ny = y + dy[nst];
		    nv = v + c[i];
		}else{
		    if(s[y][x] == 4){
			nst = 4;
			continue;
// 			nx = x;
// 			ny = y;
		    }else{
			nst = (st+s[y][x])%4;
			nx = x + dx[nst];
			ny = y + dy[nst];
		    }
		}
		if(nx < 0 || w <= nx || ny < 0 || h <= ny) continue;
		if(nv < d[nst][ny][nx]){
		    d[nst][ny][nx] = nv;
		    qxy.push(MP(nx,ny));
// 		    printf("x = %d y = %d v = %d s = %d i = %d\n",nx,ny,nv,nst,i);
		    qv.push(nv);
		    qs.push(nst);
		}
	    }
	}
	int ans = INF;
	REP(i,5) ans = min(ans,d[i][h-1][w-1]);
	cout << ans << endl;

    }

    return 0;
}

Measured memory_bytes: 1400
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Diagnostics;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.CompilerServices;
using static System.Math;


class P
{
    static void Main()
    {
        int[] nmk = Console.ReadLine().Split().Select(int.Parse).ToArray();
        for (int i = 0; i <= nmk[0]; i++)
        {
            for (int j = 0; j <= nmk[1]; j++)
            {
                if (i * j + (nmk[0] - i) * (nmk[1] - j) == nmk[2])
                {
                    Console.WriteLine("Yes");
                    return;
                }
            }
        }
        Console.WriteLine("No");
    }
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<long long, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<long long, long long> ll_ll;
typedef pair<double, double> d_d;

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define rep2d(i, j, n) for(i = 0;i < n;++i)for(j = i + 1;j < n;++j)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define sc(x) cin >> x
#define sc2(x, y) cin >> x >> y
#define sc3(x, y, z) cin >> x >> y >> z
#define scn(n, a) rep(i, n)cin >> a[i]
#define sc2n(n, a, b) rep(i, n)cin >> a[i] >> b[i]
#define pri(x) cout << x << "\n"
#define pri2(x, y) cout << x << " " << y << "\n"
#define pri3(x, y, z) cout << x << " " << y << " " << z << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define endl "\n"
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << x << "\n"
#define debug2(x, y) cout << " --- " << x << " " << y << "\n"
#define debug3(x, y, z) cout << " --- " << x << " " << y << " " << z << "\n"
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)


signed main(void){
  int i, j, k;
  for(int testcase = 0;testcase < 1234567;testcase++){
    string s;
    getline(cin, s);
    vector<string> lis;
    s += " ";

    for(i = j = 0;i < s.size();++i){
      if(s[i] == ' ' || s[i] == ',' || s[i] == '.')continue;
      for(j = i;;++j)if(s[j] == ' ' || s[j] == ',' || s[j] == '.')break;
      if(3 <= j - i && j - i <= 6)lis.pb(s.substr(i, j - i));
      i = j - 1;
    }

    rep(i, lis.size() - 1)cout << lis[i] << " ";
    pri(lis[i]);

/*/

//*/ break;
  }
  return 0;
}

Measured memory_bytes: 1180
//標準解答
//全角スペースにほんま注意　エラーでわかるけど
#include<cstdio>
#include<cstring>

int main(){
    char s[201], t[101], p[101];
    
    scanf("%s %s", s, p);
    strcpy(t, s); //tにsをコピー
    strcat(s, t); //sにtを連結

    if ( strstr(s, p) == NULL ) printf("No\n");
    else printf("Yes\n");
    
    return 0;
}


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

using namespace std;


int D;
long long G;
vector<long long> p, c;

void solve() {
    cin >> D >> G;
    p.resize(D); c.resize(D);
    for (int i = 0; i < D; i++) cin >> p[i] >> c[i];

    long long res = 1<<29;
    for (int bit = 0; bit < (1<<D); bit++) {
        long long sum = 0;
        long long num = 0;
        for (int i = 0; i < D; i++) {
            if (bit & (1<<i)) {
                sum += 100 * (i + 1) * p[i] + c[i];
                num += p[i];
            }
        }
        if (sum >= G) res = min(res, num);
        else {
            for (int i = D - 1; i >= 0; i--) {
                if (bit & (1<<i)) continue;
                for (int j = 0; j < p[i]; j++) {
                    if (sum >= G) break;
                    sum += 100 * (i + 1);
                    num++;
                }
            }
            res = min(res, num);
        }
    }

    cout << res << endl;
}


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

Measured memory_bytes: 256
S = input()
N = len(S)
pre_ans = [0] * N
ans = [0] * N

#下準備
for i in range(N):
    if S[i] == 'L':
        if S[i-1] == 'L':
            pre_ans[i] = pre_ans[i-1] -1
        else:
            pre_ans[i] = -1
for i in range(N):
    if S[N-i-1] == 'R':
        if S[N-i] == 'R':
            pre_ans[N-i-1] = pre_ans[N-i] + 1
        else:
            pre_ans[N-i-1] = 1

#実際のやつ
for i in range(N):
    tmp = pre_ans[i]
    if abs(tmp) % 2 == 0:
        ans[i + tmp] += 1
    else:
        if tmp < 0:
            ans[i + tmp + 1] += 1
        else:
            ans[i + tmp - 1] += 1
print(*ans)

Measured memory_bytes: 10268
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define ios ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0)
#define so sizeof
#define pb push_back
#define cl clear() ;
#define vl vector<ll>
#define sz size()
#define len length()
#define el endl;cout.flush()
#define be begin()
#define fi first
#define se second
#define br break
#define en end()
#define ro return 0
#define br break
#define eb emplace_back
#define con continue
#define ms(x) memset(x , 0, so x)
#define all(x) (x).be , (x).en
#define rall(x) (x).rbegin() , (x).rend()
#define acc(x) accumulate((x).be , (x).en , 0ll)
#define forn(i,a,b) for(ll i=a;i<=b;++i)
#define rng_58 mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define plll pair<ll,pair<ll,ll>>
#define plvl pair<pair<ll,ll> ,ll>
#define mp make_pair
#define trace2(a,b) cerr <<"a is " << a << " b is " << b << el;
#define trace3(a,b,c) cerr <<"a is " << a << " b is " << b << " c is " << c << el;
#define trace4(a,b,c,d) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << el ;
#define trace5(a,b,c,d,e) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << " e is " << e << el;
#define trace6(a,b,c,d,e,f) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << " e is " << e << " f is " << f << el ;

int main()
{
    ios;
    ll a , b , c;
    cin >> a >> b >> c ;
    vl v ;
    v.pb(a) ;
    v.pb(b);
    v.pb(c);
    sort(all(v)) ;
    if(v[0] == v[1]){
        cout << v[2] << el ;
        ro ;
    }
    else cout << v[0] << el ;
    ro ;
}































Measured memory_bytes: 256
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
typedef long long ll;
typedef pair<int,int> Pint;
typedef pair<ll, ll> P;
//typedef pair<int, pair<int, int>> P;
//typedef tuple<int,int,int> T;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 1000000000;//10^9
ll MOD  = 1000000007;
//vector<int> dy = {0,0,1,-1};
//vector<int> dx = {1,-1,0,0};

int main(void){
	int a,b,c;
	cin >> a >> b >> c;
	cout << min(a+b, min(a+c, b+c)) << endl;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int maxV = 90010;

 
const int maxN = 1e3+10;

const int INF = 1e9+6;
const int MOD = 1e9+7;


int n;
int main() {
	scanf("%d",&n);
	int cnt = 0;
	if(n%2 == 1)
	{
		cnt = n/2+1;
	}
	else
	{
		cnt = n/2;
	}
	double ans = (double)cnt / n;
	printf("%.7f\n",ans);
    return 0;
}

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

int main()
{
    unsigned long long int n ;
    cin>>n;
    string ans ="";
    while(n!=0)
    {
        int rem = n%26;
        if(rem==0)
        {
            n = n -1;
            rem = 26;
        }
        char add = 'a' + rem - 1;
        ans += add;
        n = n/26;
    }
    reverse(ans.begin(),ans.end());
    cout<<ans;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;cin>>n;
  double ans;
  if (n==1) {
    cout << 1 << endl;
  } else {
    if (n%2 == 0) {
      cout << 0.5 << endl;
    } else {
      ans = (double)(n/2+1)/n;
      cout << ans << endl;
    }
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int maxn = 1e5+5;
int id[maxn],x[maxn],y[maxn];
int main(){
	int n;
	scanf("%d",&n);
	for(int i = 1;i<=n;i++){
		scanf("%d%d%d",&id[i],&x[i],&y[i]);
	}
	int dis = 0;
	id[0] = 0;
	x[0] = 0;
	y[0] = 0;
	int xx,yy,tmp;
	for(int i = 1;i<=n;i++){
		dis = id[i]-id[i-1];
		xx = x[i]-x[i-1];
		yy = y[i]-y[i-1];
		tmp = xx+yy;
		if((dis-tmp)%2!=0||(dis<tmp)){
			printf("No\n");
			return 0;
		}
	}
	printf("Yes\n");
	return 0;
}

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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int ans = 0;
    int N; cin >> N;
    int A[N]; rep(i, N) cin >> A[i];
    int B[N]; rep(i, N) cin >> B[i];
    int sumA[N+1] = {};
    int sumB[N+1] = {};
    rep(i, N) sumA[i+1] = sumA[i]+A[i];
    rep(i, N) sumB[i+1] = sumB[i]+B[i];
    for(int i = 1; i <= N; i++){
        ans = max(ans, sumA[i] + sumB[N]-sumB[i-1]);
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	int N, M;
	cin >> N >> M;
	vector<int> k(M, 0);
	for (int i = 0; i < M; i++)
	{
		int t;
		cin >> t;
		for (int j = 0; j < t; j++)
		{
			int tmp;
			cin >> tmp;
			k[i] |= (1<<tmp-1);
		}
		
	}
	vector<int> p(M);
	for (int i = 0; i < M; i++)
	{
		cin >> p[i];
	}

	ll ans = 0;
	for (int bit = 0; bit < (1<<N); ++bit)
    {
		bool F = true;
		for (int i = 0; i < M; i++)
		{
			int c = __builtin_popcount(bit&k[i]);
			if(c%2!=p[i]) F=false;
		}
		if(F)ans++;
   }
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using pll = pair<long long, long long>; // (money, time)
using Edge = pair<int, pll>;
using Graph = vector<vector<Edge>>;
const long long INF = 1LL<<60;
const int MAX = 2500;

int N, M;
long long S;
Graph G;
vector<long long> C, D; // money, time

void solve() {
    if (S >= MAX) S = MAX;
    vector<vector<long long>> dp(N, vector<long long>(MAX+1, INF));
    priority_queue<pair<long long, pll>, vector<pair<long long, pll> >, greater<pair<long long, pll> > > que;
    dp[0][S] = 0;
    que.push(make_pair(0, pll(0, S)));
    while (!que.empty()) {
        auto p = que.top(); que.pop();
        long long time = p.first;
        int v = p.second.first;
        long long s = p.second.second;
        if (time > dp[v][s]) continue;

        // 補充
        if (s + C[v] <= MAX) {
            long long ns = s + C[v];
            long long ntime = time + D[v];
            if (chmin(dp[v][ns], ntime)) {
                que.push(make_pair(ntime, pll(v, ns)));
            }
        }
        // 辺を通る
        for (auto e : G[v]) {
            if (s < e.second.first) continue;
            int nv = e.first;
            long long ns = s - e.second.first;
            long long ntime = time + e.second.second;
            if (chmin(dp[nv][ns], ntime)) {
                que.push(make_pair(ntime, pll(nv, ns)));
            }
        }
    }
    for (int v = 1; v < N; ++v) {
        long long res = INF;
        for (int s = 0; s <= MAX; ++s) chmin(res, dp[v][s]);
        cout << res << endl;
    }
}

int main() {
    cin >> N >> M >> S;
    G.assign(N, vector<Edge>());
    for (int i = 0; i < M; ++i) {
        long long u, v, a, b;
        cin >> u >> v >> a >> b;
        --u, --v;
        G[u].push_back(Edge(v, pll(a, b)));
        G[v].push_back(Edge(u, pll(a, b)));
    }
    C.resize(N); D.resize(N);
    for (int i = 0; i < N; ++i) cin >> C[i] >> D[i];
    solve();
}

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

#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << " = " << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define SP << " " <<

typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<ll,vector<ll>,greater<ll>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;

const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30); // 1073741824
const int INF = (1LL << 60); // 1152921504606846976
const double EPS = (1 >> 30);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> inline T ceil(T a, T b) {return T((a + b - 1)/b);}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }

int nmax=200000; // 2*(10^5)
vvec g(nmax);



signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    
    string s;
    cin>>s;
    int ng=0;
    rep(i,3){
        if(s[i]=='7') ng++;
    }
    if(ng==0) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
}

Measured memory_bytes: 7796
/*
    _____
  .'     '.
 /  0   0  \
|     ^     |
|  \     /  |
 \  '---'  /
  '._____.'
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

struct chash
{
	int operator()(int x) const
	{
		x ^= (x >> 20) ^ (x >> 12);
		return x ^ (x >> 7) ^ (x >> 4);
	}
};

template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename U> using hashtable = gp_hash_table<T, U, chash>;
random_device(rd);
mt19937 rng(rd());

template<class T>
void readi(T &x)
{
	T input = 0;
	bool negative = false;
	char c = ' ';
	while (c < '-')
	{
		c = getchar();
	}
	if (c == '-')
	{
		negative = true;
		c = getchar();
	}
	while (c >= '0')
	{
		input = input * 10 + (c - '0');
		c = getchar();
	}
	if (negative)
	{
		input = -input;
	}
	x = input;
}
template<class T>
void printi(T output)
{
	if (output == 0)
	{
		putchar('0');
		return;
	}
	if (output < 0)
	{
		putchar('-');
		output = -output;
	}
	int aout[20];
	int ilen = 0;
	while(output)
	{
		aout[ilen] = ((output % 10));
		output /= 10;
		ilen++;
	}
	for (int i = ilen - 1; i >= 0; i--)
	{
		putchar(aout[i] + '0');
	}
	return;
}
template<class T>
void ckmin(T &a, T b)
{
	a = min(a, b);
}
template<class T>
void ckmax(T &a, T b)
{
	a = max(a, b);
}
template<class T, class U>
T nmod(T &x, U mod)
{
	if (x >= mod) x -= mod;
}
template<class T>
T randomize(T mod)
{
	return (uniform_int_distribution<T>(0, mod - 1))(rng);
}

#define y0 ___y0
#define y1 ___y1
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define debug(x) cerr << #x << " = " << x << endl;

const long double PI = 4.0 * atan(1.0);
const long double EPS = 1e-10;

#define MAGIC 347
#define SINF 10007
#define CO 1000007
#define INF 1000000007
#define BIG 1000000931
#define LARGE 1696969696967ll
#define GIANT 2564008813937411ll
#define LLINF 2696969696969696969ll
#define MAXN 200013

typedef unsigned long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;

int N;
ll X;
ll arr[MAXN];
ll pref[MAXN];
ll ans = ULLONG_MAX;

int32_t main()
{
	ios_base::sync_with_stdio(0);
	// cout << fixed << setprecision(10);
	// cerr << fixed << setprecision(10);
	// freopen ("file.in", "r", stdin);
	// freopen ("file.out", "w", stdout);
	cin >> N >> X;
	for (int i = 0; i < N; i++)
	{
		cin >> arr[i];
		pref[i + 1] = pref[i] + arr[i];
	}
	for (int i = 1; i <= N; i++)
	{
		int rt = N - 1;
		ll cur = 0;
		for (int j = 0; rt >= 0; j++)
		{
			int num = (j ? i : 2 * i);
			int lt = max(0, rt - num + 1);
			cur += 2ll * j * (pref[rt + 1] - pref[lt]);
			rt = lt - 1;
		}
		ckmin(ans, X * i + cur);
	}
	ans += X * N;
	for (int i = 0; i < N; i++)
	{
		ans += arr[i] * 5;
	}
	cout << ans << '\n';
	// cerr << "time elapsed = " << (clock() / (CLOCKS_PER_SEC / 1000)) << " ms" << endl;
	return 0;
}


Measured memory_bytes: 3456
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, l int
	fmt.Scan(&n, &l)

	s := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&s[i])
	}

	sort.Strings(s)

	for j := 0; j < n; j++ {
		fmt.Print(s[j])
	}
	fmt.Println()
}


Measured memory_bytes: 640
#include <regex>
#include "bits/stdc++.h"
#define FOR(i, s, e) for (int i = int(s); i < int(e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define INF (INT_MAX / 2)
#define LINF (LLONG_MAX / 2)
#define EPS (1.0e-8)
#define mkpr make_pair
const int MGN = 10;
const int ARY_SZ_MAX = (int)1e7;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>;
using vc = vector<char>; using vvc = vector<vc>;
using vb = vector<bool>; using vvb = vector<vb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>; using psl = pair<string, ll>;


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

  int N = 3;
  vi A(N); REP(i,N) cin>>A[i];
  sort(A.begin(), A.end());

  string  ans = "No";
  if ((A[0] == A[1] && A[1] != A[2]) ||
       A[0] != A[1] && A[1] == A[2]) ans = "Yes";

  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 256
let rec get_odd lst =
	match lst with
	| []
	| _ :: [] -> []
	| _ :: x :: xs ->
		x :: get_odd xs

let rec head n lst =
	match lst with
	| [] -> []
	| x :: xs ->
		if n > 0 then x :: head (n - 1) xs
		else []

let () =
	let n = read_int () in
	let a =
		read_line ()
		|> Str.split (Str.regexp " ")
		|> List.map int_of_string
	in
	List.sort (fun a b -> compare b a) a
	|> get_odd
	|> head n
	|> List.fold_left (+) 0
	|> print_int
	|> print_newline


Measured memory_bytes: 43776
# -*- coding: utf-8 -*-
from sys import stdin
s_list = []

n = int(stdin.readline().rstrip())

for i in range(n):
    s = stdin.readline().rstrip()
    if i == 0:
        s_shiri = s[-1]
        s_list.append(s)
    else:
        if s[0] == s_shiri:
            s_shiri = s[-1]
            s_list.append(s)
        else:
            print("No")
            exit()
            
s_check =  list(set(s_list))

if len(s_list) == len(s_check):
    print("Yes")
else:
    print("No")

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

int main(){
    int n; cin>>n;
    vector<int> p(110,0);
    p[0]=p[1]=-1;
    int n2=0,n4=0,n14=0,n24=0,n74=0;
    for(int i=2;i<=n;i++){
        if(p[i]==-1)continue;
        for(int j=i+i;j<=n;j+=i){
            p[j]=-1;
        }
        for(int j=n;j>=i;j--){
            for(int k=j;k%i==0;k/=i){
                p[i]++;
            }
        }
        if(p[i]>=2)n2++;
        if(p[i]>=4)n4++;
        if(p[i]>=14)n14++;
        if(p[i]>=24)n24++;
        if(p[i]>=74)n74++;
    }
    int ans=0;
    ans+=n4*(n4-1)*(n2-2)/2;
    ans+=n24*(n2-1);
    ans+=n14*(n4-1);
    ans+=n74;
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//#include<ext/pb_ds/detail/standard_policies.hpp>

// common
#define endl     "\n"
#define M_PI     3.14159265358979323846

// fast input output
#define fast_io  ios_base::sync_with_stdio(false); cin.tie(NULL);  cout.tie(NULL)

// fixed float field
#define fix_prec cout.setf( std::ios::fixed, std:: ios::floatfield ); cout.precision(9);

// vector
#define vi       vector<int>
#define vvi      vector<vector<int>>
#define vpii     vector<pair<int,int>>
#define pb(v,x)  v.push_back(x)

// pair
#define pii      pair<int,int>
#define mp(a,b)  make_pair(a,b)
#define F        first
#define S        second

// sort
#define all(x)   x.begin(),x.end()

// bound
#define lb(v,x)  lower_bound(v.begin(),v.end(),x)
#define ub(v,x)  upper_bound(v.begin(),v.end(),x)

using namespace std;
//using namespace __gnu_pbds;

//typedef tree < int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update > ordered_set;
typedef long long int lli;
typedef unsigned long long int ulli;

// constants
lli const mod  = 1e9;
lli const modl = 1e18;

void solve()
{
	int n,i,sum=0,curr=0,mn=INT_MAX,pos=0;
	cin>>n;
	vi a(n);
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		sum+=a[i];
	}
	for(i=0;i<n;i++)
	{
		curr+=a[i];
		if(abs(sum-2*curr)<mn)
		{
			mn=abs(sum-2*curr);
			pos=i+1;
		}
	}
	cout<<mn;
}

int main()
{
  fast_io;
  fix_prec;
  int t=1;
  //cin>>t;
  while(t--)
  {
    solve();
    cout<<endl;     
  }
  return 0;	
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define each(it,n) for(__typeof((n).begin()) it=(n).begin();it!=(n).end();++it)

using namespace std;

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

    int team = -1, frame = 0, player = 0;
    int dist[2] = {-1, -1}, time[2] = {-1, -1};
    int bx, by;
    rep(i, n) {
        int f, a, t, x, y;
        cin >> f >> a >> t >> x >> y;
        if (team == t && player != a) {
            int d = (bx - x) * (bx - x) + (by - y) * (by - y);
            if (dist[t] < d || (dist[t] == d && time[t] > f - frame)) {
                dist[t] = d;
                time[t] = f - frame;
            }
        }
        team = t, player = a, frame = f;
        bx = x, by = y;
    }

    rep(i, 2) cout << setprecision(10) << (dist[i] == -1 ? -1 : sqrt(dist[i])) << " " << (time[i] == -1 ? -1 : (double)time[i] / 60.0) << endl;
    return 0;
}

Measured memory_bytes: 1236
n,m = map(int, input().split())
a = list(map(int, input().split()))
b = []
for i in range(0, len(a)):
    if a[i]>=1/(4*m)*sum(a):
        b.append(a[i])
if len(b) >= m:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
import java.util.*;

class Main{

    int h, w, c;
    int[][] p, p2;
    int[] num = new int[5];

    void solve(){
        Scanner sc = new Scanner(System.in);

        while(true){
            h = sc.nextInt(); w = sc.nextInt(); c = sc.nextInt();
            if(h==0 && w==0 && c==0) break;

            p = new int[h][w];
            for(int i=0; i<h; i++)
                for(int j=0; j<w; j++) p[i][j] = sc.nextInt();

            System.out.println(rec(0));
            System.gc();
        }
    }

    int rec(int cnt){
        if(cnt==5){
            if(num[4]!=c) return 0;
            p2 = new int[h][w];
            for(int i=0; i<h; i++)
                for(int j=0; j<w; j++) p2[i][j] = p[i][j];
            for(int i=0; i<5; i++){
                if(num[i]==p2[0][0]) continue;
                changeColor(num[i]);
            }
            int cc = changeColor(num[4]);
            return cc;
        }
        int res = 0;
        for(int i=1; i<=6; i++){
            num[cnt] = i;
            res = Math.max(res, rec(cnt + 1));
        }
        return res;
    }

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

    int changeColor(int color){
        int before = p2[0][0];
        LinkedList<int[]> q = new LinkedList<int[]>();
        p2[0][0] = color;
        q.add(new int[]{0, 0});
        boolean[][] v = new boolean[h][w];

        int cnt = 0;
        while(q.size()>0){
            int[] qq = q.poll();
            int x = qq[0], y = qq[1];

            if(v[y][x]) continue;
            v[y][x] = true;
            cnt++;

            for(int i=0; i<4; i++){
                int nx = x + dx[i], ny = y + dy[i];
                if(nx<0 || nx>=w || ny<0 || ny>=h || p2[ny][nx]!=before || v[ny][nx]) continue;
                p2[ny][nx] = color;
                q.add(new int[]{nx, ny});
            }
        }
        return cnt;
    }

    public static void main(String[] args){
        new Main().solve();
    }
}

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

int main(){
    int a, b, c, A, B, C, X, sum, count=0;
    cin >> A >> B >> C >> X;

    for (a=0; a<=A; a++) {
        for (b=0; b<=B; b++) {
            for (c=0; c<=C; c++) {
                sum = 500 * a + 100 * b + 50 * c;
                if (sum == X) count++;
            }
        }
    }

    cout << count << endl;

    return 0;

}


Measured memory_bytes: 256
/*********************
*  Author: xuziyuan  * 
*********************/

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <int,int>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

int n,m,dp[190][190][190][18],sum[190][190];
string s[190];

int main()
{
	cin>>n>>m;
	rep(i,n) cin>>s[i];
	rep(i,n) rep(j,m)
	sum[i+1][j+1]=sum[i+1][j]+sum[i][j+1]-sum[i][j]+(s[i][j]=='#' ? 1:0);
	rep(i,n) rep(j,m) rep(k,j) rep(p,17) dp[i][j][k][p]=200;
	rep(i,n)
	{
		rep(j,m)
		{
			for(int k=j;k<m;k++)
			{
				int lb=1,ub=n-i;
				while(lb<ub)
				{
					int mid=(lb+ub+1)/2;
					int val=sum[i+mid][k+1]-sum[i][k+1]-sum[i+mid][j]+sum[i][j];
					if(val!=0&&val!=(k-j+1)*mid) ub=mid-1;
					else lb=mid;
				}
				int mid=lb;
				int val=sum[i+mid][k+1]-sum[i][k+1]-sum[i+mid][j]+sum[i][j];
				if(val!=0&&val!=(k-j+1)*mid) lb=0;
				rep(p,17) dp[i][j][k][p]=lb;
			}
		}
	}
	repn(p,17)
	{
		for(int i=n-1;i>=0;i--)
		{
			rep(j,m)
			{
				for(int k=j;k<m;k++)
				{
					dp[i][j][k][p]=dp[i+dp[i][j][k][p-1]][j][k][p-1]+dp[i][j][k][p-1];
					int lb=j,ub=k,mid,val=0;
					while(lb<ub)
					{
						mid=(lb+ub)/2;
						//if(i==0&&j==0&&k==6&&p==3) cout<<lb<<' '<<ub<<' '<<mid<<' '<<dp[i][j][mid][p-1]
						//<<' '<<dp[i][mid+1][k][p-1]<<endl;
						if(dp[i][j][mid][p-1]<=dp[i][mid+1][k][p-1]) ub=mid;
						else lb=mid+1;
						//if(i==0&&j==0&&k==6&&p==3) cout<<lb<<' '<<ub<<' '<<mid<<endl;
					}
					val=dp[i][j][lb][p-1];
					//if(i==0&&j==0&&k==6&&p==3) cout<<i<<' '<<j<<' '<<lb<<' '<<p-1<<' '<<val<<endl;
					lb=j;
					ub=k;
					while(lb<ub)
					{
						mid=(lb+ub+1)/2;
						if(dp[i][mid][k][p-1]<=dp[i][j][mid-1][p-1]) lb=mid;
						else ub=mid-1;
					}
					val=max(val,dp[i][lb][k][p-1]);
					//if(i==0&&j==0&&k==6&&p==3) cout<<i<<' '<<lb<<' '<<k<<' '<<p-1<<' '<<val<<endl;
					dp[i][j][k][p]=max(dp[i][j][k][p],val);
					//cout<<i<<' '<<j<<' '<<k<<' '<<p<<' '<<dp[i][j][k][p]<<' '<<val<<endl;
				}
			}
		}
	}
	rep(i,17)
	{
		if(dp[0][0][m-1][i]>=n)
		{
			cout<<i<<endl;
			return 0;
		}
	} 
	return 0;
}

Measured memory_bytes: 471424
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map> 
#include <map> 
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
#include <bitset>
#include <memory>
#include <complex>
using namespace std;
typedef long long LL;

int main() {
    char x, y;
    cin >> x >> y;
    if (x == y) {
        cout << "=" << endl;
    }
    else if(x>y){
        cout << ">" << endl;
    }
    else {
        cout << "<" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
<?php

while (($line = trim(fgets(STDIN)))) {
    sscanf($line, '%d %d', $H, $W);
    if ($H === 0 && $W === 0) {
        break;
    }
    
    for($i=0;$i<$H;$i++){
        for($j=0;$j<$W;$j++){
            if($j==0||$j==($W-1)||$i==0||$i==($H-1)){
                echo "#";
            }else{
                echo ".";
            }
        }
        echo PHP_EOL;
    }
    echo PHP_EOL;
}


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

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    ll a,b; cin>>a>>b;
    ll sum=0;
    vector<ll> s(1000,0);
    for(int i=1;i<=999;i++){
        s[i]=s[i-1]+i;
    }
    ll ans=s[b-a-1]-a;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3640