akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <climits>
//#include "h.h"
using namespace std;

#define MOD1097 1000000007

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define pm(first, second) pb(mp(first, second))
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(X) (X).begin(), (X).end()

vector<pair<pll, int>> PX, PY;
vector<int> parent;

//ノードXの根を返す
int root(int X){
	if(parent[X] < 0)return X;
	return parent[X] = root(parent[X]);
}
//ノードXが属するグループのサイズ(属するノード数)を返す
int size(int X){
	return -parent[root(X)];
}
//Xの属するグループとYの属するグループを繋ぐ
//それぞれの根どうしを繋ぐ
bool connect(int X, int Y){
	//根同士をつなぐため指すノードを根にする
	X = root(X);
	Y = root(Y);
	//すでに繋がっているときは繋がずにfalseを返す
	if(X == Y){
		return false;
	}
	//大きいほうに小さいほうを繋ぎたいので逆ならスワップ
	if(size(X) < size(Y))swap(X, Y);
	//繋がれる方のサイズを更新
	parent[X] += parent[Y];
	//繋ぐ方の親を設定
	parent[Y] = X;
	return true;
}

int main(){

	int N;
	cin >> N;
	int a;
	bool allEven = true;
	for(int i = 0; i < N; i ++){
		cin >> a;
		if(a%2 == 1)allEven = false;
	}
	if(allEven)cout << "second" << endl;
	else cout << "first" << endl;

//"Hiroakimm0415"
	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <tuple>
#include <set>
#include <map>
#include <unordered_map>
#include <complex>
#include <iomanip>
#include <cmath>
using namespace std;
typedef long long ll;

int main()
{
  int a[3], ans = 0;
  for (int i = 0; i < 3; i++) cin >> a[i];
  sort(a, a + 3);
  while (abs(a[0] - a[1]) > 1) {
    a[0] += 2;
    ans++;
  }
  sort(a, a + 3);
  if (a[0] == a[1]) ans += a[2] - a[0];
  else  ans += a[2] - a[0] + 1;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
const int maxn=405;
ll c[maxn][maxn],sum[maxn][maxn];
ll a[maxn],b[maxn];
ll dp[maxn][maxn];
void init()
{
    for(int i=0;i<maxn;i++)
    {
        c[i][0]=1;c[i][1]=i;
        for(int j=2;j<maxn;j++)
        {
            c[i][j]=c[i][j-1]*i%mod;
        }
    }
    for(int i=0;i<maxn;i++)
    {
        sum[0][i]=c[0][i];
        for(int j=1;j<maxn;j++)
        {
            sum[j][i]=(sum[j-1][i]+c[j][i])%mod;
        }
    }
}
int main()
{
    init();
    int n,c;
    while(~scanf("%d%d%",&n,&c))
    {
        for(int i=1;i<=n;i++)
            scanf("%d",&a[i]);
        for(int i=1;i<=n;i++)
            scanf("%d",&b[i]);
        memset(dp,0,sizeof(dp));
        dp[0][0]=1;
        for(int i=1;i<=n;i++)
        {
            for(int j=0;j<=c;j++)
            {
                for(int k=0;k<=j;k++)
                {
                    dp[i][j]=(dp[i][j]+dp[i-1][j-k]*(sum[b[i]][k]-sum[a[i]-1][k]+mod)%mod)%mod;
                }
            }
        }
        printf("%lld\n",dp[n][c]);
    }
}



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

int main()
{
    int n;cin>>n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin>>a[i];    
    int ans = 0;
    for(int i = 1; i < n; i++){
        if(a[i] == a[i -1]){
            int sum = 1;
            while(a[i] == a[i - 1]) {
                sum++;
                i++;
            }
            ans += sum / 2;
            i--;
        }
        
        
    
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
   int a,b;cin>>a>>b;
   if (a>b){cout<<"a > b"<<endl;}
   else if(a<b){cout<<"a < b"<<endl;}
   else cout<<"a == b"<<endl;
}




Measured memory_bytes: 3100
#include <cstdio>
#include <queue>
#include <iostream>
#include <bits/stdc++.h>
#include<stdio.h>
#include<string.h>
#include<fstream>

#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)

using namespace std;


int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
       
    int i,j,k,p=1,q=1;
    long n,m,tmp;
    ll sum=0;
    int a[10000];
    string s[200000];
    string str;
    char c;
    int strr[200005];
    cin>>n;
    cin >> str;
    rep(i,n-1){
        if(str[i]==str[i+1]) sum++;
    }

    std::cout<< n-sum << endl;
    //outputfile<<str;
   // outputfile.close();

    return 0;
}

Measured memory_bytes: 2048
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

//code by lynmisakura.wish to be accepted!
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

/***************************/
using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<long long> vl;
typedef pair<ll, ll> pi;
typedef vector<pair<ll, ll>> vpi;

//const long long INF = 1LL << 55;

#define itn ll
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ss second
#define ff first
#define dup(x,y) ((x) + (y) - 1)/(y)
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()
#define Rep(n) for(ll i = 0;i < n;i++)
#define rep(i,n) for(ll i = 0;i < n;i++)
#define flush fflush(stdout)
#define rrep(i,n) for(ll i = n - 1;i >= 0;i--)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define ioboost cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll qp(ll a, ll b) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
ll qp(ll a, ll b, ll mo) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }

#define _GLIBCXX_DEBUG
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

class BROTN {
public:
    static constexpr int kStressIterations = 0;
    static void generateTest(std::ostream& test) {
    }

    void solve(std::istream& cin, std::ostream& cout) {
        int n;cin >> n;
        string s;cin >> s;
        vector<char> t(52);
        rep(i,26)t[i] = t[i+26] = 'A' + i;
        rep(i,s.size()){
            int m = s[i] - 'A';
            s[i] = t[m + n];
        }
        cout << s << endl;
    }
};

int main() {
	BROTN solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
/**
 *    author:  tootal    
 *    created: 2020/03/28 16:12:57
**/
#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];
    }
    int mean=round(1.0*accumulate(a.begin(), a.end(), 0)/n);
    int ans=0;
    for_each(a.begin(), a.end(), [&](int x){
        ans+=(x-mean)*(x-mean);
    });
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int n,x;
    int  a[100010]{};
    long long int k=0;

    cin>>n>>x;

    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(int i=0;i<n-1;i++)
    {
        if(a[i]+a[i+1]>=x)
        {
            int tem=a[i]+a[i+1]-x;
            k=k+tem;
            if(a[i+1]>=tem)
            {
                a[i+1]=a[i+1]-tem;
            }
            else
            {
                a[i+1]=0;
                a[i]=a[i]-(tem-a[i+1]);
            }
        }
    }
    cout<<k<<endl;
    return 0;
}


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

