akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<stdbool.h>
#include<math.h>
#include<sstream>
#include<math.h>
#include<vector>
#include<functional>
#include<queue>
#include<utility>
#include<bitset>
typedef long long ll;
#define N (1000000000+7)
#define INF 1e10
using namespace std;
typedef pair<ll, ll> P;




int main(void) {
	ll n, W;
	cin >> n >> W;
	vector<ll>w(n), v(n), a, b, c, d;
	for (ll i = 0;i < n;i++) {
		cin >> w[i] >> v[i];
		if (w[i] == w[0])a.push_back(v[i]);
		if (w[i] == w[0] + 1)b.push_back(v[i]);
		if (w[i] == w[0] + 2)c.push_back(v[i]);
		if (w[i] == w[0] + 3)d.push_back(v[i]);
	}
	sort(a.begin(), a.end(), greater<ll>());
	sort(b.begin(), b.end(), greater<ll>());
	sort(c.begin(), c.end(), greater<ll>());
	sort(d.begin(), d.end(), greater<ll>());
	ll v1 = 0, v2 = 0, v3 = 0, v4 = 0, ma = 0;
	for (ll i = -1;i < (ll)a.size();i++) {
		v1 += i >= 0 ? a[i] : 0;
		v2 = 0;
		v3 = 0;
		v4 = 0;
		for (ll j = -1;j < (ll)b.size();j++) {
			v2 += j >= 0 ? b[j] : 0;
			v3 = 0;
			v4 = 0;
			for (ll k = -1;k < (ll)c.size();k++) {
				v3 += k >= 0 ? c[k] : 0;
				v4 = 0;
				for (ll m = -1;m < (ll)d.size();m++) {
					v4 += m >= 0 ? d[m] : 0;
					if (w[0] * (i + 1) + (w[0] + 1)*(j + 1) + (w[0] + 2)*(k + 1) + (w[0] + 3)*(m + 1) <= W) {
						ma = max(ma, v1 + v2 + v3 + v4);
					}
				}
			}
		}
	}
	cout << ma << endl;
	return 0;
}

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

using namespace std;
using lli = int_fast64_t;
using ulli = uint_fast64_t;
#define debug(x) cerr << #x << " : " << x << endl
#define debugv(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x << ", ";}cerr << endl
#define debugst(x) auto xt = x;cerr << #x << " : {";for(int i=0;i<x.size();i++){ cerr << xt.top() << ", ";xt.pop();}cerr << endl
#define debugvp(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x.first << " : " << value_of_x.second << ", ";}cerr << endl

const lli MOD = 1000000007;
const lli LIMIT = 1000000000000000000 * 5;
const int tenfive = 100000;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	cout << max(0, (b + c)-a) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>   //BAHMAN BAHMAN
#define ll long long
#define A(x) (x+(x&-x))
#define B(x) (x-(x&-x))
#define emad khar

using namespace std;

const ll mx1= 2e5+20;

ll f[3][mx1], n, q;

ll ask(ll l, ll r){
     ll mn=f[0][l];
     for(; A(l)<=r; l=A(l)) mn=min(mn, f[2][l]);
     for(; B(r)>=l; r=B(r)) mn=min(mn, f[1][r]);
     return min(mn, f[0][l]);
}

void update(ll p, ll v){
     f[0][p]=v;
     ll mn=v, l=p-1, r=p+1;
     for(int i=p; i<=n; i=A(i)){
          mn=min(mn, f[0][i]);
          for(; l>0 && B(l)+1>=B(i)+1; l=B(l)) mn=min(mn, f[1][l]);
          for(; r<=n && A(r)-1<=i; r=A(r)) mn=min(mn, f[2][r]);
          f[1][i]=mn;
     }
     mn=v, l=p-1, r=p+1;
     for(int i=p; i>0; i=B(i)){
          mn=min(mn, f[0][i]);
          for(; l>0 && B(l)+1>=i; l=B(l)) mn=min(mn, f[1][l]);
          for(; r<=n && A(r)-1<=A(i)-1; r=A(r)) mn=min(mn, f[2][r]);
          f[2][i]=mn;
     }
}

int main(){
     ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
     cin>>n>>q;
     for(ll i=1; i<=n; i++){
//          cin>>f[0][i];
          f[0][i]=(1LL<<31)-1;
          f[1][i]=f[2][i]=f[0][i];
     }
     for(ll i=1; i<=n; i++) f[1][A(i)]=min(f[1][A(i)], f[1][i]);
     for(ll i=n; i>=1; i--) f[2][B(i)]=min(f[2][B(i)], f[2][i]);
     for(; q; q--){
          ll typ, l, r;
          cin>>typ>>l>>r;
          if(typ==1) cout<<ask(l+1, r+1)<<'\n';
          else update(l+1, r);
     }
	return 0;
}


Measured memory_bytes: 5512
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <map> 
#include <set>
#include <vector>
#include <list>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define reps(s,i,n) for(int i=s;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define skip(i,n,p) for(int i=0;i<n;i+=p)
#define ll long long
#define debug cout << __FILE__ << ":" << __LINE__ << endl;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {
    if (v.empty()) {
        ostr << "{ }";
        return ostr;
    }
    ostr << "{" << v.front();
    for (auto itr = ++v.begin(); itr != v.end(); itr++) {
        ostr << ", " << *itr;
    }
    ostr << "}";
    return ostr;
}

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

void solve() {
    int N;
    cin >> N;

    if (N % 2 == 0) {
        cout << N / 2 - 1 << endl;
    } else {
        cout << (N + 1) / 2 - 1 << endl;
    }
}

int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
    cout.precision(20);
    cout << fixed;

    solve();
}


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

