akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<ll,double> P;
typedef tuple<ll,ll,ll> T;
const long long INF = 1LL<<60;
const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
// cout << fixed << setprecision(10) << ans << endl; 有効桁数指定
// *min_element(c + l, c + r) *max_element(c + l, c + r) 配列の中のmin-max
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// ~ は、-1の時だけfalse

ll dp[110][2][5];

int main() {
    string s;cin>>s;
    int k;cin>>k;
    int n = s.size();
    dp[0][0][0] = 1;
    rep(i,n) {
        int num = s[i] - '0';
        rep(j,5) {
            dp[i+1][1][min(4,j+1)] += 9*dp[i][1][j];
            dp[i+1][1][j] += dp[i][1][j];
        }
        if(num==0) {
            rep(j,5) dp[i+1][0][j] += dp[i][0][j];
        } else {
            rep(j,5) dp[i+1][0][min(4,j+1)] += dp[i][0][j];
        }
        // if(num==1) {
        //     if(i==0) continue;
        //     rep(j,5) dp[i+1][1][j] += dp[i][0][j];
        // } else if (num >= 2) {
        //     rep(k,num) {
        //         if(i==0) 
        //     }
        //     rep(j,5) dp[i+1][1][min(4,j+1)] += dp[i][0][j];
        // }

        if(num>=1) {
            rep(j,num) {
                // if(i==0&&j==0) continue;
                if(j==0) rep(p,5) dp[i+1][1][p] += dp[i][0][p];
                else rep(p,5) dp[i+1][1][min(4,p+1)] += dp[i][0][p];
            }
        }
    }
    cout << dp[n][0][k] + dp[n][1][k] << endl;
}

Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n, c, z = 0;
    string s;
    cin >> n >> s;
    c = n - 1;
    while (c >= 0 && s[c] == 'W') c--;
    for (int i = 0; i < c; i++) if (s[i] == 'W') {
        swap(s[i], s[c]);
        z++;
        c--;
        while (c >= 0 && s[c] == 'W') c--;
    }
    cout << z;
}


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

#define MAX_N 200010

vector <int> adjlist[MAX_N];

int main(void)
{
    int n, m;
    scanf("%d%d", &n, &m);
    for (int i = 0; i < m; i++) {
        int a, b;
        scanf("%d%d", &a, &b);
        adjlist[a].push_back(b);
        adjlist[b].push_back(a);
    }
    bool flag = false;
    for (int i = 0; i < adjlist[1].size(); i++) {
        int v = adjlist[1][i];
        for (int j = 0; j < adjlist[v].size(); j++) {
            if (adjlist[v][j] == n) {
                flag = true;
                break;
            }
        }
    }
    if (flag) printf("POSSIBLE\n");
    else printf("IMPOSSIBLE\n");
    return 0;
}


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

