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

#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) begin(x), end(x)
#define uniq(x) (x).erase(unique(all(x)), end(x))
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr long double PI = 3.1415926535897932384626433832795028L;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int N, M, Q;
int a[55], b[55], c[55], d[55];
int ans = 0;
void dfs(vint &x) {
    if (x.size() == N + 1) {
        int cur = 0;
        rep(i, Q) {
            if (x[b[i]] - x[a[i]] == c[i]) { cur += d[i]; }
        }
        chmax(ans, cur);
        return;
    }
    for (int i = x.back(); i <= M; i++) {
        x.push_back(i);
        dfs(x);
        x.pop_back();
    }
}
signed main() {
    cin >> N >> M >> Q;
    rep(i, Q) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }
    vint init = {1};
    dfs(init);
    cout << ans << endl;
}


Measured memory_bytes: 3628
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define pb(a) push_back(a)
#define all(x) (x).begin(), (x).end()

#define FOR(i, a, n) for (int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))

#define PRINT(str) printf(#str "\n")
#define yOUT PRINT(Yes)
#define nOUT PRINT(No)
#define YOUT PRINT(YES)
#define NOUT PRINT(NO)

//関数定義
//最大公約数
ll gcd(ll a, ll b);

//最小公倍数
ll lcm(ll a, ll b);

int main() {
  // ========================================================
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  REP(i, n) {
    cin >> a[i];
    b[i] = a[i];
  }
  SORT(b);
  int cnt = 0;
  REP(i, n) {
    if (a[i] != b[i]) cnt++;
  }
  if (cnt <= 2)
    YOUT;
  else
    NOUT;
}

//最大公約数
ll gcd(ll a, ll b) {
  if (!b) return a;
  return gcd(b, a % b);
}

//最小公倍数
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<queue>
#include<map>
#include<cmath>
#include<set>
#include<stack>
#include<cstdio>
#include<sstream>
#include<vector>
#include<bitset>
#include<algorithm>

using namespace std;
#define read(x) scanf("%d",&x)
#define Read(x,y) scanf("%d%d",&x,&y)
#define gc(x)  scanf(" %c",&x);
#define mmt(x,y)  memset(x,y,sizeof x)
#define write(x) printf("%d\n",x)
#define pii pair<int,int>
#define INF 0x3f3f3f3f
#define ll long long
const ll mod =  998244353;
const int N = 100000 + 100;
const int M = 2e6 + 1005;
int a[N];
int main()
{
    int n;
    cin>>n;
    for(int i =1 ;i <= n;++i){
        char c;
        cin>>c;
        a[i] = c - '0';
    }
    int sum = 0;
    for(int i = 0;i < 1000;++i){
        int f[] = {i/100,i/10%10,i%10};int t = 0;
        for(int i = 1;i <= n;++i){
            if(a[i] == f[t]) t++;
            if(t == 3) {sum ++;break;}
        }

    }
    cout<<sum<<endl;
}


Measured memory_bytes: 384
using System;
using System.Text;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
using System.IO;

class Solve
{
	const int mod = 1000000007;
	static void Main(string[] args)
	{
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
		Console.SetOut(sw);

		int N = int.Parse(Console.ReadLine());
		long ans = 1;
		while (ans < N)
		{
			if (ans * 2 > N)
			{
				break;
			}
			else
			{
				ans *= 2;
			}
		}
		Console.WriteLine(ans);
		
		Console.Out.Flush();
	}
}

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

typedef long long ll;

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

    vector<int> v(3);

    for (int i = 0; i < 3; ++i) {
        cin >> v[i];
    }

    //swapping first and second
    int temp = v[0];
    v[0] = v[1];
    v[1] = temp;

    // swapping first and third
    int temp2 = v[0];
    v[0] = v[2];
    v[2] = temp2;

    cout << v[0] << " " << v[1] << " "<< v[2] << "\n";
}


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

