akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
// template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }


ll solve(ll h, ll w) {
    ll ans = 1e18;
    rep3(i, 1, h) {
        // cout << i << endl;
        ll A[3];
        A[0] = i * w;
        A[1] = (h - i) / 2 * w;
        A[2] = ((h - i) / 2 + ((h - i) % 2 ? 1 : 0)) * w;
        // rep(i, 3) cout << A[i] << " "; cout << endl;
        chmin(ans, max({A[0], A[1], A[2]}) - min({A[0], A[1], A[2]}));
        
        A[1] = (h - i) * (w / 2);
        A[2] = (h - i) * (w / 2 + (w % 2 ? 1 : 0));
        // rep(i, 3) cout << A[i] << " "; cout << endl;
        chmin(ans, max({A[0], A[1], A[2]}) - min({A[0], A[1], A[2]}));
        
        
    }
    return ans;
}
int main() {
    ll h, w;
    cin >> h >> w;
    
    cout << min(solve(h, w), solve(w, h)) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define fr first
#define sc second
#define Rep(i,n) for(int i=0;i<(n);i++)
#define All(v) v.begin(),v.end()
#define Uniq(v) v.erase(unique(All(v)),v.end())
typedef pair<int, int> Pii;
typedef pair<int, Pii> Pip;
typedef pair<string, int> Psi;
const int INF = (1<<30);
const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};

int main()
{
  int n, m;

  while( cin >> n >> m, n+m ) {
    int place[101] = {0};

    for(int i=0; i<n; i++) {
      for(int j=0; j<m; j++) {
	int a; cin >> a;
	place[j] += a;
      }
    }

    vector<Pii> v;
    for(int i=0; i<m; i++) {
      v.pb( Pii( place[i], -i ) );
    }

    sort( All(v), greater<Pii>() );

    for(int i=0; i<m-1; i++) {
      cout << -v[i].sc + 1 << " ";
    }

    cout << -v[m-1].sc + 1 << endl;
  }

}    

Measured memory_bytes: 3012
#include<stdio.h>
int main()
{
    int d,r,a,b;
    double f;
    scanf("%d %d",&a,&b);
    d=a/b;
    r=a%b;
    f=(double)a/b;
    printf("%d %d %lf\n",d,r,f);
    return 0;
}


Measured memory_bytes: 2108
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define per(i, a, b) for(int i = (b) - 1; i >= (a); --i)
#define sz(x) (int)x.size()
#define de(a) cout << #a << " = " << a << endl
#define dd(a) cout << #a << " = " << a << " "
#define all(a) a.begin(), a.end()
#define pw(a) (1ll<<(a))
#define endl "\n"
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef vector<int> vi;
/*并查集
 * int f[];
 * int Find(int x){x==f[x]?return f[x]:f[x]=Find(f[x]);}
 * int join(int x,int y){if(Find(x)!=Find(y))f[Find(x)]=Find(y);}
 * 快速幂*/
int qpow(ll a,ll b,ll m){ll c=1;while(b){if(b&1)c=c*a%m;b>>=1;a=a*a%m;}return c;}
int n,m,h[100005];
vi v[100005];
void add(int f,int t){
	v[f].pb(t);
}
int main(){
	ios::sync_with_stdio(false);
	cin>>n>>m;
	rep(i,1,n+1)cin>>h[i];
	rep(i,0,m){
		int t1,t2;
		cin>>t1>>t2;
		add(t1,t2);
		add(t2,t1);
	}
	int sum=0;
	rep(i,1,n+1){
		int l=v[i].size();
		int b=1;
		rep(j,0,l){
			if(h[i]<=h[ v[i][j] ]){
				b=0;
				break;
			}
		}
		if(b)sum++;
	}
	cout<<sum;
	return 0;
}


Measured memory_bytes: 9132
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long ret = 1;
		for (int i = 1; i < n + 1; i++) {
			ret *= i;
			ret %= 1000000007;
		}
		System.out.println(ret);
	}

}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
//#pragma GCC optimize ("O3")
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx,avx2,tune=native")
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef long double ld;

#define rc(s) return cout << s, 0
#define fi first
#define se second
#define L (nod << 1)
#define R (L | 1)
#define smax(X, Y) ((X) > (Y) ? (X) : (Y))
#define smin(X, Y) ((X) < (Y) ? (X) : (Y))

const ll inf = (1LL<<62);
const int iinf = (1<<30);
//CLOCKS_PER_SEC



int main(){
    //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    //ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //ifstream cin ("test.in");
    //ofstream cout ("test.out");
    int n;
    cin >> n;
    if (n % 10 == 3)
        rc("bon");
    else if (n % 10 == 0 || n % 10 == 1 || n % 10 == 6 || n % 10 == 8)
        rc("pon");
    else
        rc("hon");
    return 0;
}


Measured memory_bytes: 3620
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;


public class Main {
	private	static	BufferedReader		br      = null;
	private	static	ArrayList<Integer>	list    = null;
	private	static	int[]				borders = null;

	static {
		br   = new BufferedReader(new InputStreamReader(System.in));
		list = new ArrayList<Integer>();
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		parseBorder();
		createPrimeList();

		for (int nLoop = 0; nLoop < borders.length; nLoop++) {
			getPrimeCnt(borders[nLoop]);
		}
	}

	private static String parseNum() {
		String	strNum = null;

		try {
			String line = br.readLine();
			if (line != null) {
				if (!line.isEmpty()) {
					strNum = line;
				}
			}
		}
		catch (IOException e) {}

		return strNum;
	}

