akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <functional>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}
string YN(bool v) { return v ? "Yes":"No"; }
void uniq(VI& es) { sort(ALL(es)); es.erase(unique(ALL(es)), es.end()); }

#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,M,W,H,K;
	string s;
	while(cin>>s) {
		ll ans=INF;
		REP(i, s.size()-3+1) {
			minUpdate<ll>(ans, abs(753-stoi(s.substr(i, 3))));
		}
		cout<<ans<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
S = int(input())
M = 10**9+7
Smo = S//3
Ans = 0
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**4
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

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

for s in range(1,Smo+1):
    T = S - 3*s
    Ans = Ans +cmb(T+s-1,s-1,M)
    Ans = Ans%M
print(Ans%M)

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


int main() {

    int A,B,C;

    cin >> A >> B >> C;

    if(A==B && A!=C)
        cout << "Yes"<<endl;
    else if(B==C && A!=B)
        cout << "Yes"<<endl;
    else if(A==C && A!=B)
        cout << "Yes"<<endl;
    else
        cout << "No" << endl;

    return 0;    
}


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

int main(int argc, char const *argv[])
{
    int A, B, T;
    cin >> A >> B >> T;

    int biscuit = 0;
    for (int t = 1; t <= T + 0.5; t++)
    {
        if (t % A == 0)
        {
            biscuit += B;
        }
    }

    cout << biscuit;
    return 0;
}


Measured memory_bytes: 256
s = input()
c = int(input())
for i in range(c):
    nums = [str(e) for e in input().split()]
    nums[1] = int(nums[1])
    nums[2] = int(nums[2]) + 1
    if nums[0] == "print":
        print(s[nums[1]:nums[2]])
    if nums[0] == "reverse":
        s = s.replace(s[nums[1]:nums[2]],s[nums[1]:nums[2]][::-1])
    if nums[0] == "replace":
        s = list(s)
        s[nums[1]:nums[2]] = nums[3]
        s = "".join(s)


Measured memory_bytes: 5628
#include <stdio.h>
int main(void)
{
    int a,b,c,d,e,f;
    scanf("%d %d %d",&a,&b,&c);
    if(a > b){
        d=a;
        a=b;
        b=d;
    }
    if(a > c){
        f=a;
        a=c;
        c=f;
    }
    if(b > c){
        e=b;
        b=c;
        c=e;
    }
    printf("%d %d %d\n",a,b,c);
    return 0;
}



Measured memory_bytes: 2036
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String[] line=sc.nextLine().split("");
		boolean a=false,b=false,c=false;
		for(int i=0;i<3;i++){
			if(line[i].equals("a")){
				a=true;
			}else if(line[i].equals("b")){
				b=true;
			}else if(line[i].equals("c")){
				c=true;
			}
		}
		if(a&&b&&c){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 22612
#include <iostream>
#include <fstream>
#include <algorithm>
#include <string>
#include <cstring>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <vector>
#include <functional>
#include <cassert>
#include <cmath>
#include <map>
#include <set>
#include <queue>

using namespace std;



int main() {
	ios_base::sync_with_stdio(false);
	long long S;
	long long x1 = 0, y1 = 0, x2, y2, x3, y3;
	cin >> S;
	long long k = sqrt(S);
	if (k * k == S) {
		x2 = y3 = k;
		x3 = y2 = 0;
	}
	else if (k * (k + 1) >= S) {
		long long remaining = k * (k + 1) - S;
		x2 = k;
		y3 = k + 1;
		x3 = remaining;
		y2 = 1;
	}
	else {
		long long remaining = (k + 1) * (k + 1) - S;
		x2 = k + 1, y3 = k + 1;
		x3 = remaining;
		y2 = 1;

	}
	cout << x1 << " " << y1 << " " << x2 << " " << y2 << " " << x3 << " " << y3 << endl;
	return 0;
}

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

int main(){
  int N;
  long long int A[300000],S=0LL,max=0LL;
  scanf("%d",&N);
  for(int i=1;i<=N;i++){
    scanf("%lld",A+i);
  }
  
  max=A[1];
  for(int i=2;i<=N;i++){
    if(A[i]<max){
      S+=max-A[i];
    }else{
      max=A[i];
    }
  }
  printf("%lld\n",S);
  return 0;
}


Measured memory_bytes: 3244
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please


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


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

	co((A + B - 1) / B);

	Would you please return 0;
}

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

// 最大公約数
int gcd(int x, int y) {
    if (x == -1) return y;
    if (y == -1) return x;
    if (x < y) swap(x, y);
    while (y > 0) {
        int r = x % y;
        x = y;
        y = r;
    }
    return x;
}

template<typename M>
struct SegmentTree {
    using F = function<M(M, M)>;
    const F f;
    const M m1;
    vector<M> nodes;
    int n;

    explicit SegmentTree(const vector<M> &v,
                         const F f, const M m1) : f(f), m1(m1) {
        n = 2;
        while (n < v.size()) n *= 2;
        nodes.resize(2 * n - 1, m1);
        for (int i = 0; i < v.size(); i++) {
            nodes[i + n - 1] = v[i];
        }
        for (int i = n - 2; i >= 0; i--) {
            nodes[i] = f(nodes[2 * i + 1], nodes[2 * i + 2]);
        }
    }
    void set(int pos, M val) {
        int idx = n - 1 + pos;
        nodes[idx] = val;
        do {
            idx = (idx - 1) / 2;
            nodes[idx] = f(nodes[2 * idx + 1], nodes[2 * idx + 2]);
        } while (idx != 0);
    }
    // l 番目から r - 1 番目の範囲の結果を出力する
    M get(int l, int r, int k = 0, int cl = 0, int cr = -1) {
        if (cr == -1) cr = n;
        if (l <= cl && cr <= r) return nodes[k];
        if (r <= cl || cr <= l) return m1;
        int m = (cl + cr) / 2;
        return f(get(l, r, 2 * k + 1, cl, m), get(l, r, 2 * k + 2, m, cr));
    }
};

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

    int N;
    scanf("%d", &N);
    vector<int> A;
    for (int i = 0; i < N; i++) {
        int a;
        scanf("%d", &a);
        A.push_back(a);
    }
    SegmentTree<int> segtree(A, gcd, -1);
    int maxv = 0;
    for (int i = 0; i < N; i++) {
        int l = -1 , r = -1;
        if (i > 0) l = segtree.get(0, i);
        if (i < N - 1) r = segtree.get(i + 1, N);
        maxv = max(maxv, gcd(l, r));
    }
    cout << maxv << endl;

    return 0;
}


