akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define VAR(v, i) __typeof(i) v=(i)
#define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define all(v) (v).begin(),(v).end()
 
#define PII pair<int,int>
#define mp make_pair
#define st first
#define nd second
#define pb push_back
#define lint long long int
#define VI vector<int>
 
#define debug(x) {cerr <<#x <<" = " <<x <<endl; }
#define debug2(x,y) {cerr <<#x <<" = " <<x << ", "<<#y<<" = "<< y <<endl; } 
#define debug3(x,y,z) {cerr <<#x <<" = " <<x << ", "<<#y<<" = "<< y << ", " << #z << " = " << z <<endl; } 
#define debugv(x) {{cerr <<#x <<" = "; FORE(itt, (x)) cerr <<*itt <<", "; cerr <<endl; }}
#define debugt(t,n) {{cerr <<#t <<" = "; FOR(it,0,(n)) cerr <<t[it] <<", "; cerr <<endl; }}
 
#define make( x) int (x); scanf("%d",&(x));
#define make2( x, y) int (x), (y); scanf("%d%d",&(x),&(y));
#define make3(x, y, z) int (x), (y), (z); scanf("%d%d%d",&(x),&(y),&(z));
#define make4(x, y, z, t) int (x), (y), (z), (t); scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define makev(v,n) VI (v); FOR(i,0,(n)) { make(a); (v).pb(a);} 
#define IOS ios_base::sync_with_stdio(0)
#define HEAP priority_queue
 
#define read( x) scanf("%d",&(x));
#define read2( x, y) scanf("%d%d",&(x),&(y));
#define read3(x, y, z) scanf("%d%d%d",&(x),&(y),&(z));
#define read4(x, y, z, t) scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define readv(v,n) FOR(i,0,(n)) { make(a); (v).pb(a);}
 
 
using namespace std;

const int max_n = 1e6 + 10;
int n, C;
int mod = 1e9 + 7;

VI prod(VI v1, VI v2) {
	VI ans(C+1, 0);
	FOR(i,0,C+1) {
		FOR(j,0,i+1) {
			ans[i] += (v1[j] * 1LL * v2[i-j]) % mod;
			if (ans[i] >= mod) ans[i] -= mod;
		}
	}
	return ans;
}


int main() {
	read2(n, C);
	makev(A, n);
	makev(B, n);
	VI w(C+1,0);
	w[0] = 1;
	FOR(i,0,n) {
		VI v; 
		VI pows;
		FOR(j,A[i],B[i]+1) pows.pb(1);
		FOR(j,0,C+1) {
			int sum = 0;
			FORE(u, pows) sum = (sum + *u) % mod;
			v.pb(sum);
			FOR(u,A[i], B[i]+1) {
				pows[u-A[i]] = ((pows[u-A[i]]) * 1LL * u)%mod;
			}
		}
		w = prod(w, v);
	}
	printf("%d\n", w[C]);
}

Measured memory_bytes: 256
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
#include <random>

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

const int L=2e5+10;
const LL M=1e9+7;
int C[L];
int pre[L];
LL dp[L];
int main() {
	int N;
	cin >> N;
	dp[0]=1;
	for(int i=1;i<=N;i++)
	{
		int c;
		cin >> c;
		if(pre[c]>0&&pre[c]!=i-1)
		{
			dp[i]=dp[i-1]+dp[pre[c]];
			dp[i]%=M;
		}
		else{
			dp[i]=dp[i-1];
		}
		//cerr << i << ", " << dp[i] << endl;
		pre[c]=i;
	}
	cout << dp[N] << endl;



	return 0;
}



Measured memory_bytes: 3192
import itertools
import math
N = int(input())

xy = [list(map(int, input().split())) for i in range(N)]

path = []
for l in itertools.permutations(xy):
    t = 0
    for i in range(N-1):
        t += math.sqrt((l[i][0] - l[i+1][0]) ** 2 + (l[i][1] - l[i+1][1]) ** 2)
    path.append(t)

print(sum(path)/len(path))

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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<double> vd;
typedef vector<vd> vdd;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define debug_print(x...) cerr << "line " << __LINE__ << " : "; debug_print_in(x);

template <typename First>
void debug_print_in(First first){
  cerr << first << endl;
  return;
}

template <typename First, typename... Rest>
void debug_print_in(First first, Rest... rest){
  cerr << first << " ";
  debug_print_in(rest...);
  return;
}

void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

template <typename First>
void OUT(First first){
  cout << first << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

template<class t, class u> void chmax(t&a,u b){if(a<b)a=b;};
template<class t, class u> void chmin(t&a,u b){if(a>b)a=b;};
int popcount(int t){return __builtin_popcount(t);} //GCC
int popcount(ll t){return __builtin_popcountll(t);} //GCC

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cerr << VEC[i] << " ";
  }
  cerr << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i,MAT.size()){
    REP(j,MAT[i].size()){
      cerr << MAT[i][j] << " ";
    }
    cerr << endl;
  }
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  string S;
  IN(S);
  if(S=="AAA" || S=="BBB"){
    printf("No\n");
  }else{
    printf("Yes\n");
  }

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <unordered_map>
#include <random>
#include <cstdio>
#include <cstring>
#include <cmath>

using namespace std;
using ll = long long;

ll A, B, C;

void input() {
    cin >> A >> B >> C;
}

ll solve() {
    if (A + B >= C) {
        return B + C;
    } else {
        return min(C, A + B + 1) + B;
    }
}


int main() {
    input();
    cout << solve() << endl;;
    
    return 0;
}



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

int main(){
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    if(a + b >= k) cout << min(a, k) << endl;
    else{
        k = k - a - b;
        cout << a - k << endl;
    }
    return 0;
}

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

typedef long long ll;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;

typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

