akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <climits>
#include <string>
#include <set>
#include <cmath>
#include <map>
#include <unordered_map>
#include <numeric>
#include <random>
#include <memory>
#include <chrono>
#include <iterator>
#include <functional>
#ifdef LOCAL
#include "debug.h"
#else
#define debug(x...)
#endif
//#pragma GCC optimize("Ofast")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
#define mp make_pair
#define pb push_back
#define sz(x) int((x).size())

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 1e5 + 7;
const int inf = INT_MAX / 2;
const ll INF = LLONG_MAX / 3;
const int MOD = 998244353;
const ld eps = 1e-6;
const string cars[] = {"🚗", "🚕", "🚙"};

signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    cout << fixed << setprecision(3);
    cin.tie();
    cout.tie();

    int n;
    cin >> n;

    vector < int > dp(n), a(n);
    for (int& x : a) {
        cin >> x;
    }
    reverse(a.begin(), a.end());
/*
    dp[0] = a[0];
    for (int& x : a) {
        int pos = upper_bound(dp.begin(), dp.end(), x) - dp.begin();
        dp[pos] = x;
    }

    debug(dp);
    for (int i = sz(dp) - 1; i >= 0; i--) {
        if (dp[i] != inf) {
            return cout << i + 1, 0;
        }
    }
*/

    dp[0] = 1;
    for (int i = 1; i < n; i++) {
        if (a[i] >= a[i - 1]) {
            dp[i] = dp[i - 1] + 1;
        }
        else {
            dp[i] = 1;
        }
    }
    debug(dp);

    cout << *max_element(dp.begin(), dp.end()) - 1;

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

using veci = vector<int>;
using pii = pair<int, int>;
using vecii = vector<pii>;
using ll = long long;
using vecl = vector<ll>;
#define fi first
#define se second
#define endl '\n'

int odr = 1;

struct Box {
    int y1;
    int x1;
    int y2;
    int x2;
};

void backtrack(Box const& b, vector<string> const& m, vector<vector<int>>& ans) {
    pii berry = {-1, -1};
    for (int i=b.y1; i<=b.y2; ++i) {
        for (int j=b.x1; j<=b.x2; ++j) {
            if (m[i][j]=='#') {
                if (berry.fi<0) {
                    berry.fi = i;
                    berry.se = j;
                } else {
                    if (berry.fi==i) {
                        backtrack({b.y1, b.x1, b.y2, berry.se}, m, ans);
                        backtrack({b.y1, berry.se+1, b.y2, b.x2}, m, ans);
                    } else {
                        backtrack({b.y1, b.x1, berry.fi, b.x2}, m, ans);
                        backtrack({berry.fi + 1, b.x1, b.y2, b.x2}, m, ans);
                    }
                    return;
                }
            }
        }
    }

    for (int i=b.y1; i<=b.y2; ++i) for (int j=b.x1; j<=b.x2; ++j) ans[i][j] = odr;
    odr += 1;
}

void solve() {
    int H, W, K;
    cin >> H >> W >> K;

    vector<string> vs(H);
    for (int i=0; i<H; ++i) cin >> vs[i];

    vector<vector<int>> ans(H, vector<int>(W,0));
    backtrack({0,0,H-1,W-1}, vs, ans);

    for (int i=0; i<H; ++i) {
        for (int j=0; j<W; ++j) {
            cout << ans[i][j] << " \n"[j==W-1];
        }
    }
}

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#if defined(LOCAL_TEST)
    (void)argc;
    freopen(string(argv[0]).append("-test.in").c_str(), "r", stdin);
    int tcs;
    cin >> tcs;
    while (tcs-- > 0)
#endif
    solve();
}


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

long long int A[100];

int main(){
  long long int n, x;
  scanf("%llu%llu",&n,&x);
  for(int i = 0;i < n;i++){
    scanf("%llu",&A[i]);
  }
  sort(A,A+n);
  int i = 0;
  int ans = 0;
  while(A[i] <= x && i < n){
    x -= A[i];
    ans++;
    i++;
  }
  if(i == n && x > 0) ans--;
  printf("%llu\n",ans);
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {
    	Scanner sc=new Scanner(System.in);
    	int N=sc.nextInt();

    	int A=sc.nextInt();
    	int B=sc.nextInt();

    	String[] s=sc.next().split("");

    	int passer=0;
    	int passerfore=1;

    	for(int i=0;i<s.length;i++) {

    		String syozoku=s[i];


    		if(syozoku.equals("a")) {
    			if(passer<A+B) {
    				System.out.println("Yes");
    				passer++;
    			}else {
    				System.out.println("No");
    			}
    		}else if(syozoku.equals("b")) {
    			if(passer<A+B && passerfore<=B) {
    				System.out.println("Yes");
    				passerfore++;
    				passer++;
    			}else {
    				System.out.println("No");
    			}

    		}else {
    			System.out.println("No");
    		}

    	}
    }

}



Measured memory_bytes: 47200
ss = list(input())
children = [1 for _ in range(len(ss))]
for i in range(len(ss)-1):
    if ss[i] == "R" and ss[i+1]=="L":
        pass
    elif ss[i] == "R":
        children[i+2] += children[i]
        children[i] = 0
    
#     print(children)
        
children.reverse()
ss.reverse()
for i in range(len(ss)-1):
    if ss[i] == "L" and ss[i+1]=="R":
        pass
    elif ss[i] == "L":
        children[i+2] += children[i]
        children[i] = 0
        
children.reverse()
ss.reverse()

print(" ".join(list(map(str,children))))

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

using namespace std;