Measured memory_bytes: 1784
unittest
{
	assert( [ "2 700", "3 500", "5 800" ].solve == 3 );
	assert( [ "2 2000", "3 500", "5 800" ].solve == 7 );
	assert( [ "2 400", "3 500", "5 800" ].solve == 2 );
	assert( [ "5 25000", "20 1000", "40 1000", "50 1000", "30 1000", "1 1000" ].solve == 66 );
}



import std.algorithm;
import std.conv;
import std.format;
import std.range;
import std.stdio;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto d = 0L;
	auto g = 0L;
	input.front.formattedRead!"%s %s"( d, g );
	auto pcs = new long[ 2 ][ d ];
	foreach( ref pc; pcs )
	{
		input.popFront;
		pc = input.front.split.to!( long[] );
	}
	
	// 各問題セットを全問解くパターンをbit全探索
	auto ans = long.max;
	foreach( b; 0L .. 1L << d )
	{
		auto z = 0L;
		auto t = 0L;
		auto m = 0L;
		
		// 全問解く問題セットの合計点数を計算
		foreach( i, pc; pcs )
		{
			if( b & ( 1L << i ) )
			{
				auto s = 100L * ( 1 + i.signed );
				z += pc[ 0 ];
				t += s * pc[ 0 ] + pc[ 1 ];
			}
			else
			{
				m = i.signed;
			}
		}
		
		// 解いていない問題セットのうち、一番点数が高いセットで不足分の点数を計算
		auto s = 100L * ( 1 + m );
		auto r = ( max( 0L, g - t ) + s - 1 ) / s;
		if( r <= pcs[ m ][ 0 ] && g <= t + s * r ) ans = min( ans, z + r );
	}
	return ans;
}


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

using namespace std;

typedef long long ll;
int n,p;
ll m,v;
const int maxn=1e5+100;
ll a[maxn];

int main()
{
    cin>>n>>m>>v>>p;
    p--;
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<n;i++)a[i]=-a[i];
    sort(a,a+n);
    for(int i=0;i<n;i++)a[i]=-a[i];
    /*for(int i=0;i<n;i++)cout<<a[i]<<' ';
    cout<<endl;*/
   /* for(int i=p;i<n;i++){
        if(a[i]==a[p]){
            p=i;
        }
        else break;
    }*/
    ll sum=a[p];
    v=n-v;
    int ans=0;
    for(int i=p+1;i<n;i++){
        if((m*v)>=(sum-(i-p)*a[i])&&m>=(a[p]-a[i])){
            //cout<<i<<' '<<a[i]<<endl;
            ans++;
        }
        sum+=a[i];
    }
    cout<<p+ans+1<<endl;
    return 0;
}


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

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

    for(int i=0; i<n; i++){

        double xa, ya, ra, xb, yb, rb;
        cin >> xa >> ya >> ra >> xb >> yb >> rb;

        double d; // 中心間距離
        d = sqrt((xa-xb)*(xa-xb)+(ya-yb)*(ya-yb));

        if( d > ra + rb ) cout << "0\n";
        else if( ra - d > rb ) cout << "2\n";
        else if( rb - d > ra )cout << "-2\n";
        else cout << "1\n";
    }

    return 0;
}

