akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

long long mod = 1000000007;

long long f (long long a) {

  long long result = 1;

  for (int i = 1; i <= a; i++) {
    result *= i;
    result %= mod;
  }

  return result;
}


int main() {

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

  long long answer = 0;

  if (abs(N - M) <= 1) {
    if (N == M) {
      answer = f(N) * f(M) * 2;
    } else {
      answer = f(N) * f(M);
    }
    answer %= mod;
  }
  
  cout << answer << endl;

  return 0;

}

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

int main(){
  int N;
  cin >> N;
  vector<int> u(N);
  for (int i = 0; i < N; i++) cin >> u.at(i);
  sort(u.begin(),u.end());
  double sum = u.at(0);
  for (int i = 1; i < N; i++) sum = (sum + u.at(i)) / 2;
  cout << sum << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define int long long
#define double long double
#define PI 3.141592653589793
typedef long long ll;
const int MOD = 1000000007;
const int INF = LLONG_MAX;
const double EPS = 1e-10;
using namespace std;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

vector<int> divisor(int n){
  vector<int> ret;
  for(int i = 1;i*i <= n;i++){
    if(n%i == 0){
      ret.push_back(i);
      if(i*i != n)ret.push_back(n/i);
    }
  }
  sort(ret.begin(), ret.end());
  return ret;
}
int n;string ss[310];char c[6100][6100];
signed main() {
  cin>>n;rep(i,n)cin>>ss[i];
  rep(i,n)rep(j,n)c[i][j] = c[i+n][j] = c[i][j+n] = c[i+n][j+n] = ss[j][i];
  int ans = 0;
  rep(i,n){
    bool b = true;
    rep(j,n){
      rep(k,n){
        b = b && (c[i+j][k] == c[i+k][j]);
      }
    }
    if(b)ans += n-i;
  }
  repd(i,1,n){
    bool b = true;
    rep(j,n){
      rep(k,n){
        b = b && (c[j][k+i] == c[k][j+i]);
      }
    }
    if(b)ans += n-i;
  }
  cout << ans << endl;
}



Measured memory_bytes: 3968
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
int main()
{
   ll x,y,a,b,c;
   cin>>x>>y>>a>>b>>c;
   ll a1[a];
   ll b1[b];
   ll c1[c];
   for(ll i=0;i<a;i++)
   cin>>a1[i];
   for(ll i=0;i<b;i++)
   cin>>b1[i];
   for(ll i=0;i<c;i++)
   cin>>c1[i];
   ll ans=0;
   sort(a1,a1+a,greater<ll>());
   sort(b1,b1+b,greater<ll>());
   sort(c1,c1+c,greater<ll>());
  /* for(ll i=0;i<a;i++)
   cout<<a1[i]<<" ";
   cout<<endl;
   for(ll j=0;j<b;j++)
   cout<<b1[j]<<" ";
   cout<<endl;
   for(ll k=0;k<c;k++)
   cout<<c1[k]<<" ";
   cout<<endl;*/
   for(ll i=0;i<x;i++)
   ans=ans+a1[i];
   for(ll j=0;j<y;j++)
   ans=ans+b1[j];
   ll k1=x-1;
   ll k2=y-1;
   ll r=0;
  // cout<<ans<<endl;
   while(r<c && (k1>=0 || k2>=0) && ((k1>=0 && c1[r]>a1[k1]) || (k2>=0 && b1[k2]<c1[r])))
   {
      
      if(k1<0)
      {
         ans=ans-b1[k2]+c1[r];
         r++;
         k2--;
      }
      else if(k2<0)
      {
          ans=ans-a1[k1]+c1[r];
          r++;
          k1--;
      }
      else if(k1>=0 && k2>=0)
      {
      if(a1[k1]<b1[k2])
      {
          ans=ans-a1[k1]+c1[r];
          r++;
          k1--;
      }
      else if(a1[k1]>=b1[k2])
      {
          ans=ans-b1[k2]+c1[r];
          r++;
          k2--;
      }
      }
   }
   cout<<ans<<endl;
   return 0;
}


Measured memory_bytes: 2560
//競技プログラミング用のテンプレート
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <math.h>
#include <stack>

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

using namespace std;
using ll = long long int;
using p = pair<int, int>;
using pl = pair<ll, ll>;
using v = vector<int>;
using vd = vector<double>;
using vs = vector<string>;
using vl = vector<ll>;

int main()
{
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int tc = ( c + (b - 1) ) / b;
  int ac = ( a + (d - 1) ) / d;
  if(tc <= ac) {
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3616
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cmath>

using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}



int main(){
  ll n;
  cin>>n;
  vector<vector<ll>> f(n, vector<ll>(10));
  vector<vector<ll>> p(n, vector<ll>(11));
  for(ll i=0; i<n; i++)
    for(ll j=0; j<10; j++)
      cin>>f[i][j];
  for(ll i=0; i<n; i++)
    for(ll j=0; j<11; j++)
      cin>>p[i][j];

  ll ans = -10000000000;
  for(ll i=1; i<(1<<10); i++) {
    vector<ll> v(10);
    ll now = 0;
    for(ll j=0; j<10; j++) {
      if(i & (1<<j)) v[j] = 1;
      else v[j] = 0;
    }
    //std::cout << v << std::endl;
    for(ll k=0; k<n; k++) {
      ll cnt = 0;
      for(ll l=0; l<10; l++) {
	if(f[k][l]==1 and v[l]==1)
	  cnt++;
      }
      now+=p[k][cnt];
    }
    ans = max(now, ans);
  }
  std::cout << ans << std::endl;
  return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
#include<set>
#include<map>
#include<cmath>
#include<cstring>
using namespace std;

void read(string s,vector<string> &other,vector<string> &str){
    int state = 0;
    string now = "";
    for(int i=0;i<s.size();i++){
        if(s[i]=='"'){
            if(state==0){
                other.push_back(now);
            }else{
                str.push_back(now);
            }
            state = 1-state;
            now = "";
        }else{
            now+=s[i];
        }
    }
    if(state==0){
                other.push_back(now);
            }else{
                str.push_back(now);
            }
}

void deb(vector<string> v){
    for(int i=0;i<v.size();i++){
        cout << v[i];
        if(i!=v.size()-1)cout << " , ";
    }
    cout << endl;
}

int main(){
    string s1,s2;
    while(cin >> s1,s1!="."){
        cin >> s2;
        vector<string> other1,other2;
        vector<string> str1,str2;
        read(s1,other1,str1);
        read(s2,other2,str2);

        // deb(other1);
        // deb(other2);
        // deb(str1);
        // deb(str2);

        if(other1.size()!=other2.size()||str1.size()!=str2.size()){
            cout << "DIFFERENT" << endl;
            continue;
        }
        int state = 2;
        for(int i=0;i<other1.size();i++){
            if(other1[i]!=other2[i])state = 0;
        }
        int cnt = 0;
        for(int i=0;i<str1.size();i++){
            if(str1[i]!=str2[i]){
                if(state==2){
                    state=1;
                }else if(state==1){
                    state=0;
                }
            }
        }
        if(state==2){
            cout << "IDENTICAL" << endl;
        }else if(state==1){
            cout << "CLOSE" << endl;
        }else{
            cout << "DIFFERENT" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3224
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;
using ll = long long;

int main() {
  ll n;
  cin >> n;
  vector<ll> vec(n);
  for (auto &v : vec)
    cin >> v;

  ll g = vec[0];
  for (int i = 1; i < n; ++i) {
    g = g / __gcd(g, vec[i]) * vec[i];
  }

  cout << g << endl;
}


Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int main() {
    int n; cin >> n;
    n %= 10;
    if (n == 2 || n == 4 || n == 5 || n == 7 || n == 9) {
        cout << "hon" << endl;
    } else if (n == 0 || n == 1 || n == 6 || n == 8) {
        cout << "pon" << endl;
    } else {
        cout << "bon" << endl;
    }
    return 0;
}

Measured memory_bytes: 3624
#include<iostream>
using namespace std;
int main() {
  int a,b,c,d; cin >> a >> b >> c >> d;
  if(b<c || d<a) cout << 0 << endl;
  else if(a<=c){
    if(b<=d) cout << b-c << endl;
    else cout << d-c << endl;
  }
  else if(c<=a){
    if(d<=b) cout << d-a << endl;
    else cout << b-a << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void) {
  long long N, K;
  cin >> N >> K;
  long long ans = 0;
  if (K%2==1) {
    ans = (N/K)*(N/K)*(N/K);
  } else {
     long long ans1 = (N/K)*(N/K)*(N/K);
     long long ans2 = 0;
     for (int a = 1; a <= N; a++) {
       if (a%K==(K/2)) ans2++;
     }
     ans2 = ans2*ans2*ans2;
     ans = ans1+ans2;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int N = 210;
typedef long long ll;
int d, t, s;

int main() {
	
	cin >> d >> t >> s;
	if(s*t >= d) {
		puts("Yes");
	}else {
		puts("No");
	}
	
	return 0;
}

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

int main() {
	int count;
	int integer;
	int basenumber;
	count = 0;
	cin >> integer >> basenumber;
	while (true) {
		count = count + 1;
		integer = integer / basenumber;
		if (integer == 0) {
			break;
		}
	}
	cout << count;
	return 0;
}

Measured memory_bytes: 256
#include <cstring>
#include <cassert>
#include <utility>
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <bitset>
#include <chrono>
#include <cstdlib>
#include <functional>
#include <tuple>
#include <climits>
#include <limits>
#include <deque>
#include <list>
#include <array>
#include <stack>
#include <queue>
#include <random>
#include <complex>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define ll              long long
#define pi              pair<int,int>
#define pll             pair<ll,ll>
#define pb              push_back
#define F               first
#define S               second
#define vi              vector<int>
#define vll             vector<ll>
#define endl            '\n'
#define all(v)          (v).begin(),(v).end()
#define MP(a,b)         make_pair(a,b)
#define debug(x)        cerr<< #x << " : " << x << endl;
#define debugp(p)       cerr<< #p << " : " << "(" << (p).first << "," << (p).second << ")\n";
#define debugv(v)       cerr<< #v << " : " << "["; for(int i = 0; i < (v).size(); i++) cerr << v[i] << " "; cerr<<"]\n";
#define debugs(m)       cerr<< #m << " : [ "; for(auto itr = m.begin(); itr != m.end(); itr++) cerr <<*itr << " "; cerr << "]\n";
#define debugm(m)       cerr<< #m << " : [ "; for(auto itr = m.begin(); itr != m.end(); itr++) cerr <<"(" << itr->first << "," << itr->second << ") "; cerr << "]\n";

/* ordered set: 
tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>
member functions :
1. order_of_key(k) : number of elements strictly lesser than k
2. find_by_order(k) : k-th element in the set
*/

inline ll modexp(ll x, ll ex , ll md) {
    ll ans = 1ll;
    while (ex > 0) {
        if (ex & 1ll) ans = (ans * x) % md;
        ex >>= 1ll;
        x = (x * x) % md;
    }
    return ans;
}

const int inf = 1e9 + 7;

void solve(){
    int n;
    cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; i++){
        cin >> a[i];
    }
    vector<ll> b(n , 0);
    for (int bit = 0; bit < 45; bit++){
        int o = 0;
        for (int i = 0; i < n; i++){
            if (a[i] & (1ll << bit)) ++o;
        }
        for (int i = 0; i < n; i++){
            if (o & 1){
                if ( !(a[i] & (1ll << bit)) ) b[i] |= (1ll << bit);
            } else{
                if (a[i] & (1ll << bit)) b[i] |= (1ll << bit);
            }
        }
    }

    for (int i = 0; i < n; i++){
        cout << b[i] << " ";
    }
    cout << endl;
}
int main(){
    ios :: sync_with_stdio(false); 
    cin.tie(nullptr); 
    cout.tie(nullptr);
    
    int T = 1;
    // cin >> T;
    for(int tc = 1; tc <= T; tc++){
        // cout << "Case #" << tc << ": ";
        solve();
    }
    #ifdef LOCAL
    cerr << "Time elapsed\t: " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";       
    #endif
}



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

int x;
int n = 6;
array<int, 6> a;
bool dp[7][100005];

void input() {
    cin >> x;
    a.at(0) = 100;
    a.at(1) = 101;
    a.at(2) = 102;
    a.at(3) = 103;
    a.at(4) = 104;
    a.at(5) = 105;

}

void solve() {
    dp[0][0] = true;

    for(int i = 0; i < n; i++) {
        for(int j = 0; j <= x; j++) {
            for(int k = 0; k <= 2000 && k * a[i] <= j; k++) {
                dp[i+1][j] |= dp[i][j-k*a[i]];
            }
        }
    }

    if(dp[n][x]) cout << 1 << endl;
    else cout << 0 << endl;

}
int main() {
    input();
    solve();
}


Measured memory_bytes: 896
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<map>
#include<set>

using namespace std;

typedef long long ll;
typedef std::vector<int> VI;

#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())

int main() {

	int a, b, n, t[1001] = {}, ans = 0;
	cin >> a >> b;
	cin >> n;
	VI s(n), f(n);
	FOR(i, n) {
		cin >> s[i] >> f[i];
		t[s[i]]++;
		if (f[i] < 1000)t[f[i] + 1]--;
	}
	eFOR1(i, 1000)t[i] += t[i - 1];
	FOR(i, n) {
		t[s[i]] += 10;
		t[f[i]] -= 10;
	}
	for (int i = a; i <= b; i++) {
		if (i == a) {
			if (t[i] >= 1) {
				ans++;
				break;
			}
		}
		else if (i == b) {
			if (t[i] == 1 || t[i] < 0) {
				ans++;
				break;
			}
		}
		else {
			if (t[i] != 0) {
				ans++;
				break;
			}
		}
	}
	cout << ans << endl;

	return 0;
}



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

#define fr first
#define se second

using namespace std;

const long long N = 2e5 + 7;
const long long inf = 1e9 + 7;
const long long mod = 1e9 + 7;

int n;
int a[N];
int used[N];
long long k;
vector<int> g;
int main()
{
    ios_base::sync_with_stdio(false);

    cin >> n >> k;
    for(int i = 1; i <= n; i ++){
        cin >> a[i];
    }
    int cur = 1;
    while(k > 0 && used[cur] == 0){
        used[cur] = 1;
        cur = a[cur];
        k --;
    }
    if(k == 0){
        cout << cur << "\n";
        return 0;
    }
    memset(used, 0, sizeof used);
    while(used[cur] == 0){
        used[cur] = 1;
        g.push_back(cur);
        cur = a[cur];
    }
    cout << g[k % (int)g.size()] << "\n";
}


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

int main()
{
    int a;
    cin >> a;
    if(a < 1200){
         cout << "ABC" << endl;
    }else if(a >1199 && a < 2800){
         cout << "ARC" << endl;
   }else{
         cout << "AGC" << endl;
   }
}

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

typedef long long ll;

ll gcd(ll a, ll b) {
  while(1) {
    if(a < b) swap(a, b);
    if(!b) break;
    a %= b;
  }
  return a;
}

int main() {
  ll n;
  cin >> n;
  ll a = 1, b = 1;
  bool flag = true;
  for (ll i = 1; i*i <= n; i++) {
    if (n%i == 0) {
      a = i;
      b = n/i;
    }
  }
  cout << a + b - 2 << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>

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

using namespace std;

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

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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> P1;
typedef pair<P, P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i, x) for (long long i = 0; i < x; i++)
#define repn(i, x) for (long long i = 1; i <= x; i++)
#define SORT(x) sort(x.begin(), x.end())
#define ERASE(x) x.erase(unique(x.begin(), x.end()), x.end())
#define POSL(x, v) (lower_bound(x.begin(), x.end(), v) - x.begin())
#define POSU(x, v) (upper_bound(x.begin(), x.end(), v) - x.begin())
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rrepn(i, n) for (int i = ((int)(n)); i > 0; --i)
#define SZ(x) ((int)(x).size())
template <class T> bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
vector<pair<string, P> > vec;
// vector<vector<int>> data(3, vector<int>(4));

int main() {
    long long A;
    scanf("%lld", &A);
    string B;
    cin >> B;
    ll b = (B[0] - '0') * 100 + (B[2] - '0') * 10 + (B[3] - '0');
    cout << A * b / 100 << endl;
    return 0;
}


Measured memory_bytes: 3672
#include<bits/stdc++.h>
using namespace std;
string to_string(const string& s) {
	return '"' + s + '"';
}
string to_string(const bool b) {
	return (b ? "true" : "false");
}
string to_string(const char* s) {
	return to_string((string)s);
}
string to_string(const char c) {
	string s = "'";
	s += c;
	s += "'";
	return s;
}
template<class T, class U>
string to_string(const pair<T, U>& p) {
	string s = "(";
	s += to_string(p.first);
	s += ", ";
	s += to_string(p.second);
	s += ")";
	return s;
}
template<class T>
string to_string(const T& a) {
	bool first = true;
	string s = "{";
	for (const auto& x : a) {
		if(!first){
			s += ", ";
		}
		first = false;
		s += to_string(x);
	}
	s += "}";
	return s;
}
void debug_out() {cerr << '\n';}
template<class Head, class... Tail>
void debug_out(Head head, Tail... tail) {
	cerr << ' ' << to_string(head);
	debug_out(tail...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "] = ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
using ll = long long;
using ld = long double;
const int mod = 998244353;
const int inf = 1e9 + 100;
const ll inf64 = 7e18l;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(20);
	int a, b;
	cin >> a >> b;
	if (a % 2 == 0 || b % 2 == 0) {
		cout << "Even\n";
	} else {
		cout << "Odd\n";
	}
 	return 0;
}


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

using namespace std;

using ll = long long;

int main()
{
    int x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;
    vector<int> p(a);
    vector<int> q(b);
    vector<int> r(c);
    for (int i = 0; i < a; i++) {
        cin >> p[i];
    }
    for (int i = 0; i < b; i++) {
        cin >> q[i];
    }
    for (int i = 0; i < c; i++) {
        cin >> r[i];
    }
    sort(p.begin(), p.end(), greater<int>());
    sort(q.begin(), q.end(), greater<int>());
    sort(r.begin(), r.end(), greater<int>());

    deque<int> ansdeq;
    for (int i = 0; i < x; i++) {
        ansdeq.push_back(p[i]);
    }
    for (int i = 0; i < y; i++) {
        ansdeq.push_back(q[i]);
    }
    for (int i = 0; i < c; i++) {
        ansdeq.push_back(r[i]);
    }
    sort(ansdeq.begin(), ansdeq.end(), greater<int>());
    int i = 0;

    ll ans = 0;
    for (int i = 0; i < x + y; i++) { 
        ans += ansdeq[i];
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 2560
using System;
using System.Linq;
using System.Collections.Generic;

namespace b
{
    class Program
    {
        static void Main(string[] args)
        {
            var _ = Console.ReadLine().Split();
            var a = long.Parse(_[0]);
            var b = long.Parse(_[1]);
            var c = long.Parse(_[2]);
            var k = long.Parse(_[3]);

            var total = 0L;
            if(a > 0){
                if(k >= a){
                    total += a;
                    k -= a;
                }else{
                    total += k;
                    k = 0;
                }
            }

            if(k > 0 && b > 0){
                k -= b;
            }

            if(k > 0 && c > 0){
                if(k >= c){
                    total -= c;
                }else{
                    total -= k;
                }
            }

            Console.WriteLine(total);
        }
    }
}


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

using namespace std;

int main(){
    int m;
    cin >> m;
    vector<int> B(m + 1);
    for (int i = 1; i <= m; i++) cin >> B[i];

    vector<int> C(m + 1);
    int ans = 0;

    for (int i = m; i > 0; i--){
        int bit = B[i];
        for (int j = 2 * i; j <= m; j += i){
            bit ^= C[j];
        }
        C[i] = bit;
        ans += bit;
    }

    cout << ans << endl;
    for (int i = 1; i <= m; i++){
        if (C[i] == 1)
            cout << i << " ";
    }

    cout << endl;

}

Measured memory_bytes: 2560
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String input = sc.next();
		sc.close();

		String ans = "";

		if (input.equals("22")) {
			System.out.println("Christmas Eve Eve Eve");
		} else if (input.equals("23")) {
			System.out.println("Christmas Eve Eve");
		} else if (input.equals("24")) {
			System.out.println("Christmas Eve");
		} else {
			System.out.println("Christmas");
		}

	}

}

Measured memory_bytes: 20820
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, const char *> R;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int P;

int modpow(int x, int k) {
  int a = 1;
  while (k > 0) {
    if (k & 1) a = (1LL*a*x) % P;
    x = (1LL*x*x) % P;
    k >>= 1;
  }
  return a;
}

int inv(int x) {
  return modpow(x, P-2);
}

bool failed;
R expr(const char *s);
R number(const char *s) {
  int x = 0;
  while ('0' <= *s && *s <= '9') {
    x = 10*x + (*s-'0');
    s++;
  }
  return R(x, s);
}

R factor(const char *s) {
  if (*s != '(') return number(s);
  s++;
  R r = expr(s);
  return R(r._1, r._2+1);
}

R term(const char *s) {
  int val = 1;
  do {
    bool div = false;
    if (*s == '*' || *s == '/') {
      if (*s == '/') div = true;
      s++;
    }
    R r = factor(s);
    int t = r._1;
    s = r._2;
    if (div) {
      if (r._1 == 0) {
        failed = true;
        t = 0;
      }
      else {
        t = inv(r._1);
      }
    }

    val = (1LL*val*t) % P;
    s = r._2;
  }
  while (*s == '*' || *s == '/');
  return R(val, s);
}

R expr(const char *s) {
  int val = 0;
  do {
    bool minus = false;
    if (*s == '+' || *s == '-') {
      if (*s == '-') minus = true;
      s++;
    }
    R r = term(s);
    int t = r._1;
    s = r._2;
    if (minus) t = (P-t) % P;

    val = (val+t) % P;
    s = r._2;
  }
  while (*s == '+' || *s == '-');
  return R(val, s);
}

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  string s;
  while (getline(cin, s)) {
    int i;
    P = 0;
    for (i=0; i<s.length(); i++) {
      if (s[i] == ':') break;
      P = 10*P + (int)(s[i]-'0');
    }
    if (P == 0) break;
    i++;
    string t = "";
    for (; i<s.length(); i++) {
      if (s[i] == ' ') continue;
      t += s[i];
    }
    failed = false;
    int val = expr(t.c_str())._1;
    if (failed) cout << "NG\n";
    else cout << t << " = " << val << " (mod " << P << ")\n";
  }
  return 0;
}

Measured memory_bytes: 3180
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
 
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
#define MAX_N 1000100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
 
ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

int main(){
    string s;
    cin >> s;
    
    if (s[0]==s[1] && s[1]!=s[2] && s[2]==s[3])cout << "Yes" << endl;
    else if (s[1]==s[2] && s[1]!=s[0] && s[0]==s[3])cout << "Yes" << endl;
    else if (s[0]==s[2] && s[0]!=s[1] && s[1]==s[3])cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#define M 2000001
#define N 100000
int partition(int *,int,int);

int main(){
  int i,k,j,n,r,p=0;
  int A[M];

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  r=n-1;
  
  k = partition(A, p, r);
  for(i=0;i<=r;i++){
    if(i>0){
      printf(" ");
    }
    
    if(i==k){
      printf("[%d]",A[i]);
    }
    else{      
      printf("%d",A[i]);
    }
  }
  printf("\n");
  return 0;
}

int partition(int *A,int q,int s)
{
  int x,i,j,t=0,l=0;
  x=A[s];
  i=q-1;
  for(j=q;j<=s-1;j++){
    if(x>=A[j]){
      i++;
      t=A[i];
      A[i]=A[j];
      A[j]=t;
    }
  }
  l=A[s];
  A[s]=A[i+1];
  A[i+1]=l;
  return i+1; 
}

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

int main(){
  int A,B;
  string S;
  cin>>A>>B>>S;
  int hantei=0;
  if(S.size()!=A+B+1) hantei++;
  else{
  if(S.at(A)!='-') hantei++;
  for(int i=0; i<A+B; i++){
    if(i==A) continue;
    else if(!iswdigit(S.at(i))) hantei++;
  } //i
  } //else
  if(hantei==0) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


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

int main() {
  int n;cin>>n;
  double x[n];
  string u[n];
  double sum=0;
  rep(i,n){
    cin>>x[i]>>u[i];
    if(u[i]=="BTC")x[i]=x[i]*380000.0;
    sum += x[i];
  }
  cout<<fixed<<setprecision(6);
  cout<<sum;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 998244353
#define pb push_back
#define ll long long int
#define con 1000000007
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll i,j,m,n,k;
    ll t;
    ll r=0;
    for(i=0;i<5;i++)
    {
        cin>>m;
        r++;
        if(m==0)
        {
            cout<<r;
            return 0;
        }
    }
}


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <climits>

using namespace std;

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

typedef long long LL;
typedef vector<int> VI;

int main() {
  string S;
  cin >> S;
  vector<int> arr(255);
  REP(i, S.length()) {
    arr[S[i]]++;
  }
  REP(i, 255) {
    if (!(arr[i] == 0 || arr[i] == 2)) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 764
S = list(input())
S_1 = int("".join(S[0:2]))
S_2 = int("".join(S[2:4]))



if 1 <= S_1 and S_1 <= 12 and 1 <= S_2 and S_2 <= 12:
    print("AMBIGUOUS")
elif 1 <= S_1 and S_1 <= 12:
    print("MMYY")
elif 1 <= S_2 and S_2 <= 12:
    print("YYMM")
else:
    print("NA")


Measured memory_bytes: 3060
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
/*----------------------------------------------------------------*/

// int MOD = 998244353;
int MOD = 1000000007;


/*----------------------------------------------------------------*/
signed main(){

    int A,B,M;
    cin >> A >> B >> M;

    vll a(A);
    vll b(B);
    rep(i,A)cin >> a[i];    
    rep(i,B)cin >> b[i];    

    vll x(M);
    vll y(M);
    vll c(M);
    rep(i,M)cin >> x[i] >> y[i] >> c[i];

    int ans = INF;
    int ma = INF;
    int mb = INF;
    rep(i,A)ma = min(ma,a[i]);
    rep(i,B)mb = min(mb,b[i]);
    ans = ma+mb;

    rep(i,M){
        ans = min(ans,a[x[i]-1]+b[y[i]-1]-c[i]);
    }
    cout << ans << endl;


	return 0;
}
/*----------------------------------------------------------------*/

// g++ -std=c++14 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2018-quala.contest.atcoder.jp/tasks/code_festival_2018_quala_c
// rm -r -f test;oj dl https://pakencamp-2019-day3.contest.atcoder.jp/tasks/pakencamp_2019_day3_c
// rm -r -f test;oj dl https://hitachi2020.contest.atcoder.jp/tasks/hitachi2020_a

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

int main ()
{
	int A, B;
	int min = -1;

	cin >> A >> B;

	int resultA, resultB;

	for (double i = 1; i < 10000; i++)
	{
		resultA = (int) (i * .08);
		resultB = (int) (i * .1);

		if (A == resultA && B == resultB)
		{
			if (-1 == min)
			{
				min = i;
			}
			else
			{
				cout << min;
				return 0;
			}
		}
	}

	cout << -1;


	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <stack>
using namespace std;
 
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)
 
int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};
int dx9[9]={0,1,0,-1,1,-1,1,0,-1};
int dy9[9]={0,1,1,1,0,0,-1,-1,-1};
 
typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;
 
const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;
// << fixed << setprecision
// --------------------------------------
#include <cassert>
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
 
int n, m;
mint dp[2100][2100];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
 
  cin >> n >> m;
  vector<int> s(n + 1);
  vector<int> t(m + 1);
 
  REP(i, n) cin >> s[i];
  REP(i, m) cin >> t[i];
 
  dp[0][0] = 1;
  REP(i, n + 1) REP(j, m + 1) {
    if(i > 0 && j > 0 && s[i - 1] == t[j - 1]) dp[i][j] += dp[i - 1][j - 1];
    if(i > 0) dp[i][j] += dp[i - 1][j];
    if(j > 0) dp[i][j] += dp[i][j - 1];
    if(i > 0 && j > 0) dp[i][j] -= dp[i - 1][j - 1];
  }
 
  cout << dp[n][m] << endl;
}

Measured memory_bytes: 38132
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <queue>
#include <string>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int> ;
using vl = vector<ll>;


bool mp[110][110];
int main(){

    rep(i,110){
        rep(j,110){
            mp[i][j] = true;
        }
    }
    int w,h,n;
    cin >> w >> h >> n;
    int x,y,a;
    rep(i,n){
        cin >> x >> y >> a;
        if(a == 1){
            rep(i,h){
                rep(j,x){
                    mp[i][j] = false;
                }
            }
        }else if(a == 2){
            rep(i,h){
                reps(j,x,w){
                    mp[i][j] = false;
                }
            }
        }else if(a == 3){
            rep(i,y){
                rep(j,w){
                    mp[i][j] = false;
                }
            }
        }else{
            reps(i,y,h){
                rep(j,w){
                    mp[i][j] = false;
                }
            }
        }
    }

    int cnt = 0;
    rep(i,h){
        rep(j,w){
            if(mp[i][j]){
                //cout << " W";
                cnt++;
            }
            else{
                //cout << " B";
            }
        }
        //cout << endl;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <vector>
#include <cstdio>
#include <cstdlib>

typedef long long int lld;
typedef unsigned long long int ulld;
const int mod = 1000000007;

using namespace std;

int power (int d, int z) {
	int re = 1;
	while (z) {
		if (z & 1) re *= d;
		d *= d;
		z = z >> 1;
	}
	return re;
}

int main (void) {
	ios::sync_with_stdio (false);
	int n, en = 0, re = 0, uinp;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> uinp;
		if (uinp & 1) en++;
	}
	re = power (3, n);
	re -= power (2, n - en);
	cout << re << endl;
	return 0;
}

Measured memory_bytes: 256
///-----Bismillahir Rahmanir Rahim-----///

#include<bits/stdc++.h>
using namespace std;

///---FAST I/O---///
#define Boost() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

///---DATA TYPE---///
typedef long long ll;
typedef long long int lli;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;

///---LOOP---///
#define rep0(i,n) for(i=0;i<n;i++)
#define rep1(i,n) for(i=1;i<=n;i++)

///---I/O---///
#define sf scanf
#define pf printf

///---OTHERS---///
#define pb push_back
#define all(c)		c.begin(),c.end()
#define MK make_pair
#define F first
#define S second
#define endl '\n'


///---INITIALIZATION---//
#define mem(a,b) memset(a, b, sizeof(a) )

///---CALCULATE---///
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))

///---BIT OPERATION---///
inline bool checkBit(ll n, int i)
{
    return n&(1LL<<i);
}
inline ll setBit(ll n, int i)
{
    return n|(1LL<<i);;
}
inline ll resetBit(ll n, int i)
{
    return n&(~(1LL<<i));
}

///------String/Char Related Functions-----///
string makeintString(int x)
{
    stringstream ss;
    ss << x;
    string str = ss.str();
    ///cout<<str<<endl;
    return str;
}
string makellString(ll x)
{
    stringstream ss;
    ss << x;
    string str = ss.str();
    ///cout<<str<<endl;
    return str;
}
char cpp(char c)
{
    return static_cast<char>(c + 1);
}

///------------Sorting STL----------///
struct func
{
    //this is a sample overloading function for sorting stl
    bool operator()(pii const &a, pii const &b)
    {
        if(a.F==b.F)
            return (a.S<b.S);
        return (a.F<b.F);
    }
};

///---CONSTANT---///
const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007

int main()
{
    Boost();

    int t;
    t=1;
    //cin>>t;
    while(t--)
    {
        string s,ans="";
        cin>>s;
        int n=s.size();
        for(int i=0; i<n; i++)
        {
            if(s[i]=='B')
            {
                if(!ans.empty()) ans.pop_back();
            }
            else ans+=s[i];
        }
        cout<<ans<<endl;
    }
    return 0;
}



Measured memory_bytes: 3604
#![allow(unused_imports)]

use std::cmp;
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::fmt;
use std::io::{self, BufWriter, Read, Write};
use std::ops::{Add, Div, Mul, Sub};
use std::str::{self, FromStr};


fn solve(s1: String, s2: String) -> char {
    let (s1, s2) = (s1.as_bytes(), s2.as_bytes());
    let (c1, c2) = (s1[0], s2[0]);
    if c1 > c2 {
        '>'
    } else if c1 < c2 {
        '<'
    } else {
        '='
    }
}


fn main() {
    let stdin = io::stdin();
    let mut sc = Scanner::new(stdin.lock().bytes());
    println!("{}", solve(sc.next(), sc.next()))
}


struct Scanner<R: Read> {
    buf: Vec<u8>,
    bytes: io::Bytes<R>,
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(bytes: io::Bytes<R>) -> Self {
        Scanner {
            buf: Vec::with_capacity(1024),
            bytes: bytes,
        }
    }

    fn next<T: FromStr>(&mut self) -> T
    where
        <T as FromStr>::Err: fmt::Debug,
    {
        let buf = &mut self.buf;
        buf.clear();
        self.bytes
            .by_ref()
            .map(Result::unwrap)
            .skip_while(|&c| c == ' ' as u8 || c == '\n' as u8)
            .take_while(|&c| !(c == ' ' as u8 || c == '\n' as u8))
            .foreach(|c| buf.push(c));
        str::from_utf8(&buf).unwrap().parse().unwrap()
    }

    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T>
    where
        <T as FromStr>::Err: fmt::Debug,
    {
        (0..n).map(|_| self.next()).collect()
    }

    fn pairs<T1: FromStr, T2: FromStr>(&mut self, n: usize) -> Vec<(T1, T2)>
    where
        <T1 as FromStr>::Err: fmt::Debug,
        <T2 as FromStr>::Err: fmt::Debug,
    {
        (0..n).map(|_| (self.next(), self.next())).collect()
    }

    fn trios<T1: FromStr, T2: FromStr, T3: FromStr>(&mut self, n: usize) -> Vec<(T1, T2, T3)>
    where
        <T1 as FromStr>::Err: fmt::Debug,
        <T2 as FromStr>::Err: fmt::Debug,
        <T3 as FromStr>::Err: fmt::Debug,
    {
        (0..n)
            .map(|_| (self.next(), self.next(), self.next()))
            .collect()
    }

    fn mat<T: FromStr>(&mut self, m: usize, n: usize) -> Vec<Vec<T>>
    where
        <T as FromStr>::Err: fmt::Debug,
    {
        (0..m).map(|_| self.vec(n)).collect()
    }
}


trait Foreach {
    type Item;
    fn foreach<F: FnMut(Self::Item)>(self, f: F);
}

impl<T, I: Iterator<Item = T>> Foreach for I {
    type Item = T;

    fn foreach<F: FnMut(T)>(self, mut f: F) {
        self.fold((), move |(), x| f(x));
    }
}


#[allow(dead_code)]
fn print_yesno(x: bool, yes: &'static str, no: &'static str) {
    println!("{}", if x { yes } else { no });
}


#[allow(dead_code)]
fn print_foreach<T: fmt::Display, I: IntoIterator<Item = T>>(xs: I) {
    let stdout = io::stdout();
    let mut stdout = BufWriter::new(stdout.lock());
    for x in xs.into_iter() {
        writeln!(stdout, "{}", x).unwrap();
    }
    stdout.flush().unwrap();
}


#[allow(dead_code)]
fn print_or<T: fmt::Display>(x: Option<T>, or: &'static str) {
    if let Some(x) = x {
        println!("{}", x);
    } else {
        println!("{}", or);
    }
}


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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    int d[102];
    int sum = 0;
    cin >> n;
    rep(i,n) cin >> d[i];
    for(int i = 0; i < n; i++) {
        for(int j = i+1; j < n; j++){
            sum += d[i] * d[j];
        }
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <ios>
#include <iomanip>
#include <cstdlib>
using namespace std;
int main(void){
  int N,M;
  cin >> N >> M;

  vector<vector<long> >card(M,vector<long>(2,0));

  for(int i=0;i<M;i++){
    cin >> card[i][0];
    cin >> card[i][1];
  }

  int min = card[0][0];
  int max = card[0][1];

  bool exist = true;
  for(int i=0;i<M;i++){
    if(min > card[i][1] || max < card[i][0]){
      exist = false;
      break;
    }
    else{
      if(min < card[i][0])
      min = card[i][0];
      if(max > card[i][1])
      max = card[i][1];
    }
  }

  if(exist)
  cout << max - min + 1 << endl;
  else
  cout << 0 << endl;

  return 0;
}


Measured memory_bytes: 5760
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <ctime>
using namespace std;
#define ll long long
#define ull unsigned long long
#define mst(a,b) memset((a),(b),sizeof(a))
#define pii pair<int,int>
#define pII pair<ll,ll>
#define pi acos(-1)
#define pb push_back
const double eps = 1e-6;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int MAXN = 1e5 + 10;
const int MAXM = 1e6 + 10;

char s[MAXN];
int a[MAXN];

int main() {
#ifdef local
    freopen("data.txt","r",stdin);
//    freopen("data.txt","w",stdout);
#endif
    scanf("%s",s);
    int len=strlen(s),ans=1e6;
    for(int i=0; i<len-1; i++)
        if(s[i]!=s[i+1]) ans=min(ans,max(i+1,len-i-1));
    if(ans==1e6) ans=len;
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
 #include <cstdio>
using namespace std;
	int main(){
		int a , b ;
		double x , y ;
		cin >> a >> b ;
		1 <= a , b <= 10*10*10*10*10*10*10*10*10;
		x = a ;
		y = b ;
		printf("%d %d %.8lf \n", a / b , a % b , x / y );
}

Measured memory_bytes: 1192
#include <stdio.h>
#include <string.h>

int main(int argc, char const *argv[]) {

  char cN[5];
  int N;
  fgets(cN, 5, stdin);
  sscanf(cN, "%d", &N);

  char str1[120];
  char str2[120];
  char strb[250];

  fgets(strb, 250, stdin);
  sscanf(strb, "%s %s", str1, str2);

  char str3[250];

  for (int i = 0; i < N; i++) {
    str3[2 * i] = str1[i];
    str3[2 * i + 1] = str2[i];
  }

  str3[2 * N] = '\0';

  printf("%s\n", str3);

  return 0;

}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <deque>

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

using namespace std;

int main() {

	int n;
	cin >> n;
	vector<int>d(n);
	rep(i, n)
		cin >> d[i];

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

	cout << d[n / 2] - d[n / 2-1] << endl;

	return 0;
}

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

using namespace std;

typedef long long int ll;

int main(void)
{
	int n;
	vector<ll> a;
	cin >> n;
	map<ll, ll> m;
	for (int i = 0; i < n; ++i)
	{
		ll ai;
		cin >> ai;
		m[ai]++;
		a.push_back(ai);
	}
	if (m.size() > 3)
	{
		cout << "No" << endl;
	}

	if (m.size() == 3)
	{
		ll keys[3];
		ll nums[3];
		int ptr = 0;
		for (auto it = m.begin(); it != m.end(); ++it)
		{
			keys[ptr] = it->first;
			nums[ptr] = it->second;
			ptr++;
		}
		if (keys[0] == (keys[1] ^ keys[2]) && nums[0] == nums[1] && nums[1] == nums[2])
		{
			cout << "Yes" << endl;
		}
		else
		{
			cout << "No" << endl;
		}
	}
	else if (m.size() == 1)
	{
		ll key;
		ll num;
		int ptr = 0;
		for (auto it = m.begin(); it != m.end(); ++it)
		{
			key = it->first;
			num = it->second;
			ptr++;
		}
		if (key == 0)
		{
			cout << "Yes" << endl;
		}
		else
		{
			cout << "No" << endl;
		}
	}
	else if (m.size() == 2)
	{
		ll keys[2];
		ll nums[2];
		int ptr = 0;
		for (auto it = m.begin(); it != m.end(); ++it)
		{
			//cout << it->first << " " << it->second << endl;
			keys[ptr] = it->first;
			nums[ptr] = it->second;
			ptr++;
		}
		if (keys[0] == 0)
		{
			if (nums[1] / 2 == nums[0])
			{
				cout << "Yes" << endl;
			}
			else
			{
				cout << "No" << endl;
			}
		}
		else if (keys[1] == 0)
		{
			if (nums[0] / 2 == nums[1])
			{
				cout << "Yes" << endl;
			}
			else
			{
				cout << "No" << endl;
			}
		}
		else
		{
			cout << "No" << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 5748
#include<iostream>
#include<string>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main()
{
    int k;
    string s;
    cin>>k>>s;
    if(s.size()<=k)
    {
        cout<<s<<endl;
        return 0;
    }

    string sub=s.substr(0,k);
    cout<<sub+"..."<<endl;

    return 0;
}

Measured memory_bytes: 3632
#include<cstdio>
#include<vector>
#include<queue>
using namespace std;
int n,m;
int ins[100006], length[100006];
int best;
vector<int> nbrs[100005];
queue<int> q;

inline int maks(int a, int b){
	return a>b?a:b;
}

int main(){

	scanf("%d %d", &n, &m);
	for(int i=0;i<m;i++){
		int a, b;
		scanf("%d %d", &a, &b);
		nbrs[a].push_back(b);
		ins[b]++; 
	}
	for(int i=1;i<=n;i++){
		if(!ins[i])q.push(i);
	}
	while(!q.empty()){
		int v = q.front(); q.pop();
		for(int w : nbrs[v]){
			length[w] = maks(length[w], length[v]+1);
			best = maks(best, length[w]);
			ins[w]--; if(!ins[w])q.push(w);
		}
	}
 	printf("%d\n", best);
}


Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long int
#define ull unsigned long long int  // ranges from (0 - twice of long long int)
#define rep(i,a,n) for (ll i=a;i<n;i++)
#define per(i,a,n) for (ll i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define vll vector<ll>
#define mod 1000000007LL
#define llpair pair<ll,ll>
#define INF 1000000000000000000ll
#define np next_permutation
#define PI acos(-1)
#define deb(x) cout<<#x<<" "<<x<<endl;
#define rotate_left(vec,amt) rotate(vec.begin(),vec.begin()+amt,vec.end());
#define rotate_right(vec,amt) rotate(vec.begin(),vec.begin()+vec.size()-amt,vec.end());


int main() {
    auto start = chrono::high_resolution_clock::now();
    fio;
    ll t=1; 
	// cin>>t;
    while(t--)
    {	
			ll n; cin>>n;
			ll m=n-1;
			vector<int>vec;
			while(m--)
			{
				ll a; cin>>a; 
				vec.pb(a);
			}
			
			ll ans[n+1]={0};
			
			rep(i,0,vec.size())
			{
				ans[vec[i]]++;
			}
			
			for(int i=1;i<=n;i++)
			cout<<ans[i]<<"\n";
			
    }

    auto finish = chrono::high_resolution_clock::now();
    cerr << "Time elapsed: " << (chrono::duration<long double>(finish-start)).count() << "s\n";
    return 0;
        
}


Measured memory_bytes: 5596