akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <stdio.h>
#include <set>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
#define MOD 1000000007
using namespace std;

int main(void)
{
	lli H; cin >> H;
	lli count = 1;
	while (H > 0) {
		count*=2;
		H /= 2;
	}
	cout << (count - 1) << endl;

	return 0;
}


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

using namespace std;
typedef long long ll;

int main() {
    int n,m;
    priority_queue<int> q;
    cin >>  n >> m;
    for(int i=0; i < n; i++) {
        int num;
        cin >> num;

        q.push(num);
    }

    for(int i=0; i < m; i++) {
        int num = q.top();
        q.pop();

        q.push(num/2);
    }

    ll sum = 0;
    while(!q.empty()) {
        sum += q.top();
        q.pop();
    }

    cout << sum;
}

Measured memory_bytes: 892
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <sstream>

using namespace std;

#define INF (1 << 28)
#define MAX_V 12000

struct edge{
	int to;
	int cost;
};

typedef pair<int, int> P; // first??????????????¢???second??????????????????

vector<edge> G[MAX_V];
int d[MAX_V];

// ?????????O(|E|log|V|)

void shortest_path(int s, int V){ // V???????????°
	
	priority_queue<P, vector<P>, greater<P> > que;
	
	for(int i = 0; i < V; i++){
		d[i] = INF;
	}
	d[s] = 0;
	
	que.push(P(0, s));
	
	while(!que.empty()){
		
		P p = que.top();
		que.pop();
		
		int v = p.second;
		
		if(d[v] < p.first){
			continue;
		}
		
		for(int i = 0; i < G[v].size(); i++){
			edge e = G[v][i];
			if(d[e.to] > e.cost + d[v]){
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		} // ????????????????°???????????????´??°
	}
}

int main(){
	
	int N, M, L;
	
	while(true){
		
		cin >> N >> M >> L;
		
		if(N == 0){
			break;
		}
		
		for(int i = 0; i < N * (L + 1); i++){
			G[i].erase(G[i].begin(), G[i].end());
		}
		
		for(int loop = 0; loop < M; loop++){
			int A, B, D, E;
			cin >> A >> B >> D >> E;
			A--;
			B--;
			for(int i = D; i <= L; i++){
				edge e1;
				e1.cost = 0;
				e1.to = A + (i - D) * N;
				G[B + i * N].push_back(e1);
				e1.to = B + (i - D) * N;
				G[A + i * N].push_back(e1);
			}
			for(int i = 0; i <= L; i++){
				edge e1;
				e1.cost = E;
				e1.to = A + i * N;
				G[B + i * N].push_back(e1);
				e1.to = B + i * N;
				G[A + i * N].push_back(e1);
			}
		}
		
		for(int i = 0; i < N; i++){
			edge e1;
			e1.cost = 0;
			for(int j = 0; j < L; j++){
				e1.to = i + j * N;
				G[i + (j + 1) * N].push_back(e1);
			}
		}
		
		shortest_path(L * N, (L + 1) * N);
		
		/*
		for(int i = 0; i <= L; i++){
			for(int j = 0; j < N; j++){
				cout << d[j + i * N] << " ";
			}
			cout << endl;
		}
		*/
		
		cout << d[N - 1] << endl;
	}
	
	return 0;
}

Measured memory_bytes: 10048
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> A(N);
    
    int sum_vote = 0;
    for (int i = 0; i < N; i++){
        cin >> A[i];
        sum_vote = sum_vote + A[i];
    }
    sort(A.begin(), A.end(), std::greater<int>());

    int cnt = 0;
    for (int i = 0; i < M; i++){        
        //cout << (double)A[i] << " " << (double)sum_vote / (4.0 * (double) M);
        if ((double)A[i] >= (double)sum_vote / (4.0 * (double) M)){
            cnt++;
        }
    }

    if (cnt == M){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

N, X = map(int, input().split())
H = [0] * N
for i in range(N):
    H[i] = int(input())

H = sorted(H)

left = 0
right = X
ans = INF
while right <= N:
    mn = H[left]
    mx = H[right - 1]
    ans = min(ans, mx - mn)
    left += 1
    right += 1
print(ans)



Measured memory_bytes: 14488
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder.ABC
{
    class Program
    {
        static void Main ()
        {
            Console.WriteLine (Solve (int.Parse (Console.ReadLine ())).Min ());
        }
        static IEnumerable<int> Solve (int n)
        {
            for (var i = 0; i <= n; i++)
            {
                var j = n - i;
                var cnt6 = Enumerable.Range (0, i)
                    .Select (p => Math.Pow (6, p))
                    .TakeWhile (val => val <= i)
                    .Select (val => Math.Floor (i / val) % 6)
                    .Sum (val => (int) val);
                var cnt9 = Enumerable.Range (0, j)
                    .Select (p => Math.Pow (9, p))
                    .TakeWhile (val => val <= j)
                    .Select (val => Math.Floor (j / val) % 9)
                    .Sum (val => (int) val);
                yield return cnt6 + cnt9;
            }
        }
    }
}

Measured memory_bytes: 17560
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<pair<int, pair<int, int>>> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i].second.first >> a[i].second.second >> a[i].first;
	}
	sort(a.rbegin(), a.rend());

	int cx = 0, cy = 0, ch = 0;
	for (int i = 0; i < 101; i++) {
		for (int j = 0; j < 101; j++) {
			int h = a[0].first + abs(i - a[0].second.first) + abs(j - a[0].second.second);
			bool ok = true;

			for (int k = 1; k < n; k++) {
				if (a[k].first != max(h - abs(i - a[k].second.first) - abs(j - a[k].second.second), 0)) {
					ok = false;
					break;
				}
			}
			
			if (ok) {
				if (ch < h) {
					cx = i;
					cy = j;
					ch = h;
				}
			}
		}
	}
	printf("%d %d %d\n", cx, cy, ch);

	return 0;
}

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

int N, C;
int field[10][10];
bool flgs[10][10];