	private static void parseBorder() {
		int[]	aWork   = new int[30];
		int		nCnt    = 0;
		String	line    = null;

		while((line = parseNum()) != null) {
			aWork[nCnt] = Integer.parseInt(line);
			nCnt++;
		}

		if (nCnt > 0) {
			borders = new int[nCnt];
			for (int nLoop = 0; nLoop < nCnt; nLoop++) {
				borders[nLoop] = aWork[nLoop];
			}
		}
	}

	private static void createPrimeList() {
		boolean	bLoop  = true;
		boolean	bPrime = true;
		int		nPrime = 0;
		int[]	aWork  = borders.clone();

		Arrays.sort(aWork);
		list.add(2);
		for(int nNum = 3; bLoop; nNum += 2) {
			bPrime = true;

			for (int nLoop = 0; nLoop < list.size(); nLoop++) {
				nPrime = list.get(nLoop);
				if (nPrime <= (int)Math.sqrt((double)nNum)) {
					if (nNum % nPrime == 0) {
						bPrime = false;
						break;
					}
				}
				else {
					break;
				}
			}

			if (bPrime) {
				list.add(nNum);
				bLoop = nNum <= aWork[aWork.length - 1];
			}
		}
	}

	private static void getPrimeCnt(int nBorder) {
		int nCnt1 = 0;
		int nCnt2 = 0;

		if (list.get(0) < nBorder) {
			// 二分法＋逐次法でnBorder以下の素数の数を探す
			int nMin = 0;
			int nMax = list.size() - 1;
			int nCur = 0;

			while (nMax - nMin > 10) {
				nCur = (nMin + nMax) / 2;

				if (nBorder == list.get(nCur)) {
					break;
				}
				else if (nBorder > list.get(nCur)) {
					nMin = nCur + 1;
				}
				else if (nBorder < list.get(nCur)) {
					nMax = nCur - 1;
				}
			}

			nMin = Math.max(nMin - 1, 0);
			nMax = Math.min(nMax + 1, list.size() - 1);
			for (nCur = nMin; nCur <= nMax; nCur++) {
				if (nBorder == list.get(nCur)) {
					nCnt1 = nCur - 1;
					nCnt2 = nCur + 1;
					break;
				}
				else if (nBorder < list.get(nCur)) {
					nCnt1 = nCur - 1;
					nCnt2 = nCur;
					break;
				}
			}

			System.out.printf("%d %d\n", list.get(nCnt1), list.get(nCnt2));
		}
	}
}

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


int n, r;

