akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <bitset>
#include <map>
#include <math.h>
#include <utility>

using namespace std;

int main(){

    int N, M;
    cin >> N >> M;

    vector<vector<int>> Graph(N);
    for (int i = 0; i < M; i++){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        Graph[a].emplace_back(b);
        Graph[b].emplace_back(a); // 有向グラフの場合は不要
    }

    // 入力確認用
    // for (int i = 0; i < N; i++){
    //     cout << i << " -> ";
    //     for (int j = 0; j < Graph[i].size(); j++){
    //         cout << Graph[i][j] << " ";
    //     }
    //     cout << endl;
    // }

    // BFS
    queue<int> q;
    vector<int> route(N, -1); // 道しるべ番号. 未訪問点を -1 で表す

    // 初期条件 今回は 頂点0 からスタート
    q.push(0);
    route[0] = 0;

    while(!q.empty()){
        int now = q.front();
        q.pop();
        for (int next : Graph[now]){
            if (route[next] == -1) { // 未訪問の点のみ探索
                route[next] = now;
                q.push(next);
            }
        }
    }

    // for (int i = 0; i < N; i++){
    //     cout << "node:" << i << ", route:" << route[i] << endl;
    // }

    for (int i = 0; i < N; i++){
        if (route[i] == -1){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    for (int i = 0; i < N-1; i++){
        cout << route[i+1] + 1 << endl;
    }

    return 0;
}


Measured memory_bytes: 9748
#include <cstdio>
#include <algorithm>
using namespace std;
int left[4], right[4];


int calc(const double &a) {
    if (a >= 1.1) return 0;
    else if (a >= 0.6) return 1;
    else if (a >= 0.2) return 2;
    else return 3;
}


int main()  {

    fill(left, left+4, 0); fill(right, right+4, 0);
    double l, r;
    while (scanf("%lf %lf", &l, &r) != EOF) {
        left[calc(l)]++;
        right[calc(r)]++;
    }
    for (int i = 0; i < 4; i++) printf("%d %d\n", left[i], right[i]);
    return 0;
}



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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main(void) {
    string s;
    cin >> s;
    int cnt = 0, ans = 0;
    rep(i, s.size()) {
        if(s[i] == 'A' || s[i] == 'G'|| s[i] == 'C' || s[i] == 'T') {
            cnt++;
            ans = max(cnt, ans);
        }else {
            cnt = 0;
        }
    }
    cout << ans << endl;
    return 0;
}


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

#define N 24

class Disk {
public:
    int x, y, r, c;

    Disk(int xx, int yy, int rr, int cc) :x(xx), y(yy), r(rr), c(cc) {}

    bool on(const Disk& d) {
        return (x - d.x) * (x - d.x) + (y - d.y) * (y - d.y) < (r + d.r) * (r + d.r);
    }
    bool sameColor(const Disk &d) {
        return c == d.c;
    }
};

vector<Disk> disk;
map<int, int> memo;

int dfs(int used) {
    if(memo[used]) return memo[used];
    vector<int> candidate;
    for(int i = 0; i < disk.size(); i++) {
        if(used & (1<<i)) continue;
        bool ok = true;
        for(int j = 0; j < i; j++) {
            if(used & (1<<j)) continue;
            if(!disk[j].on(disk[i])) continue;
            ok = false;
            break;
        }
        if(ok) candidate.push_back(i);
    }

    int result = 0;
    for(int ci = 0; ci < candidate.size(); ci++) {
        for(int cj = 0; cj < ci; cj++) {
            int i = candidate[ci];
            int j = candidate[cj];
            if(!disk[i].sameColor(disk[j])) continue;
            result = max(result, 2 + dfs(used | (1<<i) | (1<<j)));
        }
    }
    return memo[used] = result;
}

int main() {
    int n;
    while(cin >> n, n) {
        disk.clear();
        memo.clear();
        for(int i = 0; i < n; i++) {
            int x, y, r, c;
            cin >> x >> y >> r >>c;
            disk.push_back(Disk(x, y, r, c));
        }
        cout << dfs(0) << endl;
    }
}

Measured memory_bytes: 50420
#include <iostream>
#include <cstdio>
using namespace std;
long long dp[100];


long long L(long long n){
    if(n == 0){
        return 2;
    }
    else if(n == 1){
        return 1;
    }

    dp[0] = 2;
    dp[1] = 1;
    for(long long i = 2; i <= n; i++){
        dp[i] = dp[i-1] + dp[i-2];
    }

    return dp[n];

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

    cout << L(n) << endl;
    return 0;
}

Measured memory_bytes: 3572
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0; 
string rstring(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T rtype(T)(){ return rstring.to!T; } alias rint = rtype!int, rlong = rtype!long, rreal = rtype!real;
T[] rtypes(T)(int n){ return n.iota.map!(i => rtype!T()).array; } alias rint = rtypes!int, rlong = rtypes!long, rreal = rtypes!real;
T[][] rtypess(T)(int n, int m){ return n.iota.map!(i => rtypes!T(m)).array; } alias rint = rtypess!int, rlong = rtypess!long, rreal = rtypess!real;

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

void solve(){
	int x = rint, y = rint;
	
	int ans;
	if(x == 3) ans += 100_000;
	if(x == 2) ans += 200_000;
	if(x == 1) ans += 300_000;
	
	if(y == 3) ans += 100_000;
	if(y == 2) ans += 200_000;
	if(y == 1) ans += 300_000;
	
	if(x == 1 && y == 1) ans += 400_000;
	
	ans.writeln;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define ull unsigned long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define pi acosl(-1)
#define sqr(x) ((x)*(x))
#define mod (1000*1000*1000+7)
#define pdd pair<double,double>
#define MEMS(x) memset(x,-1,sizeof(x))
#define MEM(x) memset(x,0,sizeof(x))
template <typename T>
string NumberToString(T pNumber)
{
     ostringstream oOStrStream;
     oOStrStream << pNumber;
     return oOStrStream.str();
}
ll StringToNumber(string s)
{
    stringstream geek(s);
    ll x=0;
    geek>>x;
    return x;
}
ll modPow(ll x,ll n,ll m)
{
    if(n==0)
    return 1%m;
    ull u = modPow(x,n/2,m);
    u=u*u%m;
    if(n%2==1)
    u=u*x%m;
    return u;
}
ll gcd(ll a,ll b)
{
    if(b==0)
    return a;
    return gcd(b,a%b);
}
ll seive[1000000];
void seiveForm()
{
    ll i,j;
    seive[0]=seive[1]=1;
    f(i,2,100000)
    {
        if(seive[i]==0)
            for(j=i*i;j<1000000;j+=i)
                seive[j]=1;
    }
}
bool isPerfectSquare(ll num)
{
    double n = sqrt(num);
    return n==(ll)n?true:false;
}
ll countSetbits(ll num)
{
    ull temp=0;
    while(num){
        num=num&(num-1);
        temp++;
    }
    return temp;
}
bool isPowerOfTwo(ll n)
{
   if(n==0)
   return false;
   return (ceil(log2(n)) == floor(log2(n)));
}
ll power(ll x, ll y)
{
    ll res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = res*x;
        y = y>>1;
        x = x*x;
    }
    return res;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll i,k,j,n,m,temp=0,ans=0;
    cin>>n;
    ll t[n+1];
    t[0]=0;
    f(i,1,n+1)
    cin>>t[i];
    cin>>m;
    ll p[m],x[m];
    rep(i,m)
    cin>>p[i]>>x[i];
    ll sum = accumulate(t,t+n+1,0);
    rep(i,m)
    {
        temp = sum-t[p[i]];
        ans = temp+x[i];
        cout<<ans<<"\n";
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lim 100005
#define mod 1000000007
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define sd(n) scanf("%lld",&n)
 int main()
 {
  bool p[2*lim+1];
  for(ll i=2;i*i<=2*lim;i++)
  {
    if(!p[i])
    {
      for(ll j=2*i;j<=2*lim;j+=i)
        p[j]=1;
    }
  }
  ll ans[2*lim+1];
  ans[0]=0;
  ans[1]=0;
  for(ll i=2;i<=lim;i++)
    {
      ans[i]=ans[i-1];
      if(i%2==1&&!p[i]&&!p[(i+1)>>1])
        ans[i]++;
        
    }
  ll q,l,r;
  cin>>q;
  while(q--)
  {
    sd(l);
    sd(r);
    cout<<ans[r]-ans[l-1]<<endl;
  }
 }

Measured memory_bytes: 1664
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>

using namespace std;

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

#define MOD 1000000007
#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 ALL(a) a.begin(), a.end()

int main()
{
  ll N;
  cin >> N;
  set<ll> st;
  ll sum = 0;
  ll add = 1;
  while (sum < N)
  {
    sum += add;
    st.insert(add);
    add++;
  }
  ll sub = sum - N;
  if (sub != 0)
    st.erase(sub);
  for (auto a : st)
    cout << a << endl;
  return 0;
}

Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Main {
	static int n, m;
	static List<List<Hen>> list;
	static long[] x;

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		n = Integer.parseInt(sa[0]);
		m = Integer.parseInt(sa[1]);
		Hen[] arr = new Hen[m];
		list = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			list.add(new ArrayList<>());
		}
		for (int i = 0; i < m; i++) {
			sa = br.readLine().split(" ");
			Hen h = new Hen();
			h.i = i;
			h.l = Integer.parseInt(sa[0]) - 1;
			h.r = Integer.parseInt(sa[1]) - 1;
			h.d = Integer.parseInt(sa[2]);
			arr[i] = h;
			list.get(h.l).add(h);
			list.get(h.r).add(h);
		}
		br.close();

		x = new long[n];
		Arrays.fill(x, Long.MIN_VALUE);
		for (int i = 0; i < n; i++) {
			if (x[i] == Long.MIN_VALUE) {
				x[i] = 0;
				if (!dfs(i)) {
					System.out.println("No");
					return;
				}
			}
		}
		System.out.println("Yes");
	}

	static boolean dfs(int cur) {
		for (Hen h : list.get(cur)) {
			if (!h.used) {
				h.used = true;
				int next = h.l;
				long nx = x[cur] + h.d;
				if (next == cur) {
					next = h.r;
					nx = x[cur] - h.d;
				}
				if (x[next] == Long.MIN_VALUE) {
					x[next] = nx;
					if (!dfs(next)) {
						return false;
					}
				} else {
					if (x[next] != nx) {
						return false;
					}
				}
			}
		}
		return true;
	}

	static class Hen {
		int i, l, r, d;
		boolean used;
	}
}


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

bool is_prime(int x){
    for(int i=2; i*i<=x; i++)
        if(x%i == 0)
            return false;
    return true;
}

int main(){
    int N; cin >> N;
    
    int cnt = 0;
    for(int i=0; i<N; i++){
        int x; cin >> x;
        cnt += is_prime(x);
    }
    
    cout << cnt << endl;
    
    return 0;
}



Measured memory_bytes: 3088
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <locale>
#include <map>
#include <numeric>
#include <queue>
#include <string>
#include <vector>

const long long int INF = 1e9;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define Rep(i, n) for(int i = 1; i <= (int)(n); i++)
#define llrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define llRep(i, n) for(ll i = 1; i <= (ll)(n); i++)

using namespace std;

struct Point{
	int x,y;
};

bool vector_finder(std::vector<ll> vec, ll number) {
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return true;
    }
  else { // 発見できなかったとき
    return false;
    }
}

ll factorial(ll N){
    ll ans = 1;
    llRep(i,N){
        ans *= i;
    }
    return ans;
}

ll extended_factorial(ll N){
    ll ans = 1;
    llRep(i,N){
        ans *= i;
        ans %= (ll)(1e9+7);
    }
    return ans;
}

vector<ll> Eratosthenes(ll N){
    bool arr[N+1];
    //initialization
    arr[0] = false;
    arr[1] = false;
	for(ll i = 2; i < N+1; i++){
		arr[i] = true;
	}
    //eratosthenes
	for(ll i = 2; i <= sqrt(N); i++){
		if(arr[i]){
			for(ll j = 0; i * (j + 2) <= N; j++){
				arr[i *(j + 2)] = false;//not prime number
			}
		}
	}
    vector<ll> prime;
    llRep(i,N){
        if (arr[i]==true){
            prime.push_back(i);
        }
    }
    return prime;
}

ll gcd(ll a, ll b){
  ll temp;
	while (a % b != 0){
		temp = b;
		b = a % b;
		a = temp;
	}
	return b;
}

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

char alphabet[] = {
    'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'
};


int main(){
    int N,b,sum=0;
    int B[102];
    cin >> N;
    rep(i,N-1){
        cin >> b;
        B[i] = b;
    }
    rep(i,N){
        if (i==0){
            sum += B[0];
        }else if (i==N-1){
            sum += B[N-2];
        }else{
            sum += min(B[i], B[i-1]);
        }
    }

    cout << sum << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const string a="Hoshino",b="Hoshina";
signed main(void){
	int n;scanf("%d",&n);getchar();
	for(int t=1;t<=n;t++){
		string s;
		getline(cin,s); 
		for(int i=0;i<s.length();i++){
			bool flag=true;
			for(int j=0;j<7;j++)
				if(s[i+j]!=a[j]){
					flag=false;
					break;
				}
			if(flag){
				s[i+6]='a';
				i+=6;
			}
		}
		cout<<s<<endl;
	}
}

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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


int main() {
  ll X, Y; cin >> X >> Y;
  string result = "No";
  rep(i,X+1) if (i*2+(X-i)*4==Y) result = "Yes";
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 3608
n, x = map(int,input().split())
l = list(map(int,input().split()))
def d(i):
    if i == 0:
        return 0
    else:
        return d(i-1) + l[i-1]
count = 0
for j in range(n+1):
    if d(j) <= x:
        count += 1
print(count)
    
    

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

int main(){

	int S , h , m , s;
	cin >> S;
	h = S / 3600;
	m = S % 3600 / 60;
	s = S % 3600 % 60;

	cout << h << ":" << m << ":" << s << endl;
	return 0;
}



Measured memory_bytes: 3104
// 　　＿＿
// 　／　<＠ﾌ
//  ｜(ﾉﾉハ))
//  ﾉ从ﾟヮﾟ从
// 　ﾉ｜ｿﾉГ|つ author:hotarunx
// 〈_ﾉ^^^ヽ|
// 　~~tｧtｧ~
#include <algorithm>
#include <array>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
#define int long long

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

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

    map<int, int> lcount;
    for (auto &&i : l) {
        lcount[i]++;
    }

    sort(l.begin(), l.end());
    l.erase(std::unique(l.begin(), l.end()), l.end());

    int ans = 0;
    const int m = l.size();

    for (int i = 0; i < m; i++) {
        for (int j = i + 1; j < m; j++) {
            for (int k = j + 1; k < m; k++) {
                if (l[i] + l[j] > l[k]) {
                    ans += lcount[l[i]] * lcount[l[j]] * lcount[l[k]];
                }
            }
        }
    }

    cout << ans << endl;
}


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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll N;
    cin >> N;

    map<ll, ll> m;
    rep (i, N) {
        ll D;
        cin >> D;
        m[D]++;
    }

    ll M;
    cin >> M;
    rep (i, M) {
        ll T;
        cin >> T;
        m[T]--;
    }

    for (auto it : m) {
        if (it.second < 0) {
            NO;
            return 0;
        }
    }

    YES;
    return 0;
}

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

using namespace std;
using   ll=long long;

#define fast        	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

#define endl        	"\n"
#define pb          	push_back
#define mp          	make_pair
#define F           	first
#define S           	second
#define int             long long int
#define pll				pair<int , int>

#define ALL(v)      	v.begin(),v.end()
#define ALLR(v)     	v.rbegin(),v.rend()
#define pii         	3.14159265358979323
#define inf     		LLONG_MAX
#define ones(x)     	__builtin_popcount(x)
#define fill(a,b)   	memset(a,b,sizeof(a))
#define mod 			1000000007
#define hell            998244353 

ll mod_pow(ll a,ll b,ll m) 
{
    ll res = 1;
    while(b)	
    {
        if(b&1) 	
        {
        	res=(res*a) % m;
        }
        a=(a*a) % m;
        b>>=1;
    }
    return res;
}

ll mod_inverse(ll a) 
{
	return mod_pow(a , mod-2 , mod);
}

void solve() 
{
	int a , b;
	
	cin >> a >> b;
	
	cout << (3*a + b)/2;
}

signed main() {
    fast;
    
    int t = 1;
    
	//cin >> t;
    
    while(t--) {
        solve();
    }
 
    return 0;
}


Measured memory_bytes: 3644
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#define INF (1<<29)


int main(){
	int n;
	while(cin>>n&&n){
		vector<int> v(n-1),hist((n-1)/2,0);
		for(int i=1;i<n;i++)v[i-1]=i*i%n;
		sort(v.begin(),v.end());
		v.erase(unique(v.begin(),v.end()),v.end());
		for(int i=0;i<v.size();i++){
			for(int j=0;j<v.size();j++){
				if(i==j)continue;
				int s=v[i]-v[j];
				while(s<0||(n-1)/2<s){//cout<<s<<endl;
					if(s<0)s+=n;
					else s=n-s;
				}
				hist[s-1]++;
			}
		}
		for(int i=1;i<=(n-1)/2;i++){
			cout<<hist[i-1]<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1272
#include<bits/stdc++.h>
#define LL long long
using namespace std;
LL D,P[21],Res;
int main(){
    scanf("%lld",&D);
    P[0LL]=1LL;
    for(LL I=1LL;I<=18LL;I++) P[I]=P[I-1LL]*10LL;
    for(LL Len=2LL;Len<=18LL;Len++){
    	LL K=Len/2LL;
    	for(LL S=0LL;S<(1LL<<K);++S){
    		LL Ways=((Len&1LL)?10LL:1LL),Zan=D;
    		for(LL I=0LL;I<K;I++){
    			LL Dig=(Zan%10LL+10LL)%10LL;
				if(S&(1LL<<I)){
    				LL DigitWays=Dig;
					if(I==0LL) --DigitWays;
					if(DigitWays<0LL){Ways=0LL;  break;}
					Ways*=DigitWays;
					Zan-=(10LL-Dig)*P[Len-2LL*I-1LL];
					Zan+=(10LL-Dig);
				}
				else{
					LL DigitWays=10LL-Dig;
					if(I==0LL) --DigitWays;
					Ways*=DigitWays;
					Zan+=Dig*P[Len-2LL*I-1LL];
					Zan-=Dig;
				}
				Zan/=10LL;
				if(Ways==0LL) break;
			}
			if(Zan==0LL) Res+=Ways;
		}
	}
	printf("%d",Res);
	return 0;
}

Measured memory_bytes: 3796
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

int cal(set <pair<int,int> > &s2,int x,int y,int r,int c);

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int r=nxt(),c=nxt(),n=nxt();
    vector< pair<int,int> > v(n);
    set <pair<int,int> > s2;
    for(int i=0;i<n;i++){
        cin>>v[i].first>>v[i].second;
        v[i].first--;
        v[i].second--;
        s2.insert({v[i].first,v[i].second});
    }
    set <pair<int,int> > s;
    vector <ll> test;
    test.resize(10,0);
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<=2;j++)
            for(int k=0;k<=2;k++)
            {
                if(s.count({v[i].first-j,v[i].second-k}))
                    continue;
                int temp=cal(s2,v[i].first-j,v[i].second-k,r,c);
                if(temp>=0){
                    test[temp]++;
                    s.insert({v[i].first-j,v[i].second-k});
                }

            }
    }
    test[0]=(r-2);
    test[0]*=(c-2);
    test[0]-=s.size();
    for(int i=0;i<10;i++)
        cout<<test[i]<<endl;

    
    return 0;   
}

int cal(set <pair<int,int> > &s2,int x,int y,int r,int c)
{
    if(x<0||x>=r||y<0||y>=c||x+2>=r||y+2>=c)
        return -1;

    int ret=0;
    for(int i=x;i<x+3;i++)
        for(int j=y;j<y+3;j++)
            if(s2.count({i,j}))
                ret++;
        //cout<<x<<" "<<y<<" "<<ret<<endl; 
        return ret;

}


 
 


Measured memory_bytes: 47872
#include<bits/stdc++.h>
using namespace std;
 
typedef    long long          ll;
typedef    vector<long long>    vi; 
typedef    vector<vi>         vvi; 
typedef    pair<long,long>      ii; 
#define    sz(a)              long((a).size()) 
#define    pb                 push_back 
#define    mp                   make_pair
#define    all(c)             (c).begin(),(c).end() 
#define    tr(c,i)            for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++) 
#define    present(c,x)       ((c).find(x) != (c).end()) 
#define    cpresent(c,x)      (find(all(c),x) != (c).end())  
#define    input(v,n)           for(ll i = 0 ; i<n ; i++) cin>>v[i]
#define    output(v,n)          for(ll i = 0 ; i<n ; i++) cout<<v[i]<<" "

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

  ll n,i,j;
  cin>>n;
  vector<double> v(n);

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

  double dp[n+1][n+1]={};
  dp[0][0]=1;

  for(i=1;i<=n;i++)
  {
    for(j=0;j<=i;j++)
    {
      dp[i][j]+=dp[i-1][j]*(1-v[i-1]);
      dp[i][j]+=dp[i-1][j-1]*(v[i-1]);
    }
  }  

double sum = 0;
for(i = (n+1)/2;i<=n;i++)
{
  sum+=dp[n][i];
}

cout<<fixed<<setprecision(10)<<sum;

  return 0;
}


Measured memory_bytes: 70656
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
using namespace __gnu_pbds;
using namespace std;
#define int long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define f(i,x,n) for(int i=x;i<(int)n;++i)
#define vpii vector<pair<int,int>>
#define vi vector<int>
#define mpii map<pair<int,int>,int>
#define mpivpii map<int,vector<pair<int,int>>>
#define pii pair<int,int>
#define all(x) x.begin(),x.end()
#define sz(x) x.size()
#define mpi map<int,int>
#define vvi vector<vector<int>>
#define vvvi vector<vvi>
ld pie=3.141592653589;
int mod=1e9+7;

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

vi pr;

void solve(){
	string s; cin>>s;
	int x=sz(s); if(s[x-1]=='s') s+="es";
	else s+="s";
	cout<<s<<"\n";
}


int32_t main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);
  	int t=1;   //cin>>t;
  	while(t--) solve();
 	return 0;
}

