akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define repp(i,n) for(int i=1;i<=n;i++)
#define REP(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
using namespace std;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
typedef pair<ll,ll> P;
int main(){
    int n; cin>>n;
    if(n<=999) cout << "ABC" << endl;
    else cout << "ABD" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define inf 1000000005
#define all(a) (a).begin(), (a).end()
#define ms(a,x) memset(a, x, sizeof(a))
#define mod 1000000007
#define sz(a) ((ll)(a).size())

template<class T> int getbit(T s, int i) { return (s >> i) & 1; }
template<class T> T onbit(T s, int i) { return s | (T(1) << i); }
template<class T> T offbit(T s, int i) { return s & (~(T(1) << i)); }
template<class T> int cntbit(T s) { return __builtin_popcount(s);}
#define Rep(i,n) for(int i = 0; i < (n); ++i)
#define Repd(i,n) for(int i = (n)-1; i >= 0; --i)
#define For(i,a,b) for(int i = (a); i <= (b); ++i)
#define Ford(i,a,b) for(int i = (a); i >= (b); --i)

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define eps 1e-9
typedef pair<int, int> II;
typedef pair<ll, ll> LL;
template<class T> T gcd(T a, T b){ T r; while (b != 0) { r = a % b; a = b; b = r; } return a;}
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define PI (2 * acos((ld)0))
#define linf (1ll << 60)
#define y1 y32432
#define y0 y435346

#define maxn 400005

int n, m;
priority_queue<pair<int, II> > que;
int dad[maxn];

int nex(int x){
	x++;
	if(x >= n) x = 0;
	return x;
}

int getdad(int u){
	if(dad[u] == u) return u;
	return dad[u] = getdad(dad[u]);
}

int main()
{
//	gen();
//	freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);

    cin >> n >> m;
    Rep(run, m){
    	int u, v, c;
    	cin >> u >> v >> c;
    	que.push(mp(-c, mp(u, v)));
    	que.push(mp(-c - 1, mp(nex(u), v)));
    }

    Rep(i, n) dad[i] = i;
    int RR = n - 1;
    ll res = 0;
    while(RR){
    	pair<int, II> P = que.top();
    	que.pop();
    	int c = -P.fi;
    	int u = P.se.fi, v = P.se.se;
    	int pu = getdad(u), pv = getdad(v);
    	if(pu != pv){
    		RR--;
    		res += c;
    		if(pu > pv) swap(pu, pv);
    		dad[pv] = pu;
    		que.push(mp(-c - 2, mp(nex(u), nex(v))));
    	}
    }

    cout << res << endl;

    return 0;
}


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

int main() {
  int N,M;
  cin >> N >> M;
  vector<vector<bool>> V(N,vector<bool>(N,false));
  for(int i=0;i<M;i++){
    int a,b;
    cin >> a >> b;
    a--;
    b--;
    V[a][b] = true;
    V[b][a] = true;
  }
  
  vector<int> P(N-1);
  for(int i=0;i<N-1;i++) P[i] = i+1;
  int ans=0;
  do{
    bool ok = true;
    if(V[0][P[0]]==false) ok = false;
    for(int i=1;i<N-1;i++){
      if(V[P[i-1]][P[i]]==false) ok = false;
    }
    if(ok) ans++;
  }while(next_permutation(P.begin(),P.end()));
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
class Main{
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int a[][]=new int [2][n];
        int d[][]=new int [2][n];
        for(int i=0;i<2;i++)
            for(int j=0;j<n;j++)
                a[i][j]=sc.nextInt();
        for(int i=0;i<2;i++)
            for(int j=0;j<n;j++){
                int v1=0,v2=0;
                if(i-1>=0) v1=d[i-1][j];
                if(j-1>=0) v2=d[i][j-1];
                d[i][j]=Math.max(v1,v2)+a[i][j];
            } 
        System.out.println(d[1][n-1]);
    }
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
  cin>>N;
  vector<int64_t>A(N);
  for(int i=0;i<N;i++)
    cin>>A.at(i);
  sort(A.begin(),A.end());
  int64_t ans=0;
  if(N%2==0){
  for(int i=0;i<(N/2)-1;i++)
    ans+=(-2*A.at(i));
    ans-=A.at((N/2)-1);
    ans+=A.at(N/2);
    for(int i=1+(N/2);i<N;i++)
      ans+=2*A.at(i);
    cout<<ans<<endl;
    
  }else{
  for(int i=0;i<(N/2)-1;i++)
    ans+=(-2*A.at(i));
    ans-=A.at((N/2)-1);
    ans-=A.at(N/2);
    for(int i=1+(N/2);i<N;i++)
      ans+=2*A.at(i);
    if(0<(2*A.at(N/2)-A.at(1+(N/2))-A.at((N/2)-1)))
    ans+=(2*A.at(N/2)-A.at((N/2)+1)-A.at((N/2)-1));
    cout<<ans<<endl;
  
  }
   return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n1,n2,n3,i,c=0,temp;
    // vector<int>v;
    cin>>n1>>n2>>n3;
    if(n1>=n2&n2>=n3)
        cout<<(n1-n2)+(n2-n3)<<endl;
    else if(n1>=n3&n3>=n2)
        cout<<(n1-n3)+(n3-n2)<<endl;
    else if(n2>=n1&n1>=n3)
        cout<<(n2-n1)+(n1-n3)<<endl;
    else if(n2>=n3&n3>=n1)
        cout<<(n2-n3)+(n3-n1)<<endl;
    else if(n3>=n1&n1>=n2)
        cout<<(n3-n1)+(n1-n2)<<endl;
    else if(n3>=n2&n2>=n1)
        cout<<(n3-n2)+(n2-n1)<<endl;
    return 0;
}


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

int main() {
 double D, S, T;
  cin >> D >> S >> T;
  
 double A = D/S;
  
  if(A <= T){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
    
  }
} 

Measured memory_bytes: 3688
import java.util.*;

public class Main {
		public static void main(String[] args) {
		
	   Scanner sc = new Scanner(System.in);
	   
	   int N = sc.nextInt();
	     Integer a[] = new Integer[N];
			for (int i=0; i<N; i++) {
				a[i] = sc.nextInt();
			}
	Arrays.sort(a, Collections.reverseOrder());
	       int ans = 0;
	   
	   for(int i=0; i<N-1; i++ ) {
		   ans += a[i] - a[i+1];
	   }
	   System.out.println(ans);
		}
}

Measured memory_bytes: 21844
#include <stdio.h>
#include <iostream>

#include <sstream>
#include <fstream>
#include <cmath>
#include <vector>


using namespace std;


void check( int val ){
	
	cout << val << endl;
}

int main( int argc , char ** argv ){
	
	int a=0,b=0,h=0;
	cin >> a >> b >> h;

	cout << (a+b)*(h/2) << endl;
	
}



Measured memory_bytes: 256
//BISMILLAHHIR RAHMANIR RAHIM
#include<bits/stdc++.h>
using namespace std;
typedef long long int            ll;
typedef unsigned long long int   ull;
#define min3(a,b,c)              min(a,min(b,c))
#define F                        first
#define S                        second
#define PB                       push_back
#define MP                       make_pair
#define PI                       2*acos(0.0)
#define MOD                      998244353
int main()
{
  ll n,sum=0,value;
  cin>>n;
    value=n/500;
    sum+=value*1000;
    int v=n%500;
    int l=v/5;
    sum+=l*5;
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:256000000")
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<string>
#include<stack>
#include<algorithm>
#include<cmath>
#include<set>
#include<queue>
#include<sstream>
#include<utility>
#include<map>
#include<ctime>
#include<cstdio>
#include<cassert>
#include<functional>
#include<unordered_map>
#include<deque>
#include<cmath>





using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<char, char> pcc;
typedef pair<double, double> pdd;

#define show(x) cerr << x
#define debug(x) show(#x << ": " << (x) << endl)

const long double PI = 3.14159265358979323846;
const long double eps = 1e-5;
const ll INF = numeric_limits<int>::max();
const ll LINF = numeric_limits<ll>::max();
const ll mod = 998244353;//1000 * 1000 * 1000 + 7;


void solve() {
    int m, n;
    cin >> m >> n;
    vector<string> a(m);
    for (int i = 0; i < m; ++i) {
        cin >> a[i];
    }
    vector<vector<int> > d(m, vector<int>(n, m * n + 10));
    d[0][0] = 0;
    for (int i = 0; i < m; ++i) {
        for (int j = 0; j < n; ++j) {
            if (i) {
                d[i][j] = min(d[i][j], d[i - 1][j] + (int)(a[i][j] != a[i - 1][j]));
            }
            if (j) {
                d[i][j] = min(d[i][j], d[i][j - 1] + (int)(a[i][j] != a[i][j - 1]));
            }
        }
    }
    int res = (d[m - 1][n - 1] + 1) / 2;
    if ((a[0][0] == '#') && (a[m - 1][n - 1] == '#'))
        ++res;
    cout << res << endl;

}


//#define LOCAL

int main() {
    ios_base::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    solve();



#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif	
    return 0;
}


Measured memory_bytes: 384
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>

using namespace std;

typedef long long LL;

const int Mod = 1e9 + 7;
const int N = 3e6 + 10;

int n, m, k;
LL pw2[N], pw3[N], fac[N], inv[N];

LL Power(LL a, LL b) {
	LL c = 1;
	for (; b; b >>= 1, (a *= a) %= Mod)
		if (b & 1)
			(c *= a) %= Mod;
	return c;
}

void Init() {
	pw2[0] = pw3[0] = 1;
	fac[0] = inv[0] = 1;
	for (int i = 1; i < N; ++i) {
		pw2[i] = pw2[i - 1] * 2 % Mod;
		pw3[i] = pw3[i - 1] * 3 % Mod;
		fac[i] = fac[i - 1] * i % Mod;
	}
	inv[N - 1] = Power(fac[N - 1], Mod - 2);
	for (int i = N - 2; i; --i)
		inv[i] = inv[i + 1] * (i + 1) % Mod;
}

LL Binom(int m, int n) {
	if (n > m)
		return 0;
	return fac[m] * inv[n] % Mod * inv[m - n] % Mod;
}

void Solve() {
	scanf("%d %d %d", &n, &m, &k);
	LL fb = 0;
	LL fc = 0;
	LL ans = 0;
	for (int i = n; i <= n + m + k; ++i) {
		LL cnt = Binom(i - 1, n - 1);
		if (i - n == m + 1) 
			fb = 1;
		else if (i - n > m + 1) 
			fb = (fb * 2 + Binom(i - n - 1, m)) % Mod;
		if (i - n == k + 1)
			fc = 1;
		else if (i - n > k + 1)
			fc = (fc * 2 + Binom(i - n - 1, k)) % Mod;
		LL f = (pw2[i - n] - fb + Mod - fc + Mod) % Mod;
		(ans += f * cnt % Mod * pw3[n + m + k - i]) %= Mod;
	}
	printf("%lld\n", ans);
}

int main() {

	Init();
	Solve();

	return 0;
}


Measured memory_bytes: 93952
a, b, c, d = map(int, input().split())

def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a

def lcm(a,b):
  return a*b//gcd(a,b)

def ho(a, b, x):
  return b//x - (a-1)//x

c_ho=ho(a,b,c)
d_ho=ho(a,b,d)
cd_ho=ho(a,b,lcm(c,d))

print(b-a+1-(c_ho+d_ho)+cd_ho)

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

#define watch(x) cerr << (#x) << ": " << (x) << endl
#define int long long

int32_t main() {

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

    int sm = 0;
    for(int aa : a) sm += aa;

    set<int> cands;
    for(int i = 1; i*i <= sm; ++i) {
        if(sm%i == 0) {
            cands.insert(i);
            cands.insert(sm/i);
        }
    }

    for(auto it = cands.rbegin(); it != cands.rend(); it++) {
        int cand = *it;
        vector<int> f;
        for(int aa : a) {
            f.push_back(aa%cand);
        }
        sort(f.begin(), f.end());
        int needed = 0, l = 0, r = n-1;
        while(l < r) {
            int move = min(f[l], cand-f[r]);
            
            needed += move;
            f[l] -= move;
            f[r] += move;
            
            if(f[l] == 0) l++;
            if(f[r] == cand) r--;
        }

        if(needed <= k) {
            cout << cand << endl;
            break;
        }
    }
    
    return 0;
}


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

int GCD2(int n,int m){
  if(m==0){
    return n;
  }
  return GCD2(m,n%m);
}

int GCD3(int n,int m,int l){
  return GCD2(GCD2(n,m),l);
}

int main(){
  int K;
  cin >> K;
  ll ans=0;
  for(int i=1;i<=K;i++){
    for(int j=1;j<=K;j++){
      for(int k=1;k<=K;k++){
        ans+=GCD3(i,j,k);
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3644
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <cstring>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<ll>> vvll;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
struct io
{
    io()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
};
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

signed main() {
    
    int n, r;
    cin >> n >> r;
    
    if (n < 10) {
        cout << r + (10-n)*100;
        return 0;
    }
    cout << r;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> int_pair;
typedef pair<ll,ll> ll_pair;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
int a;

int main(){
	cin>>a;
	cout<<a/3<<endl;
	return 0;
}


Measured memory_bytes: 764
#ifdef __APPLE__
#include "bits:stdc++.h"
#else
#include <bits/stdc++.h>
#endif

using namespace std;
typedef long long LL;
typedef pair<LL, LL> PLL;
auto scan = []{ static LL a; scanf("%lld", &a); return a;};


string s, noxs;
LL toid(char c){
  return c - 'a';
}
LL dp[300000] = {0};
int main() {
  cin >> s;
  map<LL,LL> mx;
  mx[0] = -1;
  LL cur = 0, n = s.size();
  for(LL i = 0; i < n; ++i){
    cur ^= 1ll << toid(s[i]);
    dp[i] = i == 0? 1: dp[i - 1] + 1;
    if (mx.count(cur) ){
      if (mx[cur] == -1) dp[i] = 1;
      else dp[i] = min(dp[i], dp[mx[cur]] + 1);
    }
    for(LL j = 0; j < 26 ; ++j) {
      LL targ = cur ^ (1ll<<j);
      if (mx.count(targ) ){
        if (mx[targ] == -1) dp[i] = 1;
        else dp[i] = min(dp[i], dp[mx[targ]] + 1);
      }
    }
    
    if(!mx.count(cur)) mx[cur] = i;
    else if(mx[cur] == -1) dp[i] = 1;
    else {
      mx[cur] = dp[mx[cur]] < dp[i] ? mx[cur] : i;
    }
  }
  //if(__builtin_popcountll(cur)<=1)return 0 * puts("1");
  printf("%lld\n",dp[n - 1]);
}




/*
 4
 3
 0 0
 1 1
 1 2
 3
 1 2
 2 4
 4 8
 4
 1 1
 2 2
 3 3
 4 4
 5
 0 0
 2 0
 0 2
 2 2
 1 1
 
 */


Measured memory_bytes: 14468
//Fennec vs Monster
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <map>
#include <stdio.h>
#include <string.h>
#include <initializer_list>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <queue>
#include <set>

using namespace std;

int main ()
{
    int N, K;
    cin >> N >> K;
    vector<int> H(N);
    for (int i = 0; i < N; i++) {
        cin >> H[i];
    }
    long long count = 0;
    sort(H.begin(), H.end(),greater<int>());
    for (int i = K; i < N; i++) {
        count += H[i];
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Magic Square
 */
public class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		while (!(line = br.readLine()).equals("0")) {

			int n = Integer.parseInt(line);
			MagicSquare square = new MagicSquare(n);
			System.out.print(square.toString());
		}
	}

}

class MagicSquare {
	private int n;
	private int[][] square;

	MagicSquare(int n) {
		this.n = n;
		square = new int[n][n];
		generate();
	}

	private void generate() {
		int max = n * n + 1;
		Index idx = null;
		for (int i = 1; i < max; i++) {
			if (i == 1) {
				idx = first();
			} else {
				idx = next(idx);
			}
			setValue(i, idx);
		}
	}

	private Index first() {
		int x = n / 2 + 1;
		int y = n / 2;
		return new Index(x, y);
	}

	private Index next(Index idx) {
		int nx = idx.x + 1;
		int ny = idx.y + 1;
		Index next = new Index(nx, ny);
		correct(next);
		return next;
	}

	private void correct(Index idx) {

		int x, y;
		x = idx.x;
		y = idx.y;

		if (0 <= x && x < n && 0 <= y && y < n) {
			if (square[x][y] == 0) {
				return;
			} else {
				++idx.x;
				--idx.y;
			}
		} else {
			if (x >= n) { // 下
				idx.x = 0;
			} else if (y >= n) {// 右
				idx.y = 0;
			} else if (y < 0) {// 左
				idx.y = n - 1;
			}
		}
		correct(idx);
	}

	private void setValue(int value, Index idx) {
		square[idx.x][idx.y] = value;
	}

	public String toString() {
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n; ++i) {
			for (int j = 0; j < n; ++j) {
				sb.append(String.format("%4d", square[i][j]));
				if (j == n - 1) {
					sb.append("\n");
				}
			}
		}
		return sb.toString();
	}
}

class Index {
	int x, y;

	Index(int x, int y) {
		this.x = x;
		this.y = y;
	}
}

Measured memory_bytes: 19984
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
using namespace std;
typedef long long ll;
const int N=105;
int n,k;
int main()
{
    cin>>n>>k;
    if(n>=10) cout<<k<<endl;
    else cout<<k+100*(10-n)<<endl;
}


Measured memory_bytes: 256
n=int(input())
xy=[list(map(int,input().split())) for i in range(n)]
dmax_0=-10**10
dmin_0=10**10
dmax_1=-10**10
dmin_1=10**10
for i,j in xy:
  dmax_0=max(i-j,dmax_0)
  dmin_0=min(i-j,dmin_0)
  dmax_1=max(i+j,dmax_1)
  dmin_1=min(i+j,dmin_1)
print(max(dmax_0-dmin_0,dmax_1-dmin_1))

Measured memory_bytes: 102432
#include<bits/stdc++.h>
using namespace std;
#define ll long long int

int main()
{
    ll n;
    cin >> n;
    ll arr[5];
    for(ll i=0;i<5;i++)cin >> arr[i];
    ll ans = 0;
    ll mini = *min_element(arr,arr+5);

    cout << (n+mini-1)/mini + 4 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl;
#define printD(a) cout << setprecision(15) << (a) << endl;
using namespace std;
int max_int = 1000000007;
void Debug(auto a);
int nibul(auto a,auto b);
int nibuu(auto a,auto b);
void input(vector<int>& a,int n);

int n;

signed main(){
    cin >> n;
    vec(a,n);
    input(a,n);
    int ans = 0;
    REP(i,n){
        int min_ite = i;
        FOR(j,i,n){
            if(a[min_ite]>a[j]){
                min_ite = j;
            }
        }
        if(min_ite != i){
            ans++;
            swap(a[i],a[min_ite]);
        }
    }
    REP(i,n){
        cout << a[i];
        if(i!=n-1){
            cout << " ";
        }
        else{
            printf("\n");
        }
    }
    print(ans);
    return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}
int nibul(auto a,auto b){
    int x = lower_bound(All(a),b) - a.begin();
    //key以上の初めてのitr
    return x;
}
int nibuu(auto a,auto b){
    int x = upper_bound(All(a),b) - a.begin();
    //key以下の最後のitr
    return x-1;
}

void input(vector<int>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}



Measured memory_bytes: 3100
def solve(nu,mu,du):
    E = []
    vs = [False]*nu
    vs[0] = True

    while True:
        min_dist,ind = float("inf"),float("inf")
        for i in xrange(len(du)):
            if ( ( vs[du[i][0]] and not vs[du[i][1]] ) or ( not vs[du[i][0]] and vs[du[i][1]]) ) and min_dist > du[i][2]:
                min_dist,ind,pf,pt = du[i][2],i,du[i][0],du[i][1]
        E.append(min_dist)
        vs[pf] = vs[pt] = True
        du.pop(ind)
        if all(vs):
            break

        for i in xrange(len(du)):
            try:
                if vs[du[i][0]] and vs[du[i][1]]:
                    du.pop(i)
            except:
                pass

    print sum(E)/100 - len(E)

while True:
    n = input()
    if n == 0:
        exit()
    m = input()
    data = []
    for i in xrange(m):
        data.append( map(int,raw_input().split(",")) )
    solve(n,m,data)

Measured memory_bytes: 4884
#include<stdio.h>
#define N 20
#define Q 200
#define B 2000
#define TRUE 1
#define FALSE 0

int A[N];
int M[Q];
int n,q,j,s;
void recursion(int,int);
main()
{

  scanf("%d",&n);

  for(j=0;j<n;j++)
    {
      scanf("%d",&A[j]);
    }

  scanf("%d",&q);

  for(j=0;j<q;j++)
    {
      scanf("%d",&M[j]);
    }
  

  for(j=0;j<q;j++)
    {
      s = 0;
      recursion(0,M[j]);
   
    if(s==0)
      {
	printf("no\n");
      }
    

  }

 return 0;
}

void recursion(int soe, int  seisu)
{
  if(soe<N && s==0 && seisu>0)
    {
      if(seisu == A[soe])
	{
	  printf("yes\n");
	  s++;
	  
	}
    

  recursion(soe+1,seisu-A[soe]); /*i?????????????´?  ?????¶*/
  /*printf("%d\n",seisu);*/
  recursion(soe+1,seisu); /*i?????????????´?????????°??????*/
    }
}

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

int count(int N){ 
  int count = 0;
  while(true){
    if (N % 2 != 0){
      break;
    }
    N = N / 2;
    count++;
  } 
  return count;
}


int main(){
  int N;
  cin >> N;
  
  int max = 0;
  int max_num;
  while(true){
    if (N == 0){
      break;
    }
    
    if (count(N) >= max){
      max = count(N);
      max_num = N;
    }
    N = N - 1;
  }
  
  cout << max_num << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int x = Integer.parseInt(sc.next());
        int a = Integer.parseInt(sc.next());
        
        if(x < a){
            System.out.println(0);
        }else{
            System.out.println(10);
        }
    }
}

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

int main() {
  int N, K;
  cin >> N >> K;
  
  if (N == 1 || K == 1) {
    cout << 0 << endl;
    return 0;
  }
  
  if (N == K) {
    cout << 0 << endl;
    return 0;
  }
  
  cout << N - K << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repp(i,l,r)for(long long i=(l);i<(r);i++)
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define per(i,n) for (long long i = (n); i >= 0; --i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//ミョ(-ω- ?)
int main() {
    long double a,b;
    cin >> a >> b;
    cout <<fixed << setprecision(0) << floor(a*b) << endl;
    return 0;
}

Measured memory_bytes: 3796
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>

#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>

using namespace std;

/**
   ceil(0, 2) == 0
   ceil(1, 2) == 1
   ceil(2, 2) == 1
   ceil(3, 2) == 2
   ceil(4, 2) == 2
*/
template<class T>
T ceil(T dividend, T divisor)
{
    return (dividend + (divisor - 1)) / divisor;
}
int main()
{
    uint64_t N;
    std::cin >> N;

    std::vector<std::pair<int64_t, int64_t>> R;
    for (size_t i = 0; i < N; ++i) {
        uint64_t t, a;
        std::cin >> t >> a;
        R.push_back(std::make_pair(t, a));
    }

    decltype(R[0].first) t = 1;
    decltype(R[0].second) a = 1;
    for (size_t i = 0; i < N; ++i) {
        auto n = std::max(ceil(t, R[i].first), ceil(a, R[i].second));
        t = n * R[i].first;
        a = n * R[i].second;
    }

    std::cout << t + a << std::endl;

    return 0;
}


Measured memory_bytes: 256
[N, D] = list(map(int, input().split()))
D2 = D * D
XY = [list(map(int, input().split())) for i in range(N)]
#XY = list(map(list, set(map(tuple, XY))))
ans = []
for i in range(len(XY)):
  xy = XY[i][0] ** 2 + XY[i][-1] ** 2
  if xy <= D2:
    ans.append(i)
print(len(ans))

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

using namespace std;

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

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

  if (K == 1) {
    cout << abs(a[0]) << endl;
    return 0;
  }

  long long ans = 1e9;
  for (int i = 0; i <= N - K; i++) {
    long long tmp = min(abs(a[i]) + a[i+K-1] - a[i],abs(a[i+K-1]) + a[i+K-1] - a[i]);
    ans = min(ans, tmp);
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 640
import java.util.*;
public class Main {
    static String[][] map;
    static boolean[][] al;
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        while(true) {
            int h = stdIn.nextInt();
            int w = stdIn.nextInt();
            if(w == 0 && h == 0) {
                break;
            }
            map = new String[h][w];
            al = new boolean[h][w];
            for(int i = 0; i < h; i++) {
                String tmp = stdIn.next();
                for(int j = 0; j < w; j++) {
                    map[i][j] = tmp.substring(j, j+1);
                }
            }
             
            int npx = 0;
            int npy = 0;
            boolean lp = false;
            while(true) {
                if(map[npy][npx].equals(".")) {
                    break;
                }
                if(al[npy][npx]) {
                    lp = true;
                    break;
                }
                al[npy][npx] = true;
                if(map[npy][npx].equals(">")) {
                    npx++;
                }
                if(map[npy][npx].equals("<")) {
                    npx--;
                }
                if(map[npy][npx].equals("v")) {
                    npy++;
                }
                if(map[npy][npx].equals("^")) {
                    npy--;
                }
            }
            if(lp) {
                System.out.println("LOOP");
            }
            else {
                System.out.println(npx + " " + npy);
            }
             
             
        }
    }
}


Measured memory_bytes: 29984
#include <stdio.h>

int main(void){
    int n,ans=0;
    char a[120],b[120],c[120];
    scanf("%d",&n);
    scanf("%s\n%s\n%s",a,b,c);
    for (int i=0; i<n; i++){
        if (a[i]==b[i] && b[i]==c[i] && c[i]==a[i]){
        } else if (a[i]==b[i]){
            ans++;
        } else if (b[i]==c[i]){
            ans++;
        } else if (c[i]==a[i]){
            ans++;
        } else {
            ans+=2;
        }
    }
    printf("%d\n",ans);
    return 0;   
}

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


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

Measured memory_bytes: 256
n = int(input())
s = list(map(int, input().split()))

ans = 0
for step in range(1, n):
    now = 0
    for i, j in zip(range(0, n, step), range(n - 1, -1, -step)):
        if i == j or i - j == step or j < step:
            break
        now += s[i] + s[j]
        ans = max(ans, now)
print(ans)


Measured memory_bytes: 14332
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<set>
#define ll long long
#define pr(x) cerr<<#x<<"="<<x<<endl
using namespace std;
int n,a[1000000],i;
int main()
{
	scanf("%d",&n);
	for (i=1;i<=n;i++) scanf("%d",&a[i]);
	if (n%2)
	{
		for (i=n;i>=1;i-=2) printf("%d ",a[i]);
		for (i=2;i<=n;i+=2) printf("%d ",a[i]);
	}
	else 
	{
		for (i=n;i>=1;i-=2) printf("%d ",a[i]);
		for (i=1;i<=n;i+=2) printf("%d ",a[i]); 
	}
	return 0;
}

Measured memory_bytes: 2944
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val length: Int = sc.nextInt()
    val list = mutableListOf<Int>()

    for (x in 0 until length) {
        list.add(sc.nextInt())
    }

    val sum = list.sum()
    val max = list.max()?:0

    if (max < (sum-max)){
        println("Yes")
    }else{
        println("No")
    }

}


Measured memory_bytes: 29716
let solve =
    Array.mapi (fun i x -> i % 2 = 0 && x % 2 = 1)
    >> Array.filter id
    >> Array.length

// [|1; 3; 4; 5; 7|] |> solve
// [|13;76;46;15;50; 98; 93; 77; 31; 43; 84; 90; 6; 24; 14|] |> solve

[<EntryPoint>]
let main argv =
    stdin.ReadLine() |> ignore
    stdin.ReadLine().Split()
    |> Array.map int
    |> solve
    |> printfn "%d"
    0


Measured memory_bytes: 30348
#include <iostream>
#include <queue>

using namespace std;

int main()
{
    long long n; cin >> n;
    priority_queue<long long> queue;
    for (long long i = 0; i < n; i++)
    {
        long long val; cin >> val;
        queue.push(val);
    }
    long long res = 0;
    while (queue.top() >= n)
    {
        priority_queue<long long> queueBack;
        long long cur = queue.top();
        queue.pop();
        long long div = cur / n;
        res += div;
        long long mod = cur % n;
        cur = mod;
        queueBack.push(cur);
        while (!queue.empty())
        {
            queueBack.push(queue.top() + div);
            queue.pop();
        }
        queue = queueBack;
    }
    cout << res << '\n';
    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        String text = std.next();
        long[] dp = new long[text.length() + 1];
        for (int i = 0; i < text.length(); i++) {
            char c = text.charAt(i);
            if (c == '<') {
                dp[i + 1] = Math.max(dp[i + 1], dp[i] + 1);
            } else if (c == '>') {
                long value = Math.max(dp[i] - 1, 0);
                dp[i + 1] = Math.min(dp[i + 1], value);
            }
        }

        for (int i = text.length() - 1; i >= 0 ; i--) {
            char c = text.charAt(i);
            if (c == '<') {
                long value = Math.max(dp[i + 1] - 1, 0);
                dp[i] = Math.min(dp[i], value);
            } else if (c == '>') {
                long value = Math.max(dp[i + 1] + 1, 0);
                dp[i] = Math.max(dp[i], value);
            }
        }

        System.out.println(Arrays.stream(dp).sum());
    }
}


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

int main(){
	int N;
	string S;
	cin >> N >> S;
	for(int i=0;i<S.size();i++){
		S[i]='A'+(((S[i]-'A')+N)%26);
	}
	cout << S << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL


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

    int x;
    cin >> x;

    vector< bool > isprime(1e5 + 8, true);
    isprime[0] = isprime[1] = false;
    for (int i = 2; i <= 1e5 + 7; ++i)
    {
        if (isprime[i])
        {
            int j = i + i;
            while (j <= 1e5 + 7)
            {
                isprime[j] = false;
                j += i;
            }
        }
    }

    int ans = 2;
    rep (i, 1e5 + 8)
    {
        if (isprime[ans] && ans >= x) break;
        ++ans;
    }

    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 256
S_a, S_b, S_c = map(list, [input() for _ in range(3)])
turn = 'a'
relation = {'a': S_a, 'b': S_b, 'c': S_c}
while True: 
  if turn == 'a' and len(S_a) == 0:
    print('A')
    exit()
  if turn == 'b' and len(S_b) == 0:
    print('B')
    exit()
  if turn == 'c' and len(S_c) == 0:
    print('C')
    exit()
  
  card = relation[turn].pop(0)
  turn = card

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define mem(s,t) memset(s,t,sizeof(s))
#define pb(s) push_back(s)
#define inf 0x3f3f3f3f
#define mn 100010
typedef long long ll;
using namespace std;
vector<ll> p[50];
ll a[1010],sum[1010];
int n,k,now;
ll ans;

void work()
{
    ll pp=42,nowp;
    int i,j;
    while (pp>=0)
    {
        nowp=1ll<<pp;
        p[now+1].clear();
        for (i=0;i<p[now].size();i++)
            if ((p[now][i]&nowp)!=0) p[now+1].push_back(p[now][i]);
        if (p[now+1].size()>=k)
        {
            now++;
            ans+=nowp;
           // cout<<now<<' '<<nowp<<' '<<p[now].size()<<endl;
        }
        pp--;
    }
}

int main()
{
    int i,j;
    scanf("%d%d",&n,&k);
    for (i=1;i<=n;i++)
        scanf("%lld",&a[i]);
    p[0].clear();
    now=0;
    sum[0]=0;
    for (i=1;i<=n;i++)
        sum[i]=sum[i-1]+a[i];
    for (i=1;i<=n;i++)
        for (j=i;j<=n;j++)
            p[0].push_back(sum[j]-sum[i-1]);
    ans=0;
    work();
    printf("%lld\n",ans);
    return 0;
}



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

const int nIMPOS = -1;
struct StDist
{
  int m_nDist;
  int m_nDmy;

  StDist(int nDist) : m_nDist(nDist), m_nDmy(0)
  { }
};

void fnInput(vector<vector<int>>& rvvnAdjcy, vector<StDist>& rvoDist)
{
  int nxSiz;
  cin >> nxSiz;

  rvvnAdjcy.resize(nxSiz + 1, vector<int>(nxSiz + 1, 0));
  for (int i = 0; i < nxSiz; ++i)
  {
    int nx, nySiz;
    cin >> nx >> nySiz;
    for (int j = 0; j < nySiz; ++j)
    {
      int ny;
      cin >> ny;
      rvvnAdjcy[nx][ny] = 1;
    }
  }
  StDist oDist(nIMPOS);
  rvoDist.resize(nxSiz + 1, oDist);
}

void fnBreadthFirstSearch(const vector<vector<int>>& cnrvvnAdjcy, 
                          queue<int>& rqnBFSrch, vector<StDist>& rvoDist)
{
  while (rqnBFSrch.size())
  {
    int nx = rqnBFSrch.front(); rqnBFSrch.pop();
    for (int ny = 1; ny < cnrvvnAdjcy[nx].size(); ++ny)
    {
      if (!cnrvvnAdjcy[nx][ny])          continue;
      if (rvoDist[ny].m_nDist != nIMPOS) continue; 

      int nDist = rvoDist[nx].m_nDist + 1;
      rvoDist[ny].m_nDist = nDist;
      rqnBFSrch.push(ny);
    }
  }
}

void fnResult(const vector<StDist>& cnrvoDist)
{
  for (int i = 1; i < cnrvoDist.size(); ++i)
    cout << i <<  " " << cnrvoDist[i].m_nDist << endl;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<vector<int>> vvnAdjcy;
  queue<int>  qnBFSrch;
  vector<StDist> voDist;

  fnInput(vvnAdjcy, voDist);

  voDist[1].m_nDist = 0;
  qnBFSrch.push(1);
  fnBreadthFirstSearch(vvnAdjcy, qnBFSrch, voDist);
  fnResult(voDist);

  return 0;
}

Measured memory_bytes: 3196
n,q = map(int,input().split())
s = str(input())
lr_lst = [list(map(int,input().split())) for i in range(q)]

ac_lst = [0] * (n+1)

for i in range(n):
    if s[i:i+2]=='AC':
        ac_lst[i+1] = ac_lst[i] + 1
    else:
        ac_lst[i+1] = ac_lst[i]

for i in range(q):
    start = lr_lst[i][0]
    end = lr_lst[i][1]

    print(ac_lst[end-1] - ac_lst[start-1])

Measured memory_bytes: 30664
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>

using ll = long long;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, x) for(int i=1;i<=(int)(x);i++)
#define rrep(i, x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i, x) for(int i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007
#define put2darr(arr, row, col) rep(i, row) { rep(j, col) { printf("%18d", arr[i][j]); } cout << endl; }

using namespace std;

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

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

/* 1..10
 * rep:   0 1 2 3 4 5 6 7 8 9
 * reps:  1 2 3 4 5 6 7 8 9 10
 * rrep:  9 8 7 6 5 4 3 2 1 0
 * rreps: 10 9 8 7 6 5 4 3 2 1
 */


int n, m, k;
map<int, int> mp;
int a;
int main() {
    cin >>n >> m;
    rep(i, n){
        cin >> k;
        rep(j, k){
            cin >> a;
            mp[a]++;
        }
    }
    int ans = 0;
    for (auto e : mp) {
        if(e.second == n)ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
# coding: utf-8

n = int(input())

works = []
for _ in range(n):
    works.append(tuple(map(int, input().split())))

# sort ascending by deadline,worktime
works.sort(key=lambda x: (x[1], x[0]))

now = 0 
for work in works:
    now += work[0]
    deadline = work[1]
    if now > deadline:
        print('No')
        break
else:
    print('Yes')


Measured memory_bytes: 44528
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
import queue
#import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

def factorial(i):
    if i == 1:
        return 1
    else:
        return i*factorial(i-1)
 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)




def main(): #startline-------------------------------------------
    N = int(input())
    print(1/2 if N%2 == 0 else (N+1)/(2*N))
if __name__ == "__main__":
    main() #endline===============================================

Measured memory_bytes: 5680
#include <iostream>
#include <string>
#include <queue>
using namespace std;

int main(){
  int n, q;
  cin >> n >> q;
  vector<string> name(n);
  vector<int> time(n);
  queue<int>  process;
  for(int i=0;i<n;i++){
    cin >> name[i] >> time[i];
    process.push(i);
  }
  int t = 0;
  while(!process.empty()){
    int f = process.front();
    if(time[f] <= q){
      t += time[f];
      cout << name[f] << " " << t << endl;
      process.pop();
    }
    else{
      t += q;
      time[f] -= q;
      process.pop();
      process.push(f);
    }
  }
}



Measured memory_bytes: 6040
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
using namespace std;
const int mod = 1000000007;
#define ll long long

int main()
{
	ll N; cin >> N;
	ll n1, n2;
	int L1 = 0, L2 = 0;
	int ans = mod;
	for (ll i = 1; i * i <= N; i++) {
		L1 = 0; L2 = 0;
		if (N % i == 0) {
			n1 = i;
			n2 = N / i;
			while (n1 > 0) {
				L1++;
				n1 /= 10;
			}
			while (n2 > 0) {
				L2++;
				n2 /= 10;
			}
			if (max(L1, L2) < ans) ans = max(L1, L2);
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;

//vector string deque break continue
#define forn(i, s, f) for (int i = (int)s; i < (int)f; i++)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define fs first
#define sc second
#define pf push_front
#define pb push_back
#define pop_f pop_front
#define pop_b pop_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()

template <typename T> istream& operator>>(istream& in, vector <T>& a) {for (auto& i : a) in >> i; return in;}
template <typename T> ostream& operator<<(ostream& out, vector <T>& a)  {for (auto& i : a) out << i << " "; return out;}
template <typename T, typename U> void chkmin(T& a, U b) {if (a > b) a = b;}
template <typename T, typename U> void chkmax(T& a, U b) {if (a < b) a = b;}

vector <vector <int>> gr;
vector <int> dp;

int dfs(int v) {
    if (dp[v] != -1)
        return dp[v];
    dp[v] = 0;
    for (int u : gr[v])
        chkmax(dp[v], dfs(u) + 1);
    return dp[v];
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    int n, m;
    cin >> n >> m;
    gr.resize(n);
    forn (i, 0, m) {
        int v, u;
        cin >> v >> u, --v, --u;
        gr[v].pb(u);
    }
    dp.resize(n, -1);
    forn (i, 0, n)
        dfs(i);
    cout << *max_element(all(dp));
    return 0;
}

Measured memory_bytes: 7296
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define mp make_pair
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n,k;
	cin>>n>>k;
	int a[n];
	for(int i = 0;i<n; i++)
		cin>>a[i];
	sort(a,a+n,greater<int>());
	ll ans = 0;
	for(int i= 0; i<k;i++)
		ans += a[i];
	cout<<ans<<endl;
	return 0;
}

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

int main() {
  int N;
  cin>>N;
  vector<int> a(N);
  for(int &x: a) cin>>x;
  vector<bool> b(110,false);
  int count=0;
  for(int i=0;i<N;i++){
    if(b[a[i]]==false) {b[a[i]]=true; count++;}
  }
  cout<<count<<endl;
}




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

vector<int> depth;
vector<vector<int>> graph;

void DFS(int v, int parent_v, int d){
    depth[v] = d;
    for(int child_v : graph[v]){
        if(child_v == parent_v) continue;

        DFS(child_v, v, d+1);
    }
}

vector<int> ans;

int DFS2(int v, int parent_v){
    priority_queue<int> pq;
    for(int child_v : graph[v]){
        if(child_v == parent_v) continue;

        pq.push(DFS2(child_v,v));
    }

    if(pq.empty() == true) return ans[v] = 0;

    int count = 1;
    while(pq.empty() == false){
        int x = pq.top(); pq.pop();
        ans[v] = max(ans[v], x + count);
        count += 1;
    }
    return ans[v];
}


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

    graph.resize(n);
    for(int i=1; i<n; i++){
        int a;
        cin >> a;
        a -= 1;
        
        graph[a].push_back(i);
    }

    depth.resize(n);
    DFS(0, -1, 0);


    ans.assign(n,0);
    DFS2(0,-1);

    /*
    for(int i=0; i<n; i++){
        cout << ans[i] << " ";
    }
    cout << endl;
    */
    cout << ans[0] << endl;
    return 0;
}

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

int main()
{
    int W,H,x,y,r;cin >> W >> H >> x >> y >> r ;
    if(( x - r >= 0 ) && ( x + r <= W ) && ( y - r >= 0 ) && ( y + r <= H ))
    {
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }


    return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>
int main(void){
  int i,n;
  scanf("%d",&n);
  int x=n;
  char s[n];
  int ss[n+1];
  int sss[n+1];
  scanf("%s",s);
  ss[0]=0;
  sss[0]=0;

  for(i=0;i<n;i++){
    if(s[i]=='#'){
      ss[i+1]=ss[i]+1;
      sss[i+1]=sss[i];
    }else{
      ss[i+1]=ss[i];
      sss[i+1]=sss[i]+1;
    }
  }
  

  for(i=0;i<=n;i++){
    if(x>ss[i]+sss[n]-sss[i]){
      x=ss[i]+sss[n]-sss[i];
    }
  }

  printf("%d",x);

  
  return 0;
  
}


Measured memory_bytes: 1920
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <queue>
#include <stack>
#include <stdlib.h>
using namespace std;
#define rep(i,n) for (int (i) = 0; (i) <(n); (i)++) 
#include <math.h>
#include <bits/stdc++.h>
using namespace std;
int binary(int bina){
    int ans = 0;
    for (int i = 0; bina>0 ; i++)
    {
        ans = ans+(bina%2)*pow(10,i);
        bina = bina/2;
    }
    return ans;
}
long comb(int n, int r) {
    long ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}
using namespace std;

int main(){
  string a,b,e;
  std::cin >> a;
  int c,d;
  c=a.length();
  rep(i,c)std::cout << "x" ;
  
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,m;
  cin>>n>>m;
  int a[m],sum=0;
  for(int i=0;i<m;i++)
  {
    cin>>a[i];
    sum+=a[i];
  }
  if(sum<=n)
    cout<<n-sum;
  else 
    cout<<"-1";
  return 0;
}

Measured memory_bytes: 3632
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"sort"
	"strconv"
	"strings"
)
func avg (a, b float64) float64 {
	return (a+b)/2.0
}
func calc(arr []float64, times int) {
	sort.Float64s(arr)
	tmpAvg := arr[0]
	for i := 1; i < len(arr); i++ {
		tmpAvg = avg(tmpAvg,arr[i])
	}
	fmt.Println(tmpAvg)
}

func main() {
	arr := make([]float64, 0)
	reader := bufio.NewReaderSize(os.Stdin, 1024*1024)
	times, _:= strconv.Atoi(readLine(reader))
	strArr := strings.Split(readLine(reader), " ")
	for i := 0; i< times ; i++ {
		tmp, _ := strconv.ParseFloat(strArr[i],64)
		arr = append(arr, tmp)
	}
	calc(arr, times)
}

func readLine(reader *bufio.Reader) string {
	str, _, err := reader.ReadLine()
	if err == io.EOF {
		return ""
	}
	return strings.TrimRight(string(str), "\r\n")
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

	public static  void main(String args[])
	{
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		int k=scan.nextInt();
		String S=scan.next();
		
		int head[]=new int[n+1];
		int count=1;
		for(int i=1;i<n;i++)
		{
			if(S.charAt(i-1)!=S.charAt(i))
			{
				head[count++]=i;
			}
		}
		head[count]=n;
		int max=1;
		for(int i=0;i<count;i++)
		{
			boolean zero=S.charAt(head[i])=='0';
			int last=Math.min(i+k*2+(zero?0:1),count);
			int sum=head[last]-head[i];
			max=Math.max(max, sum);
		}
		System.out.println(max);
	}
}


Measured memory_bytes: 26836
def primes(N):
    p = [False, False] + [True] * (N - 1)
    for i in range(2, int(N ** 0.5) + 1):
        if p[i]:
            for j in range(i * 2, N + 1, i):
                p[j] = False
    return [i for i in range(N + 1) if p[i]]


def prime_factors(N):
    ret = {}
    for p in primes(int(N ** 0.5) + 1):
        while N % p == 0:
            ret[p] = ret.get(p, 0) + 1
            N //= p
    if N > 1:
        ret[N] = ret.get(N, 0) + 1
    return ret


N = int(input())
ans, ps = 0, prime_factors(N)
for p in ps:
    d = 1
    while ps[p] >= d:
        ps[p] = ps[p] - d
        d += 1
        ans += 1
print(ans)


Measured memory_bytes: 87512