int main(){
  int a,b,ans; cin>>a>>b;
  if(1<=a&&a<=9&&b<=9&&1<=b){
    ans=a*b;
  }else{
    ans=-1;
  }

  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
int n, m;
vector<vector<int> > G;
vector<int> field;
vector<bool> visited;

void bfs(){
	queue<int> que;
	que.push(0);
	visited[0] = true;
	while(!que.empty()){
		int now = que.front(); que.pop();
		for(auto next : G[now]){
			if(!visited[next]){
				que.push(next);
				field[next] = now;
				visited[next] = true;
			} 
		}
	}
}

signed main(){
	cin >> n >> m;
	vector<lint> a(m), b(m);
	G.resize(n); 
  field.resize(n);
  visited.resize(n, false);
	for(int i = 0; i < m; i++){
		int a, b; cin >>a >> b;
		G[a - 1].push_back(b - 1); G[b - 1].push_back(a - 1);
	}
	bfs();
	cout << "Yes" << endl;
	for(int i = 1; i < n; i++) cout << field[i] + 1 << endl;
}


Measured memory_bytes: 13244
#![allow(non_snake_case)]
#![allow(unused_imports)]
use proconio::input;
use std::collections::HashMap;
use std::collections::VecDeque;
use std::cmp::max;
use std::cmp::min;


fn main() {
    input! {
        S: String,
    }

    let is_ok = S.contains("C") && S.contains("F");

    let ans = if is_ok {
        if S.find("C").unwrap() < S.rfind("F").unwrap() {
            "Yes"
        } else {
            "No"
        }
    } else {
        "No"
    };
    println!("{}", ans);
}


Measured memory_bytes: 2100
#include<bits/stdc++.h>
using namespace std;
int dp[100001][9];
int ans(int **arr,int n,int p,int mask)
{
    if(n==0 || p==n)
        return 0;
    if(dp[p][mask]>0)
        return dp[p][mask];
    int ans1=0;
    for(int i=0;i<3;i++)
    {
        if((mask&(1<<i)) == 0)
        {
            ans1=max(ans1,arr[p][i]+ans(arr,n,p+1,(0|(1<<i))));
        }
    }
    return dp[p][mask]=ans1;
}
int main()
{
    int n;
    cin>>n;
    int **arr=new int*[n];
    for(int i=0;i<n;i++)
    {
        arr[i]=new int[3];
        for(int j=0;j<3;j++)
        {
            cin>>arr[i][j];
        }
    }
    //int dp[n][3];
   // dp[0][0]=arr[0][0];
   // dp[0][1]=arr[0][1];
    //dp[0][2]=arr[0][2];
    
    cout<<ans(arr,n,0,0)<<endl;
}

Measured memory_bytes: 20260
#include <stdio.h>
#include <string>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string.h>
#include <algorithm>
#include <map>
using namespace std;
const int maxn = 1e6+7;
int n = 0, q = 0;

struct Query{
	int id, l, r;
	bool operator< (Query a) const{
		return r < a.r;
	}
}query[maxn];



int v[maxn], sum[maxn], ans[maxn];

int lowbit(int x){
	return x & (-x);
}

void change(int i, int a){
	while(i <= n){
		sum[i] += a;
		i += lowbit(i);
	}
}

int getsum(int i){
	int sum_t = 0;
	while(i > 0){
		sum_t += sum[i];
		i -= lowbit(i);
	}
	return sum_t;
}
#define ll long long
int main() {
	ll k;cin>>k;
	ll tmp=0;
	ll ans=0;
	map<ll,ll>mp;
	while(1){
		ans=ans*10ll+7;
		tmp++;
		ans%=k;
		
		if(ans==0) return cout<<tmp<<endl,0;
		if(mp[ans]) return cout<<-1<<endl,0;mp[ans]++;
	}
	cout<<-1<<endl;
	return 0;
}


Measured memory_bytes: 65988
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define dump(x) cout << #x << " = " << (x) << endl;
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int INF = 1e7;
  vector<bool> is_prime(INF + 1, true);
  for(int p = 2; p <= INF; p++) {
    if(!is_prime[p]) continue;
    for(int k = p * 2; k <= INF; k += p)
      is_prime[k] = false;
  }
  vector<int> ans(INF + 1, 0);
  int tmp;
  for(int i = 13; i < INF + 1; i++) {
    if(is_prime[i - 8] && is_prime[i - 6] && is_prime[i - 2] && is_prime[i]) {
      tmp = i;
    }
    ans[i] = tmp;
  }
  while(1) {
    int x;
    cin >> x;
    if(x == 0) { break; }
    cout << ans[x] << endl;
  }

  return 0;
}