#define endl '\n'
#define mod 1000000007
#define PI 3.1415926535897932384626

#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(),x.end()

void io() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
}

int main() {
	io();
	
	ll a;
	float b;
	cin>>a>>b;
	int c=b*100+0.5;
	cout<<a*c/100;
	return 0;
}

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

vector<int> g[205];
bitset<205> vis;
int c[205];

int go(int st, int n) {
    queue<int> q;
    q.push(st);
    bitset<205> vis; vis[st] = 1;
    int cnt = 1;
    while (vis.count() != n) {
        queue<int> nq;
        while (q.size()) {
            int now = q.front(); q.pop();
            for (int i : g[now]) if (!vis[i]) {
                nq.push(i);
                vis[i] = 1;
            }
        }
        ++cnt;
        q = nq;
    }
    return cnt;
}

void dfs(int now, int nc, vector<int> &mm) {
    mm.push_back(now);
    vis[now] = 1;
    c[now] = nc;
    for (int i : g[now]) if (!vis[i]) dfs(i, -nc, mm);
        else if (c[i] == c[now]) {
            cout << -1 << endl;
            exit(0);
        }
}

int calc(vector<int> mm) {
    int mx = 0;
    for (int i : mm) {
        mx = max(mx, go(i, mm.size()));
    }
    return mx;
}

int main() {
    int n; cin >> n; 
    for (int i = 1; i <= n; ++i) for (int j = 1; j <= n; ++j) {
        char c; cin >> c;
        if (c == '1') g[i].push_back(j), g[j].push_back(i);
    }
    vector<vector<int>> gr;
    for (int i = 1; i <= n; ++i) if (!vis[i]) {
        gr.push_back(vector<int>());
        dfs(i, 1, gr.back());
    }
    int mx = 0;
    for (auto &v : gr) mx += calc(v);
    cout << mx << endl;
}


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

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

  vector<int> A(N, 0);
  for (int i = 0; i < N; i++) {
    scanf("%d", &A.at(i));
  }

  vector<int> B(N, 0);
  for (int i = 0; i < N; i++) {
    scanf("%d", &B.at(i));
  }

  vector<int> C(N - 1, 0);
  for (int i = 0; i < N - 1; i++) {
    scanf("%d", &C.at(i));
  }

  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (A.at(i) < N) {
      ans += B.at(A.at(i) - 1);
      if (i < N - 1 && A.at(i + 1) - A.at(i) == 1) {
        ans += C.at(A.at(i) - 1);
      }
    } else {
      ans += B.at(A.at(i) - 1);
    }
  }

  printf("%d", ans);
  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
#define FOR(i,a,b) for(long long int i=a;i<b;i++)
#define sz(s) (long long int)(s).size()
#define pb push_back
#define mp make_pair
const ll inf = 1000000000;
const ll MOD = 1000000007;

int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);   
    cout.tie(NULL);
    register ll i,j,k,x,y,m,n,t,q,temp,sum=0,count=0,f=1;
    ll a, b, c;
    cin>>a>>b>>c>>k;
    if(k >= a){
        sum += a;
        k-= a;
    }else{
        sum += k;
        k = 0;
    }
    if(k >= b){        
        k-= b;
    }else{        
        k = 0;
    }
    if(k >= c){
        sum -= c;
        k-= c;
    }else{
        sum -= k;
        k = 0;
    }
    cout<<sum;
}    
    

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
 
