akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
///////////////////////////////////////////
const long long int INF = 2*1e13;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

ll h,w,K;
ll ary[30][30];
ll ary_[30][30];
void _set(){
    rep(i,30)rep(j,30){
        ary[i][j] = ary_[i][j];
    }
}
ll era(ll num){
    ll tmp=10,ct=0;
    ll ans = 0;
    rep(i,h){
        rep(j,w){
            if(tmp == ary[j][i] && ary[j][i]!=-1){
                ct++;
            }else{
                if(ct>=K){
                    ans += ary[j-1][i]*ct;
                    rep(k,ct){
                        ary[j-k-1][i]=-1;
                    }
                }
                ct = 1;
                tmp = ary[j][i];
            }
        }
        if(ct>=K){
            ans += ary[w-1][i]*ct;
            rep(k,ct){
                ary[w-1-k][i]=-1;
            }
        }
        tmp = 10;
        ct = 0;
    }
    ll tp = 1;
    rep(i,num)tp*=2;
    return ans*tp;
}

void down(){
    vector<vi> tmp(w);
    rep(j,w){
        for(int i = h-1;i>=0;i--){
            if(ary[j][i]==-1){
                tmp[j].pb(i);
            }else{
                if(tmp[j].size()!=0){
                    ary[j][tmp[j][0]]=ary[j][i];
                    ary[j][i]=-1;
                    tmp[j].pb(i);
                    tmp[j].erase(tmp[j].begin());
                }
            }
        }
    }
}



int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    //std::cout<<std::fixed<<std::setprecision(30);
    cin>>h>>w>>K;
    string s;
    rep(i,h){
        cin>>s;
        rep(j,w){
            ary_[j][i] = (s[j] - '0');
        }
    }
    ll tmp = 0,ans = 0;
    rep(i,w)rep(j,h){
        _set();
        ary[i][j] = -1;
        down();
        tmp = 0;
        rep(i,h*w){
            ll tp = era(i);
            if(tp==0)break;
            else{
                tmp += tp;
                down();
            }
        }
        chmax(ans,tmp);
    }
    print(ans);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s,t,u;
  int a,b;
  cin>>s>>t;
  cin>>a>>b;
  cin>>u;
  if(s==u){
    cout<<a-1<<' '<<b<<endl;
  }
  else{
    cout<<a<<' '<<b-1<<endl;
  }
  return(0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll=long long;

const int N=2e5+10;
int arr[N];

int main(){
    int n;
    cin>>n;
    for(int i=0; i<n; i++) cin>>arr[i];
    sort(arr, arr+n);
    int j=0;
    bool fl=0;
    for(int i=1; i<n; i++){
        if(arr[i]==arr[j]){
            fl=1;
            break;
        }
        j=i;
    }
    if(fl)cout<<"NO";
    else cout<<"YES";
}



















Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
#include<map>
using namespace std;
const int maxn = 1e6+10;

int read(){
	int x=0,f=1;
	char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){x=(x<<3)+(x<<1)+c-48;c=getchar();}
	return x*f;
}

int k,m,n;
int prime[maxn],tot=0,vis[maxn],num=1e6,gett[maxn];
inline void init(){
	for(register int i=2;i<=num;i++){
		if(!vis[i]){prime[++tot]=i;gett[i]=tot;}
		for(register int j=1;j<=tot && prime[j]*i<=num;j++){
			vis[prime[j]*i]=1;
			if(i%prime[j]==0)break;
		}
	}
	return;
}

int mod = 1e9+7;
int ksm(int x,int y){
	int sum=1;
	while(y){
		if(y&1)sum=1ll*sum*x%mod;
		x=1ll*x*x%mod;
		y>>=1;
	}
	return sum;
}

int numm[maxn],a[maxn];
int main(){
	init();
	n=read();
	int ans=1;
	for(register int i=1;i<=n;i++){
		a[i]=read();
		int x=a[i];
		for(register int j=1;prime[j]*prime[j]<=x;j++){
			if(x%prime[j]==0){
				int sum=0;
				while(x%prime[j]==0){x/=prime[j];sum++;}
				numm[j]=max(numm[j],sum);
			}
		}
		if(x!=1)numm[gett[x]]=max(numm[gett[x]],1);
	}
	for(register int i=1;i<=tot;i++){
		ans=1ll*ans*ksm(prime[i],numm[i])%mod;
	}
	int sum=0;
	for(register int i=1;i<=n;i++){
		(sum+=1ll*ans*ksm(a[i],mod-2)%mod)%=mod;
	}
	printf("%d\n",sum);
	return 0;
}

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

int main(int argc, char *argv[])
{
	int tate, yoko;
	char buf[100], buf2[100];

	scanf("%s %s", buf, buf2);

	tate = atoi(buf);
	yoko = atoi(buf2);

	printf("%d %d\n", tate * yoko, 2 * (tate + yoko));

	return 0;
}