Measured memory_bytes: 1200
a=[]
b=[]
ori=[]
ans=0
for i in range(5):
  c=int(input())
  ori.append(c)
  if c%10!=0:
    a.append((c//10+1)*10)
  else:
    a.append(c)
  
  if c%10==0:
    b.append(100)
  else:
    b.append(c%10)
a.pop(b.index(min(b)))
print(ori[b.index(min(b))]+sum(a))

Measured memory_bytes: 9148
#include <iostream>
#include <map>
#include <vector>

using namespace std;

int main() {
    int N;
    cin >> N;
    map<long long int, int> mp;
    long long int tmp=0;
    vector<long long int> vec;
    for(int n=0; n<N; n++) {
        long long int A;
        cin >> A;
        mp[A]++;
        tmp ^= A;
        if(mp[A]==1) {
            vec.push_back(A);
        }
    }
    if(tmp) {
        cout << "No" << endl;
    } else {
        if(mp.size()>3) {
            cout << "No" << endl;
        } else {
            bool flag=true;
            if(mp[0]==0) {
                int cnt1=mp[vec[0]];
                long long int num1=vec[0];
                int cnt2=mp[vec[1]];
                long long int num2=vec[1];
                int cnt3=mp[vec[2]];
                long long int num3=vec[2];
                if(cnt1==cnt2 && cnt2==cnt3) {
                    if((num1^num2)==num3) {
                        cout << "Yes" << endl;
                    } else {
                        cout << "No" << endl;
                    }
                } else {
                    cout << "No" << endl;
                }
            } else {
                if(mp.size()==3) {
                    cout << "No" << endl;
                } else {
                    int cnt1=mp[vec[0]];
                    long long int num1=vec[0];
                    if(mp.size()==1) {
                        cout << "Yes" << endl;
                    } else {
                        int cnt2=mp[vec[1]];
                        long long int num2=vec[1];
                        if(num1==0) {
                            if(cnt1*2==cnt2) {
                                cout << "Yes" << endl;
                            } else {
                                cout << "No" << endl;
                            }
                        } else {
                            if(cnt2*2==cnt1) {
                                cout << "Yes" << endl;
                            } else {
                                cout << "No" << endl;
                            }
                        }
                    }
                }
            }
        }
    }

    return 0;
    
}

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

int main(){
    int A, B, C, X, Y;
    scanf("%d%d%d%d%d", &A, &B, &C, &X, &Y);
    int ans = ~0U>>1;
    for(int i=0;i<=X||i<=Y;++i){
        int tmp = i*C*2 + std::max(0, X-i)*A + std::max(0, Y-i)*B;
        ans = std::min(ans, tmp);
    }
    printf("%d\n", ans);
    return 0;
}


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

int main() {
  int a,b;
  cin >> a >> b;
  if ((a+b)%2 == 0) {
  	cout << (a+b)/2 << endl;
  }
  else {
  	cout << (a+b)/2+1 << endl;
  }
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define __STDC_LIMIT_MACROS
#include <stdint.h>
using namespace std;
#define int   long long
#define endl '\n'	 
#define pb	push_back
#define setbits(x)		__builtin_popcountll(x)
#define zrobits(x)		__builtin_ctzll(x)
void c_p_c()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

int mex(int a[], int n)
{
	set<int> h;
	for(int i = 0; i<n; i++)
		h.insert(a[i]);
	int ans = 0;
	for(auto d:h)
	{
		if(d==ans)
			ans++;
	}
	return ans;
}
int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	//c_p_c();
	int n;
	cin>>n;
	int ac = 0;
	int wa = 0;
	int tle = 0;
	int re = 0;
	string s;
	for(int i = 0; i<n; i++)
	{
		cin>>s;
		if(s=="AC")
			ac++;
		else if(s=="WA")
			wa++;
		else if(s=="TLE")
			tle++;
		else
			re++;
	}
	cout<<"AC x "<<ac<<endl;
	cout<<"WA x "<<wa<<endl;
	cout<<"TLE x "<<tle<<endl;
	cout<<"RE x "<<re<<endl;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;

main() {
    int64_t n;
    cin >> n;

    vector<int64_t> a(n), b(n);
    for (auto&& aa : a) {
        cin >> aa;
    }
    for (auto&& bb : b) {
        cin >> bb;
    }

    priority_queue<pair<int64_t, int64_t>> q;
    for (auto i : irange(0L, n)) {
        if (b[i] < a[i]) {
            cout << -1 << endl;
            return 0;
        }

        q.emplace(b[i], i);
    }

    int64_t ans = 0;
    while (!q.empty()) {
        auto idx = q.top().second;
        q.pop();

        auto prev = (idx - 1 + n) % n;
        auto next = (idx + 1) % n;

        auto tmp = (b[idx] - a[idx]) / (b[prev] + b[next]);
        ans += tmp;
        b[idx] -= (b[prev] + b[next]) * tmp;

        if (tmp == 0 && b[idx] != a[idx]) {
            cout << -1 << endl;
            return 0;
        }

        if (a[idx] != b[idx]) {
            q.emplace(b[idx], idx);
        }
    }

    if (a == b) {
        cout << ans << endl;
    } else {
        cout << -1 << endl;
    }
}

Measured memory_bytes: 9584
#include <tuple>
#include <vector>
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
using ll	= long long;
using ull	= unsigned long long;
using ld	= long double;
using pii	= pair<int,int>;
using pll	= pair<ll,ll>;
using vi	= vector<int>;
using vb	= vector<bool>;
using vc	= vector<char>;
using vvi	= vector<vi>;
using vvb	= vector<vb>;
using vpii	= vector<pii>;
using vpll	= vector<pll>;
using vll	= vector<ll>;
using vull	= vector<ull>;
using vvll	= vector<vll>;
#define ever (;;)
#define f first
#define s second
#define pb emplace_back
#define sz size()
#define graph vector<vertex>
#define deg(X) (int)G[X].e.size()
#define INF 1234567890
#define INFll 2000000000000000000
#define maxe(X, Y) if((Y) > (X)) (X) = (Y)
#define mine(X, Y) if((Y) < (X)) (X) = (Y)
#define rep(i, begin, end) for(__typeof(end) i = (begin); i < (end); ++i)
#define repr(i, begin, end) for(__typeof(end) i = (begin)-1; i >= (end); --i)
#define bend(X) X.begin(), X.end()
pii operator+(const pii& A, const pii& B) { return {A.f+B.f, A.s+B.s}; }
pii operator-(const pii& A, const pii& B) { return {A.f-B.f, A.s-B.s}; }
pii operator-(const pii& A) { return {-A.f, -A.s}; }

//
// END OF DEFINES
//

constexpr int max_v = 1e3;
int n, m;
ll w;
vpll T;
vll DP;

bool in() {
    //cin >> n >> w;
    scanf("%d %lld", &n, &w);
    m = max_v*n+1;
    T.resize(n);
    DP.resize(m, INFll);
    DP[0] = 0;
    rep(i, 0, n)
        //cin >> T[i].f >> T[i].s;
        scanf("%lld %lld", &T[i].f, &T[i].s);

	return true;
}

ll solve() {

    for(auto x : T)
        repr(i, m, 0)
            if(i+x.s < m && DP[i] < INFll)
                mine(DP[i+x.s], DP[i]+x.f);

    repr(i, m, 0)
        if(DP[i] <= w)
            return i;

	return -INF;
}

int main() {
	int noOfTests = 1;
	//scanf("%d", &noOfTests);

	while(noOfTests --> 0) {
		if(!in()) {
			printf("popsute wejscie\n");
			continue;
		}
		ll result = solve();
		if(result == ll(-'t'))
			printf("TAK\n");
		else if(result == ll(-'n'))
			printf("NIE\n");
		else if(result != -INF)
			printf("%lld\n", result);
	}

	return 0;
}


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

int main()
{

  int n;
  int b,f,r,v;
  int sum[4][3][10];

  for(int i=0; i<4; i++)
    for(int j=0; j<3; j++)
      for(int k=0; k<10; k++)
	sum[i][j][k] = 0;


  cin >> n;

  for(int i=0; i<n; i++){
    cin >> b >> f >> r >> v;

    sum[b-1][f-1][r-1] += v;
  }


  for(int j=0; j<3; j++){
    for(int k=0; k<10; k++)
      cout << ' ' << sum[0][j][k];

    cout << endl;

  }

  for(int i=1; i<4; i++){

    cout << "####################" << endl;

    for(int j=0; j<3; j++){
      for(int k=0; k<10; k++)
	cout << ' ' << sum[i][j][k];

      cout << endl;
    }
    
  }

 
  return 0;
      
}

Measured memory_bytes: 1160
import java.util.Scanner;
//int[] date=new int[2];
public class  Main {
int i,o,sum,h,s,e,u,ty,yu,ui,n,num,qw;
double m,t,r,j,k,f,d,g,w;
static double l;
String b,c,z,x,v,a,q;
Scanner scan =new Scanner(System.in);
//入力
	public void input() {	
	
	}
	//演算
	public void compute() {
	
		}
//出力
public void output() {
	int[] date=new int[3];
	for(h=0;h<3;h++) {
		date[h]=scan.nextInt();
	}
	System.out.println(date[2]+" "+date[0]+" "+date[1]);
}
	public static void main(String [ ] args) {
		 Main p = new  Main ();
		p.input();
		p.compute();
		p.output();
		}
	}

Measured memory_bytes: 22740
import java.io.*;
import java.util.*;
/**
 * @author Rick
 *
 */

public class Main{

	/**
	 * @param args
	 */
	public static void main(String[] args) throws Exception {
//		System.setIn(new FileInputStream("TestCase.txt"));
//		long ct1 = System.currentTimeMillis();
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int N=Integer.parseInt(st.nextToken().trim());
		int M=Integer.parseInt(st.nextToken().trim());
		int [][] cities = new int[M][4];
		for(int i=0;i<M;i++)
		{
			st = new StringTokenizer(br.readLine());
			int p=Integer.parseInt(st.nextToken().trim());
			int y=Integer.parseInt(st.nextToken().trim());
			cities[i][0]=i;
			cities[i][1]=p;
			cities[i][2]=y;
	    }
		Arrays.sort(cities,0,M,new Comparator<int[]>() {
            public int compare(int[] x, int[] y) {
                if(x[1] < y[1]){
                    return -1;
                } else if(x[1] > y[1]){
                    return 1;
                } else {
                	if(x[2] < y[2])
                		return -1;
                	else if(x[2] > y[2])
                		return 1;
                	else
                		return 0;
                }
            }
		});

		int pchange=0,ychange=0;
		for(int i=0;i<M;i++)
		{
			int p= cities[i][1];
			if(pchange!=p)
			{
				pchange=p;
				ychange=1;
			}
			else
			{				
				ychange++;
			}
			cities[i][3]=ychange;
		}
		Arrays.sort(cities,0,M,new Comparator<int[]>() {
            public int compare(int[] x, int[] y) {
                if(x[0] < y[0]){
                    return -1;
                } else if(x[0] > y[0]){
                    return 1;
                } else {
                    return 0;
                }
            }
		});	
		for(int i=0;i<M;i++)
		{
			System.out.println(SixDigital(cities[i][1])+SixDigital(cities[i][3]));
		}
//		long ct2 = System.currentTimeMillis();
//		System.out.println(ct1 + "   " + ct2 + " " + (ct2-ct1));
	}

	private static String SixDigital(int p) {
		if(p<10)
		{
			return "00000" + p;
		}
		else if(p<100)
		{
			return "0000" + p;
		}
		else if(p<1000)
		{
			return "000" + p;
		}
		else if(p<10000)
		{
			return "00" + p;
		}
		else if(p<100000)
		{
			return "0" + p;
		}
		else
		{
			return String.valueOf(p);
		}			
	}
}


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

int main(){
  string s;
  getline(cin,s);
  for(int i=0;i<s.size();i++){
  	if(s[i]==','){
  		s[i]=' ';
  	}
  }
 cout<<s<<endl;
  return 0;
}

Measured memory_bytes: 256
object Main extends App {
  val n = scala.io.StdIn.readInt()
  val aInput = scala.io.StdIn.readLine()
  val aArray =  aInput.split(" ").map(_.toLong).toVector

  var beforeTanka = -1L
  var kabusuu = 0L
  var amount = 1000L

  aArray.zipWithIndex.foreach { a =>
    val tanka = a._1
    val index = a._2
    if (beforeTanka == -1L) {
      beforeTanka = tanka
    } else {
      if (beforeTanka < tanka) {
        // 株数がなかったら前の単価で買う
        if (kabusuu == 0L) {
          kabusuu = amount / beforeTanka
          amount = amount - (kabusuu * beforeTanka)
        }
      } else if (beforeTanka > tanka) {
        // 株数があったら前の単価で売る
        if (kabusuu != 0L) {
          amount = amount + (kabusuu * beforeTanka)
          kabusuu = 0L
        }
      }
      // これが最後だったら売る
      if (index == n - 1) {
        amount = amount + (kabusuu * tanka)
        kabusuu = 0L
      }
      beforeTanka = tanka
    }
  }

  println(amount)

}

Measured memory_bytes: 54616
using System;
using System.Linq;

namespace Beginner101
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine();
            var N = double.Parse(input.Split(' ')[0]);
            var K = double.Parse(input.Split(' ')[1]);
            input = Console.ReadLine();
            double a = (N - 1) / (K - 1);
            var ans = Math.Ceiling(a);
            Console.WriteLine(ans);


        }
    }
}