int main()
{
 int K, A, B;
 cin >> K >> A >> B;
 int flag = 0;
 FOR(i,A,B+1){
     if(i%K==0){
         flag = 1;
     }
 }
 if(flag == 1){
     cout << "OK" << endl;
 }else{
     cout << "NG" << endl;
 }
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)x.size())
#define FOR(i,a,b) for (int i=a;i<=b;++i)
#define FORD(i,a,b) for (int i=a;i>=b;--i)
using namespace std;
typedef long long LL;
typedef pair<int,int> pa;
typedef vector<int> vec;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
const int MO=998244353;
int n,a[2000010];
LL f[2000010],fac[2000010],inv[2000010],cnt1[1000010],cnt2[1000010],ans;
LL pw(LL x,LL y){
	LL t=1;
	for (;y;y>>=1){
		if (y&1) t=t*x%MO;
		x=x*x%MO;
	}
	return t;
}
LL C(int x,int y){
	return fac[x]*inv[y]%MO*inv[x-y]%MO;
}
int main(){
	fac[0]=1;
	FOR(i,1,2000000) fac[i]=fac[i-1]*i%MO;
	inv[2000000]=pw(fac[2000000],MO-2);
	FORD(i,1999999,0) inv[i]=inv[i+1]*(i+1)%MO;
	cin>>n;
	FOR(i,1,n) getint(a[i]);
	FOR(i,1,n) (cnt1[a[i]]+=a[i])%=MO,(cnt2[a[i]]+=1ll*a[i]*a[i]%MO)%=MO;
	FOR(i,1,1000000)
		for (int j=2;i*j<=1000000;++j)
			(cnt1[i]+=cnt1[i*j])%=MO,(cnt2[i]+=cnt2[i*j])%=MO;
	FOR(i,1,1000000){
		f[i]=(1ll*cnt1[i]*cnt1[i]-cnt2[i])%MO*inv[2]%MO;
	}
	FORD(i,1000000,1)
		for (int j=i*2;j<=1000000;j+=i)
			(f[i]-=f[j])%=MO;
	FOR(i,1,1000000) (ans+=f[i]*inv[i]%MO*fac[i-1])%=MO;
	ans=(ans%MO+MO)%MO;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 57600
#include <iostream>
#include <algorithm>
#include <vector>
#define ll long long
#define __ ios::sync_with_stdio(0), cin.tie(NULL);
#define endl "\n"
using namespace std;

ll a,b,c,x,ans;

int main(){
	cin >> a >> b >> c >> x;
	for(int i=0; i<=a; i++){
		for(int j=0; j<=b; j++){
			for(int k=0; k<=c; k++){
				if(500*i+100*j+50*k == x) ++ans;
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <numeric>
#include <string>
#include <string.h>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t int64;

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

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


class C {
	string s;
	int k;
public:
	C()
	{
		cin >> s >> k;
	}
	void solve()
	{
		int leadingOnes{ 0 };

		for (; leadingOnes < k && leadingOnes < SZ(s); leadingOnes++)
		{
			if (s[leadingOnes] != '1')
				break;
		}

		if (k <= leadingOnes && leadingOnes)
			cout << 1 << endl;
		else
			cout << s[leadingOnes] << endl;
	}
};


int main()
{
	C solution;
	solution.solve();

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,t;
    cin>>n>>t;
    int k=0,f=0,key=0;
    int x[n],y[n];
    for(int i=0;i<n;i++){
        int a,b;
        cin>>a>>b;
        if(b<=t){
            y[k++]=b;
            x[f++]=a;
        }
        else key++;
    }
    int d=x[0];
    for(int i=1;i<f;i++){
        if(x[i]<d) d=x[i];
    }
    if(key==n)
    cout<<"TLE";
    else cout<<d;
    return 0;
}

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

main(){
    int n, A[1000];
    
    while(1){
        cin >> n;
        if ( n == 0 ) break;
        
        for ( int i = 0; i < n; i++ ) cin >> A[i];
        int sum = 0;
        for ( int i = 0; i < n; i++ ) sum += A[i];
        double avg = 1.0*sum/n;
        double dist = 0.0;
        for ( int i = 0; i < n; i++ ){
            dist += (avg-A[i])*(avg-A[i]);
        }
        
        printf("%lf\n", sqrt(dist/n));
    }
}


Measured memory_bytes: 3140
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

int dp[1000005][2];

void chmin(int& v, int x) {
    v = min(v, x);
}

class EPayment {
public:
    void solve(std::istream& cin, std::ostream& cout) {
        string s;
        cin >> s;

        REP(i, s.size() + 1) REP(j, 2) dp[i][j] = INF;
        dp[0][0] = 0;

        REP(i, s.size()) {
            int n = s[i] - '0';
            chmin(dp[i + 1][0], dp[i][0] + n);
            chmin(dp[i + 1][1], dp[i][0] + 1 + 10 - n);
            chmin(dp[i + 1][1], dp[i][1] + 9 - n);
            chmin(dp[i + 1][0], dp[i][1] + n);
        }
        cout << min(dp[s.size()][0], dp[s.size()][1]) << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    EPayment solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 17052
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <vector>
#include <array>
#include <tuple>
#include <utility>
#include <numeric>
#include <iomanip>
#include <cctype>
#include <cmath>
#include <assert.h>
#include <cstdlib>
#include <list>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using PII = pair<int, int>;
using PLL = pair<ll, ll>;

template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {
    return s << "(" << p.first << ", " << p.second << ")";
}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    s << "[";
    for (int i = 0; i < v.size(); i++) s << (i == 0 ? "" : ", ") << v[i];
    s << "]";
    return s;
}

#define ALL(a) (a).begin(), (a).end()

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

    int N;
    cin >> N;

    map<int, int> counter;
    for (int i = 0; i < N; i++) {
        int D;
        cin >> D;
        counter[D]++;
    }

    int M;
    cin >> M;
    for (int i = 0; i < M; i++) {
        int T;
        cin >> T;

        if (counter[T] == 0) {
            cout << "NO" << endl;
            return 0;
        }
        counter[T]--;
    }
    cout << "YES" << endl;

    return 0;
}


Measured memory_bytes: 9600
#include "bits/stdc++.h"
using namespace std;
typedef long long int lint;
typedef pair<lint, lint> plint;
typedef pair<double long, double long> pld;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
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; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first - r.first, l.second - r.second); }
const lint MOD = 1e9 + 7, INF = 1e18;

string s, t;
int main() {
	cin.tie(0); ios_base::sync_with_stdio(false);
	cin >> s >> t;
	lint cnt = 0;
	REP(i, SZ(s)) {
		if (s[i] != t[i]) cnt++;
	}
	cout << cnt;
}


Measured memory_bytes: 3764
S = input()
N = len(S)

dp = [[0]*2019 for _ in [0]*2]
ans = 0
for i,s in enumerate(S,1):
    s = int(s)
    i %= 2
    dpi = [0]*2019
    dpi1 = dp[1-i]
    dpi[s] += 1
    for j in range(2019):
        dpi[(j*10+s)%2019] += dpi1[j]
    dp[i] = dpi
    ans += dpi[0]

print(ans)


Measured memory_bytes: 80500
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;

ll N, M, S[100000], T[100000], C[100000];

int main(void) {
  cin >> N >> M;
  REP(i, 0, N) cin >> S[i] >> T[i] >> C[i];

  REP(i, 0, N) {
    S[i] = S[i] * 2 - 1;
    T[i] = T[i] * 2;
    C[i]--;
  }

  vector< vector<ll> > imos(M, vector<ll>(200010, 0LL));
  REP(i, 0, N) {
    imos[C[i]][S[i]]++;
    imos[C[i]][T[i] + 1]--;
  }
  REP(i, 0, M) REP(j, 1, imos[i].size()) imos[i][j] += imos[i][j - 1];

  ll ans = 0;
  REP(i, 0, imos[0].size()) {
    ll sum = 0;
    REP(j, 0, M) sum += imos[j][i] > 0;
    ans = max(ans, sum);
  }
  cout << ans << endl;
}


Measured memory_bytes: 51072
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <bitset>
#include <valarray>
#include <utility>
#include <tuple>
#include <cmath>
#include <random>

using ll = long long;

//各種nil
template <class T>
constexpr T nil = static_cast<T>(-1);

constexpr int nil_i = nil<int>;
constexpr int nil_ll = nil<ll>;
constexpr double nil_d = nil<double>;

//vector
template <class T>
using vec = std::vector<T>;

struct Vec2D
{
    int x, y;
};

struct TimePos
{
    int time;
    Vec2D pos;
};

int ManhattanDistance(Vec2D v1, Vec2D v2)
{
    using namespace std;
    return abs(v1.x - v2.x) + abs(v1.y - v2.y);
}

void solve()
{
    using namespace std;
    string s;
    cin >> s;

    string out {};

    auto b = find(s.begin(), s.end(), 'A');
    auto e = find(make_reverse_iterator(s.end()), make_reverse_iterator(s.begin()), 'Z').base();

    cout << distance(b, e) << endl;
}

int main()
{
    solve();
    return 0;
}

Measured memory_bytes: 640
import bisect
N = int(input())
L = list(map(int,input().split()))
L.sort()
cnt=0
for i in range(N-2):
    for j in range(i+1,N-1):
        b = bisect.bisect_left(L,L[i]+L[j])
        cnt += b-j-1
print(cnt)

Measured memory_bytes: 3188
n = int(input())


def num_div2(m):
    cnt = 0
    while m > 0 and m % 2 == 0:
        cnt += 1
        m //= 2

    return cnt


mx = max([(m, num_div2(m)) for m in range(1, n + 1)], key=lambda t: t[1])
print(mx[0])


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

/* REPmacro */
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define REPR(i,n) for(int i=((int)(n)-1);i>=0;--i)
#define FOR(i,m,n) for(int i=(int)(m);i<(int)(n);++i)

/*alias*/
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define F first
#define S second
#define PB push_back
#define MP make_pair 

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev

/*using*/
using ll = long long;
using ull = unsigned long long;
using unsi = unsigned;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using db = double;
using plex = complex<double>;
using vs = vector<string>;

/*template*/
template<class T>inline bool amax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool amin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

/* func */
int gcd(int a,int b){return b?gcd(b,a%b):a;}

/*struct*/
struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
}aaaaaaa;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7; //10^9
const db EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

//#define int ll
//#define int long long

signed main()
{
  int a,b,c,x; cin >> a >> b >> c >> x;
  int cnt = 0;
  int ans = 0;
  a+=1;b+=1;c+=1;
  
  REP(i, a){
    REP(j, b){
      REP(k, c){
        ans = 500*i + 100*j + 50*k;
        if(ans == x)++cnt;
      }
    }
  }
  cout << cnt;
  return 0;
}

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

#define int long long
#define double long double

#define REP(i, b) for(int i = 0; i < (b); i++)
#define REPS(i, b) for(int i = 1; i <= (b); i++)
#define ALL(v) (v).begin(), (v).end()

#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;

using pi = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vs = vector<string>;
using vb = vector<bool>;
using vpi = vector<pi>;
using vvi = vector<vi>;
using vvb = vector<vb>;

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

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

double d(pair<double, double> a, pair<double, double> b)
{
    return sqrt((a.fi-b.fi)*(a.fi-b.fi)+(a.se-b.se)*(a.se-b.se));
}

int fact(int n)
{
    if (n <= 1) return 1;
    return n * fact(n-1);
}

signed main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    vs q(8);
    REP(i, 8) REP(j, 8) q[i].push_back((i == j) ? 'Q' : '.');
    vi p(8); REP(i, 8) p[i] = i;
    int k; cin >> k;
    vpi m(k); REP(i, k) cin >> m[i].fi >> m[i].se;
    do
    {
        bool ok = true;
        REP(i, k)
        {
            if(p[m[i].fi] != m[i].se) ok = false;
        }
        REP(i, 8)
        {
            int qpos = p[i]; 
            for(int j = 1; i+j < 8; j++)
            {
                if(0 <= p[i]-j && p[i+j] == p[i]-j) ok = false;
                if(p[i]+j < 8 && p[i+j] == p[i]+j) ok = false;
            }
        }
        if(!ok) continue;
        REP(i, 8)
        {
            cout << q[p[i]] << endl;
        }
        return 0;
    }while(next_permutation(ALL(p)));
}


Measured memory_bytes: 3252
#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do { (t*=10)+=ch-'0'; ch=getchar(); } while ('0'<=ch&&ch<='9'); t*=f;
}
typedef long long ll;
const int maxn=(1e5)+10;
int n;
ll h[maxn],dp[maxn];
int main() {
	//freopen("1.txt","r",stdin);
	read(n);
	for (int i=1;i<=n;i++) read(h[i]);
	for (int i=2;i<=n;i++) {
		if (i==2) dp[i]=dp[i-1]+abs(h[i]-h[i-1]);
		else dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
	}
	printf("%lld\n",dp[n]);
	return 0;
}

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