int main() {
  string S;
  cin >> S;
  vector<string> weathers = {"Sunny", "Cloudy", "Rainy"};
  if (S == weathers.at(0)) {
    cout << weathers.at(1) << endl;
  } else if (S == weathers.at(1)) {
    cout << weathers.at(2) << endl;
  } else {
    cout << weathers.at(0) << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ff        first
#define ss        second
#define ll        long long
#define int       long long
#define inf       ((ll)1e18)
#define mod       (ll)1e9+7
#define double    long double
#define ull       unsigned long long
#define vi        vector<ll>
#define ppi       pair<int,int>
#define pii       pair<pair<int,int>,int>
#define pb        push_back
#define pi        2*acos(0.0)
#define rev       greater<int>()
#define pr(a,x,y) for(int i=x;i<y;i++){cout<<a[i]<<" ";}
#define sp(x,y)   fixed<<setprecision(y)<<x
#define w(x)      ll x; cin>>x; while(x--)
#define all(v)    v.begin(), v.end()
#define rall(v)   v.rbegin(), v.rend()
#define test      cout<<"THIS_AND_THIS"<<endl;
#define str       string
#define endl      '\n'
#define e         cout<<'\n';
void kehsihba(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	/*#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif*/
}
void solve(){
	ll a,b,c;cin>>a>>b>>c;
	ll x=a+b+c;
	if(x>=22){cout<<"bust";}
	else{cout<<"win";}
}
int32_t main() {
	kehsihba();
	ll t=1;
	//cin>>t;
	while(t--){
		solve();
	}
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i > 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;

void trace(int a[], int n) {
  REP(i, n) {
    if (i > 0) cout << " ";
    cout << a[i];
  }
  cout << endl;
}

void insertionSort(int a[], int n) {
  int j, v;
  FOR(i, 1, n) {
    v = a[i];
    j = i - 1;
    while (j >= 0 && a[j] > v) {
      a[j + 1] = a[j];
      j--;
    }
    a[j + 1] = v;
    trace(a, n);
  }
}

int main() {
  int n;
  cin >> n;
  int a[n];
  REP(i, n) {
    cin >> a[i];
  }
  trace(a, n);
  insertionSort(a, n);
  return 0;
}


Measured memory_bytes: 3088
#include<bits/stdc++.h>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;
typedef long long int lli;
typedef vector<int> vi;
typedef vector<long long int> vlli;
typedef pair<int,int> pii;
typedef pair<long long int,long long int> plli;
typedef vector< vi > vvi ;
typedef vector< vlli > vvlli  ;
#define fi(i,a,b) for(int i=a;i<=b;i++)
#define flli(i,a,b) for(long long int i=a;i<=b;i++)
#define bi(i,a,b) for(int i=a;i>=b;i--)
#define blli(i,a,b) for(long long int i=a;i>=b;i--)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define all(x) x.begin(),x.end()
#define sz(x) x.size()
#define pi 2*acos(0.0)
#define pb push_back
#define tr(v,it) for(decltype(v.begin()) it=v.begin();it!=v.end();it++)
#define present(v,num) (v.find(num)!=v.end())
#define cpresent(v,num) (find(v.begin(),v.end(),num)!=v.end())
#define pq priority_queue
#define mp make_pair
const int inf=INT_MAX;
const lli INF =LLONG_MAX;
const lli mod = 1e9+7;
int main() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    fast;
    lli n,x,m;cin>>n>>x>>m;
    if(x==0)
    {
    	cout<<0;
    	return 0;
    }
    set<lli> allpos;
    vlli patt;
    lli var=x;
    allpos.insert(var);
    patt.pb(var);
    lli repnum;
    while(1)
    {
    	var=(var*var)%m;
    	if(present(allpos,var))
    	{
    		repnum=var;
    		break;
    	}
    	else
    	{
    		allpos.insert(var);
    		patt.pb(var);
    	}
    }
    lli ans=0;
    lli szpatt=sz(patt);
    lli ind=0;
    while(n!=0 && patt[ind]!=repnum)
    {
    	ans+=patt[ind];
    	n--;
    	ind++;
    }
    vlli arr;
    lli sumarr=0;
    flli(i,ind,szpatt-1)
    {
    	arr.pb(patt[i]);
    	sumarr+=patt[i];
    }
    lli szarr=sz(arr);
    lli repi=n/szarr;
    ans+=repi*sumarr;
    repi=n%szarr;
    flli(i,0,repi-1)
    {
    	ans+=arr[i];
    }
    cout<<ans<<endl;
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
    return 0;
}

Measured memory_bytes: 6704
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

N, A, B = inm()


def solve():
    mx = min(A, B)
    mi = max(A + B - N, 0)
    return (mx, mi)


print(*solve())


Measured memory_bytes: 9044
#include<stdio.h>
#include<cstdio>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<time.h>
#include<set>
#include<map>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i>b;i--)
#define vint vector<int> 
#define vvint vector<vint>
#define ct(a) cout<<a<<endl
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;
const ll mod = 1e9 + 7;

ll N,cnt;
vint A(100003);

int main() {
	cin >> N;
	FOR(i, 0, N) {
		int a; cin >> a;
		A[a]++;
		A[a+1]++;
		A[a + 2]++;
	}
	int ans=0;
	FOR(i, 0, 100003) {
		if (A[i] > ans)ans = A[i];
	}
	cout << ans << endl;

	return 0;
}

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

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line[] = br.readLine().split(" ");
		int k = Integer.parseInt(line[0]);
		int s = Integer.parseInt(line[1]);
		int count = 0;

		for (int i = 0; i <= k; i++) {
			for (int j = 0; j <= k; j++) {
				if (0 <= s - i - j && s - i - j <= k) {
					count++;
				}
			}
		}

		System.out.println(count);
	}

}


Measured memory_bytes: 22740
#include <bits/stdc++.h>
using namespace std;
int main(){
  uint64_t N,ct=0,max=0,i;
  cin>>N;
  std::vector<uint64_t> high(N);


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

  for(i=0;i<(N-1);i++){
    if(high.at(i)>=high.at(i+1)){
      ct++;
    }else{
      ct=0;
    }
    if(ct>max){
      max=ct;
    }
  }

  cout<<max<<endl;

  return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main(){
  int judge, in, sum, max, min;

  while(1){
    scanf("%d", &judge);
    if(judge==0) break;

    sum=0; max=0; min=1000;
    
    int i;
    for(i=0;i<judge;i++){
      scanf("%d", &in);
      sum += in;
      if(in >= max) max = in;
      if(in <= min) min = in;
    }
    
    printf("%d\n", (sum - max - min)/(judge-2));
  }
  
  return 0;
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int M, K;
std::vector<int> v;

bool can(){
    if((1 << M) <= K){
        return false;
    }

    if(M <= 1){
        if(K > 0){
            return false;
        }

        for(int i=0;i<(1<<M);++i){
            v.emplace_back(i);
            v.emplace_back(i);
        }

        return true;
    }

    std::vector<int> w;

    for(int i=0;i<(1<<M);++i){
        if(i == K){
            continue;
        }

        w.emplace_back(i);
    }

    int l = w.size();

    for(int i=l-1;i>=0;--i){
        v.emplace_back(w[i]);
    }

    v.emplace_back(K);

    for(int i=0;i<l;++i){
        v.emplace_back(w[i]);
    }

    v.emplace_back(K);

    return true;
}

int main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    
    std::cin >> M >> K;

    if(can()){
        int l = v.size();

        for(int i=0;i<l;++i){
            std::cout << v[i] << " \n"[i + 1 == l];
        }
    }else{
        std::cout << -1 << std::endl;
    }
}


Measured memory_bytes: 2928
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e4+10;
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int f=2;
    while(a>0&&c>0){
        if(f==2){
            c-=b;
            f=1;
        }
        else{
            a-=d;
            f=2;
        }
    }

    if(a<=0){
        printf("No\n");
    }
    else{
        printf("Yes\n");
    }
    return 0;
}


Measured memory_bytes: 3636
/*The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep.*/

//PRABHJOT SINGH A.K.A. PRABHI
//~~~~~conquizztador~~~~~


