akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>		//UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>		//do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;

const int inf = 1e9;
const int MR = 401;

int dp[MR][MR];

int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }

int main()
{
	REP(i,MR)REP(j,MR) dp[i][j] = inf;
	dp[0][0] = 0;
	int N, Ma, Mb;
	scanf("%d%d%d", &N, &Ma, &Mb);
	REP(i,N)
	{
		int a, b, c;
		scanf("%d%d%d", &a, &b, &c);
		FORD(j,MR,a)FORD(k,MR,b)
			dp[j][k] = min(dp[j][k], dp[j-a][k-b] + c);
	}

	int res = inf;
	FOR(i,1,MR)FOR(j,1,MR)
		if(i/gcd(i,j) == Ma && j/gcd(i,j) == Mb)
			res = min(res, dp[i][j]);

	if(res == inf)
		res = -1;

	printf("%d\n", res);

	return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x)  (long long)(x).size()
#define sqr(x) (x)*(x)
#define sof sizeof
#define resz resize
#define ins insert
#define lowerB lower_bound
#define upperB upper_bound
#define mkp make_pair
#define mkt make_tuple
#define act(a,v) (get<(long long)a>(v))
#define mod 1000000007
#define mod1 998244353
#define N 1000003
#define inf 1e18
#define minf -1e18
#define min3(a,b,c) min(a,min(b,c));
#define max3(a,b,c) max(a,max(b,c));
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define sumall(v) accumulate(all(v),(ll)0)
#define suma accumulate
#define FastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PRECISION(n) std::cout.unsetf ( std::ios::floatfield );std::cout.precision((ll)n)
#define PI M_PI
#define fi first
#define se second
#define here cout<<"RSSB"<<endl
#define showzero cout<<std::showpoint
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define br "\n"
#define sp " "
#define zero (ll)0
using namespace  std ;
typedef double db;
typedef long long ll ;
typedef vector<int>vi ;
//typedef vector<l>vl ;
typedef vector<ll>vll ;
typedef vector<vector<ll> >vvl ;
typedef pair<int,int> pii ;
typedef pair<ll,ll> pll ;
typedef vector<pll>vpll;
typedef vector<string>vstr;
typedef vector<bool>vbool ;
void READ(vll &v, ll n){ll a ;for(ll i=0 ; i<n ; i=i+1){cin>>a ;v.pb(a);}}
void PRINT(vll &v , ll a = 0){for(ll i=a ; i<v.size() ; i=i+1){/*v[i] = max((ll)0,v[i]);*/cout<<v[i]<<" " ;}cout<<"\n" ;}
double logy(ll n , ll b){if(b==0){return(-1);}if(n==1){return(0);}return((db)log10(n)/log10(b));}
long long power(long long k , long long n , long long m=mod){long long res = 1;while(n){if(n%2!=0){res = (res*k)%m ;}k = (k*k)%m ;n = n/2 ;}return(res) ;}
ll n,m,k,x,y;
bool ok = false;
int main()
{
    FastIO ;
    PRECISION(10) ;
    ll a,b,c,d,i,j,t;//,x,y,z;//,x1,y1,z1,e,f;
    ll p,q,r,u,w ;
    char ch,chr ;
    string str,st,str1,str2,str3,str4;
    //ll a1=0,a2=0,b1=0,b2=0,c1=0 ;
    //cin>>str>>str1;
    //Stay Motivated!!
    //Never use i for two or more nested loops!!
    //Range Query + Constructive + DSU  +  Graph Theory + Math + DP + Bitmasks + Geometry + Brute Force + Implementation + Binary Search
    cin>>str;
    if(str[1]=='R')
    {
        str[1] = 'B';
    }
    else
    {
        str[1] = 'R';
    }
    cout<<str;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
#include<math.h>
#include<set>
#include<string>
using namespace std;


//#define int                long long int
#define jaldichal          ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb                 push_back
#define mk                 make_pair
#define R                  return
#define C                  continue
#define line               "\n"
#define space              " "
#define sizee(v)           ((int)((v).size()))
#define arrsize            200005
#define odd(x)             ((int)(x&1))
#define fi                 first
#define se                 second
#define all(x)             x.begin(),x.end()
#define w(x)               int x;cin>>x;for(int i=1;i<=x;i++)

#define vi                 vector<int>
#define vii                vector<pair < int , int > > 
#define setbits(x)         __builtin_popcountll(x)
#define pii                pair<int, int>
#define inp(v)             for(auto &x : v)cin>>x
int n,m;

void solve()
{
	cin>>n;
	if(n==0)cout<<"1"<<line;
	else cout<<"0"<<line;
}
signed main()
{    
    jaldichal
    solve();



return 0;
}

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

using namespace std;

#define X first
#define Y second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(), a.end()
#define rep(i, st, n) for (int i = (st); i < (n); ++i)
#define repinv(i, st, n) for (int i = ((n)-1); i >= (st); --i)
#define MEM(a, b) memset(a, b, sizeof(a));

#define debug(x) std::cout << #x << ": " << x << endl
#define fastIO() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fileIO(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout)

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;

//mt19937 mrand(random_device{}());
const ll mod=1e9+7;
//int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
pii operator+(const pii&x, const pii&y) { return mp(x.X+y.X, x.Y+y.Y);}
pii operator-(const pii&x, const pii&y) { return mp(x.X-y.X, x.Y-y.Y);}
//INT_MAX, ULLONG_MAX, LLONG_MAX or numeric_limits<int>::min()

inline ll read(){
	char ch=getchar();ll x=0,f=0;
	while(ch<'0' || ch>'9') f|=ch=='-',ch=getchar();
	while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
	return f?-x:x;
}

//------------------------------------------------------------------------//
int T;
const int maxn = 2e5+7;

//check T
void solve()
{
	int n;
	string s;
	string ad[2];
	int rev;
	cin >> s >> n;
	rev = 0;
	int T, F;
	string c;
	rep(i, 0, n)
	{
		cin >> T;
		if(T== 1) rev^=1;
		if(T==2)
		{
			cin >> F >> c;
			if(F == 1) ad[rev] += c; //rev = 0=> 0 rev = 1  => 1
			if(F == 2) ad[rev^1] += c;
		}
	}
	//ad 0 = front ad 1 = back if not rert
	if(rev) reverse(all(s));
	reverse(all(ad[rev])); 
	/*if(rev)*/ cout << ad[rev] << s << ad[rev^1];

  return;
}


signed main()
{
  fastIO();
  T = 1;
  //cin >> T; //this
  while(T--) solve();
  return 0;
}


Measured memory_bytes: 1040
N= int(input())
X=[]
Y=[]
H=[]
f=0
for i in range(N):
    x, y, h = map(int,input().split())
    X.append(x)
    Y.append(y)
    H.append(h)
for CX in range(0,101):
    for CY in range(0, 101):
        for i in range(N):
            if H[i]>0:
                CH=abs(X[i]-CX)+abs(Y[i]-CY)+H[i]
                break
        for i in range(N):
            if max(0,CH-abs(X[i]-CX)-abs(Y[i]-CY))!=H[i]:
                break
            if i==N-1:
                f=1
                break
        if f==1:
            break
    if f==1:
        break
print(str(CX)+" "+str(CY)+" "+str(CH))


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

#define endl ("\n")
#define all(x) (x).begin(),(x).end()
#define print(x) cout << (x)
#define println(x) cout << (x) << endl

template<typename Type>
Type gcd(const Type a,const Type b){return(b==0)?a:gcd(b,a%b);}
template<typename Type>
Type lcm(const Type a,const Type b){return(a/gcd(a,b))*b;}

template<typename Type>
void sort(vector<Type>& v){
	sort(all(v));
}

int main(){
	string s;
	cin >> s;
	if(s[2]==s[3]&&s[4]==s[5]){
		cout << "Yes";
	}else{
		cout << "No";
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define memset(v, h) memset((v), h, sizeof(v))
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-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; }

int main(){
    ll n1, n2, n3;
    cin >> n1 >> n2 >> n3;

    string k  =(n1 + n2 + n3) >= 22 ? "bust" : "win";
    cout << k << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define forsn(i, s, n) for(int i=s;i<int(n);i++)
#define forn(i, n) forsn(i, 0, n)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
 
typedef long long tint;

const int INF = 1e6;
const long double PI = acos(-1);
 
int main() {
	int n; cin >> n;
	vector<int> a (n);
	int maxi = 0, sum = 0;
	forn(i, n){
		cin >> a[i];
		maxi = max(maxi, a[i]);
		sum+=a[i];
	}
	if(maxi < sum-maxi) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int K = in.nextInt();
            int X = in.nextInt();
            StringBuilder sb = new StringBuilder();
            for (int i = X - K + 1; i < X + K; i++) {
                sb.append(i).append(' ');
            }
            out.println(sb.substring(0, sb.length() - 1));
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 21460
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
//#define inf 2000000000
#define inf 8000000000000000000
#define pi 3.14159265358979323846264338328
#define eps 1e-9
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#define ykh mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a)
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>

using namespace std;
using namespace __gnu_pbds;

const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod;

inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}

const int maxn=505;
//i_am_noob
int n,dx[4]={1,0,-1,0},dy[4]={0,1,0,-1},a[maxn][maxn],dp[maxn][maxn],x,ans=0;

void dfs(int x, int y){
    int tmp=inf,xx,yy;
    rep(4){
        xx=x+dx[i],yy=y+dy[i];
        if(xx<0||xx>n-1||yy<0||yy>n-1) tmp=0;
        else tmp=min(tmp,dp[xx][yy]);
    }
    if(a[x][y]) tmp++;
    if(dp[x][y]==tmp) return;
    dp[x][y]=tmp;
    rep(4){
        xx=x+dx[i],yy=y+dy[i];
        if(xx<0||xx>n-1||yy<0||yy>n-1) continue;
        if(dp[xx][yy]>dp[x][y]) dfs(xx,yy);
    }
}

signed main(){
    ios_base::sync_with_stdio(0),cin.tie(0);
    cin >> n;
    rep(n) rep1(j,n) a[i][j]=1;
    rep(n) rep1(j,n) dp[i][j]=min(min(i+1,j+1),min(n-i,n-j));
    rep(n*n){
        cin >> x;
        x--;
        a[x/n][x%n]=0;
        dfs(x/n,x%n);
        ans+=dp[x/n][x%n];
    }
    print1(ans);
    return 0;
}


Measured memory_bytes: 22996
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<vector>
using namespace std;

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(o) {cerr<<#o<<" "<<o<<endl;}
#define DUMPC(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

signed main() {
	int n; cin >> n;
	int a[110][110] = {};
	int dp[110][110] = {};
	n++;
	FOR(i, 1, n)FOR(j, 1, n) {
		cin >> a[i][j]; dp[i][j] = a[i][j];
	}
	FOR(i, 1, n)FOR(j, 1, n)
		dp[i][j] += dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1];
	int ans = -INF;
	REP(i, n - 1)REP(j, n - 1)FOR(k, i + 1, n)FOR(l, j + 1, n)
		ans = max(ans, dp[k][l] - dp[k][j] - dp[i][l] + dp[i][j]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3228
#include<cstdio>

int main(){
	char c,t;
	scanf("%c", &c);
	while(c - 48){
		int temp = 0;
		while(c - 10){
			temp += (c - 48);
			scanf("%c", &c);
		}
		printf("%d\n", temp);
		scanf("%c", &c);
	}
}

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


using namespace std;
typedef long long ll;

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

    queue<char> aQueue;
    for(const auto& c : s){
        if(aQueue.empty()) {
            aQueue.push(c);
        }else if(aQueue.back() != c){
            aQueue.push(c);
        }
    }

    cout << aQueue.size() <<endl;
}

Measured memory_bytes: 512
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int p[SIZE],B[SIZE],C[SIZE];
int main(){
    int n;
    R(n);
    FOR(i,1,n){
        R(p[i]);
        if(i!=1&&p[i]==p[i-1]+1)C[p[i-1]]++;
    }
    LL an=0;
    FOR(i,1,n){
        int x;R(x);
        an+=x;
    }
    FOR(i,1,n-1){
        int x;
        R(x);
        if(C[i])an+=x;
    }
    W(an);
    return 0;
}


Measured memory_bytes: 2304
#include "bits/stdc++.h"
#include <set>

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}

template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}

long long Com[2001][2001];

void calc_com() {
    memset(Com, 0, sizeof(Com));
    Com[0][0] = 1;
    for (int i = 1; i < 2001; ++i) {
        Com[i][0] = 1;
        for (int j = 1; j < 2001; ++j) {
            Com[i][j] = (Com[i-1][j-1] + Com[i-1][j]) % mod;
        }
    }
}


signed main(void) {
	int n;
	cin >> n;
	int ret=0;
	calc_com();
	for(int i=n/3;i>0;i--){
		ret+=Com[n-2*i-1][i-1];
		ret%=mod;
	}
	print(ret);
}

Measured memory_bytes: 34920
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

int INF = 0x3f3f3f3f;
int mod = 1e9+7;
int MAXN = 12345;
double eps = 1e-7;

int dcmp(double a, double b) 
{
    return (a - b < eps)? -1: (a - b >= eps);
}

char str[112345];

int isLRL(int pos, int dir)
{
    if (dir == -1)
    {
        if (str[pos-1] == 'L' && str[pos] == 'R') return 1;
        if (str[pos-1] == 'R' && str[pos] == 'L') return 2;
    } else
    {
        if (str[pos] == 'L' && str[pos+1] == 'R') return 1;
        if (str[pos] == 'R' && str[pos+1] == 'L') return 2;
    }
    return -1;
}

int main(int argc, char **argv)
{
    ios::sync_with_stdio(false);
    int n, k;

    scanf("%d%d", &n, &k);
    scanf("%s", str);

    int ans = 0, change = 1;

    for (int i = 0; str[i]; ++i)
    {
        if (!i) continue;
        if (str[i] == str[i-1])
        {
            ans++;
        } else
        {
            change++;
        }
    }

    while(k--)
    {
        if (change <= 1) break;
        if (change == 2) ans += 1;
        else ans += 2;
        change -= 2;
    }

    printf("%d\n", ans);

    return 0;
}


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

class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int a = scan.nextInt();
    int b = scan.nextInt();
    int c = scan.nextInt();
    
    int[] sort = {a ,b ,c};
    Arrays.sort(sort);
      
    System.out.println(sort[0] + " " + sort[1] + " " + sort[2]);
  }
}