Measured memory_bytes: 13280
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n[][]=new int[100][];
		int i=0;
		while(sc.hasNext()){
			String s[]=sc.nextLine().split(",");
			int k=s.length;
			n[i]=new int[k];
			for(int j=0;j<k;j++)
				n[i][j]=Integer.parseInt(s[j]);
			i++;
		}
		int line=i;
		int dp[][]=new int[100][100];
		dp[0][0]=n[0][0];
		for(i=1;i<=line/2;i++){
			dp[i][0]=dp[i-1][0]+n[i][0];
			dp[i][i]=dp[i-1][i-1]+n[i][i];
			for(int j=1;j<n[i].length-1;j++){
				dp[i][j]=n[i][j]+Math.max(dp[i-1][j-1],dp[i-1][j]);
			}
		}
		for(;i<line;i++){
			for(int j=0;j<n[i].length;j++){
				dp[i][j]=n[i][j]+Math.max(dp[i-1][j],dp[i-1][j+1]);
			}
		}
		System.out.println(dp[line-1][0]);
	}
}


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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

ll N,M,K;
vector<ll> G[100005];

class UnionFind{
    public:
        vector<int> uni;
        UnionFind(int s) : uni(s, -1) { }
 
       //頂点aが所属するグループを調べる
        int root(int a)
        {
            if (uni[a] < 0) return a;
            return uni[a] = root(uni[a]);
        }
    
