akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
typedef long long				ll;
#define ALL(x)					(x).begin(),(x).end()
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define M_PI					3.14159265358979323846
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
int main()
{
	ll H;
	cin >> H;

	ll ans = 0;
	ll monNum = 1;
	while (H != 0) {
		ans += monNum;
		monNum *= 2;
		H /= 2;
	}

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


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
bool initialized = false;

/**
 * @fn
 * This function must be called at first.
 */
void combination_init() {
    initialized = true;
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

/**
 * @fn
 * Calculates the combination  ( nCK % p: N choose K mod p).
 *
 * @brief constraint: 1 ≤ k ≤ n ≤ 10^7
 * @return nCK % MOD
 */
long long combination(int n, int k) {
    assert(initialized);
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

/**
 * @fn
 * Calculates the factorial of the number.
 *
 * @return N! % MOD
 */
long long factorial(int n) {
    assert(initialized);
    if (n < 0) return 0;
    return fac[n] % MOD;
}

/**
 * @fn
 * Calculates the combination ( nCK % p: N choose K mod p).
 *
 * @brief constraint: 1 ≤ k ≤ 10^7 and 1 ≤ n ≤ 10^9
 * @return nCK % MOD
 */
long long combination2(int n, int k) {
    assert(initialized);
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    ll res = 1;
    k = min(k, n - k);
    for (long long x = 1; x <= k; x++) {
        res *= (n - x + 1);
        res %= MOD;
        res *= inv[x];
        res %= MOD;
    }
    return res;
}


void Main() {
    int N, K; // 青がK個，赤がN-K個
    cin >> N >> K;
    combination_init();

    rep2(i, 1, K+1){ // i: 青が入るブロック数
        // N-K+1個の間の中からi個の(連続する)青を入れる場所を決定; (N-K+1)Ci
        // -> 一個以上入れるという制約を守りながら青を配置((K-1)個の間から(i-1)箇所選んでそこで切り分ける): (K-i)H(i-1)=(K-1)C(i-1)
        ll ans = combination2(N - K + 1, i) * combination2(K-1, i-1) % MOD;
        cout << ans << endl;
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 12160
n = int(input())
a = list(map(int, input().split()) )
swt = 1
ans = 0
while swt == 1:
    for i, num in enumerate(a):
        if num % 2 == 1 or num == 1:
            swt = 0
            break
        else:
            a[i] = num // 2
    if swt == 1:
        ans += 1
print(ans)

Measured memory_bytes: 3060
k,n = map(int,raw_input().split(' '))
hs = map(int ,raw_input().split(' '))
hs.sort()
distances = [abs(u-v) for u,v in zip(hs,hs[1:])]
distances.append(k - hs[-1] + hs[0])
s = sum(distances)
print s - max(distances)

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

// @@ !! LIM()

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  string T; cin >> T;
  for (ll i = 0; i < (ll)T.size(); i++) {
    if (T.at(i) == '?') T.at(i) = 'D';
  }
  cout << T << endl;

  return 0;
}



Measured memory_bytes: 3744
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

int main(void){
	int a, b, c; cin >> a >> b >> c;
	if(b - a == c - b) printf("YES\n");
	else printf("NO\n");
	return 0;
}

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

using namespace std;

using lint = long long;
using ldouble = long double;

bool solve() {
    string S[2];
    cin >> S[0];
    if (S[0] == ".") return false;
    cin >> S[1];

    vector<string> div[2][2];
    for (int i = 0; i < 2; ++i) {
        S[i].push_back('\"');
        string tmp;
        int bra = 0;
        for (char c : S[i]) {
            if (c == '\"') {
                div[i][bra].push_back(tmp);
                bra = 1 - bra;
                tmp.clear();
            } else {
                tmp.push_back(c);
            }
        }
    }

    int diff = 0;
    for (int bra = 0; bra < 2; ++bra) {
        if (div[0][bra].size() != div[1][bra].size()) {
            cout << "DIFFERENT" << endl;
            return true;
        }

        for (int i = 0; i < div[0][bra].size(); ++i) {
            if (div[0][bra][i] != div[1][bra][i]) {
                diff += 2 - bra;
            }
        }
    }

    cout << (diff >= 2 ? "DIFFERENT"
                       : (diff == 1 ? "CLOSE" : "IDENTICAL"))
         << endl;
    return true;
}

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



Measured memory_bytes: 3116
#pragma comment(linker, "/stack:200000000")
        #pragma GCC optimize ("Ofast")
        #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
        #include <iostream>
        #include <iomanip>
        #include <sstream>
        #include <cstring>
        #include <vector>
        #include <deque>
        #include <queue>
        #include <set>
        #include <map>
        #include <valarray>
        #include <iterator>
        #include <functional>
        #include <limits>
        #include <algorithm>
        #include <numeric>
        #include <cmath>
        #include <cassert>
        #include <unordered_map>
        #include <unordered_set>
        #include <stack>
        using namespace std;
        #define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
         #define trace(x) cerr << #x << ": " << x << " " << endl;
     
        typedef int64_t ll;
     
        #define endl '\n'
        #define int ll
        ll mod=1e9+7;
        ll mod1=1e9+5;
        ll power(ll a,ll b)
        {
            if(b==0) return 1;
            else if(b%2==0)
                return power((((a%mod)*(a%mod))%mod),b/2)%mod;
            else return ((a%mod)*(power((((a%mod)*(a%mod))%mod),b/2)%mod))%mod;
        }
        int n,t;
        int dp[3001][3001];
        pair<int,int> a[3001];
        int solve(int i,int j)
        {
            if(i==n)
                return 0;
            if(j>t)
                return 0;
            int &res=dp[i][j];
            if(res!=-1)
                return res;
            res=0;
            res=solve(i+1,j);
                res=max(res,a[i].second+solve(i+1,j+a[i].first));
            return res;


        }
     int32_t main()
        {
            IOS
        
        cin>>n>>t;
        memset(dp,-1,sizeof(dp));
        for(int i=0;i<n;++i)
        {
            cin>>a[i].first>>a[i].second;
        }
        sort(a,a+n);
        cout<<solve(0,1);


        


        }


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


int main(){
	string S;
	cin >> S;
	string op = "+-";
	vector<int> s(4);
	rep(i, 4) s.at(i) = S.at(i) - '0';
	// rep(i, 4) cout <<
	// calc(s, 1, val);
	rep(i, 2){
		int v1 = s.at(0);
		if (i == 0) v1 += s.at(1);
		else v1 -= s.at(1);
		rep(j, 2){
			int v2 = v1;
			if (j == 0) v2 += s.at(2);
			else v2 -= s.at(2);
			rep(k, 2){
				int v3 = v2;
				if (k == 0) v3 += s.at(3);
				else v3 -= s.at(3);
				if (v3 == 7){
					cout << s.at(0) << op.at(i);
					cout << s.at(1) << op.at(j);
					cout << s.at(2) << op.at(k);
					cout << s.at(3) << "=7" << endl;
					return 0;
				}
				// cout << v3 << endl;
			}
		}
	}
	// cout << "=7" << endl;
}

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

int N = 0;
int K = 0;
int h = 0;
int a = 0;
int main() {
	cin >> N;
	cin >> K;
	for (int i = 0; i < N;i++) {
		cin >> h;
		if (h >= K) {
				a++;
			}
		else
			a=a;
	}
	cout << a;
	
	return 0;
}
 

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
typedef long long LL;
using namespace std;

int n , p ;
LL c[100][100] , po[100];
void Init(){
	po[0] = 1;
	for(int i = 1;i <= 51;i++) po[i] = po[i - 1] * 2LL;
	for(int i = 1;i <= 50;i++){
		c[i][0] = 1;
		for(int j = 1;j <= i;j++){
			if(j == i) c[i][j] = 1;
			else c[i][j] = c[i - 1][j] + c[i - 1][j - 1];
		}
	}
}
void Solve(int odd ,int even){
	LL ans = 0;
	if(p & 1){
		for(int i = 1;i <= odd;i += 2){
			ans = ans + c[odd][i] * po[even];
		}
	}
	else {
		for(int i = 0;i <= odd;i += 2){
			if(odd != 0) ans = ans + c[odd][i] * po[even];
			else ans = po[even];
		}
	}
	printf("%lld\n" , ans);
}
int main()
{
	Init();
	while(~scanf("%d%d" , &n , &p)){
		int odd = 0 , even = 0;
		for(int i = 1;i <= n;i++) {
			int x;
			scanf("%d" , &x);
			if(x & 1) odd++;
			else even++;
		}
		Solve(odd , even);
	}
}

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

using namespace std;

#define make_unique(a) (a.erase(unique(a.begin(),a.end()),a.end()))
#define allof(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pb push_back
#define exists(s, e) (s.find(e)!=s.end())
#define INF 0x3f3f3f3f
#define endl '\n'
#define mp make_pair
#define readln(x) (getline(cin, x))
#define watch(x) cout << (#x) << " is " << (x) << endl;
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false); debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))

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

ll gcd(ll a, ll b) {return b == 0 ? a : gcd(b, a % b);}
ll fpow(ll  b, ll exp, ll mod){if(exp == 0) return 1;ll t = fpow(b,exp/2,mod);if(exp&1) return t*t%mod*b%mod;return t*t%mod;}
ll divmod(ll i, ll j, ll mod){i%=mod,j%=mod;return i*fpow(j,mod-2,mod)%mod;}

void solve() {
    vector<int> v(3);
    cin >> v[0] >> v[1] >> v[2];
    sort(allof(v));
    if(v[0]==5 and v[1]==5 and v[2]==7) cout << "YES" << endl;
    else cout << "NO" << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    solve();
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
#define f first
#define s second
using namespace std;

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

	int count =0 ;
	for(int i=0;i<n;i++){
		int x,y;
		cin >> x >> y;
		if(x == y){
			count++;
		}else{
			count = 0;
		}
		if(count == 3){
			cout << "Yes";
			return;
		}
	}
	cout << "No" << endl;
}

int main(){


/*#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif*/
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	//int t;cin >> t;while(t--){solve();}
	solve();
	return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 2000000007
#define LINF 100000000000000007
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
//typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
int ceil2(int a,int b){if(a%b){return a/b+1;}else{return a/b;}}
int n,d,ans;
int l[1111];
signed main(){
	cin>>n;
	rep(i,n)cin>>l[i];
	rep(i,n){
		for(int j=i+1;j<n;j++){
			for(int k=j+1;k<n;k++){
				if(l[i]==l[j]||l[j]==l[k]||l[i]==l[k])continue;
				if(l[i]+l[j]>l[k] && l[k]+l[j]>l[i] && l[i]+l[k]>l[j]){
					ans++;
				}
			}
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
typedef pair<ll, int> p;

#define MOD 1000000007
 
int main() {
	cin.tie(0);
    ios::sync_with_stdio(false);

    int N, M;
    ll K;

    cin >> N >> M >> K;

    vector<ll> A(N);
    vector<ll> B(M);

    for(int i = 0; i < N; i++) cin >> A[i];
    for(int i = 0; i < M; i++) cin >> B[i];

    vector<ll> as(N + 1);
    vector<ll> bs(M + 1);

    for(int i = 1; i <= N; i++) as[i] = A[i - 1] + as[i - 1];
    for(int i = 1; i <= M; i++) bs[i] = B[i - 1] + bs[i - 1];

    int ans = 0;

    for(int i = 0; i <= N; i++) {
        if(K - as[i] < 0) break;
        ll r = K - as[i];
        int x = upper_bound(bs.begin(), bs.end(), r) - bs.begin();
        ans = max(ans, i + x - 1);
    }

    for(int i = 0; i <= M; i++) {
        if(K - bs[i] < 0) break;
        ll r = K - bs[i];
        int x = upper_bound(as.begin(), as.end(), r) - as.begin();
        ans = max(ans, i + x - 1);
    }

    if(as[N] + bs[M] <= K) ans = N + M;

    cout << ans << endl;
}

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

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

#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,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

int H, W;
string vs[51];

int solve(int y1, int y2){
  int res = 0;
  for(int y=0;y<y1;++y)
	REP(x,W)
	  if(vs[y][x] != 'W')
		++res;
  for(int y=y1;y<y2;++y)
	REP(x,W)
	  if(vs[y][x] != 'B')
		++res;
  for(int y=y2;y<H;++y)
	REP(x,W)
	  if(vs[y][x] != 'R')
		++res;
  return res;
}

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

  cin >> H >> W;
  REP(y,H) cin >> vs[y];

  int ans = 1e9;
  for(int y1=1;y1<H;++y1)
	for(int y2=y1+1;y2<H;++y2){
	  mini(ans, solve(y1, y2));
	}

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3228
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(long long i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define ll long long
#define pb push_back
#define eb emplace_back
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V<V<T>>;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true; }return false; }
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true; }return false; }
inline void Yes(bool b = true) {cout << (b ? "Yes" : "No") << '\n';}
inline void YES(bool b = true) {cout << (b ? "YES" : "NO") << '\n';}
inline void err(){cout << -1 << '\n';}
const ll INF = 1e18;

ll Roundup_div(ll x, ll y) {return (x+(y-1))/y;}

map<ll,ll> mp;
ll n, a, b, c, d;

ll dfs(ll now){
    if(mp[now] or !now) return mp[now];
	ll result = 0;
    ll res = (__builtin_mul_overflow(now,d, &result) ? INF : now * d);
    chmin(res, dfs(now/2) + now%2 * d + a );
	chmin(res, dfs(Roundup_div(now,2)) + now%2 * d + a);
    chmin(res, dfs(now/3) + now%3 * d + b);
	chmin(res, dfs(Roundup_div(now,3)) + (3 -now%3) * d + b);
    chmin(res, dfs(now/5) + now%5 * d + c);
	chmin(res, dfs(Roundup_div(now,5)) + (5 -now%5) * d + c);
    return mp[now] = res;
}

void solve(){
    cin >> n >> a >> b >> c >> d;
    mp.clear();
    mp[1] = d;
    cout << dfs(n) << '\n';
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t; cin >> t;
    while(t--) solve();
}


Measured memory_bytes: 4464
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, a, b) for (int i = a; i < (b + a); i++)
#define W1 while (1)
#define COUT(x) cout << x << endl
using namespace std;
using ll = long long;
using ld = long double;
#define ALL(x) x.begin(),x.end()
#define P pair<int,int>
#define mod 1000000007
#define PB push_back
#define F first
#define S second

int main() {
  vector<int> a(3);
  string ans = "No";
  rep(i, 3) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  if ((a[0] == a[1] && a[1] != a[2]) || (a[0] != a[1] && a[1] == a[2])) {
    ans = "Yes";
  }
  COUT(ans);

  return 0;
}


Measured memory_bytes: 3596
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp11
{
    class Class20
    {
        static void Main()
        {
            int[] N = Console.ReadLine().Split().Select(int.Parse).ToArray();
            long R = N[1] * (long)Math.Pow(N[1] - 1, N[0] - 1);
            Console.WriteLine(R);
                
        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define ll long long
int main(){
  ll A,B,K;
  cin>>A>>B>>K;
  if(B-A>2*K-1){
    rep(i,K) cout<<A+i<<endl;
    rep(i,K) cout<<B-K+1+i<<endl;
  }else rep(i,B-A+1) cout<<A+i<<endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// #include<ext/pb_ds/tag_and_trait.hpp>
// using namespace __gnu_pbds;
using namespace std;
using ll=long long;
#define double long double
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
// using llset=tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>;
#define For(i,a,b) for(i=a;i<(ll)b;i++)
#define bFor(i,a,b) for(i=a;i>=(ll)b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define pb push_back
#define print(v) cout<<v<<endl
#define printyes cout<<"Yes"<<endl
#define printno cout<<"No"<<endl
#define printYES cout<<"YES"<<endl
#define printNO cout<<"NO"<<endl
#define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0)
const ll mod=1000000007;
const ll inf=1LL<<60;
const double PI = acos(-1);
const double eps = 1e-9;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} 
template<class T> inline bool chmin(T& a,T b){bool x=a>b;if(x)a=b;return x;} 

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

double distance(ddatas x,ddatas y){
  double a=x.first-y.first,b=x.second-y.second;
  return sqrt(a*a+b*b);
}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

vec modncrlistp,modncrlistm;

ll modncr(ll n,ll r){
  ll i,size=modncrlistp.size();
  if(size<=n){
    modncrlistp.resize(n+1);
    modncrlistm.resize(n+1);
    if(!size){
      modncrlistp[0]=modncrlistm[0]=1;
      size++;
    }
    For(i,size,n+1){
      modncrlistp[i]=modncrlistp[i-1]*i%mod;
      modncrlistm[i]=modinv(modncrlistp[i]);
    }
  }
  return modncrlistp[n]*modncrlistm[r]%mod*modncrlistm[n-r]%mod;
}

ll modpow(ll a,ll n){
  ll res=1;
  while(n){
    if(n&1)res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll gcd(ll a,ll b){if(!b)return a;return (a%b==0)?b:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

int main(){
  // startupcpp();
  // ll test;cin>>test;while(test--){
  ll i,j,N,H,W,ans;
  string s,t,u;
  cin>>s;
  rep(i,s.size())cout<<"x";
  cout<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define push push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<long long> V;
typedef vector<V> VV;
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 INFLL = 1LL<<62;
const int INF = 1<<30;
int main(){
    int n;
    int ans=0;
    int a[]={1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51};
    cin >>n;
    cout<<a[n-1]<<endl;

    
}

Measured memory_bytes: 256
package main
import "fmt"
func main() {
  var s,t,sp string
  var n,l int
  m := make(map[string]struct{})
  fmt.Scan(&s)
  fmt.Scan(&t)
  n = len(s)
  l = len(t)
  var trune []rune = []rune(t)
  Loop_i:
  for i:=0;i<n-l+1;i++ {
    for j:=0;j<l;j++ {
      if s[i+j:i+j+1] != t[j:j+1] &&
      s[i+j:i+j+1] != "?" {
        continue Loop_i
      }
    }
    var srune []rune = []rune(s)
    for j:=0;j<l;j++ {
      srune[i+j] = trune[j]
    }
    for j:=0;j<n;j++ {
      if srune[j] == 63 { srune[j] = 97 }
    }
    sp = string(srune)
    m[sp] = struct{}{}
  }
  if len(m) == 0 {
    fmt.Println("UNRESTORABLE")
  } else {
    sp = ""
    for i:=0;i<n;i++ { sp += "z" }
    for k,_ := range m {
      if sp > k { sp = k }
    }
    fmt.Println(sp)
  }
}

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

int main(){
    string s;
    cin >> s;
    
    int sum = 700;

    if(s[0] == 'o'){
        sum += 100;
    }
    if(s[1] == 'o'){
        sum += 100;
    }
    if(s[2] == 'o'){
        sum += 100;
    }

    cout << sum << endl;
}

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

using namespace std;
using ll = long long;

const int N = 100005;
const ll oo = 5e17;

int n;
int a[N];
ll r[N];

int main() {
	scanf("%d", &n);
	n++;
	for(int i = 0; i < n; i++) scanf("%d", a + i);
	if(n == 1) return printf("%d\n", a[0] == 1 ? 1 : -1), 0;
	if(a[0]) return printf("-1\n"), 0;
	r[0] = 1;
	for(int i = 1; i < n; i++) {
		r[i] = min(2 * r[i - 1] - a[i], oo);
		if(r[i] < 0) return printf("-1\n"), 0;
	}
	ll ans = 0;
	ll nodes = 0;
	for(int i = n - 1; i >= 0; i--) {
		assert(nodes <= 2 * r[i]);
		nodes = min(nodes, r[i]);
		nodes += a[i];
		ans += nodes;
	}
	printf("%lld\n", ans);
}


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


/*
int solve(int i){
	if(i == 0) return 0;
	if(i == 1) return 0;
	if(memo[i] != -1) return memo[i];
	int m = INT_MAX;
	for(int d = 1; d <= k; d++){
		if(i - d < 0) break;
		m = min(solve(i-d, k)+abs(h[i]-h[i-d]), m);
	}
	return memo[i] = m;
}*/


int n, m;

int dp[1000][1000] = {};

int main(){
	int h, w;
	cin >> h >> w;

	for(int y = 0; y < h; y++){
	for(int x = 0; x < w; x++){
		char buf; cin >> buf;
		if(buf == '#') dp[x][y] = 0;
		else{
			if(y != 0) dp[x][y] += dp[x][y-1];
			if(x != 0) dp[x][y] += dp[x-1][y];
			dp[x][y] = dp[x][y] % 1000000007;
		}
		if(x == 0 && y == 0) dp[x][y] = 1;
	}
	}

	cout << dp[w-1][h-1] << endl;

    return 0;
}



Measured memory_bytes: 4096
#include<bits/stdc++.h>
#define Fst first
#define Snd second
#define RG register
#define mp make_pair
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long LL;
typedef long double LD;
typedef unsigned int UI;
typedef unsigned long long ULL;
template<typename T> inline void read(T& x) {
	char c = getchar();
	bool f = false;
	for (x = 0; !isdigit(c); c = getchar()) {
		if (c == '-') {
			f = true;
		}
	}
	for (; isdigit(c); c = getchar()) {
		x = x * 10 + c - '0';
	}
	if (f) {
		x = -x;
	}
}
template<typename T, typename... U> inline void read(T& x, U& ... y) {
	read(x), read(y...);
}
int n;
int A[100010];
//#define rua
int main() {
//	ios::sync_with_stdio(false);
#ifdef rua
	freopen("GG.in","r",stdin);
#endif
  read(n);
  int a=n,b=0;
  for(int i=1;i<=n;++i) {
    read(A[i]);
    a=min(a,A[i]);
    b=max(b,A[i]);
  }
  if(b-a>1) return puts("No"),0;
  if(a==b) {
    if(A[1]*2<=n||A[1]==n-1) puts("Yes");
    else puts("No");
    return 0;
  }
  int cnt=0;
  for(int i=1;i<=n;++i) if(A[i]==a) ++cnt;
  if(b-cnt>0&&(b-cnt)*2<=n-cnt) puts("Yes");
  else puts("No");
	return 0;
}


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

int len[5] = {5, 7, 5, 7, 7};

int main() {
  int N;
  while (cin >> N, N) {
	vector<string> a(N); for (int i = 0; i < N; ++i) cin >> a[i];
	for (int i = 0; i < N; ++i) {
	  bool ok = true;
	  int j = i;
	  for (int it = 0; it < 5; ++it) {
		string str = "";
		while (j < N && str.size() < len[it]) str += a[j++];
		if (str.size() != len[it]) {
		  ok = false;
		  break;
		}
	  }
	  if (ok) {
		cout << i+1 << endl;
		break;
	  }
	}
  }
}
		
		
		



Measured memory_bytes: 3192
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<stack>
#include<list>
#include<unordered_map>
#include<unordered_set>
#include<cctype>
#include<iomanip>

using namespace std;
typedef long long int ll;typedef pair<int, int> P;
const long long mod = 1e9 + 7;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(a) (a).begin(),(a).end()
#define allg(a) (a).begin(),(a).end(),greater<>()
#define SUM(a) accumulate((a).begin(),(a).end(),0)
const double PI = 3.14159265359;

int main(void) {
	int x; cin >> x;
	if (x % 2 == 0)cout << 0.5 << endl;
	else {
		int a = x / 2 + 1;
		cout << (double)a / x << endl;
		
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct card
{
    int b;
    int c;
};
priority_queue<int,vector<int>,greater<int> > q;
card ca[1000000];int n,m;
void readdata()
{
    cin>>n>>m;
    int e;
    for (int i=1;i<=n;i++)
    {
        cin>>e;
        q.push(e);
    }
    for (int i=1;i<=m;i++)
    {
        cin>>ca[i].b>>ca[i].c;
    }
}

bool cmp(card a,card b)
{
    return a.c>b.c;
}

void solve()
{
    for (int i=1;i<=m;i++)
    {
        while ((!q.empty())&&(ca[i].b>0))
        {
            if (q.top()<ca[i].c)
            {
                q.pop();
                ca[i].b--;
                q.push(ca[i].c);
            }
            else return;
        }
    }
}

void sum()
{
    long long s=0;
    while (!q.empty())
    {
        s+=q.top();
        q.pop();
    }
    cout<<s;
}

int main()
{
    //freopen("inte.inp","r",stdin);
   // freopen("inte.out","w",stdout);
    readdata();
    sort(ca+1,ca+m+1,cmp);
    solve();
    sum();
    return 0;
}


Measured memory_bytes: 1528
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cctype>
#define rep(i,x,y) for(int i=x; i<=y; ++i)

using namespace std;
int n,ans;
struct data{int x,y;} dat[55];

int solve(int p,int q)
{
	int rt=0;
	rep(i,1,n)
	{
		int jdg=1;
		rep(j,1,n) if(dat[i].x-p==dat[j].x && dat[i].y-q==dat[j].y) jdg=0;
		rt+=jdg;
	}
	return rt;
}

int main()
{
	scanf("%d",&n);
	rep(i,1,n) scanf("%d%d",&dat[i].x,&dat[i].y);
	ans=n;
	rep(i,1,n) rep(j,1,n) if(i!=j)
		ans=min(ans,solve(dat[i].x-dat[j].x,dat[i].y-dat[j].y));
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
#![allow(dead_code, unused_imports, non_snake_case)]

use std::io::*;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::str::FromStr;

const MOD: i32 = 1_000_000_007;

macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty ;; $n:expr) => {
        (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
    };
}

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, t) = get!(usize, usize);
    let ts: Vec<usize> = (0..n).map(|_| read()).collect();
    let mut ans = t;
    for i in 1..n {
        ans += min(t, ts[i] - ts[i - 1]);
    }
    println!("{}", ans);
}


Measured memory_bytes: 6396
#include<stdio.h>
#define N 10
#define M 100005
int d,i,j,k;
double dp[M]={0,1,1.5},p[N]={1.0},np[N],res;

int main()
{
	for(i=1;i<N;i++)
	{
		double x=1.0/(double)(1<<i);
		p[i]=x*p[i-1];
		np[i]=(1-x)*p[i-1];
	}
	for(i=3;i<M;i++)
	{
		for(j=1;j<N&&i-j-1>=0;j++)
			dp[i]+=np[j]*(j+dp[i-j-1]);
		if(i-1<N)
			dp[i]+=i*p[i-1];
	}
	for(;scanf("%d",&d),d;)
	{
		printf("%f\n",dp[d]);
	}
	return 0;
}

Measured memory_bytes: 1412
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;

int main()
{
	vector<int> n;
	int x;
	for (int i = 0; i < 5; ++i){
		cin >> x;
		n.push_back(x);
	}

	sort(n.begin(), n.end(),greater<int>());

	for (int i = 0; i < 5; ++i){
		cout << n[i];
		if (i != 4)
			cout << " ";
		else
			cout << endl;
	}

	return 0;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<ll, II> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 400010;
const int MAXM = 100010;
const int MAXK = 510;
const int MAXQ = 200010;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    int n;
    cin >> n;
    if (n == 3 || n == 5 || n == 7) cout << "YES";
  else cout << "NO";
    return 0;
}

Measured memory_bytes: 256
import java.io.{PrintWriter, _}
import java.util._


object Main {
  def main(args: Array[String]): Unit = {
    val inputStream = System.in
    val outputStream = System.out
    val in = new InputReader(inputStream)
    val out = new PrintWriter(outputStream)
    val solver = new Task
    solver.solve(1, in, out)
    out.close()
  }

  class Task {
    def solve(testNumber: Int, in: InputReader, out: PrintWriter): Unit = {
      val a = in.nextLine.split(" ").map(i => i.toInt)
      var i = 0
      var count = 0
      var res = 0
      while (i < a(0)){
        i += 1
        count += 1
        if (count == a(1)){
          res += 1
          count = 0
          i -= (a(1) - 1)
        }
      }
      println(res)
    }
  }

  class InputReader(val stream: InputStream) extends AutoCloseable {
    //reader = new BufferedReader(new FileReader(stream), 32768);
    private val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    private var tokenizer = new StringTokenizer("")


    def next: String = {
      while ( {
        tokenizer == null || !tokenizer.hasMoreTokens
      }) try
        tokenizer = new StringTokenizer(reader.readLine)
      catch {
        case e: IOException =>
          throw new RuntimeException(e)
      }
      tokenizer.nextToken
    }

    def nextLine: String = {
      try
        return reader.readLine
      catch {
        case e: IOException =>
          e.printStackTrace()
      }
      ""
    }

    def nextInt: Int = next.toInt

    def nextLong: Long = next.toLong

    override def close(): Unit = {
    }
  }

}


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

int main(void){
    int n,m,i;
    int f=0;
    cin >> n;
    int a[n];
    for(i=0; i<n; i++){
        cin >> a[i];
    }
    for(i=0;i<n;i++){
        f += a[i]-1;
    }

    cout << f << endl;

    return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;

const int MAX = 100000;

int main(){
  ios::sync_with_stdio(false);
	cin.tie(NULL);
 
	int n;
	cin >> n;
	int dp[MAX + 1];
	dp[0] = 0;
  for(int i=1;i<=n;i++){
    dp[i]=dp[i-1]+1;
    for(int j=6;j<=i;j=j*6){
      dp[i]=min(dp[i],dp[i-j]+1);
    }
    for(int j=9;j<=i;j=j*9){
      dp[i]=min(dp[i],dp[i-j]+1);
    }
  }
  cout << dp[n] << endl;
  return 0;
}

Measured memory_bytes: 640
import java.util.Scanner

import scala.annotation.tailrec

object Main extends App {
  val sc = new Scanner(System.in)
  val t = System.currentTimeMillis

  val n  = sc.nextInt
  val av = Seq.fill(n)(sc.nextInt)
  
  @tailrec
  def loop( vec: Seq[Int], target: Int = 1 ): Int = {
    val rest = vec.dropWhile(_ != target)
    (target, rest.isEmpty) match {
      case (1, true) => -1
      case (_, true) => target
      case _ => loop(rest.tail, target + 1 )
    }
  }

  val target = loop(av)
  val res = if(target == -1) -1 else n - target + 1

  println(res)

}



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

namespace CSharpSample01
{
    
    class Program
    {

       
        static void Main(string[] args)
        {
            int A = int.Parse(Console.ReadLine());
            int B = int.Parse(Console.ReadLine());
            int C = int.Parse(Console.ReadLine());
            int[,] masu = new int[3, 3];
            masu[0, 0] = A;
            masu[0, 1] = B;
            masu[1, 1] = C;

            masu[2, 0] = A + B - C;

            masu[2, 1] = A + C - masu[2, 0];

            int sum = B + C + masu[2, 1];

            masu[1, 0] = sum - A - masu[2, 0];

            masu[1, 2] = sum - (C + masu[1, 0]);

            masu[2, 2] = sum - (masu[2, 0] + masu[2, 1]);

            masu[0, 2] = sum - (masu[1, 2] + masu[2, 2]);

            for(int i = 0; i < 3; i++)
            {
                for(int j = 0; j < 3; j++)
                {
                    Console.Write(masu[i, j]);
                    if(j != 2)
                    {
                        Console.Write(" ");
                    }
                }
                Console.WriteLine();
            }


        }
    }
}


Measured memory_bytes: 13140
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int h = sc.nextInt();
		int n = sc.nextInt();
		int [] x = new int [n];
		int [] y = new int [n];
		int [] a = new int [n];
		int goukei = 0;
		int min_x = 0; int max_x = w;
		int min_y = 0; int max_y = h;
		int fx = 0; int fy = 0;
		
		for(int i = 0; i < n; i++){
		x[i] = sc.nextInt();
		y[i] = sc.nextInt();
		a[i] = sc.nextInt();
		}
		
		for(int i = 0; i < n; i++){
		switch(a[i]){
		case 1 : if(min_x < x[i]){min_x = x[i];} break;
		case 2 : if(max_x > x[i]){max_x = x[i];} break;
		case 3 : if(min_y < y[i]){min_y = y[i];} break;
		case 4 : if(max_y > y[i]){max_y = y[i];} break;
		default:
		}}
		
		if(max_x >= min_x){ fx = max_x - min_x; } else { fx = 0; }
		if(max_y >= min_y){ fy = max_y - min_y; } else { fy = 0; }
		goukei = fx * fy;
		
		System.out.println(goukei);
	}}
		

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

#define for_(i,a,b) for(int i=a;i<b;++i)
#define for_rev(i,a,b) for(int i=a;i>=b;--i)
#define allof(a) a.begin(),a.end()
#define minit(a,b) memset(a,b,sizeof(a))
#define size_of(a) (int)a.size()

typedef long long lint;
typedef double Double;
typedef pair< int, int > pii;

typedef vector< int > Array;
typedef vector< Array > Matrix;

inline int POPCNT(int _x) { return __builtin_popcount(_x); }

int R, C;
int table[11][10010];
int b_table[100010];

int calc_senbei(int S) {
	int res = 0;
	int flip = (1 << R) - 1;
	
	for_(i,0,C) {
		int i_bit = b_table[i];
		int xor_bit = i_bit ^ S;
		res += max(R - POPCNT(xor_bit), R - POPCNT(xor_bit ^ flip));
	}
	
	return res;
}

void solve() {
	for_(i,0,C) {
		int i_bit = 0;
		for_(j,0,R) if (table[j][i] == 1) i_bit |= 1 << j;
		b_table[i] = i_bit;
	}
	
	int ans = 0;
	
	int rep = 1 << R;
	for_(S,0,rep) {
		ans = max(ans, calc_senbei(S));
	}
	
	cout << ans << endl;
}

int main() {
	while (cin >> R >> C, R) {
		for_(i,0,R) for_(j,0,C) cin >> table[i][j];
		solve();
	}
	return 0;
}

Measured memory_bytes: 1604
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int N = 10000000 + 5;
int gcd(int a, int b){
	return b == 0 ? a : gcd(b,a%b);
}
int lcm(int a, int b){
	return a/gcd(a, b)*b;
}
int main(){
	int n;
	cin >> n;
	int z = lcm(n,360);
	cout << z / n << endl;
	return 0;
}

Measured memory_bytes: 3632
#include <cmath>
#include <iostream>
#include <string>
#include <vector> 
#include <algorithm>
#include <numeric>
#include <map>   
#include <stdio.h>

#define FOR(i,a,b) for(i=(a);i<(b);++i) 
#define FORR(i,a,b) for(i=(a);i>(b);--i)
#define REP(i,n) for(i=0;i<(n);++i)
#define REPR(i,n) for(i=(n);i>0;--i)
#define PB push_back
#define ull unsigned long long
#define ll long long
#define INT_MAX 2147483647
#define LL_MAX 9223372036854775807
#define sortR(a,b) sort(a, b, greater<int>())

using namespace std;

int main() {
	int N, i, ans = 0;;
	vector<int> V(20), C(20);
	cin >> N;
	REP(i, N) {
		cin >> V[i];
	}
	REP(i, N) {
		cin >> C[i];
	}
	REP(i, N) {
		if (V[i] > C[i])
			ans += V[i] - C[i];
	}
	cout << ans;
	return 0;
}



Measured memory_bytes: 256
N = int(input())
a = [int(x) for x in input().split()]
colors = [0]*9
cnt = 0
for i in a:
    if(i//400>8):
        colors[8]+=1
    else:
        colors[i//400]+=1
for i in colors[:-1]:
    if(i>0):
        cnt+=1
if(cnt == 0 and colors[8]>0):
    print(1,colors[8])
else:
    print(cnt,cnt+colors[8])


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

template<class ADD,class DEL,class CALC>
class Mo{
private:
    int width;
    vec<int> left,right,ord;
    vec<bool> v;
public:
    Mo(int N,int Q):width((int) sqrt(N)),ord(Q),v(N){
        iota(ord.begin(),ord.end(),0);
    }

    //[l,r)
    void add_query(int l,int r){
        left.push_back(l);
        right.push_back(r);
    }

    void run(const ADD &add,const DEL &del,const CALC& calc){
        sort(ord.begin(),ord.end(),[&](int i,int j){
            int b1 = left[i]/width,b2 = left[j]/width;
            if(b1!=b2) return b1<b2;
            if(b1&1) return right[i]<right[j];
            return right[i]>right[j];
        });

        int nl = 0,nr = 0;
        auto process = [&](int id){
            v[id].flip();
            if(v[id]) add(id);
            else del(id);
        };

        for(auto id:ord){
            while(nl>left[id]) process(--nl);
            while(nr<right[id]) process(nr++);
            while(nl<left[id]) process(nl++);
            while(nr>right[id]) process(--nr);
            calc(id);
        }

    }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,M;
    cin >> N >> M;
    vec<int> A(N);
    for(int i=0;i<N;i++){
        cin >> A[i];
        A[i]--;
    }
    vec<int> cnt(N);
    int now = 0;
    vec<int> ans(M);
    auto add = [&](int id){
        if(cnt[A[id]]==0) now++;
        cnt[A[id]]++;
    };
    auto del = [&](int id){
        cnt[A[id]]--;
        if(cnt[A[id]]==0) now--;
    };
    auto calc = [&](int id){
        ans[id] = now;
    };
    Mo<decltype(add),decltype(del),decltype(calc)> ushitapunichiakun(N,M);
    for(int i=0;i<M;i++){
        int l,r;
        cin >> l >> r;
        l--;
        ushitapunichiakun.add_query(l,r);
    }
    ushitapunichiakun.run(add,del,calc);
    for(auto x:ans) cout << x << "\n";
}


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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    map<int,int> mp;
    for(auto it:a){
        mp[it]++;
    }
    double dp[303][303][303];
    //dp[i][j][k]:1枚の皿がi枚、2枚の皿がj枚、3枚の皿がk枚あったときの期待値
    for(int i=0;i<303;i++){
        for(int j=0;j<303;j++){
            for(int k=0;k<303;k++)dp[i][j][k]=0;
        }
    }
    for(int k=0;k<=n;k++){
        for(int j=0;j<=n;j++){
            for(int i=0;i<=n;i++){
                double m=double(n);
                double p1=double(i)/m,p2=double(j)/m,p3=double(k)/m;
                double sum=p1+p2+p3;
                if(i==0&&j==0&&k==0)continue;
                dp[i][j][k]=1;
                if(i!=0)dp[i][j][k]+=dp[i-1][j][k]*p1;
                if(j!=0)dp[i][j][k]+=dp[i+1][j-1][k]*p2;
                if(k!=0)dp[i][j][k]+=dp[i][j+1][k-1]*p3;
                dp[i][j][k]/=sum;
            }
        }
    }
    cout<<setprecision(20)<<dp[mp[1]][mp[2]][mp[3]]<<endl;
}

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


public class Main {
    public static void main(String[] args) {

    	try{
    		InputStreamReader isr = new InputStreamReader(System.in);
			BufferedReader br = new BufferedReader(isr);
			String buf = br.readLine();
			double r = Double.parseDouble(buf);
	    	//面積 πr^2
	    	//円周 2πr
	    	System.out.printf("%f %f",Math.PI*Math.pow(r, 2),Math.PI*2*r);

    	} catch(IOException e) {
    		System.err.println(e);
		}
    }
}

Measured memory_bytes: 16936
from itertools import combinations

def Main(N, M, X, C, A):
    inds = list(range(N))
    ind_subset = []
    for i in range(1, N+1):
        for c in combinations(inds, i):
            ind_subset.append(c)
    ans = []
    for e in ind_subset:
        c = 0
        a = [0]*M
        for j in e:
            c += C[j]
            a = [a[k]+A[j][k] for k in range(M)]
        if min(a) >= X:
            ans.append(c)
    if len(ans) == 0:
        return -1
    else:
        return min(ans)      
    
def main():
    N, M, X = map(int, input().split())
    B = []
    C = []
    A = []
    for i in range(N):
        B = list(map(int, input().split()))
        c = B[0]
        a = B[1:]
        C.append(c)
        A.append(a)
    print(Main(N, M, X, C, A))

if __name__ == '__main__':
    main()

Measured memory_bytes: 9348
n = int(input())
s = input()
mod = 10**9+7

s = sorted(s)
s += '#'
count = 1
ans = 1
for i in range(1, n+1):
    if s[i] == s[i-1]:
        count += 1
    else:
        ans = (ans * (count+1)) % mod
        count = 1
print(ans-1)


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

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 f(int x)
{
    int res = 0;
    while (x % 2 == 0)
    {
        x /= 2;
        res++;
    }
    return res;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    rep(i, n)
    {
        if (a[i] % 2 == 1)
        {
            cout << 0 << endl;
            return 0;
        }
        a[i] /= 2;
    }

    int t = f(a[0]);
    rep(i, n)
    {
        if (f(a[i]) != t)
        {
            cout << 0 << endl;
            return 0;
        }
        a[i] >>= t;
    }
    m >>= t;

    ll l = 1;
    rep(i, n)
    {
        l = lcm(l, a[i]);
        if (l > m)
        {
            cout << 0 << endl;
            return 0;
        }
    }

    m /= l;
    int ans = (m + 1) / 2;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        int x = Integer.parseInt(Integer.toString(a) + Integer.toString(b));
        if(is_square(x)){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
    public static boolean is_square(int x){
        int sqrt = (int)Math.floor(Math.sqrt(x));
        return (sqrt*sqrt == x);
    }
}

Measured memory_bytes: 21716