#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define sz(x) ((int) x.size())
#define pb(x) push_back(x)
typedef long long ll;
typedef pair<int, int> point;

const int MAXN = 2e5 + 5;

int n;
int a[MAXN];
int pref1[MAXN], pref2[MAXN];
ll sol;

int calc1(int x, int y){
    if(x) return pref1[y] - pref1[x - 1];
    return pref1[y];
}

int calc2(int x, int y){
    if(x) return pref2[y] ^ pref2[x - 1];
    return pref2[y];
}

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

    cin >> n;
    REP(i, n)
        cin >> a[i];

    pref1[0] = pref2[0] = a[0];
    FOR(i, 1, n){
        pref1[i] = pref1[i - 1] + a[i];
        pref2[i] = pref2[i - 1] ^ a[i];
    }

    REP(i, n){
        int lo = i, hi = n - 1;
        while(lo < hi){
            int mid = (lo + hi + 1) >> 1;
            if(calc1(i, mid) == calc2(i, mid))
                lo = mid;
            else
                hi = mid - 1;
        }
        sol += lo - i + 1;
    }
    cout << sol;
}


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

#define rep(i, a, b) for (int i = (a); i < (int)(b); i++)
#define rrep(i, a, b) for (int i = (a); i >= (int)(b); i--)
#define all(x) (x).begin(), (x).end()
using i32 = int32_t;
using i64 = int64_t;
using f32 = float;
using f64 = double;
using P = pair<int, int>;

template <class T>
bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    } else {
        return false;
    }
}
template <class T>
bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    } else {
        return false;
    }
}

template <class T>
void dump_vec(const vector<T>& v) {
    auto len = v.size();
    rep(i, 0, len) {
        cout << v[i] << (i == (int)len - 1 ? "\n" : " ");
    }
}

struct FastIO {
    FastIO() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} FASTIO;

//---------------------------------------------------------------------------------------------------

//---------------------------------------------------------------------------------------------------

signed main() {
    int N;
    cin >> N;
    vector<i64> A(N);
    map<i64, i64> mp;
    rep(i, 0, N) {
        i64 a;
        cin >> a;
        A[i] = a;
        mp[a]++;
    }

    i64 total = 0;
    for (const auto& p : mp) {
        auto n = p.second;
        total += n * (n - 1) / 2;
    }

    rep(i, 0, N) {
        auto a = A[i];
        auto cnt = mp[a];
        auto org = cnt * (cnt - 1) / 2;
        auto tmp = total - org;
        auto subed = (cnt - 1) * (cnt - 2) / 2;
        auto ans = tmp + subed;
        cout << ans << "\n";
    }
}


Measured memory_bytes: 11136
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Joy
 */

#include <bits/stdc++.h>
#define REP(i, N) for (ll i = 0; i < (N); ++i)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define INF 1e9
#define INFL 1e18
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

class APoor {
public:
	void solve(std::istream& in, std::ostream& out) {
        int A, B, C;
        in >> A >> B >> C;
        string ans = "No";
        if (A == B && A == C) ans = "No";
        else if (A == B || A == C || B == C) ans = "Yes";
        out << ans << '\n';
    }
};


int main() {
	APoor solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>

#define MIN(X,Y) ((X)<(Y)?(X):(Y))

typedef long long lli;

int main(void){
    lli last, now, tot=0;
    lli n,t;
    
    scanf("%lld%lld", &n, &t);
    scanf("%lld", &last);
    for (int i=1; i<n; i++){
        scanf("%d", &now);
        tot += MIN(t, now-last);
        last = now;        
    }
    tot += t;
    printf("%d\n", tot);
    return 0;
}

Measured memory_bytes: 128
let inputString = '';

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', function() {
    inputString = inputString.replace(/\s*$/, '')
        .split('\n')
        .map(str => Number(str.replace(/\s*$/, '')));

    maximumProfit(inputString.slice(1));
});

const maximumProfit = (arr) => {
  let profit = null;
  
  let buy = arr[0];
  for (let i=1; i<arr.length; i++) {
    const sell = arr[i];
    const p = sell - buy;
    if (profit === null || profit < p) {
      profit = p;
    }
    if (sell < buy) {
      buy = sell;
    }
  }
  
  console.log(profit);
};


Measured memory_bytes: 47604
#include <stdio.h>
int main(void){
    int a[101][101]={{0}};
    int r[100]={0};         
    int c[100]={0};         
    int row,column;
    int i,j;
    
    scanf("%d %d",&row,&column);
    
    for(i=0; i<row; i++){
        for(j=0; j<column; j++){
            scanf("%d",&a[i][j]);
        }
    }
    
    for(i=0; i<row; i++){
        for(j=0; j<column; j++){
            r[i] += a[i][j];
            c[j] += a[i][j];
            a[row][column] += a[i][j];
            
        }
    }
    
    for(i=0; i<row; i++){
        a[i][column] = r[i];
    }
    for(j=0; j<column; j++){
        a[row][j] = c[j];
    }
    
    
    for(i=0; i<=row; i++){
        for(j=0; j<=column; j++){
            printf("%d",a[i][j]);
            if(j<column) putchar(' ');
            else putchar('\n');
        }
    }
    
    return 0;
}