int main(void){

    string a,b;
    cin>>a>>b;
    if(a=="H"){
        if(b=="H") cout<<"H"<<endl;
        else cout<<"D"<<endl;
    }
    else{
        if(b=="H") cout<<"D"<<endl;
        else cout<<"H"<<endl;
    }

}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApp14
{
    class Program
    {
        static void Main(string[] args)
        {
            var solver = new Solver();
            solver.Calc();
        }
    }

    public class Solver
    {

        public void Calc()
        {
            //var SP = Console.ReadLine().Split();


            //var AB = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();

            //var U = Console.ReadLine();

            var S = Console.ReadLine();

            Console.WriteLine(new string('x', S.Length));


        }
    }
}

Measured memory_bytes: 13140
(town, tele)=[int(x) for x in input().split()]
pos=[int(x) for x in input().split()]
move=[pos[0]]
move_dict={i:0 for i in range(1, town+1)}
while move_dict[move[-1]] <= 1 and len(move) < tele:
  move.append(pos[move[-1]-1])
  move_dict[move[-1]]+=1
if len(move) < tele:
  loop_move=move[move.index(move[-1]):-1]
  print(loop_move[(tele-(len(move)-1))%len(loop_move)-1])
else:
  print(move[-1])

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

using namespace std;

bool cmp(vector<long long int> x, vector<long long int> y) {
    return x[0] < y[0];
}

