akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<queue>
#include<vector>
#include<complex>
using namespace std;
#define int long long

typedef double D;      // 座標値の型。doubleかlong doubleを想定
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
typedef vector<P> VP;
const D EPS = 1e-13;    // 許容誤差。問題によって変える
#define X real()
#define Y imag()
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)

					   // 内積　dot(a,b) = |a||b|cosθ
D dot(P a, P b) {
	return (conj(a)*b).X;
}
// 外積　cross(a,b) = |a||b|sinθ
D cross(P a, P b) {
	return (conj(a)*b).Y;
}
P proj(P a1, P a2, P p) {
	return a1 + dot(a2 - a1, p - a1) / norm(a2 - a1) * (a2 - a1);
}


D distLP(P a1, P a2, P p) {
	return abs(proj(a1, a2, p) - p);
}

// 2円の共通接線。返される各直線に含まれる頂点は円との接点となる
vector<L> tangentLines(P a, D ar, P b, D br) {
	vector<L> ls;
	D d = abs(b - a);
	for (int i = 0; i < 2; i++) {
		D sin = (ar - (1 - i * 2)*br) / d;
		if (!LE(sin*sin, 1)) break;
		D cos = sqrt(max(1 - sin*sin, 0.0));
		for (int j = 0; j < 2; j++) {
			P n = (b - a) * P(sin, (1 - j * 2)*cos) / d;
			ls.push_back(L(a + ar*n, b + (1 - i * 2)*br*n));
			if (cos < EPS) break;  // 重複する接線を無視（重複していいならこの行不要）
		}
	}
	return ls;
}

signed main() {
	while (true) {
		int N;
		cin >> N;
		if (N == 0)break;
		vector<int> x(N);
		vector<int> y(N);
		vector<int> r(N);
		vector<int> m(N);
		for (int i = 0; i < N; i++) {
			cin >> x[i] >> y[i] >> r[i] >> m[i];
		}
		int res = 1;
		vector<L> ls;
		vector<L> tls;
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < i; j++) {
				tls = tangentLines(P(x[i], y[i]), r[i], P(x[j], y[j]), r[j] + m[j]);
				for (auto l : tls) ls.push_back(l);
				tls = tangentLines(P(x[i], y[i]), r[i] + m[i], P(x[j], y[j]), r[j]);
				for (auto l : tls) ls.push_back(l);
				tls = tangentLines(P(x[i], y[i]), r[i], P(x[j], y[j]), r[j]);
				for (auto l : tls) ls.push_back(l);
				tls = tangentLines(P(x[i], y[i]), r[i] + m[i], P(x[j], y[j]), r[j] + m[j]);
				for (auto l : tls) ls.push_back(l);
			}
		}
		for (auto l : ls) {
			int tmp = 0;
			for (int k = 0; k < N; k++) {
				double t = distLP(l.first, l.second, P(x[k], y[k]));
				if (t > r[k] - EPS && t < r[k] + m[k] + EPS) {
					tmp++;
				}
			}
			res = max(res, tmp);
		}

		cout << res << endl;
	}
}


Measured memory_bytes: 4500
#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,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
    ost<<"{"<<p.first<<","<<p.second<<"}";
    return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
    ost<<"{";
    for(int i=0;i<v.size();i++){
        if(i)ost<<",";
        ost<<v[i];
    }
    ost<<"}";
    return ost;
}