Measured memory_bytes: 652
n,m,c = map(int, input().split())
B = list(map(int, input().split()))
count = 0
for i in range(n):
  a = list(map(int, input().split()))
  num = [a[j]*B[j] for j in range(m)]
  if sum(num)+c > 0:
    count += 1

print(count)

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

int main(){
   int64_t x,y;
   int64_t ans=2147483647;
   cin>>x>>y;
   ans=(x*y)/2;
   if(x==1||y==1){
      cout<<1<<endl;
   }
    else if(x*y%2==1){
       cout<<ans+1<<endl;
   }else if(x*y%2==0){
   cout<<ans<<endl;
   } 
   

}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

string S;
ll sum[212345];

int main() {
	cin >> S;
	reverse(ALL(S));
	
	sum[0] = 0;
	ll p2019 = 1;
	REP(i, S.size()) {
		sum[i + 1] = (sum[i] + p2019 * (S[i] - '0')) % 2019;
		p2019 = p2019 * 10 % 2019;
	}
	
	ll ans = 0;
	map<int, int> mm;
	++mm[0];
	for (int i = S.size() - 1; i >= 0; --i) {
		ans += mm[sum[i + 1]];
		++mm[sum[i + 1]];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 5316
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (a + b < c + d) {
    cout << "Right" << endl;
  }
  if (a + b > c + d) {
    cout << "Left" << endl;
  }
  if (a + b == c + d) {
    cout << "Balanced" << endl;
  }
}

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

int bubbleSort(int A[], int n){
	int sw=0;
	int flag = 1;
	for(int i = 0; flag; i++){
		flag = 0;
		for(int j = n-1;  j > i;  j--){
			if(A[j] < A[j-1]){
				swap(A[j], A[j-1]);
				flag =1;
				sw = sw + 1;
			}
		}
	}
	return sw;
}

int main(){
	int n;
	int A[100];
	cin >> n;
	for(int i = 0; i < n; i++) cin >> A[i];
	
	int count = bubbleSort(A, n);
	for(int i = 0; i <n; i++){
		if(i) cout << " ";
		cout << A[i];
	}
	cout << endl;
	cout << count << endl;
	
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using V = vector<ll>;
#define _GLIBCXX_DEBUG
#define rep(i, a, b) for(int i = a; i < b; i++)
#define ALL(v) v.begin(), v.end()


int main(){
    int n; cin>>n;
    vector<int> x(n);
    rep(i,0,n) cin>>x[i];

    sort(x.begin(),x.end());
    int m=x[0], M=x[n-1];
    int ans=1001001001;
    for(int j=m; j<=M; j++){
        int anse=0;
        rep(i,0,n){
            anse+=(x[i]-j)*(x[i]-j);
        }
        ans=min(ans,anse);
    }
    cout<<ans<<endl;
}


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

using namespace std;

int main()
{
    map<string, int> name;
    vector<string> v;
    string s;
    int n;
    int max = 0;

    cin >> n;

    for (int i = 0; i < n; i++) {
        cin >> s;
        name[s]++;
    }

    for (auto x: name) {
        if (max < x.second) {
            max = x.second;
        }
    }

    for (auto x: name) {
        if (x.second == max) {
            v.push_back(x.first);
        }
    }

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

    for (auto x: v) {
        cout << x << endl;
    }

}


Measured memory_bytes: 26868
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
typedef long long  Weight;
struct Edge {
	int src, dest;
	int cap, rev;
	Weight weight;
	bool operator < (const Edge &rhs) const { return weight > rhs.weight; }
};

const int V = 4000;
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
typedef vector<Weight> Array;
typedef vector<Array> Matrix;
Weight h[V];                //??????????????£???
Weight dist[V];             //???????????¢
int prevv[V], preve[V];  //??´???????????¨??????

void add_edge(Graph &g, int src, int dest, int cap, int weight) {
	g[src].push_back(Edge{ src, dest, cap, (int)g[dest].size(), weight });
	g[dest].push_back(Edge{ dest, src, 0, (int)g[src].size() - 1, -weight });
}
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(auto i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 2147483647;
const long long int L_INF = 9223372036854775807;
Weight min_cost_flow(Graph &g, int s, int t, int f) {
	Weight res = 0;
	memset(h, 0, sizeof(h));
	typedef pair<Weight, int> P;
	while (f > 0) {
		priority_queue<P, vector<P>, greater<P> > que;
		fill(dist, dist + V, INF);
		dist[s] = 0;
		que.push(P(0, s));
		while (!que.empty()) {
			P p = que.top(); que.pop();
			int v = p.second;
			if (dist[v] < p.first) continue;
			REP(i, g[v].size()) {
				Edge &e = g[v][i];
				if (e.cap > 0 && dist[e.dest] > dist[v] + e.weight + h[v] - h[e.dest]) {
					dist[e.dest] = dist[v] + e.weight + h[v] - h[e.dest];
					prevv[e.dest] = v;
					preve[e.dest] = i;
					que.push(P(dist[e.dest], e.dest));
				}
			}
		}
		if (dist[t] == INF) return -1;
		REP(v, V) h[v] += dist[v];

		int d = f;
		for (int v = t; v != s; v = prevv[v]) d = min(d, g[prevv[v]][preve[v]].cap);
		f -= d;
		res += d * h[t];
		for (int v = t; v != s; v = prevv[v]) {
			Edge &e = g[prevv[v]][preve[v]];
			e.cap -= d;
			g[v][e.rev].cap += d;
		}
	}
	return res;
}
int main() {
	while (1) {
		int M, W; cin >> M >> W;
		if (!M)break;
		vector<int>males(M), femas(W);
		for (int i = 0; i < M; ++i) {
			cin >> males[i];
		}
		for (int i = 0; i < W; ++i) {
			cin >> femas[i];
		}
		const int start = 0;
		const int man = start + 1;
		const int wom = man + M;
		const int goal = wom + W;
		Graph g(goal + 1);
		for (int i = 0; i < M; ++i) {
			add_edge(g, start, man + i, 1, 0);
		}
		for (int i = 0; i < M; ++i) {
			for (int j = 0; j < W; ++j) {
				const int ele = abs(males[i] - femas[j])*((abs(males[i] - femas[j]) - 30)*(abs(males[i] - femas[j]) - 30));
				add_edge(g, man + i, wom + j, 1, 1000000 - ele);
			}
		}
		for (int i = 0; i < W; ++i) {
			add_edge(g, wom + i, goal, 1, 0);
		}
		int ans = min_cost_flow(g, start, goal, min(M, W));
		cout << 1000000 * (min(M, W)) - ans << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3216
#include <bits/stdc++.h>
#define FOR(i, l, r) for(ll i = l; i < r; i++)
#define rep(i, N) FOR(i, 0, N)
using namespace std;

typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<ll> vl;
const ll MOD = round(1e9+7);

int main() {
    int N; cin >> N;
    vi D(N); rep(i,N) cin >> D[i];
    int M; cin >> M;
    vi T(M); rep(i,M) cin >> T[i];
    if(M > N) {cout << "NO";return 0;}
    sort(D.begin(),D.end()); 
    sort(T.begin(),T.end()); 
  
    bool ans = true;
    int tmp=0;
    rep(i,M){
      while(tmp < N-1 && D[tmp] < T[i]) tmp++;
      if(tmp < N && D[tmp] == T[i]){ tmp++;continue;
      }else{ans = false; break;}
      
    }
  
    cout << (ans?"YES":"NO");
    return 0;
}


Measured memory_bytes: 4776
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb push_back
#define ld long double
#define f first
#define s second
#define in insert
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e18 + 5;
const int mod = 1e9 + 7;
const int  N = 2e5 + 314;
const long double pi = 3.1415926535897932384626433832795;
void solve(){
    int n, cnt=0;
    cin>>n;
    vi v(n);
    for(int i = 0; i < n; i++)cin>>v[i];
    for(int i = 0; i < n; i++){
        for(int j = i+1; j < n; j++){
            for(int k = j+1; k < n; k++){
                if(v[i]+v[j]>v[k]&&v[i]+v[k]>v[j]&&v[j]+v[k]>v[i]&&v[i]!=v[j]&&v[i]!=v[k]&&v[k]!=v[j]){
                    cnt++;
                }
            }
        }
    }   
    cout<<cnt;
}
signed main(){
    speed;
    int t=1;
    //cin>>t;
    while(t--)solve();
}

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

int i,j,n,c=0;
scanf("%d",&n);
int s[n];

for(i=0;i<n;i++){
    scanf("%d",&s[i]);


}

for(i=1;i<n;i++)
for(j=0;j<n-1;j++){
    if(s[j]>s[j+1]){
        int temp =s[j];
        s[j]=s[j+1];
        s[j+1]=temp;
        c++;

    }



}


for(i=0;i<n;i++)
    if(i==n-1)
printf("%d\n",s[i]);
else
    printf("%d ",s[i]);


printf("%d\n",c);


}



Measured memory_bytes: 2032
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << endl; }
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
  string s;
  cin >> s;
  bool C = false;
  bool F = false;
  rep(i,sz(s)){
    if(s[i]=='C'){
      C = true;
    }
    if(C&&s[i]=='F'){
      F = true;
    }
  }
  if(C&&F){
    print("Yes");
  }
  else{
    print("No");
  }
}

Measured memory_bytes: 3584
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    final long N = sc.nextLong();
    long A = sc.nextLong();
    long B = sc.nextLong();
    sc.close();
    long ans = 0;
    if((B-A)%2 == 0) {
    	ans = (B-A)/2;
    }else {
    	ans = Math.min(A-1, N-B)+1+((B-A-1)/2);
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int mod = 1e9 + 7;
signed main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n, m;
	cin >> n >> m;
	vector<vector<bool>>in(n, vector<bool>(m, true));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			char x;
			cin >> x;
			if (x == '#')in[i][j] = false;
		}
	}
	vector<vector<int>>dp(n, vector<int>(m));
	dp[0][0] = 1;
	for (int i = 1; i < m; i++) {
		if (in[0][i - 1] == true)dp[0][i] = dp[0][i - 1];
	}
	for (int i = 1; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if (j > 0 && in[i][j - 1] == true) {
				dp[i][j] += dp[i][j - 1];
			}
			if (in[i - 1][j] == true)dp[i][j] += dp[i - 1][j];
			dp[i][j] %= mod;
		}
	}
	cout << dp[n - 1][m - 1];
	return 0;
}

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