int main()
{
    vector<char> S(3);
    for(char &c:S) cin >> c;

    int counter = count(S.begin(),S.end(),'R');
    if(S[1] == 'R')
        cout << counter;
    else if (counter == 2)
        cout << counter - 1;
    else
        cout << counter;



    return 0;
}


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

//定数
const long long MOD1=1000000007;
const long long MOD2=998244353;
const long double PI=3.1415926535897932;
const long long MAXLL=9223372036854775807;
const long long INF=2305843009213693951;
const long long dx[]={0,1,0,-1,1,-1,1,-1};
const long long dy[]={1,0,-1,0,1,1,-1,-1};

//型名省略
#define ll long long
#define ull unsigned long long
#define ld long double
#define uld unsigned long double
#define pll pair<long long,long long>
#define tll(n) array<long long,(int)(n)>
#define pcc pair<char,char>
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vp vector<pair<long long,long long>>
#define vt(n) vector<array<long long,(int)(n)>>
#define umap unordered_map
#define uset unordered_set
#define Lqueue priority_queue<long long>
#define Squeue priority_queue<long long,vector<long long>,greater<long long>>
#define Fi first
#define Se second
#define mp make_pair
#define eb emplace_back

//マクロ
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rbf(a,x) for(auto& a:x)
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s);i<(long long)(n);i++)
#define Maxe(x) *max_element((x).begin(),(x).end())
#define Mine(x) *min_element((x).begin(),(x).end())
#define Size(x) ((long long)(x).size())
#define lin(s) getline(cin,(s))

//MAX,MIN
template<class T,class U> auto max(T a,U b){return a>b?a:b;}
template<class T,class U> auto min(T a,U b){return a<b?a:b;}

//最大公約数,最小公倍数
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a,long long b){return a/gcd(a,b)*b;}

//累乗
template<typename t>
constexpr t mypow(t a,long long b){
    if(b==0)return 1;
    if(a==0)return 0;
    t x=1;
    while(b>0){
        if(b&1LL)x*=a;
        a*=a;
        b>>=1LL;
        }
    return x;
}
#define pow mypow

//chmin,chmax
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;}

//組み合わせ O(r)
template<typename t>
constexpr t nCr(t n,long long r){
    if(r==0)return 1;
    if(n==0)return 0;
    if(n<r)return 0;
    t x=1;
    for(long long i=1;i<=r;i++){
        x*=n-i+1;
        x/=i;
    }
    return x;
}