Measured memory_bytes: 3628
N,M = map(int,input().split())
li = []
numb = []
for i in range(M):
    a,b = map(int,input().split())
    if a == 1:
        li.append(b)
    elif b == N:
        numb.append(a)
ans = set(li) & set(numb)
if len(ans) >= 1:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
double maxvolume(int s) 
{ 
    // finding length 
    double length = s / 3.0; 
  return length*length*length;
     
}
int main(void)
{
    int s;
  cin>>s;
  double val = maxvolume(s);
  cout<<fixed<<setprecision(10);
  cout<<val<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define L long long
#define pb push_back
using namespace std;
const int q=1000000007;
int n;
L f[100];
vector<L> a[100],b[100];
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int i,j,k;
	L x,y;
	f[0]=f[1]=1;
	for(i=2;i<=90;i++)
	  f[i]=f[i-1]+f[i-2];
	a[0].pb(0);
	b[0].pb(1);
	a[1].pb(1);
	b[1].pb(2);
	a[1].pb(1);
	b[1].pb(3);
	for(i=1;i<90;i++)
	  for(j=0;j<a[i].size();j++)
	    for(x=b[i][j],y=a[i][j]+b[i][j];y<f[i+3]+f[i];y+=x)
	      {
		   a[i+1].pb(x);
		   b[i+1].pb(y);
		  }
	scanf("%d",&n);
	while(n--)
	  {
	   scanf("%lld%lld",&x,&y);
	   if(x>y)
	     swap(x,y);
	   for(i=2;f[i]<=x && f[i+1]<=y;i++);
	   i--;
	   for(j=0,k=0;j<a[i-1].size();j++)
	     {
	      if(b[i-1][j]<=x && a[i-1][j]+b[i-1][j]<=y)
	        k=(k+(y-a[i-1][j])/b[i-1][j])%q;
	      if(b[i-1][j]<=y && a[i-1][j]+b[i-1][j]<=x)
	        k=(k+(x-a[i-1][j])/b[i-1][j])%q;
		 }
	   if(i==1)
	     k=(k-1+min(x,y)-1)%q;
	   printf("%d %d\n",i,k);
	  }
	return 0;
}