int main(){
  string S,T;
  cin>>S>>T;
  for(int i=0;i<S.size();i++)
    if(S.at(i)!=T.at(i)){
      cout<<"No"<<endl;
      return 0;
    }
  cout<<"Yes"<<endl;
}

Measured memory_bytes: 3636
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdbool.h>
#include<stdlib.h>


int main() {
	int a, b;
	scanf("%d%d", &a, &b);

	printf("%d", (3 * a + b) / 2);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::fill;

using std::setprecision;
using std::fixed;

using std::min;
using std::max;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef string S;

namespace MySpace{

};

#define F(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define re return
#define all(x) (x).begin(), (x).end()

inline int nextInt()
{
    int x = 0;
    char c = getchar();
    int mi = (c == '-');
    if (c == '-') c = getchar();
    while ('0' <= c && c <= '9')
    {
        x = 10 * x + c - '0';
        c = getchar();
    }
    if (mi) return x * -1;
    return x;
}

vector<int> graph[500000];
int mark[500000];
int a[500000];
int n, m;

vector<int> b;

void dfs(int x)
{
    if (mark[x] == 1) return;
    mark[x] = 1;
    b.push_back(x);
    b.push_back(a[x]);
    for (auto u : graph[x])
    {
        dfs(u);
    }
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }
    for (int i = 1; i <= m; i++)
    {
        int x, y;
        cin >> x >> y;
        graph[x].push_back(y);
        graph[y].push_back(x);
    }
    ll ans = 0;
    for (int i = 1; i <= n; i++)
    {
        if (mark[i] == 0)
        {
            dfs(i);
            sort(all(b));
            for (int j = 0; j + 1 < b.size(); j++) if (b[j] == b[j + 1]) ans++;
            b.resize(0);
        }
    }
    cout << ans;
}