//main関数
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string s;
    cin>>s;
    rep(i,Size(s)){
        if(i%2==0){
            if(s[i]=='L'){
                cout<<"No"<<endl;
                return 0;
            }
        }else{
            if(s[i]=='R'){
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 3536
a, b = map(lambda x: int(x), input().split())

g = [4, 6, 9, 11]
go = [1, 3, 5, 7, 8, 10, 12]

if a == 2 and b == 2:
  print('Yes')
elif a in g and b in g:
  print('Yes')
elif a in go and b in go:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <cassert>
#include <climits>
using namespace std;

template <typename T> class SegmentTree{
	public :
		SegmentTree(int size,T o,T(*func)(T,T)):out_of_range(o),op(func){
			n=1;
			while(n<size) n*=2;
			data=vector<T>(2*n,out_of_range);
			lazy=vector<bool>(2*n,false);
		}

		T update(int k,T x){
			assert(0<=k&&k<n);
			u(k,k+1,0,x,0,n);
		}

		T update(int a,int b,T x){
			assert(0<=a&&b<=n&&a<b);
			u(a,b,0,x,0,n);
		}

		T query(int a,int b){
			assert(0<=a&&b<=n&&a<b);
			return q(a,b,0,0,n);
		}

	private:
		vector<T> data;
		vector<bool> lazy;
		int n;
		const T out_of_range;
		T (*op)(T,T);

		inline void lazy_evaluate(int k){
			data[k*2+1]=data[k];lazy[k*2+1]=true;
			data[k*2+2]=data[k];lazy[k*2+2]=true;
			lazy[k]=false;
		}

		void u(int a,int b,int k,T x,int l,int r){
			if(r<=a || b<=l)
				return ;
			else if(a<=l&&r<=b){
				data[k]=x;
				lazy[k]=true;
			}else{
				if(lazy[k])
					lazy_evaluate(k);
				u(a,b,k*2+1,x,l,(l+r)/2);
				u(a,b,k*2+2,x,(l+r)/2,r);
				data[k]=op(data[k*2+1],data[k*2+2]);
			}
		}

		T q(int a,int b,int k,int l,int r){
			if(r<=a || b<=l)
				return out_of_range;
			else if(a<=l&&r<=b)
				return data[k];
 			else{
				if(lazy[k])
					return data[k];
				T vl = q(a,b,k*2+1,l,(l+r)/2);
				T vr = q(a,b,k*2+2,(l+r)/2,r);
				return op(vl,vr);
			}
		}
};

inline int amin(int a,int b){ return min(a,b);}

int main(void){
	int N,Q;
	cin >>  N >> Q;
	SegmentTree<int> rmq(N,INT_MAX,amin);

	for(int i=0;i<Q;i++){
		int type;
		cin >> type;
		if(type){
			int s,t;
			cin >> s >> t;
			cout << rmq.query(s,t+1) << endl;
		}else{
			//int a,b,x;
			//cin >> a >> b >> x;
			int k,x;
			cin >> k >> x;
			//rmq.update(a,b+1,x);
			rmq.update(k,x);
		}
	}
	return 0;
}

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

int main()
{
    int n, q;
    cin >> n;
    int s[n];
    for (int i = 0; i < n; i++)
        cin >> s[i];
    cin >> q;
    int ans = 0;
    for (int i = 0; i < q; i++)
    {
        int t;
        cin >> t;
        for (int j = 0; j < n; j++)
        {
            if (s[j] == t)
            {
                ans++;
                break;
            }
        }
    }
    cout << ans << endl;
}


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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

#include <bits/stdc++.h>
using namespace std;

template<typename T>
void cmpmax(T* reference, T value) {
	*reference = max(*reference, value);
}

template<typename T>
void cmpmin(T* reference, T value) {
	*reference = min(*reference, value);
}

const ll mod = 1000000007;

static const ll INF = 1e15;
int n;
vector<ll> as;
vector<P> hs;

template<typename T> class SegmentTree {
private:
	typedef function<T(T, T)> F;
	int n;
	T d0;
	vector<T> vertex;
	F f;
	F g;
public:

	SegmentTree(int sourceN, F f, F g, T d = 0) :d0(d), f(f), g(g) {
		init(sourceN);
	}
	void init(int sourceN) {
		n = 1;
		while (n < sourceN) n *= 2;
		vertex.resize(2 * n - 1, d0);
	}
	void update(int i, T x) {
		int k = i + n - 1;
		vertex[k] = g(vertex[k], x);
		while (k > 0) {
			k = (k - 1) / 2;
			vertex[k] = f(vertex[2 * k + 1], vertex[2 * k + 2]);
		}
		return;
	}
	T query(int l, int r) {
		T vl = d0, vr = d0;
		l += n - 1;
		r += n - 1;
		for (; l <= r; l /= 2, r = r / 2 - 1) {
			if (l % 2 == 0) vl = f(vl, vertex[l]);
			if (r & 1) vr = f(vr, vertex[r]);
		}
		return f(vl, vr);
	}
};


static SegmentTree<ll> SegmentTreeMax(int n) {
	SegmentTree<ll> t(n, [=](ll left, ll right) {return max(left, right); }, [=](ll _, ll value) {return value; });
	return t;
}


int main() {
	cin >> n;
	as.resize(n);
	hs.resize(n);
	rep(i, n) {
		int h;
		cin >> h;
		hs[i] = { h, i };
	}
	rep(i, n) {
		cin >> as[i];
	}
	sort(hs.begin(), hs.end());
	auto tree = SegmentTreeMax(n);
	rep(i, n) {
		auto h = hs[i];
		auto index = h.second;
		auto a = as[index];
		auto m = tree.query(0, index - 1);
		tree.update(index, m + a);
	}
	auto upper = tree.query(0, n - 1);
	cout << upper << endl;
	return 0;
}
	


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

using namespace std;

int main() {
  int N;
  cin >> N;
  
  bool end = false;
  int sum = 0;
  int temp = N;
  while(!end){
    int keta = temp % 10;
    sum += keta;
    temp /= 10;
    if(!temp)
      end = true;
  }
  
  if(N % sum == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
//
//  main.cpp
//  CoderProj
//
//  Created by Minoru Hayashi on 2020/05/02.
//  Copyright © 2020 Minoru Hayashi. All rights reserved.
//
//  ABC165
//
//

#include <bits/stdc++.h>
using namespace std;

#define REP(i,n) for (int i=0; i<(n); i++)
#define REP2(i,x,n) for (int i=x; i<(n); i++)
#define ALL(n) begin(n), end(n)

using ll = long long;

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

// const ll INF = 1LL<<60;
// const int INF = 1<<29;
// const int MOD = 1000000007;
//#define __DBG__


void solve(void){
  
  int K, A, B;
  cin >> K >> A >> B;
  
  
  REP2(i,1,1000){
    int J=K*i;
    if(J>=A && J<=B){
      cout << "OK" << endl;
      return;
    }
  }
  cout << "NG" << endl;
  return;
}



#define TESTCASES 1

int main() {


    cin.tie(0);
    ios::sync_with_stdio(false);

    REP(i,TESTCASES){
      solve();
    }
 
    return 0;
}



Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
using vi   = vector<int>;
using vll  = vector<long long>;
using vvi  = vector<vi>;
using vb   = vector<bool>;
using vvb  = vector<vb>;
using pii  = pair<int,int>;
using vpii = vector<pii>;

int main() {
    int N; cin >> N;
    int ans = 0;

    for(int i = 1; i <= N; i=i+2) {
        int tmp = 0, sqrt_i = sqrt(i);
        if(sqrt_i*sqrt_i == i) continue;
        for(int j = 2; j <= sqrt_i; j++) {
            if (i%j==0) tmp++;
            if (tmp > 3) break;
        }
        if(tmp == 3) ans++;

    }
    cout << ans << endl;
}

Measured memory_bytes: 3676
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll mod=1e9+7;
int dy[]={1,-1,0,0};
int dx[]={0,0,1,-1};

int main(){
  int N,A,B;
  cin>>N>>A>>B;
  int ans=0;
  if(N*A<=B){
    ans=N*A;
  }else ans=B;
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;

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

template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}

int main(){
    int n, x, t;
    cin >> n >> x >> t;

    cout << t *((n + x-1)/x) << '\n';
    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include<bits/stdc++.h>
#include<set>
#include<string>
#include<unordered_map>
using namespace std;

# define ll long long

int main()
{
    
    unordered_map<string,ll> mp;
    ll n;
    cin>>n;
    
    for(ll i=0;i<n;i++)
    {
        string  str;
        cin>>str;
        if(mp.find(str)==mp.end())
         mp[str]=1;
         else
         mp[str]=1+mp[str];
    }
    ll max=INT_MIN;
    for(auto x :mp)
    {
        if(x.second>max)
        max=x.second;
    }
  set<string> st;
  for(auto x:mp)
  {
      if(x.second==max)
       st.insert(x.first);
  }
  for(auto it=st.begin();it!=st.end();it++)
      cout<<*it<<endl;
    
   
    
   return 0;
}

Measured memory_bytes: 33480
#include<iostream>
#include<functional>
#include<iomanip>
#include<vector>
#include<set>
#include<queue>
#include<utility>
#include<map>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>

#define LL long long
#define INT_MAX 2147483647

using namespace std;

int N;
int a[40];

//nowより左 (now含む) でいくつか選んで和をgoal以上にしたときの和の最小値-goal (差分)
int memo[40][13000];
int solve(int now, int goal) {
	if (now == -1) {
		if (goal > 0) return INT_MAX;
		return -goal;
	}
	if (memo[now][goal + 5000] != -1) return memo[now][goal + 5000];
	return memo[now][goal+5000] = min(solve(now - 1, goal), solve(now - 1, goal - a[now]));
}

int main() {
	cin >> N;
	int sum = 0;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
		sum += a[i];
	}
	sort(a, a + N);
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < 13000; j++) {
			memo[i][j] = -1;
		}
	}
	int ans = INT_MAX;
	for (int i = 2; i < N - 1; i++) { //小さいほうのグループの最大値は誰？
		for (int j = a[i]+1; j <= sum / 2; j++) {
			int tmp = solve(i - 1, j);
			if (tmp == INT_MAX) continue;
			int sumOfLeft = j + tmp + a[i];
			int sumOfRight = sum - sumOfLeft;
			if (sumOfRight - a[N - 1] <= a[N - 1]) continue;
			ans = min(ans, abs(sumOfLeft - sumOfRight));
		}
	}
	if (ans == INT_MAX) cout << -1 << endl;
	else cout << ans << endl;

	return 0;
}

/*
40
2 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 1 1 1 1 1 1 1 1 1 1
*/


Measured memory_bytes: 5196
// --------------
// Tejas Pandey  |
// 02 - 08 - 20  |
// Atcoder BC 174|
// --------------

#include <bits/stdc++.h>
using namespace std;
     
#define mod 1000000007
#define vi vector<int>
typedef long long int ll;
     
int main (void){
  //freopen("in.txt","r",stdin);
  //freopen("out.txt","w",stdout);
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ll n,d;
  cin >> n >> d;
  d = d*d;
  int ans = 0;
  for(int i = 0;i < n;i++){
	ll a,b;
	cin >> a >> b;
	ll dis = a*a + b*b;
	if(dis <= d) ans++;
  }
  cout << ans << "\n";
  return 0;
}


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

class Myon{
    static void Main(string[] args){
        var myon = new Myon();
    }

    public Myon(){
        int[] pos = new int[5];
        for(int i = 0;i < 5;i ++){
            pos[i] = int.Parse(Console.ReadLine());
        }
        int k = int.Parse(Console.ReadLine());
        int count = 0;
        for(int i = 0;i < 5;i ++){
            for(int j = 0;j + i < 5;j ++){
                int distance = pos[i] - pos[j];
                if(Math.Abs(distance) > k)count ++;
            }
        }
        if(count == 0)Console.WriteLine("Yay!");
        else Console.WriteLine(":(");
    }
}

Measured memory_bytes: 11092
#include<stdio.h>



int main()
{
  int dan,ans,count,i,DAN[31];
  DAN[1]=1;
  DAN[2]=2;
  DAN[3]=4;


  while(1){
    scanf("%d",&dan);
    if(dan==0)break;
    count=1;


    for(i=4;i<=dan;i++)
      {
        DAN[i]=DAN[i-1]+DAN[i-2]+DAN[i-3];
      }
    while(1){
    if(DAN[dan]>=3650)
      {
        DAN[dan]=DAN[dan]-3650;
        count++;
      }
    else{break;}

    }
    printf("%d\n",count);
  }
  return 0;
}

Measured memory_bytes: 0
s = input()
odd = ["R", "U", "D"]
even = ["L", "U", "D"]

for i in range(len(s)):
    if i%2 == 0:
        if not s[i] in odd:
            print("No")
            exit(0)
    else:
        if not s[i] in even:
            print("No")
            exit(0)

print("Yes")

Measured memory_bytes: 61960
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) {
    if (b==0) return a;
    else return gcd(b, a%b);
}

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

ll choose2(ll n){
    return n*(n-1)/2;
}

int main(){
    string s,t;
    cin>>s>>t;
    int cnt = 0;
    rep(i,0,s.length()-1){
        if(s[i]==t[i]) cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
class Main{
	Scanner sc=new Scanner(System.in);
	void aa(){
		int n=sc.nextInt();
		for(int i=0;i<n;i++){
			String YN="YES";
			int r=sc.nextInt();
			int l=0;
			for(int j=0;j<9;j++){
				int ball=sc.nextInt();
				if(ball>r)r=ball;
				else if(ball>l)l=ball;
				else YN="NO";
			}
			System.out.println(YN);
		}
	}
	public static void main(String[]arg){
		new Main().aa();
	}
}

Measured memory_bytes: 18408
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=3010,p=1e9+7;
int inc(int x,int y){x+=y;return x>=p?x-p:x;}
int mul(int x,int y){return (ll)x*y%p;}
int n,m,top,l[N],r[N],cnt[N];
char s[N];
int dp[N][N],C[N][N];//dp[i][j]表示填完了前l[i+1]-1个，手里剩下j个1的方案数
int calc(){
	for (int i=0;i<=top;i++)
	for (int j=0;j<=n;j++)
		dp[i][j]=0;
	dp[0][0]=1;l[0]=l[1];r[0]=l[1]-1;
	for (int i=0;i<top;i++){
		int len=l[i+1]-l[i],one=cnt[r[i+1]]-cnt[r[i]];
		for (int j=0;j<=n;j++){
			int v=dp[i][j],zero=r[i]-l[i]+1-j;
			for (int k=max(0,len-zero);k<=j&&k<=len;k++)//考虑一下填多少个1
				dp[i+1][j-k+one]=inc(dp[i+1][j-k+one],mul(v,C[len][k]));
		}
	}
	l[0]=r[0]=0;
	int ans=0;
	for (int j=0;j<=n;j++) ans=inc(ans,mul(dp[top][j],C[r[top]-l[top]+1][j]));
	return ans;
}
int main()
{
	scanf("%d%d%s",&n,&m,s+1);
	for (int i=0;i<=n;i++){
		C[i][0]=1;
		for (int j=1;j<=i;j++) C[i][j]=inc(C[i-1][j-1],C[i-1][j]);
	}
	for (int i=1;i<=n;i++) cnt[i]=cnt[i-1]+s[i]-'0';
	int ans=1;
	for (int i=1;i<=m;i++){
		int L,R;
		scanf("%d%d",&L,&R);
		if (top&&L>r[top]) ans=mul(ans,calc()),top=0;
		if (R>r[top]) top++,l[top]=L,r[top]=R;
	}
	ans=mul(ans,calc());
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 45952
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<string>
#include<math.h>
#include<stdlib.h>
#include<time.h>
#include<map>
#include<queue>
#include<set>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
int d0[50],d1[50],m,mm;
long long ans,d,wei,te,ten[18];
//81000 wei+3
void dfs(int x,long long v,long long s){
	//if (abs(v)>d*10000) return;//12
	if (v<-d*15) return;
	if (v>d*15&&v>(ten[m-x]-ten[x-1])*15) return;
	//printf("%d %lld %lld\n",x,v,s);
	if (x>mm){//>m
		if (v==d){
			//printf("%d %lld %lld\n",x,v,s);
			if (m&1) ans+=s*10;else ans+=s;//(m>2)&&
		}
		return;
	}
	if (x==1){
		fo(i,-9,8) dfs(x+1,v+i*(ten[m-x]-ten[x-1]),s*d1[i+20]);//m-i+1 i
		return;
	}
	fo(i,-9,9) dfs(x+1,v+i*(ten[m-x]-ten[x-1]),s*d0[i+20]);
}
inline void sol(int wei){
	if (wei<=1) return;
	m=wei;mm=m/2;
	dfs(1,0,1);
}
int main(){
	scanf("%lld",&d);
	if (d%9!=0){
		printf("0\n");
		return 0;
	}
	if (d==9){
		printf("8\n");
		return 0;
	}
	ten[0]=1;fo(i,1,17) ten[i]=ten[i-1]*10;
	fo(i,0,9) fo(j,0,9) d0[i-j+20]++;
	fo(i,0,9) fo(j,1,9) d1[i-j+20]++;
	te=d;
	while (te){
		wei++;
		te/=10;
	}
	//printf("%lld\n",wei);
	fo(i,-9,9) sol(wei+i);//-8..8
	printf("%lld\n",ans);
	return 0;
}

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

int MOD = 1000000007;
int total_ways = 0;
int dp[1001][1001];
void solveGrid(char mat[1001][1001] ,int m ,int n){
    memset(dp,0,sizeof(dp));
 	for(int i=0;i<m;i++){
        if(mat[i][0]=='#'){
            break;
        }
        dp[i][0]=1;
    }
    for(int j=0;j<n;j++){
        if(mat[0][j]=='#'){
            break;
        }
        dp[0][j]=1;
    }
    for(int i=0;i<m;i++){
        for(int j=0;j<n;j++){
            if(mat[i][j]=='#'){
                dp[i][j]=0;
            }
        }
    }
    for(int i=1;i<m;i++){
        for(int j=1;j<n;j++){
            dp[i][j]=0;
            if(mat[i][j]!='#')
                dp[i][j] = (dp[i-1][j] % MOD + dp[i][j-1] % MOD)%MOD;
        }
    }
    /*
    for(int i=0;i<m;i++){
        for(int j=0;j<n;j++){
            cout<<dp[i][j]<<" ";
        }
        cout<<endl;
    }*/
    cout<<dp[m-1][n-1];
}

int main(){
 	int m,n;
  	cin>>m>>n;
  	char mat[1001][1001];
  	for(int i=0;i<m;i++){
      	for(int j=0;j<n;j++){
          	cin>>mat[i][j];
        }
    }

  	solveGrid(mat,m,n);
  	//cout<<total_ways;
}


Measured memory_bytes: 8448
/******************************************
* AUTHOR : Ashish Joshi* 
* INSTITUTION : NIT Hamirpur *
******************************************/
#include <bits/stdc++.h>
using namespace std;

#define N 100005
#define MOD 1000000007
#define PI 3.141592653589793

#define dd double
#define loop(i, n) for(int i = 0; i < n; i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,b) for(int i=1;i<=b;i++)
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
#define set(b,i) (b|(1<<i))
#define unset(b,i) (b&!(1<<i))
#define cbit(b,i) bool(b&(1<<i))

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<pair<long long,long long> > vpll;
typedef vector<vector<ll> > vvll;

int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
//ios_base& scientific (ios_base& str);
int n,m;
cin>>n>>m;
cout<<((n*(n-1))/2 + (m*(m-1))/2)<<endl;

return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] args) throws IOException {
        execute();
    }

    private static void execute() throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String lineLength = br.readLine().split(" ")[0];
        List<String> strs = new ArrayList<>();
        for (int i=0; i < Integer.parseInt(lineLength); i++) {
            strs.add(br.readLine());
        }
        System.out.println(minLexicalOrder(strs));
    }

    private static String minLexicalOrder(List<String> strs) {
        return strs.stream().sorted().collect(Collectors.joining());
    }
}

Measured memory_bytes: 27860
#include<iostream>
#include<math.h>
#include <map>
#include <vector>
using namespace std;
int main()
{
	
	int N,x;
	cin >> N;
	vector<int> v(N + 1);
	for (int i = 0; i < N; ++i)
	{
		cin >> x;
		v[x]++;
      	if(i==N-1)
          v[x]--;
	}
	
	for (int i = 1; i <= N; ++i)
	{
		cout << v[i] << endl;
	}
	return 0;
}

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

using namespace std;

int main(void){
    int A, B ,K;
    cin >> A >> B >> K;

    for(int i = 0; i < K; i++){
        if(i % 2 == 0){
            if(A % 2 == 1){
                A--;
            }
            B += A / 2;
            A /= 2;
        }
        if(i % 2 == 1){
            if(B % 2 == 1){
                B--;
            }
            A += B / 2;
            B /= 2;
        }
    }
    cout << A << " " << B << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>
#include <functional>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
int main(){
	while(true){
		int w,d,a[21]={},b[21]={};
		cin>>w>>d;
		if(w==0) break;
		rep(i,w){
			int k;
			cin>>k;
			a[k]++;
		}
		rep(i,d){
			int k;
			cin>>k;
			b[k]++;
		}
		int ans=0;
		rep(i,21) ans+=max(a[i],b[i])*i;
		cout<<ans<<endl;
	}
}

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

int res[101010];
string s;

int main(){
  cin >> s;
  int n = s.size();
  s.push_back('R');
  
  int left = 0, mid = 0;
  for(int i = 0; i < n; i++){
    if(s[i] == 'R' && s[i + 1] == 'L'){
      mid = i;
      continue;
    }
    if(s[i] == 'L' && s[i + 1] == 'R'){
      int a = i - left;
      int b = mid - left;
      res[mid] = (a - b) / 2 + (b / 2) + 1;
      res[mid + 1] = (b + 1) / 2 + (a - b - 1) / 2 + 1;
      left = i + 1;
    }
  }
  
  rep(i, n) cout << res[i] << ((i == n - 1)? "\n" : " ");
    
  return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
long long s, r;
int n;
int main(){
    int i, a;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%d",&a);
        if(a==0){
            r += s/2;
            s=0;
        }
        s+=a;
    }
    printf("%lld\n",r+s/2);
}

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

inline int64_t ceiling_div(int64_t a, int64_t b){
  int64_t ans= ((a>=0 && b > 0) || (a<=0 && b < 0)) ? (abs(a)+abs(b)-1)/abs(b)
                                                    : -abs(a)/abs(b);
  return ans;
}

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

  vector<pair<int64_t, int64_t>> data(N);
  for(int i=0; i<N; i++){
    cin >> data.at(i).first >> data.at(i).second;
  }

  int64_t cnt= 0;
  for(int i=N-1; i>= 0; i--){
    auto [num_0, div]= data.at(i);
    int64_t num_tmp= num_0+ cnt;
    
    cnt+= ceiling_div(num_tmp, div)* div- num_tmp;
  }

  cout << cnt << endl;
}

Measured memory_bytes: 4800
S=gets.strip.codepoints
T=gets.strip.codepoints
ss=S.size
if !(T.uniq-S.uniq).empty?
    puts -1
    exit 0
end

data=Hash.new
S.each_with_index do |e,idx|
    if data[e].nil?
        data[e]=[idx]
    else
        data[e] << idx
    end
end

current=0
T.each_with_index do |e|
    points=data[e].bsearch{|j|current % ss <= j}
    # p points
    if points.nil?
        current += (ss-current % ss) + data[e][0]+1
    else
        current += points - (current % ss)+1
    end
end
puts current


Measured memory_bytes: 4988
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define min(a,b) (((a)>(b))?(b):(a))
#define max(a,b) (((a)>(b))?(a):(b))
#define pb push_back
#define mp make_pair
#define INF (1<<28)-1
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}
long nCr(int n, int r) {
	
}
int main(){
	int a[3];
	cin>>a[0]>>a[1]>>a[2];
	sort(a,a+3);
	int res=0;
	int t=a[2]-a[1];
	int s=a[2]-a[0];
	if(t%2==1&&s%2==1){
		a[0]++;
		a[1]++;
		res++;
	}else if(t%2==1&&s%2==0){
		a[2]++;
		a[0]++;
		res++;
	}else if(t%2==0&&s%2==1){
		a[2]++;
		a[1]++;
		res++;
	}
	if(a[2]!=a[0])res+=(a[2]-a[0])/2;
	if(a[2]!=a[1])res+=(a[2]-a[1])/2;
	cout<<res;
	return 0;
}

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