int main(){
  cin >> n >> r;
  if(n >= 10){
    cout << r << endl;
  }else{
    cout << r + (10 - n) * 100 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<map>
#include<stack>
#include<set>
#include<queue>
#include<vector>
#include<stdlib.h>
 
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cstdlib>
 
#define inf 0x3f3f3f3f
using namespace std;
typedef long long ll;
const int maxn=2500010;//maxn*maxs
const int maxs=1e8+10;
const int mod=998244353;
int l[maxn],r[maxn];
ll f[maxn],sum[maxn];
int main()
{
	int n,k;
	cin>>n>>k;
	for(int i=0;i<k;i++)
		cin>>l[i]>>r[i];
	f[1]=1;
	sum[1]=1;
	for(int i=2;i<=n;i++){
		for(int j=0;j<k;j++){
			int left=max(1,i-r[j]);
			int right=i-l[j];
			if(right<1) continue;
			f[i]+=((sum[right]-sum[left-1])%mod+mod)%mod;
		}
		sum[i]=(sum[i-1]+f[i])%mod;
	}
	cout<<f[n]%mod<<endl;
    system("pause");
    return 0;
}
	



Measured memory_bytes: 6272
#include<bits/stdc++.h>
using namespace std;
const int N=105;
int a[N],n,ans=0;
int main(){
  scanf("%d",&n);
  for(int i=1;i<=n;i++)scanf("%d",&a[i]);
  sort(a+1,a+n+1);
  for(int i=1;i<=n;i++){
    for(int j=i+1;j<=n;j++){
      for(int k=j+1;k<=n;k++){
        if(a[i]!=a[j]&&a[j]!=a[k]&&a[i]+a[j]>a[k])ans++;
      }
    }
  }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 3836
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;

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

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD=1e9+7;

int main() {
    long long sums[500000];//0+1+,,,+i
    sums[0]=0;
    rep(i,3e5) sums[i+1]=(i+1+sums[i])%MOD;
    //rep(i,100) cout<<sums[i]<<endl;
    int n,k;
    cin>>n>>k;
    long long ans=0;
    for(int i=k;i<=n+1;++i){
        long long l=sums[i-1];//l=0+1+,,,+(i-1)
        long long r=sums[n]-sums[max(n-i,0)];//r=n-i+1+,,,+n
        //cout<<i<<" "<<r<<":"<<l<<endl;
        ans+=r-l+1;
        ans%=MOD;
    }
    if(ans<0) ans+=MOD;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 5988
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


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

    ll d,n;
    cin >> n >> d;
    cout << (n+2*d) / (2*d+1) << endl;


    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define REP(i, n) for ( int i = 0; i < (n); i++ )
 
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);

  int N, Y;
  cin >> N >> Y;

  bool flag = false;
  for ( int i = 0; i <= N; i++ ) {
    for ( int j = 0; j <= N-i; j++ ) {
      if ( i*10000 + j*5000 > Y ) continue;
      int amari = N - i - j;
      if ( amari*1000 + i*10000 + j*5000 == Y ) {
	cout << i << " " << j << " " << amari << endl;
	return 0;
      }
    }
  }

  cout << -1 << " " << -1 << " " << -1 << endl;

  return 0;
}


Measured memory_bytes: 3652
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));

            return;
        }

        public void Solve(ConsoleInput cin)
        {

            var N = cin.ReadInt;
            var A = cin.ReadIntArray(N);

            int ans = Gcd(A[0], A[1]);
            if (N == 2) {
                Console.WriteLine(ans);
                return;
            }
            for (int i = 2; i < N; i++)
            {
                ans = Gcd(ans, A[i]);
            }

            Console.WriteLine(ans);
            return;
        }
        public int Gcd(int a, int b)
        {
            if(a == 0) return b;
            if(b == 0) return a;
            if (a < b) {
                return Gcd(b, a);
            }
            while (b != 0) {
                int remainder = a % b;
                a = b;
                b = remainder;
            }
            return a;
        }
    }

    public static class Extensions
    {
        public static string Reverse(this string sourse)
        {
            char[] chrAry = sourse.ToCharArray();
            Array.Reverse(chrAry);
            return new string(chrAry);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}


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

int main() {
  string s;
  cin>>s;

  int sum; 
  int ans=0;
  for (int i=0; i<s.size(); i++) {
    ans+=s.at(i)-'0';
  }
  for (int i=0; i<s.size()-1; i++) {
    sum=0;
    for (int j=0; j<i; j++) {
      sum+=s.at(j)-'0';
    }
    sum+=(s.at(i)-'0')-1;
    for (int j=i+1; j<s.size(); j++) {
      sum+=9;
    }
    ans=max(sum,ans);
  }

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

Measured memory_bytes: 256
//

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

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

	int ans;

	if (X <= 599) ans = 8;
	else if (X <= 799) ans = 7;
	else if (X <= 999) ans = 6;
	else if (X <= 1199) ans = 5;
	else if (X <= 1399) ans = 4;
	else if (X <= 1599) ans = 3;
	else if (X <= 1799) ans = 2;
	else  ans = 1;

	cout << ans << endl;

	return 0;
}

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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX / 10;
//const ll INF = (1ll << 31) - 1;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;

bool contain(set<P> &s, P a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);


void print_line(vector<ll> &line) {
    if (line.size() == 0ll) {
        cout << endl;
        return;
    }
    for (ll i = 0; i < line.size(); i++) {
        cout << line[i];
        if (i == line.size() - 1) cout << endl;
        else cout << ' ';
    }
}


typedef priority_queue<long long, vector<long long>, greater<long long>> PQ_ASK;
const int mod = 1000000007;

struct Item {
    int value;
    ll weight;
    ll count;
};

// https://hfuji.hatenablog.jp/entry/2015/11/25/172524
const ll VMAX = 50;
const ll NMAX = 50;
const ll S = VMAX * NMAX * VMAX;

int main() {

    int n;
    ll w;
    cin >> n >> w;

    vector<Item> items(n);
    rep(i, n)cin >> items[i].value >> items[i].weight >> items[i].count;

    // 各商品、最大VMAX個で価値ベースの個数制限ナップザック
    std::vector<ll> dp(S + 1, INF);
    dp[0] = 0;
    for (auto &g : items) {
        int k = std::min(g.count, VMAX);
        g.count -= k;
        // 高々50回なのでループで済ませる
        for (int i = 0; i < k; ++i) {
            for (int j = S; j - g.value >= 0; --j) {
                dp[j] = std::min(dp[j], dp[j - g.value] + g.weight);
            }
        }
    }

    // 価値の密度が高い順にソート
    std::sort(items.begin(), items.end(),
              [](const Item &a, const Item &b) {
                  return a.value * b.weight > b.value * a.weight;
              });

    // 後は貪欲に選んでいくDFS
    ll ans = 0;
    for (ll v = 0; v <= S; ++v) {
        if (dp[v] > w) continue;

        ll cap = w - dp[v];
        ll vsum = v;

        for (const auto &g : items) {
            // 貪欲に選べるだけ選ぶ
            ll num = std::min(g.count, cap / g.weight);
            vsum += num * g.value;
            cap -= num * g.weight;
        }
        ans = std::max(ans, vsum);
    }

    std::cout << ans << std::endl;
}





Measured memory_bytes: 3900
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cassert>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repd(i, n) for (int i = n; i >= 1; i--)
#define mod 1000000007
#define MOD 998244353
#define inf 1e20
typedef long long int ll;
typedef pair<ll, ll> p;


int main() {
	int a, b, c,d;
	cin >> a >> b >> c>>d;
	int maxx = max(a, max(b, c));
	cout << pow(2, d)*maxx + a + b + c - maxx << endl;
	return 0;
}

//Ctrl+Aを使わない

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,b,e) for (common_type_t<decltype(b),decltype(e)> i = (b), i ## __end = (e); i < i ## __end; ++ i)
#define rep(i,n)   FOR (i, size_t{}, n)
#define ALL(x)     begin (x), end (x)
using namespace std;
using ll = int64_t;
constexpr ll inf = 2e18;

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

  size_t n;
  cin >> n;

  vector <ll> h (n);
  rep (i, n) cin >> h [i];

  ll now_section = 0, max_section = 0;
  rep (i, n - 1)
  {
    if (h [i + 1] <= h [i])
    {
      ++ now_section;
      max_section = max (max_section, now_section);
    }
    else
    {
      max_section = max (max_section, exchange (now_section, 0));
      now_section = 0;
    }
  }
  cout << max_section << endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	int n,m;
	cin>>n>>m;
	pair<ll,ll> p[n];
	for(int i=0;i<n;i++){
		cin>>p[i].first>>p[i].second;
	}
	sort(p,p+n);
	ll ans=0;
	int j=0;
	multiset<ll> m1;
	for(int i=m;i>=1;i--){
		int lim=m-i+1;
		for(;j<n;j++){
			if(p[j].first > lim) break;
			m1.insert(p[j].second);
		}
		if(m1.size()!=0){
			auto it=m1.end();
			it--;
			ans+=*it;
			m1.erase(it);
		}
	}
	cout<<ans;
}