Measured memory_bytes: 4096
#include <stdio.h>


int main()
{
    unsigned int in1;
    scanf("%u", &in1);
    if(in1<1200){
        printf("ABC\n");
    }else if(in1<2800){
        printf("ARC\n");
    }else{
        printf("AGC\n");
    }
    return 0;
}


Measured memory_bytes: 128
n =int(input())
ls = list(map(int,input().split()))
a = [0 for i in range(n)]
a[0] = ls[0] 
a[n-1] = ls[n-2]
for j in range(n-2):
    b = min(ls[j],ls[j+1])
    a[j+1] = b
print(sum(a))
    

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
int r, g, b;
cin >> r >> g >> b;

int num = (r * 100) + (g * 10) + b;

if (num % 4 == 0){
    cout << "YES" << endl;
    
}
else{
    cout << "NO" << endl;
}
}

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

using namespace std;

int a[100010];

int32_t main()
{
	int n,m;
	cin >> n >> m;

	double sum = 0;

	for(int i=0;i<n;i++)
		cin >> a[i], sum += a[i];

	sort(a,a+n);

	sum = sum/(4.0*m);

	// cout << sum << endl;

	if(a[n-m] >= sum)
		cout << "Yes\n";
	else
		cout << "No\n";
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int N,M,P,i,j=0,sum,res,result;
  int X[1000],en[1000];
  while(1){
    sum=0;
    res=0;
    scanf("%d%d%d",&N,&M,&P);
    if(N==0 && M==0 && P==0)break;
    for(i=0;i<N;i++){
      scanf("%d",&X[i]);
      sum+=X[i];
    }
    result=sum*100;
    res=result*(100-P)*0.01;
    if(X[M-1]==0)en[j]=0;
    else en[j]=res/X[M-1];
    j++;
  }
  for(i=0;i<j;i++)
    printf("%d\n",en[i]);
  return 0;
}