#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007
const int maxn= 100010;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n=0;
    cin>>n;
    vector<int> b(n-1);
    for(auto &i: b)
    	cin>>i;
    vector<int> a(n);
    a[0]=b[0];
    for(int i=1;i+1<n;++i)
    	a[i]=min(b[i],b[i-1]);
    a[n-1]=b[n-2];
    lli sum=0ll;
    for(auto i: a)
    	sum+=i;
    cout<<sum<<endl;
}

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

int main()
{
  int n;
  cin>>n;
  
  double ar[n+1];
  for(int i=0;i<n;i++)
  cin>>ar[i];
  
  double ans=0.0;
  double tmp=0.0;
  
  for(int i=0;i<n;i++)
  tmp+=1.0/ar[i];
  
  cout << fixed << setprecision(12) << 1.0 / tmp << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//pbds
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>   using orderedSet =tree<T, null_type, less<T>,rb_tree_tag, tree_order_statistics_node_update>;
///use less_equal in pbds template to work as multiset...................................................
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define pb push_back
//BFS+DFS
#define boundary(i,j) (i>=0 && i<n && j>=0 && j<m)
int X[]={-1,1,0,0};
int Y[]={0,0,1,-1};
/*
struct cmp{
bool operator()(const pii &a,const pii &b)
{
    if(a.first==b.first) return a.second<b.second;///second value small to big
    else return a.first>b.first;///first value big to small
}
};
///in pq true means swap required  ,false means swap  not required...
set<pii,cmp>st;
priority_queue<pii,deque<pii>,cmp>pq;
*/
int main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     int n;
     cin>>n;
     cout<<!n<<endl;
}




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

ll n;

main()
{
        cin>>n;
        vector<pair<ll,ll>> v;
        rep(i,n)
        {
                ll x,l;
                cin>>x>>l;
                v.push_back(make_pair(x+l-1,x-l+1));
        }
        sort(v.begin(),v.end());

        ll tmp=LLONG_MIN;
        ll cnt=0;
        for(auto it : v)
        {
                if(it.second<=tmp)continue;
                tmp=it.first+1;
                cnt++;
        }


        /*
        cout<<endl;
        for(auto it : v)
        cout<<it.first<<" "<<it.second<<endl;
        //*/

        cout<<cnt<<endl;

}

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

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

  vector<int64_t> L(N + 1);
  L.at(0) = 2;
  L.at(1) = 1;

  rep(i, N - 1) {
    L.at(i + 2) = L.at(i + 1) + L.at(i);
  }

  cout << L.at(N) << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int a[105];
int fab(int x)
{
    if(x<0)
        return -x;
    else return x;
}
int main()
{
    int n;
    scanf("%d",&n);
    a[0]=0;
    for(int i=1;i<=n;i++)
    {
        int x;
        scanf("%d",&x);
        a[i]=a[i-1]+x;
    }
     int minn=10000;
     for(int i=1;i<=n;i++)
    {
       if(fab(a[n]-a[i]-a[i])<minn)
        minn=fab(a[n]-a[i]-a[i]);
       if(fab(a[n]-a[i]-a[i])==0)
        break;
    }
    printf("%d\n",minn);
    return 0;
}











Measured memory_bytes: 128
// B - Battle
#include <bits/stdc++.h>
using namespace std;
int A,B,C,D;

bool solve(){
	int m[2][2];
	m[0][0] = A; // 先手　体力
	m[0][1] = B; // 先手　攻撃
	m[1][0] = C; // 後手　体力
	m[1][1] = D; // 後手　攻撃
	int at = 0;
	while(true){
		int df = (at+1)%2;
		m[df][0] -= m[at][1];
		if(m[df][0] <= 0){
			if(df%2) return true;
			return false;
		}
		at = df;
	}
	return false;
}

int main(){
	cin>>A>>B>>C>>D;
	cout<< (solve()? "Yes":"No") <<endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i < (n + 1); ++i)
using namespace std;
using ll = long long;
const int INF = +100100100;
// typedef pair<int,int> P;
const int MAX = 1000000;


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

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

int main(){
    ll n,y,ans=0,i,j,tmp;
    cin>>n>>y;
    for(i=0;i<=n;i++){
        for(j=0;j<=n-i;j++){
            if(10000*i+5000*j+1000*(n-i-j)==y){cout<<i<<" "<<j<<" "<<n-i-j<<endl; return 0;}
        }
    }
    cout<<"-1 -1 -1"<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
ll cnt[222222]={};
ll kaijo[222222]={};
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  cin>>n;
  vi D(n);
 
  for(auto &a:D){cin>>a;cnt[a]++;}
  if(D[0]!=0)cout<<0<<endl;
  else if(cnt[0]!=1){
    cout<<0<<endl;
  }else{
    ll ans=1;
    for(int i=1;i<=n;i++){
      if(cnt[i-1]==1){
      }else{
	ll kake=1;
	for(int j=0;j<cnt[i];j++){
	  kake*=cnt[i-1];
	  kake%=998244353;
	}
	ans*=kake;
	ans%=998244353;
      }
    }
    // cout<<"!"<<endl;
    cout<<ans<<endl;
  }
  
  return 0;
}


Measured memory_bytes: 1792
#include "bits/stdc++.h"

// clang-format off
template <typename T> T gcd(T a, T b) { return b == 0 ? a : gcd(b, a % b); }
template <typename T> T lcm(T a, T b) { return a * b / gcd(a, b); }
template <typename T> T clamp(T val, T min, T max) { return val < min ? min : (max < val ? max : val); }
template <typename T> size_t max_index(T begin, T end) { return distance(begin, max_element(begin, end)); }
template <typename T> size_t min_index(T begin, T end) { return distance(begin, min_element(begin, end)); }
// clang-format on