int main() {
    int N;
    long long int D, A;
    cin >> N >> D >> A;

    vector<vector<long long int> > XH(N, vector<long long int>(2));
    vector<long long int> X(N);
    for(int n=0; n<N; n++) {
        cin >> XH[n][0] >> XH[n][1];
        X[n]=XH[n][0];
    }

    sort(XH.begin(), XH.end(), cmp);
    sort(X.begin(), X.end());
    // for(int n=0; n<N; n++) {
    //     cout << XH[n][0] << " ";
    // }
    // cout << endl;
    
    vector<int> IND(N);
    vector<long long int> vec(N+1, 0);
    long long int ans=0;
    for(int n=0; n<N; n++) {
        IND[n] = upper_bound(X.begin(), X.end(), X[n]+2*D)-X.begin();
        // cout << IND[n] << endl;

        if(n>0) {
            vec[n] += vec[n-1];
        }
        if(vec[n]<XH[n][1]) {
            long long int tmp=(XH[n][1]-vec[n])/A;
            if((XH[n][1]-vec[n])%A!=0) tmp++;
            vec[n] += tmp*A;
            vec[IND[n]] -= tmp*A;
            ans += tmp;
        }
        // cout << vec[n] << " ";
    }
    // cout << endl;
    
    cout << ans << endl;
    
    return 0;
    
}

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

int partition(int A[],int p,int r){
  int x = A[r];
  int i = p - 1;
  int j,tmp;

  for(j=p;j<=r-1;j++){
    if(A[j] <= x){
      i++;
      tmp = A[i];
      A[i] = A[j];
      A[j] = tmp;
    }
  }
    tmp = A[i+1];
    A[i+1] = A[r];
    A[r] = tmp;

    return i+1;
}

int main(){
  int n,i,x;
  int *A;

  scanf("%d",&n);

  A = malloc(sizeof(int)*n);

  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }

  x = partition(A,0,n-1);

  for(i=0;i<n;i++){
    if(i == x){
      printf("[%d]",A[i]);
    }else{
    printf("%d",A[i]);
    }
    if(i<n-1)printf(" ");
  }
  puts("");

  free(A);
  return 0;
}

Measured memory_bytes: 888
#include <iostream>
#include <iosfwd>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cassert>
#include <cctype>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <sstream>
#include <complex>
#include <fstream>
#include <functional>
#include <numeric>
#include <utility>
#include <algorithm>
#include <assert.h>
#include <unordered_map>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector < long long > vll;
typedef pair <long long, long long> pll;
typedef pair <int, int> pii;
typedef vector < int > vii;
typedef complex < double > Point;

#define csl ios_base::sync_with_stdio(false); cin.tie(NULL)
#define mp make_pair
#define fst first
#define snd second

ll n, m, u, v, q, r, ql, qr, k, l, w, x, y, d, c, a, s;
const int N = 1e5 + 500;
const long long mod = 1e9 + 7;
const long long INF = 1LL << 61LL;


long long A, B;
long long S[N];
long long dpX[N], dpY[N];
set <int> idxX, idxY;
inline void inc(long long arr[], int idx, long long add) {
  if (idx == 0) return;
  while (idx < N) {
    arr[idx] += add;
    if (arr[idx] >= mod) arr[idx] -= mod;
    if (arr[idx] < 0) arr[idx] += mod;
    idx += (idx & -idx);
  }
}
inline long long get(long long arr[], int idx) {
  long long ret = 0;
  while (idx > 0) {
    ret += arr[idx];
    if (ret >= mod) ret -= mod;
    if (ret < 0) ret += mod;
    idx -= (idx & -idx);
  }
  return ret;
}
inline void reset(long long arr[], int idx) {
  if (idx == 0) return;
  inc(arr, idx, (-get(arr, idx)) % mod);
}
void clear(set <int> &idxZ, int i, long long v, long long arr[]) {
  if (S[i] - S[i - 1] >= v) return;
  for (auto ia : idxZ) {
    int idx = ia;
    reset(arr, idx);
  }
  idxZ.clear();
  arr[0] = 0;
}
int main() {
  csl;
  cin >> n;
  cin >> A >> B;
  for (int i = 1; i <= n; ++i) {
    cin >> S[i];
  }
  dpX[0] = dpY[0] = 1;
  S[0] = -INF;
  for (int i = 1; i <= n - 1; ++i) {
    /*cout << i << endl;
    for (int j = 0; j <= i - 1; ++j) {
      if (j == 0) cout << dpX[j] << ' ';
      else cout << get(dpX, j) - get(dpX, j - 1) << ' ';
    }
    cout << endl;
    for (int j = 0; j <= i - 1; ++j) {
      if (j == 0) cout << dpY[j] << ' ';
      else cout << get(dpY, j) - get(dpY, j - 1) << ' ';
    }
    cout << endl;*/
    int lo = 0, hi = i - 1;
    while (lo < hi) {
      int mid = (lo + hi + 1) / 2;
      if (S[i + 1] - S[mid] >= B) lo = mid;
      else hi = mid - 1;
    }
    inc(dpY, i, get(dpX, lo) + dpX[0]);
    lo = 0, hi = i - 1;
    while (lo < hi) {
      int mid = (lo + hi + 1) / 2;
      if (S[i + 1] - S[mid] >= A) lo = mid;
      else hi = mid - 1;
    }
    inc(dpX, i, get(dpY, lo) + dpY[0]);
    clear(idxX, i + 1, A, dpX);
    clear(idxY, i + 1, B, dpY);
    idxX.insert(i);
    idxY.insert(i);
  }
  long long res = 0;
  res = (get(dpX, n) + get(dpY, n) + dpX[0] + dpY[0]) % mod;
  cout << res << endl;
  return 0;
}























