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

const int N = 3005;

int A[N], B[N], n, tA, tB, l[N], r[N], tot;

string s, dp[N];

void solve(int x) {
  if(A[l[x]] < B[l[x]]) {
    int L = 0;
    for(int i = l[x]; i <= r[x]; ++ i) {
      if(A[i] > L) {
        dp[x] += "ab";
        L = B[i];
      }
    }
  }
  else {
    dp[x] = "";
    vector < pair < int, char> > it;
    for(int i = r[x]; i >= l[x]; -- i) {
      string now = "";
      it.clear();
      for(int j = i; j <= r[x]; ++ j)
        it.push_back(make_pair(B[j], 'b')),
          it.push_back(make_pair(A[j], 'a'));
      sort(it.begin(), it.end());
      for(int j = 0; j < (int) it.size(); ++ j)
        now += it[j].second;
      dp[x] = max(dp[x], now);
    }
  }
}

main() {
  cin >> n;
  cin >> s;
  int L = 1;
  for(int i = 0; i < n * 2; ++ i) {
    if(s[i] == 'a') A[++ tA] = i + 1;
    else B[++ tB] = i + 1;
    if(tA == tB) {
      l[++ tot] = L, r[tot] = tA;
      L = tA + 1;
    }
  }
  for(int i = 1; i <= tot; ++ i) solve(i);

  for(int i = tot - 1; i >= 1; -- i) {
    dp[i] = max(dp[i] + dp[i + 1], dp[i + 1]);
  }
  cout << dp[1] << endl;
}


Measured memory_bytes: 10624
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
class Program
{
    public static void Main()
    {
        String[] input = Console.ReadLine().Split();
        long N = long.Parse(input[0]);
        long K = long.Parse(input[1]);
        int[] A = new int[N];
        long[] temp = new long[N];
        input = Console.ReadLine().Split();
        for (int i = 0; i < N; i++)
        {
            A[i] = int.Parse(input[i]);
            temp[i] = 0;
        }
        int now = 0;
        long counter = 1;
        int ans = -1;
        for(long i = 0; i < K; i++)
        {
            if (temp[now] == 0)
            {
                temp[now] = counter;
                now = A[now] - 1;
                counter++;
            }
            else if (now==A[now]-1)
            {
                ans = now + 1;
                i = K;
            }
            else
            {
                K = (K-counter+1) % (counter - temp[now]);
                for (int x = 0; x < K; x++)
                {
                    now = A[now] - 1;
                }
            }
        }
        if (ans == -1) { ans = now+1; }
        Console.WriteLine(ans);
    }
}

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

using namespace std;

#define loop(i, n) for(int i = 0;i < int(n);i++)
#define rloop(i, n) for(int i = int(n);i >= 0;i--)
#define range(i, a, b) for(int i = int(a);i <= int(b);i++)
#define SZ(c) int(c.size())
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1, v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1, v2, v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1, v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1, v2, v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'


typedef complex<long double> point;
#define sz(a) ((int)(a).size())
#define all(n) (n).begin(),(n).end()
#define EPS 1e-9
#define OO 1e9
#define X real()
#define Y imag()
#define vec(a, b) ((b)-(a))
#define polar(r, t) ((r)*exp(point(0,(t))))
#define angle(v) (atan2((v).Y,(v).X))
#define length(v) ((long double)hypot((v).Y,(v).X))
#define lengthSqr(v) (dot(v,v))
#define dot(a, b) ((conj(a)*(b)).real())
#define cross(a, b) ((conj(a)*(b)).imag())
#define rotate(v, t) (polar(v,t))
#define rotateabout(v, t, a)  (rotate(vec(a,v),t)+(a))
#define reflect(p, m) ((conj((p)/(m)))*(m))
#define normalize(p) ((p)/length(p))
#define same(a, b) (lengthSqr(vec(a,b))<EPS)
#define mid(a, b) (((a)+(b))/point(2,0))
#define perp(a) (point(-(a).Y,(a).X))
#define colliner pointOnLine

typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
typedef long long ll;
typedef pair<int, int> pii;

int dcmp(const double &a, const double &b) {
    if (fabs(a - b) < EPS)
        return 0;
    return ((a > b) << 1) - 1;
}


int main() {

#ifndef ONLINE_JUDGE
//    freopen("in.in", "r", stdin);
    //freopen("out.in", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n, x, y;
    vector<point> pnts;
    cin >> n;

    loop(i, n) {
        cin >> x >> y;
        pnts.pb({x, y});
    }

    sort(ALL(pnts),[](const point &a , const point &b){
            return angle(a) < angle(b);
         });

    //loop(i,n)cout << pnts[i].X << " " << pnts[i].Y << endl;


    double ans = 0;
    loop(i, n) {
        bool flag = false;
        double x = 0, y = 0;
        int j = i;
        while (true) {
            if (flag && j == i)break;
            flag = true;
            x += pnts[j].X;
            y += pnts[j].Y;
            ans = max(ans, x * x + y * y);
            //cout << x << "====" << y << endl;
            j++;
            if(j == n)j = 0;
        }
    }


    cout << fixed << setprecision(12) << sqrt(ans) << endl;


    return 0;
}


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