Measured memory_bytes: 43100
//
#include <vector>
#include <set>
#include <map>
#include <array>
#include <iostream>
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <numeric>
#include <bitset>
#include <iomanip>
//
using ll = long long;
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);++i)
#define outD(fpv) cout << setprecision(20) << fpv << endl;
inline void yes(bool cond) { cond ? puts("Yes") : puts("No"); }
inline void YES(bool cond) { cond ? puts("YES") : puts("NO"); }
template<typename Type> inline void chmin(Type& a, Type b) { if (a > b) a = b; }
template<typename Type> inline void chmax(Type& a, Type b) { if (a < b) a = b; }
template<typename Arr, typename Type> inline void fill(Arr& arr, Type v) { std::fill(arr.begin(), arr.end(), v); }
template<typename Type> inline void sort(Type& arr) { std::sort(arr.begin(), arr.end()); }
template<typename Type> inline Type nth(vector<Type>& arr, size_t pos) { std::nth_element(arr.begin(), arr.begin() + pos, arr.end()); return arr[pos]; }
template<typename Type> inline void unique(Type& arr) { sort(arr); arr.erase(unique(arr.begin(), arr.end()), arr.end()); }
constexpr ll INF_I = std::numeric_limits<ll>::max();
constexpr ll BIGP = 1000000007L;
constexpr double INF_F = std::numeric_limits<float>::infinity();
constexpr double PI = 3.14159265358979323846L;
//
int main()
{
    struct Shop
    {
    public:
        ll idx = 0;
        string S;
        ll P;
    public:
        bool operator < (const Shop& rhs) const
        {
            if (S != rhs.S)
            {
                return S < rhs.S;
            }
            if (P != rhs.P)
            {
                return P > rhs.P;
            }
            return false;
        }
    };
    //
    cin.tie(0); ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    //
    set<Shop> shops;
    rep(i, N)
    {
        Shop s;
        cin >> s.S >> s.P;
        s.idx = i + 1;
        shops.insert(s);
    }
    //
    for (auto& s : shops)
    {
        cout << s.idx << endl;
    }

    return 0;
}

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

int main(){
    short n;
    cin >> n;
    short l[n];
    for(short i=0; i<n; i++) cin >> l[i];
    int count = 0;
    sort(l, l+n, greater<int>());

    for (short i = 0; i < n; i++)
        for (short j = i + 1; j < n; j++){
            short ln = max(l[i], l[j]);
            short sh = min(l[i], l[j]);
            for (short k = j + 1; k < n; k++) {
                short c = l[k];
                if (c < ln + sh){
                    if (c > ln - sh) count++;
                    else break;
                }
            }
        }
    cout << count << "\n";
    return 0;
}

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

using namespace std;

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

#ifdef DEBUG
#else
    #define cerr if (false) cerr
#endif

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

const int MOD = 998244353;

int add(int x, int y) {
    x += y;
    if (x >= MOD)
        return x - MOD;
    return x;
}

int sub(int x, int y) {
    x -= y;
    if (x < 0)
        return x + MOD;
    return x;
}

int mul(int x, int y) {
    return (1LL * x * y) % MOD;
}

int bin_pow(int a, int p) {
    if (!p)
        return 1;
    if (p % 2)
        return (1LL * bin_pow(a, p - 1) * a) % MOD;
    int t = bin_pow(a, p / 2);
    return (1LL * t * t) % MOD;
}

int inv(int x) {
    return bin_pow(x, MOD - 2);
}

int a, b, c, d;
vector <vector <int>> dp;

int solve(int x, int y) {
    if (dp[x][y] != -1)
        return dp[x][y];
    if (x == a && y == b)
        return dp[x][y] = 1;
    int n = x - a, m = y - b;
    if (!n)
        return dp[x][y] = mul(solve(x, y - 1), x);
    if (!m)
        return dp[x][y] = mul(solve(x - 1, y), y);
    dp[x][y] = add(mul(solve(x - 1, y), y - 1), mul(solve(x, y - 1), x - 1));
    dp[x][y] = add(dp[x][y], add(solve(x - 1, y), solve(x, y - 1)));
    dp[x][y] = sub(dp[x][y], mul(solve(x - 1, y - 1), mul(x - 1, y - 1)));
    return dp[x][y];
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    cin >> a >> b >> c >> d;
    dp = vector <vector <int>> (c + 1, vector <int> (d + 1, -1));
    cout << solve(c, d);
    forn (i, 0, c + 1)
        forn (j, 0, d + 1)
            cerr << i << " " << j << ": " << dp[i][j] << "\n";
    return 0;
}

Measured memory_bytes: 39072
def gcm(a,b):
    while b!=0:
        a,b=b,a%b
    return a