#define int long long
#define YES "YES"
#define NO  "NO"

using namespace std;

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

  bool flag = true;
  int num = 0;

  string c[2];
  for (int i = 0; i < 2; ++i) {
    cin >> c[i];
  }

  for (int i = 0; i < 3; ++i) {
    if (c[0][i] != c[1][2 - i]) flag = false;
  }
  
  // cout << num << endl;
  cout << (flag ? YES : NO) << endl;
  
  return 0;
}


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

int main() {
  int n, m;
  cin >> n >> m;
  
  priority_queue<int> a;
  int in;
  rep(i, n) {
    cin >> in;
    a.push(in);
  }
  
  rep(i, m) {
    int max = a.top();
    a.pop();
    a.push(max/2);
  }
  
  ll sum = 0;
  rep(i, n) {
    sum += a.top();
    a.pop();
  }
  cout << sum;
  return 0;
}

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

vi graphf[100005], graphb[100005];
vi label(100005, -1);
vi sz;

int main(){
    int n, m, k;
    cin >> n >> m >> k;
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        graphf[a].push_back(b);
        graphf[b].push_back(a);
    }
    rep(i, k) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        graphb[a].push_back(b);
        graphb[b].push_back(a);
    }
    int num = 0;
    rep(i, n) {
        if (label[i] >= 0) continue;
        label[i] = num;
        sz.push_back(1);
        int p;
        stack<int> todo;
        todo.push(i);
        while (!todo.empty()) {
            p = todo.top();
            todo.pop();
            for (int j : graphf[p]) {
                if (label[j] >= 0) continue;
                label[j] = num;
                todo.push(j);
                sz[num]++;
            }
        }
        num++;
    }
    rep(i, n) {
        int ans;
        ans = sz[label[i]] - 1 - graphf[i].size();
        for (int j : graphb[i]) {
            if (label[j] == label[i]) ans--;
        }
        printf("%d%c", ans, i==n-1?'\n':' ');
    }
    return 0;
}



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

using namespace std;

int main()
{
    int n,i,j,k,res=0;
    cin>>n;
    int f[200],s[200];
    for(i=0;i<n;i++){
        cin>>f[i]>>s[i];
    }
    for(i=0;i<=n-3;i++){
        if(f[i]==s[i]&&f[i+1]==s[i+1]&&f[i+2]==s[i+2]){
            cout<<"Yes";
            break;
        }
    }
    if(i==n-2)cout<<"No";
}

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

int main()
{
  int n, ans = 0;
  cin >> n;
  vector<vector<pair<int, int>>> v(n);
  for (int i = 0; i < n; ++i)
  {
    int a;
    cin >> a;
    v[i].resize(a);
    for (int j = 0; j < a; ++j)
    {
      cin >> v[i][j].first >> v[i][j].second;
      --v[i][j].first;
    }
  }
  for (int bit = 0; bit < (1 << n); ++bit)
  {
    bool judge = 1;
    // i人目の証言を検証
    for (int i = 0; i < n; ++i)
    {
      // i人目が不親切な場合は証言を聞かない
      if (!(bit & (1 << i)))
        continue;
      for (pair<int, int> xy : v[i])
      {
        int x = xy.first, y = xy.second;
        // 証言は正直だが、仮定は不親切
        if (y == 1 and !(bit & (1 << x)))
          judge = 0;
        // 証言は不親切だが、仮定は正直者
        else if (y == 0 and (bit & (1 << x)))
          judge = 0;
      }
    }

    if (judge)
    {
      // 正直者の数
      int count = 0;
      for (int i = 0; i < n; ++i)
      {
        if (bit & (1 << i))
          ++count;
      }
      ans = max(ans, count);
    }
  }
  cout << ans << "\n";
}

Measured memory_bytes: 256
(in-package "CL-USER")