Measured memory_bytes: 544
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  vector<string> c(3);
  REP(i, 3) cin >> c[i];
  cout << c[0][0] << c[1][1] << c[2][2] << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int INF = 1000000000;
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define rep(i,n) REP(i, 0, n)
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    while(cin >> N >> M && N){
        vector<int> h(N + 1), w(M + 1);
        h[0] = 0, w[0] = 0;
        rep(i, N) cin >> h[i + 1];
        rep(i, M) cin >> w[i + 1];
        rep(i, N) h[i + 1] += h[i];
        rep(i, M) w[i + 1] += w[i];
        vector<int> hs(h.back() + 1, 0), ws(w.back() + 1, 0);
        rep(i, N) REP(j, i + 1, N + 1)
          hs[h[j] - h[i]]++;
        rep(i, M) REP(j, i + 1, M + 1)
          ws[w[j] - w[i]]++;
        int ans = 0;
        rep(i, min(h.back(), w.back()) + 1)
          ans += hs[i] * ws[i];
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 5288
#include <iostream>

int solve(){
    int h1, m1, h2, m2, k;
    scanf("%d", &h1);
    scanf("%d", &m1);
    scanf("%d", &h2);
    scanf("%d", &m2);
    scanf("%d", &k);

    int res;
    res = (h2-h1)*60+(m2-m1)-k;
    return res;
}

int main(){
    int res = solve();
    printf("%d\n", res);
    return 0;
}

Measured memory_bytes: 3824
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
using vl=vector<ll>;
using vb=vector<bool>;
using vs=vector<string>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
const ll oo =0x3f3f3f3f3f3f3f3fLL;
const double eps=1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORD(i,a,b) for(ll i=ll(b)-1;i>=(a);i--)
#define TR(X) ({if(0) cerr << "TR: " << (#X) << " = " << (X) << endl; })
vl Xs, Ms;
vvl adj;

bool doit(ll cur) {
    TR(cur);
    for (ll nei : adj[cur]) {
        if (!doit(nei)) return false;
    }

    vb possibleSum(5001, false);
    possibleSum[0] = true;
    ll Msum = 0;

    for (ll nei : adj[cur]) {
        Msum += Ms[nei] + Xs[nei];
        vb newSum(5001, false);
        FOR(i, 0, 5001) {
            if (possibleSum[i]) {
                for (ll newval : {i + Xs[nei], i + Ms[nei]}) {
                    TR(newval);
                    if (newval <= 5000) {
                        newSum[newval] = true;
                    }
                }
            }
        }
        possibleSum = newSum;
    }

    // Select biggest Sum lessequal than Xs[cur]
    ll res = -1;
    TR(cur);
    FOR(i, 0, Xs[cur]+1) {
        TR(i);
        TR(possibleSum[i]);
        if (possibleSum[i]) res = i;
    }
    TR(res);
    if (res < 0) {
        return false;
    } else {
        Ms[cur] = Msum - res;
        return true;
    }
}
int main(){ cin.sync_with_stdio(0);
    ll N; cin >> N;

    adj.resize(N);
    FOR(i, 1, N) {
        ll a; cin >> a;
        a --;
        adj[a].pb(i);
    }

    Xs.resize(N);
    FOR(i, 0, N) cin >> Xs[i];

    Ms.resize(N);

    if (doit(0)) {
        cout << "POSSIBLE" << endl;
    } else {
        cout << "IMPOSSIBLE" << endl;
    }
    FOR(i, 0, N) TR(Ms[i]);

} //cin.tie(0) bei schnellem Wechseln


Measured memory_bytes: 384
//#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
//using namespace atcoder;
#define int long long
   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; }
    const int MAX =3001;
const int MOD =998244353;

  
  
signed main(){
  string s;
  cin>>s;
  if(s[s.size()-1]=='s')cout<<s<<"es"<<endl;
  else cout<<s<<"s"<<endl;
  


}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N,a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1,F;
    cin >> N;
    if (N != 0){
        a = N % 100000000;
        b = a % 10000000;
        c = b % 1000000;
        d = c % 100000;
        e = d % 10000;
        f = e % 1000;
        g = f % 100;
        h = g % 10;
    
        a1 = (N-a)/100000000;
        b1 = (a-b)/10000000;
        c1 = (b-c)/1000000;
        d1 = (c-d)/100000;
        e1 = (d-e)/10000;
        f1 = (e-f)/1000;
        g1 = (f-g)/100;
        h1 = (g-h)/10;
    
        F = a1 + b1 + c1 + d1 + e1 + f1 +g1 + h1 + h;
        if ((N % F) == 0){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
    }
    }
    else {
        cout << "No" << endl;
    }
}

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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = 1LL << 60;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
	ll a, b, x;

	cin >> a >> b >> x;

	if (a <= x && a + b >= x) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int a,b,c,d;
    scanf ("%d %d %d",&a,&b,&c);
    
    if(a>b){
        d=a;
        a=b;
        b=d;
    }
     if(b>c){
        d=b;
        b=c;
        c=d;
    }
     if(a>b){
        d=a;
        a=b;
        b=d;
    }    
    printf("%d %d %d\n",a,b,c);

    return 0;
}


Measured memory_bytes: 2148
unittest
{
	assert( [ "3", "1 2 3" ].parse.expand.solve == 0 );
	assert( [ "4", "1 3 1 1" ].parse.expand.solve == 2 );
	assert( [ "8", "27 23 76 2 3 5 62 52" ].parse.expand.solve == 2 );
}



import std.algorithm;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	input.popFront;
	auto ws = input.front.split.to!( long[] );
	return tuple( ws );
}