int main(){
    char ch;
    int counter[26] = {};
    while(cin >> ch){
        if(isupper(ch)){
            ch = tolower(ch);
        }
        int num = ch - 'a';
        counter[num]++;
    }
    for(int i = 0;i<26;i++){
        char c = i + 'a';
        cout << c << " : " << counter[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 3088
fun main(args: Array<String>) {
    cf16finalb()
}

fun cf16finalb() {
    val n = readLine()!!.toInt()

    var sum = 0
    var i = 0
    while (sum < n) {
        sum += ++i
    }

    val sums = (1..i).toList()

    val answer = if (sum == n) sums else sums.filterNot { it == sum - n }

    println(answer.joinToString(separator = System.lineSeparator()))
}


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

vector<int> f(vector<int> x) {
	vector<int> a(1, 1);
	for (int i = 1; i < x.size(); ++ i) {
		if (x[i-1] == x[i]) {
			++ a.back();
		} else {
			a.push_back(1);
		}
	}
	return a;
}
int func(vector<int> b, vector<int> p) {
	if (f(b) == p) return 0;

	map<vector<int>, int> dist;
	queue<vector<int> > Q;
	dist[b] = 0;
	Q.push(b);
	while (!Q.empty()) {
		vector<int> c = Q.front(); Q.pop();
		for (int i = 1; i < c.size(); ++ i) {
			vector<int> d = c;
			swap(d[i-1], d[i]);
			if (!dist.count(d)) {
				dist[d] = dist[c] + 1;
				if (f(d) == p) return dist[d];
				Q.push(d);
			}
		}
	}
}
int main() {
	int N, M;
	cin >> N >> M;
	vector<int> b(N), p(M);
	for (int i = 0; i < N; ++ i) cin >> b[i];
	for (int i = 0; i < M; ++ i) cin >> p[i];
	cout << func(b, p) << endl;
}


Measured memory_bytes: 2244
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#define ll long long

using namespace std;

long long MOD = 1000000007;

int main(){
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    for(int i=0; i<N; i++){
        cin >> A[i];
        if(i>=K){
            if(A[i]<=A[i-K]){
                cout << "No" << endl;
            }else{
                cout << "Yes" << endl;
            }
        }
    }
}

Measured memory_bytes: 4048
#include <iostream>
#include <utility>
#include <stdint.h>

using namespace std;

int main()
{
  char b;
  cin >> b;

  char ans;

  switch(b) {
  case 'A':
    ans = 'T';
    break;
  case 'T':
    ans = 'A';
    break;
  case 'C':
    ans = 'G';
    break;
  case 'G':
    ans = 'C';
    break;
  }
  
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
typedef unsigned int u_int;
int main(void){
  u_int i,j,m,n,tmp,max=0,in;
  scanf("%u %u",&m,&n);
  for(i=0;i<m;i++){
    tmp=0;
    for(j=0;j<n;j++){
      scanf("%u",&in);
      tmp+=in;
    }
    if(tmp>max) max=tmp;
  }
  printf("%u\n",max);
  return 0;
}

Measured memory_bytes: 0
'''
自宅用PCでの解答
'''
import math
#import numpy as np
import itertools
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)
mod = 10**9+7
dir = [(-1,0),(0,-1),(1,0),(0,1)]
alp = "abcdefghijklmnopqrstuvwxyz"

def main():
    h,w,m = map(int,ipt().split())
    hs = [0]*h
    ws = [0]*w
    base = 3*10**5
    st = set()
    for i in range(m):
        hi,wi = map(int,ipt().split())
        hs[hi-1] += 1
        ws[wi-1] += 1
        st.add((hi-1,wi-1))

    hma = max(hs)
    mah = []
    for i,hi in enumerate(hs):
        if hi == hma:
            mah.append(i)
    wma = max(ws)
    maw = []
    for i,wi in enumerate(ws):
        if wi == wma:
            maw.append(i)

    for i in mah:
        for j in maw:
            if not (i,j) in st:
                print(hma+wma)
                exit()

    print(hma+wma-1)

    return None

if __name__ == '__main__':
    main()


Measured memory_bytes: 166632
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
  int N,i;
  int X[111];
  cin >> N;
  for(i=0;i<=N-1;i++)
    cin >> X[i];
  int P;
  sort(X,X+N);
  int min = 111111111;
  for(P=X[0];P<=X[N-1];P++){
    int sum = 0;
    for(i=0;i<=N-1;i++)
      sum += (X[i]-P)*(X[i]-P);
    if(sum < min) min = sum;
  }
  cout << min << endl;
}

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

const int MAXN = 300001;
typedef long long ll;
#define f first
#define s second
const ll mod = 1e9+7;

ll nums[MAXN];
ll tree[MAXN];

void update(int pos, ll val){
    for (;pos<MAXN;pos+=pos&-pos){
        tree[pos] = max(tree[pos],val);
    }
}

ll query(int pos){
    ll res = 0;
    for (;pos>0;pos-=pos&-pos) res = max(res,tree[pos]);
    return res;
}

int main(){
    int N;
    scanf("%d",&N);
    int arr[N], arr2[N];
    for (int i=0;i<N;i++){
        scanf("%lld",&arr[i]);
        arr2[i] = arr[i];
    }
    for (int i=0;i<N;i++){
        scanf("%lld",&nums[i]);
    }
    sort(arr2,arr2+N);
    for (int i=0;i<N;i++){
        arr[i] = upper_bound(arr2,arr2+N,arr[i])-arr2+1;
    }
    ll ans = 0;
    for (int i=0;i<N;i++){
        ll cur = query(arr[i]);
        ans = max(ans,cur+nums[i]);
        update(arr[i]+1,cur+nums[i]);
    }
    printf("%lld\n",ans);
}

Measured memory_bytes: 5376
#include<iostream>
using namespace std;
int main(){
  int n;
  cin >> n;
  int i=1;
  while(++i<=n){
    int x=i;
    if(x%3==0){
      cout << " " << i;
      continue;
    }
    while(x){
      if(x%10==3){
	cout << " " << i;
	break;
      }
      x/=10;
    }
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const long long INF = 1LL << 60;
using ping = pair<ll, ll>;

int main() { 
    ll K;
    string S;
    cin >> K >> S;
    if (S.size() <= K) cout << S << endl;
    else{
      for (int i = 0; i < K; i++) cout << S[i];
      cout << "..." << endl;
    }
    return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1);
typedef long long ll;
typedef pair<int64_t,int64_t> pll;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};
#define INF (2147483647)
#define mod (1000000007)
#define limit (7368791)
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define ALL(a) begin(a),end(a)
#define sz(s) (s).size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second

 
void solve()
{
    double n;cin>>n;
    cout<<(n-(int)n/2)/n<<endl;

}

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

Measured memory_bytes: 256
l = input().split()
li = list(map(int,l))
num = len(li)
for i in range(num-1):
    if li[i] > li[i + 1]:
        t = li[i]
        li[i] = li[i + 1]
        li[i + 1] = t
if li[0] > li[1]:
    t = li[0]
    li[0] = li[1]
    li[1] = t
a,b,c = li
print(a,b,c)


Measured memory_bytes: 5596
#include <algorithm>
#include <iostream>

using namespace std;

const int MAX_M = 5000;

int ns[MAX_M*2+1];
int bs[MAX_M*2+1];
int es[MAX_M*2+1];
int cs[MAX_M*2+1];

int main() {
  for (;;) {
    int n;
    cin >> n;
    if (!n) return 0;
    int m, p, q, r;
    cin >> m >> p >> q >> r;
    ns[0] = -1;
    bs[0] = 0;
    es[0] = n;
    cs[0] = n;
    int t = 0;
    for (int i = 0, j = 1; i < m; i++) {
      int x, y;
      cin >> x >> y;
      int s = 0, a = -1, b = -1, c = t;
      for (;;) {
        s += cs[c];
        if (a < 0 && s >= x) {
          a = j++;
          ns[a] = ns[c];
          es[a] = es[c];
          cs[a] = s - x;
          bs[a] = es[a] - cs[a];
          cs[c] -= cs[a];
          es[c] = bs[c] + cs[c];
          ns[c] = -1;
          c = a;
        }
        if (b < 0 && s >= y) {
          b = j++;
          ns[b] = ns[c];
          es[b] = es[c];
          cs[b] = s - y;
          bs[b] = es[b] - cs[b];
          cs[c] -= cs[b];
          es[c] = bs[c] + cs[c];
          ns[c] = t;
          c = b;
        }
        if (ns[c] == -1)
          break;
        c = ns[c];
      }
      ns[c] = a;
      t = b;
    }
    int z = 0;
    for (int c = t, s = 0; c != -1; c = ns[c]) {
      if (s >= q)
        break;
      s += cs[c];
      if (s >= p)
        z += max(0, min(r, min(bs[c]+q-(s-cs[c]), es[c]))-(bs[c]+max(p-1-(s-cs[c]), 0)));
    }
    cout << z << endl;
  }
}

Measured memory_bytes: 1024
#include <atcoder/fenwicktree>
#include <iostream>

using namespace std;
using namespace atcoder;

int main() {
    int n, q;
    cin >> n >> q;
    fenwick_tree<long long> fw(n);
    for(int i = 0; i < n; ++i) {
        long long a;
        cin >> a;
        fw.add(i, a);
    }
    while(q--) {
        int t, a, b;
        cin >> t >> a >> b;
        if(t == 0) fw.add(a, b);
        else cout << fw.sum(a, b) << endl;
    }
}

Measured memory_bytes: 8204
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        System.out.print(n+":");
        for (int i=2; i*i<=n; i++){
        	while (n%i==0) {
        		n/=i;
        		System.out.print(" "+i);
        	}
        }
        if (n!=1) System.out.print(" "+n);
        System.out.println();
        br.close();
	}
}

Measured memory_bytes: 24424
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <stack>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;	//using vi = vector<int>;

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

int main()
{
	char a[4];
	int count = 0;

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

	if (a[0] == a[1] && a[1] == a[2] && a[2] == a[3])cout << "No" << endl;
	else if (a[0] == a[1] && a[2] == a[3])cout << "Yes" << endl;
	else if (a[0] == a[2] && a[1] == a[3])cout << "Yes" << endl;
	else if (a[0] == a[3] && a[1] == a[2])cout << "Yes" << endl;
	else cout << "No" << endl;


	return 0;
}

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "cycle"

const double EPS = 1e-9;
const double PI = acos(-1.);
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

const int MAXN = 2e5 + 5;

vector<pii> g[MAXN];

ll dp[MAXN];
int used[MAXN];

ll mxl, mnr;
int fl;

void dfs(int s, int ind){
	used[s] = 1;
	if (ind == 0){
		mxl = max(mxl, dp[s]);
	} else {
		mnr = min(mnr, dp[s]);
	}
	REP(i, 0, SZ(g[s])){
		int to = g[s][i]._1;
		if (!used[to]){
			dp[to] = dp[s] + g[s][i]._2;
			dfs(to, ind ^ 1);
		} else if (dp[to] != dp[s] + g[s][i]._2){
			//printf("%d %d %d %lld %lld\n", s, to, g[s][i]._2, dp[s], dp[to]);
			fl = 1;
		}
	}
}

void solve(){
	int r, c, n, x, y, a;
	scanf("%d%d%d", &r, &c, &n);
	REP(i, 0, n){
		scanf("%d%d%d", &x, &y, &a);
		g[x].pb(mp(r + y, a));
		g[r + y].pb(mp(x, -a));
	}
	REPN(i, 1, r){
		if (!used[i]){
			mxl = -INF;
			mnr = INF;
			fl = 0;
			dfs(i, 0);
			//printf("%d %lld %lld\n", fl, mxl, mnr);
			if (fl || mxl > mnr){
				printf("No\n");
				return;
			}
		}
	}
	printf("Yes\n");
}	

int main(){

	//freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();	
	}
}