Measured memory_bytes: 26244
// Think twice, Code once
// 1SAC
#include<bits/stdc++.h>
using namespace std;

/*============================ DEBUGGING =============================*/

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif

/*============================= DEFINES ==============================*/

#define eps 1e-9
#define mod 1000000007
#define pb emplace_back
#define mp make_pair
#define B begin()
#define E end()
#define F first
#define S second
#define tostr(x) to_string(x)
#define SZ(x) ((int)x.size())
#define ins insert
#define rep(i,x,y) for(int i=x;i<y;i++)
#define per(i,x,y) for(int i=x;i>y;i--)
#define repi(i,x,y) for(int i=x;i<=y;i++)
#define peri(i,x,y) for(int i=x;i>=y;i--)
#define inf (ll)LLONG_MAX
#define ds1(i,x) for(auto i=x.begin();i!=x.end();i++)
#define ds2(i,x) for(auto i:x)
#define FIO {ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);}
#define dig(n) (int)(log10(n)+1)
#define ss(x,k) substr(x,k)  // x is the start pos and k is the length of substr.
#define set(x,k) memset(x,k,sizeof x)
#define Sort(a) sort(a.begin(),a.end())

/*============================== TYPEDEFS ============================*/

typedef long long ll;
typedef long double ld;
typedef long l;
typedef string str;
typedef vector<int> vi;
typedef vector<ll> vlli;
typedef vector<bool> vb;
typedef queue<int> qi;
typedef vector<pair<int,int> > vpii;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;