Measured memory_bytes: 12032
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i,n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<"\n"
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define mp make_pair
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using vc = vector<char>;
using vvc = vector<vc>;
template<class T> inline bool chmax(T& a, T b) { 
 if (a < b) { a = b; return true; } return false; 
}
template<class T> inline bool chmin(T& a, T b) {
 if (a > b) { a = b; return true; } return false; 
}
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  map<string,ll> p;
  p["AC"]=0;
  p["WA"]=0;
  p["TLE"]=0;
  p["RE"]=0;
  ll n;
  cin>>n;
  rep(i,n){
    string s;
    cin>>s;
    p[s]++;
  }
  cout<<"AC x "<<p["AC"]<<endl;
  cout<<"WA x "<<p["WA"]<<endl;
  cout<<"TLE x "<<p["TLE"]<<endl;
  cout<<"RE x "<<p["RE"]<<endl;
}
  


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

typedef long long ll; //longlong型をllと省略

//最大値を求めるテンプレ
template<class T> inline bool chmax(T& a, T b){
  if(a < b){
    a = b;
    return 1;
  }
  return 0;
}

//最小値を求めるテンプレ
template<class T> inline bool chmin(T& a, T b){
  if(a > b){
    a = b;
    return 1;
  }
  return 0;
}

//input
int N;

ll a[100010][3];

ll dp[100010][3];

int main(){

  int N; cin >> N;

  rep(i,N) rep(j,3) cin >> a[i][j];

  rep(i,N){
    //i=0は夏休み始まってない
    rep(j,3){
      rep(k,3){
        if(j == k) continue;
        //i日目のkという行動と(i-2)日目にjという行動をした後に
        //kという行動をした際に得られた幸福度の比較
        chmax(dp[i+1][k],dp[i][j]+a[i][k]);
      }
    }
  }
  ll res = 0;
  rep(j,3) chmax(res,dp[N][j]);
  cout << res << endl;
}



Measured memory_bytes: 4992
#include<iostream>
#include<vector>
using namespace std;
int main()
{
    int x,y;
    cin>>x>>y;
    long long sum =0 ;
    int a;
    for(int i =0;i<y;i++){
    cin>>a;
    sum+=a;
    }
  if(x-sum>=0)
  cout<<x-sum;
  else 
  cout<<-1;
  return 0;

    
}

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

int main() {
	int n,cnt=1;
	string s;
	cin>>n>>s;
	for(int i=0;i<s.length()-1;i++){
		if(s.substr(i,1)!=s.substr(i+1,1))cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}



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

int main(){
    int n; cin >> n;
    vector<string> s(n);
    rep(i,n) cin >> s[i];


    sort(s.begin(), s.end());
    string prev="";
    int max=0;
    int tmp=0;
    list<string> ans;
    for (int i = 0; i < n; i++) {
        if (s[i]==prev) {
            tmp++;
            if (tmp>max) {
                max=tmp;
                ans.clear();
                ans.push_back(s[i]);
            } else if(tmp==max) {
                ans.push_back(s[i]);
            }
        } else {
            tmp=1;
            prev=s[i];
            if (tmp>=max) {
                ans.push_back(s[i]);
            }
        }
    }

    list<string>::iterator it = ans.begin();
    while( it != ans.end() ) {
        cout << *it << endl;
        ++it;
    }
    return 0;
}


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

using namespace std;

const int N=100010;
int r[N],tup[N],tdn[N];
int n,X;
int q;
int a,t;
int s[N];

int getlw(int p){
    int L=0,R=n;
    while(L<R){
	//cout<<L<<' '<<R<<endl;
	int mid=(L+R+1)>>1;
	if(r[mid]>p)R=mid-1;
	else{
	    L=mid;
	}
    }
    return L;
}

int main()
{
    //freopen("c.in","r",stdin);
    //freopen("c.out","w",stdout);
    scanf("%d",&X);
    tup[0]=X;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
	scanf("%d",&r[i]);
	if(i%2){
	    s[i]=s[i-1]-r[i]+r[i-1];
	    tup[i]=tup[i-1]-r[i]+r[i-1];
	    tdn[i]=tdn[i-1]-r[i]+r[i-1];
	}
	else{
	    s[i]=s[i-1]+r[i]-r[i-1];
	    tup[i]=tup[i-1]+r[i]-r[i-1];
	    tdn[i]=tdn[i-1]+r[i]-r[i-1];
	}
	if(tup[i]>X)tup[i]=X;
	else if(tup[i]<0)tup[i]=0;
	if(tdn[i]>X)tdn[i]=X;
	else if(tdn[i]<0)tdn[i]=0;
	//cout<<tup[i]<<' '<<tdn[i]<<endl;
    }
    scanf("%d",&q);
    while(q--)
    {
	scanf("%d%d",&t,&a);
	int p=getlw(t);
	//cout<<p<<endl;
	int up,dn,now;
	if((p+1)%2){
	    up=tup[p]-t+r[p];
	    dn=tdn[p]-t+r[p];
	    now=s[p]-t+r[p];
	}else{
            up=tup[p]+t-r[p];
	    dn=tdn[p]+t-r[p];
	    now=s[p]+t-r[p];
	}
	now+=a;
	if(up>X)up=X;
	else if(up<0)up=0;
	if(dn>X)dn=X;
	else if(dn<0)dn=0;
	//cout<<up<<'|'<<now<<'|'<<dn<<endl;
	if(now>up)now=up;
	if(now<dn)now=dn;
	printf("%d\n",now);
    }
}