Measured memory_bytes: 6528
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define rep(i, s, n) for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t) for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(type, ...) \
    type __VA_ARGS__;  \
    read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U>
inline bool chmax(T &a, const U &b) {
    return b > a && (a = b, true);
}
template <class T, class U>
inline bool chmin(T &a, const U &b) {
    return b < a && (a = b, true);
}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(
        sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream &operator>>(istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail &... tail) {
    cin >> head;
    read(tail...);
}

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream &operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x) : x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

constexpr double PI = acos(-1);

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

    var(double, r);
    cout << fixed << setprecision(12);
    print(2 * r * PI);

    return 0;
}


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

inline long long read(){   
    long long s = 0, w = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9'){
        if (ch == '-') w = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9'){
        s = s * 10 + ch - '0';
        ch = getchar();
    }
    return s * w;
}

bool cmp(int x, int y){
    return x > y;
}

long long n, m, a[111], sum; 
int main(){
    n = read(), m = read();
    for (int i = 1; i <= n; i++){
        a[i] = read();
        sum += a[i];   
    }
    sort (a+1, a+n+1, cmp); 
    double k = sum / 4.0 / m; 
    for (int i = 1; i <= m; i++){
        if (a[i] < k){  
            cout << "No" << endl;
            return 0;   
        }
    }
    cout << "Yes" << endl; 
    return 0;
}

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

#define REP(i,n) for (int i = 0; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end()
typedef long long ll;

using namespace std;

int n;
string s;
int ans=0;