auto solve( long[] ws )
{
	auto ans = long.max;
	auto wl = 0L;
	auto wg = ws.sum;
	for( auto i = 0L; i < ws.length; i++ )
	{
		wl += ws[ i ];
		wg -= ws[ i ];
		ans = min( ans, abs( wl - wg ) );
	}
	return ans;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
#include <stdio.h>
#include <cstring>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <numeric>

//#include <map>

using namespace std;

int main()
{
	int n, m, l;
	cin >> n >> m >> l;

	vector<vector<long long>> va,vb,vc;

	for (int i = 0; i < n; i++)
	{
		vector<long long> vt;
		for (int j = 0; j < m; j++)
		{
			int tt;
			cin >> tt;
			vt.push_back(tt);
		}
		va.push_back(vt);
	}

	for (int i = 0; i < m; i++)
	{
		vector<long long> vt;
		for (int j = 0; j < l; j++)
		{
			int tt;
			cin >> tt;
			vt.push_back(tt);
		}
		vb.push_back(vt);
	}

	for (int i = 0; i < n; i++)
	{
		vector<long long> vt;
		for (int j = 0; j < l; j++)
		{
			long long sk = 0;
			for (int k = 0; k < m; k++)
			{
				sk += va.at(i).at(k) * vb.at(k).at(j);
			}
			vt.push_back(sk);
		}
		vc.push_back(vt);
	}

	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < l; j++)
		{
			cout << vc.at(i).at(j);
			if (j < l - 1)
				cout << " ";
		}
		cout << endl;
	}
	return 0;
}

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