        //頂点aと頂点bを繋ぐ。もともと同じグループの時falseを返す
        bool connect(int a,int b)
        {
            a = root(a);
            b = root(b);
            if (a == b) return false;
    
            if (uni[a] > uni[b])
            {
                a ^= b;
                b ^= a;
                a ^= b;
            }
    
            uni[a] = uni[a] + uni[b];
            uni[b] = a;
            return true;
        }
    
        //頂点a,bが同じグループであるかを調べる
        bool isConnect(int a,int b)
        {
            return root(a) == root(b);
        }
    
        //頂点aを含むグループの頂点数を調べる
        int size(int a)
        {
            return -uni[root(a)];
        }
    
    };

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

    cin >> N >> M >> K;

    UnionFind uf(N+3);

    for (int i = 0;i < M;i++){
        ll a,b; cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
        uf.connect(a,b);
    }

    ll ss[100005];

    for (int i = 1;i <= N;i++){
        ss[i] = uf.size(i)-G[i].size()-1;
    }

    for (int i = 0;i < K;i++){
        ll a,b; cin >> a >> b;
        if(uf.isConnect(a,b)){
            ss[a]--;
            ss[b]--;
        }
    }

    for (int i = 1;i <= N;i++){
        cout << ss[i] << " ";
    }

    cout << endl;

    return 0;

}

Measured memory_bytes: 8308
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <set>
#define ll long long
#define ull unsigned long long
#define out(a) printf("%d",a)
#define outl(a) printf("%lld",a)
#define outu(a) printf("%lu",a)
#define kg cout<<' '
#define writeln printf("\n")
#define rep(i,a,b) for (int i=a;i<=b;i++)
#define down(i,a,b) for (int i=a;i>=b;i--)
#define inf 0x7fffffff
#define yes puts("YES")
#define no puts("NO")
#define ms(a,b) memset(a,b,sizeof(a))
#define deb printf("%d\n",233)
using namespace std;
typedef int Array[100050];
Array a,b;
int n,x,y;
ll now=0;
ll ans;
int read()
{
	int s=0,t=1; char c;
	while (c<'0'||c>'9') {if (c=='-') t=-1; c=getchar();}
	while (c>='0'&&c<='9') {s=s*10+c-'0'; c=getchar();}
	return s*t;
}
ll readl()
{
	ll s=0,t=1; char c;
	while (c<'0'||c>'9') {if (c=='-') t=-1; c=getchar();}
	while (c>='0'&&c<='9') {s=s*10+c-'0'; c=getchar();}
	return s*t;
}
int gcd(int a,int b)
{
	return b==0?a:gcd(b,a%b);
}
int power(int a,int b)
{
	int ans=1;
	while(b)
	{
	  if(b&1) ans*=a,b--;
	  b>>=1; a*=a;
	}
	return ans;
}
int main()
{
	x=read(); y=read();
	if (x%y==0) {
	  puts("-1");
	  return 0;
    }
    out(x);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
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; }

const int MOD = 1000000007;
const int INF = 1e9;

const int mod = 1000000007;
const int inf = 1e9;
#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};

map<ll, int> prime_factor(ll n){
	map<ll, int> res;
	for(ll i = 2; i*i<=n; i++){
		while(n%i==0){
			res[i]++;
			n/=i;
		}
	}
	if(n!=1) res[n]++;
	return res;
}

set<ll> all_divisor(ll n){
	set<ll> res;
	for(ll i = 1; i*i<= n; i++){
		if(n%i==0){res.insert(i);res.insert(n/i);}
	}
	return res;
}

int main(){
    ll n;
    cin >> n;
    int ans = 0;
    auto s = all_divisor(n-1);
    ans += s.size() - 1;
    auto ss = all_divisor(n);
    for(auto p : ss) {
        if(p == 1) continue;
        ll nn = n;
        while(nn%p==0) {
            nn /= p;
        }
        if((nn-1)%p == 0) ans++;
    }
    cout << ans << endl;
}

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