Measured memory_bytes: 2816
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<numeric>
#include<string>
#include<vector>
using namespace std;

const long mod = 1000000007;
const long indlim = 5368709119;
long gcd(long x, long y) { if (x > y) { return gcd(y, x); } long r; while (y != 0) { r = x % y; x = y; y = r; }return x; }
long lcm(long x, long y) { return(x / gcd(x, y)) * y; }
long fact(long x) { if (x == 0) return 1; else return((fact(x - 1) * x) % mod); }
long mybase(long N, long B) { if (N == 0) return 0; string S = ""; while (N != 0) { string M = to_string(N % B); N -= N % B; N /= B; S = M + S; }return stol(S); }
void indexsort(long* first, long* last, long* func) { sort(first, last, [&](long a, long b) {return func[a] < func[b]; }); }
//--------------------

int main() {

	long N; cin >> N;
	long res = 1;
	long T; for (int i = 0; i < N; i++) { cin >> T; res = lcm(res, T); }
	cout << res << endl;
}

Measured memory_bytes: 256
import copy
floor = [0,0,0,0,0,0,0,0,0,0]
build = [copy.deepcopy(floor),copy.deepcopy(floor),copy.deepcopy(floor)]
list = [copy.deepcopy(build),copy.deepcopy(build),copy.deepcopy(build),copy.deepcopy(build)]

line = int(input())
for i in range(line):
    b,f,r,v=map(int, input().split())
    build = list[b-1]
    floor = build[f-1]
    floor[r-1] += v

for i in range(4):
    build = list[i]
    for j in range(3):
        floor = build[j]
        for k in range(10):
            if k == 9:
                print(" " + str(floor[k]))
            else:
                print(" " + str(floor[k]), end="")
    if i != 3:
        print("####################")


Measured memory_bytes: 6336
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/










int N; 
ll A[101010], B[101010];
ll C[101010];
int vis[101010];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    rep(i, 0, N) cin >> A[i];
    rep(i, 0, N) cin >> B[i];

    ll smA = 0;
    rep(i, 0, N) smA += A[i];

    int ans = 0;
    rep(i, 0, N) C[i] = B[i];
    
    ll smB = 0;
    rep(i, 0, N) smB += B[i];

    if (smA < smB) {
        printf("-1\n");
        return;
    }

    ll d = smA - smB;
    vector<pair<int,int>> up;
    int ng = 0;
    int same = 0;
    rep(i, 0, N) {
        if (A[i] < B[i]) ng++;
        else if (B[i] < A[i]) up.push_back({ A[i] - B[i],i });
        else same++;
    }

    sort(all(up));
    int upuse = 0;
    fore(p, up) {
        if (p.first <= d) {
            d -= p.first;
            C[p.second] = A[p.second];
            upuse++;
        }
    }

    rep(i, 0, N) if (A[i] != C[i]) ans++;
    if (d) {
        if (ng == 0) ans++;
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 3196
#include"bits/stdc++.h"
using namespace std;

int main(){
    int n; cin >> n;
    float a[n]; for(int i=0; i<n; i++) cin >> a[i];
    float s = 0;
    for(int i=0; i<n; i++){
        s += 1.0/a[i];
    }
    printf("%5f", 1/s);
}

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

int main(){
        string n, ans, op="aaa";
        int i, j, cal, tmp;
        cin >> n;
        for(i=0;i<n.length();++i) ans.push_back(n[i]);
        ans.push_back('=');
        ans.push_back('7');
        for(i=0;i<(1<<3);++i){
                cal = (int)n[0] - 48;
                for(j=0;j<3;++j){
                        if((i>>j)&1){
                                tmp = (int)n[3-j] - 48;
                                op[2-j] = '+';
                        }else{
                                tmp = -((int)n[3-j] -48);
                                op[2-j] = '-';
                        }
                        cal += tmp;
                }
                if(cal==7){
                        for(j=0;j<op.size();++j) ans.insert(1+2*j,1,op[j]);
                        cout << ans << endl;
                        break;
                }
        }
        return 0;
}

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

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<ll,ll> pii;
typedef vector<pii> vpii;

#define pb(x) push_back(x)
#define ppb() pop_back()
#define mp(x,y) make_pair(x,y)
#define mod 1000000007
#define FOR0(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i = a; i < b; i++)
#define FORD(i,a,b) for(ll i=(a);i>=(int)(b);i--)
#define sf(n) scanf("%lld", &n)
#define sfc(x) scanf("%c", &x)
#define pf(x) printf("%lld", x)
#define pff(x) printf("%lf", x)
#define pfc(x) printf("%c", x)
#define pfs(x) printf("%s", x)
#define sf2(a,b) scanf("%lld %lld", &a, &b)
#define sf3(a,b,c) scanf("%lld %lld %lld", &a, &b, &c)
#define pfn(n) printf("%lld\n", n)
#define pfs(n) printf("%lld ", n)
#define ff first
#define ss second   
#define mem(a,b) memset(a,b,sizeof(a))
#define sz size()
#define ll long long
#define all(c) (c).begin(),(c).end()
#define fast ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
const ll INF = 2e18;

bool prime[1000009];    
unordered_map<ll,ll> largest_factor;
void SieveOfEratosthenes(ll n)
{
    memset(prime,true, sizeof(prime)); 
    prime[1]=false;
    for (ll p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (ll i=p*p; i<=n; i += p){
                prime[i] = false;
                largest_factor[i]=p;
            }

        }
    }
}