int main(){
  int n;
  cin >> n;
  int min1 = 10000000;
  int count = 0;
  for(int i=0;i<n;i++){
    int y;
    cin >> y;
    if(y<min1){
      count++;
      min1 = min(y,min1);
    }
  }
  cout << count << endl;
}

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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		
		int l = 0, r = N;
		while(r - l > 1){
			int c = (r + l) / 2;
			if(!isOK(c)){
				l = c;
			} else {
				r = c;
			}
		}
		Console.WriteLine(r);
	}
	
	bool isOK(int k){
		if(k == 0) return false;
		if(k == 1){
			for(int i=0;i<N-1;i++) if(A[i] >= A[i+1]) return false;
			return true;
		}
		
		int[] a = new int[33];
		
		for(int i=1;i<N;i++){
			
			if(A[i] >=33) continue;
			if(A[i] > A[i-1]){
				for(int j=A[i];j<33;j++){
					a[j] = 0;
				}
			} else if(A[i] == A[i-1]){
				a[A[i]]++;
				for(int j=A[i];j>0;j--){
					if(a[j] >= k){
						a[j] -= k;
						a[j-1] += 1;
					}
				}
				if(a[0] != 0) return false;
			} else {
				for(int j=A[i] + 1;j<33;j++) a[j] = 0;
				a[A[i]]++;
				for(int j=A[i];j>0;j--){
					if(a[j] >= k){
						a[j] -= k;
						a[j-1] += 1;
					}
				}
				if(a[0] != 0) return false;
			}
		}
		
		return true;
	}
	int N;
	int[] A;
	public Sol(){
		N = ri();
		A = ria();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


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

#define debug(x) cerr << #x << ": " << x << endl
#define debugArray(x, n)                                                       \
    for(long long hoge = 0; (hoge) < (n); ++(hoge))                            \
    cerr << #x << "[" << hoge << "]: " << x[hoge] << endl
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
const ll INF = LLONG_MAX / 2;
const ll MOD = 1e9 + 7;

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    cout << N * (N - 1) / 2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

#define EPS (1e-7)

// 4方向への隣接頂点への移動を表すベクトル
constexpr int dx[] = {1, 0, -1, 0};
constexpr int dy[] = {0, 1, 0, -1};

int main() {
  // 入力
  int height, width;
  cin >> height >> width;

  vector<string> field(height);
  for (int h = 0; h < height; h++) {
    cin >> field[h];
  }
  ll totalmax = 0;

  for (int h = 0; h < height; h++) {
    for (int w = 0; w < width; w++) {
      if (field[h][w] == '#') {
        continue;
      }
      ll sx = h;
      ll sy = w;

      // 幅優先探索の初期設定

      // 各セルの最短距離(訪れていないところは -1 としておく)
      vector<vector<int>> dist(height, vector<int>(width, -1));
      dist[sx][sy] = 0;  // スタートを 0 にする

      // 「一度見た頂点」のうち「まだ訪れていない頂点」を表すキュー
      queue<pair<int, int>> que;
      que.push(make_pair(sx, sy));  // スタートを push

      // 幅優先探索を実施する
      while (!que.empty()) {
        const pair<int, int> current_pos = que.front();
        que.pop();
        const int x = current_pos.first;
        const int y = current_pos.second;

        // 隣接頂点を探索
        for (int direction = 0; direction < 4; direction++) {
          const int next_x = x + dx[direction];
          const int next_y = y + dy[direction];

          if (next_x < 0 || next_x >= height || next_y < 0 || next_y >= width) {
            // 場外アウト
            continue;
          }
          if (field[next_x][next_y] == '#') {
            // 壁はアウト
            continue;
          }

          if (dist[next_x][next_y] == -1) {
            // まだ見ていない頂点ならpush
            que.push(make_pair(next_x, next_y));
            dist[next_x][next_y] = dist[x][y] + 1;  // 距離を更新
          }
        }
      }

      // 最も数字の大きい最短距離をとる
      ll maxele = 0;
      for (const auto& x : dist) {
        for (const auto& y : x) {
          maxele = max(maxele, (ll)y);
        }
      }
      totalmax = max(maxele, totalmax);
    }
  }
  // 出力
  cout << totalmax << endl;
  return 0;
}

// 下記が入力例
/*
8 8
.#....#G
.#.#....
...#.##.
#.##...#
...###.#
.#.....#
...#.#..
S.......
*/


Measured memory_bytes: 256
/*
ID: cyxoier1
TASK: d
PROG: d.cpp
LANG: C++
*/
#include<bits/stdc++.h>
using namespace std;

template<typename T>
inline void Read(T &n){
	char ch; bool flag=0;
	while(!isdigit(ch=getchar()))if(ch=='-')flag=1;
	for(n=ch^48;isdigit(ch=getchar());n=(n<<1)+(n<<3)+(ch^48));
	if(flag)n=-n;
}

typedef long long ll;
const ll MOD = 1000000007;
const int MAXN = 300005;
const int MAXK = 60;

ll a[MAXN], num[2], maxi;

int main(){
	int n;
	Read(n);
	for(register int i=1; i<=n; i++) Read(a[i]), maxi = max(maxi,a[i]);
	
	ll base=1, ans=0;
	while(maxi){
		num[0] = num[1] = 0;
		for(register int i=1; i<=n; i++)
			num[a[i]&1]++;
		ans = (ans+base*num[0]%MOD*num[1]%MOD)%MOD;
		base = base*2%MOD;
		for(register int i=1; i<=n; i++)
			a[i] /= 2;
		maxi /= 2;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 2560
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <map>

#define ST_ARR_LEN(array) (sizeof(array)/sizeof(*array))

using namespace std;

using ll = long long;

typedef stack<int> IntStack;
typedef queue<int> IntQueue;
typedef vector<int> IntVector;
typedef list<int> IntList;

typedef struct S{
  int a;
  int b;
} Object;

int main(){
  int N;
  cin >> N;
  
  long long count = 0;
  for(int i=1;i<=N;i++){
    if((i%3 != 0) && (i%5 != 0)){
      count += i;
    }
  }
  
  cout << count << endl;
}

Measured memory_bytes: 3624
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int ans = 0;
        for (int i = 1;; i++) {
            if (i * i <= n)
                ans = i * i;
            else
                break;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 21844
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

//----------------------- Print Function ----------------------//

inline void print() {
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest) {
    cout << first << ' ';
    print(rest...);
}

//------------------------- Libraries -------------------------//

//--------------------------- Solve ---------------------------//

void solve() {
    int A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;

    double conce = 0;
    int weight = 0, sugar = 0;

    for (int a = 0; A * a * 100 <= F; a++) {
        for (int b = 0; (A * a + B * b) * 100 <= F; b++) {
            int limit = E * (A * a + B * b);
            for (int c = 0; C * c <= limit && (A * a + B * b) * 100 + C * c <= F; c++) {

                int tmp_water = (A * a + B * b) * 100;

                int d = min((F - tmp_water - C * c) / D, (limit - C * c) / D);
                int tmp_sugar = C * c + D * d;

                double tmp_conce = tmp_sugar / (double)(tmp_sugar + tmp_water);
                if (tmp_conce >= conce) {
                    conce = tmp_conce;
                    sugar = tmp_sugar;
                    weight = tmp_sugar + tmp_water;
                    //print(tmp_sugar, tmp_water);
                }
            }
        }
    }

    print(weight, sugar);
}

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

    solve();

    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9

typedef long long ll;

using namespace std;

const ll inf = 1e18;
const ll mod = 1e9+7;
const int N = 1e5+5;
//int a[N];

int main()

{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
  	string a, b, c;
  
  	cin >> a >> b >> c;
  
  cout << a[0] << b[0] << c[0];
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
using P=pair<int,int>;
typedef unsigned long long ull;
typedef long long ll;
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; }
const ll INF=1e18;
const ll MOD=1e9+7;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);  
  int n;
  cin >> n;
  cout << pow(n,3) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	int n;
	cin>>n;
	int h[n];
	for(int i=0;i<n;i++)cin>>h[i];
	
	int dp[n];fill(dp, dp+n, INT_MAX);
	dp[0]=0;
	dp[1]=abs(h[1]-h[0]);
	for(int i=2;i<n;i++)dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
	cout<<dp[n-1]<<"\n";
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define gcd(a,b) __gcd(a,b)
#define ll long long int
#define ld unsigned long long int
#define pi pair<ll,ll>
#define pb push_back
#define pf push_front
#define pu push
#define po pop
#define fi first
#define se second
#define mk make_pair
#define ve vector
#define lr(n) for(ll i=0;i<n;i++)
#define all(x) x.begin(),x.end()

ll dp[100001];
ve<ll>ar(100001);

ll fun(ll n){
	if(n==0){
		return 0;
	}
	if(dp[n]==-1){
		dp[n]=abs(ar[n]-ar[n-1])+fun(n-1);
		if(n>1){
			dp[n]=min(dp[n],abs(ar[n]-ar[n-2])+fun(n-2));
		}
	}
	return dp[n];
}

	int main(){
		ios_base::sync_with_stdio(0);
		cin.tie(0);
		cout.tie(0);
		ll n;
		cin>>n;
		lr(n){
			cin>>ar[i];
		}
		lr(100001){
			dp[i]=-1;
		}
		cout << fun(n-1) << "\n";
		return 0;
	}

Measured memory_bytes: 4992
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] d = new int[n];
		int[] cnt = new int[n];
		
		for(int i = 0; i < n; i++) {
			d[i] = sc.nextInt();
			cnt[d[i]]++;
		}

		long ans = 1;
		if(d[0] != 0 || cnt[0] != 1) { 
			System.out.println(0);
			sc.close();
			return;
		}else {
			for(int i = 1; i < n; i++) {
				for(int j = 0; j < cnt[i]; j++) {
					ans *= cnt[i-1];
					ans %= 998244353;
				}
			}
		}
		
		System.out.println(ans);
		sc.close();
	}
}

Measured memory_bytes: 55656
N = int(input())
a = [int(i) for i in input().split()]
zeros = [0] * N
ai = length = len(a)