int main(){
  char c;
  cin >> c ;

  if(c=='a' or c=='e' or c=='i' or c=='o' or c=='u'){
    cout << "vowel" << endl;
  }
  else{
    cout << "consonant" <<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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

const long long INF = 1LL << 60;

int main(){
  int n; cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  sort(a.rbegin(), a.rend());

  int ans = 0;
  rep(i, n){
    if(i%2 == 0) ans += a[i];
    else ans -= a[i];
  }

  cout << ans << endl;

  return 0;
}


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

using namespace std;


int N;
vector<int> v;
vector<int> dp;

int main() {
    cin>>N;
    v.resize(N);
    dp.resize(N);
    for(int i=0;i<N;i++){
        cin>>v[i];
    }
    for (int i = 1; i < N; i++)
    {
        if(i == 1) dp[i]=abs(v[i]-v[i-1])+dp[i-1];
        else dp[i] = min(abs(v[i]-v[i-2])+dp[i-2],abs(v[i]-v[i-1])+dp[i-1]);
    }
    cout<<dp[N-1]<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
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; }
const long long INF = 1LL << 60;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数
int lcm(int a, int b) {return a * b / gcd(a, b);}   //最小公倍数

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    rep(i,s.length()){
        s[i] += n;
        if(s[i]>90)
            s[i] -= 26;
    }
    cout << s << endl;
    
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <climits>
#include <complex>
#include <fstream>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <thread>
#include <tuple>
#include <type_traits>
#include <vector>

#include <stdio.h>

using ll = long long;
using namespace std;

vector<vector<bool>> v;

int main() {
    ios::sync_with_stdio(false);
    ll x, y;
    cin >> x >> y;

    ll ans = 0;

    while (x <= y) {
        ans++;
        x *= 2;
    }
    cout << ans << endl;

    return 0;
}


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

using namespace std;
using ll = long long;

const int MOD = 1000000007;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string S;
  cin >> S;
  int N = S.size();

  vector<vector<ll>> dp(N + 5, vector<ll>(13, 0));

  dp[0][0] = 1;

  for (int i = 0; i < N; i++) {
    int c;
    if (S[i] == '?')
      c = -1;
    else
      c = S[i] - '0';

    for (int j = 0; j < 10; j++) {
      if (c != -1 && c != j) continue;
      for (int r = 0; r < 13; r++) {
        dp[i + 1][(r * 10 + j) % 13] += dp[i][r];
      }
    }
    for (int r = 0; r < 13; r++) {
      dp[i + 1][r] %= MOD;
    }
  }
  cout << dp[N][5] << '\n';
  return 0;
}


Measured memory_bytes: 13648
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;

public class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		ArrayDeque<Integer> left = new ArrayDeque<Integer>();
		ArrayDeque<Integer> areaLeft = new ArrayDeque<Integer>();
		ArrayDeque<Integer> area = new ArrayDeque<Integer>();
		
		for(int i = 0; i < s.length(); ++i) {
			char c = s.charAt(i);
			if(c == '\\'){
				left.addFirst(i);
			}else if(c == '/'){
				if(!left.isEmpty()) {
					int l = left.removeFirst();
					areaLeft.addFirst(l);
					area.addFirst(i-l);
				}
			}
		}
		
		int lastl = s.length();
		while(!areaLeft.isEmpty()){
			int l = areaLeft.removeFirst();
			if(l > lastl){
				area.addLast(area.removeFirst() + area.removeLast());
			}else{
				area.addLast(area.removeFirst());
				lastl = l;
			}
		}
		
		StringBuilder sb = new StringBuilder();
		int sum = 0;
		for(Integer i : area){
			sum += i;
			sb.insert(0, " " + i);
		}
		sb.insert(0, area.size());
		
		System.out.println(sum);
		System.out.println(sb);
	}
	
}

Measured memory_bytes: 25864
import Data.Traversable
import Data.List

main = do
  t <- getLine
  ps <- map read . words <$> getLine
  putStrLn . show . solve $ ps


solve :: [Int] -> Int
solve [] = 0
solve (x:[]) = 0
solve (x:y:[]) = if x == y then 1 else 0
solve ps =
  let l1 = sort $ everyOtherElem ps
      l2 = sort $ everyOtherElem (tail ps)
      (v1,mcnt1, scnt1) = countMax (head l1) 1 (head l1) 0 0 (tail l1)
      (v2,mcnt2, scnt2) = countMax (head l2) 1 (head l2) 0 0 (tail l2)
  in if v1 /= v2 then (length l1) - mcnt1 + (length l2) - mcnt2
    else min ((length ps) - mcnt1 - scnt2) ((length ps) - mcnt2 - scnt1)

countMax x cnt m cntmax cnt2nd [] = (if cnt > cntmax then x else m, max cnt cntmax, (max cnt2nd (min cnt cntmax)))
countMax x cnt m cntmax cnt2nd (s:sorted) =
  if x /= s then
    countMax s 1 (if cnt > cntmax then x else m) (max cnt cntmax) (max cnt2nd (min cnt cntmax)) sorted
  else
    countMax x (cnt+1) m cntmax cnt2nd sorted

everyOtherElem [] = []
everyOtherElem (x:[]) = [x]
everyOtherElem (x:y:xs) = x : everyOtherElem xs


Measured memory_bytes: 46460
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    int count=0;
    vector<int> p(N);

    for(int i=0; i<N; i++){
        cin >>p[i];
    }

    for(int i=0; i<N; i++){
        if(p[i] != i+1) count++;
    }
    
    if(count>2) cout << "NO" << endl;
    else cout << "YES" << endl;
    
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int max = 0;
        int count = 0;
        int tmp = 0;
        for (int i = 0; i < N; i++) {
        	int Hi = sc.nextInt();
        	if (Hi <= tmp) {
        		count++;
        	} else {
        		if (max < count) {
        			max = count;
        		}
        		count = 0;
        	}
        	tmp = Hi;
        }
		if (max < count) {
			max = count;
		}
        System.out.println(max);
    }
}