int main(){
    int N; cin >> N;
    vector<int> P(N), Q(N);
    rep(i, 0, N) cin >> P[i];
    rep(i, 0, N) cin >> Q[i];

    int cnt1 = 0, cnt2 = 0;
    do{
        cnt1++;
    }while(next_permutation(P.begin() , P.end()));
    do{
        cnt2++;
    }while(next_permutation(Q.begin() , Q.end()));
    //cerr << cnt1 << cnt2 << endl;
    cout << abs(cnt1 - cnt2) << endl;

}

Measured memory_bytes: 256
//#pragma warning(disable:4996)
#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>
//#include <stdio.h>

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

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	string S;
	cin >> S;
	cin >> S;
	cout << "A" << S.substr(0, 1) << "C\n";
	return 0;
}

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

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

const double PI = acos(-1);
#define MOD 1000000007

#define PB push_back
#define F first
#define S second
#define test int tc; cin>>tc; while(tc--)
#define all(a) (a).begin(), (a).end()
#define sz(x) (int)x.size()
#define el <<'\n'
#define sp <<' '

#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (abs(a*b)/gcd(a,b))
#define sqr(a) (a*a)

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

///binary to decimal
long double btod(string a){
    long double i,c=sz(a)-1,s=0,d=0;
    for(i=c;i>=0;i--){
        a[i]-=48;
        s+=a[i]*pow(2,d);
        d++;
    }
    return s;
}