int main(){
    cin>>n>>s;
    for(int i=0;i<s.length();i++){
        if(s[i]=='R'){
            ans++;
        }else{
            ans=ans-1;
        }
    }
    if(ans>0){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
}


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;
using P = pair<int,int>;
 
 
int main() {
    int n;
    cin >> n;
    vector<ll> h(n);
    rep(i,n) cin >> h.at(i);
    int count=0;
    int ans=0;
    rep(i,n-1){
        if(h.at(i)>=h.at(i+1))count++;
        else count=0;        
        ans=max(ans,count);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
#define int long long
#define endl '\n'
using namespace std;
 
typedef long long ll;
#define db(x) cerr << #x << ": " << x << '\n';
#define read(a) int a; cin >> a;
#define readb(a, b) int a, b; cin >> a >> b;
#define readc(a, b, c) int a, b, c; cin >> a >> b >> c;
#define readarr(a, n) int a[(n) + 1] = {}; FOR(i, 1, (n)) {cin >> a[i];}
#define readmat(a, n, m) int a[n + 1][m + 1] = {}; FOR(i, 1, n) {FOR(j, 1, m) cin >> a[i][j];}

#define print(a) cout << a << endl;
#define printarr(a, n) FOR (i, 1, n) cout << a[i] << " "; cout << endl;
#define printv(v) for (int i: v) cout << i << " "; cout << endl;
#define printmat(a, n, m) FOR (i, 1, n) {FOR (j, 1, m) cout << a[i][j] << " "; cout << endl;} cout << endl;
#define all(v) v.begin(), v.end()
#define sz(v) (int)(v.size())
#define rz(v, n) v.resize((n) + 1);
#define pb push_back
#define fi first
#define se second
#define vi vector <int>
#define pi pair <int, int>
#define vpi vector <pi>
#define vvi vector <vi>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll N = 2e5 + 1;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	read(n);
	int adj[n + 1] = {};
	FOR (i, 2, n)
	{
	    read(x);
	    adj[x]++;
	}
	
	FOR (i, 1, n) cout << adj[i] << endl;
}














Measured memory_bytes: 5212
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<cmath>

#define REP(i,n) for(int (i) = 0;(i) < (n);(i)++)
using namespace std;

long long int Pow(long long int n,long long int  m){
	if(m==0)return 1;
	if(m==1)return n;
	if(m%2) return (n*Pow((n*n)%1000000007,m/2))%1000000007;
	return Pow((n*n)%1000000007,m/2)%1000000007;
}

int main(){
	int n,m;
	cin >> n >> m;
	cout << Pow(n,m) << endl;
}

Measured memory_bytes: 3048
#include <iostream>
#include <float.h>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <fstream>
#include <queue>
#include <math.h>
#include <set>
#include <stdlib.h>
#include <time.h>
#include <list>
#include <stack>
#include <queue>

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

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
#define SORT(c) sort((c).begin(),(c).end())
#define vi(m,a) vector<int> m(a)
#define vti(m,a,i) vector<vector<int>> m(a,vector<int>(i))
#define ALL(it,a) for(auto it = a.begin(); it!=a.end(); it++)
#define Fe(it,a) for(auto &it : a)
#define all(a) begin(a),end(a)

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
#define WARU 1000000007;

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

bool solve(string s, string t) {
	//cout << s << endl;
	//cout << t << endl;
	if (abs((int)(s.length() - t.length())) % 3 == 0)
		return true;
	return false;
}

int main() {
	string s;
	string t;
	cin >> s;
	cin >> t;
	int n;
	cin >> n;
	map<int, int> smp;
	map<int, int> tmp;
	vector<char> stmp;
	vector<char> ttmp;
	int index = 1;
	rep(i, s.length()) {
		smp[i] = index;
		if (s[i] == 'B') {
			stmp.push_back('A');
			stmp.push_back('A');
			index += 2;
		}
		else {
			stmp.push_back('A');
			index++;
		}
	}
	index = 1;
	rep(i, t.length()) {
		tmp[i] = index;
		if (t[i] == 'B') {
			ttmp.push_back('A');
			ttmp.push_back('A');
			index += 2;
		}
		else {
			ttmp.push_back('A');
			index++;
		}
	}
	string ns(stmp.begin(), stmp.end());
	string nt(ttmp.begin(), ttmp.end());

	rep(i, n) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		a--; b--; c--; d--;
		int nb = smp[b], nd = tmp[d];
		int na = smp[a], nc = tmp[c];
		if (s[b] == 'B') {
			nb++;
		}
		if (t[d] == 'B') {
			nd++;
		}
		if (solve(ns.substr(smp[a], nb - smp[a]), nt.substr(tmp[c], nd - tmp[c]))) {
			cout << "YES" << endl;
		}
		else
			cout << "NO" << endl;
	}



}

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

int main(){
  int d;
  cin >> d;
  if(d==22){
    cout << "Christmas Eve Eve Eve";
    return 0;
  }else if(d==23){
    cout << "Christmas Eve Eve";
    return 0;
  }else if(d==24){
    cout << "Christmas Eve";
    return 0;
    }
  else if(d==25){
    cout << "Christmas";
    return 0;
   }
}

Measured memory_bytes: 256
n = gets.to_i

max_loop_cnt = (n + 4 - 1) / 4
res = 'No'

0.upto(max_loop_cnt) do |i|
  0.upto(max_loop_cnt) do |j|
    sum = i * 4 + j * 7
    break if sum > 100
    break res = 'Yes' if n == sum
  end
end

puts res

Measured memory_bytes: 3836
// ░█████╗░░░░░░░░░░░░░░░
// ██╔══██╗░░██╗░░░░██╗░░
// ██║░░╚═╝██████╗██████╗
// ██║░░██╗╚═██╔═╝╚═██╔═╝
// ╚█████╔╝░░╚═╝░░░░╚═╝░░
// ░╚════╝░░░░░░░░░░░░░░░
#include <bits/stdc++.h>
#include <iostream>
#include <string.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define f(ii,n) for(ii=0;ii<n;ii++)
#define F(ii,a,n) for(ii=a;ii<n;ii++)
#define read0(array,n) for(ll i=0;i<n;i++) cin>>array[i];
#define read1(array,n) for(ll i=1;i<=n;i++) cin>>array[i];
#define inf 1000000007;
// function to transform string to lowercase --> transform(s.begin(),s.end(),s.begin(),::tolower)
//(a + b ) % m = (a % m + b % m ) %m
//(a - b ) % m = ( (a % m - b % m ) + m ) %m
//(a * b ) % m = (a % m * b % m ) %m
//(a / b ) % m = (a % m * inv(b) ) %m where inv(b) = pow(b,m,m-2)



ll power(ll i,ll j){
	ll prod=1;
	while(j>0){
		if(j&1){
			prod=prod*i;
		}
		j=j>>1;
		i=i*i;
	}
	return prod;
}

void solve(){
	ll i,j,n,m,k;
	ll a,b,h;
	ld pi=3.14159265358979323846;
	cin>>a>>b>>h>>m;
	if(h==12) h=0;
	if(m==60) m=0;
	ld ha=(0.5)*(h*60+m);
	ld ma=6*m;
	ld ang=abs(ha-ma);
	ang=(ld)min(360-ang,ang);
	ang=(ang*pi)/180.00;

	ld cc=((ld)(a*a)+(ld)(b*b)-ld((2*a*b)*(ld)(cos(ang))));
	ld ans=sqrt(cc);
	cout<<fixed<<setprecision(14)<<ans<<endl;


}
int main(){
	// freopen("filename.txt","r",stdin);
	solve();
	// ll t;
	// cin>>t;
	// while(t--){
	// 	solve();
	// }
}

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

namespace AtCoder.Abc
{
    class A_Multiplication_169
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数配列の入力
            var inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

            Console.WriteLine(inputLongArray[0] * inputLongArray[1]);

            Console.Out.Flush();
        }
    }
}


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

bool isSosuu(int num) {
  bool isSosuu = true;
  for(int i=2; i<num; i++) {
    if(num%i == 0){
      isSosuu = false;
      break;
    }
  }
  return isSosuu;
}

int main() {
  int X;
  int answer;
  cin >> X;
  
  int i=X;
  while(true) {
  	if(isSosuu(i)){
      answer = i;
      break;
    }
    i++;
  }
  cout << answer;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
using namespace std;
int main(void){
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a.begin(),a.end());
    reverse(a.begin(),a.end());
    long long x=0,y=0,c=0;
    for(int i=0;i<n;i++){
        if(a[i]==a[i+1]&&c==0){
            x=a[i];
            i++;
            c++;
        }
        else if(a[i]==a[i+1]&&c==1){
            y=a[i];
            break;
        }
    }
    cout<<x*y<<endl;
    return 0;
}


Measured memory_bytes: 640
from collections import Counter

N = int(input())
S = []
for _ in range(N):
    S.append(input())

c = Counter(S)
P = c.most_common()[0][1]

o = []
for k,v in c.most_common():
    if v != P:
        break
    o.append(k)