Measured memory_bytes: 48212
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;cin>>n;
    //if((n/2.0)<=9.0||(n/3.0)<=9.0||(n/4.0)<=9.0||(n/5.0)<=9.0||(n/6.0)<=9.0||(n/7.0)<=9.0||(n/8.0)<=9.0||(n/9.0)<=9.0)puts("Yes");
    //else puts("No");
    bool f=0;
    for(int i=1;i<10;i++)for(int j=1;j<10;j++)if(i*j==n)f=1;
    if(f)cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
  }

Measured memory_bytes: 256
x = input()
y = x.split(" ")
parameters = [int(i) for i in y]
N = parameters[0]
M = parameters[1]
C = parameters[2]
x = input()
y = x.split(" ")
B = [int(i) for i in y]
i = N
count = 0
A = [[0] * M for i in range(N)]

while(i > 0):
    x = input()
    y = x.split(" ")
    A[count] = [int(i) for i in y]
    count += 1
    i -= 1
right = 0
for i in range(N):
    sum = 0
    for j in range(M):
        sum += A[i][j] * B[j]
    sum = sum + C
    if(sum > 0):
        right += 1

print(right)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  int size = S.size();
  vector<char> s(size);
  for (int i = 0; i < size; i++) {
    s.at(i) = S.at(i);
  }
  int N;
  cin >> N;
  bool f = true;
  for (int i = 0; i<N; i++) {
    int x;
    cin >> x;
    if (x == 1) {
      if(f) {
        f = 0;
      }
      else {
        f = 1;
      }
    }
    else {
      int y;
      cin >> y;
      if (y == 1) {
        if (f) {
          char c;
          cin >> c;
          s.insert(s.begin() + 0, c);
        }
        else {
          char c;
          cin >> c;
          s.push_back(c);
        }
      }
      else {
        if (f) {
        char c;
        cin >> c;
        s.push_back(c);
        }
        else {
          char c;
          cin >> c;
          s.insert(s.begin() + 0, c);
        }
      }
    }
  }
  int n = s.size();
  if (f) {
    for (int i = 0; i < n; i++) {
      cout << s.at(i);
    }
  }
  else {
    for (int i = 0; i < n; i++) {
      cout << s.at(n - i - 1);
    }
  }
}

Measured memory_bytes: 1084
//ITP1_1_B
#include <iostream>
#include <cmath>

class ITP1_1_B
{
public:
    static void cubeNumber()
    {
        int num;
        std::cin >> num;
        std::cout << num * num * num << std::endl;
    }
};

class ITP1_1_C
{
public:
    int length;
    int breadth;
    int area;
    int perimeter;
    ITP1_1_C(int l,int b)
    {
        this->length = l;
        this->breadth = b;
        this->area = length * breadth;
        this->perimeter = 2 * (length + breadth);
    }
};

int main()
{
    int a,b;
    std::cin>>a>>b;
    ITP1_1_C rectangle(a,b);
    std::cout<<rectangle.area<<" "<<rectangle.perimeter<<std::endl;
}



Measured memory_bytes: 3016
#include <bits/stdc++.h>
#define MAX_N 10000000
using namespace std;

int prime[MAX_N];
bool is_prime[MAX_N];
/*
int init() {
    int p = 0;
    memset(is_prime, true, sizeof(is_prime));
    is_prime[0] = is_prime[1] = false;
    for(int r = 2; r * r <= MAX_N; r++) {
        if(is_prime[r]) {
            prime[p++] = r;
            for(int c = r*2; c <= MAX_N; c+=r) {
                is_prime[c] = false;
            }
        }
    }
    return(p);
}
*/
bool isPrime(int n) {
    for(int r = 2; r * r <= n; r++) {
        if(n % r == 0) return(false);
    }
    return(true);
}

void init() {
    int p = 0;
    prime[p++] = 2;
    for(int r = 3; p < 10000; r+=2) {
        if(isPrime(r)) prime[p++] = r;
    }
}


int main(void) {
    int num;
    init();
    while(cin >> num, num != 0) {
        int sum = 0;
        for(int r = 0; r < num; r++) {
            sum += prime[r];
        }
        cout << sum << endl;
    }
    return(0);
}

Measured memory_bytes: 3208
#include<iostream>
#include<vector>
using namespace std;
#define int long long
#define V vector
#define vel V<int>
#define rep(i,n) for(int i=0;i<n;i++)
#define mkp make_pair
#define pin pair<int,int>
pin solve(V<pin>& ab, int ex) {
	if (!ex) { return mkp(0, 0); }
	V<V<pin>> qab(2);
	int sz = ab.size();
	qab[0].reserve(sz);
	qab[1].reserve(sz);
	for (pin& x : ab) {
		qab[x.second & 1].push_back(mkp(x.first / 2, x.second / 2));
		if (x.first & 1) { qab[(x.second + 1) & 1].push_back(mkp(x.first / 2, (x.second + 1) / 2)); }
	}
	int c = 0;
	for (pin& x : qab[0]) {
		int qc = (2 * x.first + x.second) % 3;
		c ^= (qc + 1);
	}
	if (!c) {
		pin ans = solve(qab[1], ex - 1);
		ans.first *= 2; ans.second *= 2; ans.second++;
		return ans;
	}
	pin ans = solve(qab[0], ex - 1);
	c = 0;
	int d = 0;
	for (pin& x : qab[1]) {
		int qc = (2 * x.first + x.second) % 3;
		c ^= (qc + 1);
		int w = ans.second - x.second - 1;
		if ((w & x.first) == w) { d ^= 1; }
	}
	if (!c) {
		ans.first *= 2; ans.second *= 2;
		return ans;
	}
	ans.first *= 2; ans.first++; ans.second *= 2; ans.second -= d;
	return ans;
}
signed main() {
	cin.tie(0); ios::sync_with_stdio(false);
	long long inf = 1e17;
	int n; cin >> n;
	V<pin> ab(n);
	rep(i, n) {
		long long a, b; cin >> a >> b;
		ab[i] = { a + inf,b + inf };
	}
	pin ret = solve(ab, 59);
	cout << ret.first - inf << " " << ret.second - inf << "\n";
}