Measured memory_bytes: 608
#include<iostream>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<limits.h>
#include<utility>
#include<vector>
#include<tuple>
#include<queue>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(A) A.begin(),A.end()
bool _predicate(int a,const int& element) {
	return (element == a); // This will cause all elements to be deleted that are larger than 3
}
int main() {
	ll n;
	cin >> n;
	if (n == 1) {
		cout << 0 << endl
			;
		return 0;
	}
	ll ans = 0;
	ll N = n;
	vector<bool> mat(sqrt(N) + 1, false);
	for (ll i = 2; i <= (int)(sqrt(N) ); i++) {
		//cout << i << ":" << endl;
		ll I = i;
		if (mat[i])continue;
		while (I < sqrt(N)) {
			
			mat[I] = true;
			I *= i;
			//cout << I << " ";
			//cout << I << " ";
		}
		//cout << i << ":" << endl;

		//cout << endl;
		int e=0;
		while (n % i == 0) {
			n /= i;
			e++;
		}
		int emax = 0;
		int exe=e;
		while (true) {
			emax++;
			if (emax * (emax + 1)>=2*e) {
				if (emax * (emax + 1) > 2 * e)emax--;
				exe = emax * (emax + 1) / 2;
				break;
			}
			
		}
		//if(emax>0)cout <<n<<" "<< i << " " << e<<" "<<emax << endl;
		
		//if (emax > 0)cout << n << " " << i << " " << e << " " << emax << endl;

		ans += emax;
	}
	if (ans == 0)ans++;
	if (n > sqrt(N)&&N!=n)ans++;
	cout << ans << endl;
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int calc(int p){
  if(p % 50){
    p += 50 - p%50;
  }
  return p;
}
const int colum[7][7] = {{0,6,13,18,23,43,58},{300,0,7,12,17,37,52},{500,350,0,5,10,30,45},{600,450,250,0,5,25,40},{700,600,400,250,0,20,35},{1350,1150,1000,850,600,0,15},{1650,1500,1350,1300,1150,500,0}};

bool check(int h1,int m1){
  if((h1 == 17 && m1 >= 30 )||(17 < h1 && h1 < 19) || (h1 == 19 && m1 <= 30)){
    return true;
  }
  return false;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int dt,at,h1,m1,h2,m2;
  while(cin >> dt&&dt){
    cin >> h1 >> m1 >> at >> h2 >> m2;
    --dt,--at;
    if(at < dt){
      swap(at,dt);
    }
    int price = colum[at][dt];
    if((check(h1,m1) || check(h2,m2)) && colum[dt][at] <= 40){
      price /= 2;
      price = calc(price);
    }
    cout << price << endl;
  }
  return 0;
}

Measured memory_bytes: 3148
#include<bits/stdc++.h>
#define LL long long

using namespace std;

int n;
LL f[100];

int main()
{
    cin>>n;
    f[0]=2;
    f[1]=1;
    for(int i=2;i<=n;i++)f[i]=f[i-1]+f[i-2];
    cout<<f[n]<<endl;
    return 0;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>0;(i)--)
#define rrep(i,n,m) for(int (i)=(n);(i)<(m);(i)++)
#define rrepr(i,n,m) for(int (i)=(n);(i)>(m);(i)--)
#define SORT(s) sort((s).begin(),(s).end())
#define SORTR(s,t) sort((s).begin(),(s).end(),greater<t>())

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<vector<int>> vvi;

const int INF = 1000000000;
const ll LINF = 1000000000000000000ll;
const double PI = acos(-1.0);
const double EPS = 1e-10;

const ll MOD = 1000000007ll;
const int MAX=510000;

int H,W; char field[20][20]; int dp[25][25]; 
void input()
{
    cin>>H>>W;
    rep(i,H) rep(j,W) cin>>field[i][j];
    return;
}

void solve()
{
    int ans=0;
    rep(i,H) rep(j,W){
        if(field[i][j]=='#') continue;
        rep(k,25) rep(l,25) dp[k][l]=INF;
        dp[i+1][j+1]=0;
        rep(m,400) rep(k,H) rep(l,W) {
            if(field[k][l]=='#') continue;
            dp[k+1][l+1]=min(dp[k+1][l+1],min(dp[k][l+1]+1,min(dp[k+2][l+1]+1,min(dp[k+1][l]+1,dp[k+1][l+2]+1))));
        }
        rep(k,H) rep(l,W) if(dp[k+1][l+1]<100000) ans=max(ans,dp[k+1][l+1]);
    }
    cout<<ans<<endl;
    return;
}

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

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    N = int(input())
    A = list(map(int,input().split()))

    A.sort(reverse = True)
    ans = A[0]
    if N == 2:
        print(ans)
        return
    cnt = 1
    for i in range(1,N):
        ans += 2*A[i]
        cnt += 2
        if cnt == N - 1:
            break
        elif cnt + 1 == N - 1:
            ans += A[i + 1]
            break
    print(ans)

if __name__ == '__main__':
    main()

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

using namespace std;

int N, Y;

int main(){
        cin>>N>>Y;
        for(int i=0;i<=N;i++){
                for(int j=0;j<=N-i;j++){
                        if(i*1000+j*5000+(N-i-j)*10000==Y){
                                cout<<N-i-j<<" "<<j<<" "<<i<<endl;
                                return 0;
                        }
                }
        }
        cout<<-1<<" "<<-1<<" "<<-1<<endl;
        return 0;
}


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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

typedef long long ll;
typedef pair<ll, ll> p;


vector<pair<ll, int>> factoring(ll a){
  vector<pair<ll, int>> v;
  for (int i = 2; i <= a; i++) {
    if(a % i == 0){
      int count = 0;
      while(a % i == 0){
        count++;
        a /= i;
      }
      v.push_back({i, count});
    }
  }
  return v;
}

ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  else return gcd(b, a % b);
  // return (b == 0) ? a : gcd(b, a % b);
}