Measured memory_bytes: 21624
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

int main(void){
   double x1, y1, x2, y2;
   cin >> x1 >> y1;
   cin >> x2 >> y2;
   double sqrt(double (d));
   double d = pow(x1-x2, 2) + pow(y1-y2, 2);
   cout << fixed << setprecision(8) << sqrt(d);
   cout << endl;

}


Measured memory_bytes: 3272
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
using namespace std;

const long long int mod=1000000007;
const long long int INF=99999999999999999;



long long int n,m,cou=0,res=0,h[200000];
string s,t;                
int main() {
	cout << fixed << setprecision(10);
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>h[i];
	}
	long long int tmp=0;
	for(int i=n-2;i>=0;i--){
		if(h[i]>=h[i+1]){
			tmp++;
		}else{
			res=max(tmp,res);
			tmp=0;
		}
	}
	res=max(res,tmp);
	cout<<res<<endl;
} 


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int i = sc.nextInt();
		int a = i/100;
		int b = i%100;
		if (a<=12 && a>=1 && b<=12 && b>=1 ) {
			System.out.println("AMBIGUOUS");
		} else if (a<=12 && a>=1) {
			System.out.println("MMYY");
		} else if (b<=12 && b>=1) {
			System.out.println("YYMM");
		} else {
			System.out.println("NA");
		}
	}
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);cout.tie(NULL);
  ll w, h, x, y;
  cin >> w >> h >> x >> y;
  cout << w * h / 2.0 << " " << (2 * x == w && 2 * y == h) << endl;
  return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;

class UF
{
private:
	int         num;
	vector<int> par;
	vector<int> siz;
public:
	//vector<int> val;
public:
	UF(int n) : num(n) {
		par.resize(n);
		siz.resize(n);
		//val.resize(n);
		int i;
		for (i = 0; i < n; i++) {
			par[i] = i; siz[i] = 1;
			//val[i]=0;
		}
	}

	int find(int x) {
		if (x == par[x]) return x;
		return par[x] = find(par[x]);
	}

	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y) return;
		if (siz[x] < siz[y]) {
			par[x] = y;
			siz[y] = siz[x] + siz[y];
			//val[y]=val[x]+val[y];
		}
		else {
			par[y] = x;
			siz[x] = siz[x] + siz[y];
			//val[x]=val[x]+val[y];
		}
	}

	bool same(int x, int y) {
		return find(x) == find(y);
	}

	int size(int x) {
		return siz[find(x)];
	}

	int ngroup() {
		//int ngroup( int& ans ) {
		int count = 0;
		int i;
		for (i = 0; i < num; i++) {
			if (par[i] == i) {
				count++;
				//ans += (val[i]? siz[i]: siz[i]-1);
			}
		}
		return count;
	}
};

void solve()
{
	int n;
	scanf("%d", &n);

	vector<pair<int, int> > x, y;
	int i;
	for (i = 0; i < n; i++) {
		int x0, y0;
		scanf("%d%d", &x0, &y0);
		x.push_back(make_pair(x0, i));
		y.push_back(make_pair(y0, i));
	}
	sort(x.begin(), x.end());
	sort(y.begin(), y.end());

	vector<pair<int, pair<int, int> > > z;
	for (i = 1; i < n; i++) {
		z.push_back(make_pair(x[i].first - x[i - 1].first, make_pair(x[i].second, x[i - 1].second)));
		z.push_back(make_pair(y[i].first - y[i - 1].first, make_pair(y[i].second, y[i - 1].second)));
	}
	sort(z.begin(), z.end());

	UF uf(n);
	ll ans = 0;
	for (i = 0; i < (int)z.size(); i++) {
		int d=z[i].first;
		int a = z[i].second.first;
		int b = z[i].second.second;
		if (!uf.same(a, b)) {
			ans += d;
			uf.unite(a, b);
		}
	}
	printf("%lld\n", ans);

	return;
}


int main(int argc, char* argv[])
{
#if 1
	solve();
#else
	int T; scanf("%d", &T);
	while (T--) {
		solve();
	}
#endif
	return 0;
}


Measured memory_bytes: 7144
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}
const int MOD = 1000000007;




int main() {
    int n,k;
    cin >> n >> k;
    cout << (ll)pow(k-1,n-1)*k;
}



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

using ll = long long;

#define for_(i,a,b) for(int i = (a);i < (b);i++)
#define rfor_(i,a,b) for(int i = (b)-1;i >= (a);i--)
#define rep(i,n) for_(i,0,(n))
#define rrep(i,n) rfor_(i,0,(n))

int N, L;

int a[1000006], r[1000006];

deque<int> dq;