Measured memory_bytes: 7552
#include <stdio.h>
int main(void){
    char s[51];
    int n;
    scanf("%s%n",s,&n);
    int p=0;
    if(s[p]=='A'){
        p++;
    }
    if(s[p]=='K'){
        p++;
    }else{
        printf("NO\n");
        return 0;
    }
    if(s[p]=='I'){
        p++;
    }else{
        printf("NO\n");
        return 0;
    }
    if(s[p]=='H'){
        p++;
    }else{
        printf("NO\n");
        return 0;
    }
    if(s[p]=='A'){
        p++;
    }
    if(s[p]=='B'){
        p++;
    }else{
        printf("NO\n");
        return 0;
    }
    if(s[p]=='A'){
        p++;
    }
    if(s[p]=='R'){
        p++;
    }else{
        printf("NO\n");
        return 0;
    }
    if(s[p]=='A'){
        p++;
    }
    if(p==n){
        printf("YES\n");
    }else{
        printf("NO\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
#include <random>
#include <iomanip>

using namespace std;
typedef long long unsigned int ll;
typedef pair<int, int> P;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define fillInt(xs, x)        \
  for (int i = 0; i < (x); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < (x); i++) \
    scanf("%ld", &xs[i]);
#define fillString(xs, x)       \
  for (int i = 0; i < (x); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvdi(xs) sort(xs.begin(), xs.end(), std::greater<int>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)

#define rep(i,n) for(long i=0; i<(n); i++)
#define isValidPoint(x, y, mx, my) x >= 0 && x  < mx && y >= 0 && y < my

int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MOD = 1000000007;

int exp_mod(long long a, long long b, int m) {
	long long res = 1;
	while (b > 0) {
		if (b&1)
			res = (res * a)%m;
		a = (a * a)%m;
		b >>= 1;
	}
	return (int)res;
}

int fact_mod(int n, int m) {
	long long res = 1;
	for (int i=n; i>0; --i)
		res = (res * i)%m;
	return (int)res;
}

int comb_mod(int n, int r) {
	long long res = 1;
	for (int i=0; i<r; ++i)
		res = (res * (n - i) )%MOD;
	return ( res * exp_mod(fact_mod(r, MOD), MOD-2, MOD) ) % MOD;
}

struct Pony
{
    string name;
    int score, n;

    Pony(string name_, int score_, int n_)
    {
        name = name_;
        score = score_;
        n = n_;
    }

    bool operator<(const Pony &another) const
    {
        return name < another.name || ((name == another.name) && score > another.score);
    };
};

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

  int n, m;

  cin >> n >> m;

  vector<vector<int>> s(m);
  vector<int> p(m);
  
  rep(i, m) {
    int k;
    cin >> k;
    rep(j, k) {
      int a;
      cin >> a;
      s[i].push_back(a-1);
    }
  }

  rep(i, m) {
    cin >> p[i];
  }

  int loopc = 1;
  rep(i, n) {
    loopc *= 2;
  }

  int cnt = 0;
  rep(i, loopc) {
    bool ok = true;
    rep(j, m) {
      int sm = 0;
      rep(k, s[j].size()) {
        if ((i>>s[j][k])&1) sm++;
      }
      if (sm % 2 != p[j]) ok = false;
    }
    if (ok) cnt++;
  }
  
  cout << cnt << endl;
}


Measured memory_bytes: 888
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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 int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------
int N;
vector<int> A, B;

int main() {
  cin >> N;
  rep(i, 0, N) {
    int a, b;
    cin >> a >> b;
    A.push_back(a);
    B.push_back(b);
  }
  sort(A.begin(), A.end());
  sort(B.begin(), B.end());

  if (N % 2 == 1) {
    int mid = (N + 1) / 2 - 1;
    int low = A[mid];
    int high = B[mid];
    cout << high - low + 1 << endl;
    return 0;
  } else {
    int mid = N / 2 - 1;
    double low = double((A[mid] + A[mid + 1])) / 2.0;
    double high = double(B[mid] + B[mid + 1]) / 2.0;
    int ans = (high - low) / 0.5 + 1;
    cout << ans << endl;
  }
}


Measured memory_bytes: 5004
s_s = list(input())
odd  = set(['R', 'U', 'D'])
even = set(['L', 'U', 'D'])
ans = 'Yes'
for i, s in zip(range(1, len(s_s) + 1), s_s):
  if (i % 2 == 0 and s not in even) or (i % 2 == 1 and s not in odd):
      ans = 'No'
      break
print(ans)

Measured memory_bytes: 3060
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int A[][] = new int[N][2];
		boolean f[] = new boolean[N];
		for(int i = 0; i < N; i++) {
			A[i][0] = sc.nextInt();
			A[i][1] = sc.nextInt();
		}
		Arrays.sort(A, Comparator.comparingInt(o -> o[0]));
		long ans = 0;
		int j = 0;
		PriorityQueue<Integer> pq = new PriorityQueue<Integer>(Collections.reverseOrder());
		for(int i = 1; i <= M; i++) {
			while(j < N && A[j][0] <= i) {
				pq.add(A[j][1]);
				j++;
			}
			if(!pq.isEmpty()) {
				ans += pq.poll();
			}
		}
		System.out.println(ans);
	}
}


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

int main()
{
    //string s;
    //cin >> s;
    int x,y,z;
    cin >> x >> y >> z;
    //vector<int> A(N);
    //vector<vector<int>> vec(N, vector<int>(N,99));

    //rep(i, N){
    //cin >> A[i];
    //}



    cout << z << " " << x << " "<< y << endl;

    return 0;
}

Measured memory_bytes: 256