Measured memory_bytes: 16640
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define pp pop_back
#define in insert
#define ff first
#define ss second
#define  show for(int j=0;j<v.size();j++) cout<<v[j]<<" ";
#define ld long double
#define e endl
#define bc __builtin_popcount
#define MOD 1000000007
#define INT_SIZE 32
#define me(x) memset(x,0,sizeof(x))
ll fast_expo(ll x,ll p)
{if(p==0) return 1;
else if(p%2==0){ ll t=fast_expo(x,p/2)%MOD;return (t*t)%MOD;} else return (x*(fast_expo(x,p-1))%MOD)%MOD;}

int main(){
    int n,m,i;
    cin>>n>>m;
    int a[n],b[n];
    vector<vector<int>> v(m);
   for(i=0;i<n;i++){
        cin>>a[i]>>b[i];
        if(a[i]<=m){
        a[i]--;
        v[a[i]].push_back(b[i]);
        }
    }
priority_queue<int> pq;
ll ans=0;
for(i=0;i<m;i++){
    for(auto x:v[i]){
        pq.push(x);
    }
    if(!pq.empty()){
            //cout<<pq.top()<<e;
        ans= ans+ pq.top();
        pq.pop();
    }
}
cout<<ans<<e;
}


Measured memory_bytes: 6400
// https://atcoder.jp/contests/abcXXX/tasks/abcXXX_x

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;