for i in a[::-1]:
    s = 0
    for j in range(ai, length+1, ai):
        s += zeros[j-1]
    if s % 2 == i:
        pass
    else:
        zeros[ai-1] = 1
    ai -= 1

print(sum(zeros))
for i, v in enumerate(zeros, 1):
    if v:
        print(i)


Measured memory_bytes: 8784
#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 int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
const ll MOD = 1000000007;

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

Measured memory_bytes: 256
from collections import deque

lst = deque()

for l in range(int(input())):
  dat_set = input().split()
  command = dat_set[0]
  try:
    if command == 'insert':
      lst.appendleft(dat_set[-1])
    elif command == 'delete':
      lst.remove(dat_set[-1])
    elif command == 'deleteFirst':
      lst.popleft()
    elif command == 'deleteLast':
      lst.pop()
  except:
    pass

print(*lst)


Measured memory_bytes: 69740
#include <bits/stdc++.h>
using namespace std;
string n;   
int ans=0;
int a=0;
int main()
{
    std::cin>>n;
    for(int i=0;i<n.size();i++)
    {
        if(n[i]=='g')
        {
            if(a>0)
            {
                ans++;
                a--;
            }
            else
            {
                a++;
            }
        }
        else
        {
            if(a>0)
            {
                a--;
            }
            else
            {
                a++;
                ans--;
            }

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

Measured memory_bytes: 512
while True:
    N, Q = map(int, input().split())
    if not N:
        break
    a = []
    for i in range(N):
        x, y, z = input().split()
        a.append((int(z), int(z) - int(y), x))
    a = list(reversed(sorted(a)))
    for i in range(Q):
        x = int(input())
        for v in a:
            if v[0] >= x and v[1] < x:
                print(v[2], x - v[1])
                break;
        else:
            print('Unknown')

Measured memory_bytes: 6868
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <queue>
using namespace std;

const int dx[6] = {1, 1, 0, -1, -1, 0};
const int dy[6] = {1, 0, -1, -1, 0, 1};
const int MAX = 121, OFFSET = 60;
bool used[MAX][MAX];

struct state {
	int x, y, t;
	state(int x, int y, int t):x(x), y(y), t(t){}
};

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

	for(int t, n; cin >> t >> n, t;) {
		memset(used, false, sizeof(used));
		for(int i = 0; i < n; ++i) {
			int x, y;
			cin >> x >> y;
			used[y + OFFSET][x + OFFSET] = true;
		}

		int x, y;
		cin >> x >> y;

		queue<state> que;
		que.push(state(x + OFFSET, y + OFFSET, 0));
		used[y + OFFSET][x + OFFSET] = true;
		int ans = 0;

		while(!que.empty()) {
			const state& s = que.front();
			++ans;

			if(s.t < t) {
				const int nt = s.t + 1;
				for(int i = 0; i < 6; ++i) {
					const int nx = s.x + dx[i], ny = s.y + dy[i];
					if(!used[ny][nx]) {
						que.push(state(nx, ny, nt));
						used[ny][nx] = true;
					}
				}
			}

			que.pop();
		}
		
		cout << ans << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1240
#include<iostream>
#include<unordered_map>
#include<vector>
using namespace std;
typedef long long li;
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }
// pair 型
template<class S,class T>
std::ostream& operator<<(std::ostream& os, const pair<T,S>& p){
  // ここでストリームに obj を書き込みます。
  cout << "(" << p.first << "," << p.second << ")";
  return os;
}
// Container コンテナ型, map以外
template< template<class ...> class Ctn,class T>
std::ostream& operator<<(std::ostream& os,const Ctn<T>& v){
  // ここでストリームに obj を書き込みます。
  auto itr=v.begin();
  while(itr!=v.end()){
    if(itr!=v.begin())cout << " ";
    cout << *(itr++);
  }
  return os;
}

li fact(li a){
  static unordered_map<li,li> f;
  f[0]=1;
  if(f.find(a)!=f.end())return f[a];
  return f[a]=fact(a-1)*a%MOD;
}

li inv(li a){
  static unordered_map<li,li> f;
  f[1]=1;
  if(f.find(a)!=f.end())return f[a];
  if(df)  print("inv",a);
  li s=MOD-inv(MOD%a);
  (s*=MOD/a)%=MOD;
  return f[a]=s;
}

void init(vector<vector<int>>& adj,
          vector<pair<li,int>>& w,int parent=-1,int a=0){
  if(df)print("init",a);
  li s=1;
  int cnt=0;
  for(int x:adj[a]){
    if(df)print("x:",x);
    if(x==parent) continue;
    init(adj,w,a,x);
    (s*=w[x].first)%=MOD;
    (s*=inv(fact(w[x].second)))%=MOD;
    cnt+=w[x].second;
  }
  (s*=fact(cnt))%=MOD;
  w[a]={s,cnt+1};
  if(df)print(w[a]);
}

void reverse(int a,int b,vector<vector<int>>& adj,vector<pair<li,int>>& w){
  li& s=w[a].first;
  (s*=inv(fact(w[a].second-1)))%=MOD;
  (s*=fact(w[a].second-1-w[b].second))%=MOD;
  (s*=inv(w[b].first))%=MOD;
  (s*=fact(w[b].second))%=MOD;
  w[a].second-=w[b].second;
  //  w[b].second+=w[a].second;

  if(df)print("b/",w[b].second-1,"! *",w[a].second-1+w[b].second,"! *",w[a].first,"/",w[a].second,"!");
  li& t=w[b].first;
  (t*=inv(fact(w[b].second-1)))%=MOD;
  (t*=fact(w[a].second-1+w[b].second))%=MOD;
  (t*=w[a].first)%=MOD;
  (t*=inv(fact(w[a].second)))%=MOD;
  w[b].second+=w[a].second;
  if(df)print(a,"->",w[a],b,"->",w[b]);
}

void dfs(vector<vector<int>>& adj,vector<pair<li,int>>& w,
          vector<li>& ans,int parent=-1,int a=0){
  for(int x:adj[a]){
    if(x==parent) continue;
    reverse(a,x,adj,w);
    if(df)print("w:",w);
    ans[x]=w[x].first;
    dfs(adj,w,ans,a,x);
    reverse(x,a,adj,w);
  }
}
int main(){
  int n; cin >>n;
  vector<vector<int>> adj(n);
  rep(i,n-1){
    int a,b; cin >>a >>b; a--; b--;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  vector<pair<li,int>> w(n);
  if(df)for(auto x:adj)print(x);
  init(adj,w);
  if(df)print("w:",w);
  
  vector<li> ans(n);
  ans[0]=w[0].first;
  dfs(adj,w,ans);
  for(auto x:ans) print(x);
  
}


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

class Program
{

	//Main
	static void Main(string[] args)
	{
		//読み込む
		string[] S = Console.ReadLine().Split(' ');
		int H = int.Parse(S[0]);
		int N = int.Parse(S[1]);

		//消費魔力の最小値を格納するバケツ（２次元配列）
		//i番目の魔法までを使い、j以上のダメージを与える最小の魔力値を格納
		int[,] dp = new int[N+1,H+1];

		//初期化（十分に大きい数を初期値に設定しておく）
		for(int i=0; i<N+1;i++){
				for(int j=0; j<H+1; j++){
						dp[i,j] = 2000000000;
				}
		}

		//動的計画法を行い、i番目からの魔法から順に最小値を求めていく
		for(int i=1; i<=N; i++){
				//i番目の魔法のデータを読み込む
				string[] Si = Console.ReadLine().Split(' ');
				int Ai = int.Parse(Si[0]);
				int Bi = int.Parse(Si[1]);

				//体力を変更するループ処理
				for(int j=0; j<H+1; j++){
						//（１）j <= Aiのとき、Aiを一度使うだけで倒せる
						if(j <= Ai){
								//Aiを使うか使わないかの二者択一
								//使う場合
								int mp1 = Bi;
								//使わない場合
								int mp2 = dp[i-1, j];

								//少ない方をとる
								dp[i,j] = Math.Min(mp1,mp2);
						}
						//（２）j > Aiのとき、Aiを二度以上使う可能性がある
						//Aiを一度でも使うべきかはdp[i, j-1]以下をみればわかる
						//そこと比較すれば良い
						else{
								//Aiを使う場合
								int mp1 = dp[i,j-Ai] + Bi;
								//Aiを使わない場合
								int mp2 = dp[i-1, j];

								//少ない方をとる
								dp[i,j] = Math.Min(mp1,mp2);
						}
				}
		}


		//出力
		int ans = dp[N, H];
		Console.WriteLine(ans);
	}
}


Measured memory_bytes: 50016
<?php
  

//$abc = explode(" ",trim(fgets(STDIN)));
fscanf(STDIN,"%d",$n);
fscanf(STDIN,"%s",$s);

if($n==1 && $n%2!=0){
  echo "No\n";
  exit;
}
for($i=0;$i<(int)($n/2);$i++){
  $front .= $s[$i];
}

for($i=(int)($n/2);$i<$n;$i++){
  $back .= $s[$i];
}



if($front==$back){
  echo "Yes\n";
}else{
    echo "No\n";

}


Measured memory_bytes: 4728
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	ll n,k;
	ll in;
	cin >> n >>k;
	vector<ll> v;
	for(int i=0;i<n;++i) {cin >> in; v.push_back(in);};
	sort(v.begin(),v.end());
	auto lb=lower_bound(v.begin(),v.end(),k);
	cout << distance(lb,v.end()); 
	return 0;
}


Measured memory_bytes: 1400
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <iomanip>
using namespace std;
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const int INTMAX = 2147483647;
const int INTMIN = -2147483648;
const unsigned int UINTMAX = 4294967295;
const long LONGMAX = 9223372036854775807;
const long LONGMIN = -9223372036854775808;
const unsigned long ULONGMAX = 18446744073709551615;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n+1)
#define SUM(c) accumulate((c).begin(),(c).end(),0)
#define UNIQ(c) (c).erase(unique((c).begin(), (c).end()), (c).end());
#define Yn(b) puts(b?"Yes":"No")
#define YN(b) puts(b?"YES":"NO")
#define fsp(c) fixed << setprecision(c)

bool isprime(int p) {
  if (p==1) return false;
  FOR(i,2,p) {
    if (p%i==0) return false;
  }
  return true;
}

int dig(int n, int a) {return n/(int)pow(10,a)%10;}
int digl(long n, int a) {return n/(long)pow(10,a)%10;}
int digsum(int n) {int r=0;REP(i,10){r+=dig(n,i);}return r;}
int digsuml(long n) {int r=0;REP(i,19){r+=digl(n,i);}return r;}
int dignum(int n) {return n?to_string(n).length():0;}
int dignuml(long n) {return n?to_string(n).length():0;}

double cutl(int i,double n,double r) {
  if (i<=0||n<=i) return 0;
  return r*sqrt(1-((double)i-n/2)*((double)i-n/2)*4/n/n);
}

int main(){
  int sx,sy,tx,ty;
  cin >> sx >> sy >> tx >> ty;
  REP(i,ty-sy){
    cout << 'U';
  }
  REP(i,tx-sx){
    cout << 'R';
  }
  REP(i,ty-sy){
    cout << 'D';
  }
  REP(i,tx-sx){
    cout << 'L';
  }
  cout << 'L';
  REP(i,ty-sy+1){
    cout << 'U';
  }
  REP(i,tx-sx+1){
    cout << 'R';
  }
  cout << "DR";
  REP(i,ty-sy+1){
    cout << 'D';
  }
  REP(i,tx-sx+1){
    cout << 'L';
  }
  cout << 'U';
  return 0;
}

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

typedef long long ll;
typedef pair<int,int> pii;

long long MOD = 1000000000 + 7;

int main(){
  cout << setprecision(10);
  ll A,B,N;
  cin >> A >> B >> N;

  ll x;
  if(N < B-1){
    x = N;
  } else { 
    ll p = (N+1)/B;
     x = p * B - 1;
  }
  ll tmp1 = A*x;
  tmp1 /= B;

  ll tmp2 = x / B;
  tmp2 *= A;
  cerr << tmp1 << " " << tmp2 << endl;
  cout << tmp1 - tmp2 << endl;

}


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

Measured memory_bytes: 1848
#include <iostream>
#include <deque>

using namespace std;

int main()
{
  int n;
  cin >> n;
  deque<int> q;
  for(int i = 0; i < n; ++i){
    int tmp;
    cin >> tmp;
    if (i % 2 == 0){
      q.push_back(tmp);
    }else{
      q.push_front(tmp);
    }
  }
  if (n % 2 != 0){
    for(auto it = q.rbegin(); it != q.rend(); ++it){
      if (it != q.rbegin())
        cout << " ";
      cout << *it;
    }
  }else{
    for(auto it = q.begin(); it != q.end(); ++it){
      if (it != q.begin())
        cout << " ";
      cout << *it;
    }
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 2944
def appendnum(lis) :
    for i in range(1,14):
        lis.append(i)

def removenum(lis,num) :
    lis.remove(num)
    
def shownum(lis,S):
    for s in lis:
        print(S,s)
        
Slist = list()
Hlist = list()
Clist = list()
Dlist = list()

appendnum(Slist)
appendnum(Hlist)
appendnum(Clist)
appendnum(Dlist)

n = int(input())

for i in range(n):
    suit, num = input().split()
    suit = str(suit)
    num = int(num)
    if suit == "S":
        removenum(Slist,num)
    elif suit == "H":
        removenum(Hlist,num)
    elif suit == "C" :
        removenum(Clist,num)
    elif suit == "D" :
        removenum(Dlist,num)
        
shownum(Slist,"S")
shownum(Hlist,"H")
shownum(Clist,"C")
shownum(Dlist,"D")



Measured memory_bytes: 5608
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#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 REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); 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 ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tupiii;
typedef tuple<ll, ll, ll> tuplll;

const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;

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; }
void SWAP(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
void SWAP(int& a, int& b) { a ^= b; b ^= a; a ^= b; }


class D {
	static const int end{ 200001 };
	int n, c;
	int v[end];
public:
	D()
	{
		cin >> n >> c;
		memset(v, 0, sizeof v);
	}
	void solve()
	{
		REP(i, n)
		{
			int s, t, c;
			cin >> s >> t >> c;

			++v[2 * s - 1];
			--v[2 * t];
		}

		int ans{ 0 };
		int tmp{ 0 };
		REP(i, end)
		{
			tmp += v[i];
			chmax(ans, tmp);
		}

		ans = min(ans, c);

		cout << ans << endl;
	}
};


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

	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())outp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<'\n';}}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*modpow(a,b-1)%mod;ll k=modpow(a,b/2);return k*k%mod;}