def solve():
    N,M=map(int,input().split())
    S=input()
    T=input()
    if (N == M) and (S == T):
        return N
    g=gcm(M,N)
    for i in range(g):
        #print(S[N//g*i], T[M//g*i])
        if S[N//g*i] != T[M//g*i]:
            break
    else:
        return M*N//g
    return -1

print(solve())


Measured memory_bytes: 39536
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(){
    int n;
    cin>>n;
    string s,t;
    cin>>s>>t;
    int pile=0;
    rep(i,n){
        if(s.substr(i)==t.substr(0,n-i)){
            pile=n-i;
            break;
        }
    }
    cout<<2*n-pile<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,int> pdi;
typedef pair<double,double> pdd;
typedef pair<double,ll> pdl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<pdd> vdd;
typedef vector<pdi> vdi;
typedef vector<pdl> vdl;
typedef vector<string> vs;
#define fi first
#define se second
const ll INFLL=LLONG_MAX;
const int INF=INT_MAX;
const ll MAXLL=0x3f3f3f3f3f3f3f3f;
const int MAX=0x3f3f3f3f;
const ll MOD=1000000007;
const ll mod=998244353;
#define eb emplace_back
#define emp emplace
#define mp(a,b) make_pair(a,b)
template<class T> using min_heap=priority_queue<T,vector<T>,greater<T> >;
template<class T>
void sort(vector<T>& v){
	sort(v.begin(),v.end());
}
template <class T, class U>
void sort(vector<T>& v,U func){
	sort(v.begin(),v.end(),func);
}
template<class T>
void rsort(vector<T>& v){
	sort(v.rbegin(),v.rend());
}
template <class T>
int lb_index(vector<T>& v,T k){
	return lower_bound(v.begin(),v.end(),k)-v.begin();
}
template <class T>
int ub_index(vector<T>& v,T k){
	return upper_bound(v.begin(),v.end(),k)-v.begin();
}
template<class T>
bool is_sorted(vector<T>& v){
	return is_sorted(v.begin(),v.end());
}
template<class T>
bool sorted(vector<T>& v){
	return is_sorted(v);
}
void precompute(){

	return;
}
void solve(){
	ll n,a,b;
	cin>>n>>a>>b;
	if(a>b)cout<<0;
	else if(n==1&&a!=b)cout<<0;
	else cout<<(n-2)*b-(n-2)*a+1;
	return;
}

int main(){
	ios::sync_with_stdio(0);
	int numberofsubtestcases=1;
//	cin>>numberofsubtestcases;
	precompute();
	for(int looping=1;looping<=numberofsubtestcases;looping++){
//		cout<<"Case #"<<looping<<": ";
		solve();
	}
	return 0;
}




Measured memory_bytes: 3608
#include <iostream>
#include <cmath>
typedef long long ll;
using namespace std;
#define chmin(x,y) (x=min(x,y))
int main(void){
    ll n;
    cin >> n;
    ll Min = n;
    for(int i=1;i<=sqrt(n);i++){
        if(n%i==0) chmin(Min,abs(i-1)+abs((n/i)-1));
    }
    cout << Min << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <numeric>

using namespace std;

const int INF = 1e6;

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> a(m), b(m), c(m);

    vector< vector<int> > dist(n+10, vector<int>(n+10, INF));
    for (int i=0; i<n+10; i++){
        dist[i][i] = 0;
    }

    for (int i=0; i<m; i++){
        cin >> a[i] >> b[i] >> c[i];
        dist[a[i]][b[i]] = c[i];
        dist[b[i]][a[i]] = c[i];
    }

    for (int k=1; k<=n; k++){
        for (int i=1; i<=n; i++){
            for (int j=1; j<=n; j++){
                dist[i][j] = min(dist[i][j], dist[i][k]+dist[k][j]);
            }
        }
    }

    int count = m;
    for (int i=0; i<m; i++){
        if (dist[a[i]][b[i]] == c[i])  count--;
    }

    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define VI vector<int>
#define VVI vector<vector<int>>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define MOD 1000000007
#define INF 1e9
#define All(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;

int main() {
  int N, cnt = 0;
  cin >> N;
  vector<int> a(N), c(N, 0);
  REP(i, N) cin >> a[i];
  for (int i = 0; i < N;i++){
    if(c[i]!=0)
      continue;
    if (a[a[i] - 1] == i +
     1) {
      cnt++;
      c[a[i] - 1] = 1;
    }
  }
  cout << cnt << endl;

  return 0;
}

Measured memory_bytes: 1024
A, B, C = map(int, input().split())

A, B, C = sorted((A, B, C))
ans = 0

if sum([C % 2 == a % 2 for a in (A, B, C)]) == 2:
    ans += 1
    if A % 2 == C % 2:
        A += 1
    else:
        B += 1
    C += 1

ans += sum([C - a for a in (A, B, C)]) // 2
print(ans)

Measured memory_bytes: 3060
#include<stdio.h>
int main(void) {
	int x, a;
	scanf("%1d", &x);
	scanf("%1d", &a);
	if(x < a) {
		printf("%d", 0);
	}
	else if (x >= a) {
		printf("%d", 10);
	}
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define dbg(x) cout<<#x<<"="<<x
#define nl cout<<"\n"
#define frn(i,n) for(int i = 0;i < n;i++)
#define fr(i,a,b) for(int i = a;i < b;i++)
#define pb push_back
using namespace std;



int main() {
  int a,b,c,x;
  cin>>a>>b>>c>>x;
  int ans = 0;
  fr(i,0,a+1) {
    fr(j,0,b+1) {
      fr(k,0,c+1) {
        if(500*i+100*j+50*k == x) ans++;
      }
    }
  }
  cout<<ans;
}

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

using namespace std;

int dp(int x,int y){
    if(y==0){
        return x;
    }
    return dp(y,x%y);
}

int main() {
    int n,g;
    cin>>n;
    int a[n];
    for(int i=0;i<=n-1;i++){
        cin>>a[i];
    }
    g=a[0];
    for(int i=1;i<=n-1;i++){
        g=dp(g,a[i]);
    }
    cout<<g<<endl;
    return 0;
}


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

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

	if (s == "Sunny") {
		cout << "Cloudy" << endl;
	}
	else if (s == "Cloudy") {
		cout << "Rainy" << endl;
	}
	else {
		cout << "Sunny" << endl;
	}
    return 0;
}


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

const int N=2e5+20;

int n,x,y;
vector <int> v1,v2;

int main()
{
	scanf("%d",&n);
	while(n--)
	{
		scanf("%d%d",&x,&y);
		v1.push_back(x+y);
		v2.push_back(x-y);
	}

	sort(v1.begin(),v1.end());
	sort(v2.begin(),v2.end());
	printf("%d",max(v1.back()-v1.front(),v2.back()-v2.front()));
}

Measured memory_bytes: 5144
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())
#define VI(a,n) vi a(n); rep(i,n)cin>>a[i];
#define sq(n) (n)*(n)

using namespace std;

const int mod=1e9+7;

void run();

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

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n;
    cin>>n;
    vvi a(n,vi(3));
    rep(i,n)rep(j,3)cin>>a[i][j];
    vvi dp(n+1,vi(3));
    rep(i,3)dp[0][i]=a[0][i];
    Rep(i,1,n){
        rep(j,3){
            dp[i][j]+=max(dp[i-1][(j+1)%3],dp[i-1][(j+2)%3])+a[i][j];
        }
    }
    cout<<*max_element(all(dp[n-1]))<<endl;
}

Measured memory_bytes: 11264
#include<iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <tuple>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
using namespace std;

#define ll int64_t
const long MOD = 1e9 + 7;


int main()
{
    int a,b;
    cin >> a>>b;
  vector<int> v1 = { 3, 1, 5,7,8,10,12 };
  vector<int> v2 = {  4,6,9,11 };
  vector<int> v3 = { 2 };
  
  bool isAnd=false;
  
  if ( find(v1.begin(), v1.end(), a ) != v1.end() ){
    if ( find(v1.begin(), v1.end(), b ) != v1.end() )isAnd=true;
  }
   if ( find(v2.begin(), v2.end(), a ) != v2.end() ){
    if ( find(v2.begin(), v2.end(), b ) != v2.end() )isAnd=true;
  }
   if ( find(v3.begin(), v3.end(), a ) != v3.end() ){
    if ( find(v3.begin(), v3.end(), b ) != v3.end() )isAnd=true;
  }

	if (isAnd){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, n) for(int i = 1; i <= (int)(n); i++)
const long long INF = 1LL << 60;
const double PI=3.14159265358979323846;
int main() 
{
    string s;
    cin >> s;
    int n=s.size();
    int m=n/2;
    for(int i=0;i<m;i++){
        if(s.at(i)!=s.at(n-1-i)||s.at(i)!=s.at(m-1-i)||s.at(i)!=s.at(m+1+i)){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" <<endl;
}

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

typedef long long LL;
#define dbg(x) cerr << #x"=" << x << endl;

int main(){
   // freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(0); cin.tie(0);
    string s;
    while(cin >> s){
        sort(s.begin(), s.end());
        bool f = (s[0] == s[1]) && (s[2] == s[3]);
        f &= (s[1] != s[2]);
        cout << (f ? "Yes" : "No") << endl;
    }   
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
#include <random>
#include <cassert>
using namespace std;
 
#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<int, ll> i_ll;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
typedef vector<int> vi;
struct edge { int v; ll w; };
 
const int MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;
int INF = INT_MAX / 2;

int main() {
	ll x, y; cin >> x >> y;
	cout << (abs(x - y) <= 1 ? "Brown" : "Alice") << endl;
	return 0;
	vector<vector<bool> > dp(100, vector<bool>(100));
	rep(N, 100) for (int x = 0; x <= N; x++) {
		int y = N - x;
		for (int i = 1; i <= 50; i++) {
			if (i * 2 <= x && !dp[x - i * 2][y + i]) dp[x][y] = true;
			if (i * 2 <= y && !dp[x + i][y - i * 2]) dp[x][y] = true;
		}
	}
	rep(x, 20) {
		rep(y, 20) cout << dp[x][y];
		cout << endl;
	}
}


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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string a,b;
    cin>>a>>b;

    int n = a.size();
    int m = b.size();

    vector<vector<int>> dp(n+1,vector<int>(m+1,0));

    for(int i=n-1;i>=0;i--){
        for(int j=m-1;j>=0;j--){
            if(a[i] == b[j]){
                dp[i][j] = 1+dp[i+1][j+1];
            }
            else{
                dp[i][j] = max(dp[i+1][j],dp[i][j+1]);
            }
        }
    }

    int i=0, j=0;

    string ans;

    while(i<n && j<m){
        if(a[i] == b[j]){
            ans.push_back(a[i]);
            i++;
            j++;
        }
        else if(dp[i+1][j] >= dp[i][j+1]){
            i++;
        }
        else{
            j++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 35584
n,m,k = map(int,input().split())

MOD = 998244353
FAC = [1]
INV = [1]
for i in range(1,n+1):
  FAC.append((FAC[i-1]*i) % MOD)
  INV.append(pow(FAC[-1],MOD-2,MOD))

def nCr(n,r):
  return FAC[n]*INV[n-r]*INV[r]

ans = 0
for i in range(k+1):
  ans += nCr(n-1,i)*m*pow(m-1,n-i-1,MOD)
  ans %= MOD
print(ans)

Measured memory_bytes: 98432
N, M = gets.split.map(&:to_i)

S = Array.new(M)
C = Array.new(M)
M.times { |m|
  S[m], C[m] = gets.split.map(&:to_i)
}

ans = "0" * N
M.times { |m|
  if ans[S[m]-1] == "0" then
    ans[S[m]-1] = C[m].to_s
  elsif ans[S[m]-1] != C[m].to_s
    ans = -1
    break
  end
}

if ans != -1 && ans.length != 1 && ans[0] == "0" then
  ans[0] = "1"
  M.times{ |m|
    if S[m] == 1 then
      ans = -1
    end
  }
end

puts ans


Measured memory_bytes: 1788
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

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

template<class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template<class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template<class T, class V>
typename enable_if<is_class<T>::value == 0>::type fill(T &t, const V &v) {
    t = v;
}
template<class T, class V>
typename enable_if<is_class<T>::value != 0>::type fill(T &t, const V &v){
    for (auto &e : t) fill(e, v);
}

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }

#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }




int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int N, M;
    while (cin >> N >> M) {
        vector<vector<int> > s(M);
        for (int i = 0; i < M; ++i) {
            int k; cin >> k;
            for (int j = 0; j < k; ++j) {
                int a; cin >> a; --a;
                s[i].push_back(a);
            }
        }
        vector<int> p(M);
        for (int i = 0; i < M; ++i) cin >> p[i];

        long long res = 0;
        for (int bit = 0; bit < (1<<N); ++bit) {
            bool ok = true;
            for (int i = 0; i < M; ++i) {
                int con = 0;
                for (auto v : s[i]) {
                    if (bit & (1<<v)) ++con;
                }
                if (con % 2 != p[i]) ok = false;
            }
            if (ok) ++res;
        }
        cout << res << endl;
    }
}


















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

int main(){
  int x[5];
  cin>> x[0] >> x[1] >> x[2] >> x[3] >> x[4];
  for (int i=0; i<5; i++){
    if(x[i] == 0){
      cout<<i+1<<endl;
    }
  }
}

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

int main(){
	int n,m,a,b;
	cin>>n>>m;
	a=max(n,m);
	b=min(n,m);
	for(int i=0;i<a;i++){
		printf("%d",b);
	}
	return 0;
}

Measured memory_bytes: 256
N=int(input())
INF=10**10
dp=[INF]*(N+1)
dp[0]=0
for i in range(N+1):
    if i+1<=N: dp[i+1]=min(dp[i+1],dp[i]+1)
    j=1
    while i+6**j<=N:
        dp[i+6**j]=min(dp[i+6**j],dp[i]+1)
        j+=1
    j=1
    while i+9**j<=N:
        dp[i+9**j]=min(dp[i+9**j],dp[i]+1)
        j+=1
print(dp[N])

Measured memory_bytes: 9504
import sys
sys.setrecursionlimit(10**6)

K = int(input())
A = list(map(int,input().split()))

def ceil(a, b):
    return -(-a // b)

def floor(a, b):
    return a // b

def L(i):
    if i == K:
        return 2
    return ceil(L(i+1), A[i]) * A[i]

def R(i):
    if i == K:
        return 2
    return floor(R(i+1), A[i]) * A[i] + A[i] - 1

L0 = L(0); R0 = R(0)
if L0 <= R0:
    print(L0, R0)
else:
    print(-1)

Measured memory_bytes: 88208
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
	    int N =sc.nextInt();
	    int D = sc.nextInt();
	    int X[][]=new int[N][D];
	    for(int i=0;i<N;i++) {
	    	for(int j=0;j<D;j++) {
	    		X[i][j]=sc.nextInt();
	    	}
	    }
	    int c=0;
	    for(int i=0;i<N;i++) {
	    	for(int j=i+1;j<N;j++) {
	    		int d =dist2(X[i], X[j]);
	    		double ds = Math.sqrt(d);
	    		if(ds==(int)ds) {
	    			c++;
	    		}
	    	}
	    }
	    System.out.println(c);

	}

	static int dist2(int a[],int b[]) {
		int sum=0;
		for(int i=0;i<a.length;i++) {
			sum+=(a[i]-b[i])*(a[i]-b[i]);
		}
		return sum;
	}


}

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

int main(){
    int n; cin >> n;
    int r[n];
    int DELTA_MAX = -1e9;
    int MIN = 1e9;
    for(int i=0;i<n;i++){
        cin >> r[i];
    }
    for(int i=0;i<n-1;i++){
        MIN = min(MIN, r[i]);
        DELTA_MAX = max(r[i+1] - MIN, DELTA_MAX);
    }
    cout << DELTA_MAX << endl;
}


Measured memory_bytes: 3880
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)

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

    string c = a + b;
    ll cNum = stoi(c);

    for(ll i = 1; i*i <= cNum; i++) {
        if(i*i == cNum) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <stack>
#include <climits>
#include <map>
#include <set>

using namespace std;

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

const ll mod = 1000000007;
const int inf = 1e9;
const long long INF = 1LL << 60;


int main()
{
    ll a,b,c;
    cin >> a >> b >> c;
    if(a == b && a == c && a % 2 == 0){
        cout << -1 << endl;
    }else{
        int ans = 0;
        while(true){
            if(a % 2 == 1 || b % 2 == 1 || c % 2 == 1){
                break;
            }
            ll x = (b+c) / 2, y = (a+c) / 2, z = (a+b) / 2;
            a = x, b = y, c = z;
            ans++;
        }
        cout << ans << endl;        
    }
}


Measured memory_bytes: 256
import sys
from collections import defaultdict
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり


N,M = MI()
S = [LI() for _ in range(M)]
P = LI()

ans = 0
for i in range(1 << N):
    d = defaultdict(int)
    for j in range(N):
        if (i >> j) & 1:
            d[j] = 1
    for k in range(M):
        if sum(d[l-1] for l in S[k][1:]) % 2 != P[k]:
            break
    else:
        ans += 1

print(ans)


Measured memory_bytes: 75220
#include "bits/stdc++.h"
#define _CRT_SECURE_NO_WARNINGS
#define rep(i,n) for(int i = 0;i < n;i++)
#define REP(i,n,k) for(int i = n;i < k;i++)
#define P(p) cout << (p) << endl;
#define sP(p) cout << setprecision(15) << fixed << p << endl;
#define Pi pair<int,int>
#define IINF 1e9
#define LINF 1e18
#define vi vector<int>
#define mp make_pair
#define pb push_back

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = { 0, 1,0,-1 };
int dy[] = { 1, 0,-1,0 };
int dx8[] = { -1,-1,-1,0,0,1,1,1 };
int dy8[] = { -1,0,1,-1,1,-1,0,1 };

unsigned long long sttoi(std::string str) {
	unsigned long long ret;
	std::stringstream ss; ss << str;
	ss >> ret;
	return ret;
}

ull gcd(ull a, ull b) {
	if (b > a)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a%b);
}

int comb(int n, int k) {
	int ans = 1;
	for (int i = 0; i < min(k, n - k); i++) {
		ans *= n - i;
		ans /= i + 1;
	}
	return ans;
}

ll mod_pow(ll n, ll p, ll mod) {
	if (p == 0) return 1 % mod;
	if (p < 2) {
		return n % mod;
	}
	else {
		ll d = 2, value = (n%mod)*(n%mod) % mod;
		while (d * 2 < p) { d *= 2;	value *= value;	value %= mod; }
		value %= mod;
		return ((value%mod) * (mod_pow(n, p - d, mod) % mod)) % mod;
	}
}

bool isPrime(int n) {
	if (n <= 1)return false;
	if (n == 2)return true;
	if (n % 2 == 0)return false;
	for (int i = 3; i*i <= n; i += 2) {
		if (n%i == 0)return false;
	}
	return true;
}

void solve() {
	string s;
	cin >> s;
	P(s.substr(0, 4) + " " + s.substr(4, 8));
}

int main() {
	solve();
	return 0;
}

Measured memory_bytes: 256
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    x,a=INTM()
    if x<a:
        print(0)
    else:
        print(10)
if __name__ == '__main__':
    do()

Measured memory_bytes: 3316
fun main() {
    val (a, b, n) = readLine()!!.split(" ").map(String::toLong).toLongArray()

    val c = if (n >= b) {
        b - 1
    } else {
        n
    }.toDouble()

    val result = (Math.floor(a * c / b).toLong() - a * Math.floor(c / b).toLong())
    println(result)
}





Measured memory_bytes: 36480
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    Init();
    ll n; cin >> n;
    vi a(n), as(n+1);
    rep(i, n){
        cin >> a[i];
        as[i] += a[i];
        as[i+1] = as[i];
    }
    ll ans = INFLL;
    rep(i, n-1) chmin(ans, abs(as[n-1]-2*as[i]));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6324
#[allow(dead_code)]
fn is_whitespace(c: &char) -> bool {
    c.is_whitespace()
}

#[allow(dead_code)]
fn is_eol(c: &char) -> bool {
    ['\r', '\n'].contains(c)
}

#[allow(unused_macros)]
macro_rules! input {
    ($var:ident, $($r:tt)*) => {
        input_inner!{$var, $($r)*}
    };

    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        #[allow(unused_mut, unused_variables, bare_trait_objects)]
        let mut next = move |f: &Fn(&char)->bool| -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|f(&c))
                .take_while(|c|!f(&c))
                .collect()
        };
        input_inner!{next, $($r)*};
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; eol ]) => {
        $next(&is_eol).split(' ').map(|x| x.parse::<$t>().unwrap()).collect::<Vec<_>>()
    };

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

    ($next:expr, parser) => {
        $next
    };

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

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap, HashSet};