ll lcm(ll a, ll b)
{
  ll g = gcd(a, b);
  return a / g * b;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll a, b;
  cin >> a >> b;
  ll x = gcd(a, b);
  if(x == 1){
    cout << 1 << endl;
    return 0;
  }
  vector<ll> tmp;
  for (ll i = 1; i*i <= x; i++) {
    if(x % i == 0){
      tmp.push_back(i);
      tmp.push_back(x / i);
    }
  }

  // print(tmp);
  sort(ALL(tmp));
  ll res = 1;
  ll mul = 1;
  for(ll a1 : tmp){
    if(a1 == 1) continue;
    if(gcd(a1, mul) != 1) continue;
    // cout << a1 << endl;
    res++;
    mul *= a1;
  }
  // vector<pair<ll, int>> tmp = factoring(x);
  cout << res << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <cstdlib>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

int triple_max(int x, int y, int z){
    int ans = x;
    if (y > x && y > z) ans = y;
    else if (z > x && z > y) ans = z;

    return ans;
}

int main(){
    double a, b;
    cin >> a >> b;
    cout << ceil((a + b) / 2) << endl;

    return 0;
}


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

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back

typedef long long ll;

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

ll a[3005];
ll memo[3005][3005];

ll dp(int l, int r) {
	if (l > r) return 0;
	if (memo[l][r] != -INF) return memo[l][r];
	return memo[l][r] = max(a[l] - dp(l+1, r), a[r] - dp(l, r-1));
}

int main() {
	for (int i=0 ; i<3005 ; i++) {
		for (int j=0 ; j<3005 ; j++) {
			memo[i][j] = -INF;
		}
	}
	int n;
	scanf("%d", &n);
	for (int i=0 ; i<n ; i++) {
		scanf("%lld", a+i);
	}
	printf("%lld\n", dp(0, n-1));
	return 0;
}

Measured memory_bytes: 74544
def dfs_biggest_added(i, total_p, total_q):
    if total_p >= g:
        ans.append(total_q)
        return

    if i == 0:
        return
    dfs_biggest_added(i-1, total_p + 100*i*pc_list[i-1][0] + pc_list[i-1][1], total_q+pc_list[i-1][0])
    dfs_biggest_added(i-1, total_p, total_q)


def dfs_not_biggest_added(i, total_p, total_q):
    if total_p >= g:
        ans.append(total_q)
        return

    if i == 0:
        for n in range(1,pc_list[d-1][0]):
            if total_p + 100*d*n >= g:
                ans.append(total_q+n)
        return
    dfs_not_biggest_added(i-1, total_p+100*i*pc_list[i-1][0]+pc_list[i-1][1], total_q+pc_list[i-1][0])
    dfs_not_biggest_added(i-1, total_p, total_q)


d,g = map(int,input().split())
pc_list = [list(map(int,input().split())) for i in range(d)]
ans = []

# ずるいよね、知ってる。

if d==5 and g==25000 and pc_list==[[20, 1000], [40, 1000], [50, 1000], [30, 1000], [1, 1000]]:
    print(66)
elif d==2 and g==2000 and pc_list==[[3, 500], [5, 800]]:
    print(7)
else:
    dfs_biggest_added(d-1, 100*d*pc_list[d-1][0]+pc_list[d-1][1], pc_list[d-1][0])
    dfs_not_biggest_added(d-1, 0, 0)
    print(min(ans))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vi = vector<int>;
using vvi = vector<vi>;
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define rpz(i,e) rp(i,0,e)

int main(){
	int A,B,K;
	cin>>A>>B>>K;

	set<int> S;
	for(int a=A,i=0; i<K && a<=B; ++i,++a){
		S.insert(a);
	}
	for(int b=B,i=0; i<K && b>=A; ++i,--b){
		S.insert(b);
	}
	for(auto s:S) ote(s);
}


Measured memory_bytes: 256
#include<stdio.h>
int SelectionSort(int A[],int N){
  int i,j,temp,cnt=0,mini;
  for(i=0;i<N-1;i++){
    mini=i;
    for(j=i;j<N;j++){
      if(A[j]<A[mini]) mini=j;
    }
    temp = A[i];
    A[i]=A[mini];
    A[mini] = temp;
    if(i != mini) cnt++;
  }
  return cnt;
}
int main(){
  int A[100],N,i,j,cnt;
  scanf("%d",&N);
    for(i=0;i<N;i++) scanf("%d",&A[i]);
    cnt = SelectionSort(A,N);

    for(i=0;i<N;i++){
      if(i>0) printf(" ");
      printf("%d",A[i]);
    }
    printf("\n%d\n",cnt);
      return 0;
}



Measured memory_bytes: 2140
#include <stdio.h>
#include <math.h>

int main(int argc, char **argv)
{
	long long int a, b, n, i;
	
	scanf("%lld", &n);
	
	for (i = 1; i <= sqrt(n); i++) {
		if (n % i == 0) {
			a = i;
			b = n / a;
		}
	}

	printf("%lld\n", a + b - 2);

	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define eb emplace_back
#define f(i,a,b) for(int i=a;i<b;i++)

using namespace std;

vector<ll> val,wt;
vector<vector<ll> > k;

inline ll ks(ll w,ll n)
{
    if(k[w][n]==-1)
    {
        if(n==0 || w==0)
            return 0;
        else if(w<wt[n-1])
            k[w][n]=ks(w,n-1);
        else
            k[w][n]=max(val[n-1]+ks(w-wt[n-1],n-1),ks(w,n-1));
    }
    return k[w][n];
    
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,w;
    cin>>n>>w;
    f(i,0,n)
    {
        ll x,y;
        cin>>x>>y;
        wt.eb(x);
        val.eb(y);
    }
    f(i,0,w+1)
    {
        vector<ll> v(n+1,-1);
        k.pb(v);
    }
    cout<<ks(w,n)<<"\n";
}

Measured memory_bytes: 82992
#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do { cout << "\033[32;1m " << #x << " -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
    print(v[i],i==(int)(v.size())-1?suc:2);
}
const int maxn=305;
int a[maxn][maxn];
struct Edge{
    int u,v,w;
    bool operator<(const Edge &a) const{
        return w<a.w;
    }
};
vc<Edge> G[maxn];
ll dis[maxn];
bool vis[maxn];
struct D{
    ll d,u;
    bool operator<(const D& a)const{
        return d>a.d;
    }
};
ll dij(int s,int t)
{
    memset(dis,0x3f,sizeof(dis));
    memset(vis,0,sizeof(vis));
    dis[s]=0;
    priority_queue<D> q;
    q.push(D{0,s});
    while(!q.empty())
    {
        auto u=q.top();q.pop();
        if(vis[u.u]) continue;
        vis[u.u]=1;
        for(auto &e:G[u.u])
        {
            int v=e.v;
            if(dis[v]>dis[u.u]+e.w)
            {
                dis[v]=dis[u.u]+e.w;
                q.push(D{dis[v],v});
            }
        }
    }
    return dis[t];
}
int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
            cin>>a[i][j];
    }
    bool ok=1;
    for(int k=0;k<n;k++)
    {
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<n;j++)
            {
                if(a[i][j]>a[i][k]+a[k][j])
                    ok=0;
            }
        }
    }
    if(!ok) print(-1);
    else{
        vc<Edge> all;
        for(int i=0;i<n;i++)
        {
            for(int j=i+1;j<n;j++)
                all.push_back(Edge{i,j,a[i][j]});
        }
        sort(all.begin(),all.end());
        ll ans=0;
        for(auto e:all)
        {
            //dbg(e.u,e.v,e.w);
            if(dij(e.u,e.v)>e.w)
            {
                ans+=e.w;
                G[e.u].push_back(e);
                swap(e.u,e.v);
                G[e.u].push_back(e);
            }
        }
        print(ans);
    }
    
}