signed main(){
    int N,M;
    scanf("%lld%lld",&N,&M);
    vint A(N);rep(i,N)scanf("%lld",&A[i]);
    priority_queue<pint>que;
    rep(i,M){
        int b,c;
        scanf("%lld%lld",&b,&c);
        que.emplace(c,b);
    }


    sort(all(A));
    
    int sum=accumulate(all(A),0ll);
    int ans=sum;
    rep(i,N){
        if(que.empty())break;
        auto p=que.top();
        que.pop();
        p.se--;
        sum+=p.fi;
        sum-=A[i];
        chmax(ans,sum);
        if(p.se)que.push(p);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define ft first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=1e5+7;
static const ll MOD=1e9+7;


int main() {
    ll N, K;
    cin >> N >> K;
    ll a[MAX], b[MAX];
    ll i, j;
    
    for(i=0; i<N; i++)
        cin >> a[i] >> b[i];
    
    ll ans=0;
    
    for(i=0; i<N; i++) {
        if((K|a[i])==K)
            ans+=b[i];
    }
    
    for(i=30; i>=0; i--) {
        if(!(1&K>>i)) continue;
        
        ll mask=K-(1<<i)|((1<<i)-1);
        ll s=0;
        for(j=0; j<N; j++) {
            if((mask|a[j])==mask)
                s+=b[j];
        }
        
        chmax(ans, s);
    }
    
    pt(ans);
    
}


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

#define F first
#define S second

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef priority_queue<int> HEAP;
typedef priority_queue<int, vector<int>, greater<int> > RHEAP;

const int N = 310, M = 100010;

int n;
int g[N][N], f[N][N];
bool st[N][N];

int main()
{
	cin >> n;
	for (int i = 1; i <= n; i ++ )
		for (int j = 1; j <= n; j ++ )
		{
			cin >> g[i][j];
			f[i][j] = g[i][j];
		}
	
	for (int k = 1; k <= n; k ++ )
		for (int i = 1; i <= n; i ++ )
			for (int j = 1; j <= n; j ++ )
				f[i][j] = min(f[i][j], f[i][k] + f[k][j]);
				
	for (int i = 1; i <= n; i ++ )
		for (int j = 1; j <= n; j ++ )
			if (g[i][j] != f[i][j])
			{
				puts("-1");
				return 0;
			}
	
	LL res = 0;
	for (int i = 1; i <= n; i ++ )
		for (int j = 1; j <= n; j ++ )
			for (int k = 1; k <= n; k ++ )
				if (k != i && k != j && g[i][j] == g[i][k] + g[k][j])
					st[i][j] = true;

	for (int i = 1; i <= n; i ++ )
		for (int j = i + 1; j <= n; j ++ )
			if (!st[i][j])
				res += g[i][j];
	
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 1024
import sys
import math
import fractions
from functools import reduce
from collections import Counter
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]  # LIST INT
def LF(): return [float(x) for x in sys.stdin.readline().split()]  # LIST FLOAT
def LS(): return sys.stdin.readline().split()  # LIST STRING
def MI(): return map(int, sys.stdin.readline().split())  # MAP INT
def II(): return int(sys.stdin.readline())  # INPUT INT
def IS(): return input()  # INPUT STRING
def P(x): return print(x)
def C(x): return Counter(x)
def GCD_LIST(numbers):
    return reduce(fractions.gcd, numbers)


N, X = MI()
x = LI()
diff = [abs(X - i) for i in x]
print(GCD_LIST(diff))


Measured memory_bytes: 16236
#line 2 "header.hpp"

//%snippet.set('header')%
//%snippet.fold()%
#ifndef HEADER_H
#define HEADER_H

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

// varibable settings
const long long INF = 1e18;
template <class T> constexpr T inf = numeric_limits<T>::max() / 2.1;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define _rrep(i, n) rrepi(i, 0, n)
#define rrepi(i, a, b) for (ll i = (ll)((b)-1); i >= (ll)(a); --i)
#define r_rep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(i, a) for (auto &&i : a)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(...) make_tuple(__VA_ARGS__)
#define ub upper_bound
#define lb lower_bound
#define lpos(A, x) (lower_bound(all(A), x) - A.begin())
#define upos(A, x) (upper_bound(all(A), x) - A.begin())
template <class T> inline void chmax(T &a, const T &b) { if ((a) < (b)) (a) = (b); }
template <class T> inline void chmin(T &a, const T &b) { if ((a) > (b)) (a) = (b); }
template <typename X, typename T> auto make_table(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto make_table(X x, Y y, Z z, Zs... zs) { auto cont = make_table(y, z, zs...); return vector<decltype(cont)>(x, cont); }

#define divceil(a, b) ((a) + (b)-1) / (b)
#define is_in(x, a, b) ((a) <= (x) && (x) < (b))
#define uni(x) sort(all(x)); x.erase(unique(all(x)), x.end())
#define slice(l, r) substr(l, r - l)

typedef long long ll;
typedef long double ld;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll, ll>;

template <typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;
void check_input() { assert(cin.eof() == 0); int tmp; cin >> tmp; assert(cin.eof() == 1); }

#if defined(PCM) || defined(LOCAL)
#else
#define dump(...) ;
#define dump_1d(...) ;
#define dump_2d(...) ;
#define cerrendl ;
#endif

#endif /* HEADER_H */
//%snippet.end()%
#line 2 "solve.cpp"
template<class T=ll> using vec = vector<T>;
struct Fast { Fast() { std::cin.tie(0); ios::sync_with_stdio(false); } } fast;


int gcd(int a, int b) {
    if (b > a) swap(a, b);
    if (b == 0) return a;
    return gcd(b, a % b);
}

int solve() {
    ll a,b,c;cin>>a>>b>>c;

    ll g = gcd(a, b);
    if (c%g==0){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }

    return 0; 
}


int main(){/*{{{*/
    solve();
    check_input();
    return 0;
}/*}}}*/


Measured memory_bytes: 256
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> s;
  rep(i, Size(s) / 2) {
    if (s[i] == s[Size(s) - i - 1]) continue;
    ans++;
  }
  Cout(ans);
  return 0;
}

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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}


typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { -1,0, 1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
// #define mp make_pair
//#define endl '\n'


int main() {
  while (true) {
    int x, y, s;
    cin >> x >> y >> s;
    if (x == 0) return 0;
    int ans = 0;
    rep1 (a, s) {
      rep1 (b, s) {
        int a1 = a * (100 + x) / 100;
        int b1 = b * (100 + x) / 100;
        if (a1 + b1 != s) continue;
        int a2 = a * (100 + y) / 100;
        int b2 = b * (100 + y) / 100;
        chmax(ans, a2 + b2);
      }
    }
    cout << ans << endl;
  }
}



Measured memory_bytes: 3072
import java.util.Scanner;

public class Main {

	static Scanner scanner;

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

	    int N=gi();
	    int[] A=new int[N+1];

	    for (int i=1; i<=N; i++) {
	    	A[i]=gi();
	    }
	    
	    int c=0;
	    for (int i=1; i<=N; i++) {
	    	int a=A[i];
	    	if(A[a]==i)c++;
	    }
        System.out.print(c/2);
//        if (K<A) {
//        	System.out.println(K);
//        }else if(K<A+B){
//        	System.out.println(A);
//        } else {
//        	System.out.print(A-(K-A-B));
//        }
	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Measured memory_bytes: 59200
#include <bits/stdc++.h>
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
using Int = long long;
const char newl = '\n';

//INSERT ABOVE HERE
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  int n,m;
  cin>>n>>m;
  vector<int> as(m);
  for(int i=0;i<m;i++) cin>>as[i];

  cout<<max(-1,n-accumulate(as.begin(),as.end(),0))<<newl;
  return 0;
}


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

int main(){

  int n, m;
  int a[9999];

  while(true){
    cin >> n >> m;
    if(!n && !m) break;

    for(int i=1;i<=n;i++) cin >> a[i];

    int p = 1;
    int ans = 0;

    for(int i=0;i<m;i++){
      int k;
      cin >> k;
      p += k + a[p+k];
      if(!ans && p >= n) ans = i+1;
    }

    cout << ans << endl;
  }

}

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

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

	int min = X - K + 1;
	int max = X + K - 1;

	for(int i = min; i <= max; i++)
	{
		cout << i << endl;
	}

	return 0;
}


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

int main() {
  int N;
  cin >> N;
  string slime;
  cin >> slime;
  
  int sum = 1;
  char A = slime.at(0);
                    
  for(int j=1;j<N;j++){
	if(A != slime.at(j)){
      A = slime.at(j);
      sum +=1;
    }
  }
  
  cout << sum <<endl;

}


Measured memory_bytes: 512
#include <iostream>
#include <queue>
#include <map>
#include <cmath>
#include <algorithm>
#include <queue>
#include <cstdarg>
#include <set>
#include <limits>
#include <iomanip>

using namespace std;
#define INF 2e9 + 9
#define MOD 1000000007
#define ALL(v) v.begin() , v.end()
#define Int int64_t
#define pll pair<Int,Int>
template<class T> using pql = priority_queue<T, vector<T>>;
template<class T> using pq = priority_queue<T, vector<T>, greater<T>>;
#define ll(n) Int n; cin >> n;
#define LL(...) Int __VA_ARGS___; cin >> __VA_ARGS___;
#define OUT(...) cout << __VA_ARGS___;
#define RP(n, i, s) for(Int i = s ;i < n ;i++)
#define REP(n, i) for (Int i = 0; i < n; i++)
#define REPe(n, i) for (Int i = 1; i <= n; i++)
#define RPe(n, i, s) for (Int i = s; i <= n; i++)
#define upd_max(maxer, updater) if (maxer < updater) maxer = updater;
#define upd_min(miner, updater) if (miner > updater) miner = updater;

void ansYes(bool flag) {
    if (flag) cout << "Yes" << endl; else cout << "No" << endl;
}

void ansYES(bool flag) {
    if (flag) cout << "YES" << endl; else cout << "NO" << endl;
}

struct node {
    Int to;
    Int length;
};


vector<Int> divisor(Int n) {
    vector<Int> ret;
    for (Int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    return (ret);
}

/*
vector<vector<int>> to;
vector<int> flag;
vector<int> c;


Int dfs(int from, int mae) {
    flag[from] = 1;
    Int mini = 0;
    for (auto next : to[from]) {
        if (next == mae) continue;
        if (flag[next] == 1) {
            return -1;
        } else {
            mini = min(mini, dfs(next, from));
        }
    }
    return mini;
}*/

int dx8[8] = {0, -1, -1, -1, 0, 1, 1, 1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};

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

struct datas {
    Int max;
    Int size;
};

class ContainChecker {
protected:
    Int minx, miny, maxx, maxy;
public:
    ContainChecker(Int minx, Int miny, Int maxx, Int maxy) : minx(minx), miny(miny), maxx(maxx), maxy(maxy) {};

    bool in(Int x, Int y) {
        return (minx <= x && miny <= y && x <= maxx && y <= maxy);
    }
};

Int dfs(Int digits, Int tugi, Int num, Int koko) {

}



int main(void) {
    Int n;
    cin >> n;
    cout << n*(n+1) / 2 << endl;
}




Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
https://beta.atcoder.jp/contests/abc085/tasks/abc085_b

"""
import sys
from sys import stdin
input = stdin.readline


def solve(mochi):
    availables = [False] * 101
    for m in mochi:
        availables[m] = True
    return availables.count(True)


def main(args):
    mochi = []
    N = int(input())
    for _ in range(N):
        mochi.append(int(input()))
    ans = solve(mochi)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>
#include<array>
using namespace std;
using ll = long long;
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rrep(i, a, b) for(int i = b - 1; i >= a; i--)
#define ALL(a) a.begin(), a.end()
using pii = pair<int,int>;
using piii = pair<pii,int>;
using pll = pair<long long, long long>;
using plll = pair<pll, long long>;
// #pragma GCC optimize("Ofast")
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define isSquare(x) (sqrt(x)*sqrt(x) == x)
template<class T>inline bool chmax(T &a, const T &b) {if(a<b){a = b; return 1;} return 0; };
template<class T>inline bool chmin(T &a, const T &b) {if(a>b){a = b; return 1;} return 0; };
inline void in(void){return;}
template <typename First, typename... Rest> void in(First& first, Rest&... rest){cin >> first;in(rest...);return;}
inline void out(void){cout << "\n";return;}
template <typename First, typename... Rest> void out(First first, Rest... rest){cout << first << " ";out(rest...);return;}
const double EPS = 1e-9;
const int mod = 1e9 + 7;
const int INF = 1e9;
const long long INFLL = 1e18;

ll a, b, c, d;
map<ll, ll> memo;
ll rec(ll n){
    if(n == 0) return 0;
    if(n == 1) return d;
    if(memo.count(n)) return memo[n];
    ll l2 = (n / 2) * 2;
    ll r2 = ((n + 1) / 2) * 2;
    ll l3 = (n / 3) * 3;
    ll r3 = ((n + 2) / 3) * 3;
    ll l5 = (n / 5) * 5;
    ll r5 = ((n + 4) / 5) * 5;

    ll res = 1e18;
    if(res / d > n) chmin(res, n * d);
    chmin(res, rec(l2/2) + abs(n - l2) * d + a);
    chmin(res, rec(r2/2) + abs(n - r2) * d + a);

    chmin(res, rec(l3/3) + abs(n - l3) * d + b);
    chmin(res, rec(r3/3) + abs(n - r3) * d + b);

    chmin(res, rec(l5/5) + abs(n - l5) * d + c);
    chmin(res, rec(r5/5) + abs(n - r5) * d + c);

    return memo[n] = res;
}

int main(){
    int T; cin >> T;
    while(T--){
        memo.clear();
        ll n;
        cin >> n >> a >> b >> c >> d;
        cout << rec(n) << endl;;
    }

    return 0;
}

Measured memory_bytes: 4448
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod 100000007
int main()
{
    int N;
    cin >> N;
    vector<pair<int, int>> P;
    vector<int> A(N);
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
        P.push_back(make_pair(A[i], i + 1));
    }
    sort(P.begin(), P.end());
    for (int i = 0; i < N; i++)
    {
        cout << P[i].second << " ";
    }
    cout << endl;
}


Measured memory_bytes: 2164
program main
    implicit none
    integer::n,ans,i,t
    integer,allocatable::x(:)
    read(*,*) n
    allocate(x(n))
    read(*,*) x
    
    t=1
    
    do i=1,n
        if(mod(x(i),2)==0)then
        	t=t*2
        end if
    end do
    
    ans=3**n-t
    
    write(*,*) ans
    deallocate(x)
    
    stop
end program main
    
    

Measured memory_bytes: 512
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

ll N,K;
ll inf = 1e9+7;
ll dp1[101][100010] = {};
ll dp2[101][100010] = {};
ll cnt[100010] = {};
int main(){
    cin >> N >> K;
    ll s = 0;
    for(int i=1;i*i<=N;i++){
        s = i;
    }
    for(int i=1;i<=s;i++){
        cnt[i] = max(0LL,N/i-max(N/(i+1),s));
    }
    for(int i=1;i<=s;i++){
        dp1[1][i] = 1;
        dp2[1][i] = cnt[i];
        dp1[1][i] += dp1[1][i-1];
    }
    for(int i=s-1;i>=1;i--) dp2[1][i] += dp2[1][i+1];
//    for(int i=1;i<=s;i++) cerr << i << " " << cnt[i] << endl;
    for(int i=2;i<=K;i++){
        for(int j=1;j<=s;j++){
            (dp1[i][j] += dp1[i-1][s]+dp2[i-1][j])%=inf;
            (dp2[i][j] += cnt[j]*dp1[i-1][j])%=inf;
        }
        for(int j=1;j<=s;j++){
            (dp1[i][j] += dp1[i][j-1])%=inf;
            if(j!=1) (dp2[i][s-j+1] += dp2[i][s-j+2])%=inf;
        }
    }
/*    for(int i=1;i<=K;i++) for(int j=1;j<=s;j++) cerr << dp1[i][j] << (j!=s? " ":"\n");
    cerr << endl;
    for(int i=1;i<=K;i++) for(int j=1;j<=s;j++) cerr << dp2[i][j] << (j!=s? " ":"\n");
    ll ans = 0;
*/    cout << (dp1[K][s]+dp2[K][1])%inf << endl;
}

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

int main()
{
    long long n,w;
    cin>>n>>w;
    long long a[n],b[n],sum=0,ans=0;
    for(int i=0; i<n; i++)
    {
        cin>>a[i]>>b[i];
        sum+=b[i];
    }
    long long dp[sum+1];
    for(int i=0; i<=sum; i++)
        dp[i]=1e18;
    dp[0]=0;
    for(int i=0; i<n; i++)
        for(int j=sum; j>=0; j--)
            if(j>=b[i]) dp[j]=min(dp[j],dp[j-b[i]]+a[i]);
    for(long long j=0; j<=sum; j++)
    {
        //cout<<dp[j]<<" ";
        if(dp[j]<=w) ans=max(ans,j);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
import java.util.*;
 
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String m[] = s.split("");
    int ans = 0;
    for (int i = 0; i < s.length(); i++){
      if (m[i].equals("+")){
        ans++;
      }else{
        ans--;
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 35652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define enum(i,x,y) for(int i=(x);i<=(y);++i)
#define try(i,x,y) for(int i=(x);i>=(y);--i)
template <typename TYPE> inline void chkmax(TYPE &x,TYPE y){x<y?x=y:0;}
template <typename TYPE> inline void chkmin(TYPE &x,TYPE y){y<x?x=y:0;}
template <typename TYPE> void readint(TYPE &x)
{
    x=0;int f=1;char c;
    for(c=getchar();!isdigit(c);c=getchar())if(c=='-')f=-1;
    for(;isdigit(c);c=getchar())x=x*10+c-'0';
    x*=f;
}
const int MAXN=200005,MOD=998244353;

int n;char s[MAXN];
int prm[MAXN],mu[MAXN],pn;bool notp[MAXN];
vector<int> eat;
int f[MAXN];
void euler()
{
	notp[1]=0;mu[1]=1;
	enum(i,2,n)
	{
		if(!notp[i]){prm[++pn]=i;mu[i]=-1;}
		enum(j,1,pn)
		{
			if(i*prm[j]>n)break;
			notp[i*prm[j]]=1;
			if(i%prm[j])mu[i*prm[j]]=-mu[i];
			else {mu[i*prm[j]]=0;break;}
		}
	}
}

int qmi(int x,int y)
{
	int ans=1;
	for(;y;y>>=1,x=1ll*x*x%MOD)
		if(y&1)ans=1ll*ans*x%MOD;
	return ans;
}
int work(int x)
{
	int ans=0;
	enum(i,0,n)
	{
		if(s[i]=='1' && (i<=x || s[i]==s[i-x]))
			ans=(ans+qmi(2,max(0,x-i)))%MOD;
		if(i>x && s[i]==s[i-x])break;
	}
	return ans;
}

int main()
{
	readint(n);scanf("%s",s+1);
	euler();
	s[0]='0';
	try(i,n,0)
		if(s[i]=='1')s[i]='0';
		else {s[i]='1';break;}
	enum(i,1,n)
		if(n%(2*i)==i)
		{
			f[i]=work(i);
			eat.pb(i);
		}
	int ans=0;
	for(auto x:eat)
	{
		int t=0;
		for(auto y:eat)
			if(!(x%y))t=(t+1ll*f[y]*(mu[x/y]+MOD))%MOD;
		ans=(ans+2ll*t*x)%MOD;
	}
	printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 1536
import itertools


D = [int(input()) for _ in range(5)]
min_time = 1000
for p in itertools.permutations(range(5)):
    time = 0
    for i in range(5):
        time += D[p[i]]
        if i < 4:
            dm = D[p[i]]%10
            time += 0 if dm == 0 else 10-dm
    min_time = min(min_time, time)
print(min_time)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

const ll mod=1e9+7;

//vector書き出し
template <class T>
void cout_vec(const vector<T> &vec1){
  rep(i,len(vec1)){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}

typedef pair<int,int> P;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,c;
    cin>>n>>c;
    vector<int> s(n),t(n),ch(n),sum(100010,0);
    vector<P> x[31];
    rep(i,n){
      cin>>s[i]>>t[i]>>ch[i];
      //sum[s[i]-1]++;
      //sum[t[i]]--;
      x[ch[i]].push_back({s[i],t[i]});
    }
    FOR(i,1,31){
      sort(begin(x[i]),end(x[i]));
      if(len(x[i])>=2){
        rep(j,len(x[i])-1){
          if(x[i][j].second==x[i][j+1].first){
            x[i][j+1].first=x[i][j].first;
            x[i][j].first=1;
            x[i][j].second=0;
          }
        }
      }
      rep(j,len(x[i])){
        sum[x[i][j].first-1]++;
        sum[x[i][j].second]--;
      }
    }
    rep(i,100010){
      sum[i+1]+=sum[i];
    }
    //cout_vec(sum);
    cout<<*max_element(begin(sum),end(sum))<<endl;
}

Measured memory_bytes: 3072
def Distance(X,Y,p):
    s=0
    for x,y in zip(X,Y):
        s+=abs(x-y)**p
    print(s**(1/p))

n=int(input())
X=list(map(int,input().split()))
Y=list(map(int,input().split()))

for p in range(1,4):
    Distance(X,Y,p)
print(max(abs(x-y) for x,y in zip(X,Y)))


Measured memory_bytes: 5644
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  vector<string> blue(n);
  vector<int> score(n);
  int max_score = 0;
  for (int i = 0;i<n;i++) cin >> blue.at(i);
  int red_n;
  cin >> red_n;
  vector<string> red(red_n);
  for (int i = 0;i < red_n;i++) cin >> red.at(i);
 
  for (int i = 0;i < n;i++){
    int count = 0;
    for (int j = 0;j < n;j++){
      if (blue.at(i) == blue.at(j)) count++;
    }
    for (int j = 0;j < red_n;j++){
      if (blue.at(i) == red.at(j)) count--;
    }
    max_score = max(max_score, count);
  }
  cout << max_score << endl;
}

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

int main() {
	int N;
	int sum = 0;
	vector<int>::iterator itr;

	cin >> N;
	vector<int> s(N);

	for (int i = 0; i < N; i++) cin >> s[i];
	for (int i = 0; i < N; i++) sum += s[i];


	while( (sum % 10) == 0 ) {
		itr = min_element(s.begin(), s.end());
		if ( (*itr % 10) != 0) {
			sum -= *itr;
			s.erase(itr);
		} else if ((*itr % 10) == 0) {
			s.erase(itr);
		}

		if (s.size() == 0) {
			sum = 0;
			break;
		}
	}


	cout << sum << endl;


	return 0;
}

Measured memory_bytes: 256
n=int(input())
p=list(map(int,input().split()))
q=[0 for i in range(n)]
for i in range(n):
  q[p[i]-1]=i+1
a=[i*n+q[i] for i in range(n)]
b=[(n-i-1)*n+q[i] for i in range(n)]
sa=""
sb=""
for i in range(n):
  sa+=str(a[i])+" "
  sb+=str(b[i])+" "
print(sa)
print(sb)

Measured memory_bytes: 12680
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
multiset<i_i> st;
int N;

void print() {
    return;
    for(auto tmp : st) {
        cerr << "(" << tmp.first << ", " << tmp.second << ") ";
    }
    cerr << endl;
}

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    st.insert({0, 1});
    st.insert({2e9, 2e9});
    for(int i = 1; i <= N; i++) {
        print();
        int x;
        cin >> x;
        auto itr = st.lower_bound({x, 2e9});
        if(itr == st.begin()) {
            cout << "No" << endl;
            continue;
        } else {
            cout << "Yes" << endl;
        }
        itr--;
        i_i now = *itr;
        st.erase(itr);
        if(now.second > x) {
            i_i sub = {now.first, x};
            if(sub.first != sub.second) st.insert(sub);
            sub = {x + 1, now.second};
            if(sub.first != sub.second) st.insert(sub);
        } else {
            i_i sub = {now.first, now.second - 1};
            if(sub.first != sub.second) st.insert(sub);
            sub = {now.second, x + 1};
            if(sub.first != sub.second) st.insert(sub);
            //now.first++;
            //now.second = x + 1;
            //st.insert(now);
        }
    }
    return 0;
}


Measured memory_bytes: 10728
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.math;


void main() {
    int n;
    scan(n);
    auto a = readln.split.to!(int[]);
    auto b = a.dup.sort();
    int m1 = b[n/2 - 1], m2 = b[n/2];
    foreach (ai ; a) {
        if (ai <= m1) writeln(m2);
        else writeln(m1);
    }
}



void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


Measured memory_bytes: 12720
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const ll INF = 1e9 + 7;
const ll inf = 1LL << 50;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
///////////////////////////////////////

int main() {
	ll N, W; cin >> N >> W;
	vector<ll>V[4];
	ll wi;
	REP(i, N) {
		int	w, v;
		cin >> w >> v;
		if (i == 0) {
			V[0].push_back(v);
			wi = w;
		}
		else {
			V[w - wi].push_back(v);
		}
	}
	REP(i, 4) {
		sort(V[i].begin(), V[i].end(), greater<ll>());
	}
	vector<ll>sum[5];
	REP(i, 5)sum[i].push_back(0);
	for (int i = 0; i < 4; ++i) {
		for (int j = 1; j < V[i].size() + 1; ++j) {
			sum[i].push_back( sum[i][j - 1] + V[i][j - 1]);
		}
	}
	ll ans = 0;
	for (int i = 0; i <= V[0].size(); ++i) {
		for (int j = 0; j <= V[1].size(); ++j) {
			for (int k = 0; k <= V[2].size(); ++k) {
				for (int l = 0; l <= V[3].size(); ++l) {
					if (i*wi + j * (wi + 1) + k * (wi + 2) + l * (wi + 3) > W)continue;
					ans = max(ans, sum[0][i] + sum[1][j] + sum[2][k] + sum[3][l]);
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<stack>
#include<queue>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<math.h>
using namespace std; 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define pp(...) "\033[94m [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define dg1(x) debug() << pp(x)
#define dg2(x,y) debug() << pp(x) pp(y)
#define dg3(x,y,z) debug() << pp(x) pp(y) pp(z)
#define dg4(w,x,y,z) debug() << pp(w) pp(x) pp(y) pp(z)
#define msg(x) debug() << x
#define int long long
const int xx = 2e5;
const int MOD = 1e9 + 7;
int lcm(int a, int b){
  return a*(b/__gcd(a,b));
}
signed main(){

  ios::sync_with_stdio(false);cin.tie(0);

  int n;
  cin >> n;
  vector<int>v(n);
  for(int i=0;i<n;i++){
    cin >> v[i];
  }
  int cnt = 0;
  int j = 0;
  int x = 1;
  while(j < n){

    if(v[j] == x){
      cnt++;
      x++;
    }
    j++;
  }

  int ans  = n - cnt ;
  if(cnt == 0) ans = -1;

  cout << ans << '\n';
  
}


Measured memory_bytes: 1792
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const int MOD=1000000007;

int main(){
    int n,i,j;
    cin>>n;
    vector<int> x(n);
    rep(i,n){
        cin>>x[i];
    }
    vector<int> ans(100,0);
    int ene;
    rep(i,100){
        ene=0;
        rep(j,n){
            ene+=pow(x[j]-i,2);
        }
        ans[i]=ene;
    }
    int answ=MOD;
    rep(i,100){
        answ=min(answ,ans[i]);
    }
    cout<<answ;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {

	while (1) {
		int H, W;
		scanf("%d %d", &H, &W);

		if (H == 0 && W == 0) {
			return 0;
		}

		for (int i2 = 0; i2 < W; i2++) {
			printf("#");
		}
		printf("\n");

		for (int i = 0; i < (H - 2); i++) {
			printf("#");

			for (int i2 = 0; i2 < (W - 2); i2++) {
				printf(".");
			}

			printf("#");
			printf("\n");
		}

		for (int i2 = 0; i2 < W; i2++) {
			printf("#");
		}

		printf("\n");
		printf("\n");
	}


	return 0;
}


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

typedef long long ll;

int main() {
    int A, B;
    cin >> A >> B;
    int ans;
    if (A < 1 || A > 9 || B < 1 || B > 9) ans = -1;
    else ans = A*B;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

public class ABC0140_A3v1 {
    private static void Main(string[] args) {
        var inputs = new List<string>() {
            Console.ReadLine().Trim(),
            Console.ReadLine().Trim(),
        };

        Prepare(inputs);
    }

    private static void Prepare(List<string> inputs) {
        var numOfInts = int.Parse(inputs[0]) - 1;
        var ints = inputs[1].Split().
            Select(x => int.Parse(x)).
            ToArray();

        Compute(numOfInts, ints);
    }

    private static void Compute(int numOfInts, int[] ints) {
        var total = ints[0] + ints[numOfInts - 1];

        for (var index = 0; index < numOfInts - 1; index++) {
            total += Math.Min(ints[index], ints[index + 1]);
        }

        OutputAnswer(total.ToString());
    }

    private static void OutputAnswer(string text) => Console.WriteLine(text);
}


Measured memory_bytes: 13268
#include <iostream>
#include <algorithm>
#include <cmath>
#include <functional>
#include <string>
#include <vector>
using namespace std;

#define int long long
#define rep(n, i) for (int i = 0; i < n; i++)
#define rep2(m, n, i) for (int i = m; i < n; i++)
#define rep_r(n, i) for (int i = n - 1; i >= 0; i--)

signed main() {
    int n, d, x;
    cin >> n >> d >> x;
    int a[n];
    rep(n, i) {
        cin >> a[i];
    }
    int cnt = 0;
    rep(n, i) {
        int day = 1;
        while (day <= d) {
            cnt++;
            day += a[i];
        }
    }
    cout << cnt + x << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

static class CaesarCipher
{
    const int numAlph = 'z' - 'a' + 1;
    static void Main()
    {
        var sep = " ,.\n".ToArray();
        var q =
            from c in RepeatInfinite<Func<string>>( Console.ReadLine )
                .Select( x => x() )
                .TakeWhile( x => x != null )
            let k = EstimateKey( c.Split( sep ) )
            select new string( c
                .Select( x => new { c = x, p = x - k } )
                .Select( x => new { c = x.c, p = x.p < 'a' ? x.p + numAlph : x.p } )
                .Select( x => new { c = x.c, p = x.p > 'z' ? x.p - numAlph : x.p } )
                .Select( x => (char)( sep.Contains( x.c ) ? x.c : x.p ) )
                .ToArray() );
        q.ToList().ForEach( Console.WriteLine );
    }

    static int EstimateKey(IEnumerable<string> cipherWords)
    {
        var samples = new[] { "the", "this", "that" }
            .Select( x => x.Select( y => (int)y ) )
            .ToArray();
        var q =
            from w in cipherWords
            where w.Length == 3 || w.Length == 4
            let k = w[0] - 't'
            let p = w
                .Select( x => x - k )
                .Select( x => x < 'a' ? x + numAlph : x )
                .Select( x => x > 'z' ? x - numAlph : x )
            where samples.Any( x => x.SequenceEqual( p ) )
            select k;
        return q.First();
    }

    static IEnumerable<TSource> RepeatInfinite<TSource>(TSource source)
    {
        while ( true )
            yield return source;
    }
}

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

int main() {
    vector <bool> monSatNum( 300001, false );
    int n = 0;
    while ( true ) {
        if ( 7 * n + 1 < 300000 ) {
            monSatNum[7 * n + 1] = true;
        }
        else {
            break;
        }
        if ( 7 * n + 6 < 300000 ) {
            monSatNum[7 * n + 6] = true;
        }
        else {
            break;
        }
        n++;
    }

    vector <bool> prime( 300001, true );
    rep ( i, 300001 ) {
        if ( monSatNum[i] == false ) continue;
        if ( i == 1 ) continue;
        for ( int j = i * 2; j < 300001; j += i ) {
            prime[j] = false;
        }
    }

    while ( cin >> n, n != 1 ) {
        cout << n << ":";
        range ( i, 6, n + 1 ) {
            if ( prime[i] && monSatNum[i] && n % i == 0 ) {
                cout << " " << i;
            }
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3128
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<math.h>
#include<iomanip>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define PI acos(-1);
typedef long long ll;
using namespace std;
//scanf("%d", &a) '\n'

int main() {
	int n;
	cin >> n;
	vector<string> fs(n);
	ll ans = 0;
	rep(i, n) {
		string s;
		cin>>s;
		sort(s.begin(), s.end());
		fs.at(i) = s;
	}
	sort(fs.begin(), fs.end());
	int count = 1;
	rep2(i, 1, n) {
		if (fs[i] != fs[i-1]) {
			count = 1;
		}
		else ++count;
		ans += count - 1;
	}
	cout << ans << '\n';
}
	

Measured memory_bytes: 5760
a,b,k=map(int,input().split())
s={a}
for i in range(a,a+k):
    if a<=i<=b:
        s.add(i)
for i in range(b,b-k,-1):
    if a<=i<=b:
        s.add(i)
s=list(s)
s.sort(reverse=True)
for i in range(len(s)):
    print(s.pop())

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

int main(){
	cin>>n;
	for(ll i=2;i*i<=n;i++){
		int cnt=0;
		while(n%i==0){
			n/=i;
			cnt++;
		}
		int x=1;
		while(cnt>=x){
			ans++;
			cnt-=x;
			x++;
		}
	}
	if(n>1)ans++;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
int main(int argc, char* argv[]) {
    string s;
    cin >> s;
    if(s[2]==s[3]&&s[4]==s[5]) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bitset>
#include <string>
#include <vector>

using namespace std;

int main() {
	string s;
	cin >> s;
	vector<int> v(4);
	for (int i = 0; i < 4; i++) v.at(i) = s[i] - '0';
	for (int i = 0; i < (1 << 4); i++)
	{
		bitset<4> bit(i);
		int sum = v.at(0);
		for (int j = 0; j < 4; j++)
		{
			if (j) {
				if (bit.test(3-j)) sum += v.at(j);
				else sum -= v.at(j);
			}
		}
		if (sum == 7) {
			cout << v.at(0);
			for (int k = 0; k < 4; k++)
			{
				if (k) {
					if (bit.test(3-k)) cout << "+";
					else cout << "-";
					cout << v.at(k);
				}
			}
			cout << "=7" << endl;
			break;
		}
	}
	return 0;
}


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

int main(){
    int a, b;
    string op;
    while (true){
        cin>>a>>op>>b;
        if(op=="?"){
            break;
        }
        else{
            if(op=="+"){
                cout<<a+b<<endl;
            }
            else if(op=="-"){
                cout<<a-b<<endl;
            }
            else if (op=="*"){
                cout<<a*b<<endl;
            }
            else{
                cout<<a/b<<endl;
            }
        }
    }
}


Measured memory_bytes: 3160
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast", "unroll-loops")
using namespace std;
#define ll long long
#define int ll
#define FOR(i,a,b) for (int i = (a); i<(b); i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n+1)
#define RREP(i,n) for (int i=(n)-1; i>=0; i--)
#define f first
#define s second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define SZ(x) (int)(x.size())
#define SQ(x) (x)*(x)
#define pii pair<int, int>
#define endl '\n'
//#define TOAD
#ifdef TOAD
#define bug(x) cerr<<__LINE__<<": "<<#x<<" is "<<x<<endl
#define IOS() 
#else
#define bug(...)
#define IOS() ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#endif
const ll inf = 1ll<<60;
const int iinf=2147483647;
const ll mod = 1e9+7;
const int maxn=1e6+5;
signed main (){
  IOS();
  int n, m; cin>>n>>m;
  vector<int> vc(n);
  REP(i,n) vc[i]=1;
  vector<bool> can(n);
  can[0]=1;
  //vc[0]=0;
  REP(i,m){
    int x, y; cin>>x>>y;
    if (can[x-1]) can[y-1]=true;
    vc[x-1]--;
    vc[y-1]++;
    if (vc[x-1]<=0) can[x-1]=false;

  }
  int ans=0;
  REP(i,n){
    if (can[i]) ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1024
#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 ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x))
#define RSORT(x) sort(RALL(x))
#define SUM(x) accumulate(ALL(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))
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 ll mod = 1e9+7;
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;}

vector<pair<ll,int>> factorize(ll n) {
  vector<pair<ll,int>> res;
  for (ll i = 2; i*i <= n; ++i) {
    if (n%i) continue;
    res.emplace_back(i,0);
    while (n%i == 0) {
      n /= i;
      res.back().se++;
    }
  }
  if (n != 1) res.emplace_back(n,1);
  return res;
}

int main () {
  ll a, b;
  cin >> a >> b;

  ll g = gcd(a,b);

  vector<pair<ll,int>> f;
  f = factorize(g);

  cout << f.size() + 1 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef double db;
typedef vector<ll> VI;
typedef vector<pair<ll,ll> > VII;
typedef map<ll,ll> mll;
typedef pair<ll,ll> pll;
//
#define M 1000000007
#define INF (ll)0x3f3f3f3f3f3f3f3f
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define F first
#define S second
#define itr iterator
#define GO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
void fileioe(){
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout); 
	freopen("error.txt","w",stderr);
}

void error_out() { cerr << endl; }
template <typename Head, typename... Tail>
void error_out(Head H, Tail... T) {
  cerr << " " << H;
  error_out(T...);
}
void time_elapsed(){
  cerr<<"\nTime Elapsed : " << 1.0*clock() / CLOCKS_PER_SEC << " s\n";
}
#ifndef ONLINE_JUDGE
#define error(...) cerr << "[" << #__VA_ARGS__ << "]:", error_out(__VA_ARGS__)
#define fioe() fileioe()
#define time() time_elapsed()
#else
#define error(...) 1
#define fioe() 1
#define time() 1
#endif


//
int main()
{
	GO
	//fioe();
	ll n,k,s;
	cin>>n>>k>>s;
	for(ll i=0;i<k;i++){
		cout<<s<<" ";
	}
	if(s<=1e5){
		for(ll i=k;i<n;i++){
			cout<<s+1<<" ";
		}
	}
	else{
		for(ll i=k;i<n;i++)
			cout<<1<<endl;
	}
	time();
	return 0;
}

Measured memory_bytes: 1280