int mn;

int main(){
	cin.tie(0);
	
	cin>>N>>L;
	
	rep(i, N)cin>>a[i];
	
	
    rep(i, N) {
        while(!dq.empty() && a[dq.back()] > a[i]) {
            dq.pop_back();
        }
        dq.push_back(i);
        if(i>=L-1) {
            r[i-L+1] = a[dq.front()];
            if(dq.front() == i-L+1) {
                dq.pop_front();
            }
        }
    }
	
	rep(i, N-L+1) {
		if(i>0)cout<<' ';
		cout<<r[i];
	}
	cout<<endl;
	
	return 0;
}



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

using namespace std;

typedef long long ll;
typedef long double ld;

const int INF = (int) 1e9 + 123;
const ll LINF = (ll) 1e18 + 123;
const ld EPS = (ld) 1e-12;
const ll MOD = (ll) 1e9 + 7;

#define sz(x) (int) (x).size()
#define mp(x, y) make_pair(x, y)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lb(s, t, x) (int) (lower_bound(s, t, x) - s)
#define ub(s, t, x) (int) (upper_bound(s, t, x) - s)
#define rep(i, f, t) for (auto i = f; i < t; i++)
#define per(i, f, t) for (auto i = f; i >= t; i--)

ll power(ll x, ll y, ll mod = MOD) {
    if (y == 0) {
        return 1;
    }
    if (y & 1) {
        return power(x, y - 1, mod) * x % mod;
    } else {
        ll tmp = power(x, y / 2, mod);
        return tmp * tmp % mod;
    }
}

inline void add(ll &x, ll y, ll mod = MOD) {
    x += y;
    if (x >= mod) x -= mod;
    if (x < 0) x += mod;
}

inline ll sum(ll x, ll y, ll mod = MOD) {
    add(x, y, mod);
    return x;
}

inline ll mult(ll x, ll y, ll mod = MOD) {
    return (x * y) % mod;
}

inline ll div(ll x, ll y, ll mod) {
    return x * power(y, mod - 2, mod);
}

template<typename A, typename B> inline bool mini(A &x, const B &y) {
    if (y < x) {
        x = y;
        return true;
    }
    return false;
}

template<typename A, typename B> inline bool maxi(A &x, const B &y) {
    if (y > x) {
        x = y;
        return true;
    }
    return false;
}

template<typename T> inline void read(T first, T last) {
    while (first != last) {
        cin >> *(first++);
    }
}

template<typename T> inline void print(T first, T last) {
    while (first != last) {
        cout << *(first++) << " ";
    }
    cout << "\n";
}

void run();

#define TASK ""

int main() {
#ifdef LOCAL
    if (strlen(TASK) > 0) {
        cerr << "Reminder: you are using file i/o, filename: " TASK "!" << endl << endl;
    }
#endif
#ifndef LOCAL
    if (strlen(TASK)) {
        freopen(TASK ".in", "r", stdin);
        freopen(TASK ".out", "w", stdout);
    }
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
#endif
    cout << fixed << setprecision(12);
    run();
    return 0;
}

// == SOLUTION == //

void run() {
    ll a, b, c, d;
    ll n;
    cin >> a >> b >> c >> d >> n;
    mini(b, 2 * a);
    mini(c, 2 * b);
    mini(d, 2 * c);
    n *= 4;
    ll ans = 0;
    ans += n / 8 * d;
    n %= 8;
    ans += n / 4 * c;
    n %= 4;
    ans += n / 2 * b;
    n %= 2;
    ans += n * a;
    cout << ans << "\n";
}


Measured memory_bytes: 256
import collections

k = int(input())
L = collections.deque(range(1,10))
for i in range(k):
    x = L.popleft()
    if x%10 != 0:
        L.append((10*x)+(x%10)-1)
    L.append(10*x+x%10)
    if x%10 != 9:
        L.append(10*x+x%10+1)

print(x)

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

int main() {
  
  int N , L ;
  
  cin >> N >> L ;
  
  int A = 0;
  
  if (L <= 0 && 0 <= L+N-1) {
    for (int i = 0; i < N; i++){
      A += (L+i);
    }
    cout << A << endl;
  }
  
  else if (L > 0){
     for (int i = 1; i < N; i++){
      A += (L+i);
    }
    cout << A << endl;
  }
  
  else {
     for (int i = 0; i < (N-1); i++){
      A += (L+i);
    }
    cout << A << endl;
  }
}


Measured memory_bytes: 256
while true
    rect = gets.split.map(&:to_i)
    break if (rect[0] == 0 && rect[1] == 0)
    cen = rect[0]-2
    cen2 = rect[1]-2
    
    puts '#'*rect[1]
    
    cen.times do
        print "#"
        print '.'*cen2
        print "#"
        puts
    end
    
    puts '#'*rect[1]
    
    puts
    
end

Measured memory_bytes: 6104
#include <iostream>
#include <utility>
#include <stdint.h>
#include <vector>
#include <algorithm>