vector<string> ans;
void dfs(int i,int k,int n,string s){
    if(i==n){
        ans.pb(s);
        return;
    }
    rep(j,k){
        string ns=s+(char)('a'+j);
        int nk=k;
        if(j==k-1)nk++;
        dfs(i+1,nk,n,ns);
    }
}
int main(){
    int n;cin>>n;
    dfs(0,1,n,"");
    sort(all(ans));
    for(auto x:ans)out(x);
}

Measured memory_bytes: 7796
#include <stdio.h>
int main(void){
    char b;
    scanf("%c",&b);
    
    if(b == 'A'){
      printf("T");
    }else if(b == 'T'){
      printf("A");
	}else if(b == 'G'){
      printf("C");
    }else if(b == 'C'){
      printf("G");
    }
    return 0;
}

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





int main()
{
    int n;
    cin >> n;
    vector<vector<int>> mV(n + 1);
    
 
    
    for (int i = 1; i < n + 1; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        vector<int> temp(4);
        temp[1] = a;
        temp[2] = b;
        temp[3] = c;
        mV[i] = temp;

    }
    vector<vector<int>> str(n + 1);



    for (int i = 1; i < n + 1; i++) {
        
        vector<int> temp(4);
        temp[1] = -1;
        temp[2] = -1;
        temp[3] = -1;
        str[i] = temp;

    }

    str[n][1] = mV[n][1];
    str[n][2] = mV[n][2];
    str[n][3] = mV[n][3];

    for (int i = n - 1; i >= 1; i--) {

        str[i][1] = mV[i][1] + max(str[i + 1][2], str[i + 1][3]);
        str[i][2] = mV[i][2] + max(str[i + 1][1], str[i + 1][3]);
        str[i][3] = mV[i][3] + max(str[i + 1][1], str[i + 1][2]);
 }

    cout << max(str[1][1], max(str[1][2], str[1][3])) << endl;
    
}



Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define MOD 1000000007
#define INF 1000000000000000
#define fi first
#define se second
#define all(v) v.begin(),v.end()
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
struct edge{int to,cost;};
typedef pair<int,int> P;
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
bool prime(int a){
	if(a==1)return false;
	for(int i=2;i*i<=a;i++){
		if(a%i==0)return false;
	}
	return true;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){//線分の交差判定
	double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
	double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
	double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
	double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
	return tc*td<0&&ta*tb<0;
}
int kaijo(int n){
	int ans=1;
	for(int i=2;i<=n;i++){
		ans*=i;
		ans%=MOD;
	}
	return ans;
}
int modpow(int a,int b){
	if(b==0)return 1;
	if(b%2)return modpow(a,b-1)*a%MOD;
	return modpow(a,b/2)*modpow(a,b/2)%MOD;
}
int comb(int a,int b){
	return kaijo(a)*modpow(kaijo(a-b),MOD-2)%MOD*modpow(kaijo(b),MOD-2)%MOD;
}
int n,K,a[55],ans;
signed main(){
	cin>>n>>K;
	rep(i,n)cin>>a[i];
	if(n==1){
		cout<<max(a[0],0ll)<<endl;
		return 0;
	}
	rep(l,n){
		for(int r=1;r<=n;r++){
			if(n-(r-l)>K)continue;
			vector<int>v;
			rep(k,n){
				if(l<=k&&k<r)continue;
				v.push_back(a[k]);
			}
			sort(v.begin(),v.end());
			int k=0;
			for(;k<K-(n-(r-l));k++){
				if(k>=v.size())break;
				if(v[k]>0)break;
			}
			int sum=0;
			for(;k<v.size();k++){
				if(k>=v.size())break;
				sum+=v[k];
			}
			ans=max(ans,sum);
		}
	}
	cout<<ans<<endl;		
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;cin>>n;long long a=0,c=n/15,d=n%15;
  a+=60*c*(c-1)+60*c;
  int i=1;
  while(i<=d){
    if(i%3!=0 && i%5!=0){a+=15*c+i;}
    i++;
  }
  cout<<a<<endl;
}