main()
{
    optimize();
    ll n,a;
    cin>>n;
    a=(n/500)*1000;
    a+=((n%500)/5)*5;
    cout<<a el;
}












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

using namespace std;

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

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

#endif

void Main() {
    ll N, M; cin >> N >> M;
    ll cost = M * 1900 + (N - M) * 100;
    cout << ((ll)(1 / pow(0.5, M))) * cost << endl; // 1 + 1/2 + 1/4 + ... = 2
}

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


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define LL long long
#define ld double
#define PB push_back
using namespace std;
const int MX = (1 << 18) + 100;
const int SQ = 3000;
const double PI = acos(-1.0);
const int K = 18;
int n;
int V[100000];
int m[2][100001];
vector<pair<int , int > > v[2];
int main()
{
	//freopen("In.txt" , "r" , stdin);
	cin >> n;
	for(int i = 0; i < n; i++)
	{
			cin >> V[i];
			m[i % 2][V[i]]++;
	}
	for(int i = 0; i < 2; i++)
	{
		for(int j = 0; j <= 100000; j++)
		{
			v[i].PB({m[i][j] , j});
		}
		sort(v[i].begin() , v[i].end());
		reverse(v[i].begin() , v[i].end());
	}
	int ans = n;
	for(int i = 0; i < 2; i++)
	{
		for(int j = 0; j < 2; j++)
			if(v[0][i].second != v[1][j].second)
			{ 
				ans = min(ans , n - v[0][i].first - v[1][j].first);
			}
	}
	cout << ans;
	
    return 0;

}

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

