akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <time.h>
#define ll long long
#define double long double
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define ALL(V) ((V).begin(),(V).end())
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 998244353
#define MAX 5100000
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
using namespace std;

ll power(ll a,ll b){
  ll res=1;
  while(b>0){
    if(b&1) res=res*a%MOD;
    a=a*a%MOD;
    b>>=1;
  }
  return res;
}

ll fac[MAX],finv[MAX],inv[MAX];

void COMinit(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2; i<MAX; ++i){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}

ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0 || k<0) return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}

int main(){
  ll N,M,K,ans=0ll;
  cin>>N>>M>>K;
  COMinit();
  
  for(ll i=0; i<=K; ++i){
    ll cnt=0;
    cnt=COM(N-1,i)*M;
    cnt%=MOD;
    cnt*=power(M-1,N-i-1);
    cnt%=MOD;
    
    ans+=cnt;
    ans%=MOD;
  }
  
  cout<<ans<<endl;
  return 0;
}

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


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll t,b,a,c;
	cin>>a>>b>>c;
	t=b/a;
	cout<<min(c,t);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
const ll INF = 1e16;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)

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

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cout << a[i] << " "; cout << "\n"; }
template<class T> void verr(const vector<T>& v){ for(auto& a : v) cout << a << " "; cout << "\n"; }
ll dbgt = 1; void err() { cout << "passed " << dbgt++ << "\n"; }
template<class H, class... T> void err(H&& h,T&&... t){ cout<< h << (sizeof...(t)?" ":"\n"); if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//

int main() {
    init();
    ll N,M;
    cin >> N >> M;
    vl A(N);
    rep(i, N) cin >> A[i];
    sort(all(A), greater<ll>());
    ll sum = accumulate(all(A), 0ll);

    bool isok = true;
    if(sum%(4*M)==0){
        sum /= 4 * M;
        rep(i,M){
            if (A[i] < sum) isok = false;
        }
    }
    else {
        sum /= 4 * M;
        rep(i,M){
            if (A[i] <= sum) isok = false;
        }
    }

    cout << (isok ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << endl;
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

int main(){
	ll n,k,q; cin >> n >> k >> q;
	vl a(n); rep(i,n) cin >> a[i];
	vpl b(n+1,P(inf,inf));
	rep(i,n){
		b[i].first = a[i];
		b[i].second = i;
	}
	sort(all(b));
	ll now = b[0].first;
	ll id = 0;
	vl split;
	split.push_back(-1);
	split.push_back(n);
	ll ans = linf;
	while(id < n){
		vl as;
		rep(i,split.size()-1){
			vl vv;
			REP(j,split[i]+1,split[i+1]){
				vv.push_back(a[j]);
			}
			if(vv.size()<k) continue;
			sort(all(vv));
			rep(j,vv.size()-k+1) as.push_back(vv[j]);
		}
		if(as.size()>=q){
			sort(all(as));
			chmin(ans,as[q-1]-as[0]);
		}
		while(id < n && now == b[id].first){
			split.push_back(b[id].second);
			id++;
		}
		sort(all(split));
		now = b[id].first;
	}
	cout << ans << endl;
}


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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(lli i=s;i<n;i++)
#define RREP(i,s,n) for(lli i=s;i>=n;i--)
#define MOD 1000000007
#define NUM 2520
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define INF (1LL<<50)

signed main(){

	lli k;

	lli data[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

	cin>>k;

	cout<<data[k-1]<<endl;


	return 0;
}


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

int main() {
    int N, A, B;
    cin >> N >> A >> B;
    if((B-A)%2 == 0){
      cout << "Alice" << endl;
    } else {
      cout << "Borys" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,x,y,z;
	cin>>n>>m;
	for(x=0;x<=m/10000;x++)
	for(y=0;y<=m/5000;y++)
	{
		z=n-x-y;
		if(z>=0&&x*10000+y*5000+z*1000==m)
		{
		    cout<<x<<' '<<y<<' '<<z;
		    return 0;
	    }
	}
	cout<<"-1 -1 -1";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>

using namespace std;

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

    using ll = long long;

    vector<ll> x(n), y(n);

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

    int pa = (abs(x[0]) + abs(y[0])) % 2;

    for (int i = 1; i < n; i++) {
        if ((abs(x[i]) + abs(y[i])) % 2 != pa) {
            cout << -1 << endl;
            return 0;
        }
    }

    int m = 31;

    vector<ll> d(m);

    for (int i = 0; i < m; i++) {
        d[i] = 1LL << i;
    }

    reverse(d.begin(), d.end());

    if (pa == 0) {
        m++;
        d.push_back(1);
    }

    cout << m << endl;
    
    for (int i = 0; i < m; i++) {
        cout << d[i] << " \n"[i + 1 == m]; 
    }

    for (int i = 0; i < n; i++) {
        ll cur_x = 0;
        ll cur_y = 0;

        for (int j = 0; j < m; j++) {
            pair<ll, char> mov(1LL << 50, 'X');

            mov = min(mov, make_pair(abs(cur_x - x[i]) + abs(cur_y + d[j] - y[i]), 'U'));
            mov = min(mov, make_pair(abs(cur_x - x[i]) + abs(cur_y - d[j] - y[i]), 'D'));
            mov = min(mov, make_pair(abs(cur_x + d[j] - x[i]) + abs(cur_y - y[i]), 'R'));
            mov = min(mov, make_pair(abs(cur_x - d[j] - x[i]) + abs(cur_y - y[i]), 'L'));

            cout << mov.second;

            switch(mov.second) {
                case 'U':
                    cur_y += d[j];
                    break;
                case 'D':
                    cur_y -= d[j];
                    break;
                case 'R':
                    cur_x += d[j];
                    break;
                case 'L':
                    cur_x -= d[j];
                    break;
            }
        }

        cout << endl;

        assert(cur_x == x[i] && cur_y == y[i]);
    }
}



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

typedef pair<int,int> pii;
typedef vector<int> vi;
#define ll long long int
typedef vector<pii> vii;
#define mp make_pair
#define first fi
#define second se

const int N = 35;
//int arr[N][N], arr1[N][N];
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int a, b, c, d, e, f;
    int ans[2];
    double maxV = -1;
    cin >> a >> b >> c >> d >> e >> f;
    for (int i = 0; 100*a*i <= f; ++i)
        for (int j = 0; 100*a*i + 100*b*j <= f; ++j)
            for (int k = 0; 100*a*i + 100*b*j + c*k <= f; ++k)
                for (int l = 0; 100*a*i + 100*b*j + c*k + d*l <= f; ++ l){
                    if (/*(k*c + l*d + a*i + b*j) &&*/ k*c + l*d <= (e*(100*a*i + 100*b*j))/100 && double((k*c + l*d))/(k*c + l*d + 100*a*i + 100*b*j) > maxV){
//                        cout << "erorr" << endl;
                        ans[0] = k*c + l*d + 100*a*i + 100*b*j;
                        ans[1] = k*c + l*d;
                        maxV = double(k*c + l*d)/(k*c + l*d + 100*a*i + 100*b*j);
                    }
                }
    cout << ans[0] << " " << ans[1] << endl;
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cstring>
#include<cmath>
#include<ctime>
#include<algorithm>
#include<utility>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#define EPS 1e-9
#define PI acos(-1.0)
#define INF 0x3f3f3f3f
#define LL long long
const int MOD = 1E9+7;
const int N = 200000+5;
const int dx[] = {-1,1,0,0,-1,-1,1,1};
const int dy[] = {0,0,-1,1,-1,1,-1,1};
using namespace std;
 
LL a[N];
int main() {
    LL n;
    scanf("%lld",&n);
    LL tot=0;
    for(int i=1;i<=n;i++){
        scanf("%lld",&a[i]);
        tot+=a[i];
    }
 
    LL minn=1E15;
    LL sum=a[1];
    for(int i=2;i<=n;i++){
        LL last=tot-sum;
        LL sub=last-sum;
        sub=llabs(sub);
        minn=min(minn,sub);
        sum+=a[i];
    }
    printf("%lld\n",minn);
 
    return 0;
}

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

int quotient(int a, int b){
	if(a % b < 0){
		return a / b - 1;
	}
	else{
		return a / b;
	}
}

int remainder(int a, int b){
	return (a %= b) >= 0 ? a : a + b;
}

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

signed main(){
	int N, X, D, i, j, ans = 0;
	scanf("%lld%lld%lld", &N, &X, &D);
	if(D == 0){
		if(X == 0){
			printf("1\n");
		}
		else{
			printf("%lld\n", N + 1);
		}
		return 0;
	}
	if(D < 0){
		X = -X;
		D = -D;
	}
//	printf("(N, X, D) = (%lld, %lld, %lld)\n", N, X, D);
	int d = D / gcd(D, abs(X));
//	printf("d = %lld\n", d);
	int l, r;
	vector<vector<pair<int, int>>> bound(min(d, N + 1), vector<pair<int, int>>(0));
	for(i = 0; i <= N; i++){
//		printf("i = %lld\n", i);
		l = i * X + ((i * (i - 1)) / 2) * D;
		r = i * X + ((i * (2 * N - i - 1)) / 2) * D;
//		printf("(l, r) = (%lld, %lld)\n", l, r);
		bound[remainder(i, d)].push_back(pair<int, int>(quotient(l, D), 1));
		bound[remainder(i, d)].push_back(pair<int, int>(quotient(r, D) + 1, -1));
	}
	auto comp = [&](pair<int, int> x, pair<int, int> y){
		if(x.first != y.first){
			return x.first < y.first;
		}
		else{
			return x.second > y.second;
		}
	};
	for(i = 0; i < min(d, N + 1); i++){
//		printf("i = %lld\n", i);
		sort(bound[i].begin(), bound[i].end(), comp);
		int now = 0;
		for(j = 0; j < bound[i].size(); j++){
//			printf("bound[%lld][%lld] = (%lld, %lld)", i, j, bound[i][j].first, bound[i][j].second);
//			printf("now = %lld\n", now);
			if(bound[i][j].second == 1){
				if(now == 0){
					l = bound[i][j].first;
				}
				now++;
			}
			else{
				now--;
				if(now == 0){
					ans += bound[i][j].first - l;
				}
			}
		}
	}
	printf("%lld\n", ans);
	return 0;
}

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

int dist(int x1, int y1, int x2, int y2) {
  return abs(x2 - x1) + abs(y2 - y1);
}

int main() {
  int N;
  cin >> N;
  int pt = 0;
  int px = 0;
  int py = 0;
  bool ok = true;
  for (int i = 0; i < N; i++) {
    int t, x, y;
    cin >> t >> x >> y;
    int d = dist(px, py, x, y);
    if (t - pt >= d && (t - pt - d) % 2 == 0) {
    } else {
      ok = false;
      break;
    }
    pt = t;
    px = x;
    py = y;
  }
  cout << (ok ? "Yes" : "No") << endl;
}


Measured memory_bytes: 3128
#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <map> 
#include<set>
#include<queue>

typedef long long ll;


#define rep(i,n) for(ll i=0;i<n;i++)
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; }

const long long INF = 1000000000000000;
const ll inf = -1e18;
typedef pair<ll, ll> P;
ll ma = 1000000000 + 7;
ll mx = 1000003;
ll h, w, n,m,k; string s,t;
char maze[60][60];
int dis[101][101]; int graph[52][52]; bool vis[52];
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
ll gcd(ll x, ll y) {
	if (x % y == 0) return y;
	return gcd(y, x % y);

}
ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
void comb(vector<vector <ll> >& v) {
	for (ll i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%ma;
		}
	}
}

ll GetDigit(ll num) {
	return log10(num) + 1;
}

int main() {
	cin >> n;
	cout << n * n * n << endl;
}



Measured memory_bytes: 256
// 基本テンプレート
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
signed main() {
    int N; cin >> N;
    vector<int> L(N), R(N);
    for(int i=0; i<N; i++) {
        cin >> L[i] >> R[i];
    }

    priority_queue< int > queL;
    priority_queue< int, vector<int>, greater<int> > queR;

    // 最小値の y 座標 (最終的な答え)
    int flr = 0;

    // 最小値より左 / 右にある点は、どれだけシフトしたか？
    int ofsL = 0, ofsR = 0;
    
    queL.push(L[0]);
    queR.push(L[0]);

    for(int i=1; i<N; i++) {
        ofsL += R[i] - L[i];
        ofsR += R[i-1] - L[i-1];

        // 左側領域の右端と、右側領域の左端
        // 区間 [lb, ub] 内の任意の座標について最小値を達成する 
        int lb = queL.top() - ofsL, ub = queR.top() + ofsR;

        // 点を push する際は、その時点での offset をキャンセルするよう注意
        if(lb <= L[i] and L[i] <= ub) {
            // 傾き 0 (最小値を取る領域内) の場合、最小値は変わらない
            queL.push(L[i] + ofsL);
            queR.push(L[i] - ofsR);
        }
        else if(L[i] < lb) {
            // 傾き負の領域内にいた場合、最小値が変化
            flr += lb - L[i];
            // 左側にある点であって元の最小値に最も近い点は、
            // 最小値が変化したことにより傾きが正へ変化する
            queR.push(lb - ofsR);
            queL.pop();
            // L[i] に相当する情報を追加
            queL.push(L[i] + ofsL);
            queL.push(L[i] + ofsL);
        }
        else {
            flr += L[i] - ub;
            queL.push(ub + ofsL);
            queR.pop();
            queR.push(L[i] - ofsR);
            queR.push(L[i] - ofsR);
        }
    }
    cout << flr << endl;
    return 0;
}


Measured memory_bytes: 3572
#include<stdio.h>
int main(){
  int n,a[100010]={};
  int i,tmp,ans=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&tmp);
    tmp<100001?(a[tmp]++):(ans++);
  }
  for(i=1;i<100001;i++){
    ans+= a[i]<i?a[i]:a[i]-i;
  }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll mod=1e9+7;		
double pi=3.1415926535897;	
	   
int main() {
			fast
			// #ifndef ONLINE_JUDGE
			// freopen("input.txt","r",stdin);
			// freopen("output.txt","w",stdout);
			// #endif

			ll a,b,h,m;
			cin>>a>>b>>h>>m;
			m=m+h*60;

			double hr=0.5*m;
			ll mn=(6*m)%360;

			double diff=abs(hr-mn);
			diff=min(diff,360-diff);
			
			double y=cos(diff*(pi/180.0));
			
			double ans=(double)a*a+(double)b*b-(double)2*a*b*y;
			cout<<fixed<<setprecision(10)<<sqrt(ans);



			return 0;
		 }	


Measured memory_bytes: 4128
//IIT2019052
//Yukta Gopalani
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
#define pb push_back
int main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     cout.tie(NULL);
     
     ll n;
     cin>>n;
    
    map<string,ll>m;
    for(ll i=0;i<n;i++)
    {
        string s;
        cin>>s;
        m[s]++;
    }
    cout<<"AC"<<" "<<"x"<<" "<<m["AC"]<<endl;   
    cout<<"WA"<<" "<<"x"<<" "<<m["WA"]<<endl;
    cout<<"TLE"<<" "<<"x"<<" "<<m["TLE"]<<endl;
    cout<<"RE"<<" "<<"x"<<" "<<m["RE"]<<endl;
         
     
}

Measured memory_bytes: 3664
#include<cstdio>
#include<algorithm>
using namespace std;

int n,k,a,maxa,c[200001],ans;

int main(){
    scanf("%d%d",&n,&k);
    for(int i=0;i<n;i++){
        scanf("%d",&a);
        if(a>maxa)maxa=a;
        c[a]++;
    }
    n=maxa;
    sort(&c[1],&c[n+1]);
    for(int i=1;i<=n-k;i++)ans+=c[i];
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using boost::multiprecision::cpp_int;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ll,pair<ll, ll>> lpll;
typedef pair<ll, int> pli;
typedef pair<int, int> pii;

const ll INF = LLONG_MAX;
const ll MOD = 1e9+7;

int N,M;
ll S;
vector<vector<pll>> ex_lines;

vector<ll> dijkstra (){
    priority_queue<pll, vector<pll>, greater<pii>> pq;
    vector<ll> dist(2500*(N+1)+1, INF);
    int first_city = (int)(1+min(S*N,2500ll*N));
    dist[first_city] = 0;
    pq.push({dist[first_city],first_city});

    while (!pq.empty()) {
        auto p = pq.top(); pq.pop();
        ll d = p.first;
        int from = p.second;
        if (dist[from]<d) continue;
        for (auto nxt: ex_lines[from]) {
            ll to = nxt.first;
            ll c = nxt.second;
            if (dist[from] + c < dist[to]) {
                dist[to] = dist[from] + c;
                pq.push({dist[to], to});
                // cout << from << " " << to << endl;
            }
        }
    }
    return dist;
}

int main() {
    // input, ready
    cin >> N >> M >> S;
    vector<vector<lpll>> lines(2500 * (N +1)+1);
    ex_lines.resize(2500 * (N +1)+1);
    for (int i=0; i<=2500 * (N +1); i++) {
        vector<lpll> tmp;
        vector<pll> tmp2;
        lines[i] = tmp;
        ex_lines[i] = tmp2;
    }
    for (int i=0; i<M; i++) {
        ll u,v,a,b;
        cin >> u >> v >> a >> b;
        lines[u].push_back({v,{a,b}});
        lines[v].push_back({u,{a,b}});
    }
    vector<ll> exchange_unit(N+1);
    vector<ll> exchange_time(N+1);
    for (int i=1; i<=N; i++) {
        ll c,d;
        cin >> c >> d;
        exchange_unit[i] = c;
        exchange_time[i] = d;
    }

    // resolve
    // グラフ拡張
    for (int city=1; city<=N; city++) {
        // 頂点拡張
        for (int j=0; j<2500; j++) {
            ll coins = min(2500ll,j+exchange_unit[city]);
            ex_lines[city+N*j].push_back({city+N*coins,exchange_time[city]});
        }
        // 辺拡張
        for (auto line: lines[city]) {
            for (int j=0; j<=2500; j++) {
                ll to = line.first;
                pll c = line.second;
                ll fee = c.first;
                ll time_cost = c.second;
                if (j-fee <0) continue;
                ex_lines[city+N*j].push_back({N*(j-fee)+to,time_cost});
            }
        }
    }
    auto dist = dijkstra();
    for (int i=2; i<=N; i++) {
        ll ans = INF;
        for (int j=0; j<2500; j++) {
            ans = min(ans,dist[i+N*j]);
        }
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 33092
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define INF 1000000
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
using namespace std;
int main()
{
	int h, w;
	cin >> h >> w;
	char table[2 * h + 1][w + 1];
	int a = 0;
	for(int i = 0; i < h; i++)
	{
		for(int j = 0; j < w; j++)
		{
			cin >> table[i][j];
			cout << table[i][j];
		}
		cout << endl;
		for(int j = 0; j < w; j++)
			cout << table[i][j];
		cout << endl;
	}
	return 0;
}



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

def solve():
	for i in range(n+1):
		for j in range(n+1-i):
			if 10000*i+5000*j+1000*(n-i-j) == y:
				return i,j,n-i-j
	return -1,-1,-1
	
print(*solve())

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

int main () {
  vector<string> line(3) ;
  for ( int i = 0 ; i < 3 ; i++ ){
    cin >> line.at(i) ;
  }
 cout << "A" << line.at(1).at(0) << "C" << endl; 
}

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

int main(void){
  char S[3];
  int value = 700;
  cin >> S;
  for(int i = 0; i < 3; i++){
    if(S[i] == 'o')
      value += 100;
  }
  cout << value << "\n";
  return 0;
}


Measured memory_bytes: 3620
// 基本テンプレート
 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
signed main() {
    int N, A, B; cin >> N >> A >> B;
    int diff = abs(B - A);

    if(A == 1 && B == 2) cout << "Borys" << endl;
    else if(A == N && B == N-1) cout << "Borys" << endl;
    else {
        if(diff % 2) cout << "Borys" << endl;
        else cout << "Alice" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>	// 入出力
#include<math.h>	// 数学の関数
#include<vector>	// 配列
#include<string>	// 文字列
#include<map>		// 連想配列
#include<stack>		// スタック
#include<queue>		// キュー
#include<algorithm> // ソートとか


using namespace std;


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

	int ab = a + b, bc = b + c, ca = a + c;

	if (ab < bc&&ab < ca) {
		cout << ab;
	}
	else if (bc < ca) {
		cout << bc;
	}
	else {
		cout << ca;
	}
	

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
	    Scanner sc=new Scanner(System.in);
	    int n=sc.nextInt();
	    int ans=0;
	    if(n%1000!=0)ans=1000-n%1000;
	    
	   System.out.println(ans);
	   
	}
}



Measured memory_bytes: 35812
#include<bits/stdc++.h>
using namespace std;
#define FILEIN freopen("input.txt", "r", stdin)

#define ll long long
#define endl "\n"

ll fact(int n, ll p = 1e9+7) {
    int res = 1;
    while (n > 1) {
        res = (res * ((n/p) % 2 ?  p-1 : 1)) % p;
        for (int i = 2; i <= n%p; ++i)
            res = (res * i) % p;
        n /= p;
    }
    return res % p;
}

int main(){
	// FILEIN;
	int n; cin>>n;
	vector<ll> p(n), q(n);
	for(auto &i: p) cin>>i;
	for(auto &i: q) cin>>i;
	ll ans = 0, ans1 = 0;
	for(int i = 0; i<(n-1); i++){
		int count = 0;
		for(int j = i+1; j<n; j++){
			if(p[j] < p[i]) count++;
		}
		ans += count*fact(n-i-1);
		count = 0;
		for(int j = i+1; j<n; j++){
			if(q[j] < q[i]) count++;
		}
		ans1 += count*fact(n-i-1);
	}
	cout<<abs(ans1 - ans)<<endl;
}

Measured memory_bytes: 256
(* O(n^2 log n) *)
let n = read_int ()
let is_prime n =
  if n <= 1 then false
  else
    let rec loop i =
      if i * i > n then true
      else if n mod i = 0 then false
      else loop @@ i + 1 in
    loop 2
let rec div_count n i = if n mod i <> 0 then 0 else 1 + div_count (n / i) i
let ans = ref 1
let _ =
  for i = 2 to n do
    if is_prime i then 
      let c = ref 0 in
      for j = 2 to n do c := !c + div_count j i done;
      ans := !ans * (!c + 1) mod 1_000_000_007 done;
  Printf.printf "%d\n" @@ !ans

Measured memory_bytes: 384
//------------------------------------------------------------------------------MANAS UNIYAL---------------------------------------------------------
//                                                                              NEVER GIVE UP
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);
#define ll long long
#define pb push_back
#define fi first 
#define se second
#define pii pair<ll,ll>
#define INF 0x3f3f3f3f
#define LINF 98765432123456789
#define testcases() ll t; cin>>t; while(t--)
#define debug cout<<"Hello\n";
#define debug1(x) cout<<#x<<" "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<"\n";
#define debug4(w,x,y,z) cout<<#w<<" "<<w<<" "<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<"\n";
#define rep(i,start,end) for(ll i=start;i<end;i++)
#define sz(x) (ll)((x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
//----------------------------------------------------------------------------------------------------------------------------------------------------

int main()
{
	
	#ifndef ONLINE_JUDGE
	freopen("C:/Users/DELL/Desktop/input.txt", "r", stdin);
	#endif

	fast;
	int n;
	cin>>n;
	vector<int> v(n);
	map<int,int> mp;
	for(int i=0;i<n;i++)
	{
		cin>>v[i];
		mp[v[i]]++;
	}
	vector<int> ans;
	for(int j=0;j<n;j++)
	{
		int x = v[j];
		vector<int> temp;
		for(int i=1;i*i<=x;i++)
		{
			if(x%i==0)
			{
				temp.pb(i);
				if(x/i!=i)
					temp.pb(x/i);
			}
		}
		bool ok = true;
		for(auto it: temp)
		{
			if(it==x)
			{
				if(mp[it]!=1)
				{
					ok = false;
					break;
				}
			}
			else
			{
				if(mp[it]!=0)
				{
					ok = false;
					break;
				}
			}
		}
		if(ok)
			ans.pb(x);
	}
	cout<<sz(ans)<<"\n";
	// for(auto it: ans)
	// 	cout<<it<<" ";
	return 0;
}


Measured memory_bytes: 33556
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ll long long
#define pi pair<int,int>
#define endl "\n"
#define MAXN 100005
using namespace std;

double n;

void solve()
{
    cin>>n;
    double ans=(double)2*((double)22.0/(double)7.0)*n;
    cout<<fixed<<setprecision(10)<<ans<<endl;
}

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


Measured memory_bytes: 3812
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (ll)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// ll        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>
//  ba;
signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  ll n, m;
  cin >> n >> m;
  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> d;
  priority_queue<ll> kouho;
  rep(i, n) {
    ll hosyu, leftday;
    cin >> leftday >> hosyu;
    d.push(pair<ll, ll>(leftday, hosyu));
  }
  ll res = 0;
  for (int i = 1; i <= m; i++) {
    while (!d.empty() and d.top().first <= i) {
      kouho.push(d.top().second);
      d.pop();
    }
    if(kouho.empty()) continue;
    res += kouho.top();
    kouho.pop();
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 3696
import std.stdio, std.string, std.conv, std.array, std.algorithm;

void main() {
   auto a = readln.split.map!(to!int);
   if (a[4] <= a[2] && a[2] <= a[0] - a[4] && a[4] <= a[3] && a[3] <= a[1] - a[4]) writeln("Yes");
   else
      writeln("No");
}

Measured memory_bytes: 2476
from sys import stdin

def main():
    L, R = map(int, input().split())

    mod = []
    r = min(R, L + 2019)
    for i in range(L, r):
        for j in range(i + 1, r + 1):
            mod.append((i * j) % 2019)
    print(min(mod))

input = stdin.readline
main()


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

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

	int ans = 0;
	vector<int> count(n);
	int last = 1;
	for (int i = 0; i < n; i++) {
		ans++;
		count[last - 1]++;
		last = a[last - 1];
		if (last == 2) break;
		if (count[last - 1] > 0) {
			ans = -1;
			break;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int flag=0;
    char apple[]="apple",peach[]="peach";
    string str;
    getline(cin,str);
    for(int i=0;str[i]!='\n';i++){
        if(str[i]=='a'){
            for(int j=i;j<i+5;j++){
                if(str[j]!=apple[j-i]){
                    flag=1;
                    break;
                }
            }
            if(flag==0){
                for(int j=i;j<i+5;j++)str[j]=peach[j-i];
            }
            flag=0;
        }
        else if(str[i]=='p'){
            for(int j=i;j<i+5;j++){
                if(str[j]!=peach[j-i]){
                    flag=1;
                    break;
                }
            }
            if(flag==0){
                for(int j=i;j<i+5;j++)str[j]=apple[j-i];
            }
                flag=0;
        }
    }
    cout<<str<<endl;
}

Measured memory_bytes: 1172
// stvorec.cpp : Defines the entry point for the console application.
//

//#include "stdafx.h"
#include <iostream>
#include <algorithm>
using namespace std;
bool cmp(int i, int j)
{
	return i > j;
}
int main()
{
	int n;
	cin >> n;
	int *pole = new int[2*n];
	for (int i = 0; i < n*2; i++)
	{
		cin >> pole[i];
	}
	sort(pole, pole + 2*n, cmp);
		int dokopy = 0;
	for (int i = 0; i < n*2; i = i + 2)
	{
		dokopy = dokopy + min(pole[i], pole[i + 1]);
	}
	cout << dokopy << endl;
    return 0;
}



Measured memory_bytes: 3600
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void) {
  char inbuf[100000];
  int n;
  long sum = 0;
  long min = 1000001;
  long max = -1000001;
  char *token;

  fgets(inbuf, sizeof(inbuf), stdin);
  sscanf(inbuf, "%d", &n);

  if (n == 0)
    return 0;

  fgets(inbuf, sizeof(inbuf), stdin);
  token = strtok(inbuf, " ");
  while (token != NULL) {
    long num = atol(token);
    sum = sum + num;

    if (num > max)
      max = num;
    if (num < min)
      min = num;

    token = strtok(NULL, " ");
  }

  printf("%ld %ld %ld\n", min, max, sum);

  return 0;
}

Measured memory_bytes: 684
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef pair<int, int> P;

const int INF = 1e8;

signed main(){
    while(1){
        int n;
        cin >> n;
        if(n == 0) break;
        int d[51][31] = {};
        rep(i, 0, n){
            int m;
            cin >> m;
            rep(j, 0, m){
                int a;
                cin >> a;
                a--;
                d[i][a] = 1;
            }
        }
        int ans = INF;
        rep(j, 0, n){
            int vis[51] = {};
            rep(i, 0, n) vis[i] = ((int)1 << i);
            rep(i, 0, 30){
                    rep(l, 0, n){
                        rep(x, 0, n){
                            if(d[l][i] && d[x][i]){
                                vis[l] |= vis[x];
                                vis[x] |= vis[l];
                            }
                        }
                    }
                    // cout << j << "  " << i << " " << vis[j] << endl;
                    if(vis[j] == ((int)1 << n) - 1){
                        ans = min(ans, i + 1);
                        break;
                    }
                }
            }
            if(ans == INF) cout << -1 << endl;
            else cout << ans << endl;
    }
}

Measured memory_bytes: 3064
from collections import Counter
mod = 1000000007


def inverse(a):
    return pow(a, mod - 2, mod)


def usearch(x, a):
    lft = 0
    rgt = len(a) + 1
    while rgt - lft > 1:
        mid = (rgt + lft) // 2
        if a[mid] <= x:
            lft = mid
        else:
            rgt = mid
    return lft


def main():
    n, k = map(int, input().split())
    s = input()
    cnt = 0
    for i in range(n-1):
        if s[i] != s[i+1]:
            cnt += 1
    ans = n - 1 - cnt
    ans += k * 2
    ans = min(ans, n-1)
    print(ans)

main()


Measured memory_bytes: 3564
//You Are the Judge
#include<bits/stdc++.h>
using namespace std;

typedef struct TEAM{
  int t, c, p;
  int w[10];
}team;

bool mycomp(const team &a, const team &b){
  if(a.c>b.c)return true;
  if(a.c<b.c)return false;
  if(a.p<b.p)return true;
  if(a.p>b.p)return false;
  return a.t<b.t;
}

int main(){
  int T, P, R;
  while(true){
    cin>>T>>P>>R;
    if(T==0&&P==0&&R==0)break;
    vector<team> p;
    for(int i=0; i<T; i++){
      team tmp;
      tmp.t=i+1; tmp.c=0; tmp.p=0; memset(tmp.w, 0, sizeof(tmp.w));
      p.push_back(tmp);
    }
    for(int i=0; i<R; i++){
      int tid, pid, tim;
      string mes;
      cin>>tid>>pid>>tim>>mes;
      if(mes=="CORRECT"){
        p[tid-1].c++;
        p[tid-1].p+=1200*p[tid-1].w[pid-1]+tim;
      }
      else p[tid-1].w[pid-1]++;
    }
    sort(p.begin(), p.end(), mycomp);
    for(int i=0; i<T; i++)
      printf("%d %d %d\n", p[i].t, p[i].c, p[i].p);
  }
  return 0;
}

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

int n, m;
ll res;
ll table[2][4][4], tarr[100010];
char arr[100010];

int main(){
	int i, j, k, a, s, cnt = 0;
	scanf("%s", arr + 1); n = strlen(arr + 1); tarr[0] = 1ll;
	for(i = 1; i <= n; i++) tarr[i] = tarr[i - 1] * 3, tarr[i] %= mod; table[0][0][0] = 1ll;
	for(i = 1; i <= n; i++){
        a = i % 2; s = (i + 1) % 2;
        for(j = 0; j < 4; j++) for(k = 0; k < 4; k++) table[a][j][k] = table[s][j][k];
        if(arr[i] == 'A') table[a][0][1]++;
        else if(arr[i] == 'B') table[a][1][2] += table[s][1][1], table[a][0][2] += table[s][0][1];
        else if(arr[i] == 'C') table[a][2][3] += table[s][2][2], table[a][1][3] += table[s][1][2], table[a][0][3] += table[s][0][2];
        else{
            cnt++;
            for(j = 1; j < 4; j++){
                for(k = 1; k < 4; k++) table[a][j][k] += table[s][j - 1][k - 1];
            }
        }
        for(j = 0; j < 4; j++) for(k = 0; k < 4; k++) table[a][j][k] %= mod;
        res %= mod;
	}
	for(j = 0; j < 4; j++){
        if(j <= cnt) res += table[a][j][3] * tarr[cnt - j], res %= mod;
	}
	printf("%lld", res);
	return 0;
}


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

const int INF = pow(2, 31) - 1;
#define ll long long
#define DEBUG(x) cout << "DEBUG>" << #x << ":" << x << endl;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(M), b(M);
  REP(i, M) {
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
  }
  vector<vector<bool>> conjoint_matrix(N, vector<bool>(N, false));
  REP(i, M) {
    conjoint_matrix[a[i]][b[i]] = true;
    conjoint_matrix[b[i]][a[i]] = true;
  }
  int ans = 0;
  REP(i, M) {
    conjoint_matrix[a[i]][b[i]] = false;
    conjoint_matrix[b[i]][a[i]] = false;
    vector<bool> visited(N, false);
    vector<int> q;

    visited[0] = true;
    q.push_back(0);
    while(!q.empty()) {
      int s = q[q.size()-1];
      q.pop_back();
      REP(j, N) {
        if(conjoint_matrix[s][j] == true && visited[j] == false) {
          visited[j] = true;
          q.push_back(j);
        }
      }
    }

    bool bridge = false;
    REP(i, N) {
      if(visited[i] == false) {
        bridge = true;
        break;
      }
    }
    if(bridge == true) {
      ans += 1;
    }
    conjoint_matrix[a[i]][b[i]] = true;
    conjoint_matrix[b[i]][a[i]] = true;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
S = input()
YY = int(S[:2])
MM = int(S[2:])

if 0 < YY < 13 and 0 < MM < 13:
    print("AMBIGUOUS")

elif 0 < YY < 13:
    print("MMYY")

elif 0 < MM < 13:
    print("YYMM")
    
else:
    print("NA")


Measured memory_bytes: 2940
#include <stdio.h>
#include<math.h>
#include <algorithm>
using namespace std;

int main(){
	int H,W,num;
	scanf("%d %d",&H,&W);
	char buf[W+1];

	for(int i=0; i < H; i++){
		scanf("%s",buf);
		num = -1;
		if(buf[0] == 'c'){
			printf("0");
			num = 0;
		}else{
			printf("-1");
		}

		for(int k=1;k < W; k++){
			if(buf[k] == 'c'){
				printf(" 0");
				num = 0;
			}else{
				if(num == -1){
					printf(" -1");
				}else{
					num++;
					printf(" %d",num);
				}
			}
		}
		printf("\n");
	}

    return 0;
}

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

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

int main() {
    int a, b;
    cin >> a >> b;
    if ( a <= 8 && b <= 8 ) cout << "Yay!" << endl;
    else                   cout << ":(" << endl; 
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;

int main() {
	int n, x,sum=0,min, m[101],rest;
	cin >> n >> x;
	for (int i = 0;i < 101;i++)
		m[i] = 0;
	for (int i = 0;i < n;i++)
		cin >> m[i];
	sort(m, m + n);
	for (int i = 0;i < n;i++)
		sum += m[i];
	rest = x - sum;
	min = 101 - (n - 1);
	cout << (n + rest / m[0]) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
#define REP(i, n) for (int i = 0; (i) < (n); ++i)

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x, y, z;
    cin >> x >> y >> z;
    cout << z << " " << x << " " << y;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
template<class T>bool CHMAX(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool CHMIN(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  IOS;
  int n,q; cin >> n >> q;
  string s; cin >> s;
  int l[q],r[q];
  REP(i,q) {
    cin >> l[i] >> r[i];
    l[i]; r[i];
  }
  vector<int> c(n+1, 0);
  REP(i,n) {
    c[i+1] = c[i];
    if (i == 0) continue;
    if (s[i] == 'C' && s[i-1] == 'A') c[i+1]++;
  }
  REP(i,q) COUT(c[r[i]] - c[l[i]]);
  return 0;
}

Measured memory_bytes: 2256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<queue>
const int mod = 1e9 + 7;
const int INF = 1e9;
using namespace std;
typedef long long ll;


int main()
{
    ll h,w;
    cin >> h >> w;
    ll s1,s2,s3;
    ll dif = INF;
    for(int i = 1; i <= h; i++){
        s1 = i * w;
        s2 = ((h-i)/2) * w;
        s3 = (h-i - (h-i)/2) * w; 
        dif = min(max({s1,s2,s3}) - min({s1,s2,s3}),dif);
        s1 = i * w;
        s2 = (h - i) * (w/2);
        s3 = (h - i) * (w - w/2); 
        dif = min(max({s1,s2,s3}) - min({s1,s2,s3}),dif);
    }
    int tmp = h;
    h = w;
    w = tmp;
    for(int i = 1; i <= h; i++){
        s1 = i * w;
        s2 = ((h-i)/2) * w;
        s3 = (h-i - (h-i)/2) * w; 
        dif = min(max({s1,s2,s3}) - min({s1,s2,s3}),dif);
        s1 = i * w;
        s2 = (h - i) * (w/2);
        s3 = (h - i) * (w - w/2); 
        dif = min(max({s1,s2,s3}) - min({s1,s2,s3}),dif);
    }
    cout << dif << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int data[100];
int sp = 0;

int empty() {
    return sp <= 0;
}


int top() {
    return data[sp-1];
}

void pop() {
    sp--;
}

void push(int v) {
    data[sp] = v;
    sp++;
}

int main() {
    int a;
    while(scanf("%d", &a) != EOF) {
        if(a != 0) {
            push(a);
        } else {
            if(empty()) break;
            printf("%d\n", top());
            pop();
        }
    }
    return 0;
}

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

using namespace std;

int main(void)
{
    string S;
    cin >> S;

    char Si = S.at(0);
    bool jumped = false;
    long result=1;

    for (int i = 1; i < S.size(); i++)
    {
        if (!jumped)
        {
            if (S.at(i) == S.at(i - 1))
            {
                if(i==S.size()-1){
                    break;
                }
                i++;
                jumped = true;
            }
        }
        else{
            jumped = false;
        }
        result++;
    }

    cout << result << endl;

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A , B , C , D ;
  cin >> A >> B >> C >> D ;
  
 if( A + B == C + D ){
   cout << "Balanced" << endl ;
 }
  if ( A + B < C + D ){
    cout << "Right" << endl ;
  }
  if ( A + B > C + D ) {
    cout << "Left" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  vector<int> a(3);
  cin>>a[0]>>a[1]>>a[2];
  sort(a.begin(), a.end());
  cout<<a[0]+a[1]<<endl;
}



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

int main() {
    ll N, A, B, C, D, E;
    cin >> N >> A >> B >> C >> D >> E;
    ll tmp = min({A, B, C, D, E});
    ll ans = (N + tmp - 1)/tmp + 4;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
#include <bitset>

using namespace std;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define reppe(i,a,b) for(int i = (int)(a) ; i <= (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
#define repme(i,a,b) for(int i = (int)(a) ; i >= (int)(b) ; --i)

typedef long long ll;

long long GCD(long long a, long long b){if(b==0)return a;return GCD(b,a%b);}

int main() {
    ll N, K; cin >> N >> K;
    ll X = N % K;
    cout << min(abs(X), abs(X-K)) << endl;
}


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

vector < int64_t > factors (int64_t x) {
	vector < int64_t > res;
	for (int64_t i = 2; i * i <= x; ++i) {
		if (x % i == 0) 
			res.push_back(i);
		while (x % i == 0)
			x /= i;
	}
	if (x != 1)
		res.push_back(x);
	return res;
}

signed main () {
	int64_t a, b;
	cin >> a >> b;
	cout << int(factors(__gcd(a, b)).size()) + 1 << '\n';
}


Measured memory_bytes: 256
N, M, Q = list(map(int, input().split()))
Qs = [list(map(int, input().split())) for i in range(Q)]

patterns = []
def dfs(a):
  if len(a) == N:
    patterns.append(a)
  else:
    for i in range(int(a[-1]), M+1):
   	  dfs(a+[i])

dfs(a=[1])
result = 0
for p in patterns:
  r = 0
  for q in Qs:
    if p[q[1]-1]-p[q[0]-1]==q[2]:
      r += q[3]
  #print(p, r)
  result = max([result, r])
print(result)

Measured memory_bytes: 16280