#[allow(dead_code)]
struct Edge {
    from: usize,
    to: usize,
}

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;
#[allow(dead_code)]
const M: usize = 1_000_000_007;

fn main() {
    input! {
        n: usize,
        k: usize,
        mut h: [usize; n],
    }
    h.sort();
    let x = if n > k {
        h[0..n-k].iter().sum::<usize>()
    } else {
        0
    };
    println!("{}", x);
}


Measured memory_bytes: 6396
#include<bits/stdc++.h>
#define N 200005
using namespace std;
int n,m;
int a[N],cov[N],now,cnt[N];
void ad(int x)
{
	if(x>=1)
	{
		cov[x]++;
		if(cov[x]==1)now++;
	}
}
void dl(int x)
{
	if(x>=1)
	{
		cov[x]--;
		if(!cov[x])now--;
	}
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]),cnt[a[i]]++,ad(a[i]-cnt[a[i]]+1);
	for(int i=1;i<=m;i++)
	{
		int t1,t2;
		scanf("%d%d",&t1,&t2);
		dl(a[t1]-cnt[a[t1]]+1);
		cnt[a[t1]]--;
		a[t1]=t2;
		cnt[a[t1]]++;
		ad(a[t1]-cnt[a[t1]]+1);
//		cout<<cnt[1]<<' '<<cnt[4]<<endl;
		printf("%d\n",n-now);
	}
	return 0;
}