Measured memory_bytes: 3636
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int w,a,b;
    std::cin >> w >> a >>b;
    if(a>b){
        int p=a;
        a=b;
        b=p;
    }
    if(a+w<=b){
        std::cout << b-(a+w) << std::endl;
    }else{
        std::cout << 0 << std::endl;
    }
    
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数

//-------------------------------------------------
//



//-------------------------------------------------


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n ;
  cin >> n ;
  int ans = 0 ;
  
  vector<vector<int>> vec(n,vector<int>(n,2)) ;
  vector<vector<int>> vecvec(n,vector<int>(n)) ;
  
  REP(i,n){
    int a ;
    cin >> a ;
    REP(j,a){
      int b, c ;
      cin >> b >> c ;
      vec.at(i).at(b-1) = c ;
    }
  }
  
  for (int bitt = 0; bitt < (1 << n); bitt++) {
    int cnt = 0 ;
    bitset<15> bits(bitt); 
    bool flag = true ;
    vecvec = vec ;
    
    REP(i,n){
      REP(j,n){
        if(bits.test(i) && vecvec.at(i).at(j)==0 && bits.test(j)){
          flag = false ;
        }
        else if(bits.test(i) && vecvec.at(i).at(j)==1 && bits.test(j)!=true){
          flag = false ;
        }
      }
    }
    
    if(flag){
      REP(i,n){
        if(bits.test(i)){
          cnt++ ;
        }
      }
      ans = max(ans,cnt) ;
    }
  }
  cout << ans <<endl ;
  
  return 0 ;
}




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

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define INF 2000000000000000000LL
#define EPS 1e-9
#define debug(a) cerr<<#a<<"="<<(a)<<"\n"
#define FastSlowInput ios_base::sync_with_stdio(false); cin.tie(NULL);