ll power(ll x,ll y)
{
    if (y == 0)
        return 1;
    else if (y%2 == 0)
        return power(x, y/2)*power(x, y/2);
    else
        return x*power(x, y/2)*power(x, y/2);
}


ll mod_power(ll a,ll b,ll m){
    ll res=1;
    a%=m;
    while(b){
        if(b&1){
            res=res*a%m;
        }
        a=a*a%m;
        b>>=1;
    }
    return res;
}


int main(){
    fast
    string s,t;
    cin>>s>>t;
    bool flag=true;
    FOR0(i,s.size())if(s[i]!=t[i])flag=false;
    if(flag)cout<<"Yes\n";
    else cout<<"No\n";    
}

Measured memory_bytes: 3616
import java.util.*;

public class Main {
    static int[][] dp;
    static Scanner sc;
    static int n;
    static int m;
    static Node[] nodes;
    static boolean[] contains;

    public static void main(String[] args) {
        sc = new Scanner(System.in);
        n = sc.nextInt();
        m = sc.nextInt();
        nodes = new Node[n];
        contains = new boolean[n];
        for (int i = 0; i < n; i++) {
            nodes[i] = new Node(i);
        }
        for (int i = 0; i < m; i++) {
            int a = sc.nextInt() - 1;
            int b = sc.nextInt() - 1;
            nodes[a].nexts.add(nodes[b]);
            nodes[b].nexts.add(nodes[a]);
        }

        LinkedList<Integer> path = new LinkedList<>();

        path.add(nodes[0].a);
        path.add(nodes[0].nexts.stream().findAny().get().a);
        for (Integer i: path) {
            contains[i] = true;
        }
        boolean flag = true;
        while (flag) {
            flag = false;
            int first = path.getFirst();
            for (Node node : nodes[first].nexts) {
                if(contains[node.a]) {
                    continue;
                }
                contains[node.a] = true;
                path.addFirst(node.a);
                flag =true;
                break;
            }
            int last = path.getLast();
            for (Node node : nodes[last].nexts) {
                if(contains[node.a]) {
                    continue;
                }
                contains[node.a] = true;
                path.addLast(node.a);
                flag = true;
                break;
            }
        }
        System.out.println(path.size());
        for (Integer i : path) {
            System.out.print((i + 1) + " ");
        }
    }

    static class Node{
        int a;
        Set<Node> nexts;

        public Node(int a) {
            this.a = a;
            this.nexts = new HashSet<>();
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            Node node = (Node) o;

            return a == node.a;
        }

        @Override
        public int hashCode() {
            return a;
        }
    }
}

Measured memory_bytes: 115300
#![allow(non_snake_case)]
use proconio::input;
// use std::collections::HashMap;

fn main() {
    input! {
        N: usize,
        K: usize,
    }

    // 1 ~ K
    // 2 ~ K + 1
    // ans ~ K - 1 + ans
    // K - 1 + ans <= N
    // ans <= N - K + 1

    let ans = N - K + 1;
    println!("{}", ans);
}


Measured memory_bytes: 2112
#include <iostream>
#include <string.h>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
int main(void){
   char s[1000010];
   cin>>s;
   int N;
   N=strlen(s);
   strcat(s,"xxxxxxx");
   int b=0;
   bool check=false;
   int roop=0; int oper=0;
   while(!check){roop++;
       if(s[b]=='e'&&s[b+1]=='r'&&s[b+2]=='a'&&s[b+3]=='s'&&s[b+4]=='e'&&s[b+5]=='r') {b+=6; if(b==N) {check=true;} oper++;}
       else if(s[b]=='e'&&s[b+1]=='r'&&s[b+2]=='a'&&s[b+3]=='s'&&s[b+4]=='e') {b+=5; if(b==N) {check=true;} oper++; }
       else if(s[b]=='d'&&s[b+1]=='r'&&s[b+2]=='e'&&s[b+3]=='a'&&s[b+4]=='m'&&s[b+5]=='e'&&s[b+6]=='r'&&s[b+7]!='a') {b+=7; if(b==N) {check=true;} oper++; }
       else if(s[b]=='d'&&s[b+1]=='r'&&s[b+2]=='e'&&s[b+3]=='a'&&s[b+4]=='m') {b+=5; if(b==N) {check=true;} oper++; }
       if(roop!=oper) {break;}
   }
   if(!check) cout<<"NO";
   else cout<<"YES";
   return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
#include<stdlib.h>
int fun(int ,int ,int );
int fun(int x,int y,int z)
{
    int ans=0;
    while(ans*y+(ans+1)*z<=x)
    {
        ans++;
    }
    return ans-1;
}
int main()
{
    int x,y,z;
    scanf("%d%d%d",&x,&y,&z);
    printf("%d\n",fun(x,y,z));
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <stack>
#include <string>
#include <cstdlib>

using namespace std;

int main(){
	string word;
	stack<int> S;
	while(cin >> word){
		int a,b;
		if(word == "+"){
			a = S.top();
			S.pop();
			b = S.top();
			S.pop();
			S.push( a + b );
			// cout << "+" << a+b;
		}
		else if(word == "-"){
			a = S.top();
			S.pop();
			b = S.top();
			S.pop();
			S.push( b - a );	
			// cout << "-" << b-a;		
		}
		else if(word == "*"){
			a = S.top();
			S.pop();
			b = S.top();
			S.pop();
			S.push( a * b );			
			// cout << "*" << a*b;			
		}else{
			S.push( atoi(word.c_str()) );
		}
		// cout << S.top() << endl;
	}
	cout << S.top() << endl;
	return 0;
}

Measured memory_bytes: 1204