static const ll INF = 1001001001;
static const ll LLINF = 1001001001001001001;
static const ll MOD = (ll)1e9 + 7;
static const double EPS = 1e-9;

#define REP(i, n) for(ll i = 0; i < static_cast<ll>(n); ++i)
#define RANGE(i, m, n) for(ll i = (m); i <= static_cast<ll>(n); ++i)
#define RRANGE(i, m, n) for(ll i = static_cast<ll>(m); i >= static_cast<ll>(n); --i)
#define POSITIVE(x) (x)=((x) < 0) ? 0 : (x)

ll power(ll x, ll y) {
    ll ret = 1;
    while(y-- > 0) ret *= x;
    return ret;
}

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

ll extgcd(ll a, ll b, ll& x, ll& y) {
    x = 1; y = 0;
    assert(a >= 0);
    assert(b >= 0);
    if (b == 0) return a;
    ll X, Y;
    auto d = extgcd(b, a % b, X, Y);
    x = Y;
    y = X - (a / b) * Y;
    return d;
}

int run(istream& in, ostream& out) {
    ll D, T, S;
    in >> D >> T >> S;
    out << (D <= T * S ? "Yes": "No") << endl;
    return 0;
}

int main() {
    return run(cin, cout);
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int k,a,b;
  cin>>k>>a>>b;
  bool bl = false;
  for(int i=a;i<=b;i++)
  {
    if(i%k==0){
        bl = true;break;
    }
  }
  if(bl) cout<<"OK"<<endl;
  else cout<<"NG"<<endl;
}


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

int main() {
  int x,n;
  cin >> x >> n;
  if(n==0){
    cout << x << endl;
    return 0;
  }
  
  set<int> s;
  for(int i=0;i<102;i++){
    s.insert(i);
  }
  vector<int> p(n);
  bool flag=false;
  for(int i=0;i<n;i++){
    cin >> p.at(i);
    s.erase(p.at(i));
    if(p.at(i)==x){
      flag=true;
    }
  }
  s.insert(x);
  
  if(flag==false){
    cout << x << endl;
    return 0;
  }
  
  vector<int> ss(s.size());
  for(int i=0;i<102;i++){
    if(s.count(i)==1){
      ss.push_back(i);
    }
  }
  int k=ss.size();
  int num;
  for(int i=0;i<k;i++){
    if(ss.at(i)==x){
      num=i;
      break;
    }
  }
  if(abs(ss.at(num-1)-ss.at(num))<=abs(ss.at(num+1)-ss.at(num))){
    cout << ss.at(num-1) << endl;
    return 0;
  }
  else{
    cout << ss.at(num+1) << endl;
    return 0;
  }
}


Measured memory_bytes: 3632
N, H = map(int, input().split())
a = [0 for i in range(N)]
b = [0 for i in range(N)]
s = []
for i in range(N):
    a[i], b[i] = map(int, input().split())
    s.append(a[i])
    s.append(b[i])

a.sort(reverse=True)
b.sort(reverse=True)
s.sort(reverse=True)
low=0
high=2*N
t=(low+high) // 2
while(low<=high):
    if s[t] == a[0]:
        break
    elif s[t] < a[0]:
        high=t
    else:
        low=t+1
    t=(low+high) // 2

m = 0
P = 0
flag = False
for i in range(t+1):
    m+=1
    P+=s[i]
    if P >= H:
        flag = True
        break

if flag == False:
    k = (H-P)//a[0]
    m += k
    P += k * a[0]
    if H > P:
        m+=1

print(m)

Measured memory_bytes: 13572
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)
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; }