Measured memory_bytes: 3712
x1,y1,x2,y2 = map(int,input().split())

x3 = x2-(y2-y1)
y3 = y2+(x2-x1)
x4 = x1-(y2-y1)
y4 = y1+(x2-x1)

print('%d %d %d %d' % (x3,y3,x4,y4))


Measured memory_bytes: 2940
N = int(input())
values = map(int, input().split())

# 最初に投入した具材ほど半分の半分の半分の……になっていく
# つまり小さい順に投入すればいい

sorted_values = sorted(values)

# 順番に足していく
anser_values = [0.0 for _ in range(N)]
anser_values[0] = (sorted_values[0] + sorted_values[1]) / 2
for n in range(2, N):
    anser_values[n - 1] = (anser_values[n - 2] + sorted_values[n]) / 2

print(anser_values[N - 2])

Measured memory_bytes: 3064
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"

using namespace std;

const long long int MOD = 1000000007;
//const int MOD = 998244353;

long long int N, M, K, H, W, L, R;
//int N, M, K, H, W, L, R;



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

	cin >> N >> M;
	vector<int>v(N, 1);
	vector<int>w(N, 0);
	w[0] = 1;
	for (int i = 0; i < M; i++) {
		cin >> L >> R;
		L--;
		R--;
		v[L]--;
		v[R]++;
		w[R] |= w[L];
		w[L] &= !!v[L];
	}
	cout << accumulate(w.begin(), w.end(), 0);
	cout << endl;
	return 0;
};

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