int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> work(m);
  ll ans = 0;
  rep(i, n){
    int a, b;
    cin >> a >> b;
    if(a > m)continue;
    a--;
    work[a].push_back(b);
  }
  priority_queue<int> que;
  rep(i, m){
    rep(j,work[i].size()){
      que.push(work[i][j]);
    }
    if(!que.empty()){
      ans += que.top();que.pop();
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 8488
#include<algorithm>
#include<stdio.h>
#include<stdlib.h>
#include<vector>

using namespace std;

int main(void){
	int H = 0, W = 0;
	char str[55][55] = {"\0"};

	scanf("%d%d", &H, &W);
	for (int i = 0; i < H; i++){
		scanf("%s", str[i]);
	}
	for (int i = 0; i < H; i++){
		for (int j = 0; j < W; j++){
			char count = 0;
			for (int x = -1; x < 2; x++){
				for (int y = -1; y < 2; y++){
					if (i + x < 0 || j + y < 0)
						continue;
					if (str[i + x][j + y] == '#')
						count++;
				}
			}
			if (str[i][j] == '#')
				printf("#");
			else
				printf("%d", count);
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 128
// 見せてやるぜ、奇跡ってやつをよぉ……
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

pair< vector<ll>, vector<ll> > RunLengthEncoding(vector<ll> s) {
    ll len = 1;
    vector<ll> c;
    vector<ll> l;
    s.push_back(-1);
    for (int i=1; i<s.size(); i++) {
        if (s[i] != s[i-1]) {
            c.push_back(s[i-1]);
            l.push_back(len);
            len = 1;
        } else len++;
    }
    return make_pair(c, l);
} 

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    vll s(1LL << n); REP(i, 1LL << n) cin >> s[i];
    sort(ALL(s));
    reverse(ALL(s));
    P< vll, vll > rle = RunLengthEncoding(s);

    priority_queue< P<ll, ll> > pq;
    pq.push(make_pair(n, HIGHINF));
    REP(i, rle.first.size()) {
        V< P<ll, ll> > tmp;
        REP(j, rle.second[i]) {
            if (pq.empty()) {
                cout << "No\n";
                return 0;
            }

            P<ll, ll> q = pq.top(); pq.pop();
            // cout << q.first << ' ' << q.second << '\n';
            if (q.second <= rle.first[i]) {
                cout << "No\n";
                return 0;
            }
            for (ll k = q.first - 1; k >= 0; k--) tmp.emplace_back(k, rle.first[i]);
        }
        REP(j, tmp.size()) pq.push(tmp[j]);
    }
    cout << "Yes\n";
    return 0;
}


Measured memory_bytes: 15612
#include <iostream>
using namespace std;
int main(){
    int a,b,c;
    char op;
    while(1){
        cin >> a >> op >> b;
        if     (op=='+') c = a+b;
        else if(op=='-') c = a-b;
        else if(op=='*') c = a*b;
        else if(op=='/') c = a/b;
        else if(op=='?') return 0;
        cout << c << endl;
    }
}

Measured memory_bytes: 1160
/* --- author: dxm --- */
#include<bits/stdc++.h>
using namespace std;

#define INF 1e9
#define Inf 1e18
#define rep(i,n) for(int (i)=0;(i)<n;i++)
#define REP(i,n) for(int (i)=1;(i)<=n;i++)
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define fst first
#define snd second
typedef long long ll;
typedef double db;
typedef long double ldb;
typedef unsigned int uint;
typedef unsigned long long ull;
#define DEBUG

const int maxn=100005;
int n,m,s,t;
vector<pii>edge[maxn];
ll dist[maxn][2],a[maxn],b[maxn],ans[maxn];
priority_queue<pair<ll,int> >q;

int main(){
#ifndef DEBUG
	freopen("my.in","r",stdin);
	freopen("my.out","w",stdout);
#endif
	scanf("%d%d%d%d",&n,&m,&s,&t);
	REP(i,m){
		int u,v;
		scanf("%d%d%d%d",&u,&v,&a[i],&b[i]);
		edge[u].pb(mp(v,i));
		edge[v].pb(mp(u,i));
	}
	REP(i,n)rep(j,2)dist[i][j]=Inf;
	dist[s][0]=0;
	q.push(mp(0,s));
	while(!q.empty()){
		pair<ll,int> x=q.top();q.pop();
		x.fst=-x.fst;
		if(dist[x.snd][0]!=x.fst)continue;
		rep(i,edge[x.snd].size()){
			pii y=edge[x.snd][i];
			if(dist[y.fst][0]>x.fst+a[y.snd]){
				dist[y.fst][0]=x.fst+a[y.snd];
				q.push(mp(-dist[y.fst][0],y.fst));
			}
		}
	}
	dist[t][1]=0;
	q.push(mp(0,t));
	while(!q.empty()){
		pair<ll,int> x=q.top();q.pop();
		x.fst=-x.fst;
		if(dist[x.snd][1]!=x.fst)continue;
		rep(i,edge[x.snd].size()){
			pii y=edge[x.snd][i];
			if(dist[y.fst][1]>x.fst+b[y.snd]){
				dist[y.fst][1]=x.fst+b[y.snd];
				q.push(mp(-dist[y.fst][1],y.fst));
			}
		}
	}
	ans[n+1]=Inf;
	for(int i=n;i>=1;i--){
		ans[i]=ans[i+1];
		ans[i]=min(ans[i],dist[i][0]+dist[i][1]);
	}
	REP(i,n)printf("%lld\n",1LL*100000*100000*100000-ans[i]);
	return 0;
}

/*
Input:
-----------------
Output:
*/

Measured memory_bytes: 12404
S = input()

if(0<int(S[:2])<=12 and 0<int(S[2:])<=12):
    print("AMBIGUOUS")
elif(0<int(S[:2])<=12):
    print("MMYY")
elif(0<int(S[2:])<=12):
    print("YYMM")
else:
    print("NA")


Measured memory_bytes: 40680
#include <bits/stdc++.h>
#include<math.h>
using namespace std;
#define NMAX 1000000
int main()
{
int N,M,S=0;
int *A;
cin>>N>>M;
A=new int(M);
for(int i=0;i<M;i++)
{
  cin>>A[i];
}
for (int i=0; i<M ; i++)
{
  S+=A[i];
}
if(S>N)
{
  cout<<"-1"<<endl;
}
else {
  cout<<N-S;
}
}



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

int main()
{
    int N;
    cin >> N;
    vector<int> a(9, 0);
    for (int i = 0; i < N; i++)
    {
        int x;
        cin >> x;
        if (x < 400)
            a[0]++;
        else if (x < 800)
            a[1]++;
        else if (x < 1200)
            a[2]++;
        else if (x < 1600)
            a[3]++;
        else if (x < 2000)
            a[4]++;
        else if (x < 2400)
            a[5]++;
        else if (x < 2800)
            a[6]++;
        else if (x < 3200)
            a[7]++;
        else
            a[8]++;
    }
    int c = 0;
    for (int i = 0; i < 8; i++)
        if (a[i] != 0)
            c++;
    cout << (1 <= c ? c : 1) << " " << a[8] + c << endl;
    return 0;
}

Measured memory_bytes: 256
s = int(input())
L, R = divmod(s, 100)
if 0 < L < 13:
    if 0 < R < 13:
        print('AMBIGUOUS')
    else:
        print('MMYY')
elif 0 < R < 13:
    print('YYMM')
else:
    print('NA')

Measured memory_bytes: 3060
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  int n, x, a, b;
  cin >> x >> a >> b >> n;
  int ans = x;
  while(n--) {
    string s;
    cin >> s;
    if(s == "nobiro") ans += a;
    else if(s == "tidime") ans += b;
    else ans = 0;
    ans = max(ans, 0);
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3224
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fr first
#define sc second
typedef long long ll;
const long long llinf=LLONG_MAX;
const int nrm=INT_MAX;
const int nrn=INT_MIN;
const int nmax=1e5+5;
const int mod=1e9+7;
using namespace std;
ll x,y,n;
int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    cin>>n;
    for(x=1;x<=3500;x++)
     for(y=1;y<=3500;y++)
      if(4*x*y-n*x-n*y>0 && !((n*x*y)%(4*x*y-n*x-n*y)))return cout<<x<<" "<<y<<" "<<(n*x*y)/(4*x*y-n*x-n*y)<<endl,0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
using ll = long long;
using namespace std;
int main() {
    ll k,a,b;cin >> k;a = k / 50;b = k % 50;
    cout << 50 << endl;
    rep(i,50)cout << 49+a-b + (i<b)*50 << " ";
    cout << endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define ll long long
const int mod=1e9+7;
using namespace std;

int N;
void dfs(string s,char mx)
{
    if(s.size()==N)
        cout<<s<<endl;
    else
    {
        for(char c='a';c<=mx;c++)
            dfs(s+c,(c==mx)?(char)(mx+1):mx);
    }
}
int main()
{
    //freopen("input.txt","r",stdin);
    ios::sync_with_stdio(false);
    cin>>N;
    dfs("",'a');
}



Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
#define ll long long
#define pb push_back
#define mp make_pair
#define nt _int128
#define ld long double
long double PI =3.14159265358979323846;


const ll modo=1e9+7;
const ll inf=2e14;
const ll ms=(1e5) +5;


int main()
{
    idfc;

    ll n,m;
    cin>>n>>m;
    map<int,int> mm;
    set<int> ss;
    int i;
    int e; string s;
    int a=0;
    int b=0;
    for(i=0;i<m;i++)
    {
        cin>>e>>s;
      //  cout<<e<<" "<<s<<endl;
        if(ss.count(e))continue;
        if(s=="WA")
        {
            mm[e]+=1;
        }
        else{
            a+=mm[e];
            b++;
            ss.insert(e);
        }
    }
    cout<<b<<" "<<a;
    return 0;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;

int v[100005];

int main(){

    map<int,int> mapa;
    int n; cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> v[i];
        mapa[v[i]]++;
    }

    vector<ii> vec(mapa.begin(), mapa.end());
    int res = 0;
    for(int i = 0; i < vec.size(); i++){
        res = max(res, vec[i].second);
        if(i+1 < vec.size() and abs(vec[i+1].first-vec[i].first) <= 2)
            res = max(res, vec[i].second + vec[i+1].second);
        if(i-1 >= 0 and i+1 < vec.size() and abs(vec[i-1].first-vec[i].first) <= 1 and abs(vec[i].first-vec[i+1].first) <= 1)
            res = max(res, vec[i-1].second+vec[i].second+vec[i+1].second);
    }
    cout << res << endl;
	return 0;
}


Measured memory_bytes: 4096
#include "bits/stdc++.h"
#ifndef err
#define err(...)(void)0
#endif
using namespace std;
using ll = long long;
using ull = decltype(1ull);
template<class T>int size(T&&a) { return a.size(); }
#define REP(t,a)for(typename make_signed<decltype(a.second)>::type t=a.first,_l##t=a.second;t<_l##t;t++)
#define RREP(t,a)for(typename make_signed<decltype(a.second)>::type t=a.second-1,_l##t=a.first;t>=_l##t;t--)
template<class B>pair<int, B>make_pair(B b) { return{ 0,b }; }
#define rep(t,...)REP(t,make_pair(__VA_ARGS__))
#define rrep(t,...)RREP(t,make_pair(__VA_ARGS__))
#define all(a)begin(a),end(a)
#define rall(a)a.rbegin(),a.rend()
#define var(t, ...) t __VA_ARGS__;in,__VA_ARGS__;

void Calc();
int main() {
  ios::sync_with_stdio(false); cin.tie(nullptr);
  cin.exceptions(istream::failbit | istream::badbit);
  cout << fixed << setprecision(15); Calc(); cout.flush(); return 0;
}
template<class A>void amax(A&a, A b) { a = max(a, b); }
template<class A>void amin(A&a, A b) { a = min(a, b); }
template<class A>int comp(A a, A b) { return a < b ? 1 : b < a ? -1 : 0; }
struct Scanner {
  template<class A = string>A Next() { A a; cin >> a; return a; }
  template<class A = int>vector<A>Array(int n) { vector<A>a(n); for (A&i : a) cin >> i; return a; }
  string Line() const { string s; getline(cin, s); return s; }
  template<class A>Scanner&operator,(A&a) { a = Next<A>(); return *this; }
  template<class A>operator A() { return Next<A>(); }
}in;

/*---------------------------------------------------------------------*/


void Calc() {
    int n = in;
    auto a = in.Array<ll>(n);
    a.push_back(0);
    rep(i, n)a[i+1] += a[i];
    ll cnt = 1000000000000000000;
    rep(i, n - 1){
      ll s = a[i];
      ll b = a[n]-a[i];
      amin(cnt, abs(s-b));
    }
    cout << (cnt) << endl;

}


Measured memory_bytes: 4864
#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) (v).begin(),(v).end()
#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; }

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pll> pip;
const ll INF = 1ll<<60;
const ll MOD = 1000000007;
const double EPS  = 1e-9;

int n;
int a[212345];

int main() {
	cin >> n;
	REP(i, n) scanf("%d", a + i);
	
	deque<int> deq;
	REP(i, n) {
		if (i & 1) deq.push_back(a[i]);
		else deq.push_front(a[i]);
	}
	
	vector<int> ans;
	REP(i, n) ans.push_back(deq[i]);
	
	if (n % 2 == 0) reverse(ALL(ans));
	
	REP(i, n) printf("%d%c", ans[i], i == n - 1 ? '\n' : ' ');
	
	return 0;
}

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

int main() {
  int n,m;
  int sum = 0; cin >> n;
  m = n;

  for(int i = 0; n > 0; ++i){
    sum += n%10;
    n /= 10;
  }
  if(m%sum==0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

int main() {
    int H,W;
    cin >> H >> W;
    string S[50];
    for(int i = 0; i < H; ++i) cin >> S[i];

    //*def vector
    const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
    const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

    int num;
    for(int i = 0; i < H; ++i){
        for(int j = 0; j < W; ++j){
            //each cell
            if(S[i][j] == '#') continue;

            //count
            num = 0;
            //with vector
            for (int d = 0; d < 8; ++ d) {
                const int ni = i + dy[d];
                const int nj = j + dx[d];

                if(ni < 0 || H <= ni) continue;
                if(nj < 0 || W <= nj) continue;
                if(S[ni][nj] == '#') num++;
            }
            S[i][j] = char(num + '0');
            //for(int k = i-1; k <= i+1; ++k){
            //    if(k < 0 || k >= H) continue;
            //    for(int l = j-1; l <= j+1; ++l){
            //        if(l < 0 || l >= W) continue;
            //        if(S[k][l] == '#') num++;
            //    }
            //}
            //S[i][j] = '0' + num;
        }
    }
    for(int i = 0; i < H; ++i) cout << S[i] << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String buffer;
		try {
			while ((buffer = reader.readLine())  != null) {
				int second = Integer.valueOf(buffer);
				int minute = second / 60;
				second -= minute * 60;
				int hour = minute / 60;
				minute -= hour * 60;
				System.out.println(hour + ":" + minute + ":" + second);
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}
}

Measured memory_bytes: 24400
pub struct Scanner {
	handle: std::io::Stdin,
	buffer: std::collections::VecDeque<String>
}

impl Scanner {
	pub fn new() -> Scanner {
		Scanner {
			handle: std::io::stdin(),
			buffer: std::collections::VecDeque::new()
		}
	}
	pub fn next<T: std::str::FromStr>(&mut self) -> Result<T, T::Err> {
		if self.buffer.len() == 0 {
			loop {
				let mut available = String::new();
				self.handle.read_line(&mut available).unwrap();
				self.buffer = available.split_whitespace().map(String::from).collect();
				if self.buffer.len() > 0 {
					break;
				}
			}
		}
		T::from_str(&self.buffer.pop_front().unwrap())
	}
}

fn gcd(m: isize, n: isize) -> isize {
	if m == 0 {
		n
	} else {
		gcd(n % m, m)
	}
}

fn two_p(p: isize) -> isize {
	if p == 0 {
		1
	} else {
		(2 * two_p(p - 1)) % 1000000007
	}
}

fn main() {
	let mut scanner = Scanner::new();
	let n: isize = scanner.next().unwrap();
	let mut size = std::collections::HashMap::<(isize,isize,isize),isize>::new();
	let mut zero_total: isize = 0;
	for _ in 0..n {
		let mut a: isize = scanner.next().unwrap();
		let mut b: isize = scanner.next().unwrap();
		if a == 0 && b == 0 {
			zero_total = (zero_total + 1) % 1000000007;
			// println!("a: {}, b: {}, zero_total: {}", a, b, zero_total);
			continue;
		}
		let mut sign = 1;
		if a < 0 {
			sign *= -1;
			a *= -1;
		}
		if b < 0 {
			sign *= -1;
			b *= -1;
		}
		sign = if a == 0 {
			-1
		} else if b == 0 {
			1
		} else {
			sign
		};
		let g = gcd(a as isize,b as isize);
		let s = size.entry((sign,(a as isize)/g,(b as isize)/g)).or_insert(0);
		*s += 1;
	}
	// println!("zero_total: {}", zero_total);
	// println!("{:?}", size);
	let mut total: isize = 1;
	for (k1,v1) in size.iter() {
		// println!("total: {}", total);
		match size.get(&(-k1.0,k1.2,k1.1)) {
			Some(v2) => {
				if k1.0 > 0 {
					total = (total * ((two_p(*v1) + two_p(*v2) - 1) % 1000000007)) % 1000000007;
				}
			}
			None => total = (total * two_p(*v1)) % 1000000007
		}
		// println!("B {:?}", ((s1,a1,b1),v1));
	}
	total = ((total + zero_total - 1) % 1000000007 + 1000000007) % 1000000007;
	// if total == 0 {
	// 	total = 1000000007 - 1;
	// } else {
	// 	total -= 1;
	// }
	println!("{}", total);
}


Measured memory_bytes: 14848
def calc_odd(n):
    return (n + 1) // 2 % 2


def calc(n):
    if n % 2 == 1:
        return calc_odd(n)
    else:
        return calc_odd(n + 1) ^ (n + 1)


a, b = map(int, input().split())
ans = calc(b) ^ calc(a - 1)
print(ans)


Measured memory_bytes: 2940
n=int(input())
s=(list(range(1,14)))
h=(list(range(1,14)))
c=(list(range(1,14)))
d=(list(range(1,14)))
hand=[map(str,raw_input().split()) for i in range(n)]
for a in hand:
    if a[0]=="S":
        s.remove(int(a[1]))
    if a[0]=="H":
        h.remove(int(a[1]))
    if a[0]=="C":
        c.remove(int(a[1]))
    if a[0]=="D":
        d.remove(int(a[1]))
if len(s)!=0:
    for a in s:
        print "S "+str(a)
if len(h)!=0:
    for a in h:
        print "H "+str(a)
if len(c)!=0:
    for a in c:
        print "C "+str(a)
if len(d)!=0:
    for a in d:
        print "D "+str(a)


Measured memory_bytes: 4692
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)
#include<boost/multiprecision/cpp_int.hpp>
using Int=boost::multiprecision::cpp_int;

struct modint{
    using i64=int_fast64_t;
    i64 a;
    static constexpr i64 MOD=1e9+7;
    modint(){a=0;}
    modint(i64 a_){
        a=a_%MOD;
        if(a<0) a+=MOD;
    }
    modint inv()const{
        i64 n=1,m=MOD-2,A=a;
        while(m){
            if(m&1)(n*=A)%=MOD;
            (A*=A)%=MOD;
            m>>=1;
        }
        modint y;
        y.a=n;
        return y;
    }
    bool operator==(const modint& x){
        return a==x.a;
    }
    bool operator!=(const modint& x){
        return a!=x.a;
    }
    modint& operator=(const modint& x){
        a=x.a;
        return *this;
    }
    modint operator+(const modint& x){
        modint y;
        y.a=a+x.a;
        if(y.a>MOD) y.a-=MOD;
        return y;
    }
    modint operator-(const modint& x){
        modint y;
        y.a=a-x.a;
        if(y.a<0) y.a+=MOD;
        return y;
    }
    modint operator*(const modint& x){
        modint y;
        y.a=(a*x.a)%MOD;
        return y;
    }
    modint operator/(const modint& x){
        modint y;
        y.a=(a*x.inv().a)%MOD;
        return y;
    }
    modint& operator+=(const modint& x){
        a+=x.a;
        if(a>=MOD) a-=MOD;
        return *this;
    }
    modint& operator-=(const modint& x){
        a-=x.a;
        if(a<0) a+=MOD;
        return *this;
    }
    modint& operator*=(const modint& x){
        (a*=x.a)%=MOD;
        return *this;
    }
    modint& operator/=(const modint& x){
        (a*=x.inv().a)%=MOD;
        return *this;
    }
};
istream& operator>>(istream &in,modint& x){
    int_fast64_t a_;
    in>>a_;
    modint y(a_);
    x=y;
    return in;
}
ostream& operator<<(ostream &out,const modint& x){
    out<<x.a;
    return out;
}
modint pwr(int_fast64_t a,int_fast64_t b){
    modint _;
    int_fast64_t n=1,A=a;
    while(b){
        if(b&1) (n*=A)%=modint::MOD;
        (A*=A)%=modint::MOD;
        b>>=1;
    }
    _.a=n;
    return _;
}

Int gcd(Int n,Int m){
    if(n>m) swap(n,m);
    while(n>0){
        m%=n;
        swap(n,m);
    }
    return m;
}


int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    istream& in(cin);
    ostream& out(cout);
    int n;
    in>>n;
    vector<int> a(n);
    for(auto&i:a) in>>i;
    Int lcm{1};
    fr(i,n) lcm*=(Int)a[i]/gcd((Int)a[i],lcm);
    lcm%=1000000007;
    modint ans{};
    fr(i,n) ans+=modint(a[i]).inv();
    ans*=(int)lcm;
    cout<<ans<<endl;
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int main(void){
	int n,i,k;
	string s;
	cin >> s;
	n = s.l_ength();
	k = n;
	for(i=1; i<n; ++i){
		if(s[i-1] == s[i]){
			--k; i+=2;
		}
	}
	cout << k << endl;
	return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)









int main() {
    ll n;
    cin >> n;
    vector<ll> h(n);
    REP(i, n){
        cin >> h[i];
    }
    ll ans = 0;
    bool ok = true;
    for(;ok;){
        ok = false;
        ll i = 0;
        while(h[i] == 0){
            i++;
        }
        for(ll j = i; j < n && h[j] != 0; j++){
            h[j]--;
            ok = true;
        }
        if(ok){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;
public class c
{
  public static void Main()
  {
    int N = int.Parse(Console.ReadLine());
    int[] x=new int[N];
    int i;
    for(i=0;i<N;i++)
    {
      x[i]=int.Parse(Console.ReadLine());
    }
    Array.Sort(x);
    int s=1;
    int ans=0;
    for(i=1;i<N;i++)
    {
      if(x[i]==x[i-1])s++;
      else 
      {
        if(s%2==1)ans++;
         s=1;
      }
      
    }if(s%2==1)ans++;
    
    Console.WriteLine(ans);
  }
}

Measured memory_bytes: 15328
/* ****Ragnar7 _Lawliet_**** */
/* First, solve the problem.Then write the code. */
#include<bits/stdc++.h>
#define ll          long long
#define ld 			long double
#define hell        1000000007
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	#ifndef ONLINE_JUDGE
	freopen ("input.txt","r",stdin);
	// freopen ("output.txt","w",stdout);
	#endif
	ll t = 1;
	// cin>>t;
	while(t--)
	{
		ll n;
		cin>>n;
		vector<ll> v(n,0);
		ll s = 0;
		for(ll i=0;i<n;i++)
		{
			cin>>v[i];
			s+=v[i];
		}
		ll ans =0 ;
		s=s%hell;
		for(ll i=0;i<n;i++)
		{
			s = ((s-v[i])%hell+hell)%hell;
			ans = (ans+v[i]*s)%hell;
			
		}
		cout<<ans%hell;
		
	}

	
	time
	return 0;
}

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

#define int             long long
#define	ll				long long

#define	mod 			1000000007
#define	inf 			1000000000000000
#define infty			1000000000000000000LL
#define	md				998244353
#define	PI				acos(-1.0)
#define	endl 			"\n"
#define	rr				return
#define	br				cout<<"\n";
long long prime[1000000];

void sieve()
{
	prime[0]=0;
	prime[1]=0;
	for(int i=2;i<1000000;i++)
		prime[i]=1;

	for(int i=2;i*i<1000000;i++)
		if(prime[i]==1)
			for(int j=i*i;j<1000000;j+=i)
				prime[j]=0;
}

bool isPrime(int n)
{
    if (n <= 1)
        return false;
    for (ll i = 2; i <= floor(sqrt(n)); i++)
        if (n % i == 0)
            return false;

    return true;
}

int factorial(int n)
{
    int f=1;
    for(int i = 1;i<=n ; i++)
        f = (f*i)%mod;
    return f;
}

int gcd(int a, int b)
{
	return !b ? a : gcd(b, a % b);
}

int lcm(int a, int b)
{
	return (a / gcd(a, b)) * b;
}

int fastExponentiation(int n, int x, int modulo)
{
	int res = 1;
	while(x > 0)
       {
          if(x & 1)
          res = (res*n) % modulo;
          x = x >> 1;
          n = (n * n) % modulo;
       }
       return res;
}

int power(int n , int p )
{
	if(p==0)
	   return 1;

	 int res = power((n*n)%mod,p/2);
	 if(p%2==1)
	   res = (n*res)%mod;

	   	 return res;
}

bool isPowerOfTwo(int n)
{
   	return n && (!(n&(n-1)));
}

bool isSet(int n,int i)
{
	// To check if ith bit is set or not in binary representation of n
   	return n & (1 << i);
}

bool valid_coordinate(ll x,ll y,ll n,ll m)
{
    if(x<0 || y<0)
       return false;

   	else if(x>=n || y>=m)
       return false;

   	else
   		return true;
}

int sod(int n)
{
	int sum=0;
	while(n)
	{
		sum+=(n%10);
		n/=10;
	}
	return sum;
}



void solve()
{
	int a,b;
	cin>>a>>b;
	if(a>9 || b>9)
		cout<<-1<<endl;
	else
		cout<<a*b<<endl;
}

int32_t main()
{

	//int t; cin>>t; while(t--)
	solve();

	return 0;
}


Measured memory_bytes: 3692
fn run() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let n: usize = s.trim().parse().unwrap();
    let mut cnt = vec![vec![0; 10]; 10];
    for i in 1..(n + 1) {
        let x = i % 10;
        let mut m = i;
        while m >= 10 {
            m /= 10;
        }
        let y = m;
        cnt[y][x] += 1;
    }
    let mut ans = 0usize;
    for i in 0..10 {
        for j in 0..10 {
            ans += cnt[i][j] * cnt[j][i];
        }
    }
    println!("{}", ans);
}

fn main() {
    run();
}

Measured memory_bytes: 4352
<?php
  $dice = explode(" ", trim(fgets(STDIN)));
  $action = trim(fgets(STDIN));
  $upper  = $dice[0];
  $side   = array($dice[4], $dice[2], $dice[1], $dice[3]);
  $bottom = $dice[5];
  foreach(str_split($action) as $val){
    $b = $bottom;
    $u = $upper;
    if ($val == "N") {
      $upper = $side[2];
      $bottom = $side[0];
      $side[2] = $b;
      $side[0] = $u;
    } else if ($val == "E") {
      $upper = $side[3];
      $bottom = $side[1];
      $side[3] = $b;
      $side[1] = $u;
    } else if ($val == "S") {
      $upper = $side[0];
      $bottom = $side[2];
      $side[0] = $b;
      $side[2] = $u;
    } else if ($val == "W") {
      $upper = $side[1];
      $bottom = $side[3];
      $side[1] = $b;
      $side[3] = $u;
    }
  }
  print $upper;
?>

Measured memory_bytes: 6604
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<(n);i++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod =1000000007;
const int PI = acos(-1);
int main(){
	int n,m;cin>>n>>m;
	vi x[100005];
	rep(i,n){
		int a,b;
		cin>>a>>b;
		x[a].push_back(b);
	}
	priority_queue<int>q;
	ll ans =0 ;
	rep(i,m+1){
		for(int a:x[i])q.push(a);
		if(q.size()){
			ans+=q.top();
			q.pop();
		}
	}
	cout<<ans<<endl;
}

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

int main ()
{
    int n,k;
    cin>>n;
    int d[n];
    for(int i=0;i<n;i++)
    {
        cin>>d[i];
    }
    sort(d,d+n);
    int m=n/2;
    cout<<d[m]-d[m-1];
    return 0;
}


Measured memory_bytes: 640
N,M,C =map(int,input().split())
B=[int(x) for x in input().split()]
result = 0
test = 0
for i in range(N):
  test = 0
  A=[int(x) for x in input().split()]
  for j in range(M):
    test +=A[j]*B[j]
  if test + C>0:
    result +=1
print(result)

Measured memory_bytes: 3060
#!/usr/bin/env python3
import sys, math, fractions, itertools


def solve(N: int, M: int, a: "List[int]", b: "List[int]"):

    visited = [0] * N
    visited[0] = 1
    G = [[] for _ in range(N)]
    for i in range(M):
        G[a[i]-1].append(b[i]-1)
        G[b[i]-1].append(a[i]-1)

    def dfs(v):
        if all(visited):
            return 1
        else:
            counter = 0
            for g in G[v]:
                if visited[g]:
                    continue
                visited[g] = 1
                counter += dfs(g)
                visited[g] = 0
            return counter
    print(dfs(0))
    return


# Generated by 1.1.4 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()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    a = [int()] * (M)  # type: "List[int]" 
    b = [int()] * (M)  # type: "List[int]" 
    for i in range(M):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
    solve(N, M, a, b)

if __name__ == '__main__':
    main()


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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long l, r, i, j, ans=100009;
  cin >> l >> r;
  for (i = l; i <= min(l+2020, r); i++) {
    for (j = i+1 ; j <= min(i+2020, r); j++) {
      ans = min(ans, (long long)(i*j)%2019);
    }
  }
  cout << ans << '\n';
}


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

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

using namespace std;
using ll = long long;
int mod = 1000000007;

int main(void){
    int N; cin >> N;
    string S; cin >> S;
    rep(i, S.length()){
        int val = S[i] + N;
        if(val > 'Z') val -= 26;
        S[i] = val;
    }
    cout << S << endl;
    return 0;
}

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

using namespace std;

int main(){
	
	long long a, v;
	cin >> a >> v;
	long long b, w;
	cin >> b >> w;
	long long t;
	cin >> t;

	if (v <= w) {
		cout << "NO" << endl;
		return 0;
	}

		if (abs(b - a)   <= t* (v - w)) {
			cout << "YES" << endl;
			return 0;
		}

	cout << "NO" << endl;


	return 0;
}

Measured memory_bytes: 3600
import java.io.PrintWriter;
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

    PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {

        String s = sc.next();
        char[] arr = s.toCharArray();

        StringBuilder sb = new StringBuilder();

        for (int i=0; i<s.length(); i++) {
            if (i%2==0) sb.append(arr[i]);
        }

        System.out.println(sb.toString());
    }
}

Measured memory_bytes: 24268
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define MOD2 998244353
#define vi vector<ll>
#define PB push_back
#define FOI(i, a, n) for( ll i = a; i <= n; i++)
#define FOD(i, a, n) for( ll i = a; i >= n; i--)
#define F0I(i, n) FOI(i,0,n)
#define F0D(i, n) FOD(i,n,0)
#define F1I(i, n) FOI(i,1,n)
#define F1D(i, n) FOD(i,n,1)
#define watch(x) cout << #x << ": " << x << endl;
#define cnl(d) cout<<d<<'\n'
#define cns(d) cout<<d<<' '
#define printcont(v) for (auto &i : v) cout << i << " "; cout << endl
#define printmat(mat,row,col) F0I(i,row-1)F0I(j,col-1)cout << mat[i][j] << " \n"[j == col-1];
#define PNS cout<<' '
#define PNL cout<<'\n'
#define inint(i) ll i;cin >> i
#define invec(n,v) vi v(n); F0I(i,n-1) cin >> v[i]
#define insvec(n,v) inint(n); vi v(n); F0I(i,n-1) cin >> v[i]
#define MK2DV(v,row,col,val) vector<vector<ll>> v(row, vector<ll>(col,val))
#define trvl(c,it) for(auto it=(c).begin();it!=(c).end();it++)
using namespace std;
ll findmin(ll a, ll b) { if(a < b) return a; return b; }
ll findmax(ll a, ll b) { if(a > b) return a; return b; }
ll fast_pow(ll base,ll exp){if (exp == 0) return 1;if (exp == 1) return base % MOD;ll t = fast_pow(base, exp / 2);t = ((t% MOD) * (t%MOD)) % MOD;if (exp % 2 == 0)return t;else return ((base %  MOD) * t) % MOD;}
ll abso(ll a){
	if(a < 0) return -a;
	return a;
}
//GLOBAL FUNCTIONS AND VARIABLES GO HERE //
int main()
{
	inint(n);
	inint(k);
	vi h(n);
	for(ll i = 0; i < n; i++) cin >> h[i];
	vi dp(n);
	dp[0] = 0;
	k = findmin(n-1,k);
	for(ll i = 1; i <= k; i++)
	{
		dp[i] = INT_MAX;
		for(ll j = 0; j < i; j++)
			dp[i] = findmin(dp[i],dp[j]+abso(h[i] - h[j]));
	}
	for(ll i = 2; i < n; i++)
	{
		dp[i] = INT_MAX;
		for(ll j = 1; j <= k; j++)
		{
			if(i-j < 0) break;
			ll cost = dp[i-j] + abso(h[i-j] - h[i]);
			dp[i] = findmin(dp[i], cost);

		}
	}
	cout << dp[n-1];

	return 0;
 }

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

int main()
{
	int N,M;

	scanf ("%d %d",&N,&M);
	for (int i=1;i<=N;i++) for (int j=0;j<M;j++){
		char S[7];
		scanf ("%s",S);
		std::string st = S;
		if (st == "snuke"){
			printf ("%c%d\n",j+'A',i);
			return 0;
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll mod = 1e9 + 7;

ll n;
ll a[405], pre[405], dp[405][405];

ll fn(ll i, ll j)
{
	if(dp[i][j] != -1)
		return dp[i][j];
	if(i == j)
		return 0;
	dp[i][j] = 1e18;
	for(ll k=i; k<j; k++)
	{
		dp[i][j] = min(dp[i][j], fn(i,k) + fn(k+1, j) + pre[j] - pre[i-1]);
	}
	return dp[i][j];
}

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

	cin >> n;
	for(ll i=0; i<n; i++)
	{
		cin >> a[i];
		if(i==0)
			pre[0] = a[0];
		if(i>0)
			pre[i] = pre[i-1] + a[i];
	}
	pre[0] = a[0];
	memset(dp, -1, sizeof dp);
	cout << fn(0, n-1) << "\n";

	return 0;
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define ssort(a) sort(a.begin(), a.end())
#define INF 1001001001
#define INFll 100100100100100
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

int main(){
  int n;
  cin >> n;
  vector<tuple<int, int, int> > V;
  multiset<int> S;
  rep(i, n){
    int a, b;
    cin >> a >> b;
    V.push_back(make_tuple(a, b, 0));
  }
  rep(i, n){
    int c, d;
    cin >> c >> d;
    V.push_back(make_tuple(c, d, 1));
  }
  ssort(V);
  int vsz=V.size();
  int ans=0;
  rep(i, vsz){
    auto p=V[i];
    if(get<2>(p)==0){
      S.insert(-get<1>(p));
    } else {
      if(S.upper_bound(-get<1>(p))!=S.end()){
        S.erase(S.upper_bound(-get<1>(p)));
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include<cmath>
#define N 100005
#define A 1000005
#define MOD 1000000007 // //100000000 998244353 //
#define inf 1000000000000000000
#define ll long long
//#define M_PI 3.141592653589793238463

using namespace std;

#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define itr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define mem(a, b) memset(a, (ll)b, sizeof(a))
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);
#define popcount __builtin_popcount
#define ANS(s) {cout << s << "\n"; return;}

//~~~~~~fancy print~~~~~~~//
#define printpii(a) cout << a.ft << " " << a.sd << endl;
#define printpiii(a) cout << a.ft << " " << a.sd.ft << " " << a.sd.sd << endl;
#define print(a, n) rep(i, n) cout << a[i] << " "; cout << endl;
#define printv(v) for(auto x: v)cout << x << " "; cout << endl;
#define printm(a, n, m) rep(i, n) { rep(j, m) cout << a[i][j] << "\t"; cout << endl;}

ll lx[4] = {0, 0, 1, -1};
ll ly[4] = {1, -1, 0, 0};
ll dx[8] = {0, 0, 1, -1, 1, -1, 1, -1};
ll dy[8] = {1, -1, 0, 0, 1, 1, -1, -1};
void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout << setprecision(12) << fixed;}

void solve(){
    string a, b;
    cin >> a >> b;
    sort(all(a));
    sort(allr(b));
    cout << (a < b ? "Yes" : "No");
}

int main(){
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    fast();
    ll t = 1; //cin >> t;
    while(t--){
        solve();
    }
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define newl '\n'




bool isprime(ll a)
{
    if(a<=1)
        return false;
    if(a==2||a==3)
        return true;
    if(a%2==0||a%3==0)
        return false;
    for(ll i=5;i*i<=a;i=i+6)
    {
        if(a%i==0||a%(i+2)==0)
            return false;
    }
    return true;

}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin>>t;
    if(t>=30)
    cout<<"Yes";
    else
    {
        cout<<"No";
    }
    

    return 0;
}


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

using namespace std;
#define FOR(i,a,b) for(int (i) = (a); (i) < (b); (i)++)
#define rep(i,n) for(int (i)=0; (i)<(n); (i)++)

int main(){
  int n,m;
  const int max_n = 3;
  const int max_m = 5;
  int s[max_m + 1];
  int c[max_m + 1];
  int num[max_n + 1];

  cin >> n >> m;
  for(int i = 0; i < n; i++) num[i] = -1;
  for(int i = 0; i < m; i++) cin >> s[i] >> c[i];
  for(int i = 0; i < m; i++) s[i] -= 1;

  bool f = 0;
  for(int i = 0; i < m; i++){
    if(num[s[i]] == -1){
      num[s[i]] = c[i];
    }else if(num[s[i]] != c[i]){
      f = 1;
    }
  }

  for(int i = 0; i < n; i++){
    if(num[i] == -1) {
      if(i == 0 && n != 1) num[i] = 1;
      else if (i == 0 && n == 1) num[i] = 0;
      else num[i] = 0;
    }
  }
  if(num[0] == 0 && n != 1) f = 1;
  

  if(f == 1) {
    cout << -1 << endl;
  }else {
    if(n == 1) cout << num[0] << endl;
    else if(n == 2) cout << num[0] * 10 + num[1] << endl;
    else cout << num[0] * 100 + num[1] * 10 + num[2] * 1 << endl;
  }

  return 0;
}

Measured memory_bytes: 256
d =int(input())
c = list(map(int, input().split())) 
s = []
t = []

d_l = []
score = 0
soft = 0

for i in range(d):
    s.append(0)
    s[i] = list(map(int, input().split()))

for i in range(26):
    d_l.append(0)
    
for i in range(d):
    t = int(input())
    soft = 0
    
    for j in range(26):
        if t-1 == j:
            d_l[j] = 0
            score += s[i][j]
        else:
            d_l[j] += 1
            soft += c[j] * d_l[j]
    
    score -= soft
    print(score)
    
    

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

int g(int a, int b) {
  if (a > b) swap(a, b);
  if (b % a == 0)
    return a;
  else
    return g(b % a, a);
}

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

  vector<int> x(n);
  for (int i = 0; i < n; i++) cin >> x[i];

  int d = abs(x[0] - x0);
  for (int i = 0; i < n; i++) d = g(abs(x[i] - x0), d);

  cout << d << endl;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		String moji = stdIn.next();
		if(moji.length() <= n) {
			System.out.println(moji);
		}else {
			System.out.println(moji.substring(0,n) + "...");
		}
	}

}


Measured memory_bytes: 27028
# Problem C - Colon

import math

# input
A, B, H, M = map(int, input().split())

# initialization
tmp_1 = H * 30 + 0.5 * M
tmp_2 = 6 * M
tmp_3 = min(abs(tmp_1-tmp_2), 360-abs(tmp_1-tmp_2))
radian = math.radians(tmp_3)
tmp_4 = math.sqrt(A**2 + B**2 - 2*A*B*math.cos(radian))

# output
print(tmp_4)


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

#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<string> vs;

ll assign(auto &coeff, auto &vals) {
    sort(all(coeff));
    ll ans = 0;
    for (int i = 0; i < vals.size(); i++) {
        ans += coeff[i] * vals[i];
    }
    return ans;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    cout << fixed << setprecision(15);

    int N;
    cin >> N;

    vi vals(N);
    for (int i = 0; i < N; i++) {
        cin >> vals[i];
    }
    sort(all(vals));

    vi startHigh(N), startLow(N);
    for (int i = 0; i + 1 < N; i++) {
        if (i & 1) {
            startHigh[i]--;
            startHigh[i+1]++;
        } else {
            startHigh[i]++;
            startHigh[i+1]--;
        }
    }
    for (int i = 0; i < N; i++) {
        startLow[i] = -startHigh[i];
    }

    cout << max(assign(startHigh, vals), assign(startLow, vals)) << endl;
    return 0;
}



Measured memory_bytes: 1408
n, m = gets.split.map(&:to_i)
problems = m.times.map{ gets.split.map(&:to_i) }.sort_by{|(a, b)| b}

bridges = [Float::INFINITY]
problems.each do |(a, b)|
  bridge = bridges.last
  bridges << b - 1 unless a <= bridge && bridge <= b
end

puts bridges.size - 1

Measured memory_bytes: 12664
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
#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 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;


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




int main() {
    int n, m;
    cin >> n >> m;
    bool unbroken[n];
    REP(i, n + 1) {
        unbroken[i] = true;
    }
    REP(i, m) {
        int x;
        cin >> x;
        unbroken[x] = false;
    }
    
    vector<ll> dp(n+1);
    dp[0] = 1;
    REP(now, n) {
        FOR(nex, now+1, min(n, now+2)+1){
            if(unbroken[nex]) {
                dp[nex]+=dp[now];
                dp[nex]%=MOD;
            }
        }
    }
   cout << dp[n] << endl;
}


Measured memory_bytes: 1152