int main() {
    ll n;
    cin >> n;
    vector<ll> a(n, 0), sum(201, 0);
    rep1(i, n) cin >> a[i];
    ll now;
    for (ll i=-100; i<101; i++){
        now = i;
        rep1(j, n) sum[i+100] += (a[j]-now) * (a[j]-now);
    }
    ll ans = *min_element(sum.begin(), sum.end()); 
    cout << ans << endl;
    //printf("%.12f", ans);
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long int
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define pci pair<char,int
#define mii map<int,int>
#define mll map<long long int,long long int>
#define mci map<char,int>
#define umii unordered_map<int,int>
#define umll unordered_map<long long int,long long int>
#define umci unordered_map<char,int>
#define F first
#define S second
#define pb push_back
#define endl '\n'
#define mod 1000000007
using namespace std;
#define maxval 10003000

int main(){
   IOS;
ll t;t=1;//cin>>t;

while(t--){
ll n;cin>>n;
ll m;cin>>m;
  if(n*500>=m) cout<<"Yes\n";
  else cout<<"No\n";
}

    
    
    

    
return 0;    
}

Measured memory_bytes: 3612
import os
import sys
from collections import Counter

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 998244353

N = int(sys.stdin.readline())
D = list(map(int, sys.stdin.readline().split()))


if D[0] != 0:
    print(0)
    exit()

counts = Counter(D)
if counts[0] != 1:
    print(0)
    exit()

ans = 1
for i in range(1, max(D) + 1):
    if counts[i] == 0:
        print(0)
        exit()
    ans *= pow(counts[i - 1], counts[i], MOD)
    ans %= MOD
print(ans)


Measured memory_bytes: 63772
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
long long ans;
int n,be;
char c[2][100];
/*int main()
{
	long long f = 3;
	for(int i = 1;i <= 51;i++)f = f * 2 % 1000000007;
	printf("%lld\n",f);
}*/

int main()
{
	scanf("%d%s%s",&n,c[0] + 1,c[1] + 1);
	ans = c[0][1] == c[1][1] ? 3 : 6;
	be = c[0][1] == c[1][1] ? 1 : 2;
	for(int i = c[0][1] == c[1][1] ? 2 : 3;i <= n;i++)
	{
		if(c[0][i] == c[1][i])
		{
			if(be == 1)ans = ans * 2 % 1000000007;
			else be = 1;
		}
		else
		{
			i++;
			if(be == 1)ans = ans * 2 % 1000000007,be = 2;
			else ans = ans * 3 % 1000000007;
		}
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

public class Main{

    static StringBuilder sb;

    public static void main(String[] args) {
	try {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    List<String> lines = new ArrayList<String>();

	    for (String line = br.readLine(); line != null; line = br.readLine()) {
		lines.add(line);
	    }
	    //lines.add("5");
	    //lines.add("1 2 5 4 5");
	    br.close();

	    //List<String> array = new ArrayList<String>();
	    String[] array = new String[Integer.parseInt(lines.get(0))];
	    String[] reverse = new String[Integer.parseInt(lines.get(0))];
	    for (int i = 0; i < array.length ; i++) {
		array[i] = lines.get(1).split(" ")[i];
	    }
	    sb = new StringBuilder();

	    for (int i = array.length - 1; i >= 0 ; i--) {
		if ( i != 0 ) {
		    sb.append(array[i] + " ");
		} else {
		    sb.append(array[i]);
		}
	    }

	    System.out.println(sb.toString());
	    System.exit(0);

	} catch (Exception e) {
	    System.out.println(e.getMessage());
	    System.out.println(Arrays.toString(e.getStackTrace()));
	    System.exit(0);
	}
    }
}

Measured memory_bytes: 25736
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int N;

  long long A[222222];

  std::cin >> N;

  std::map<long long, long long> map, map2;

  for (int i = 0; i < N; i ++) {
    std::cin >> A[i];

    map[A[i]] ++;
  }

  long long S = 0;

  for (const auto& kv : map) {
    long long x = kv.second;

    S += map2[kv.first] = x * (x - 1) / 2;
  }

  for (int i = 0; i < N; i ++) {
    int x = A[i];

    long long y = map[A[i]], s = S - map2[x] + (y - 1) * (y - 2) / 2;

    std::cout << s << std::endl;
  }
  
  return 0;
}


Measured memory_bytes: 19928
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;

int main(int argc, char** argv){
    int N, M;
    cin >> N >> M;
    vector<vector<int>> v(N, vector<int>(2));
    for (int i=0; i<N; i++) cin >> v[i][0] >> v[i][1];
    sort(v.begin(), v.end());

    priority_queue<int> q;
    int j = 0;
    long long int sum = 0;
    for (int i=M-1; i>=0; i--){
        while(j<N && v[j][0] == M-i){
            q.push(v[j][1]);
            j++;
        }
        if (!q.empty()){
            sum += q.top();
            q.pop();
        }
    }

    cout << sum << "\n";

    return 0;
}


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

using namespace std;

typedef long long ll;

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

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

const int INF = 1001001000;

int main(void) {
    int N, L;
    cin >> N >> L;

    int sum = L * N  + (N * (N + 1) / 2) - N;
    int a = L + 1 - 1;
    int b = L + N - 1;

    if (a > 0) {
        // should remove apple 1.
        cout << sum - a << endl;
    } else if (b < 0) {
        // should remove apple N.
        cout << sum - b << endl;
    } else {
        // there is an apple whose value is 0. so output the same value.
        cout << sum << endl;
    }

    return 0;
}


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

int main() {
 int n,x,a=0,cnt=1; //aが座標の位置
 cin >> n >> x;
 vector<int> zahyo(n);
  for(int i=0;i<n;i++){
   cin >> zahyo[i];
   a+=zahyo[i];
    if(a<=x)cnt++;
  }
  cout << cnt << endl;
}


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

#define PI 4*atan(1)
#define INF 1e8

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

int main(){
  string S;
  cin >> S;
  string answer = "";
  for(int i = 0; i < S.size(); i++){
    if(S[i] == '0'){
      answer += '0';
    }else if(S[i] == '1'){
      answer += '1';
    }else{
      if(answer.size() != 0)answer.erase(answer.begin() + answer.size() - 1);
    }
  }
  cout << answer << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SZ(x) ((int)x.size())
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
int n;
int main() {
	scanf("%d", &n);
	if(n == 3) { puts("2 5 63"); return 0; }
	n -= 4;
	vector<int> res = {2,3,4,9};
	int cur = 8;
	while(cur <= 30000 && n >= 2) {
		n -= 2;
		res.push_back(cur);
		res.push_back(cur + 2);
		cur += 6;
	}
	cur = 15;
	while(cur + 6 <= 30000 && n >= 2) {
		n -= 2;
		res.push_back(cur);
		res.push_back(cur + 6);
		cur += 12;
	}
	cur = 6;
	while(n > 0) {
		n--;
		res.push_back(cur);
		cur += 6;
	}
	sort(ALL(res));
	assert(n == 0);
	for(int u : res) printf("%d ", u);
	return 0;
}

Measured memory_bytes: 512
import std.stdio, std.conv, std.array, std.string;
import std.algorithm;
import std.container;
import std.range;
import core.stdc.stdlib;
import std.math;

void main() {
  auto ABC = readln.split.to!(int[]).sort;
  writeln(ABC == [5, 5, 7] ? "YES" : "NO");
}


Measured memory_bytes: 256
<?php
fscanf(STDIN, '%d', $n);
$studens = fgets(STDIN);
$exploded_studens = explode(' ', trim($studens));

asort($exploded_studens);
$result = "";
foreach ($exploded_studens as $key => $student) {
  $result .= ($key+1)." ";
}

echo trim($result);

Measured memory_bytes: 16884
sub f{my($u,$t)=@_;$v[$_]++||f($_,$t^R,push@$t,$_)for@$u}@n=1..<>;map{push@$_,@z[--$|]for@z=split}<>;f 1,b;map{$s=++$x-3;$s+3>$.or$a[$_]||=$s+=3for@$_}@b>$./3&@0>$./3?(0,b):(@b>@0?b:0)x2,n;print"@a"

Measured memory_bytes: 303104
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<string>

using namespace std;
int main(){
int N;
cin >> N;
int s[N+1];
s[0]=0;
int w;
for(int i=1;i<=N;i++){
    cin >>w;
    s[i]=s[i-1]+w;
}
int  ans=1000000;

for(int i=1;i<N;i++){
   
    ans=min(ans,abs(s[N]-2*s[i]));
}
cout <<ans <<endl;
 return 0;
}

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

using namespace::std;


int main(void){
  int N,A,B;

  cin >> N >> A >> B;

  vector<int> r(3,0);
  for(int i=0;i<N;i++){
    int p;
    cin >> p;
    if(p<=A)r[0]++;
    else if(A<p && p<=B)r[1]++;
    else r[2]++;
  }

  int res = *min_element(r.begin(),r.end());

  cout << res << endl;
  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,x[110],ans,prv;
int main()
{
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d",&x[i]);
	}
	sort(x,x+n);
	prv = x[n-1];
	ans = 1;
	for(int i=n-1;i>=0;i--)
	{
		if(x[i]<prv)
		{
			ans++;
			prv = x[i];
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <sstream>
#include <functional>
#include <numeric>
#include <cmath>
#include <cstring>
#include <queue>
#include <set>

using namespace std;
int n, m;
vector<int> cards;
const int INF = 1 << 29;
typedef long long LL;

set<LL> nums;

vector<bool> used;

//a それ数を追加 b使っていい個数 cそれまでの数
void dfs(int a, int b, LL c)
{
	c += cards[a];
	if(b == 0)
	{
		nums.insert(c);
		return;
	}

	for (int i = 0; i < n; i++)
	{
		if(!used[i])
		{
			used[i] = true;
			dfs(i, b - 1, c * (cards[i] < 10 ? 10 : 100));
			used[i] = false;
		}
	}
}

int main(void)
{
	while(cin >> n >> m && n && m)
	{
		cards.resize(n);
		for (int i = 0; i < n; i++)
		{
			cin >> cards[i];
		}
		nums.clear();
		used.resize(n);
		for (int i = 0; i < n; i++)
		{
			used[i] = false;
		}
		for (int i = 0; i < n; i++)
		{
			used[i] = true;
			dfs(i, m - 1, 0);
			used[i] = false;
		}
		cout << nums.size() << endl;
	}
	return 0;
}

Measured memory_bytes: 1332
import java.util.*;

public class Main {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[]$) {
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        long sum = 0;
        for (int i = 0; i < n; i++) {
            int x = scanner.nextInt();
            sum += Math.min(k - x, x) * 2;
        }
        System.out.println(sum);
    }
}

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


int main() {

  int a,b;
  cin>>a>>b;


  bool flg=false;
  for(int c=1;c<=3;c++){
    if(a*b*c%2!=0)
      flg=true;
  }

  if(flg)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;

  return 0;
}




Measured memory_bytes: 3636
#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(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define SORT(x) sort(rng(x))
#define RSORT(x) sort(rrng(x))
#define SUM(x) accumulate(rng(x),0)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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; }

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

//const int mod = 1000000007;
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
} comb(100005);
// comb(n,k)ならcomb(n+k+5)とかにしておく

mint f(int n, int k) {
  if (n < 0) return 0;
  mint res = comb(n,k);
  // nPk = nCk * k!
  //res *= comb.fact[k]; // <- nPk求めたいときは必要
  return res;
}
// f(n,k).x で nCk か nPk が計算される

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

  for (int i = 1; i <= k; ++i) {
    mint ans = f(n-k+1,i).x * f(k-1,i-1).x;
    cout << (ll)ans.x << '\n';
  }
  return 0;
}

Measured memory_bytes: 1792
N=int(input())
A=[]
for i in range(N):
  tmp=float(input())*10**9
  if tmp%1>0.9:
    tmp+=0.1
  A.append(int(tmp))

#print(A)

dat=[[0]*19 for _ in range(19)]  
rui=[[0]*19 for _ in range(19)]

B=[]

for i in range(N):
  dev2,dev5=0,0
  while A[i]%2==0 and dev2<18:
    dev2+=1
    A[i]//=2
  while A[i]%5==0 and dev5<18:
    dev5+=1
    A[i]//=5
  dat[dev2][dev5]+=1
  B.append([dev2,dev5])
  
for i in range(19):
  for j in range(19):
    for k in range(i+1):
      for l in range(j+1):
        rui[k][l]+=dat[i][j]
  
ans=0
for i in range(N):
  dev2,dev5=B[i]
  t_dev2,t_dev5=18-dev2,18-dev5
  if dev2>=t_dev2 and dev5>=t_dev5:
    ans-=1
  ans+=rui[t_dev2][t_dev5]

print(ans//2)
  
  
    
    


Measured memory_bytes: 34280
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#if __cplusplus >= 201103L
#include <chrono>
using namespace std::chrono;
#endif
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pb push_back
#define fi first
#define se second
#ifdef LOCAL
#define prln(x) (cout << #x << ' ' << x << endl)
#define pr(x) (cout << #x << ' ' << x << ' ' )
#define prv(x) (cout << x << ' ')
#else
#define prln(x) 
#define pr(x)
#define prv(x)
#endif
#define clr(x) memset((x), 0, sizeof((x)))
#define clr1(x) memset((x), -1, sizeof((x)))
#define endl "\n"
#define pi acos(-1)
#define rep(i, st, ed) for (int i = (st); i <= (ed); ++i)
#define rep0(i, st, ed) for (int i = (st); i < (ed); ++i)
#define per(i, st, ed) for (int i = (st); i >= ed; --i)
template<class T> void _sf(T &x) {cin >> x;}
void _sf(int &x) {scanf("%d", &x);}
void _sf(ll &x) {scanf("%lld", &x);}
void _sf(double &x) {scanf("%lf", &x);}
void _sf(char &x) {scanf(" %c", &x);}
void _sf(char *x) {scanf("%s", x);}
void sf() {}
template <class T, class...U> void sf(T & head, U&... tail) { _sf(head); sf(tail...);}
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;

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


int main(){
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
        #if __cplusplus >= 201103L
        auto start = steady_clock::now();
        #endif
    #endif
    int n = read(), m = read();
    rep(i, 1, n) {
        int x = read();
        q.push(x);
    }
    while (!q.empty()) {
        int t = q.top();q.pop();
        if (m) {
            t /= 2;
            m--;
            q.push(t);
        }
        if (m == 0) break;
    }
    ll ans = 0;
    while (!q.empty()) {
        ans += q.top();
        q.pop();
    }
    cout << ans << endl;
    #ifdef LOCAL
        #if __cplusplus >= 201103L
        auto end = steady_clock::now();
        duration<double> time_span = duration_cast<duration<double>>(end - start);;
        printf("Total time: %.6fs\n", time_span.count());
        #endif
    #endif
    return 0;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

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

    int f[n] = {};
    rep(i,n){
        int a; cin >> a;
        a--;
        f[a]++;
    }
    sort(f,f+n,greater<int>());
    int m = 0;
    rep(i,n){
        if(f[i] > 0)m++;
    }
    int a[m];
    rep(i,m)a[i] = f[i];
    sort(a,a+m);
    int sum[m+1] = {};
    srep(i,1,m+1){
        sum[i] = sum[i-1] + a[i-1];
    }

    ll y[n+2] = {};
    srep(i,1,n+2){
        ll x = i;
        int tmp = 0;
        int ite = lower_bound(a, a+m, x) - a;
        tmp += (ll)(m - ite) * x + sum[ite];
        y[x] = tmp / x;
    }

    drep(i,n+1){
        y[i] = max(y[i], y[i+1]);
    }

    int now = n+1;
    srep(i,1,n+1){
        while(y[now] < i){
            if(now == 0)break;
            now--;
        }
        cout << now << endl;
    }

    /*
    srep(i,1,n+1){
        ll k = i;
        int l = 0;
        int r = n + 1;
        while(l + 1 < r){
            ll x = (l + r) / 2;
            int tmp = 0;
            int ite = lower_bound(a, a+m, x) - a;
            tmp += (ll)(m - ite) * x + sum[ite];
            if(tmp >= x * k){
                l = x;
            }else{
                r = x;
            }
        }
        cout << l << endl;
    }
    */

    return 0;
}
 
 


Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for (int i = x, i##_len = (n); i < i##_len; ++i)
#define ALL(n) begin(n), end(n)

long long calc(string S)
{
  if (S.size() == 1)
    return S[0] - '0';

  long long res = 0;
  rep(i, S.size())
  {
    if (i == S.size() - 1)
      res += (S[i] - '0') * pow(2, S.size() - 1);
    else
      res += (S[i] - '0') * pow(2, S.size() - 2);
  }
  string before_s = S;
  before_s.pop_back();
  res += 10 * calc(before_s);
  return res;
}

int main()
{
  string S;
  cin >> S;
  cout << calc(S) << endl;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val array = "1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51".split(",")
    println(array[readLine()!!.toInt() - 1])
}

Measured memory_bytes: 37936
#include <stdio.h>
#define n 44
int main(){
  int f[n],i,a;
  f[0]=f[1]=1;
  scanf("%d",&a);
  for(i=2;i<=a;i++){
    f[i]=f[i-1]+f[i-2];
  }
  printf("%d\n",f[a]);
  return 0;
}

Measured memory_bytes: 596
object Main extends App {
    val Array(n) :: _ :: s = io.Source.stdin.getLines.map(_.split(",").map(_.toInt)).toList
    s.foldLeft((1 to n).toList){case (x, Array(a, b)) =>
        x.updated(a-1, x(b-1)).updated(b-1, x(a-1))
    }.foreach(println)
}

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

int main(){
    string s;
    cin >> s;
    bool ans=false;
    for(int x : s){
        if(x == '7'){
            ans=true;
            break;
        }
    }
    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3644
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())

// code
// ------------------------------------------------
int main() {
  int a,b,c;
  cin >> a >> b >> c;
  
  if(a <= c && c <=  a + b ) cout << "YES" ;
  else cout << "NO";
  return 0;
}

// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}


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

int main() {
    int n,k,sum=0;
    cin>>n>>k;
    while (n--) {
        int a;cin>>a;
        sum+=min(a,abs(a-k))*2;
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
struct UnionFind{
  vector<int> par;
  vector<int> sizes;
  UnionFind(int n) : par(n), sizes(n, 1) {
    rep(i,n) par[i] = i;
  }
  int root(int x) {
    if (x == par[x]) return x;
    return par[x] = root(par[x]);
  }
  void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) return;
    if (sizes[x] < sizes[y]) swap(x, y);
    par[y] = x;
    sizes[x] += sizes[y];
  }
  bool same(int x, int y) {
    return root(x) == root(y);
  }
  int size(int x) {
    return sizes[root(x)];
  }
};
int main(){
	int N,M;
	scan(N);scan(M);
	int A[200001],B[200001];
	UnionFind uf(N*2);
	rep(i,M){
		scan(A[i]);scan(B[i]);
		A[i]--; B[i]--;
		uf.unite(A[i],B[i]+N);
		uf.unite(A[i]+N,B[i]);
	}
	ll alonenum=0,nibu=0,hinibu=0;
	rep(i,N){
		if(uf.root(i)==i||uf.root(i)==i+N){
			if(uf.size(i)==1) alonenum++;
			else if(uf.same(i,i+N)) hinibu++;
			else nibu++;
		}
	}
	ll ans=N*alonenum*2-alonenum*alonenum+nibu*nibu*2+hinibu*nibu*2+hinibu*hinibu;
	prin(ans);
	return 0;
}


Measured memory_bytes: 3328
module constants
  implicit none
  integer(8), parameter :: modulo = 10**9 + 7
end module constants

program abc110d
  use constants
  implicit none
  integer(8) :: ans = 1, i = 2
  integer(8) n, m, count
  read *, n, m
  do
     if (m < i * i) exit
     if (mod(m, i) == 0) then
        count = 0
        do
           m = m / i;
           count = count + 1
           if (mod(m, i) /= 0) exit
        end do
        ans = mod(ans * comb(n + count - 1, count), modulo)
     end if
     i = i + 1
  end do
  if (m /= 1) then
     ans = mod(ans * n, modulo)
  end if
  print *, ans

contains

  recursive integer(8) function comb(n, k) result(r)
    integer(8), intent(in) :: n, k
    integer(8) i, numer, denom
    if (n - k < k) then
       r = comb(n, n - k)
    else
       numer = 1
       denom = 1
       do i = 0, k - 1
          numer = mod(numer * (n - i), modulo)
          denom = mod(denom * (i + 1), modulo)
       end do
       r = mod(numer * modpow(denom, modulo - 2), modulo)
    end if
  end function comb

  recursive integer(8) function modpow(a, p) result(r)
    integer(8), intent(in) :: a, p
    if (p == 0) then
       r = 1
    else if (mod(p, 2) == 0) then
       r = mod(modpow(a, p / 2)**2, modulo)
    else
       r = mod(a * modpow(a, p - 1), modulo)
    end if
  end function modpow

end program abc110d


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;

int main() {
int N;
cin >> N;
vector<int> vec(N);
int maxi = -1;
for (int i = 0;i < N;i++) {
    cin >> vec.at(i);
}
sort(vec.begin(),vec.end());

cout <<vec.at(N/2) - vec.at(N/2-1) << endl; 



return 0;
}


Measured memory_bytes: 640