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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2017/11/13  Problem: NU_27_B / Link: __CONTEST_URL__  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

LL N;

LL ans = 0LL;

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

	cin >> N;

	VL a(N);
	FOR(i, 0, N) {
		cin >> a[i];
	}
	ans = LINF;
	LL cnt = 0;
	LL sum = 0;
	FOR(i, 0, N) {
		if (i == 0) {
			sum += a[i];
			if (sum < 0) {
				cnt = (-sum + 1);
				sum = 1;
			}
			else if (sum == 0) {
				cnt++;
				sum = 1;
			}
			continue;
		}
		if (sum > 0) {
			sum += a[i];
			if (sum >= 0) {
				cnt += (sum + 1);
				sum = -1;
			}
		}
		else {
			sum += a[i];
			if (sum <= 0) {
				cnt += (-sum + 1);
				sum = 1;
			}
		}
	}
	ans = min(ans, cnt);
	sum = 0;
	cnt = 0;
	FOR(i, 0, N) {
		if (i == 0) {
			sum += a[i];
			if (sum > 0) {
				cnt = (sum + 1);
				sum = -1;
			}
			else if (sum == 0) {
				cnt++;
				sum = -1;
			}
			continue;
		}
		if (sum > 0) {
			sum += a[i];
			if (sum >= 0) {
				cnt += (sum + 1);
				sum = -1;
			}
		}
		else {
			sum += a[i];
			if (sum <= 0) {
				cnt += (-sum + 1);
				sum = 1;
			}
		}
	}

	ans = min(ans, cnt);
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1024
n,a[5000],i,j,s,m;main(){for(;~scanf("%d",&n);n&&printf("%d\n",m)){for(i=n;i--;)scanf("%d",a+i);for(m=*a,i=n;i;)for(s=0,j=i--;j--;m=s>m?s:m)s+=a[j];}}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define M 20000

int main(void){
    int tx,ty;
    string s;
    assert((int)s.size()<=8000);
    cin>>s>>tx>>ty;
    s += "T";
    int init = s.find("T",0);
    tx -= init;
    s = string(s.begin()+init, s.end());
    bitset<M*2> dp[2];
    dp[0][M] = dp[1][M] = 1;
    int cnt = 0, mode = 0;
    for(char c : s){
        if(c=='F') cnt++;
        else{
            dp[mode] = (dp[mode]<<cnt) | (dp[mode]>>cnt);
            cnt = 0;
            mode = !mode;
        }
    }
    cout<<((dp[0][M+tx] && dp[1][M+ty]) ? "Yes" : "No")<<endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
	int m, f, r, sum;

	while (1) {
		cin >> m >> f >> r; 
		if (m == -1 && f == -1 && r == -1) break;
		if (m == -1 || f == -1) {
			cout << 'F' << endl;
			continue;
		}
		sum = m + f;

		if (80 <= sum) {
			cout << 'A' << endl;
			continue;
		}
		if (65 <= sum && sum < 80) {
			cout << 'B' << endl;
			continue;
		}
		if (50 <= sum && sum < 65) {
			cout << 'C' << endl;
			continue;
		}
		if (30 <= sum && sum < 50) {
			if (50 <= r)
				cout << 'C' << endl;
			else
				cout << 'D' << endl;
			continue;
		}
		if (sum < 30) {
			cout << 'F' << endl;
			continue;
		}
	}

	return (0);
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll k;
    cin >> k;
    ll last = 0;
    ll pow = 1;
    for(int i = 1; i <= 1e6+5; i++) {
        last += (pow * 7) % k;
        last %= k;
        if(last == 0) {
            cout << i;
            exit(0);
        }
        pow = (pow*10)%k;
    }
    cout << -1;
    return 0;
}

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

