akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ALL(A) (A).begin(),(A).end()
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)

const ll mod = 1e9+7;
const ll INF = 2*1e18;
const int inf = 1e9+7;

using namespace std;

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int x,y;
	int ans = 0;
	cin >> x >> y;
	int t[4] = {0,300000,200000,100000};
	if(x==1&&y==1){
		ans = 300000*2 + 400000;
	}else{
		if(x<4)ans += t[x];
		if(y<4)ans += t[y];
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!

from collections import defaultdict

N = int(input())
A = list(map(int, input().rstrip().split(' ')))

d = defaultdict(int)
for a in A:
    d[a] += 1

count = 0
sorted_keys = sorted(d.keys(), key=lambda x: -x)
has_choiced = False
h = 0
v = 0
for key in sorted_keys:
    if has_choiced == False and d[key] >= 4:
        h = key
        v = key
        break
    elif has_choiced == True and d[key] >= 4:
        v = key
        break
    elif has_choiced == True and d[key] >= 2:
        v = key
        break
    elif has_choiced == False and d[key] >= 2:
        h = key
        has_choiced = True
        
print(h * v)

Measured memory_bytes: 73428
/*ॐ नमो भगवते वासुदेवाय नमः*/
#include<bits/stdc++.h>
using namespace std;

#define int long long
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define allrev(x) (x).rbegin(), (x).rend()
#define pb push_back
#define pf push_front
#define fori(i, a, n) for(int i = a; i < n; ++i)
#define MAX(x) (*max_element(all(x)))
#define MIN(x) (*min_element(all(x)))
#define sortarr(a, n) sort(a, a + n)
#define sortvec(V) sort(all(V))

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

typedef unordered_map<int, int, custom_hash> u_map;
typedef unordered_set<int, int, custom_hash> u_set;
typedef vector<int> V;
typedef pair<int , int> pairi;
typedef set<int> seti;
typedef priority_queue<int> p_queue;
typedef deque<int> deqi;

const int MOD = 1e9+7;
const int INF = 1e9+8;
const double pi = 3.14159265359;

int binpow(int a, int b, int m) {
    a %= m;
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
int inverse(int x){
    return binpow(x, MOD - 2, MOD);
}

void solve()
{
    int n;
    cin >> n;
    vector<pair<int, int>> a(n);
    for(auto & i : a)   cin >> i.F >> i.S;
    sort(all(a));
    int a1 = INT_MIN, b1 = INT_MIN, c1 = INT_MAX, d1 = INT_MAX;
    for(int i = 0; i < n; i++){
        a1 = max(a1, a[i].F + a[i].S);
        b1 = max(b1, a[i].F - a[i].S);
        c1 = min(c1, a[i].F + a[i].S);
        d1 = min(a[i].F - a[i].S, d1);
    }
    cout << max(a1 - c1, b1 - d1) << endl;
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    solve();
    cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n ";
}

Measured memory_bytes: 6348
#include<stdio.h>
int main(){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    int sum=a;
    for(int i=0;i<100;i++){
        if(sum%b==c){
            printf("YES\n");
            return 0;
        }
        sum+=a;
    }
    printf("NO\n");
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <string>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <numeric>
using namespace std;

int abs(int num){
   if (num > 0)
      return num;
   else
      return -num;
}

int main(){
  int A,B,C;
  cin >> A >> B >> C;
  if(C >= A && C <= B){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG//TLEの原因になるので注意！！！！！！！！！！！
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.xise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
//#define int long long

//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある

int main(){
    int n;
    cin >> n;
    vector<int> l(n);
    rep(i,n){
        cin >> l[i];
    }
    sort(l.begin(),l.end());
    ll ans=0;
    int i=0,j,k;
    int a,b,c;
    for(;i<n;i++){
        a=l[i];
        for(j=i+1;j<n;j++){
            b=l[j];
            for(k=j+1;k<n;k++){
                c=l[k];
                if(c<a+b){
                    //cerr<<a<<' '<<b<<' '<<c<<endl;
                    ans++;
                }else{
                    k=n;
                }
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

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


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

  int ans = 0;
  for(int i = 0; i < 3; i++){
    if(s[i] == '1') ans++;
  }

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


Measured memory_bytes: 256
from collections import Counter

n = int(input())
A = list(map(int, input().split()))
c = Counter(A)
if n % 2 == 1 and c[0] == 1 and all(c[2 * i] == 2 for i in range(1, n // 2 + 1)):
  print(2 ** (n // 2) % (10 ** 9 + 7))
elif n % 2 == 0 and all(c[2 * i - 1] == 2 for i in range(1, n // 2 + 1)):
  print(2 ** (n // 2) % (10 ** 9 + 7))
else:
  print(0)

Measured memory_bytes: 14820
def f(S):
    L=list(S)
    L.sort()
    return  "".join(L)

N=int(input())
D={}

for _ in range(N):
    T=f(input())
    if T in D:
        D[T]+=1
    else:
        D[T]=1

A=0
for k in D:
    A+=(D[k]*(D[k]-1))//2
print(A)


Measured memory_bytes: 98532
// Problem : C - Multiplication 3
// Contest : AtCoder - AtCoder Beginner Contest 169
// URL : https://atcoder.jp/contests/abc169/tasks/abc169_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#define DEBUG fprintf(stderr, "Passing [%s] line %d\n", __FUNCTION__, __LINE__)
#define File(x) freopen(x".in","r",stdin); freopen(x".out","w",stdout)

using namespace std;

typedef long long LL;
typedef pair <int, int> PII;
typedef pair <int, PII> PIII;

inline int gi()
{
	int f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}

inline LL gl()
{
	LL f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}

const int INF = 0x3f3f3f3f, N = 100003, M = N << 1;

int n, m;

int main()
{
	//File("");
	long double a, b;
	cin >> a >> b;
	long double ans = a * b;
	cout << (LL)ans << endl;
	return 0;
}	

Measured memory_bytes: 3732
#pragma region Macros
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define RSORT(x) sort((x).rbegin(), (x).rend())
#define ALL(x) (x).begin(), (x).end()
#define REV(x) reverse(ALL(x))
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define SP << " " <<
#define INF2 1000000000000000037
#define INF  1000000007
#define lwb(x,n) distance(x.begin(),lower_bound(ALL(x),(n)))
#define upb(x,n) distance(x.begin(),upper_bound(ALL(x),(n)))
#define fora(i, ...) if(ll i = -1) for(__VA_ARGS__) if(i++, true)
#ifdef _MY_DEBUG
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define de(...) CHOOSE((__VA_ARGS__,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define de(...)
#endif
using namespace std;
using ll = long long;
using ld = long double;
template<class T = ll> using v = vector<T>;
template<class T = ll> using vv = vector<vector<T>>;
template<class T = ll> using vvv = vector<vector<vector<T>>>;
template<class T> bool maxi(T &a, const T &b){ if(a<b){a=b;return 1;}return 0;}
template<class T> bool mini(T &a, const T &b){ if(b<a){a=b;return 1;}return 0;}
template<class T> ll sumer(const T& a){ return accumulate(ALL(a),0LL); }
template<class T> void UNIQUE(vector<T> &a){ SORT(a);a.erase(unique(ALL(a)),a.end());}
template<class T, class U> ostream &operator<<(ostream &os, const pair<T,U> &pe) { os << pe.first << " " << pe.second; return os;}
template<class T> ostream &operator<<(ostream &os, const v<T> &ve) { rep(i,ve.size()) os<< (i?" ":"")<<ve[i]; return os;}
ll topbit(ll a) { return a==0?-1:63-__builtin_clzll(a);}
ll botbit(ll a) { return a==0?64:__builtin_ctzll(a);}
ll popcount(ll a) { return __builtin_popcountll(a);}
#define dame {cout<< retword <<"\n"; return;}
#pragma endregion
//--MODIFS---------------------------------
#pragma region Modifs
#define retword "-1"
#define MOD  1000000007
using P  = pair<ll,ll>;
using TP  = tuple<ll,ll,ll>;
#pragma endregion
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    string S; cin>>S;
    cout<< ( S=="ABC" ? "ARC" : "ABC" )<<"\n";
    
}
//--START----------------------------------
int main() {
    cin.tie(nullptr); ios_base::sync_with_stdio(false);
    // ifstream in("input.txt"); cin.rdbuf(in.rdbuf());
    // ofstream out("output.txt"); cout.rdbuf(out.rdbuf());
    cout << fixed << setprecision(15);
    // ll Qkai; cin>>Qkai; rep(QQ,Qkai) Main();
    Main();
}
//-----------------------------------------

Measured memory_bytes: 3656
h,w = gets.split.map &:to_i
a = h.times.map { gets.chomp }
seen = Array.new(h) { Array.new(w, -1)}

dx = [1,0,-1,0]
dy = [0,1,0,-1]

within = -> x,y { 0 <= x && x < w && 0 <= y && y < h }

que = [[0,0]]
seen[0][0] = 0
while !que.empty?
  x,y = que.shift
  4.times do |i|
    nx = x + dx[i]
    ny = y + dy[i]
    dist = seen[y][x]
    next unless within[nx,ny]
    next unless seen[ny][nx] == -1
    next unless a[ny][nx] == "#"

    seen[ny][nx] = dist + 1
    que << [nx,ny]
  end
end

walk = 0
a.each do |row|
  walk += row.count("#")
end

if seen[h-1][w-1] == h + w - 2 && walk == h + w - 1
  puts "Possible"
else
  puts "Impossible"
end

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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;

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

    int H, W, D; cin >> H >> W >> D;
    vector<int> px(101010), py(101010), d(101010);
    rep(i, H) rep(j, W) {
        int A; cin >> A;
        px[A] = i; py[A] = j;
    }
    for (int i = D + 1; i <= H * W; i++) {
        d[i] = d[i-D] + abs(px[i] - px[i-D]) + abs(py[i] - py[i-D]);
    }
    int Q; cin >> Q;
    while (Q--) {
        int L, R; cin >> L >> R;
        cout << d[R] - d[L] << endl;
    }
    return 0;
}

Measured memory_bytes: 2304
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b){return *(char*)a - *(char*)b;} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b){return strcmp(*(const char **)a, *(const char **)b);} /* aaa,aab.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

int main(void) {
  int n;
  int p[MAX];
  scanf("%d", &n);
  rep(i, 0, n) scanf("%d", &p[i]);

  int sum = 0, max = 0;
  rep(i, 0, n) {
    sum += p[i];
    max = max(max, p[i]);
  }
  int ans = sum - max / 2;
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
int main()
{
	char s[55];
	char t[55];
	char ans[55];
	char ans1[55];
	int i=0,j=0,n,min=100,cishu=0;
	scanf("%s",&s);
	scanf("%s",&t);
	strcpy(ans,s);
	if(strlen(s)<strlen(t))
	{
		printf("UNRESTORABLE\n");
		return 0;
	}
	for(i=0;i<=strlen(s)-strlen(t);i++)
	{
		cishu=0;
		strcpy(ans,s);
		for(j=0;i+j<strlen(s),j<strlen(t);j++)
		{
			if((ans[i+j]==t[j])||(ans[i+j]=='?'))
			{
				if((ans[i+j]=='?')&&(t[j]!='a'))
					cishu++;
				ans[i+j]=t[j];
			}
			else
				break;
		}
		if(j==strlen(t))
		{
			for(n=0;n<strlen(s);n++)
			{
				if(ans[n]=='?')
					ans[n]='a';
			}
			if(cishu<=min)
			{
				min=cishu;
				strcpy(ans1,ans);
			}
		}
	}
	if(min!=100)
		printf("%s\n",ans1);
	else
		printf("UNRESTORABLE\n");
	return 0;
}

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

int int_sort(const void *a, const void *b)
{
	if ( *(int *)a > *(int *)b){
		return -1;
	}
	else if (*(int *)a == *(int *)b){
		return 0;
	}
	
	return 1;
}

int main(void)
{
	float kiji, topping;
	float cal[100], kiji_cal;
	float cal_sum, dollar_sum;
	float dollars_cal;
	float tmp;
	int i, j, k;
	int ans;
	
	scanf("%d", &k);
	scanf("%f%f", &kiji, &topping);
	scanf("%f", &kiji_cal);
	
	
	for (i = 0; i < k; i++){
		scanf("%f", &cal[i]);
	}
	
	qsort(cal, k, sizeof(int), int_sort);
		
	cal_sum = kiji_cal;
	dollar_sum = kiji;
	dollars_cal = cal_sum / dollar_sum;
	
	for (i = 0; i <  k; i++){
		cal_sum += cal[i];
		dollar_sum += topping;	
		tmp = cal_sum / dollar_sum;
		if (tmp > dollars_cal){
			dollars_cal = tmp;
		}
	}
	ans = dollars_cal;
	
	printf("%d\n", ans);
	
	return (0);
}

Measured memory_bytes: 632
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = 1000000007;
using Graph = vector<vector<int>>;

signed main() {
  int H, W, A, B;
  cin >> H >> W >> A >> B;
  
  for( int i = 0; i < H; i++ ){
    for( int j = 0; j < W; j++ ){
      if( j < A ){
        if( i < B ) cout << 0;
        else cout << 1;
      }else{
        if( i < B ) cout << 1;
        else cout << 0;
      }
    }
    cout << endl;
  }
}


Measured memory_bytes: 1280
ans = [0, 0]

S = input()

colorA = ['0', '1']
colorB = ['1', '0']
idx = 0

for s in S:
    if colorA[idx] != s:
        ans[0] += 1
    if colorB[idx] != s:
        ans[1] += 1
    idx = (idx+1) % 2

print(min(ans))


Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define rush() int T;scanf("%d",&T);while(T--)
#define mm(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define sc(a) scanf("%d",&a)
#define sc2(a,b) scanf("%d%d",&a,&b)
#define pf(a) printf("%d\n",a)
#define pf2(a,b) printf("%d %d\n",a,b)
#define p_f(a) printf("%d ",a)
#define fi first
#define se second
#define db double
#define ll long long
using namespace std;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
const db eps=1e-9;
const int N=2e5+5;
const int P=998244353;
pii robs[N];
int n,cop[N],ner[N];
ll dp[N],sum[N],bb[N];
struct eff{
    int l,r,id;
    bool operator < (const eff a)const{
        return id<a.id;
    }
};
priority_queue<eff>q;
int findd(int x){return upper_bound(cop+1,cop+n+2,x)-cop;}
int main()
{
    sc(n);
    rep(i,1,n)sc2(robs[i].fi,robs[i].se);
    sort(robs+1,robs+n+1);
    rep(i,1,n)cop[i]=robs[i].fi;
    cop[n+1]=inf;
    rep(i,1,n){
        while(!q.empty()){
            auto u=q.top();
            if(i>u.r)q.pop();
            else if(i>=u.l&&i<=u.r&&!ner[i]){
                ner[i]=u.id;
                break;
            }else break;
        }
        int nx=robs[i].fi+robs[i].se-1,pos=findd(nx);
        q.push({i+1,pos-1,i});
    }
    bb[1]++;sum[0]=1;dp[0]=1;
    rep(i,1,n){
        bb[i]=(bb[i]+bb[i-1])%P;
        dp[i]=(dp[i]+bb[i])%P;
        if(ner[i]>0)dp[i]=((dp[i]-sum[ner[i]-1])%P+P)%P;
        bb[i+1]=(bb[i+1]+dp[i])%P;
        sum[i]=(dp[i]+sum[i-1])%P;
        //cout<<dp[i]<<" "<<sum[i]<<endl;
    }
    cout<<sum[n]<<endl;
    return 0;
}


Measured memory_bytes: 11248
#include<bits/stdc++.h>
using namespace std;
int main() {
  string s; cin >> s;
  string t = "CODEFESTIVAL2016";
  int cnt = 0;
  for (int i = 0; i < 16; i++) {
    if (s[i] != t[i]) cnt++;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  int x,t;
  cin >> x >> t;
  cout << max(x-t,0) << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

struct Door{
	Door(){
		to = -1;
	}
	Door(int arg_to){
		to = arg_to;
	}
	int to;
};

struct Node{
	Node(){
		dist_from_start = next_open_door = -1;
	}

	int dist_from_start,next_open_door;
	Door to_parent;
	vector<Door> children;
};

Node nodes[1000];

int bug_count = 0;

void func(){

	bug_count++;

	for(int i = 0; i < 1000; i++){
		nodes[i].children.clear();
		nodes[i].next_open_door = 0;
		nodes[i].to_parent.to = -1;
	}

	int index = 0;

	int tmp;
	int pre_room = -2;

	int debug = 0;

	while(true){
		scanf("%d",&tmp);
		if(tmp == 0)break;

		debug++;

		if(tmp > 0){

			nodes[index].to_parent.to = pre_room;

			if(pre_room != -2){

				for(int i = 0; i < tmp-1; i++){
					nodes[index].children.push_back(Door(-1));
				}

				nodes[pre_room].children[nodes[pre_room].next_open_door++].to = index;
				nodes[index].dist_from_start = nodes[pre_room].dist_from_start+1;
			}else{

				for(int i = 0; i < tmp; i++){
					nodes[index].children.push_back(Door(-1));
				}

				nodes[index].dist_from_start = 0;
			}

			if(tmp > 1){
				pre_room = index;
			}else{

				while(pre_room != 0 && nodes[pre_room].next_open_door >= nodes[pre_room].children.size()){
					pre_room = nodes[pre_room].to_parent.to;
				}
			}
			index++;


		}else{

			for(int i = index-1; i >=0 ; i--){
				if(nodes[i].dist_from_start-nodes[pre_room].dist_from_start == tmp && nodes[i].next_open_door < nodes[i].children.size()){

					nodes[pre_room].children[nodes[pre_room].next_open_door++].to = i;
					nodes[i].children[nodes[i].next_open_door++].to = pre_room;

					if(nodes[pre_room].next_open_door >= nodes[pre_room].children.size()){

						pre_room = nodes[pre_room].to_parent.to;

						while(pre_room != 0 && nodes[pre_room].next_open_door >= nodes[pre_room].children.size()){
							pre_room = nodes[pre_room].to_parent.to;
						}
						break;
					}else{
						//Do nothing
					}
					break;
				}
			}
		}
	}

	vector<int> work;

	for(int i = 0; i < index; i++){
		printf("%d",i+1);

		if(i != 0)work.push_back(nodes[i].to_parent.to+1);

		for(int k = 0; k < nodes[i].children.size(); k++){
			work.push_back(nodes[i].children[k].to+1);
		}

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

		for(int k = 0; k < work.size(); k++){
			printf(" %d",work[k]);
		}
		printf("\n");

		work.clear();
	}

}

int main(){

	int N;
	scanf("%d",&N);

	for(int i = 0; i < N; i++)func();

	return 0;
}

Measured memory_bytes: 3136
#include <iostream>
#include <vector>
#include <chrono>
#include <random>
#include <cassert>

std::mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count());

int main() {
	std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);
	int a[5];
	for(int i = 0; i < 5; i++) {
		std::cin >> a[i];
	}
	for(int i = 1; i <= 5; i++) {
		bool valid = false;
		for(int j = 0; j < 5; j++) {
			if(a[j] == i) valid = true;
		}
		if(!valid) {
			std::cout << i << '\n';
		}
	}
}

Measured memory_bytes: 3652
#include <algorithm>
#include <array>
#include <cmath>
#include <deque>
#include <iostream>
#include <set>
#include <string>

using namespace std;

int main() {
  int k, a, b;

  cin >> k >> a >> b;

  bool flag = false;

  for (int i = a; i <= b; i++) {
    if (i % k == 0) {
      cout << "OK" << endl;
      flag = true;
      break;
    }
  }

  if (!flag) {
    cout << "NG" << endl;
  }

  return 0;
}

Measured memory_bytes: 3160
#include<bits/stdc++.h>
using namespace std;
int cnt = 0;
void insertion_sort(vector<int> &A, int n, int g){
    for(int i = g; i <n;i++){
        int v = A[i];
        int j = i - g;
        while(j >= 0 && A[j] > v){
            A[j + g] = A[j];
            j -= g;
            cnt++;
        }
        A[j + g] = v;
    }
}

void shell_sort(vector<int> &A, int n){
    int r= 1;
vector<int> G;
  while(r <= n){
    G.push_back(r);
    r *= 2;
  }
  int m = G.size();
  reverse(G.begin(),G.end());
  cout << m << endl;
  for(int i = 0; i < m; i++){
      cout << G[i] << " \n" [i == m - 1];
  }
  for(int i = 0; i < m; i++)
  insertion_sort(A,n,G[i]);
 cout << cnt << endl;
 }
 int main(){
     int n;
     cin >> n;
     vector<int> A(n);
     for(int i = 0; i < n; i++){
         cin >> A[i];
     }
     shell_sort(A,n);
     for(int i = 0; i < n; i++)
     cout << A[i] << endl;
 }


Measured memory_bytes: 6800
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
typedef pair<int,int> P;
const int inf=1000000000000000007;
const int MOD=1000000007;
int Smod(string const& s,int m){
  int res=s[0]-'0';
  int n=s.length();
  for(int i=1;i<n;++i){
    res=res*10+s[i]-'0';
    res%=m;
  }
  return res;
}
struct Node{
  int no;
  int par;
  int dist;
  vector<Node*> child;
  void build(int i){
    no=i;par=i;dist=inf;
  }
};
signed main(){
  int n,a;cin>>n;
  a=1;
  string s;cin>>s;
  vector<int> b(n+1);
  int ind=0;
  vector<Node> node(n+1);
  rep(i,n+1)node[i].build(i);
  rep1(i,n){
    cin>>b[i];
    node[i].child.push_back(&node[b[i]]);
  }
  node[a].dist=0;
  if((int)s.length()<18){
    int k=stol(s);
    if(k>n){
      Node cur=node[a];
      k-=n;
      int c=inf;
      rep(i,n){
        if(cur.child[0]->dist!=inf){
          c=cur.dist+1-cur.child[0]->dist;
        }
        cur.child[0]->dist=cur.dist+1;
        cur=*cur.child[0];
      }
      k%=c;
      rep(i,k){
        cur=*cur.child[0];
      }
      cout<<cur.no<<"\n";
    }
    else{
      Node cur=node[a];
      rep(i,k){
        cur=*cur.child[0];
      }
      cout<<cur.no<<endl;
    }
  }
  else{
    if(true){
      node[a].dist=0;
      Node cur=node[a];
      int c=inf;
      rep(i,n){
        if(cur.child[0]->dist!=inf&&c==inf){
          c=cur.dist+1-cur.child[0]->dist;
        }
        cur.child[0]->dist=cur.dist+1;
        cur=*cur.child[0];
      }
      int k=Smod(s,c);
      k-=n;
      while(k<0){
        k+=c;
      }
      rep(i,k){
        cur=*cur.child[0];
      }
      //cout<<c<<endl;
      cout<<cur.no<<"\n";
    }
  }
  return 0;
}

Measured memory_bytes: 20420
#include <stdio.h>
#include <stdlib.h>

#define ll long long
#define ARR_SIZE 210000
#define MOD ((ll)1e9 + 7)

typedef struct __node__ {
    int data;
    struct __node__ *next;
} Node;

int main(){
    int n, m, a[ARR_SIZE] = {}, b[ARR_SIZE] = {};
    scanf("%d %d", &n, &m);
    for(int i=0;i<m;i++) scanf("%d %d", a+i, b+i);
    // end input

    Node* room[ARR_SIZE];
    for(int i=1;i<=n;i++) room[i] = NULL;

    for(int path=0;path<m;path++){
        Node* p0 = calloc(1, sizeof(Node));
        p0->data = a[path];
        p0->next = room[b[path]];
        room[b[path]] = p0;

        Node* p1 = calloc(1, sizeof(Node));
        p1->data = b[path];
        p1->next = room[a[path]];
        room[a[path]] = p1;
    }

    int next_room[ARR_SIZE] = {0,1};
    int child_room[ARR_SIZE] = {1};
    int child_room0[ARR_SIZE] = {};
    int num_children = 1;
    int num_children0 = 0;

    if(room[1]==NULL){
        printf("No\n");
        return 0;
    }
    
    while(num_children>0){
        for(int i=0;i<num_children;i++){
            int parent_room = child_room[i];

            Node* ptr = room[parent_room];
            while(ptr!=NULL){
                int data = ptr->data;
                if(next_room[data]>0){
                    ptr = ptr->next;
                    continue;
                }
                next_room[data] = parent_room;
                child_room0[num_children0] = data;
                num_children0 += 1;
                ptr = ptr->next;
            }
        }

        num_children = num_children0;
        for(int j=0;j<num_children;j++){
            child_room[j] = child_room0[j];
        }
        num_children0 = 0;
    }

    int count = 0;
    for(int r=2;r<=n;r++){
        if(next_room[r]==0){
            printf("No\n");
            return 0;
        }
    }
    
    
    printf("Yes\n");
    for(int r=2;r<=n;r++){
        printf("%d\n", next_room[r]);
    }


    return 0;
}




Measured memory_bytes: 19048
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define db long double
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()

void dout() { cerr << '\n'; }

template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << " " << H;
    dout(T...);
}

#ifdef LOCAL
    #define dbg(...) cerr << #__VA_ARGS__, dout(__VA_ARGS__)
#else
    #define dbg(...) ;
#endif

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair <int, int> pii;

const int N = 2007;
int n, m, adj[N][N], good[N][N];
int f[N][N], l[N][N], r[N][N];

int main() {
    ios_base::sync_with_stdio(false), cin.tie(NULL);
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
    #endif

    cin >> n >> m;
    char ch;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            cin >> ch;
            if (ch == '.') {
                adj[i][j] = 1;
            }
        }
    }
    for (int i = 1; i < n; i++) {
        for (int j = 1; j < m; j++) {
            good[i][j] = 1;
            if (adj[i][j] ^ adj[i][j + 1] ^ adj[i + 1][j] ^ adj[i + 1][j + 1]) {
                good[i][j] = 0;
            }
        }
    }
    for (int j = 1; j < m; j++) {
        for (int i = 1; i < n; i++) {
            if (good[i][j]) {
                f[i][j] = f[i - 1][j] + 1;
            }
        }
    }
    stack <int> st;
    int ans = max(n, m);
    for (int i = 1; i < n; i++) {
        for (int j = 1; j < m; j++) {
            while (!st.empty() && f[i][st.top()] >= f[i][j]) {
                st.pop();
            }
            if (st.empty()) {
                l[i][j] = 1;
            }   else {
                l[i][j] = st.top() + 1;
            }
            st.push(j);
        }
        while (!st.empty()) {
            st.pop();
        }
        for (int j = m - 1; j >= 1; j--) {
            while (!st.empty() && f[i][st.top()] >= f[i][j]) {
                st.pop();
            }
            if (st.empty()) {
                r[i][j] = m - 1;
            }   else {
                r[i][j] = st.top() - 1;
            }
            st.push(j);

            ans = max(ans, (r[i][j] - l[i][j] + 2) * (f[i][j] + 1));
        }
        while (!st.empty()) {
            st.pop();
        }
    }
    cout << ans;
}


Measured memory_bytes: 78848
n = int(input())
s = [input() for i in range(n)]

from collections import Counter
cnt = Counter(s)

if 'AC' in cnt:
    print('AC x ' + str(cnt['AC']))
else:
    print('AC x 0')
if 'WA' in cnt:
    print('WA x ' + str(cnt['WA']))
else:
    print('WA x 0')
if 'TLE' in cnt:
    print('TLE x ' + str(cnt['TLE']))
else:
    print('TLE x 0')
if 'RE' in cnt:
    print('RE x ' + str(cnt['RE']))
else:
    print('RE x 0')

Measured memory_bytes: 16536
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 200005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
        if(c == '-') f = -1;
        c = getchar();
    }
    while(c >= '0' && c <= '9') {
        res = res * 10 +c - '0';
        c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
        out(x / 10);
    }
    putchar('0' + x % 10);
}
int A,B,C;
void Solve() {
    read(A);read(B);read(C);
    if(A == B && B == C) puts("Yes");
    else puts("No");
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}


Measured memory_bytes: 256
A, B, C = map(int, input().split())

if (A == 5 or A == 7) & (B == 5 or B == 7) & (C == 5 or C == 7):
    if (A + B + C) == 17:
        print('YES')
    else:
        print('NO')
else:
    print('NO')

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, n) for (int i = 1; i <= (int)(n); i++)
#define ll long long
#define umap unordered_map
using graph = vector<vector<int>>;
using graph2 = vector<vector<pair<int, int>>>;

ll mod(ll x, ll y){if(x>=0||x%y==0) return x%y;return y+x%y;} //mod including minus
ll dv0(ll x, ll y){if(x>=0||x%y==0)return x/y;return x/y-1;} //rnd down
ll dv1(ll x, ll y){if(x%y==0) return dv0(x,y);return dv0(x,y)+1;} //rnd up
ll M=1e9+7;
int quick_pow(int x,int p){
    int a=1,po=x;
    while(p){
        if(p&1)  a=1ll*a*po%M;
        po=1ll*po*po%M;p>>=1;
    }
    return a;
}
//Start from Here
int main(){
    double R;
    cin>>R;
    printf("%.8lf\n", 2*3.14159265358979*R);
}

Measured memory_bytes: 3796
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i) sort((i).begin(),(i).end(), greater<int>());
#define F first
#define S second
constexpr auto INF = 1000000000;
constexpr auto LLINF = 9223372036854775807;
constexpr auto mod = 1000000007;
int main() {

	int n, m;
	cin >> n >> m;
	vector<pair<int, int>> a(m);
	FOR(i, m)cin >> a[i].second >> a[i].first;
	SORT(a);
	int last = -1, cnt = 0;
	FOR(i, m) {
		if (last >= a[i].second)continue;
		cnt++;
		last = a[i].first - 1;
	}
	cout << cnt << endl;

	return 0;
}


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

bool isMonth(char n1, char n2){
        if(n1 == '0'){
                if(n2 == '0') return false;
                else return true;
        }else if(n1 == '1'){
                if(n2 == '0' or n2 == '1' or n2 == '2')
                        return true;
                else return false;
        }else
                return false;
}

int main(){
        char S[4];
        cin >> S;
        if(isMonth(S[0],S[1])){
                if(isMonth(S[2],S[3]))
                        cout << "AMBIGUOUS";
                else cout << "MMYY";
        }else{
                if(isMonth(S[2],S[3]))
                        cout << "YYMM";
                else cout << "NA";
        }
        cout << endl;
        return 0;
}

Measured memory_bytes: 256
#pragma region kyomukyomupurin

/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-06-02 14:33:25
 **/

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

using int64 = long long;

template <class T>
using binary_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

#if __cplusplus >= 201703L
template <class Ch, class Tr, class Tuple, std::size_t... Is>
void tuple_out(std::basic_ostream<Ch, Tr>& os, const Tuple& tp, std::index_sequence<Is...>) {
  ((os << (Is ? ", " : "(") << std::get<Is>(tp)), ...) << ")";
}

template <class Ch, class Tr, class... Args>
auto& operator<<(std::basic_ostream<Ch, Tr>& os, const std::tuple<Args...>& tp) {
  tuple_out(os, tp, std::index_sequence_for<Args...>{});
  return os;
}
#endif

template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  int n = 0;
  for (auto e : vec) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T, class Compare>
std::ostream& operator<<(std::ostream& os, const std::set<T, Compare>& st) {
  int n = 0;
  for (auto e : st) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T, class U, class Compare>
std::ostream& operator<<(std::ostream& os, const std::map<T, U, Compare>& mp) {
  int n = 0;
  for (auto e : mp) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

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

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

#pragma endregion kyomukyomupurin

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

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

  sort(a.begin(), a.end());
  sort(b.begin(), b.end());

  if (n & 1) {
    cout << b[n / 2] - a[n / 2] + 1 << endl;
  } else {
    int mid_a1 = a[n / 2 - 1], mid_a2 = a[n / 2];
    int mid_b1 = b[n / 2 - 1], mid_b2 = b[n / 2];
    int ma = (mid_a1 + mid_a2);
    int mb = (mid_b1 + mid_b2);
    cout << mb - ma + 1 << endl;
  }

  return 0;
}


Measured memory_bytes: 4748
package main

import (
	"fmt"
)

func main() {
	var s,t string
	fmt.Scan(&s,&t)
	
	for i := 0; i < len(s); i++ {
		//fmt.Println(s)
		if s == t {
			fmt.Println("Yes")
			return
		}
		s = s[len(s)-1:] + s[0:len(s)-1]
	}
	fmt.Println("No")
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> V;

int gcd(int m, int n) {
  if (n == 0) return abs(m);
  else return gcd(n, m%n);
}

int main() {
  int n, k;
  cin >> n >> k;
  V a(n);
  for (auto &v : a) cin >> v;
  sort(a.begin(), a.end());
  if (k > a.back()) dump("IMPOSSIBLE");
  else {
    int g = a.front();
    for (int i = 1; i < n; i++) {
      g = gcd(max(g, a[i]), min(g, a[i]));
    }
    k%g == 0 ? dump("POSSIBLE") : dump("IMPOSSIBLE");
  }
  return 0;
}


Measured memory_bytes: 640
main(p,q,l){for(;~scanf("%d%d",&p,&q);){int r[1000000]={l=1};for(;!r[p%=q];putchar(p/q+48))r[p]=l++,p*=10;puts("");if(p)for(;l;)putchar(--l?--r[p]>0?32:94:10);}}

Measured memory_bytes: 0
#include <iostream>

using namespace std;

int main(void) {
  int a, b;

  cin >> a;
  cin >> b;

  if (a + b == 15) {
    cout << "+";
  } else if (a * b == 15) {
    cout << "*";
  } else {
    cout << "x";
  }

  cout << endl;

  return 0;
}

Measured memory_bytes: 256
//最終的に0か１のいずれかのみが並ぶor0個
//少ない方は全部消える、同じ数だけ1も消える
//しゅうりょう

#include <iostream>
#include <string>

using namespace std;

int main(){
  
  string c;
  cin >> c;
  
  int n = (int)c.size();
  
  int a=0;
  int b=0;
  
  for(int i=0;i<n;i++){
    if(c[i] == '0') a += 1;
    else b += 1;}
  
  cout << min(a,b)*2;
  
  
}
  
  
    

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

int main() {
    int N;
    int count=0;
    int a,b;
    int num2[10][10]={0};
    int ans=0;
  	int i,j;
    scanf("%d",&N);

    for(int i=1; i<=N; i++){
            a=i%10;//末尾の取得
      		b=i;
            while(b>=10){//先頭の取得
                b/=10;
            }
            num2[b][a]++;
    }

    //i=0;j=0でも可
     for(i=1; i<10; i++){
        for(j=1; j<10; j++){
           ans+=num2[i][j]*num2[j][i];
        }
    }
    printf("%d\n",ans);
}


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

#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int a, b, c;
    cin >> a >> b >> c;

    if(a==b) cout << c;
    else if(a==c) cout << b;
    else if(b==c) cout << a;
    return 0;
}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    long long a[100005], b[100005];
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
    }
    long long sum = 0;
    for (int i = n - 1; i >= 0; i--) {
        a[i] += sum;
        a[i] %= b[i];
        if (a[i])
            sum += b[i] - a[i];
    }
    cout << sum;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#define Endl endl
#define mp make_pair
#define rep(N) for(int i=0;i<N;i++)
#define repj(N) for(int j=0;j<N;j++)
#define ll long long 
#define pii pair<int,int>
#define pll pair<ll,ll>
#define For(I,N) for(int I=0;I<N;I++)
#define cinone(N) int N;cin>>N;
#define scanfone(N) int N;cin>>N;
#define cinng(N,M) int N[M];for(int yiuytvnm=0;yiuytvnm<M;yiuytvnm++) cin>>N[yiuytvnm];
#define scanfng(N,M) int N[M];for(int qrwuoiq=0;qrwuoiq<M;qrwuoiq++) scanf("%d",&N[qrwuoiq]);
#define over(A) {cout<<A<<endl;exit(0);}
typedef unsigned long long ull;
const int inf=103974182;
using namespace std;
pii a[105],b[105];
bool use[105];

int main()
{
//	freopen("input.txt","r",stdin);
	int n;
	cin>>n;
	rep(n)
	{
		cin>>a[i].first>>a[i].second;
	}
	rep(n)
	{
		cin>>b[i].first>>b[i].second;
	}
	sort(a,a+n);
	sort(b,b+n);
	int i=0,j,r=0;
	int res=0;
	for(j=0;j<n;j++)
	{
		while(a[r].first<b[j].first)
		{
			r++;
			if(r>=n) break;
		}
		if(r>=n) r=n;
		int maxk=-1;
		int maxn=-1;
		for(int k=0;k<r;k++)
		{
			if(use[k]) continue;
			if(a[k].second>maxn && a[k].second<b[j].second) maxn=a[k].second,maxk=k;
		}
		if(maxk==-1) continue;
		res++;
		use[maxk]=true;
	}
	cout<<res<<Endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1LL << 30;

int main(){
  double L;
  cin >> L;
  cout << fixed << setprecision(10);
  cout << L/3 * L/3 * L/3 << endl;
}

Measured memory_bytes: 256
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    int a, b, c;
    a = sc.nextInt();
    b = sc.nextInt();
    c = sc.nextInt();

    if(a < b && b < c){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
/*fin*/
    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}

Measured memory_bytes: 17352
function main(lines) {
  const input = lines.split('\n')
  
  let AC = 0;
  let WA = 0;
  let TLE = 0;
  let RE = 0;
  
  for(let i=1; i<input.length; i++){
      if(input[i] === 'AC') AC++
      if(input[i] === 'WA') WA++
      if(input[i] === 'TLE') TLE++
      if(input[i] === 'RE') RE++
  }
  console.log('AC' + ' x ' + AC)
  console.log('WA' + ' x ' + WA)
  console.log('TLE' + ' x ' + TLE)
  console.log('RE' + ' x ' + RE)
}

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


Measured memory_bytes: 37320
import heapq
X,Y,Z,K=map(int,input().split(' '))
A=sorted(list(map(int,input().split(' '))))[::-1]
B=sorted(list(map(int,input().split(' '))))[::-1]
C=sorted(list(map(int,input().split(' '))))[::-1]

default=A[0]+B[0]+C[0]
A=[A[0]-A[i] for i in range(len(A))]
B=[B[0]-B[i] for i in range(len(B))]
C=[C[0]-C[i] for i in range(len(C))]

print(default)
hp=[]
visited=set()
visited.add((0,0,0))
a,b,c=0,0,0
for _ in range(K-1):
  if (a+1,b,c) not in visited and a+1<len(A):
    heapq.heappush(hp,(A[a+1]+B[b]+C[c],(a+1,b,c)))
    visited.add((a+1,b,c))
  if (a,b+1,c) not in visited and b+1<len(B):
    heapq.heappush(hp,(A[a]+B[b+1]+C[c],(a,b+1,c)))
    visited.add((a,b+1,c))
  if (a,b,c+1) not in visited and c+1<len(C):
    heapq.heappush(hp,(A[a]+B[b]+C[c+1],(a,b,c+1)))
    visited.add((a,b,c+1))
  temp=heapq.heappop(hp)
  print(default-temp[0])
  a,b,c=temp[1]

Measured memory_bytes: 5104
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define ARB ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define bp  __builtin_popcount
using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;
const int maxn=1e5+5;
const  double EPS = 1e-14;

int main()
{
    int k,s,cnt=0;
    cin>>k>>s;
    for(int i=0; i<=k; i++)
    {
        for(int j=0; j<=k; j++)
        {
            int z=s-i-j;
             if(z>=0 && z <= k)
                 cnt++;
        }
    }
    cout<<cnt;
}


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

int main(){
    int k , n;
    cin >> k >> n;
    vector<int> a(n);
    int max = 0;
    int l;
    rep(i ,n) cin >> a[i];
    int i = 0;
    while(i < n){
        l = 0;
        if( i == n-1){
            l = k - a[n-1];
            l += a[0];
            if( max < l) max = l;
            ++i;
        } else 
        l = a[i+1]-a[i];
        if( max < l) max = l;
        ++i;
    }
    cout << k - max << endl;
}

Measured memory_bytes: 1024
def digit_sum(n:int) -> int:
    res = n
    ans = 0
    while res > 0:
        ans = ans + res%10
        res //= 10
    
    return ans

def keta(n:int) -> int:
    res = n
    ans = 0
    while res > 0:
        ans += 1
        res //= 10
    return ans

n = int(input())
n_keta = keta(n)

ans = 0
if n % 10**(n_keta-1) == 10**(n_keta-1) - 1:
    ans = digit_sum(n)
    
else:
    ans = n // 10**(n_keta-1) - 1
    ans += 9 * (n_keta-1)
    
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll          long long
#define pb          push_back
#define INF         9223372036854775807
#define    endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define lower(u)    transform(u.begin(), u.end(), u.begin(), ::tolower);//convert string u to lowercase;
#define upper(u)    transform(u.begin(), u.end(), u.begin(), ::toupper);
using namespace std;

using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define N  100005

void solve()
{
    ll l,r,d;
    cin>>l>>r>>d;
    ll ans=r/d-(l-1)/d;
    cout<<ans<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int TESTS=1;
//    cin>>TESTS;
    while(TESTS--)
    {
        solve();
    }
    return 0;
}

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

int main()
{
	int n;
	cin >> n;
	vector<long double> ps(n);
	for (auto &p : ps)
	{
		cin >> p;
	}
	vector<vector<long double>> dp(n + 1, vector<long double>(n + 1, 0));
	dp[0][0] = 1;
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j <= i; j++)
		{
			//omote
			dp[i + 1][j + 1] += dp[i][j] * ps[i];
			//ura
			dp[i + 1][j] += dp[i][j] * (1 - ps[i]);
		}
	}
	long double ans = 0;
	for (int j = (n + 1) / 2; j <= n; j++)
	{
		ans += dp[n][j];
	}
	cout << fixed << setprecision(20) << ans << endl;
	return 0;
}

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

int main()
{
    int n, l;
    cin>>n>>l;
    int a[n+1];
    int p = 0, ne = 0, z = 0;
    int sum = 0;
    int mini = INT_MAX;
    map<int, int> flg;
    int res; 

    for(int i =1;i<=n;i++)
    {
        a[i] = l+i-1;
        if(a[i]==0)
            z++;

        if(a[i]>0)
            p++;

        sum+=a[i];
        //int d = mini;
        int ori = a[i];
        int pos = abs(a[i]);
        mini = min(mini, pos);
        if(mini == pos)
            res = ori;
        //cout<<a[i]<<" ";
    }
   // cout<<endl;
    //sort(a, a+n+1);
    //cout<<sum<<endl;
    if(z)
    {
        cout<<sum<<"\n";
        return 0;
    }
    else
    {
        return cout<<sum - res, 0;
    }


    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
using namespace std;
 
int main(){
int a,b,r,d;
double f;
 
cin >> a >> b;
 
d= a/b;
r= a%b;
f= 1.0 * a / b ;
 
printf("%d %d %.5lf\n", d,r,f);
 
return 0;
}


Measured memory_bytes: 3232
import itertools

n, m, q = map(int, input().split())
abcd_array = [list(map(int, input().split())) for _ in range(q)]

def get_sum(A, abcd_array):
    sum = 0
    for abcd in abcd_array:
        a, b, c, d = abcd
        if A[b-1] - A[a-1] == c:
            sum += d
    return sum

candidate_array = list(itertools.combinations_with_replacement(range(1,m+1), n))
ans = 0
for A in candidate_array:
    ans = max(ans, get_sum(A, abcd_array))

print(ans)

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

using namespace std;

int main( ) {
    ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t;
	char ch;
	t = 1;
	while(t--) {
	 cin >> ch;
	 if(ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' )
	  cout << "vowel" << endl;
	 else
	  cout << "consonant" << endl;
	}
	return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();

		if (N < 1000){
			System.out.println("ABC");
		} else {
			System.out.println("ABD");
		}
		

	}
}

Measured memory_bytes: 21588