print(*sorted(o),sep="\n")

Measured memory_bytes: 122064
#include <bits/stdc++.h>
using namespace std;
int n,a[123456],c=1;
int main(){
    cin>>n;
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    for(int i=1;i<n;i++){
        if(a[i]!=a[(i-1)])c++;
    }
    cout<<c<<endl;
}



Measured memory_bytes: 3560
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
typedef long long LL;
typedef long double LD;
typedef pair<LL, LL> PLL;
typedef pair<LD, LL> pdl;
typedef pair<LD, LD> pdd;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned long long ULL;
//typedef boost::multiprecision::cpp_int bigint;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	LL K;
	cin >> K;
	VVLL DP;
	DP.resize(10, VLL(12, 0));
	DP[0][1] = 1;
	for (LL a = 1; a <= 9; a++) {
		DP[a][1] = 1;
	}
	for (LL n = 2; n <= 11; n++) {
		for (LL a = 0; a <= 9; a++) {
			if (a > 0)DP[a][n] += DP[a - 1][n - 1];
			DP[a][n] += DP[a][n - 1];
			if (a < 9)DP[a][n] += DP[a + 1][n - 1];
		}
	}
	VVLL X;
	X.resize(10, VLL(12, 0));
	for (LL n = 1; n <= 11; n++) {
		X[0][n] = X[9][n-1];
		X[1][n] = X[9][n - 1] + DP[1][n];
		for (LL a = 2; a <= 9; a++) {
			X[a][n] = X[a - 1][n] + DP[a][n];
		}
	}
	LL N = 1, A = 1;
	while (X[A][N] < K) {
		A++;
		if (A == 10) {
			N++;
			A = 1;
		}
	}
	K -= X[A - 1][N];
	cout << A;
	while (N > 1) {
		LL temp = 0;
		if (A > 0) {
			if (0 < K && K <= DP[A - 1][N - 1]) {
				cout << A - 1;
				A = A - 1;
				K -= temp;
				N--;
				continue;
			}
			temp += DP[A - 1][N - 1];
		}
		if (temp < K && K <= temp + DP[A][N - 1]) {
			cout << A;
			K -= temp;
			N--;
			continue;
		}
		temp += DP[A][N-1];
		if (A < 9) {
			if (temp < K && K <= temp + DP[A+1][N - 1]) {
				cout << A+1;
				A = A + 1;
				K -= temp;
				N--;
				continue;
			}
		}
	}
	cout << "\n";
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ull unsigned long long
#define pb push_back
#define pp pop_back
#define pi pair<ll,ll>
#define pii pair<int,int>
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ll n,i,j,k,l,m,b,t,sum,sum1,flag,max1,min1,tmp;
    string s;
    cin>>s;
    k=s.size()-1;
    if(s[k]=='s'){
        cout<<s<<"es"<<endl;
    }else{
        cout<<s<<"s"<<endl;
    }

}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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 int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

bool is_prime(ll n) {
    if (n < 2) {
        return false;
    } else if (n == 2) {
        return true;
    } else if (n % 2 == 0) {
        return false;
    }
 
    for (ll i = 3; i <= sqrt(n); i += 2) {
        if (n % i == 0) {
            return false;
        }
    }
    return true;
}

class UnionFind {
    vector<int> parent;

    public:
        UnionFind(int size) {
            parent = vector<int>(size, -1);
        }

        int find(int x) {
            if (parent[x] < 0) {
                // parent itself
                return x;
            } else {
                return parent[x] = find(parent[x]);
            }
        }

        bool unite(int x, int y) {
            int rX, rY;
            if ((rX = find(x)) == (rY = find(y))) {
                // already united
                return false;
            }
            if (size(rX) < size(rY)) {
                int tmp = rX;
                rX = rY;
                rY = tmp;
            }
            parent[rX] += parent[rY];
            parent[rY] = rX;
            return true;
        }

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

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

        // CAUTION!! : This method is heavy due to scanning linearly.
        int component_count() {
            int c = 0;
            for (const int x : parent) {
                if (x < 0) {
                    c++;
                }
            }
            return c;
        }
};

void solve() {
    int n, q;
    cin >> n >> q;
    UnionFind uf(n);
    int c, x, y;
    while (q--) {
        cin >> c >> x >> y;
        if (c == 0) {
            uf.unite(x, y);
        } else {
            cout << (uf.is_same(x, y) ? 1 : 0) << endl;
        }
    }
}




Measured memory_bytes: 3264
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <queue>
#include <bitset>
#include <cmath>
#include <set>
#include <map>
#include <iostream>

using namespace std;
 
#define rep(i, l, r) for(int i=l; i<=r; i++)
#define dow(i, l, r) for(int i=l; i>=r; i--)
#define clr(x, c) memset(x, c, sizeof(x))
#define travel(x) for(edge *p=fir[x]; p; p=p->n)
#define travel0(x) for(edge *p=fir0[x]; p; p=p->n)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define l(x) Left[x]
#define r(x) Right[x]
#define lowbit(x) (x&-x)
 
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,int> Pli;
typedef long double ld;
typedef unsigned long long ull;
 
inline int read()
{
	int x=0, f=0; char ch=getchar();
	while (ch<'0' || '9'<ch) f|=ch=='-', ch=getchar();
	while ('0'<=ch && ch<='9') x=x*10+ch-'0', ch=getchar();
	return f?-x:x;
}

#define maxn 100009
#define maxm 3500009

bool f[maxn];
int n, K, a[maxn], b[maxn]; ll g[maxn];
ll Ans0, Ans, now;