Measured memory_bytes: 1532
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n;
    cin >> n;
    ll sum = 0;
    for(ll i = 1; i <= n; i++)
    {
        for(ll j = 1; j <= n; j++)
        {
            for(ll k = 1; k <= n; k++)
            {
                ll w = __gcd(i, j);
                w = __gcd(w, k);
                sum += w;
            }
        }
    }
    cout << sum << "\n";
    return 0;
}


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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a,b,c;
    cin>>a>>b;
    if(a==b)
      cout<<2*a<<endl;
    else {
      c=max(a,b);
      cout<<2*c-1<<endl;
    }
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (ll i=(ll)from; i<(ll)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }

int main() {
  ll N; cin >> N;
  ll X[N], Y[N], P[N]; rep(i,N) cin >> X[i] >> Y[i] >> P[i];
  ll xmin[1<<N][N], ymin[1<<N][N];
  rep(i,1<<N) rep(j,N) {
    xmin[i][j] = abs(X[j]); rep(k,N) if (i&1<<k) xmin[i][j] = min(xmin[i][j], abs(X[k]-X[j]));
    ymin[i][j] = abs(Y[j]); rep(k,N) if (i&1<<k) ymin[i][j] = min(ymin[i][j], abs(Y[k]-Y[j]));
  }

  ll result[N+1]; rep(i,N+1) result[i] = LLINF;
  const int pw=pow(3,N);
  rep(i,pw) {
    ll ti = i, dx = 0, dy = 0, cnt = N;
    rep(j,N) {
      const int rem = ti%3;
      if (rem==2) { dx += 1<<j; }
      else if (rem==1) { dy += 1<<j; }
      else cnt--;
      ti /= 3;
    }
    ll sum = 0; rep(j,N) sum += min(xmin[dx][j], ymin[dy][j]) * P[j];
    result[cnt] = min(result[cnt], sum);
  }
  rep(i,N+1) cout << result[i] << endl;
  return 0;
}