namespace ConsoleApp14
{
    class Class23
    {
        static void Main()
        {
            string S = Console.ReadLine();
            int[] ans = new int[S.Length];
            for (int i = 0; i < S.Length; i++) ans[i] = 0;

            for(int i = 0; i < S.Length;)
            {
                int R = 0;int L = 0;
                int check = S.Length - 1;
                for (; i < S.Length; i++)
                {
                    if (S[i] == 'R') R++;
                    else break;
                }
                check = i;
                for (; i < S.Length; i++)
                {
                    if (S[i] == 'L') L++;
                    else break;
                }

                if (check == 0 | check == S.Length - 1&&R==0)
                    ans[check] = L + R;
                else
                {
                    ans[check-1] = R / 2 + L / 2 + R % 2;
                    ans[check] = L / 2 + R / 2 + L % 2;
                }
            }
            Console.WriteLine(string.Join(" ", ans));
        }
    }
}


Measured memory_bytes: 15200
// https://atcoder.jp/contests/abc130/tasks/abc130_a
//
#![allow(unused_imports)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! dvec {
    ($t:expr ; $len:expr) => {
        vec![$t; $len]
    };

    ($t:expr ; $len:expr, $($rest:expr),*) => {
        vec![dvec!($t; $($rest),*); $len]
    };
}