(defun read-into-string-vector (stream)
  (let ((line-list '()))
    (loop
      (let ((line (read-line stream nil nil)))
	(unless line
	  (return))
	;;(print line)
	(push line line-list)))
    (setf line-list (nreverse line-list))
    (make-array (length line-list) :initial-contents line-list)))

;;;;;;;;;;;;;;;;;;;;

(defun get-n-integer-list (string n)
  (let ((old-index 0)
	(value-list '()))
    (loop repeat n
	  do
	  (multiple-value-bind (value new-index)
      	      (parse-integer string :start old-index  :junk-allowed t)
	    (push value value-list)
	    (setf old-index new-index)))
    (setf value-list (nreverse value-list))
    value-list))

;;;;;;;;;;;;;;;;;;;;

(defun test-data-set-up (f pathname)
  (with-open-file (input-stream pathname :direction :input :if-does-not-exist nil)
    (funcall f input-stream)))

;;;;;;;;;;;;;;;;;;;;

(defun station-and-bus (stream)
  (let ((data (read-into-string-vector stream)))
    (let ((s (svref data 0)))
      (cond ((and (eql (char s 0) (char s 1))
		  (eql (char s 1) (char s 2)))
	     (format *standard-output* "~&No~%"))
	    (t
	     (format *standard-output* "~&Yes~%")))
      (values))))

(defun test-station-and-bus (pathname)
  (test-data-set-up #'station-and-bus pathname))

(station-and-bus *standard-input*)
(sb-ext::exit)


Measured memory_bytes: 12256
#include<bits/stdc++.h>
using namespace std;
int a[200009];
int dp[100005 + 7];
int solve(int i,int n) {
    if (i == n - 1)
        return 0;
    if (dp[i] != -1)
        return dp[i];
    dp[i] = abs(a[i + 1] - a[i]) + solve(i + 1, n);
    if (i != n - 2)
        dp[i] = min(dp[i], abs(a[i + 2] - a[i]) + solve(i + 2, n));
    return dp[i];
}
int main() {
    int n;
    scanf("%d",&n);
    for(int i = 0;i<n;++i){
        scanf("%d",a+i);
    }
    memset(dp,-1,sizeof dp);
    printf("%d",solve(0,n));
}

Measured memory_bytes: 10728
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7


#############
# Main Code #
#############

N, A = getNM()
w = []
v = []
for i in range(N):
    a, b = getNM()
    w.append(a)
    v.append(b)
    
# limit回までコストカットできる
def knapsack_6(N, upper, limit, weight, value):
    dp = [[[0] * (upper + 1) for i in range(limit + 1)] for j in range(N + 1)]

    for i in range(N):
        # ボーナスでコスト１にするのを使ったか
        for j in range(limit + 1):
            for l in range(upper + 1):
                # コストカットできる時
                if j < limit:
                    dp[i + 1][j + 1][l] = dp[i][j + 1][l]
                    if l >= weight[i]:
                        dp[i + 1][j][l] = max(dp[i][j][l], dp[i][j][l - weight[i]] + value[i])
                        dp[i + 1][j + 1][l] = max(dp[i][j + 1][l], dp[i][j][l - 1] + value[i])
                    elif l >= 1:
                        dp[i + 1][j][l] = max(dp[i + 1][j][l], dp[i][j][l])
                        dp[i + 1][j + 1][l] = max(dp[i + 1][j + 1][l], dp[i][j][l - 1] + value[i])
                    else:
                        dp[i + 1][j][l] = dp[i][j][l]
                # できない時
                else:
                    if l >= weight[i]:
                        dp[i + 1][j][l] = max(dp[i + 1][j][l], dp[i][j][l - weight[i]] + value[i])
    return dp[N][limit][upper]

print(knapsack_6(N, A, 1, w, v))

Measured memory_bytes: 226816
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include<vector>
#include<iomanip>
#include<map>
#include <queue>
#include<cmath>
#include<cstdio>
#include<iomanip>
#include<set>
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long int;
 
#define REP(i,n) for(ll i=0;i<(ll)(n);i++) //REP(i, 5) cout<<i;
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define MOD 1000000007 //10^9+7
//#define MOD 1
 
ll gcd(ll a, ll b) {
  ll tmp;
  if ( b > a) {
    tmp = a;
    a = b;
    b = tmp;
  }
  while (a % b !=0) {
    tmp = b;
    b = a % b;
    a = tmp;
  }
  return b;
}
 
const int MAX = 1000;
 
ll table[MAX][MAX];
 
// テーブルを作る前処理
void COMinit() {
    table[0][0] = table[0][1] = 1;
    FOR(i, 1, MAX-1){
      FOR(j, 0, i+1){
        if(j==0) table[i][j] = 1;
        else if(j == i+1) table[i][j] = 1;
        else table[i][j] = table[i-1][j-1]+table[i-1][j];
      }
    }
}
 
// 二項係数計算
ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return table[n-1][k];
}

void sosuu(ll n, vector<ll> &v){

  vector<ll> num(n, 0);

  FOR(i, 1, sqrt(n)){
    if(num[i]==0){
      FOR(j, 0, n/i){
        num[i+(j*i)] = 1;
      }
    }
  }
  REP(i, n){
    if(num[i]==0) v.push_back(i+1);
  }
}

ll SORT(int n, vector<pair<ll, ll>> &v, int start){
  sort(v.begin()+start, v.end());
  return v[n-1].first;
}


int main(void){
 
  ll n;
  cin>>n;
  vector<pair<string, ll>> v(n);
  vector<pair<ll, ll>> m(n);

  REP(i, n){
    string s;
    ll p;
    cin>>s>>p;
    v[i] = make_pair(s, -p);
    m[i] = make_pair(-p, i);
  }

  sort(v.begin(), v.end());

  REP(i, n){
    REP(j, n){
      if(v[i].second==m[j].first){
        cout<<m[j].second+1<<endl;
        break;
      }
    }
  }

  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 a = sc.nextInt();
		int b = sc.nextInt();
		if(a < b){
			System.out.println("a < b");
		}
		else if(a > b){
			System.out.println("a > b");
		}
		else if(a == b){
			System.out.println("a == b");
		}
	}
}

Measured memory_bytes: 26328
using System;
using System.Linq;
using static System.Math;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            // Console.WriteLine("Hello World!");
            var n = int.Parse(Console.ReadLine());
            var h = Console.ReadLine().Split().Select(int.Parse).ToArray();

            var dp = new int[n];
            dp[0] = 0;
            dp[1] = Abs(h[1] - h[0]);

            for(int i=2;i<n;i++)
            {
                dp[i] = Min(dp[i-1] + Abs(h[i] - h[i-1]), dp[i-2] + Abs(h[i] - h[i-2]) );
            }

            Console.WriteLine(dp[n-1]);


        }
    }
}


Measured memory_bytes: 18016
import sys
readline = sys.stdin.readline
from heapq import heapify, heappush, heappop
INF = float("inf")
def MAIN():
    n = int(input())
    adj = [[]] * n
    for _ in range(0, n):
        U = list(map(int, input().split()))
        adj[U[0]] = zip(U[2::2], U[3::2])
    def dijkstra():
        d = [0] + [INF] * (n - 1)
        hq = [(0, 0)]
        while hq:
            u = heappop(hq)[1]
            for v, c in adj[u]:
                alt = d[u] + c
                if d[v] > alt:
                    d[v] = alt
                    heappush(hq, (alt, v))
        print("\n".join(f"{i} {c}" for i, c in enumerate(d)))
    dijkstra()
MAIN()



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

int main() {
	int n;

	while (cin >> n) {
		int ans = 0;
		for (int a = 0; a <= 9; a++) {
			for (int b = 0; b <= 9; b++) {
				for (int c = 0; c <= 9; c++) {
					for (int d = 0; d <= 9; d++) {
						if (a + b + c + d == n) ans++;
					}
				}
			}
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 2996
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <vector>
#include <queue>
#include <functional>
#include <math.h>
#include <string.h>

using std::endl;
using std::string;

#define ll long long int
#define LEP(a, n) for(int a = 0; a < n; ++a)
#define INF 123456789012345
#define OUT std::cout
#define IN std::cin
#define itn int
#define fro for
#define sdt std

ll N, X, ans;
ll data[123456];
ll after[123456];
ll old = 0;

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


int main()
{
	IN >> N >> X;
	LEP(a, N)
	{
		IN >> data[a];
	}
	data[N] = X;
	std::sort(data, data + N + 1);
	old = data[0];
	for(int a = 1; a <= N; ++a)
	{
		after[a - 1] = data[a] - old;
		old = data[a];
	}

	ans = after[0];

	LEP(a, N)
	{
		if(after[a] != 0)
		ans = gcd(ans, after[a]);
	}

	OUT << ans << endl;
	return 0;
}

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

int main(void)
{
    int n,k;
    cin>>n>>k;
    int sum=k;
    for(int i=1;i<=n-1;i++)
    {
        sum*=(k-1);
    }
    cout << sum <<endl;
    return 0;
}


Measured memory_bytes: 256
N,M = map(int,input().split())
l = [[] for i in range(N)]
for i in range(M):
    s,t = map(int,input().split())
    s -= 1
    t -= 1
    l[s].append(t)

dp = [0]*N
for i in range(N-2,-1,-1):
    dp[i] = 0
    for j in l[i]:
        dp[i] += dp[j]
    dp[i] /= len(l[i])
    dp[i] += 1

ans = dp[0]
for s in range(N-1):
    if len(l[s])==1:
        continue
    M = 0
    t = 0
    for j in l[s]:
        if M < dp[j]:
            M = dp[j]
            t = j
    dp_ = [0]*N
    for i in range(N-2,-1,-1):
        dp_[i] = 0
        for j in l[i]:
            if i != s or j != t:
                dp_[i] += dp_[j]
        if i != s:
            dp_[i] /= len(l[i])
        else:
            dp_[i] /= len(l[i])-1
        dp_[i] += 1
    ans = min(ans,dp_[0])
print(ans)

Measured memory_bytes: 66776
store = [int(i) for i in input().split()]
sum_store = sum(store)
store = [store]
while True:
    if any([i%2 for i in store[-1]]):
        print(len(store)-1)
        break
    else:
        new_store = [(sum_store - i ) //2 for i in store[-1]]
        if new_store in store:
            print(-1)
            break
        store.append(new_store)

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

typedef long long ll;
typedef pair <int, int> pii;

const int N = 1e5 + 5;

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);	
	int n;
	cin >> n;
	vector <int> a(n);
	ll sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
	}
	sum &= 1;
	cout << ((sum & 1)? "NO\n" : "YES\n");
}


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

int main(){
	int a, b,c;
	cin >> a >> b >> c;
	int ans;
	ans = c-(a-b);
	if(ans <0) ans = 0;
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  int ans=0;//output
  int num;//the number of input
  int i;//counter
  int x;//input
  int min;//the "current" minimum value
  scanf("%d",&num);
  for(i=0;i<num;i++)
    {
      scanf("%d",&x);
      if(i==0) min=x;
      else
	{
	  if(i==1) ans=x-min;
	  if(x-min>ans) ans=x-min;//update answer
	  if(min>x) min=x;//update minimum value
	}
    }
  printf("%d\n",ans);
  return 0;
}



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

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

    if(s.length()%2 == 0)   s = s.substr(0, s.length()-2);
    else                    s = s.substr(0, s.length()-1);

    while(1){
        int half = s.length()/2;
        if(s.substr(0,half) == s.substr(half,half)){
            break;
        }
        s = s.substr(0, half*2-2);
    }

    cout << s.length() << endl;
    return 0;
}

Measured memory_bytes: 256
/**
 *    +--+--+--++--++--In the name of ALLAH--++--++--+--+--+
 *
 *    author:  skmonir
 *    created: 01-Jun-2020 09:32:58
**/

#include <bits/stdc++.h>

using namespace std;

#define endl                '\n'
#define TN                  typename
#define mod                 998244353LL
#define len(x)              (int) x.size()
#define all(x)              x.begin(), x.end()
#define rall(x)             x.rbegin(), x.rend()
#define mem(x, y)           memset(x, y, sizeof x)
#define FOR(x, l, r)        for (int x = l; x <= r; ++x)
#define ROF(x, l, r)        for (int x = l; x >= r; --x)

template <TN T> inline void Int(T &n) {
    n = 0; int f = 1; int ch = getchar();
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
    for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
    n = n * f;
}

template <TN T> T gcd(T a, T b) {return !b ? a : gcd(b, a % b);}
template <TN T> inline void umin(T &a, T b) {a = a < b ? a : b;}
template <TN T> inline void umax(T &a, T b) {a = a > b ? a : b;}
template <TN T, TN W> inline void Int(T &x, W &y) {Int(x), Int(y);}
template <TN T, TN W, TN Q> inline void Int(T &x, W &y, Q &z) {Int(x, y), Int(z);}

const int N = 3e3 + 7;
const int inf = 1e9 + 7;

int n, s;
int A[N];
long long inv;
long long pwn;
long long dp[N][N];

template <TN T> inline T my_pow(T base, T exp, T md) {
    base %= md; T res = 1;
    if (base < 0) base += md;
    if (exp < 0) exp += md - 1;
    for (; exp > 0; exp >>= 1) {
        if (exp & 1) res = (res * base) % md;
        base = (base * base) % md;
    }
    return res;
}

long long call(int id, int taken, int sum) {
    if (sum == s) {
        return pwn;
    }
    if (sum > s || id > n) {
        return 0;
    }
    long long &res = dp[id][sum];
    if (~res) {
        return res;
    }
    res = call(id + 1, taken, sum);
    res += (inv * call(id + 1, taken + 1, sum + A[id])) % mod;
    res %= mod;
    return res;
}

int solve() {
    cin >> n >> s;
    for (int i = 1; i <= n; ++i) {
        cin >> A[i];
    }

    memset(dp, -1, sizeof dp);
    inv = my_pow(2LL, -1LL, mod);
    pwn = my_pow(2LL, 1LL * n, mod);

    cout << call(1, 0, 0) << endl;

    return 0;
}

int main() {
    int tests = 1, CaseNo = 0;
    // Int(tests);
    while (tests--) {
        //printf("Case %d: ", ++CaseNo);
        solve();
    }
    return 0;
}

Measured memory_bytes: 74416
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 1000000007;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}