struct edge{int x; edge *n;} e[maxm], *fir[39], *fir0[39], *pt=e;
inline void Add(int o, int x){pt->x=x, pt->n=fir[o], fir[o]=pt++;}
inline void Add0(int o, int x){pt->x=x, pt->n=fir0[o], fir0[o]=pt++;}

int main()
{
	n=read(); K=read();
	rep(i, 1, n) a[i]=read(), b[i]=read();
	rep(i, 1, n) if (a[i]==0) Ans0+=b[i], a[i]=a[n], b[i]=b[n], n--, i--;
	rep(i, 1, n)
	{
		int o=29; while ((a[i]&(1<<o))==0) o--;
		g[o]+=b[i]; Add0(o,i);
		for(;o>=0;o--) if (a[i]&(1<<o)) Add(o,i);
	}
	rep(i, 1, 29) g[i]+=g[i-1];
	if (!K) {printf("%lld\n", Ans0); return 0;}
	int o=29; while ((K&(1<<o))==0) o--;
	for(;o>=0;o--)
	{
		if (K&(1<<o))
		{
			ll tmp=now;
			travel(o) if (f[p->x]) tmp-=b[p->x];
			Ans=max(Ans, Ans0+tmp+(o-1>=0?g[o-1]:0)); //o>0
			travel0(o) f[p->x]=1, now+=b[p->x];
		}
		else
		{
			travel(o) if (f[p->x]) f[p->x]=0, now-=b[p->x];
		}
	}
	Ans=max(Ans, Ans0+now);
	printf("%lld\n", Ans);
	return 0;
}

Measured memory_bytes: 29824
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int a,b;
  cin>>a>>b;
  int n;
  cin>>n;
  int imos[2000];
  memset(imos,0,sizeof(imos));
  for(int i=0;i<n;i++){
    int s,f;
    cin>>s>>f;
    imos[s]++;
    imos[f]--;
  }
  for(int i=1;i<2000;i++) imos[i]+=imos[i-1];
  cout<<(*max_element(imos+a,imos+b)>0)<<endl;
  return 0;
}