#[allow(unused_macros)]
macro_rules! ifv {
    ($t:expr, $a:expr, $b: expr) => {
        if $t { $a } else { $b }
    }
}

#[allow(unused_macros)]
macro_rules! fill {
    ($t:expr, $v:expr) => {
        for i in 0..$t.len() {
            $t[i] = $v;
        }
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    input! {
        x: usize, a: usize
    };
    println!("{}", ifv!(x < a, 0, 10));
}


Measured memory_bytes: 4352
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <iomanip>
#include <string>
#include <queue>
#include <numeric>
#include <functional>
#include <array>
#include <map>
#include <set>

#define INF 1000000007 //1000000000000000003
#define MOD 1000000007

#define ll long long

//printf("%.10f", );
//cout << fixed << setprecision(10) << heikin << endl;

using namespace std;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using edge = struct { int to; long long dist; };

vector<edge>tree[100010];
vector<P> connect[100005];
long long cost[100005];

int dp[40][500][500];

bool compare_by_second(pair<int, int> a, pair<int, int> b) {
	if (a.second != b.second) {
		return a.second < b.second;
	}
	else {
		return a.first < b.first;
	}
}

int main() {

	int N;
	cin >> N;

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

	int ans = 0;
	for (int i = 0; i < N;++i) {
		for (int j = i + 1; j < N;++j) {
			ans += d[i] * d[j];
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 5888
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
    private static int[] A = new int[2000000];
    private static int heapSize = 0;
    private static void maxHeapify(int k){
        int l = 2*k;
        int r = 2*k+1;
        int largest;
     
        if ((l <= (heapSize)) && (A[l] > A[k])){
            largest = l;
        }else{
            largest = k;
        }
        if ((r <= (heapSize)) && (A[r] > A[largest])){
            largest = r;
        }
        if (largest != k){
            swap(k, largest);
            maxHeapify(largest);
        }
    }
    private static void swap(int i, int j) {
        int tmp = A[i];
        A[i] = A[j];
        A[j] = tmp;
    }
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        while (true){
            String[] line = br.readLine().split(" ");
            String order = line[0];
            if (order.equals("insert")){
                heapSize++;
                //A[heapSize] = Integer.MIN_VALUE;
                int num = Integer.parseInt(line[1]);
                A[heapSize] = num;
                int i = heapSize;
                while (i > 1 && A[i/2] < A[i]) {
                    swap(i, i/2);
                    i = i/2;
                }
            }else if (order.equals("extract")){
                int max = A[1];
                A[1] = 0;
                swap(1, heapSize);
                heapSize--;
                maxHeapify(1);
                System.out.println(max);
            }else{ // end
                break;
            }
        }
    }
}

Measured memory_bytes: 186788
#include<iostream>
#include <cassert>
#include <algorithm>
#include <functional>

using namespace std;

int main() {
	int a, b, c, x, y;
	int t = 0;
	int count = 0;


	cin >> a >> b >> c >> x >> y;
	t = std::min(x, y);
	if ((a + b) <= 2 * c){
		count += a * x + b * y;
	}
	else{
		if ((x - y) > 0){
			if ((x - y) * a < (x - y) * c * 2){
				count += 2 * c * t;
				count += a * (x - y);
			}
			else {
				count += 2 * c * t;
				count += 2 * c * (x - y);
			}
		}
		else if ((x - y) < 0){
			count += 2 * c * t;
			if ((y - x) * b < (y - x) * c * 2) count += b * (y - x);
			else count += 2 * c * (y - x);
		}
		else count += 2 * c * t;
	}
	cout << count << endl;
	return 0;
}


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

using namespace std;

#define fastio cin.tie(NULL); cout.tie(NULL); ios_base::sync_with_stdio(0)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> matrix;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(c) c.begin(),c.end()
#define mp make_pair
#define pb push_back
#define f first
#define int ll
#define tcase int t; cin>> t; for( ; t; --t)
#define s second
#define endl '\n'
const int MAX = 1e6+1;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1);
const double DEG = 180/PI;
const int MOD = 1e9+7;
int mod(int x, int m){ if(x >= 0) return x % m; if(-x < m) return m-(-x); return mod(x%m, m);}
int gcd (int a, int b) {while(b){a = mod(a, b); swap(a, b);} return a;}
int lcm (int a, int b) {return a / gcd(a, b) * b;}
int fexp(int base, int exp, int m){
	int total = 1;
	while(exp > 0){
		if(exp % 2 == 1){
			total = mod(((mod(total, m)) * (mod(base, m))), m);
			exp--;
		}
		base= mod((mod(base, m) * mod(base, m)), m);
		exp /= 2;
	}
	return mod(total, m);
}

int n;

int32_t main(){
	fastio;
	double a, b, h, m;
	cin >> a>> b>> h >> m;
	m = 11*m;
	m /= 2;
	h*=30;
	double t = abs(h - m);
	if(t > 180.0) t = 360 - t;
	double ans = sqrt(a*a + b*b - 2*a*b*cos(t*PI/180.0));

	cout<< fixed<< setprecision(10)<< ans << endl;

	return 0;
}

Measured memory_bytes: 4316
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

template<typename T>
class RMQ {
    int n;
    vector<T> data;
    const T INIT_VALUE;
    int get(int a, int b, int k, int l, int r){
        if(r <= a || b <= l)return INIT_VALUE;
        if(a <= l && r <= b)return data[k];
        T lv = get(a, b, (k << 1) + 1, l, (l + r) >> 1);
        T rv = get(a, b, (k << 1) + 2, (l + r) >> 1, r);
        return min(lv, rv);
    }
public:
    RMQ(int _n, int INIT_VALUE):INIT_VALUE(INIT_VALUE){
        for(n = 1; n < _n; n <<= 1);
        data.assign((n << 1) - 1, INIT_VALUE);
    }
    void update(int k, T v){
        k += n - 1;
        data[k] = v;
        while(0 < k){
            k = (k - 1) >> 1;
            data[k] = min(data[(k << 1) + 1], data[(k << 1) + 2]);
        }
    }
    T get(int a, int b){
        return get(a, b, 0, 0, n);
    }
};

int main(){
    int n, q;
    cin >> n >> q;
    RMQ<int> rmq(n, (1 << 31) - 1);
    while(q--){
        int com, x, y;
        cin >> com >> x >> y;
        if(com)cout << rmq.get(x, y + 1) << '\n'; else rmq.update(x, y);
    }
    return 0;
}

Measured memory_bytes: 2060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

int main()
{
	int k;
	cin >> k;
	vector<ll> a;
	for (int i = 1; i <= 9; i++) a.push_back(i);

	while (true) {
		if (k < a.size()) {
			cout << a[k - 1] << endl;
			return 0;
		}
		else k -= a.size();
		vector<ll> old;
		swap(old, a);
		for (const auto& item : old) {
			for (int i = -1; i <= 1; i++) {
				int d = item % 10 + i;
				if (d < 0 || 9 < d) continue;
				ll next_item = item * 10 + d;
				a.push_back(next_item);
			}
		}
	}
}

Measured memory_bytes: 1712