public class Main {

	public static void main(String[] args) throws IOException {
		
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));		

		int n = Integer.parseInt(reader.readLine());
		int[] numbers = new int[n+1];
		String[] strArray = reader.readLine().split(" ");
		for (int i = 0; i < n; i++) {
			numbers[i] = Integer.parseInt(strArray[i]);
		}
		int q = Integer.parseInt(reader.readLine());
		int[] targets = new int[q];
		strArray = reader.readLine().split(" ");
		for (int i = 0; i < q; i++) {
			targets[i] = Integer.parseInt(strArray[i]);
		}		
	
		int ans = 0;
		for (int i = 0; i < q; i++) {
			int target = targets[i];
			numbers[n] = target;
			int j = 0;
			while (target != numbers[j]) {
				j++;
			}
			if (j != n) {
				ans++;
			}
		}
		
		System.out.println(ans);
	}
}


Measured memory_bytes: 26896
#include<stdio.h>
int main(void){

int x,y;
int i=1;

 
	scanf("%d",&y);
	scanf("%d",&x); 


while(i=3000){

i++;
//printf("%d %d\n",x,y);
if(x>y){printf("%d %d\n",y,x);}
else if(y>x){printf("%d %d\n",x,y);}
else if(x==0 && 0==y)break;
else if(x==y){printf("%d %d\n",x,y);}

scanf("%d",&y);
scanf("%d",&x);



}
return 0;}