int di[6] = {-1, -1, 0, 0,1, 1};
int dj[6] = {-1, 0, -1, 1,0, 1};
int dfs(int i, int j, int c){
	flgs[i][j] = false;	
	bool zero = false;
	int ans = 1;
	for(int k = 0; k < 6; k++){
		int ni = i + di[k];
		int nj = j + dj[k];
		if(0 <= ni && ni < N && 0 <= nj && nj <= ni && flgs[ni][nj]){
			if(field[ni][nj] == 0){
				zero = true;
			}
			if(field[ni][nj] == c){
				int ret = dfs(ni, nj, c);
				if(ret == 0){
					ans = 0;
					zero = true;
				}
				else ans += ret;
			}
		}
	}
	if(zero) return 0;
	return ans;
}

int check(){
	for(int i = 0; i < 10; i++){
		for(int j = 0; j < 10; j++){
			flgs[i][j] = true;
		}
	}

	int ans = 0;
	for(int i = 0; i < N; i++){
		for(int j = 0; j <= i; j++){
			if(flgs[i][j]){
				if(field[i][j] == C){
					ans -= dfs(i, j, C);
				}else if(field[i][j] != 0){
					ans += dfs(i, j, field[i][j]);
				}
			}
		}
	}
	return ans;
}

int main(){
	while(cin >> N >> C, N){
		for(int i = 0; i < N; i++){
			for(int j = 0; j <= i; j++){
				cin >> field[i][j];
			}
		}
		int ans = -100000;
		for(int i = 0; i < N; i++){
			for(int j = 0; j <= i; j++){
				if(field[i][j] == 0){
					field[i][j] = C;
					int val = check();
					ans = max(ans, val);
					field[i][j] = 0;
				}
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 3052
#include <bits/stdc++.h>
#define int long long
#define pii pair<int, int>
  
using namespace std;
const int inf = 1e9 + 7;

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



signed main() {
	/*freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);*/

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

    int n, x, y;
    cin >> n >> x >> y;

    vector<int> res(n + 1);
    for(int i = 1;i <= n;i++) {
    	for(int j = i + 1;j <= n;j++) {
    		int min_dist = dist(i, j);
    		min_dist = min(min_dist, min(dist(i, x) + 1 + dist(y, j), dist(i, y) + 1 + dist(x, j)));

    		res[min_dist]++;
    	}
    }

    for(int i = 1;i < n;i++) cout << res[i] << '\n';
}

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

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using namespace std;

int main() {
  ll R, G, B, N;
  cin >> R >> G >> B >> N;

  ll res = 0;
  FOR(r, 0, 3001) {
    FOR(g, 0, 3001) {
      const ll b = (N - (R * r + G * g)) / B;
      if (b >= 0 && R * r + G * g + B * b == N) {
        res++;
      }
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 3684
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ff(i, c, n) for (ll i = c; i < n; i++)
#define fr(i, c, n) for (ll i = c; i >= n; --i)
#define INF 1e9 + 7

const int inf=1e9+7;
int main(){
    ll h,w;
    cin>>h>>w;
    ll dp[h][w];
    ff(i,0,h){
        ff(j,0,w){
            char x;
            cin>>x;
            if(x=='#') {
                dp[i][j]=-1;
                if(i==0){
                    ff(k,j+1,w) dp[0][k]=-1;
                }
                else if(j==0){
                    ff(k,i+1,h) dp[k][0]=-1;
                }
            }
            else if(x=='.'&&(i==0||j==0)&&dp[i][j]!=-1) dp[i][j]=1;
            else if(x=='.'&&!(i==0||j==0)) {
                ll x=dp[i-1][j]==-1?0:dp[i-1][j];
                ll y=dp[i][j-1]==-1?0:dp[i][j-1];
                dp[i][j]=(x+y)%inf;
            }
            //cout<<dp[i][j]<<" ";
        }
        //cout<<"\n";
    }
    cout<<dp[h-1][w-1];
    
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <typename T>  ostream& operator<<(ostream& os, const vector<T>& v)  {  for (int i = 0; i < (int)v.size(); ++i) {  os << v[i];  if (i != (int)v.size() - 1)  os << ' ';  } return os;  }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }


/*
 * 働ける日だが働かない日をiとして、i日目無しでk日達成できるかを確認する.
 * 以下i) ~ ii)のいずれかを満たす場合k日達成できる.
 * i) i-c+1以前とi+1以後でk日達成している
 * ii) i+c-1以後とi-1以前だけでk日達成している
 */
int main() {
  string s;
  int n,k,c; cin >> n >> k >> c >> s;
  if (n==k and k==1) {
    cout << 1 << endl;
    return 0;
  }

  vector<int> accl(n, 0), accr(n, 0);
  loop(i,0,n) {
    if (i == 0) accl[i] = s[i] == 'o';
    else if (i-c-1 < 0) accl[i] = max(accl[i-1], (int)(s[i] == 'o'));
    else {
      chmax(accl[i], accl[i-c-1] + (int)(s[i]=='o'));
      chmax(accl[i], accl[i-1]);
    }
  }

  for (int i=n-1; i>=0; i--) {
    if (i==n-1) accr[i] = s[i]=='o';
    else if (i+c+1 >= n) accr[i] = max(accr[i+1], (int)(s[i] == 'o'));
    else {
      chmax(accr[i], accr[i+c+1] + (int)(s[i]=='o'));
      chmax(accr[i], accr[i+1]);
    }
  }
  // cout << accl << endl;
  // cout << accr << endl;

  loop(i,0,n) {
    if (s[i]=='x') continue;
    bool ok = false;
    {
      int num = 0;
      if (i-1 >= 0) num += accl[i-1];
      if (i+1 < n) num += accr[i+1];
      ok |= num >= k;
    }
    {
      int num = 0;
      if (i+1 < n) num += accr[i+1];
      if (i-1 >= 0) num += accl[i-1];
      ok |= num >= k;
    }
    if (!ok) {
      cout << i+1 << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 5224
#include<bits/stdc++.h>
#define INF 0x7fffffff
#define INFLL 1e17
#define PI 2*acos(0.0)
#define show(x) cout<< #x <<" is "<< x <<"\n"
using namespace std;

#define FS first
#define SC second
#define PB(t) push_back(t)
#define LEN(t) ((int)t.size())
#define ALL(t) t.begin(),t.end()
#define MP(x, y) make_pair((x), (y))
#define Fill(a,c) memset(&a, c, sizeof(a))
#define POPCOUNT __builtin_popcount

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<PII> VPII;

int main() {
    #ifdef LJ
        freopen("input.txt", "rt", stdin);
        freopen("output.txt", "wt", stdout);
    #endif

    ios::sync_with_stdio(false);
    cin.tie(NULL);
    
    string str;
    for (int n; cin >> n >> str;) {
        if (n & 1) {
            cout << "No\n";
        } else {
            string mid1 = str.substr(0, n / 2);
            string mid2 = str.substr(n / 2, n/2);
            if (mid1 == mid2) {
                cout << "Yes\n";
            } else {
                cout << "No\n";
            }
        }
    }
    
    return 0;
}


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

using namespace std;

typedef pair<int,int> pi;
typedef long long ll;

ll N, A[100005], tot;

ll ft[100005];

void die(){
	cout << -1 << '\n';
	exit(0);
}

void update(int x, int v){
	for (; x <= 100000; x += (x & -x)){
		ft[x] += v;
	}
}

ll query(int x){
	ll sum = 0;
	for (; x; x -= (x & -x)){
		sum += ft[x];
	}
	return sum;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	set<int> s;
	cin >> N;
	for (int i = 0; i <= N; ++i){
		cin >> A[i];
	}
	A[N]--;
	update(2,1);
	update(N+2,-1);
	tot = N+1;
	for (ll i = 0; i <= N; ++i){
		if (A[i] == 0) continue;
		int pos = 0;
		for (int k = 20; k >= 0; --k){
			if (pos + (1 << k) > N+1) continue;
			if (ft[pos + (1 << k)] == 0) pos += (1 << k); 
		}
		pos++;
		//cerr << pos << '\n';
		ll x = pos;
		for (; pos <= i+1; ++x){
			ll amt = query(x);
			if (amt < A[i]){
				tot += amt;
				update(x,-amt);
				update(x+1,amt);
				update(x+1,2*amt);
				update(x+2,-2*amt);
			}
			else{
				tot += (i - x+1) * A[i];
				update(x,-A[i]);
				update(x+1,2*A[i]);
				update(i+2,-A[i]);
				break;
			}
		}
		if (x > i+1) die();
		tot += A[i];
		/*
		cout << tot << '\n';
		for (int j = 1; j <= N+1; ++j){
			cout << query(j) << ' ';
		}
		cout << '\n';
		*/
	}
	cout << tot << '\n';
}

Measured memory_bytes: 5204
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
#define rep(i, n) for(long long int i = 0; i < (n); i++)


int Len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}


int Sint(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}


int Svec(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}


int GCD(int a,int b){
  int r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return b;
}


int LCM(int a,int b){
  int c=a,d=b,r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return c/b*d;
}


int Factorial(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}


/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  long long int n;
  cin>>n;
  vector<long long int> v(n),w(n);
  rep(i,n){
    cin>>v[i];
    w[i]=v[i];
  }
  sort(w.begin(),w.end());
  long long int l,r;
  r=w[n/2];
  l=w[n/2-1];
  rep(i,n){
    if(v[i]<=l){
      cout<<r<<endl;
    }else{
      cout<<l<<endl;
    }
  }
  
}

Measured memory_bytes: 5376
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#define pb emplace_back
using namespace std;
typedef long long li;

const int maxn = 1010;
int n;
li a[maxn];
int b[maxn], c[maxn];
vector< pair<int, int> > g;
vector<int> opt;

int main(void) {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i)
    scanf("%lld", a + i);
  int cnt = 0;
  li sumx = 0, sumy = 0;
  for (int i = 1; i <= n; ++i) {
    if (a[i] <= 0) continue;
    ++cnt;
    if (i & 1) {
      sumx += a[i];
      b[i] = 1;
    } else {
      sumy += a[i];
      c[i] = 1;
    }
  }
  
  if (!cnt) {
    int pos = 1;
    for (int i = 2; i <= n; ++i)
      if (a[i] > a[pos]) pos = i;
    printf("%lld\n", a[pos]);
    for (int i = n; i > pos; --i) opt.pb(i);
    for (int i = 1; i < pos; ++i) opt.pb(1);
    printf("%d\n", (int)opt.size());
    for (int i = 0; i < opt.size(); ++i) printf("%d\n", opt[i]);
    return 0;
  }
  
  if (sumx < sumy) {
    for (int i = 1; i <= n; ++i) b[i] = c[i];
  }
  printf("%lld\n", max(sumx, sumy));
  int l = 1;
  while (l <= n && !b[l]) {
    opt.pb(1);
    ++l;
  }
  int r = n;
  while (!b[r]) {
    opt.pb(r - l + 1);
    --r;
  }
  int pre = l, p = l + 1;
  while (p <= r) {
    if (b[p]) {
      g.pb(pre, p);
      pre = p;
    }
    ++p;
  }
  for (int i = 0; i < g.size(); ++i) {
    int tmp = g[i].second - g[i].first - 2;
    if (tmp <= 0) {
      opt.pb(2);
      continue;
    }
    tmp /= 2;
    for (int j = 1; j <= tmp; ++j) opt.pb(3);
    opt.pb(2);
  }
  printf("%d\n", (int)opt.size());
  for (int i = 0; i < opt.size(); ++i) printf("%d\n", opt[i]);
  
  return 0;
}


Measured memory_bytes: 256
package main

import (
	"math/rand"
	"time"
	"os"
	"bufio"
	"fmt"
	"strconv"
)

var(
	inf = 10000000071000000
	stdin = bufio.NewReader(os.Stdin)
	mod = 1000000007
	mod9 = 1000000009
)

func init()  {
	rand.Seed(time.Now().UnixNano())
}


func main() {
	n := goint();m := goint()
	uni := UnionFind{}
	uni.uniInit(n)
	p := intLine(n,-1)
	for i:=0;i<m;i++{
		uni.connect(goint()-1,goint()-1)
	}
	count := 0
	for i:= range p{
		if i == p[i] || (uni.root(i) == uni.root(p[i])) {
			count ++
		}
	}
	fmt.Println(count)
}

//Union-Find
type UnionFind struct {
	par []int
}

func (u *UnionFind) uniInit(n int)  {
	u.par = make([]int,n)
	for i:=0;i<n;i++{
		u.par[i] = -1
	}
}

//aがどのグループに属しているか
func (u *UnionFind) root (a int) int {
	if u.par[a] < 0{
		return a
	}
	u.par[a] = u.root(u.par[a])
	return u.par[a]
}

//自分のグループの頂点数
func (u *UnionFind) size (a int) int {
	return -u.par[u.root(a)]
}

//つなげる
func (u *UnionFind) connect(a,b int) bool {
	a = u.root(a)
	b = u.root(b)
	if a == b {
		return false
	}
	if u.size(a) < u.size(b) {a,b = b,a}
	u.par[a] += u.par[b]
	u.par[b] = a
	return true
}

//||||||||||||||||||||||||||入力|||||||||||||||||||||||||||||||||||||||

//次のスペースか改行まで読み込む
func gostring() string {
	byte_ls := make([]byte,0)
	for  {
		b, _ := stdin.ReadByte()
		if b == 32 || b == 10 || b == 0{
			return string(byte_ls)
		} else if b == 13 {
			continue
		} else {
			byte_ls = append(byte_ls,b)
		}
	}
}

//上の関数のintバージョン
func goint() int {
	n,_ := strconv.Atoi(gostring())
	return n
}

//数字一行
func intLine(n ,a int) []int {
	ls := make([]int,n)
	for i,_ := range ls{
		ls[i] = goint() + a
	}
	return ls
}

//|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

func sum(a ...int) int {
	ans := 0
	for i:=0;i<len(a);i++{
		ans += a[i]
	}
	return ans
}

func min(a ...int) int {
	ans := a[0]
	for i:=1;i<len(a);i++{
		if ans > a[i]{
			ans = a[i]
		}
	}
	return ans
}

func abs(n int) int {
	if n >= 0{
		return n
	} else {
		return -n
	}
}

func max(a ...int) int {
	ans := a[0]
	for i:=1;i<len(a);i++{
		if ans < a[i]{
			ans = a[i]
		}
	}
	return ans
}

Measured memory_bytes: 4608
#include <stdio.h>

int main(void)
{
	int college[5][4][11] = {};

	int n, i, b, f, r, v;
	scanf("%d", &n);

	for (i = 0; i < n; i++) {
		scanf("%d %d %d %d", &b, &f, &r, &v);
		college[b][f][r] += v;
	}

	for (b = 1; b < 5; b ++) {
		for (f = 1; f < 4; f++) {
			for(r = 1; r < 11; r++) {
				printf(" %d", college[b][f][r]);
			}
			printf("\n");
		}
		if (b != 4) puts("####################");
	}

	return 0;
}

Measured memory_bytes: 612
#include<bits/stdc++.h>
using namespace std;
int a1,a2;
int main()
{
    cin>>a1>>a2;
    double a=1.0*a1*a2/(a1+a2);
    printf("%.10f",a);
    return 0;
}
//
//                       _oo0oo_
//                      o8888888o
//                      88" . "88
//                      (| -_- |)
//                      0\  =  /0
//                    ___/`---'\___
//                  .' \\|     |// '.
//                 / \\|||  :  |||// \
//                / _||||| -:- |||||- \
//               |   | \\\  -  /// |   |
//               | \_|  ''\---/''  |_/ |
//               \  .-\__  '-'  ___/-. /
//             ___'. .'  /--.--\  `. .'___
//          ."" '<  `.___\_<|>_/___.' >' "".
//         | | :  `- \`.;`\ _ /`;.`/ - ` : | |
//         \  \ `_.   \_ __\ /__ _/   .-` /  /
//     =====`-.____`.___ \_____/___.-`___.-'=====
//                       `=---='
//
//
//     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
//               佛祖保佑         永无BUG
//
//
//

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


int main()
{
  int n,a[100];
  cin >> n;
  for(int i = 0;i < n;i++){
    cin >> a[i];
  }
  sort(a,a+n);
  int alice,bob;
  alice = 0;
  bob = 0;
  for(int i = n - 1;i >= 0;i--){
    if((n-1)%2 == i%2) alice += a[i];
    else bob += a[i];
  }
  cout << (alice - bob) << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
	string a,b,c;
    cin>>a;
    cin>>b;
	sort(b.begin(),b.end());
    reverse(b.begin(),b.end());
    sort(a.begin(),a.end());
    if (a<b) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define pii pair<int, int>
#define endl '\n'
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define vpii vector<pii>
typedef long long ll;
typedef long double ld;
using namespace std;
template<class T> using minheap = priority_queue<T, vector<T>, greater<T>>;


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

  int n;
  cin >> n;
  vi d(n);
  for (int& x : d) 
    cin >> x;
  ll sum = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      sum += d[i] * d[j];
    }
  }
  cout << sum << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " is " << x << endl

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

const int INF = 1e9 + 7;

signed main()
{
	IO_OP;
	
	int x, y;
	cin >>x >> y;
	cout << (1^2^3^x^y) << endl;
	
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
using LP=pair<ll,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007,MOD2=998244353;

int D;
vector<int> c(26);
vector<vector<int>> s;
vector<int> spa(26,0);//経過日数
vector<int> t;
ll contest(int day,int x){//day日にコンテストxを開催した時の満足度の増加量 1-indexed
    ll now=s.at(day-1).at(x-1);
    rep(i,26){
        if(i==x-1){
            spa.at(i)=0;
            continue;
        }
        spa.at(i)++;
        now-=spa.at(i)*c.at(i);
    }
    return now;
}

int main() {
    cin>>D;
    rep(i,26)cin>>c.at(i);
    s.resize(D,vector<int>(26));
    rep(i,D)rep(j,26){cin>>s.at(i).at(j);}
    t.resize(D);
    rep(i,D)cin>>t.at(i);
    ll ans=0;
    rep(i,D){
        ans+=contest(i+1,t.at(i));
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 3684
#include<stdio.h>
int main(void)
{
	int D, N;
	scanf("%d%d", &D, &N);
	if (D == 0) {
		if (N == 100) {
			printf("101");
		}
		else {
			printf("%d", N);
		}
	}
	if (D == 1) {
		if (N == 100) {
			printf("10100");
		}
		else {
			printf("%d", N * 100);
		}
	}
	if (D == 2) {
		if (N == 100) {
			printf("1010000");
		}
		else {
			printf("%d", N * 10000);
		}
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <map>
#define rep for(int i = 0; i<n; i++)

using namespace std;

int main()
{	
	map<int, int> v;
	int n, a,ans =0;
	cin >> n;
	rep
	{
		cin >> a;
		if (!v[a])
		{
			v[a]++;
			ans++;
		}
		else
		{
			v[a]--;
			ans--;
		}
	}
	cout << ans << endl;

    return 0;
}

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

const int MAXN = 200020;
int NODOS = 0;
typedef int Costo;
const Costo INF = 1 << 30;

typedef pair<Costo, int> CostoNodo;
vector<CostoNodo> grafoCosto[MAXN];
const bool bi = false;
// Grafos con ponderacion.
// Nodos indexados de 0 a n - 1.
// bi = true -> Bidireccional.
// bi = false -> Dirigido.

struct Ponderada{
  int x, y;
  Costo c;
  Ponderada(){}
  Ponderada(int x_, int y_, int c_) : x(x_), y(y_), c(c_) {}
  bool operator<(const Ponderada& q) const {
    return c < q.c ? true : false;
  }
};

void AgregarArista(int u, int v, Costo c) {
  if (bi) grafoCosto[v].push_back(CostoNodo(c, u));
  grafoCosto[u].push_back(CostoNodo(c, v));
}

void limpia(){
  for( int i = 0; i < NODOS; i++ )
    grafoCosto[i].clear();
}

// Algoritmo de dijkstra desde el nodo s.
// Devuelve el vector de distancias a todos
// los nodos desde s. Un valor INF indica que
// no es posible ir de s al respectivo nodo.
Costo dist[MAXN];
void Dijkstra(int s) {
  for( int i = 0; i < NODOS; i++ ) dist[i] = INF;
  priority_queue<CostoNodo> pq;
  pq.push(CostoNodo(0, s)), dist[s] = 0;
  while (!pq.empty()) {
    Costo p = -pq.top().first;
    int u = pq.top().second; pq.pop();
    if (dist[u] < p) continue;
    for (CostoNodo arista : grafoCosto[u]) {
      int v = arista.second;
      p = dist[u] + arista.first;
      if (p < dist[v]) dist[v] = p, 
        pq.push(CostoNodo(-p, v));
    }
  }
}

int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	int casos, N, M, S, T, x, y, c;

	cin >> N >> M >> S;
	NODOS = N;

	limpia();
	for( int i = 0; i < M; i++ ){
		cin >> x >> y >> c;
		AgregarArista( x, y, c );
	}
	Dijkstra( S );

	for( int i = 0; i < NODOS; i++ ){
		if( dist[i] == INF ){
			cout << "INF\n";
		}
		else
			cout << dist[i] << '\n';
	}
	
	return 0;
}

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

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

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

    // start
    int r, g;
    cin >> r >> g;
    cout << g * 2 - r << endl;
    // end

    return 0;
}


Measured memory_bytes: 256
N = int(input())
color = list(input())

left = 0
right = N-1

ans = 0

while left < right:
    while color[left] == "R":
        left += 1
        if left >= N:
            break

    while color[right] == "W":
        right -= 1
        if right < 0:
            break
    
    if left < right:
        ans += 1
        left += 1
        right -= 1

print(ans)

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

using namespace std;
inline void FAST_IO(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);}

int main(){
	FAST_IO();
	
	int a,b,c;
	cin >> a >> b >> c;
	if(a > b) swap(a,b);
	if(a <= c && b >= c) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}

Measured memory_bytes: 256
program abc159d2
      implicit none
      integer::n, a(200000)=0,i
      integer(8)::b(200000)=0,x=0

!Aは元データ
!Bは書かれている数字がそれぞれ何個ずつあるかを格納している配列

         read(*,*) n
         read(*,*) a(1:n)
         do i=1,n
            b(a(i))=b(a(i))+1
         end do
         do i=1,n
            x=x+(b(i)*(b(i)-1))/2
         end do
         do i=1,n
            print *, x-(b(a(i))-1)  !(n*(n-1))/2-((n-1)*(n-2)/2)=n-1
         end do
         stop

   end program abc159d2

Measured memory_bytes: 7424
#include <iostream>

using namespace std;

int C[12];
int A[12][12];

int main() {
  int N, M, X;
  cin >> N >> M >> X;

  for (int i = 0; i < N; ++i) {
    cin >> C[i];
    for (int j = 0; j < M; ++j) {
      cin >> A[i][j];
    }
  }

  int min = -1;
  for (int i = 0; i < (1 << N); ++i) {
    int cost = 0;
    int a[12];
    for (int j = 0; j < 12; ++j) {
      a[j] = 0;
    }
    for (int j = 0; j < N; ++j) {
      if ((i >> j) & 1) {
        cost += C[j];
        for (int k = 0; k < M; ++k) {
          a[k] += A[j][k];
        }
      }
    }
    bool ok = true;
    for (int j = 0; j < M; ++j) {
      if (a[j] < X) {
        ok = false;
      }
    }
    if (ok && (min == -1 || min > cost)) {
      min = cost;
    }
  }
  cout << min << endl;
}

Measured memory_bytes: 3616
#入力
nk=gets
ppp=gets
n,k=nk.split(" ")
p_ar=ppp.split(" ")
n,k = [n,k].map{|n| n.to_i}
p_ar = p_ar.map{|n| n.to_i}
#nこ選ぶ
sum=0
for i in 1..k
  sum+=p_ar.min
  p_ar.delete_at(p_ar.index(p_ar.min))
end
#出力
p sum


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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

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

struct edge {
	int to, cost;
	edge(int t,int c):to(t),cost(c) {}
};


//-----------------------------------------------------------------------------

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

	string s;cin>>s;
	int cnt=0;
	REP(i,3) if(s[i]=='1') cnt++;
	cout<<cnt<<endl;

	return 0;
}


Measured memory_bytes: 256
/** MIT License Copyright (c) 2018 Vasilyev Daniil **/
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
template<typename T> using v=vector<T>;
#define int long long
typedef string str;
typedef vector<int> vint;
#define rep(a,l,r) for(int a=(l);a<(r);a++)
#define pb push_back
#define sz(a) ((int)(a).size())
const long long inf=4611686018427387903;//2^62-1
#if 0 //FileIO
ifstream fin ("input.txt" );
ofstream fout("output.txt");
#define get fin>>
#define put fout<<
#else
#define get cin>>
#define put cout<<
#endif
#define eol put endl
void read(){}             template<typename Arg,typename... Args> void read (Arg& arg,Args&... args){get   (arg)     ;read(args...) ;}
void print(){}            template<typename Arg,typename... Args> void print(Arg  arg,Args...  args){put   (arg)<<" ";print(args...);}
void debug(){cout<<endl;} template<typename Arg,typename... Args> void debug(Arg  arg,Args...  args){cout<<(arg)<<" ";debug(args...);}
int getInt(){int a; get a; return a;}
//code goes here
void run(){
    int n,c;read(n,c);
    int d[c][c];rep(i,0,c)rep(j,0,c)get d[i][j];
    int g[n][n];rep(i,0,n)rep(j,0,n)get g[i][j];
    int ans=inf;
    int arr[3][c];rep(i,0,c)rep(j,0,3)arr[j][i]=0;
    rep(i,0,n)rep(j,0,n)arr[(i+j)%3][g[i][j]-1]++;
    rep(i,0,c)rep(j,0,c)rep(k,0,c){
        if(i==j||i==k||j==k)continue;
        int pos=0;
        rep(z,0,c)pos+=d[z][i]*arr[0][z];
        rep(z,0,c)pos+=d[z][j]*arr[1][z];
        rep(z,0,c)pos+=d[z][k]*arr[2][z];
        ans=min(ans,pos);
    }
    put ans;
}
int32_t main() {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);run();return 0;}


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

int R(int idx,int goal){
  return goal+((goal-idx)&1);
}
int L(int idx,int goal){
  return goal+((idx-goal)&1);
}
int ans[123456];

signed main(){
  string s;cin>>s;
  int n=s.size();
  set<int> RL;
  for(int i=0;i<n-1;i++)if(s[i]=='R'&&s[i+1]=='L')RL.insert(i);
  for(int i=0;i<n;i++){
    if(s[i]=='R')ans[R(i,*RL.lower_bound(i))]++;
    else ans[L(i,*--RL.upper_bound(i))]++;
  }
  for(int i=0;i<n;i++)cout<<ans[i]<<" ";cout<<endl;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
 
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const ll INF = 1023456789;
 
#define REP(i,n)	for(int i=0;i<n;++i)
#define REPR(i,n)	for(int i=n-1;i>=0;--i)
#define FOR(i,s,n)	for(int i=s;i<n;++i)
#define FORR(i,s,n)	for(int i=n-1;i>=s;--i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define F			first
#define S			second
 
int main(int argc, char **argv) {
	ll a, b;
	cin >> a >> b;
	if (b < 10) b += a * 10;
	else if (b < 100) b += a * 100;
	else b += a * 1000;
	ll i = 1;
	for (ll i = 1; i * i <= b; ++i) if (i * i == b) {
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
	return 0;
}
 

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
using namespace std;
#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 Sort(a) sort(a.begin(),a.end())
#define pb push_back
#define vl vector<ll>
#define vll vector<vector<ll>>
#define INF 999999999999

int main(){
  int K,X; ll x;
  cin>>K>>X;

  x=X-(K-1);
  while(x!=X+K){
    cout<<x<<" ";
    x++;
  }
return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <numeric>
#include <deque>
using namespace std;
typedef long long int ll;

char t[4]={'A','N','a','n'};

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int a[4]={};
    int n; cin >> n;
    string s; cin >> s;
    for(char c:s){
        if('A'<=c&&c<='M')a[0]++;
        if('N'<=c&&c<='Z')a[1]++;
        if('a'<=c&&c<='m')a[2]++;
        if('n'<=c&&c<='z')a[3]++;
    }
    if(a[0]>a[1]){
        a[0]-=a[1];
        a[1]=0;
    }else{
        a[1]-=a[0];
        a[0]=0;
    }
    if(a[2]>a[3]){
        a[2]-=a[3];
        a[3]=0;
    }else{
        a[3]-=a[2];
        a[2]=0;
    }
    cout << a[0]+a[1]+a[2]+a[3] << endl; 
    for(int i=0;i<4;i++){
        for(int j=0;j<a[i];j++){
            cout << t[i];
        }
    }
    cout << endl;
}


Measured memory_bytes: 3320
fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val map = mutableMapOf<Pair<Char, Char>, Int>()
    for (i in 1..N) {
        val s = i.toString()
        map.put(s.first() to s.last(), map.getOrElse(s.first() to s.last(), { 0 }) + 1)
    }
    var count = 0
    for ((pair, value) in map) {
        count += value * map.getOrElse(pair.second to pair.first, { 0 })
    }
    println(count)
}



Measured memory_bytes: 40980
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Edge
    {
        internal int from, to, cost;

        public Edge(int from, int to, int cost)
        {
            this.from = from;
            this.to = to;
            this.cost = cost;
        }
    }

    class Union_Find
    {
        internal int[] parents, rank;

        public Union_Find(int n)
        {
            parents = Enumerable.Range(0, n).ToArray();
            rank = new int[n];
        }

        public int Find(int x)
        {
            if (parents[x] == x) return x;
            else return parents[x] = Find(parents[x]);
        }

        public void Unite(int x, int y)
        {
            x = Find(x);
            y = Find(y);

            if (x == y) return;

            if (rank[x] < rank[y])
            {
                parents[x] = y;
            }
            else
            {
                parents[y] = x;
                if (rank[x] == rank[y]) rank[x]++;
            }
        }

        public bool Same(int x, int y)
        {
            return Find(x) == Find(y);
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int V = int.Parse(input[0]);
            int E = int.Parse(input[1]);

            List<Edge> edges = new List<Edge>();

            for (int i = 0; i < E; i++)
            {
                input = Console.ReadLine().Split(' ');
                int s = int.Parse(input[0]);
                int t = int.Parse(input[1]);
                int w = int.Parse(input[2]);
                edges.Add(new Edge(s, t, w));
            }

            Console.WriteLine(Kruskal(edges, V));
        }

        static int Kruskal(List<Edge> edges, int V)
        {
            edges.Sort((a, b) => a.cost - b.cost);
            Union_Find UF = new Union_Find(V);

            int totalCost = 0;
            int len = edges.Count;

            for (int i = 0; i < len; i++)
            {
                Edge e = edges[i];

                if (!UF.Same(e.from, e.to))
                {
                    UF.Unite(e.from, e.to);
                    totalCost += e.cost;
                }
            }
            return totalCost;
        }
    }
}

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

using namespace std;

int a[200007];
int b[200007];

int main()
{
    long long int y=0, n, m, k, i, j, w=0, o=0, x=0, czy=1;
    cin >> n >> m >> k;
    for(i=0; i<n; i++){
        cin >> a[i];
        if((o+a[i]<=k)&&(czy)){
            o+=a[i];
            x++;
        }
        else{
            czy=0;
        }
    }
    czy=1;
    for(i=0; i<m; i++){
        cin >> b[i];
        if((o+b[i]<=k)&&(czy)){
            o+=b[i];
            y++;
        }
        else{
            czy=0;
        }
    }
    w=max(w, x+y);
    for(i=x-1; i>=0; i--){
        o-=a[i];
        x--;
        while(o+b[y]<=k){
            o+=b[y];
            y++;
            if(y>=m){
                break;
            }
        }
        w=max(w, x+y);
    }
    cout << w << '\n';
    return 0;
}


Measured memory_bytes: 5104
n = gets.to_i
n.times{
    score = 0 
    out_count = 0
    runners = [0, 0, 0]

    until out_count == 3
        event = gets.chomp
        case event
        when "HIT"
            score += 1 if runners[2] == 1
            runners[2] = runners[1]
            runners[1] = runners[0]
            runners[0] = 1
        when "HOMERUN"
            score += runners.count(1) + 1
            runners = [0, 0, 0]
        when "OUT"
            out_count += 1
        end
    end
    puts score
}

Measured memory_bytes: 8548
#include <iostream>

using namespace std;

int main(){
  char s[11] = {};
  int l;
  int c = -1;
  cin >> s;
  l = strlen(s);
  if (s[0] != 'A') {
    cout << "WA" << endl;
    return(0);
  }
  if (!(97<=int(s[1]) && int(s[1]) <= 122)) {
    cout << "WA" << endl;
    return(0);
  }
  if (!(97<=int(s[l-1]) && int(s[l-1]) <= 122)) {
    cout << "WA" << endl;
    return(0);
  }

  for (int i=2;i<l-1;i++) {
    if (s[i] == 'C') {
      if (c > 0) {
	cout << "WA" << endl;
	return(0);
      } else {
	c = i;
	continue;
      }
    } else if (!(97<=int(s[i]) && int(s[i]) <= 122)) {
	cout << "WA" << endl;
	return(0);
    }
  }
  if (c < 0) {
    cout << "WA" << endl;
  } else {
    cout << "AC" << endl;
  }
  return(0);
}




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

int main() {
  
  int A, B;
  cin >> A >> B ;
  
  if (A+B < 10) {
    cout << A+B << endl;
  }
  else {
    cout << "error" << endl;
  }
  
  
return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define repi(i, x) for (auto i = (x).begin(), i##_fin = (x).end(); i != i##_fin; i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a) ? "Yes" : "No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int, int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long, long long> P;
typedef vector<P> VP;
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;
}
const long long INFLL = 1LL << 60;
const int INF = 1 << 30;
const double PI = acos(-1);
int main()
{
	ll n;
	int ans = 0;
	cin >> n;
	ll bef = n;
	int count = 0;
	vector<int> trans;
	for (int i = 0; count < 64; i++)
	{
		count += i;
		trans.push_back(count);
		//	clog<<count<<" ";
	}
	clog << endl;
	map<ll, int> tri;
	while (bef > 1)
	{
		for (ll i = 2; i <= sqrt(bef); i++)
		{
			if (bef % i == 0)
			{
			//	clog << i << endl;
				tri[i] += 0;
				while (bef % i == 0)
				{
					tri[i]++;
					bef /= i;
				}
			}
		}
		if (bef != 1LL)
		{
			tri[bef] += 0;
			tri[bef]++;
			bef = 0LL;
		}
	}
	repi(itr, tri)
	{
	//	clog<<(itr->F)<<" "<<(itr->S)<<endl;
		ans += distance(trans.begin(), upper_bound(all(trans), (itr->S)))-1;
	}
	cout << ans << endl;
}


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

int main() {
    int n;
    cin >> n;
    vector<ll> a(n), b(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> b[i];
    }
    ll diff = accumulate(b.begin(), b.end(), 0ll);
    diff -= accumulate(a.begin(), a.end(), 0ll);
    if (diff < 0) {
        puts("No");
        return 0;
    }
    if (diff == 0) {
        bool can = true;
        for (int i = 0; i < n; i++) {
            if (a[i] != b[i]) {
                can = false;
            }
        }
        puts(can ? "Yes" : "No");
        return 0;
    }
    ll oneup = 0, twoup = 0;
    for (int i = 0; i < n; i++) {
        if(a[i] > b[i]){
            oneup += a[i] - b[i];
            continue;
        }
        if(a[i] < b[i]){
            twoup += (b[i] - a[i] + 1) / 2;
        }
    }
    puts(oneup <= diff && twoup <= diff ? "Yes" : "No");
}

Measured memory_bytes: 384
import sys
tmp = int(input())
a = tmp
b = [int(i) for i in input().split()]
cnt_list = [0] * a
flag_cnt = 0
while flag_cnt < a:
    flag_cnt = 0
    for j in range(a):
        if b[j] % 2 == 0:
            b[j] /= 2
            cnt_list[j] += 1
        else:
            flag_cnt += 1
print(sum(cnt_list))

Measured memory_bytes: 4148
a, b = map(int, input().split())
s = input()
bool = True
nums = [str(i) for i in range(10)]
if s[a] == "-":
    while True:
        for i in range(len(s)):
            if i == a:
                continue
            if not(s[i] in nums):
                print("No")
                quit()
        print("Yes")
        quit()
else:
    print("No")


Measured memory_bytes: 3060
#include<stdio.h>
#include<string.h>
int main(void)
{
	char s[1001];
	int l=0,j=0;
	int x[4]={0,0,0,0};
	scanf("%s",s);
	l=strlen(s);
	for(j=0;j<l;j++){
		if(s[j]=='N'){
			x[0]=1;
		}
		else if(s[j]=='S'){
			x[1]=1;
		}
		else if(s[j]=='E'){
			x[2]=1;
		}
		else if(s[j]=='W'){
			x[3]=1;
		}
	}
	if(x[0]==x[1] && x[2]==x[3]){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int h = sc.nextInt();
    int w = sc.nextInt();
    String[][] fig = new String[h][w];
    for(int i = 0; i < h; i++) {
      String s = sc.next();
      for(int j = 0; j < w; j++) {
        String t = String.valueOf(s.charAt(j));
        fig[i][j] = t;
      }
    }
    ArrayList<Integer> row = new ArrayList<Integer>();
    ArrayList<Integer> col = new ArrayList<Integer>();
    for(int i = 0; i < h; i++) {
      int p = 0;
      for(int j = 0; j < w; j++) {
        if(fig[i][j].equals("#")) p++;
      }
      if(p > 0) row.add(i); 
    }
    for(int j = 0; j < w; j++) {
      int p = 0;
      for(int i = 0; i < h; i++) {
        if(fig[i][j].equals("#")) p++;
      }
      if(p > 0) col.add(j); 
    }
    Collections.sort(row);
    Collections.sort(col);
    for(int i = 0; i < row.size(); i++) {
      String str = "";
      for(int j = 0; j < col.size(); j++) {
        str += fig[row.get(i)][col.get(j)];
      }
      System.out.println(str);
    }
  }
}


Measured memory_bytes: 28884
using System;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args) {
#if DEBUG
        using (var reader = new StreamReader("../TextFile1.txt")) {
            var count = 1; string str;
            while((str=Debugger.ReadBlock(reader))!= null) {
                System.Diagnostics.Debug.WriteLine("----------" + count++ + "----------");
                System.Diagnostics.Debug.WriteLine(process(new StringReader(str)));
            }
        }
        System.Diagnostics.Debug.WriteLine("-----END DEBUG-----");
#endif
#if !DEBUG
        object ret = process(new System.IO.StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var s     = input.ReadLine();
        var spl   = s.Split(' ');
        long L     = long.Parse(spl[0]);
        long R     = long.Parse(spl[1]);

        long r = 0;

        long min = long.MaxValue;

        for(long i=L; i<=R; i++) {
            for(long j=i+1; j<=R; j++) {
                long modI = i % 2019;
                long modJ = j % 2019;
                if (modI == 0 || modJ == 0) return "0";
                long mod = (modI * modJ) % 2019;
                if (mod < min) min = mod;
            }
        }
        return min.ToString();
    }
}

static class Debugger
{
    public static string ReadBlock(StreamReader reader) {
        var text = "";
        while (true) {
            var str = reader.ReadLine();
            if (str == null) break;
            if (str.Trim() == "" && text != "") break;
            if (str.Trim() != "") text += str + Environment.NewLine;
        }
        if (text == "") return null;
        return text;
    }
}

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

struct T{
    T *child[4];
    bool value;
    T():child{}, value(false){}
    static int toi(char c){return c=='A'?0:c=='C'?1:c=='G'?2:3;}
    void insert(char *s){
        if(*s){
            if(!child[toi(*s)]){
                child[toi(*s)] = new T();
            }
            child[toi(*s)]->insert(s+1);
        }else{
            value = true;
        }
    }
    bool find(char *s){
        if(*s == '\0')
            return value;
        if(child[toi(*s)])
            return child[toi(*s)]->find(s+1);
        else
            return false;
    }
};

int n;
char cmd[7];
char str[13];

int main() {
    T root;

    scanf("%d", &n);
    while(n--){
        scanf("%s%s", cmd, str);
        if(cmd[0] == 'i'){
            root.insert(str);
        }else{
            printf("%s\n", root.find(str) ? "yes" : "no");
        }
    }
}

Measured memory_bytes: 19392
#include<iostream>
#include<vector>
using namespace std;
int main() {
	int n;
	cin >> n;
	vector<int> card;
	for (int i = 1; i <= 2 * n; ++i) {
		card.push_back(i);
	}
	int time;
	cin >> time;
	int code;
	for (int i = 0; i < time; ++i) {
		cin >> code;
		if (code) {
			vector<int> dommy;
			dommy.assign(card.begin() + code, card.end());
			dommy.insert(dommy.end(), card.begin(), card.begin()+code);
			card = dommy;
		}
		else {
			vector<int> dommy1, dommy2;
			dommy1.assign(card.begin(), card.begin()+card.size()/2 );
			dommy2.assign(card.begin() + card.size()/2, card.end());
			card.clear();
			for(int i=0;i<dommy1.size();++i){
				card.push_back(dommy1[i]);
				card.push_back(dommy2[i]);
			}
		}
	}
	vector<int>::iterator he;
	for (he = card.begin(); he != card.end(); ++he) {
		cout << *he << endl;
	}
	return 0;
}

Measured memory_bytes: 3156
#include <cstdio>
#include <iostream> 
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>

using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e18 + 5;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)
#define RREP(i, n) for(ll i = n - 1; i >= 0; i--)
#define REP2(i, n, k) for(ll i = 0; i < n; i += k)




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

	ll idx = INF;
	REP(i, s.size()) {
		if (s[i] != '1') {
			idx = i - 1;
			break;
		}
	}

	if (idx + 2 <= k) {
		cout << s[idx + 1] << endl;
	}
	else {
		cout << "1" << endl;
	}
}


Measured memory_bytes: 256