int main(){
    int H,W;
    
    while(1){
        cin >> H >> W;
        if(H==0 && W==0)break;
        for ( int i = 0; i < H; i++ ){
            for ( int j = 0; j < W; j++ ){
                if( i==0 || i==H-1 || j == 0 || j==W-1 ){
                    cout<<"#";
                }
                else{
                    cout<<".";
                }
            }cout << endl;
        }cout << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3060
from bisect import bisect_left

n = int(input())
l = sorted(list(map(int, input().split())))
answer = 0

for i in range(n - 2):
    for j in range(i + 1, n - 1):
        lij = l[i] + l[j]
        r = bisect_left(l, lij)
        answer += r - j - 1
        
print(answer)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define ll long long
#define mp(a, b) make_pair(a, b)
#define newline cout << endl;
#define ff first
#define ss second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(v) v.begin(),v.end()
using namespace std;

template <typename S, typename T> ostream& operator<<(ostream& out, pair<S, T> const& p)
{
	out << '(' << p.ff << ", " << p.ss << ')';
	return out;
}

template <typename T> ostream& operator<<(ostream& out, vector<T> const& v)
{
	int l = v.size();
	for (int i = 0; i < l - 1; i++)
		out << v[i] << ' ';
	if (l > 0)
		out << v[l - 1];
	return out;
}

template <typename T> void trace(const char* name, T&& arg1) { cout << name << " : " << arg1 << endl; }

template <typename T, typename... Args> void trace(const char* names, T&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	cout.write(names, comma - names) << " : " << arg1 << " | ";
	trace(comma + 1, args...);
}

/*Input*/
const ll size = 1e5+100;
ll n,m;
vector<ll> v(size);
priority_queue<ll, vector<ll> > q;
/*Input*/

int main()
{
	//ios::sync_with_stdio(false);
	//cin.tie(0);
	//cout.tie(0);
	clock_t tStart = clock();
	int test;
	test = 1;
	// cin >> test;
	while (test--) {
        cin >> n >> m;
        for(int i=0; i < n; i++){
            cin >> v[i];
            q.push(v[i]);
        }
        
        for(int i = 0; i < m && q.size(); i++){
            auto temp = q.top();
            q.pop();
            temp/=2;
            q.push(temp);
        }

        ll ans = 0;
        for(int i = 0; i < n; i++){
            auto temp = q.top();
            q.pop();
            ans += temp;
        }
        cout << ans << endl;


	}
#ifdef LOCAL_DEFINE
	printf("Time taken: %.2fs\n", (double)(clock() - tStart) / CLOCKS_PER_SEC);
#endif
	return 0;
}


Measured memory_bytes: 2168
#include<cstring>
#include<algorithm>
#include<iostream>

using namespace std;

int d[310][310];
int f[310][310];

const int INF = 0x3f3f3f3f;
int main(){
    int n, m, L;
    cin >>n >>m >>L;

    memset(d, INF, sizeof(d));
    memset(f, INF, sizeof(f));

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

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


    for(int i=1;i<=n;i++){
        for(int j =1;j<=n;j++){
            if(d[i][j] <= L){
                f[i][j] = 0;
            }
        }
    }

    for(int k=1;k<=n;k++){
        for(int i=1;i<=n;i++){
            if(i==k)
                continue;
            for(int j=1;j<=n;j++){
                if(i==j || k==j)
                    continue;
                f[i][j] = min(f[i][j], f[i][k] + f[k][j] + 1);
            }
        }
    }

    int q;
    cin >>q;
    while(q--){
        int s, t;
        cin >>s>>t;
        if(f[s][t] == INF)
            cout <<-1 <<endl;
        else
            cout <<f[s][t] <<endl;
    }
}



Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define limit(x, l, r) max(l, min(x, r))
#define lims(x, l, r) (x = max(l, min(x, r)))
#define isin(x, l, r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)), x.end())
#define show(x) cout << #x << " = " << x << endl;
#define print(x) cout << x << endl;
#define PQ(T) priority_queue<T, v(T), greater<T> >
#define bn(x) ((1 << x) - 1)
#define dup(x, y) (((x) + (y)-1) / (y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  ll l, r;
  cin >> l >> r;
  ll ans = 1001001001LL;
  vi mod(2020,0);
  vl q;

  for (ll i = l,j=0; i <= r; i++,j++) {
    q.push_back(i);
    if(j>=5000)break;
  }
  rep(i,sz(q)){
    srep(j,i+1,sz(q)){
      mins(ans,(q[i]*q[j])%2019);
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3680
def q(a,h):
 d[a]=str(h)
 for b in t[a]:q(b,h+1)
t,p,d={},{},{}
for _ in[0]*int(input()):
 e=input().split()
 t[e[0]]=e[2:]
 for i in e[2:]:p[i]=e[0]
r=(set(t)-set(p)).pop()
p[r]='-1'
q(r,0)
print('\n'.join(f"node {i}: parent = {p[i]}, depth = {d[i]}, {'root'if'-1'==p[i]else'internal node'if t[i]else'leaf'}, [{', '.join(t[i])}]"for i in map(str,sorted(map(int,t)))))


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

int main(){
  //int n; cin>>n;
  char s; cin>>s;
  
  
  
  cout<<(isupper(s)?"A":"a")  <<endl;
  

}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int i,n;
    cin>>n;
    int h[n],dp[n];
    for(i=0;i<n;i++)
    {
        cin>>h[i];
    }
    dp[0]=0;
    dp[1]=abs(h[1]-h[0]);
    for(i=2;i<n;i++)
    {
        dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
    }
    cout<<dp[n-1]<<endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <map>
#include <utility>

using namespace std;


int main()
{
  int H,W,D,Q;
  cin >> H >> W >> D;
  vector < vector<int> > A(H, vector<int>(W, 0));
  vector <pair<int, int> > Aij(H*W+1);
  for( int i=0;i<H;i++ )
    for( int j=0;j<W;j++ )
      {
	cin >> A[i][j];
	Aij[A[i][j]] = make_pair(i+1,j+1);
      }
  cin >> Q;
  
  vector<int>cost(H*W+1, 0);
  for( int i=0;i<D;i++ )
    {
      int tmp=0;
      for( int j=i+1;j<H*W+1;j+=D)
	{
	  cost[j] = tmp;
	  if(j+D<W*H+1)
	    tmp += abs(Aij[j+D].first-Aij[j].first)+abs(Aij[j+D].second-Aij[j].second);
	}
    }



  for( int q=0;q<Q;q++ )
    {
      int ans = 0;    
      int L,R;
      cin >> L >> R;
      cout << cost[R]-cost[L] << endl;
    }
}


Measured memory_bytes: 2560
#include <iostream>

using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int a, b, c;
  cin >> a >> b >> c;
  cout << ((2 * b) == (a + c) ? "YES" : "NO") << "\n";
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
Int const INF = 1e10;

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

    Int l,r,ans=INF,key; cin>>l>>r;
    if(r-l>2019){
        key=2019;
    }else key=r-l;
    for (int i = 0; i <= key; i++){
        for (int j = i+1; j <= key; j++){
            ans=min(ans,(l+i)*(l+j)%2019);
        }
    }
    cout<<ans<<'\n';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unistd.h>
#include <sys/time.h>
#include <stdlib.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P, ll> T;
 
long long int INF = 1e18;
const ll fact_table = 1200008;
double Pi = 3.1415926535897932384626;

priority_queue <ll> pql;
priority_queue <P> pqp;
priority_queue <P> bag;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
ll dx[8]={1,0,-1,0,1,1,-1,-1};
ll dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//↓,→,↑,←
 
 
#define p(x) cout<<x<<"\n";
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)(); 
#define pc(x) cout << x << ",";
 
// ll mod = 998244353ll;
// ll mod = 1000000007;
  
ll mypow(ll number1,ll number2, ll mod){
 
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = mypow(number1,number2 / 2, mod);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
/*
ll rui(ll number1,ll number2){
 
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
 
    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
*/
void YES(bool condition){
 
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
 
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}
 
/*
ll fact[fact_table + 5],rfact[fact_table + 5]; 
 
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=fact_table; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[fact_table] = rui(fact[fact_table],mod - 2);
    for(ll i=fact_table; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod ) * rfact[n-r]) % mod;}
*/
bool multicase = false;

ll n,m,num,sum,a,b,c,d,e,h,q;
ll w, k, l, r;
ll x[500005], y[500005], z[500005];
char s[500005], t[500005];

void solve(){
    cin >> n >> k;
    n = n % k;
    ll ans = min(n, k - n);
    p(ans);
    return;
}

int main(){
    // init();
    // ios::sync_with_stdio(false);
    // cin.tie(nullptr);
    
    ll q;
    if(multicase){
        cin >> q;
    }else{
        q = 1;
    }
    while(q--){
        // pu("Case ");pu("#");pu(testcase);pu(": ");
        solve();
    }
    
    // while(solve());
    // solve();
    return 0;

}


















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

using ll = long long;
using pll = pair<ll, ll>;

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

template<class T> vector<pair<T,T>> factorize(T n)
{
    vector<pair<T,T>> factors;

    T lim = sqrt(n) + 0.1;
    
    T c = 0;
    while (n % 2 == 0) {
        n /= 2;
        c++;
    }
    if (c != 0)
        factors.push_back(make_pair(2, c));

    for (T p = 3; p <= lim; p += 2) {
        T c = 0;
        while (n % p == 0) {
            n /= p;
            c++;
        }
        if (c != 0)
            factors.push_back(make_pair(p, c));
    }
    if (n != 1) {
        factors.push_back(make_pair(n, 1));
    }
    
    return factors;
}

int g(ll x) {
    ll sum = 0;
    int res = 0;
    for (ll n = 1; n <=x; n++) {
        sum += n;
        if (sum > x) break;
        res++;
    }
    return res;
}

int main()
{
    ll N; cin >> N;
    vector<pll> factors = factorize(N);

    int ans = 0;
    for (const auto& f : factors) {
        ll x = f.second;
        ans += g(x);
    }
    cout << ans << endl;
}


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

using namespace std;


const int MAXN = 1000;

int n, h, w;
int a[MAXN * MAXN], c[MAXN][MAXN];

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

    cin >> h >> w >> n;
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    int curColor = 1;
    for(int i = 0; i < h; i++) {
        if(i & 1) {
            for(int j = 0; j < w; j++) {
                c[i][j] = curColor;
                a[curColor]--;
                if(a[curColor] == 0) curColor++;
            }
        }
        else {
            for(int j = w - 1; j >= 0; j--) {
                c[i][j] = curColor;
                a[curColor]--;
                if(a[curColor] == 0) curColor++;
            }
        }
    }
    for(int i = 0; i < h; i++) {
        for(int j = 0; j < w; j++) {
            cout << c[i][j] << " ";
        }
        cout << "\n";
    }
}


Measured memory_bytes: 2688
#ifdef DEBUG_IS_VALID
#define DEB 1 
#define _LIBCPP_DEBUG 0
#else
#define DEB 0
#define NDEBUG
#endif

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

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
#define fi first
#define se second
#pragma GCC optimize ("-O3")

using namespace std;

#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T1,typename T2>ostream& operator << (ostream& os, pair<T1,T2> p){cout << "(" << p.first << ", " << p.second << ")"; return os;}
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
template<typename T>ostream& operator << (ostream& os, set<T>& st){cout << "{"; for(auto itr = st.begin(); itr != st.end(); itr++) cout << *itr << (next(itr)!=st.end() ? ", " : ""); cout << "}"; return os;}
template<typename T1,typename T2>ostream& operator << (ostream& os, map<T1,T2> mp){cout << "{"; for(auto itr = mp.begin(); itr != mp.end(); itr++) cout << "(" << (itr->first) << ", " << (itr->second) << ")" << (next(itr)!=mp.end() ? "," : ""); cout << "}"; return os; }

void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline bool chmax(T& a,T const& b){if(a>=b) return false; a=b; return true;}
template<class T> inline bool chmin(T& a,T const& b){if(a<=b) return false; a=b; return true;}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vp = vector<Pl>;
using vvp = vector<vp>;

const int INF = 1<<29;
const long long LINF=1LL<<59;


void solve(std::vector<long long> T, std::vector<long long> A, std::vector<long long> B){
  ll x = A[0]*T[0]+A[1]*T[1], y = B[0]*T[0]+B[1]*T[1];
  ll diff = x - y;
  if(diff<0){
    swap(A,B); swap(x,y); diff = -diff;
  }
  // x > y, Aが抜かす
  if(diff==0){
    cout << "infinity" << endl;
    return;
  }
  if(A[0]>B[0] && A[1]>B[1]){
    cout << "0" << endl;
    return;
  }
  ll c = A[0] * T[0], d = B[0] * T[0];
  if(c>d){
    cout << "0" << endl;
    return;
  }
  ll num = (d-c)/diff;
  ll ans = 2LL * (num+1LL) - 1LL;
  if(num*diff==d-c) ans--;
  cout << ans << endl;
}

int main(){
  std::cout << std::fixed << std::setprecision(15);
  std::vector<long long> T(2);
  for(int i = 0 ; i < 2 ; i++){
    scanf("%lld",&T[i]);
  }
  std::vector<long long> A(2);
  for(int i = 0 ; i < 2 ; i++){
    scanf("%lld",&A[i]);
  }
  std::vector<long long> B(2);
  for(int i = 0 ; i < 2 ; i++){
    scanf("%lld",&B[i]);
  }
  solve(std::move(T), std::move(A), std::move(B));
  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++)

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep (i, n) {
        cin >> a.at(i);
    }
    vector<int> ans(n);
    for (int i = 0; i < n; i++) {
        ans.at(n - a.at(i)) = i + 1;
    }
    reverse(ans.begin(), ans.end());
    rep(i, n) {
        cout << ans.at(i) << " ";
    }
    cout << endl;
    return 0;
    }

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
long long n,m;
int main()
{
	cin>>n>>m;
	
	if(n==0||m==0||n<0&&m>0){
	cout<<"Zero"<<endl;	
	return 0;
	} 
	if(n>0&&m>0||abs(n-m)%2==1){
	cout<<"Positive"<<endl;	
	return 0;
	}
	cout<<"Negative"<<endl;
	return 0;
}

Measured memory_bytes: 256
import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
# from math import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n,m,k=map(int,input().split())

# MOD combination
def cmb(n, r, mod=10**9+7):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

N = 2*10**5+10
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

ans=0
for i in range(n):
    ans+=i*(n-i)*m*m*cmb(n*m-2,k-2)
    ans%=mod

n,m=m,n
for i in range(n):
    ans+=i*(n-i)*m*m*cmb(n*m-2,k-2)
    ans%=mod

print(ans)

Measured memory_bytes: 81392
#include <bits/stdc++.h>
using namespace std;
const int n=1e5+1;
int c[n], s[n];
int main()
{
    for(int i=2; i*i<n; ++i) if (!c[i])
        for(int j=i*i; j<n; j+=i) c[j]=1;


    for(int i=3; i<n; ++i) s[i]=s[i-1]+!c[i]*!c[-~i/2];

    int q; cin>>q;
    while (q--) {
        int l, r; cin>>l>>r;
        cout<<s[r]-s[l-1]<<endl;
    }
}


Measured memory_bytes: 1408
n = int(input())
S = [input() for _ in range(n)]

word = []
end = S[0][0]
for i in range(n):
	val = S[i]
	if val[0] != end or val in word:
		print ("No")
		exit()
	else:
		end = val[-1]
		word.append(val)
print ("Yes")

Measured memory_bytes: 3060
s = list(input())
t = input()

if(len(s) != len(t)):
    print("No")
else:
    for i in range(len(s)):
        str = ''.join(s)
        if(str == t):
            print("Yes")
            exit()
        u = s.pop(0)
        s.append(u)
    print('No')

Measured memory_bytes: 3060
#include <cmath>
#include <iomanip>
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<pair<int, int>> v;
    for (int i = 0; i < n; ++i) {
        int x, y;
        cin >> x >> y;
        v.push_back({x, y});
    }
    double d = 0.0;
    for (int i = 0; i < n - 1; ++i) {
        for (int j = i + 1; j < n; ++j) {
            d +=
                sqrt((v[i].first - v[j].first) * (v[i].first - v[j].first) +
                     (v[i].second - v[j].second) * (v[i].second - v[j].second));
        }
    }
    double answer = d * (n - 1) / (n * (n - 1) / 2);
    cout << setprecision(15) << answer << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O0")
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
const ll mod = 1e9+7;
const ll INF = 1e18;
#define All(a) (a).begin(),(a).end()
#define Pi acos(-1)

class mint {
public:
    long long x;
    constexpr mint(long long x=0) : x((x%mod+mod)%mod) {}
    constexpr mint operator-() const { 
      return mint(-x);
    }
    constexpr mint& operator+=(const mint& a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    constexpr mint& operator-=(const mint& a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    constexpr mint& operator*=(const mint& a) {
        (x *= a.x) %= mod;
        return *this;
    }
    constexpr mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    constexpr mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    constexpr mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    constexpr mint pow(long long t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    constexpr mint inv() const {
        return pow(mod-2);
    }
    constexpr mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    constexpr mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }
};
ostream& operator<<(ostream& os, const mint& m){
    os << m.x;
    return os;
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << setprecision(15) << fixed;
  chrono::system_clock::time_point start,end;
  start = chrono::system_clock::now();

  ll n, k;
  cin >> n >> k;
  mint ans = 0;
  for (ll i = k; i <= n+1; ++i) {
    ans += i*(2*n-i+1)/2 - (i-1)*i/2 + 1;
  }
  cout << ans << '\n';

  end = chrono::system_clock::now();
  auto elapsed = chrono::duration_cast< chrono::milliseconds >(end - start).count();
  cerr << elapsed << "ms" << '\n';
}

Measured memory_bytes: 3588
#include <stdio.h>

int main(){
  long N,A,B;
  scanf("%ld %ld %ld",&N,&A,&B);
  long n=N/(A+B);
  long m=N%(A+B);
  n*=(A);
  if(m>A){
    m=A;
  }
  n+=m;
  printf("%ld",n);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cassert>
#include <functional>
#include <string>
using namespace std;

int main(){
  int N, K; cin >> N >> K;
  vector<int> x(N);
  for(int i = 0; i < N; i++) cin >> x[i];
  int ans = 0;
  for(int i = 0; i < N; i++){
    ans += 2 * min(x[i], K - x[i]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
module.exports=function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=0)}([function(e,r,t){t(1)(t(2).readFileSync("/dev/stdin","UTF-8"))},function(e,r){e.exports=function(e){var r=e.split("\n"),t=Number(r[0]),n=r[1].split(" ").map(function(e){return Number(e)}),o=new Array(t).fill(0);o[0]=n[0];for(var u=1;u<t;u++)o[u]=n[u],o[u]+=o[u-1];for(var i=o[t-1],f=1;f<t-1;f++){var l=Math.abs(o[t-1]-2*o[f]);l<i&&(i=l)}console.log(i)}},function(e,r){e.exports=require("fs")}]);

Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
const int MAXN=1005;
int P=1000000007;
int n,m;
char Matrix[MAXN][MAXN];
int dp[MAXN][MAXN];
int main(){
	cin>>n>>m;
	for(int i=1;i<=n;++i)
	{
		for(int j=1;j<=m;++j)
		{
			cin>>Matrix[i][j];
		}
	}
	if(Matrix[1][1]=='.') dp[1][1]=1;
	for(int i=1;i<=n;++i)
	{
		for(int j=1;j<=m;++j)
		{
			if(i==1&&j==1) continue;
			if(Matrix[i][j]=='.')
			{
				dp[i][j]=(dp[i-1][j]+dp[i][j-1])%P;
			}
		}
	}

	cout<<dp[n][m]<<endl;
	
	
	return 0;
}


Measured memory_bytes: 5120
import numpy as np

Height, Width = map(int, input().split())
mat = [[0 for i in range(Width)] for j in range(Height)]

for h in range(Height):
    a = input()
    
    for w in range(Width):
        if (a[w] == '.'):
            mat[h][w] = 0
        else:
            mat[h][w] = 1

mat = np.array(mat)

h_sur = []
w_sur = []

for h in range(Height):

    if (1 in mat[h]):
        h_sur.append(h)


for w in range(Width):

    if (1 in mat[:, w]):
        w_sur.append(w)


convert_w = len(w_sur)
convert_h = len(h_sur)

convert_mat = [[-1 for i in range(convert_w)] for j in range(convert_h)]
convert_mat=np.array(convert_mat)


for h_index, h in enumerate(h_sur):

    for w_index, w in enumerate (w_sur):

        convert_mat[h_index][w_index] = mat[h][w]


for i in range(convert_h):
    
    s=''
    for j in range(convert_w):
        if (convert_mat[i][j] == 1):
            s += '#'
        else:
            s += '.'
    
    print(s)


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

int main(){
  string S;
  cin >> S;
  if ((S.at(0) == S.at(1) && S.at(1) == S.at(2)) || (S.at(1) == S.at(2) && S.at(2) == S.at(3))){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
//<MIHIR KHAMBHATI/>
 
#include<bits/stdc++.h>
using namespace std;
 
#define mod 1000000007
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);
#define deb(x) cout<<"\n"<<#x<<"="<<x<<"\n";
#define deb2(x,y) cout<<"\n"<<#x<<"="<<x<<"\n"<<#y<<"="<<y<<"\n";
#define ideb int _p_;cin>>_p_;
typedef long long int ll;
typedef unsigned long long int ull;

int main()
{
ll a,b;
cin>>a>>b;
ll ans=0;
ll gcd=__gcd(a,b);
for(ll i=2;i*i<=gcd;i++)
{
	if(gcd%i==0)
	ans++;
	while(gcd%i==0)
	{
		gcd/=i;
	}

}
if(gcd!=1)
ans++;
cout<<ans+1;
}

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

typedef struct Edge {
    int to, cost;
} Edge;

struct Node {
    ll costK = INT64_MAX;
    vector<Edge> e;
};

void dfs(vector<Node>& NO, int cur, ll cost) {
    for (auto x : NO[cur].e) {
        if (NO[x.to].costK == INT64_MAX) {
            NO[x.to].costK = cost + x.cost;
            dfs(NO, x.to, cost + x.cost);
        }
    }
}

int main() {
    int N; cin >> N;
    vector<Node> NO(N);
    rep (i, N-1) {
        int a, b, c; cin >> a >> b >> c;
        a--, b--;
        NO.at(a).e.emplace_back(Edge{b,c});
        NO.at(b).e.emplace_back(Edge{a,c});
    }

    int Q, K; cin >> Q >> K;
    K--;
    NO[K].costK = 0;
    dfs(NO, K, 0);

    rep(i,Q) {
        int x, y; cin >> x >> y;
        x--, y--;
        cout << NO[x].costK + NO[y].costK << endl;
    }
}


Measured memory_bytes: 14016
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define repr(i,a,b) for (int i = a; i > b; --i)
#define mm(lamb, tttt) memset(lamb, tttt, sizeof lamb)
 
#define null NULL
#define eps 0.000000001
#define mod 1000000007
#define PI 3.14159265358979323846
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define ALL(V) V.begin(), V.end()
#define sz(V) (int)V.size()
#define _ <<" "<<
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long int ll;
typedef vector <int> vi;
typedef vector<vi> vvi;
typedef pair <int, int> ii;
typedef pair<int, pair<int,int> > iii;
typedef vector<ii> vii;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
 	//ll ans = 1;
	//freopen ("test.txt","r",stdin);
 	int n;cin>>n;
 	int a[n],b[n],c[n];
 	for (int i = 0; i < n; ++i)
 	{
 		cin>>a[i]>>b[i]>>c[i];
 	}

 	int dp1[n],dp2[n],dp3[n];

 	dp1[0] = a[0];
 	dp2[0] = b[0];
 	dp3[0] = c[0];

 	for (int i = 1; i < n; ++i)
 	{
 		dp1[i] = a[i] + max(dp2[i-1] , dp3[i-1]);
 		dp2[i] = b[i] + max(dp1[i-1] , dp3[i-1]);
 		dp3[i] = c[i] + max(dp2[i-1] , dp1[i-1]);

 	}
 	//cout<<dp1[n-1] _ dp2[n-1] _ dp3[n-1]<<endl;
 	cout<<max(dp1[n-1]  , max(dp2[n-1],dp3[n-1]));


}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define DEC(i, a, b) for (int i = (a); i > (b); --i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define pb push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
typedef long long ll;
const int INF = (int)1e9;
const int MOD = (int)1e9 + 7;
const ll LINF = (int)1e18;
const double EPS = 1e-9;

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

  int n;
  cin >> n;
  int h = 0;
  int ans = 0;
  int tmp = 0;
  REP(i,n) {
    int htmp;
    cin >> htmp;
    if (h >= htmp) ++tmp;
    else tmp = 0;
    h = htmp;
    ans = max(ans,tmp);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
s = input()

for i in range(int(len(s) / 2)):
    if s[i] != s[len(s) - 1 - i]:
        print('No')
        exit(0)
for i in range(int(int(len(s) / 2) / 2)):
    if s[i] != s[int(len(s) / 2) - 1 - i]:
        print('No')
        exit(0)
    if s[int(len(s) / 2) + 1 + i] != s[len(s) - 1 - i]:
        print('No')
        exit(0)
print('Yes')


Measured memory_bytes: 3064
#include<stdio.h>

int main(void)
{
  char s[256]={};
  int judge=0;
  int i;

  scanf("%s", s);

  for(i=0;i<200;i++)
    if(s[i]=='C')break;
  for(;i<200;i++)
    if(s[i]=='F')judge=1;

  if(judge)
    puts("Yes");
  else 
    puts("No");

  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define DEBUG2(x, y) cerr << #x << ": " << x << " " << #y << ": " << y << "\n"
#define DEBUG3(x, y, z)                                                        \
  cerr << #x << ": " << x << " " << #y << ": " << y << " " << #z << ": " << z  \
       << "\n"
#define PRINTALL(V)                                                            \
  for (auto v : (V)) {                                                         \
    cerr << v << " ";                                                          \
  }                                                                            \
  cerr << "\n";
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
#define pint pair< int, int >
#define ld long double
using namespace std;
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 (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template < class T > using vec = std::vector< T >;
template < class T > void print(const T &x) { cout << x << "\n"; }
const int MOD = 1000000007, INF = 1061109567, INF2 = INF * INF;
const double EPS = 1e-10, PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  vec< int > a(7);
  REP(i, 7) cin >> a[i];
  int ans = a[0] + a[1] + a[3] + a[4];
  int val = a[0] % 2 + a[3] % 2 + a[4] % 2;
  if (val == 1)
    ans--;
  if (val == 2) {
    if (a[0] == 0 || a[3] == 0 || a[4] == 0)
      ans -= 2;
    else
      ans--;
  }
  print(ans);
}

Measured memory_bytes: 256
n = int(input())
a = [sorted(input()) for i in range(n)]
from collections import Counter
b = []
for i in range(n):
    b.append(''.join(a[i]))
count = Counter(b)
ans = 0
for i in set(b):
    ans += count[i]*(count[i]-1)/2
print(int(ans))

Measured memory_bytes: 44640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

const double EPS = 1e-8;
using vec = vector<double>;
using mat = vector<vec>;

// 行列の階数を求める
// 係数行列と拡大係数行列の階数が異なるときは不能
// 係数行列と拡大係数行列の階数が等しく、係数行列の階数と変数の個数が異なるときは不定
// 係数行列と拡大係数行列の階数と変数の個数がすべて等しいときは一意解が存在
int mat_rank(mat A){
    const int R = A.size(), C = A[0].size();
    int ret = 0;
    for(int i=0; ret<R&&i<C; ++i){
        int pivot = ret;
        for(int j=ret+1; j<R; ++j){
            if(abs(A[j][i]) > abs(A[pivot][i])) pivot = j;
        }
        swap(A[pivot], A[ret]);

        if(abs(A[ret][i]) < EPS) continue;

        for(int k=C-1; k>=i; --k) A[ret][k] /= A[ret][i];
        for(int j=ret+1; j<R; ++j){
            for(int k=C-1; k>=i; --k) A[j][k] -= A[ret][k]*A[j][i];
        }
        ++ret;
    }
    return ret;
}

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

    mat Ab(n, vec(m+1));
    rep(i,m){
        int s,t;
        cin >>s >>t;
        --s;
        --t;

        Ab[s][i] = -1;
        Ab[t][i] = 1;
    }

    cout << m - mat_rank(Ab) << endl;
    return 0;
}



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

const int S = 510;
int sum[S+10][S+10];
signed main() {
    int N, M, Q; cin >> N >> M >> Q;
    for(int i=0; i<M; i++) {
        int l, r; cin >> l >> r;
        sum[l][r]++;
    }
    for(int i=0; i<S; i++) {
        for(int j=0; j<S; j++) sum[i][j] += sum[i][j-1];
    }
    for(int j=0; j<S; j++) {
        for(int i=0; i<S; i++) sum[i][j] += sum[i-1][j];
    }
    
    for(int i=0; i<Q; i++) {
        int p, q; cin >> p >> q;
        int ans = 0; p--;
        ans += sum[q][q] + sum[p][p];
        ans -= sum[p][q] + sum[q][p];
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 2944
#include<cstdio>

int main(){
    int a,b,c,A,B,C;
    scanf("%d %d %d",&a,&b,&c);
    A = a , B = b , C = c;
    if(A <= B){
        if(B <= C){
            a = A , b = B , c = C;
        }
        else if(B > C){
            if(A <= C){
                a = A , b = C , c = B;
            }
            else {
                a = C , b = A , c = B;
        }
        }
    }
    else if(A > B){
        if(A <= C){
            a = B , b = A , c = C;
        }
        else if(A > C){
            if(B <= C){
                a = B , b = C , c = A;
            }
            else{
                a = C , b = B , c = A;
            }
        }
    }
    printf("%d %d %d\n",a,b,c);
    return 0;
    }


Measured memory_bytes: 2728
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

    private static long MOD = 1000000007;

    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int h = scanner.nextInt();
        final int w = scanner.nextInt();
        final int k = scanner.nextInt();

        final List<boolean[]> patterns = new ArrayList<>();
        final boolean[] pattern = new boolean[w - 1];
        recursive(patterns, pattern, 0);

        final long[] counter = new long[w - 1];
        int all = 0;
        for (final boolean[] booleans : patterns) {
            all++;
            for (int i = 0; i < booleans.length; i++) {
                if (booleans[i]) {
                    counter[i]++;
                }
            }
        }

        final long[][] table = new long[h + 1][w];
        table[0][0] = 1;

        for (int i = 1; i < h + 1; i++) {
            for (int j = 0; j < w; j++) {
                int tmp = 0;
                if (j != 0) {
                    tmp += counter[j - 1];
                    table[i][j] += counter[j - 1] * table[i - 1][j - 1] % MOD;
                }

                if (j != w - 1) {
                    tmp += counter[j];
                    table[i][j] += counter[j] * table[i - 1][j + 1] % MOD;
                }

                table[i][j] += (all - tmp) * table[i - 1][j] % MOD;
            }
        }
        System.out.println(table[h][k - 1] % MOD);
    }

    private static void recursive(final List<boolean[]> patterns, final boolean[] pattern, final int index) {
        if (index == pattern.length) {
            patterns.add(pattern);
            return;
        }

        final boolean[] tmpPattern = Arrays.copyOf(pattern, pattern.length);
        tmpPattern[index] = true;
        recursive(patterns, pattern, index + 1);
        if (index == 0 || !pattern[index - 1]) {
            recursive(patterns, tmpPattern, index + 1);
        }
    }
}


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

signed main() {
  int A, B, C;
  cin >> A >> B >> C;
  
  if( (A < C && C < B) || (B < C && C < A) ) cout << "Yes" << endl;
  else cout << "No" << endl;
  
}

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

struct edge
{
	int to;
	int index;
};

std::vector<edge> edges[50];
long long path[50][50];

long long dfs(int v, int last, long long p, const int src)
{
	path[src][v] = p;
	for (auto &e : edges[v])
	{
		if (e.to == last) continue;
		dfs(e.to, v, p | 1LL << e.index, src);
	}
}

int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n - 1; ++i)
	{
		int a, b;
		scanf("%d%d", &a, &b);
		--a, --b;
		edges[a].emplace_back(edge{b, i});
		edges[b].emplace_back(edge{a, i});
	}
	int m;
	int bd[20][2];
	scanf("%d", &m);
	for (int i = 0; i < m; ++i)
	{
		int u, v;
		scanf("%d%d", &u, &v);
		--u, --v;
		bd[i][0] = u;
		bd[i][1] = v;
		dfs(u, -1, 0, u);
	}

	long long ng = 0;
	for (int i = 1; i < 1 << m; ++i)
	{
		long long white = 0;
		for (int j = 0; j < m; ++j)
		{
			if (((i >> j) & 1) == 0) continue;
			white |= path[bd[j][0]][bd[j][1]];
		}
		int fw = __builtin_popcountll(white);
		long long pat = 1LL << (long long)(n - 1 - fw);
		if (__builtin_parity(i)) ng += pat;
		else ng -= pat;
	}
	printf("%lld\n", (1LL << (long long)(n - 1)) - ng);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,k;
vector<int> a;
int add(int x,int y)
{
	if(a[x]==0)
		if(y>=0)
			return n-1;
		else
			return 0;
	int v=a[x];
	int l=0,r=n-1,ans=(v<0)?n:(-1);
    while(l<=r) 
	{
        int mid=(l+r)/2;
        if(v*a[mid]<=y) 
		{
            ans=mid;
            if(v<0) 
				r=mid-1;
            else 
				l=mid+1;
        } 
		else 
		{
            if(v<0)
				l=mid+1;
            else 
				r=mid-1;
        }
    }
    if(v<0) 
	{
        int cnt=0; 
		if(ans<=x) 
			cnt=-1;
        cnt+=(n-ans); 
		return cnt;
    } 
	else 
	{
        int cnt=0; 
		if(x<=ans) 
			cnt=-1;
        cnt+=(ans+1); 
		return cnt;
    }
}
int judge(int x)
{
	int ans=0;
	for(int i=0;i<n;i++)	
		ans+=add(i,x);
	return ans/2;
}
signed main()
{
	scanf("%lld%lld",&n,&k);
	for(int i=1;i<=n;i++)
	{
		int v;
		scanf("%lld",&v);
		a.push_back(v);
	}
	sort(a.begin(),a.end());
	int l=-1000000000000000009l,r=-l,ans;
	while(l<=r)
	{
		//cout<<l<<endl;
		int mid=(l+r)>>1;
		if(k<=judge(mid))
		{
			r=mid-1;
			ans=mid;
		}	
		else
			l=mid+1;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 2420
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
using ll = long long;
using namespace std;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}

int main(){
  string S; cin >> S;
  if(S.back()!='s') S += 's';
  else S+="es";
  cout << S << endl;
  return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b); (i) >= (a); --(i)) //Reversi for

int main()
{
    int ans;
    string a;
    cin >> a;
    rep(i, 3)if(a[i]== '1') ++ans;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define sc(n) scanf("%d",&n)
#define scl(n) scanf("%lld",&n)
#define pr(n) printf("%d",n)
#define prl(n) printf("%lld",n)
#define nl printf("\n")
#define fr(i,n) for(i=0;i<n;i++)
#define rep(i,st,en) for(i=st;i<=en;i++)
#define repv(i,st,en) for(i=en;i>=st;i--)
#define fout cout<<fixed<<setprecision(7)
#define bi(n) __builtin_popcount(n)
#define bil(n) __builtin_popcountll(n)


typedef long long ll;
typedef pair<int,int> pii;
const int N = 100010;
ll mod = 1e9+7;
ll fmod(ll b,ll exp){
    ll res =1;
    while(exp){if(exp&1ll)res=(res*b)%mod;
    b =(b*b)%mod;exp/=2ll;
    }
    return res;
}
ll C3(ll res)
{
    //if(num<=2)return 0;
    //ll res = (num*(num-1));
    //return (res*(num-2))/6ll;
    return (res*res*res);
}


int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //ios_base::sync_with_stdio(false);cin.tie(NULL);
    int t=1,n,i,j;
    int k;
    cin>>n>>k;
    ll cnt1=0,cnt2=0,cnt3=0;
    rep(i,1,n){
        int x = i;
        if(x%k==0)cnt1++;
        if(k%2==0 && k>1 && x%k==(k/2))cnt2++;
        if(k%2==0 && k>1 && x%k==(k/2) && x%k==0)cnt3++;
    }
    cout<<C3(cnt1)+C3(cnt2)-C3(cnt3)<<"\n";


    
    return 0;
}


Measured memory_bytes: 256