using namespace std;

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

  vector<uint16_t> L;
  for (int n=0; n<N; ++n) {
    uint16_t l;
    cin >> l;
    L.push_back(l);
  }

  sort(L.begin(),L.end(),std::greater<uint16_t>());

  uint64_t ans = 0;

  for (auto itr_longest = L.begin(); itr_longest != L.end(); ++itr_longest) {
    auto itr_second = itr_longest;
    ++itr_second;
    for (; itr_second != L.end(); ++itr_second) {
      auto itr_third_first = itr_second;
      ++itr_third_first;
      if (itr_third_first == L.end())
	break;
      uint16_t minimum_length = *itr_longest - *itr_second;
      auto itr_third_end = lower_bound(itr_third_first, L.end(), minimum_length, greater<uint16_t>());
      if (itr_third_end == itr_third_first)
	continue;
      int count = distance(itr_third_first, itr_third_end);
      ans += count;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std; 
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,n) for (int i = 0; i < (n); ++i)

int main(void) {
    io;
    int n_probs, m_submissions;
    cin >> n_probs >> m_submissions;
    int cnt[n_probs] = {0}; // Penalty count
    bool found[n_probs] = { false }; // AC bool
    int correct_ans = 0, penalties = 0;

    rep(i, m_submissions) {
        int val;
        string s;
        cin >> val >> s;
        val--; // To get index right
        if (s == "AC" && found[val] == false) { // First time "AC"
            found[val] = true;
            correct_ans++; 
            penalties += cnt[val];
        } else {
            cnt[val]++;
        }
    }
    cout << correct_ans << " " << penalties;
    return 0;
}


Measured memory_bytes: 4080
#include <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for (int i = m; i < n; ++i)
#define rem(i, m, n) for (int i = m; i >= n; --i)
typedef long long ll;
#define mod 1000000007
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

int N, M;
string s[2020];
int u[2020][2020];
int d[2020][2020];
int l[2020][2020];
int r[2020][2020];

int main() {
  cin >> N >> M;
  rep(i, 0, N) cin >> s[i];
  rep(j, 0, M) rep(i, 1, N) {
    if(s[i][j] == '#') continue;
    if(s[i-1][j] == '.') u[i][j] = u[i-1][j] + 1;
  }
  rep(j, 0, M) rem(i, N-2, 0) {
    if(s[i][j] == '#') continue;
    if(s[i+1][j] == '.') d[i][j] = d[i+1][j] + 1;
  }
  rep(i, 0, N) rep(j, 1, M) {
    if(s[i][j] == '#') continue;
    if(s[i][j-1] == '.') l[i][j] = l[i][j-1] + 1;
  }
  rep(i, 0, N) rem(j, M-2, 0) {
    if(s[i][j] == '#') continue;
    if(s[i][j+1] == '.') r[i][j] = r[i][j+1] + 1;
  }
  int ans = 0;
  rep(i, 0, N) rep(j, 0, M) {
    if(s[i][j] == '#') continue;
    int n = u[i][j] + d[i][j] + l[i][j] + r[i][j];
    ans = max(ans, n);
  }
  cout << ans + 1<< endl;
  return 0;
}


Measured memory_bytes: 67968
#include<algorithm>
#include<string>
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
 
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
 
 int sousa(int &a){
     if(a%2==1){
        a = a-1;
     }
        a = a/2;
    return a;
 }
 
int main(){
    
    int a,b,k;
    cin >> a >> b >> k;

    REP(i,k){
        if(i%2==0){
            b += sousa(a);
        }
        if(i%2==1){
            a += sousa(b);
        }
    }

    cout << a << " " << b << endl;

    return 0;
}

Measured memory_bytes: 256
class Dice:
    same_dice_index = ('123456', '135246', '142536', '154326',
                       '214365', '231645', '246135', '263415',
                       '312564', '326154', '351624', '365214',
                       '415263', '421653', '456123', '462513',
                       '513462', '536142', '541632', '564312',
                       '624351', '632541', '645231', '653421')

    def __init__(self, num_list):
        self.faces = num_list

    def is_same(self, dice):
        for i in Dice.same_dice_index:
            example_faces = []
            for j in i:
                example_faces.append(self.faces[int(j) - 1])
            if example_faces == dice.faces:
                return 'Yes'
        return 'No'

num_list1 = list(map(int, input().split()))
num_list2 = list(map(int, input().split()))

dice1 = Dice(num_list1)
dice2 = Dice(num_list2)

ans = dice1.is_same(dice2)

print(ans)

Measured memory_bytes: 7764
package main

import (
	"fmt"
	"sort"
)

func cumsum(a []int) []int {
	b := make([]int, len(a))
	copy(b, a)
	for i := 1; i < len(b); i++ {
		b[i] += b[i-1]
	}
	return b
}

func main() {
	var n int
	fmt.Scan(&n)
	as := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&as[i])
	}
	sort.Ints(as)
	cs := cumsum(as)

	ans := n
	for i := 0; i < n-1; i++ {
		if cs[i]*2 < as[i+1] {
			ans = n - (i + 1)
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 5504
#!/usr/bin/env python3
import sys


def solve(r: int):
    print(r*r)
    return


# 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)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    r = int(next(tokens))  # type: int
    solve(r)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
// https://atcoder.jp/contests/abc082/tasks/arc087_a

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (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 INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

int N, c, m[100001] = {0};
ll mm;

int main()
{
  c = 0;
  cin >> N;
  REP(i, N)
  {
    cin >> mm;
    if (mm < 100001)
      m[mm]++;
    else
      c++;
  }

  REP(i, 100001)
  {
    c += i <= m[i] ? m[i] - i : m[i];
  }

  cout << c << '\n';

  return 0;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
//#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>

using namespace std;
using ll=long long;
using intpair=pair<int,int>;
using intpv=vector<intpair>;
using llpair=pair<ll,ll>;
using llpv=vector<llpair>;
using intvec=vector<int>;
using llvec=vector<ll>;
using intq=queue<int>;
using llq=queue<ll>;
using intmat=vector<intvec>;
using llmat=vector<llvec>;
using pairmat=vector<llpv>;

template<typename T, typename U>
using pv=vector<pair<T,U>>;
template<typename T>
using matrix=vector<vector<T>>;
template<typename T>
using pque=priority_queue<T>;
template<typename T>
using lpque=priority_queue<T,vector<T>,greater<T>>;

#define PI 3.141592653589793
#define INTINF 1<<30
#define LLINF 1LL<<60
#define MPRIME 1000000007
#define MPRIME9 998244353

#define len length()
#define pushb push_back
#define fi first
#define se second

#define setpr fixed<<setprecision(15)
#define all(name) name.begin(),name.end()
#define rall(name) name.rbegin(),name.rend()
#define gsort(vbeg,vend) sort(vbeg,vend,greater<>())
#define matin(mat,H,W) for(int i__=0; i__<H; i__++)for(int j__=0; j__<W; j__++) cin>>mat[i__][j__]
#define out(n) cout<<n<<endl

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;
}

template<class T>
inline void outmat(T& a, int y, int x) {
	for(int i=0; i<y; i++) {
		for(int j=0; j<x; j++) cout<<a[i][j]<<" ";
		cout<<endl;
	}
}

template<class T>
inline void init(T& v) {
	for(auto &a__: v) cin>>a__;
}
template<class T, class U>
inline void init(vector<pair<T,U>>& v) {
	for(auto &a__: v) cin>>a__.first>>a__.second;
}
template<class T, class N>
inline void init(T& v, N n) {
	v.resize(n);
	for(auto &a__: v) cin>>a__;
}
template<class T, class U, class N>
inline void init(vector<pair<T,U>>& v, N n) {
	v.resize(n);
	for(auto &a__: v) cin>>a__.first>>a__.second;
}

template<class N>
void resiz(N n) {
	//empty
}
template<class N, class T, class... U>
void resiz(N n, T&& hd, U&&... tl) {
	hd.resize(n);
	resiz(n,forward<U>(tl)...);
}

ll GCD(ll a, ll b) { //最大公約数
	if(a==0||b==0) return 0;
	if(a<b) swap(a,b);
	ll tmp = a%b;
	while(tmp!=0) {
		a = b;
		b = tmp;
		tmp = a%b;
	}
	return b;
}

ll binpow(ll a, ll ex, ll p) { //繰り返し二乗法
	ll result=1;
	while(ex>0) {
		if(ex&1) result=result*a%p;
		ex>>=1;
		a=a*a%p;
	}
	return result;
}

ll Fact(ll x, ll p) { //階乗
	ll f=1;
	for(ll i=2; i<=x; i++) {
		f*=i;
		f%=p;
	}
	return f;
}

int DigitNum(ll n) { //桁数
	int digit=0;
	ll div=1LL;
	while(n/div) {
		digit++;
		div*=10;
	}
	return digit;
}


ll N;
string res;

void input() {
	cin>>N;
}

void solve() {
	while(N>0) {
		res = (char)('a'+(N%26+25)%26) + res;
		N-=26;
		N=(N+25)/26;
	}
	cout<<res<<endl;
}

int main() {
	while(1) {
		input();
		solve();
		break;
	}
}


Measured memory_bytes: 3624
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
#pragma GCC optimize("O3")
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdlib>
#include<set>
#include<vector>
#include<sstream>
#include<queue>
#include <iomanip>
#include<unordered_set>
#include <stack>
#include <unordered_map>
#include <map>
#include<numeric>
#include<chrono>
#include <fstream>
constexpr auto INF = 9223372036854775807;
typedef long long int ll;
typedef unsigned long long int ull;
typedef unsigned long int ul;
#define f(i,a,b) for(ll i=(ll)a;i<(ll)b;i+=1)
#define rf(i,a,b) for(ll i=(ll)a;i>=(ll)b;i-=1)
#define endl '\n'
#define N 1000000007 // prime modulo value 
#define M 998244353
#define all(x) x.begin(),x.end()
#define mkp(a,b) make_pair(a,b)
using namespace std;
struct custom_hash {
	static uint64_t splitmix64(uint64_t x) {
		// http://xorshift.di.unimi.it/splitmix64.c
		x += 0x9e3779b97f4a7c15;
		x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
		x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
		return x ^ (x >> 31);
	}

	size_t operator()(uint64_t x) const {
		static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
		return splitmix64(x + FIXED_RANDOM);
	}
};
inline int mex(unordered_set<int> st)
{
	int m = 0;
	while (st.find(m) != st.end())
	{
		m += 1;
	}
	return m;
}
inline int calculateGrundy(int n)
{
	if (n == 1)
		return 0;
	unordered_set<int> mexi;
	for (int i = 1; i <= sqrt(n); i += 1)
	{
		if (n % i == 0)
		{
			if (n / i != n)
				mexi.insert(calculateGrundy(n / i));
			mexi.insert(calculateGrundy(i));
		}
	}
	return mex(mexi);
}
inline ll gcd(ll a, ll b)
{
	// This is code taken from geeksforgeek
	if (b == 0)
		return a;
	return gcd(b, a % b);
}
/*ll power(ll x, ll y)
{
	// This is code taken from geeksforgeek
	ll res = 1;

	x = x % N;
	if (x == 0) return 0;
	while (y > 0)
	{
		if (y & 1)
			res = (res * x) % N;
		y = y >> 1;
		x = (x * x) % N;
	}
	return res;
}*/
ll power(ll x, ll y)
{
	ll res = 1;

	x = x;

	while (y > 0)
	{

		if (y & 1)
			res = (res * x);

		y = y >> 1;
		x = (x * x);
	}
	return res;
}


/*ll modInverse(ll n, ll p)
{
	return power(n, p - 2, p);
}*/

ll sum(ll n)
{
	return (n * (n + 1)) / 2;
}
ll sum_digit(ll n)
{
	ll ans = 0;
	while (n)
	{
		ans += n % 10;
		n /= 10;
	}
	return ans;
}
ll gp(ll r, ll n)
{
	return (pow(r,n)-1)/(r-1);
}
int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	ll d,t,s;
	cin>>d>>t>>s;
	ll time=(d-s*t);
	if(time<=0)
	{
		cout<<"Yes";
	}
	else
	{
		cout<<"No";
	}
	
	return 0;
}

Measured memory_bytes: 3680