Measured memory_bytes: 3096
#include <iostream>
using namespace std;
int main(){
    int a,b,c,x; cin >> a >> b >> c >> x;
    int coins[3] = {500, 100, 50};
    int ans = 0;
    
    for (int i=0; i<=a; i++){
        for (int j=0; j<=b; j++){
            for (int k=0; k<=c; k++){
                if (500*i + 100*j + 50*k == x) ans++;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char s[100000];
int main()
{
    cin>>s;
    for (int i=0; i<strlen(s); ++i)
    if (s[i]=='C') for (int j=i+1; j<=strlen(s); ++j)
    if (s[j]=='F') {cout<<"Yes"<<endl; return 0;}
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
import * as fs from 'fs';

//in
//
//out
//
const main = (inp: string) => {

    const [a, b]: number[] = inp.split(' ').map(Number);
    if (a < b * 2) {
        console.log(0);
    } else {
        console.log(a - b * 2);
    }
};

main(fs.readFileSync('/dev/stdin', 'utf8').trim());

Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
using LL  = long long;
using VI  = vector<LL>;
using VVI = vector<VI>;
using VB  = vector<bool>;
using VS  = vector<string>;
using PII = pair<LL, LL>;
using VP  = vector<PII>;
#define PB           push_back
#define MP           make_pair
#define SZ(a)        LL((a).size())
#define EACH(x, c)   for (auto x : (c))
#define ALL(c)       (c).begin(), (c).end()
#define REVERSE(c)   reverse(ALL(c))
#define SORT(c)      stable_sort(ALL(c))
#define RSORT(c)     stable_sort((c).rbegin(), (c).rend())
#define FOR(i, a, b) for (LL i = (a); i < (b); ++i)
#define REP(i, n)    FOR(i, 0, n)
#define dump(x)      cerr << #x << " = " << (x) << endl;


int main() {
    LL r, D, x;
    cin >> r >> D >> x;
    FOR(i, 1, 11) {
        x = r * x - D;
        cout << x << endl;
    }
	
    return 0;
}


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

constexpr auto N = 5;

auto main() -> int {
  int ps[N];
  for (int i = 0; i < N; ++i) {
    std::cin >> ps[i];
  }

  int k;
  std::cin >> k;

  for (auto i = 0; i < N - 1; ++i) {
    for (auto j = i + 1; j < N; ++j) {
      if (ps[j] - ps[i] > k) {
        std::cout << ":(\n";
        return 0;
      }
    }
  }

  std::cout << "Yay!\n";
}


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

struct person
{
	int name;
	int feature;
}a[16][32];
int num[16]={0},judge[16]={0};
int dest,flag=1,max_total=-1;

int main()
{
	int n;
	cin>>n;
	for (int i=1;i<=n;i++)
	{
		cin>>num[i];
		for (int j=1;j<=num[i];j++)  cin>>a[i][j].name>>a[i][j].feature;
	}
	dest=n;
	while (judge[0]!=1)
	{
		int total=0;
		dest=n,flag=1;
		for (int i=1;i<=n;i++)
		{
			if (judge[i]==1)
			{
				for (int j=1;j<=num[i];j++)
				{
					if (a[i][j].feature!=judge[a[i][j].name])
					{
						flag=0;
						break;
					}
				}
				if (flag==0)  break;
			}
		}
		if (flag==1)
		{
			for (int i=1;i<=n;i++)
			{
				if (judge[i]==1)  total++;
			}
		    if (total>max_total)  max_total=total;
		}
		while (judge[dest]==1)
		{
			judge[dest]=0;
			dest--;
		}
		judge[dest]=1;
		if (dest==0)  break;
	}
	cout<<max_total<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <algorithm>

using namespace std;
using ll = long long;
using ld = long double;

int next(int a){
    if(a % 2 == 0){
        return a/2;
    }
    return a*3 + 1;
}

int main() {

    int s;
    cin >> s;

    set<int> a;
    a.insert(s);

    int x = s;
    for(int i=1; i< 10000000; i++){
        int b = next(x);
        if(a.find(b) == a.end()){
            a.insert(b);
            x = b;
        }else{
            cout << i+1 <<endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#define  N  1100
#define  M  2100
using  namespace  std;
struct  node
{
	int  y,next;
}a[M];int  len,last[N];
inline  void  ins(int  x,int  y){a[++len].y=y;a[len].next=last[x];last[x]=len;}
int  dfn[N],low[N],now,sta[N],top,bel[N],cnt[N],blen;
inline  int  mymin(int  x,int  y){return  x<y?x:y;}
void  dfs(int  x)
{
	dfn[x]=low[x]=++now;sta[++top]=x;
	for(int  k=last[x];k;k=a[k].next)
	{
		int  y=a[k].y;
		if(!dfn[y])
		{
			dfs(y);
			low[x]=mymin(low[x],low[y]);
		}
		else  if(!bel[y])low[x]=mymin(low[x],dfn[y]);
	}
	if(low[x]==dfn[x])
	{
		++blen;
		while(sta[top]!=x)
		{
			bel[sta[top]]=blen;
			top--;cnt[blen]++;
		}
		top--;bel[x]=blen;cnt[blen]++;
	}
}
int  list[N],head,st;
bool  v[N]/*±íÊ¾ÕâÐ©µãÊÇ·ñÑ¡ÎªÁË´ð°¸*/;
int  be[N];//±íÊ¾Ä¿Ç°ÎªÕâ¸öÍ¼µÄµÚ¼¸¸ö±»ÕÒµ½µÄ 
void  dfs2(int  x)
{
	if(v[x])
	{
		int  i=head;
		for(;list[i]!=x;i--)be[list[i]]=i;
		be[list[i]]=i;
		return  ;
	}
	v[x]=true;
	list[++head]=x;
	for(int  k=last[x];k;k=a[k].next)
	{
		int  y=a[k].y;
		if(bel[x]==bel[y])
		{
			dfs2(y);break;
		}
	}
	//Ö»ËÑË÷Á¬Í¨¿éµÄ»°±ØÈ»¿ÉÒÔÕÒµ½Ò»ÖÖÁªÍ¨¿éµÄ·½·¨
	if(be[x])
	{
		for(int  k=last[x];k;k=a[k].next)
		{
			int  y=a[k].y;
			if(be[y])
			{
				if(be[y]>be[x]/*ÊÇÔÚºóÃæµÄ»°*/)
				{
					for(int  i=be[x]+1;i<be[y];i++)be[list[i]]=0;
				}
				else//ÔÚÇ°Ãæ 
				{
					for(int  i=1;i<be[y];i++)be[list[i]]=0;
					for(int  i=be[x]+1;i<=head;i++)be[list[i]]=0;
				}
			}
		 }
	}
}
int  n,m;
int  main()
{
	scanf("%d%d",&n,&m);
	for(int  i=1;i<=m;i++)
	{
		int  x,y;scanf("%d%d",&x,&y);
		ins(x,y);
	}
	for(int  i=1;i<=n;i++)
	{
		if(!bel[i])dfs(i);
	}
	for(int  i=1;i<=n;i++)
	{
		if(cnt[bel[i]]>1)
		{
			dfs2(i);
			int  ans=0;
			for(int  j=1;j<=n;j++)if(be[j])ans++;
			printf("%d\n",ans);
			for(int  j=1;j<=n;j++)if(be[j])printf("%d\n",j);
			return  0;
		}
	}
	printf("-1\n");
	return  0;
}

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

#define NDEBUG
#ifdef DEBUG
#include "../cout11.h"
#undef NDEBUG
#endif
#include <cassert>

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))


bool solve(string& s){
    int N = s.size();
    reverse(ALL(s));

    const char *p = s.c_str();

    /*
    dream
    dreamer
    erase
    eraser
    */
    for (int i=0; i<N; ) {
        if (i+5 <= N && strncmp(p+i, "maerd", 5) == 0) {
            i += 5; continue;
        }
        if (i+7 <= N && strncmp(p+i, "remaerd", 7) == 0) {
            i += 7; continue;
        }
        if (i+5 <= N && strncmp(p+i, "esare", 5) == 0) {
            i += 5; continue;
        }
        if (i+6 <= N && strncmp(p+i, "resare", 6) == 0) {
            i += 6; continue;
        }
        return false;
    }
    return true;
}

int main() {
    string s; cin >> s;
    cout << (solve(s) ? "YES":"NO") << endl;
    return 0;
}


Measured memory_bytes: 512
// D - RGB Triplets
#include <bits/stdc++.h>
using namespace std;
long long ng,r,g,b;

int main(){
	int N; string S; cin>>N>>S;
	for(int i=0; i<N; i++){
		S[i]=='R'? r++: S[i]=='G'? g++: b++;
		for(int j=i+1,k=i+2; k<N; k+=2,j++)
			if((S[i]^S[j]^S[k]) == ('R'^'G'^'B')) ng++;
	}
	cout<< r*g*b - ng <<endl;
}

Measured memory_bytes: 3636