/*============================ START FROM HERE =======================*/

int main(){
	FIO
	
	int n;cin>>n;
	cout<<800*n-(n/15)*200;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>
#include <bitset>
#include <sstream>
#include <cassert>
#include <time.h>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}
void printvec (vec &v) {
    Rep (i, (ll)v.size()) {
        cout << v[i] << " \n"[i+1 == (ll)v.size()];
    }
}

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

    ll x;
    ll ans;
    Rep (i, 5) {
        cin >> x;
        if (x != i+1) ans = i+1; 
    }

    cout << ans << endl;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;


int main() {
  string s,t;
  cin >> s >> t;
  int a,b;
  cin >> a >> b;
  string u;
  cin >> u;
  if (s==u) a--;
  if (t==u) b--;
  cout << a << " " << b << endl;
}


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

int main(){
	int x, y;
	scanf("%d %d",&x,&y);
	if (x == y) printf("0\n");
	else if (x == 0 && y < 0) printf("%d\n", x - y + 1);
	else if (x == 0 && y > 0) printf("%d\n", y - x);
	else if (x < 0 && y == 0) printf("%d\n", y - x);
	else if (x > 0 && y == 0) printf("%d\n", x - y + 1);
	else if (x < 0 && y > 0) printf("%d\n", abs(x + y) + 1);
	else if (x > 0 && y < 0) printf("%d\n", abs(x + y) + 1);
	else if (x > 0 && y > 0 && x < y) printf("%d\n", y - x);
	else if (x > 0 && y > 0 && x > y) printf("%d\n", x - y + 2);
	else if (x < 0 && y < 0 && x < y) printf("%d\n", y - x);
	else if (x < 0 && y < 0 && x > y) printf("%d\n", x - y + 2);
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#define ll long long
#define rep(i,j,k) for (i=j;i<=k;i++)
#define down(i,j,k) for (i=j;i>=k;i--)
using namespace std;
const int N=2e6,mod=1e9+7;
int i,ans,fac[N+5],inv[N+5],x[7],y[7];
int fgm(int a,int n)
{
	int ret=1,bsc=a;
	for (;n>0;n>>=1,bsc=(ll)bsc*bsc%mod)
	if (n&1) ret=(ll)ret*bsc%mod;
	return ret;
}
ll C(int n,int m)
{
	if (!n || !m) return 1;
	return (ll)fac[n+m]*inv[m]%mod *inv[n]%mod;
}
void calc2(int x0,int y0,int x2,int y2,int sgn)
{
	ll s=0; int i;
	rep(i,x[3],x[4]) {
		(s+=-C(i-x0,y[3]-y0-1)*C(x2-i,y2-y[3])%mod*(y[3]+i)  )%=mod;	
		(s+= C(i-x0,y[4]-y0)*C(x2-i,y2-y[4]-1)%mod*(y[4]+i+1))%=mod;
	}
	rep(i,y[3],y[4]) {
		(s+=-C(x[3]-x0-1,i-y0)*C(x2-x[3],y2-i)%mod*(x[3]+i)  )%=mod;
		(s+= C(x[4]-x0,i-y0)*C(x2-x[4]-1,y2-i)%mod*(x[4]+i+1))%=mod;
	}
	s*=sgn;
	(ans+=s)%=mod;
}
void calc(int x0,int y0,int sgn)
{
	calc2(x0,y0,x[6]+1,y[6]+1,sgn);
	calc2(x0,y0,x[5],y[5],sgn);
	calc2(x0,y0,x[5],y[6]+1,-sgn);
	calc2(x0,y0,x[6]+1,y[5],-sgn);
}
int main()
{
//	freopen("sight.in","r",stdin);
//	freopen("sight.out","w",stdout);
	rep(i,1,6) scanf("%d",&x[i]);
	rep(i,1,6) scanf("%d",&y[i]);
	fac[1]=fac[0]=inv[1]=inv[0]=1;
	rep(i,2,N) fac[i]=(ll)fac[i-1]*i%mod;
	inv[N]=fgm(fac[N],mod-2);
	down(i,N-1,2) inv[i]=(ll)inv[i+1]*(i+1)%mod;
	calc(x[1]-1,y[1]-1,1);
	calc(x[2],y[2],1);
	calc(x[2],y[1]-1,-1);
	calc(x[1]-1,y[2],-1);
	(ans+=mod)%=mod;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 15872
/*********************
*  Author: xuziyuan  * 
*********************/

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair
#define sqr(a) ((a)*(a))

using namespace std;

const LL MOD=1e9+7;

int m,d,ans=0;

int main()
{
	cin>>m>>d;
	repn(i,m) repn(j,d) if(j%10>1&&j/10>1&&j/10*(j%10)==i) ans++;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import Control.Arrow
import qualified Data.Vector.Unboxed as VU
import qualified Data.ByteString.Char8 as B
import Data.List

fact n = product [1..n]

solve :: Int -> VU.Vector (Int, Int) -> Double
solve n vs = (/ fromIntegral (fact n)) $ sum $ map (dist 0) $ permutations [0 .. n - 1]
  where
    dist acc (i:j:ks) =
      let (x1,y1) = vs VU.! i
          (x2,y2) = vs VU.! j
      in dist (sqrt (fromIntegral $ (x1-x2)^2 + (y1-y2)^2) + acc) (j:ks)
    dist acc _ = acc

main = do
  let readInt = fmap (second B.tail) . B.readInt

  n   <- (VU.! 0) . VU.unfoldrN 1 readInt <$> B.getLine
  xys <-
    VU.replicateM n
    $   (\vec -> (vec VU.! 0, vec VU.! 1))
    .   VU.unfoldrN 2 readInt
    <$> B.getLine

  print $ solve n xys


Measured memory_bytes: 1916
#include <bits/stdc++.h>
using namespace std;
int main(){
  vector<vector<int>> A(3,vector<int>(3));
  for(int i = 0 ; i < 3 ; i++){
    for(int j = 0 ; j < 3 ;j++){
      cin >> A.at(i).at(j);
    }
  }

  int N;
  cin >> N;
  vector<int> B(N);
  for(int i = 0 ; i < N ; i++){
    cin >> B.at(i);
  }


  vector<vector<bool>> flag(3,vector<bool>(3));
  for(int i = 0 ; i < N ; i++){
    int tmp = B.at(i);
    for(int j = 0 ; j < 3 ; j++){
      for(int k = 0 ; k < 3 ; k++){
        //cout << "A is " << A.at(j).at(k) << endl;
        if(tmp == A.at(j).at(k)){
          //cout << "ok" << endl;
          flag.at(j).at(k) = 1;
          goto SKIP;
        }
      }
    }
    SKIP:;
  }

  /*
  for(int i = 0 ; i < 3 ; i++){
    cout << "|-|-|-|" << endl;
    for(int j = 0 ; j < 3 ; j++){
      cout << "|" << flag[i][j];
    }
    cout << "|" << endl;
  }
  cout << "|-|-|-|" << endl;
  */

  string str = "No";

  for(int i = 0 ; i < 3 ; i++){
    if(flag[i][0] == flag[i][1] && flag[i][1] == flag[i][2] && flag[i][2] == 1){
      str = "Yes";
    }
  }
  for(int i = 0 ; i < 3 ; i++){
    if(flag[0][i] == flag[1][i] && flag[1][i] == flag[2][i] && flag[2][i] == 1){
      str = "Yes";
    }
  }

  if(flag[0][0] == flag[1][1] && flag[1][1] == flag[2][2] && flag[2][2] == 1){
    str = "Yes";
  }
  if(flag[0][2] == flag[1][1] && flag[1][1] == flag[2][0] && flag[2][0] == 1){
    str = "Yes";
  }

  cout << str << endl;
  return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
const int MOD = 1000000007;
const int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;

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

  int N, K;
  cin >> N >> K;
  int A[N];
  rep(i,N) cin >> A[i];
  if(N > K){
    sort(A, A+N);
    int sum{};
    rep(i,N-K){
      sum += A[i];
    }
    cout << sum << endl;
  }
  else cout << 0 << endl;
}

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

ll N, D;

int main(){
  cin >> N >> D;
  ll x, y;
  int ans = 0;
  rep(i, N){
    cin >> x >> y;
    if (sqrt(x*x + y*y) <= D) ans++;
  }
  cout << ans << endl;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i=0;i<N;i++){
  cin >> A.at(i);
  }
  vector<int> C(N);  
  for (int i=0;i<N;i++){
  C.at(i)=A.at(i);
  }
  sort (C.begin(),C.end());
  
  for (int i=0;i<N;i++){
  if (A.at(i)!=C.at(N-1)){
  cout << C.at(N-1) << endl;    
  }
  else {
  cout << C.at(N-2) << endl;
  } 
  }
}

Measured memory_bytes: 3200
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>

using namespace std;

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

    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a.at(i);
    }
    
    sort(a.begin(), a.end(), greater<int>());
    int sum = accumulate(a.begin(), a.end(), 0);
    double percentage = static_cast<double>(sum) / (4 * static_cast<double>(m));

    if (a.at(m - 1) >= percentage) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

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

const int maxn=200000;
const int maxm=2001;
const int maxk=maxm<<1;
const int mod=1000000007;

int n,x[maxn+10],y[maxn+10],mp[maxk+10][maxk+10],f[maxk+10][maxk+10],C[maxk*2+10][maxk+10];

int main()
{
  n=read();
  for(int i=1; i<=n; ++i)
    {
      int a=read(),b=read();
      ++mp[maxm-a][maxm-b];
      x[i]=a;
      y[i]=b;
    }
  C[0][0]=1;
  for(int i=1; i<=maxk*2; ++i)
    {
      C[i][0]=C[i-1][0];
      for(int j=1; (j<=i)&&(j<=maxk); ++j)
        {
          C[i][j]=C[i-1][j]+C[i-1][j-1];
          if(C[i][j]>=mod)
            {
              C[i][j]-=mod;
            }
        }
    }
  for(int i=1; i<=maxk; ++i)
    {
      for(int j=1; j<=maxk; ++j)
        {
          f[i][j]=mp[i][j]+f[i-1][j]+f[i][j-1];
          if(f[i][j]>=mod)
            {
              f[i][j]-=mod;
            }
        }
    }
  int ans=0;
  for(int i=1; i<=n; ++i)
    {
      ans+=f[x[i]+maxm][y[i]+maxm];
      if(ans>=mod)
        {
          ans-=mod;
        }
      ans-=C[(x[i]+y[i])<<1][x[i]<<1];
      if(ans<0)
        {
          ans+=mod;
        }
    }
  ans=1ll*ans*((mod+1)/2)%mod;
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 222976
import numpy as np

N, D = map(int, input().split())

def d(x, y):
  x = np.array(x)
  y = np.array(y)
  return np.sqrt(np.sum((x - y)**2))
  
X = [[list(map(int, input().split()))] for _ in range(N)]

cnt = 0
for i in range(N):
  for j in range(N):
    if i < j:
      cnt += d(X[i], X[j]).is_integer()

print(cnt)

Measured memory_bytes: 12448
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int K = sc.nextInt();
        int X = sc.nextInt();
        if (K * 500 >= X){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


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

struct card { char suit, value;};

int Print(int a[], int p){
    for(int i=0;i<p;i++){
        if(i>0)printf(" ");
        printf("%d",a[i]);
    }
	printf("\n");
}

void select(struct card a[],int n){
        for(int i=0;i<n-1;i++){
        int ind = i ;
        for(int j=i;j<n;j++){
            if(a[j].value<a[ind].value){
                ind = j ;
            }
        }
        card tmp = a[i];
        a[i] = a[ind];
        a[ind] = tmp;
    }
}

void bubble(struct card a[], int n){
    int flag= 1;
    while(flag){
        flag = 0;
        for(int j=n-1;j>0;j--){
            if(a[j].value<a[j-1].value){
                card tmp = a[j-1];
                a[j-1] = a[j];
                a[j] = tmp ;
                flag = 1;
            }
        }
    }
}

void Print(struct card a[], int n){
    for(int i=0;i<n;i++){
        if(i>0)cout << " ";
        cout << a[i].suit << a[i].value;
    }
    cout << endl;
}

bool isstable(struct card a1[],struct card a2[],int n){
    for(int i=0;i<n;i++){
        if(a1[i].suit != a2[i].suit) return false ;
    }
    return true;
}

int main(){
    card a1[100], a2[100];
    int n;
    char ch ;
    
    cin >> n ;
    for(int i=0;i<n;i++){
        cin >> a1[i].suit >> a1[i].value;
    }
    for(int i=0;i<n;i++)a2[i]=a1[i];
    
    bubble(a1,n);
    select(a2,n);
    
    Print(a1,n);
    cout << "Stable" << endl;

    Print(a2,n);
    if(isstable(a1,a2,n)){
    cout << "Stable" << endl;
    }else{
    cout << "Not stable" << endl;
    }
    return 0 ;
}



Measured memory_bytes: 3092
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {
	int n, m, x, y;
	cin >> n >> m >> x >> y;
	vector<int> vx(n, 0), vy(m, 0);
	for (int i = 0; i < n; i++) {
		cin >> vx[i];
	}
	for (int i = 0; i < m; i++) {
		cin >> vy[i];
	}
	sort(vx.begin(), vx.end());
	sort(vy.begin(), vy.end());
	x = max(x, vx.back());
	y = min(y, vy[0]);
	if (x < y)
		cout << "No War" << endl;
	else
		cout << "War" << endl;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using str = string;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
const double PI = 3.141592653589793238;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define REP(i, m, n) for (int i = m; i < (int)n; i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greator<>()
#define d20 std::setprecision(20)
#define veci vector<int>
#define vecll vector<long long int>
#define vecd vector<double>
template <typename T>
T lcm(T a, T b)
{
	return a / __gcd(a, b) * b;
}
void comb(vector<vector<long long int>> &v)
{
	for (int i = 0; i < v.size(); i++)
	{
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (int 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]);
		}
	}
}
bool is_not_out_of_range(size_t now, size_t max_num)
{
	return !(now < 0 || max_num <= now);
}
int main()
{
	str s;
	cin >> s;
	int ans = 0;
	rep(i, s.size())
	{
		if (s.at(i) == '+')
		{
			ans++;
		}
		else
		{
			ans--;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
n = int( input() )

list = [input() for i in range(n)]

#print(list)

j = 0
k = 1
error = 0

while j < n-1:
    str1 = list[j]
    str2 = list[j+1]
    if str1[-1] == str2[0]:
        j += 1
        continue
    else:
        error += 1
        break

while k <= n:
    count = list.count(list[-k])
    if count != 1:
        error += 1
        break
    else:
        k += 1
        continue
        
if error == 0:
    print("Yes")
else:
    print("No")

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

using namespace std;
using p=pair<int,int>;
typedef long long ll;
const double pi=3.14159265;

int main() {
  ll n,m,ans;
  cin >> n >> m;
  ans=0;
  rep(i,m){
    ll a;
    cin >> a;
    ans+=a;
  }
  ll fin;
  if(ans<=n){
    fin =n-ans;
    cout << fin << endl;
  }
  else if(ans >n){
    cout <<-1<< endl;
  }
  return 0;
  
}

Measured memory_bytes: 3612
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<numeric>
#include<cctype>
#include<random>

using namespace std;

int keta(int a){
    int count=0;
    while(a!=0){
        a/=10;
        count++;
    }
    return count;
}


int main(){
    int n,w,h;
    cin>>h>>w>>n;
    int m=max(w,h);
    int ans=n/m;
    if(n%m!=0)
        ans++;
    cout<<ans<<endl;    



    return 0;
}

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

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

    vector<vector<int>> vec(N);
    int a, b;
    rep(i, M) {
        cin >> a >> b;
        a--, b--;
        vec[a].push_back(b);
        vec[b].push_back(a);
    }

    int G[N];
    rep(i, N) G[i] = -1;
    G[0] = 0;

    queue<int> que;
    que.push(0);

    while (!que.empty()) {
        int s = que.front();
        que.pop();

        for (auto t : vec[s]) {
            if (G[t] == -1) {
                G[t] = s;
                que.push(t);
            }
        }
    }

    bool ok = true;
    rep(i, N) if (G[i] == -1) ok = false;

    if (ok) {
        cout << "Yes" << endl;
        for (int i=1; i<N; i++) cout << G[i] + 1 << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 10072
public class Hello{
    public static void Main(){
        // Your code here!
        string[] sarray = System.Console.ReadLine().Trim().Split();
        int N = int.Parse(sarray[0]);
        int M = int.Parse(sarray[1]);
        string[] work_array = System.Console.ReadLine().Trim().Split();
        int work_day = 0;
        for(int i = 0; i < M; i++) {
            work_day += int.Parse(work_array[i]); 
        }
        int free_day = N - work_day;
        if(free_day >= 0) {
            System.Console.WriteLine(free_day);
        } else {
            System.Console.WriteLine(-1);
        }
        
    }
}


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

 
int main() {
   int n;
   cin>>n;
   vector<int> p(n);
   rep(i,n)cin>>p[i];
   rep(i,n){
       if(i+1!=p[i]){
           swap(p[i],p[p[i]-1]);
           break;
       }
   }
   rep(i,n){
       if(i+1!=p[i]){
           cout<<"NO"<<endl;
           return 0;
       }
   }
   cout<<"YES"<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>          // printf(), scanf()

#define MAX_N 500000
#define swap(a, b) { int t; t = a; a = b; b = t; }

void
max_heapify(int a[], int h, int i)
{
	int largest;

	int l = 2 * i;
	int r = 2 * i + 1;

	/* ????????????????????????????????§???????????§???node????????¶ */
	if (l <= h && a[l] > a[i])
		largest = l;
	else
		largest = i;

	if (r <= h && a[r] > a[largest])
		largest = r;

	if (largest != i) /* ????????????????????§????????´?????? */
	{
		swap(a[i], a[largest]);
		max_heapify(a, h, largest);
	}
}

int
main(int argc, char** argv)
{
	int a[MAX_N + 1];
	int h;
	int i;

	scanf("%d", &h);
	for (i = 1; i <= h; ++i)
		scanf("%d", &a[i]);

	for (i = h / 2; i >= 1; --i)
		max_heapify(a, h, i);

	for (i = 1; i <= h; ++i)
		printf(" %d", a[i]);

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

Measured memory_bytes: 2552
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

type Pos struct{
	cnt int
	x int
	y int
}

func main() {
	var h, w int
	fmt.Scanf("%d %d", &h, &w)
	s := make([][]int, h)
	for i := 0; i < h; i++ {
		s[i] = make([]int, w)
		var ss string
		fmt.Scanf("%s", &ss)
		for j, c := range ss {
			if c == '#' {
				s[i][j] = -1
			}
		}
	}

	max := 0
	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			sc := make([][]int, h)
			for k := 0; k < h; k++ {
				sc[k] = make([]int, w)
				copy(sc[k], s[k])
			}
			q := []Pos{{
				cnt: 0,
				x:   j,
				y:   i,
			}}
			length := mostDepth(sc, h, w, q)
			if length > max {
				max = length
			}
		}
	}

	fmt.Printf("%d", max)
}

func Max(x ...int) int {
	max := x[0]
	for _, v := range x {
		if v > max {
			max = v
		}
	}
	return max
}

func mostDepth(m [][]int, mi, mj int, q []Pos) (int) {
	max := 0
	for len(q) > 0 {
		v := q[0]
		q = q[1:]

		if v.y < 0 || v.y >= mi {
			continue
		}

		if v.x < 0 || v.x >= mj {
			continue
		}

		if m[v.y][v.x] != 0 {
			continue
		}

		max = v.cnt

		m[v.y][v.x] = -1

		q = append(q, Pos{
			cnt: v.cnt +1,
			x:   v.x + 1,
			y:   v.y,
		})
		q = append(q, Pos{
			cnt: v.cnt +1,
			x:   v.x - 1,
			y:   v.y,
		})
		q = append(q, Pos{
			cnt: v.cnt +1,
			x:   v.x,
			y:   v.y + 1,
		})
		q = append(q, Pos{
			cnt: v.cnt +1,
			x:   v.x,
			y:   v.y - 1,
		})
	}
	return max
}


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

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define MAX 100005
#define INF 1001001001

int main(int, char**)
{
  int n;
  cin >> n;
  int k;
  cin >> k;
  bitset<18> mask(0);
  rep(i,k) {
    int b; cin >> b;
    mask.set(b);
  }

  rep(i,1<<n) {
    bitset<18> b(i);
    if ((~b&mask).any()) continue;
    cout << i << ":";
    rep(j,n) if (b[j]) cout << " " << j;
    cout << endl;
  }

  return 0;
}



Measured memory_bytes: 3100
s = input()
if len(s)==1:
  print(0)
else:
  start0 = 0
  start1 = 0
  for i in range(0,len(s),2):
    if s[i]=="1":
      start0 += 1
  for i in range(1,len(s),2):
    if s[i]=="0":
      start0 += 1
  for i in range(0,len(s),2):
    if s[i]=="0":
      start1 += 1
  for i in range(1,len(s),2):
    if s[i]=="1":
      start1 += 1
  print(min(start0,start1))

Measured memory_bytes: 3188
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <set>
#include <iostream>
#include <map>
#include <functional>
#include <cstdlib>
#include <numeric>
#include <queue>
#include <complex>

using namespace std;

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

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> Point;

int main()
{
	int n, m;
	while(scanf("%d%d", &n, &m), n){
		vector<bool> persons(n, true);

		for(int pos=0, cnt=n; cnt>1; --cnt){
			for(int c=0;; pos = (pos+1)%n){
				c += persons[pos];
				if(c == m)
					break;
			}
			persons[pos] = false;
			pos = (pos+1)%n;
		}

		int ans;
		rep(i, n){
			if(persons[i]){
				ans = i+1;
				break;
			}
		}

		printf("%d\n", ans);
	}

	return 0;
}

Measured memory_bytes: 912
#include <iostream>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(void){
  int n;
  int a, cnt=0;
  int cnt2=0;
  cin >> n;
  r(i,n){
    cin >> a;
    if(a%4==0)cnt++;
    else if(a%2==0)cnt2++;
  }
  if(n/2<=cnt+cnt2/2)cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

using namespace std;

typedef long long ll;

const int INF = 1e9;

int main()
{
  int h, w;
  while (true) {
    fscanf(stdin, "%d %d", &h, &w);
    if (h == 0 && w == 0) { break; }
    for (int i = 0; i < h; ++i) {
      for (int j = 0; j < w; ++j) {
        if ((i + j) % 2 == 0) {
          printf("#");
        }
        else { printf("."); }
      }
      fprintf(stdout, "\n");
    }
    fprintf(stdout, "\n");
  }
  return 0;
}

Measured memory_bytes: 1168
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}


fn main() {
    input!{
        v: [i32; 3],
        k: usize,
    }

    let a = v[0];
    let mut b = v[1];
    let mut c = v[2];

    for _ in 0..k {
        if a >= b {
            b *= 2;
        } else if b >= c {
            c *= 2;
        }
    }

    if c > b && b > a {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2148