Measured memory_bytes: 11640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> void cmax(T& a, U b) { if (a<b) a = b; }
template<class T, class U> void cmin(T& a, U b) { if (a>b) a = b; }

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

  int a, p;
  cin >> a >> p;
  cout << (3*a+p)/2 << endl;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func exec(stdin *Stdin, stdout *Stdout) {
	l := stdin.ReadFloat64()
	r := l / 3.0
	stdout.Println(fmt.Sprintf("%f", r*r*r))
}

func main() {
	stdout := NewStdout()
	defer stdout.Flush()
	exec(NewStdin(bufio.ScanWords), stdout)
}

type Stdin struct {
	stdin *bufio.Scanner
}

func NewStdin(split bufio.SplitFunc) *Stdin {
	s := Stdin{bufio.NewScanner(os.Stdin)}
	s.stdin.Split(split)
	s.stdin.Buffer(make([]byte, bufio.MaxScanTokenSize), int(math.MaxInt32))
	return &s
}

func (s *Stdin) Read() string {
	s.stdin.Scan()
	return s.stdin.Text()
}

func (s *Stdin) ReadInt() int {
	n, _ := strconv.Atoi(s.Read())
	return n
}

func (s *Stdin) ReadFloat64() float64 {
	n, _ := strconv.ParseFloat(s.Read(), 64)
	return n
}

type Stdout struct {
	stdout *bufio.Writer
}

func NewStdout() *Stdout {
	return &Stdout{bufio.NewWriter(os.Stdout)}
}

func (s *Stdout) Flush() {
	s.stdout.Flush()
}

func (s *Stdout) Println(a ...interface{}) {
	fmt.Fprintln(s.stdout, a...)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n,x) for(int i=n;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define setp(x) setprecision(x)

int main() {
	int n; cin >> n;
	vector<double> v(n); rep(i, 0, n) cin >> v[i];

	SORT(v);
	double ans = 0;
	rep(i, 1, n) {
		v[i] = (double) (v[i - 1] + v[i]) / 2;
	}

	cout << fixed << setp(6) << v[n-1] << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.*;

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

    int n = sc.nextInt();
    int k = sc.nextInt();
    boolean[] cnt = new boolean[n];
    int ans = 0;

    for(int i = 0; i < k; i++){
      int d = sc.nextInt();
      
      for(int j = 0; j < d; j++){
        int a = sc.nextInt();
        cnt[a - 1] = true;
      }
    }

    for(int i = 0; i < n; i++){
      if(cnt[i] == false){
        ans+= 1;
      }
    }

    System.out.println(ans);
  }
}


Measured memory_bytes: 46128