template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}

template<typename T,typename Y>
ostream& operator<<(ostream& os,const pair<T,Y>& p){
  return os<<"{"<<p.fs<<","<<p.sc<<"}";
}
template<typename T> ostream& operator<<(ostream& os,const V<T>& v){
  os<<"{";
  for(auto e:v)os<<e<<",";
  return os<<"}";
}
template<typename ...Args>
void debug(Args&... args){
  for(auto const& x:{args...}){
    cerr<<x<<' ';
  }
  cerr<<ENDL;
}

long long modpow(long long a, long long n, long long MOD) {//a^n(MOD)を求める
    long long res = 1%MOD;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;//次の準備
        n >>= 1;
    }
    return res;
}

signed main(){
  cin.tie(0);cerr.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  ll n,scnt=0;cin>>n;
  string s;cin>>s;
  rep(i,0,n){
    if(s[i]=='1')++scnt;
  }


  ll plsn=0,mnsn=0;
  rep(i,0,n){
    plsn<<=1ll;
    if(scnt>1)mnsn<<=1ll;
    if(s[i]=='1'){
      plsn++;
      if(scnt>1)mnsn++;
    }
    
    plsn%=scnt+1;
    if(scnt>1)mnsn%=scnt-1;
  }

  ll ans=1,now;
  rep(i,0,n){
    ans=1;

    if(s[i]=='1'){
      if(scnt==1){
        cout<<0<<ENDL;
        continue;
      }

      now=mnsn;
      now+=scnt-1-(modpow(2,n-1-i,scnt-1));
      now%=scnt-1;
    }else{
      now=plsn;
      now+=(modpow(2,n-1-i,scnt+1));
      now%=scnt+1;
    }


    while(now>0){
      now=now%__builtin_popcountll(now);
      ++ans;
    }
    cout<<ans<<ENDL;
  }
}
//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int t = 1;
    while(a > 0 && c > 0) {
        if(t % 2 == 1) c -= b;
        else a -= d;
        ++t;

    }
    if(a <= 0) cout << "No";
    else cout << "Yes";
    cout << endl;
    return 0;
}