typedef long long ll;
typedef unsigned long long ull;
typedef complex<double> cd;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll mod = 998244353 ;
const double PI = acos(-1);

int n,i,j,k,t;
int h[100002];
int dp[100002];

int main(){
    scanf("%d", &n);
    for(i=0;i<n;++i)
        scanf("%d", h+i);
    dp[0] = 0;
    for(i=1;i<n;++i){
        dp[i] = abs(h[i] - h[i-1]) + dp[i-1];
        if(i>1)
            dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]));
    }
    printf("%d\n", dp[n-1]);
	return 0;
}

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

char s[10010];
int main(){
	int n;
	scanf("%d%s",&n,s);
	int len=strlen(s);
	for(int i=0;i<len;i++)s[i]=(s[i]-'A'+n)%26+'A';
	puts(s);
}

Measured memory_bytes: 128
require 'set'

def aux(a, b)
  hit=a.zip(b).select{|x|x[0]==x[1]}.count
  blow= (Set.new(a) & Set.new(b)).count - hit
  [hit,blow]
end

def main
  fh=STDIN
  #fh=File.new("x.txt", "r")
  while fh.gets
    a=$_.chomp.split.map(&:to_i)
    b=fh.gets.chomp.split.map(&:to_i)
    puts aux(a,b).map(&:to_s).join(" ")
  end
end

if $0 == __FILE__ then
  main
end


Measured memory_bytes: 6964