Measured memory_bytes: 600
"use strict";

function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }

function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }

function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }

function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

!function () {
  function splitNum(line) {
    return (Array.isArray(line) ? line : line.split(/\s+/)).map(function (n) {
      return parseInt(n);
    });
  }

  function* range(start, end) {
    for (var i = start; i < end; i++) {
      yield i;
    }
  }

  !function (input) {
    var lines = input.split("\n");

    var _splitNum = splitNum(lines[0]),
        _splitNum2 = _slicedToArray(_splitNum, 1),
        N = _splitNum2[0];

    var W = splitNum(lines[1]).slice(0, N);
    var sum = W.reduce(function (a, b) {
      return a + b;
    }, 0);
    var leftSum = 0;
    var min = 1 / 0;
    var _iteratorNormalCompletion = true;
    var _didIteratorError = false;
    var _iteratorError = undefined;

    try {
      for (var _iterator = range(0, N - 1)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
        var i = _step.value;
        leftSum += W[i];
        var diff = Math.abs(leftSum - (sum - leftSum));
        if (min > diff) min = diff;
      }
    } catch (err) {
      _didIteratorError = true;
      _iteratorError = err;
    } finally {
      try {
        if (!_iteratorNormalCompletion && _iterator.return != null) {
          _iterator.return();
        }
      } finally {
        if (_didIteratorError) {
          throw _iteratorError;
        }
      }
    }

    console.log(min);
  }(require("fs").readFileSync("/dev/stdin", "utf8"));
}();


Measured memory_bytes: 21192
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef double db; 
typedef string str;
 
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
 
typedef vector<int> vi; 
typedef vector<bool> vb; 
typedef vector<ll> vl; 
typedef vector<db> vd; 
typedef vector<str> vs; 
typedef vector<pi> vpi;
 
#define sz(x) (int)(x).size()
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define sor(x) sort(all(x))
#define ins insert 
#define ft front() 
#define bk back()
#define pf push_front 
#define pb push_back
#define endl '\n'
 
const ll MOD = 1e9+7; // 998244353;
const ll INF = 1e18;
 
int main() {
   ios_base::sync_with_stdio(false); cin.tie(nullptr);
   int x; cin >> x;
   cout << 1 - x;
   return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (n); ++i)
const int INF = 1 << 30;
using namespace std;

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

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

  // k:[0, 100]
  int n, k; cin >> n >> k;
  vector<int> h(100100);  // error : h(n)
  rep(i, n) cin >> h[i];

  int dp[100100] = {};
  rep(i, 100010) dp[i] = INF;
  dp[0] = 0;

  rep(i, n) {
    for(int j = 1; j <= k; ++j) {
      chmin(dp[i+j], dp[i] + abs(h[i]-h[i+j])); // h[i+j]で配列外参照に注意
    }
  }
  cout << dp[n-1] << '\n';
  return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <string.h>
#include <iostream>
#include <stdio.h>

using namespace std;

typedef long long ll;
const ll N = 2e5 + 10;
ll n, k, t;
ll l, r;
ll a[N];
ll h[N];

int main() {
	memset(h, 0, sizeof h);
	cin >> n >> k;
	for (ll i = 1; i <= n; i++) cin >> a[i];

	t = 1;
	h[1] = 0;
	ll i;
	for (i = 1; i <= min(k, n); i++) {
		t = a[t];
		if (h[t] || t == 1) {
			break;
		}
		h[t] = i;
	}

	if (i == k) {
		cout << t << endl;
		return 0;
	}

	ll xx = k - h[t];
	xx = xx % (i - h[t]);
	for (i = 0; i < xx; i++) {
		t = a[t];
	}

	cout << t << endl;

	return 0;
}

Measured memory_bytes: 6756
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {

    let n: usize = read();
    let mut v: Vec<i32> = Vec::with_capacity(n);

    for _i in 0..n {
        v.push(read())
    }

    let mut sum: i32 = 0;
    for mut value in v {
        while value % 2 == 0 {
            sum += 1;
            value /= 2;
        }
    }
    println!("{}", sum);
}


Measured memory_bytes: 4352
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;

int main() {
	char c[7][4]={"AAA","AA","A","B","C","D","E"};
	double n1,n2,t1[7]={35.5,37.5,40,43,50,55,70},t2[7]={71,77,83,89,105,116,148};
	int i;
	while(cin >> n1 >> n2) {
		for (i=0;i<7;i++) if (n1<t1[i] && n2<t2[i]) break;
		if (i==7) cout << "NA" << endl; else cout << c[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 1220