Measured memory_bytes: 3656
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <bitset>
#include <random>
#include <chrono>
#include <complex>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <cstring>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip> 

using namespace std;

#define sqr(x) ((x)*(x))
#define mp make_pair
#define pb push_back
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define RE(i, n) FOR(i,1,n)
#define REP(i,n) FOR(i, 0, (int)(n)-1)
#define fst first
#define snd second

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

string to_string(string s) {
    return '"' + s + '"';
}
    
string to_string(const char* s) {
    return to_string((string) s);
}
    
string to_string(bool b) {
    return (b ? "true" : "false");
}
    
template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
    
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

void fastIO() {
    cin.sync_with_stdio(false);
    cin.tie(0);
}


int XMOV[4] = {0, 0, 1, -1};
int YMOV[4] = {1, -1, 0, 0};

//#############################
const int MAXN = 1000005;
double memo[3005][3005];
int n;
vector<double> p;

double dp(int i, int h) {
    if (i == 0 && h == 0)
        return 1;
    if (i == 0)
        return 0;
    if (i < h)
        return 0;
    if (memo[i][h] < 0)
        return memo[i][h];
    return memo[i][h] = p[i]*dp(i-1,h-1) + (1-p[i])*dp(i-1, h);
}

int main() {
    cin >> n;
    double x=-1;
    p.pb(x);
    for (int i = 0;i < n; i++)
        cin >> x, p.pb(x);
    memset(memo, 0.00, sizeof(memo));
    memo[0][0] = 1.00;
    // for (int j = 1; j <= n; j++)
    //     memo[0][j] = 0.00;
    for (int i = 1; i <= n; i++){
        for (int j = 0; j <= i; j++){
            memo[i][j] = p[i]*memo[i-1][j-1] + (1-p[i])*memo[i-1][j];
        }
    }
    x = 0.00;
    for (int i = n; i >= n/2+1; i--) {
        // cout << memo[n][i] << endl;
        x += memo[n][i];
    }
    cout.precision(12);
    cout << x << endl;
    return 0;
}

Measured memory_bytes: 70912
#include <algorithm>
#include <functional>
#include <iostream>
#include <vector>

using namespace std;

template <typename T>
class BIT {
  vector<T> tree_;

 public:
  BIT(int n) : tree_(n, 0) {}
  void Add(int i, T x) {
    for (i++; i <= tree_.size(); i += i & -i) {
      tree_[i - 1] += x;
    }
  }

  T Sum(int s) {
    T ans = 0;
    for (s++; s > 0; s -= s & -s) {
      ans += tree_[s - 1];
    }

    return ans;
  }

  T Sum(int l, int r) { return Sum(r - 1) - Sum(l - 1); }
};

int main(int argc, const char *argv[]) {
  using ll = long long;
  int n;
  cin >> n;
  vector<vector<int>> vs(n);
  for (int i = 0; i < n; i++) {
    int c;
    cin >> c;
    vs[c - 1].push_back(i);
  }

  vector<vector<int>> tree(n);
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    tree[a].push_back(b);
    tree[b].push_back(a);
  }

  int k = 0;
  vector<int> in(n), out(n);
  function<void(int, int)> dfs;
  dfs = [&](int v, int p) {
    in[v] = k++;
    for (int u : tree[v]) {
      if (u != p) {
        dfs(u, v);
      }
    }

    out[v] = k;
  };

  dfs(0, -1);

  auto c2 = [](ll n) -> ll { return n * (n + 1) / 2; };
  ll tot = c2(n);
  BIT<ll> d(n);
  for (int i = 0; i < n; i++) {
    d.Add(i, 1);
  }

  for (int i = 0; i < n; i++) {
    ll ans = tot;
    vector<int> &nvs = vs[i];
    sort(nvs.begin(), nvs.end(), [&](int a, int b) { return in[a] > in[b]; });
    vector<pair<int, int>> history;
    for (int v : nvs) {
      int cnt = 1;
      for (int u : tree[v]) {
        if (in[u] < in[v]) {
          continue;
        }

        int num = d.Sum(in[u], out[u]);
        ans -= c2(num);
        cnt += num;
      }

      d.Add(in[v], -cnt);
      history.emplace_back(in[v], cnt);
    }

    ans -= c2(d.Sum(n - 1));
    for (auto p : history) {
      d.Add(p.first, p.second);
    }

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

  return 0;
}

Measured memory_bytes: 40936
#include <stdio.h>

int main(void) {
    double max, min, i, n;
    scanf("%lf",&max);
    min = max;
    while(scanf("%lf",&n) != EOF ) {
        if(max < n ) {
            max = n;
        }
        if(min > n ) {
            min = n;
        }
    }
    printf("%lf\n",max-min);
    return 0;
}

Measured memory_bytes: 648
#include <iostream>
#include <stdio.h>
#include <stdint.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <string>
#include <math.h>
#include <time.h>
#include <algorithm>
#include <deque>

using namespace::std;

int ri()
{
	int x;
	scanf("%d", &x);

	return x;
}

int64_t ri64()
{
	int64_t x;
	scanf("%lld", &x);

	return x;
}

void wi(int x)
{
	printf("%d\n", x);
}

void wvi(vector<int> &v)
{
	for (int i = 0; i < v.size(); i++)
		printf("%d ", v[i]);
	printf("\n");
}

void dbg(string &str, int x)
{
	cout << str << ": ";
	wi(x);
}

void dbg(string &str, vector<int> &x)
{
	cout << str << ": ";
	wvi(x);
}

int main()
{
	int N = ri();

	vector<int64_t> A(N);	
	for (int i = 0; i < N; i++)
		A[i] = ri();

	sort(A.begin(), A.end());

	int n = (N + 1) / 2;

	// Start with lowest
	int64_t ans = 0;

	if (N & 1)
	{
		int64_t u = 0;
		for (int i = 0; i < (n - 2); i++)
			u += 2 * A[i];

		u += A[n - 2];
		u += A[n - 1];

		int64_t v = 0;
		for (int i = n; i < N; i++)
			v += 2 * A[i];

		ans = max(ans, v - u); 
	}
	else
	{
		int64_t u = 0;
		for (int i = 0; i < (n - 1); i++)
			u += 2 * A[i];

		u += A[n - 1];

		int64_t v = A[n];
		for (int i = n + 1; i < N; i++)
			v += 2 * A[i];

		ans = max(ans, v - u);
	}

	// Start with highest
	reverse(A.begin(), A.end());
	if (N & 1)
        {
                int64_t u = 0;
                for (int i = 0; i < (n - 2); i++)
                        u += 2 * A[i];

                u += A[n - 2];
                u += A[n - 1];

                int64_t v = 0;
                for (int i = n; i < N; i++)
                        v += 2 * A[i];

                ans = max(ans, u - v);
        }
        else
        {
                int64_t u = 0;
                for (int i = 0; i < (n - 1); i++)
                        u += 2 * A[i];

                u += A[n - 1];

                int64_t v = A[n];
                for (int i = n + 1; i < N; i++)
                        v += 2 * A[i];

                ans = max(ans, u - v);
        }

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1024
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		
		String s = "No";
        int b = sc.nextInt();
		int c = sc.nextInt();
        if((a-b)*(b-c)*(c-a)==0 && (a!=b || b!=c || c!=a)){s = "Yes";}
		System.out.println(s);
	}
}


Measured memory_bytes: 25300