akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'
#define rep(i,n) for(int_fast32_t i = 0; i < ((int_fast32_t)(n)); i++)   // 0-indexed up
#define rep1(i,n) for(int_fast32_t i = 1; i <= ((int_fast32_t)(n)); i++) // 1-indexed up
#define rrep(i,n) for(int_fast32_t i = ((int_fast32_t)(n)-1); i >= 0; i--)  // 0-indexed down
#define rrep1(i,n) for(int_fast32_t i = ((int_fast32_t)(n)); i >= 1; i--)   // 1-indexed down
#define all(x) (x).begin(),(x).end()

using namespace std;

template<typename T>
using vec = vector<T>;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using ll = long long;
using ld = long double;
using vi = vec<int_fast32_t>;
using vl = vec<int_fast64_t>;
using vld = vec<ld>;
using vii = vec<vi>;
using PII = pair<int_fast32_t, int_fast32_t>;

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

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

const ld Pi = std::acos(-1.0L);
constexpr ll infll = (1LL<<62)-1;
constexpr int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    int START_TIME = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
//    cout << fixed << setprecision(15);

    string s, t;
    i32 n,m;
    char ch;
    cin >> ch;
    if('A' <= ch && ch <= 'Z') {
        cout << 'A' << '\n';
    }
    else {
        cout << 'a' << '\n';
    }

    // printf("ExecutionTime: %d /ms\n",1000*(int)((clock()-START_TIME)/CLOCKS_PER_SEC));
}

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

#define  ll         long long
#define  llu        unsigned long long
#define  mod        1000000007
#define  pi         ((2.0)*acos(0.0))
#define  pb         push_back
#define  pf         push_front
#define  eb         emplace_back
#define  mp         make_pair
#define  all(x)     (x).begin(),(x).end()
#define  X          first
#define  Y          second

/*loop*/
#define  fr(i,m,n)   for(ll i=m;i<n;++i)

/*output shortcuts*/
#define  nl         "\n"
#define  Yes        cout<<"Yes\n"
#define  yes        cout<<"yes\n"
#define  YES        cout<<"YES\n"
#define  No         cout<<"No\n"
#define  no         cout<<"no\n"
#define  NO         cout<<"NO\n"

using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    string s,t;
    cin>>s>>t;

    ll x=s.size();
    ll y=t.size();

    ll dp[x+1][y+1];
    char dir[x+1][y+1];

    fr(i,0,x+1)
    {
        fr(j,0,y+1)
        {
            if(i==0 || j==0)
            {
                dp[i][j]=0;
                continue;
            }

            if(s[i-1]==t[j-1])
            {
                dir[i][j]='S';
                dp[i][j] = dp[i-1][j-1] + 1;
            }
            else
            {
                dp[i][j]=max(dp[i][j-1],dp[i-1][j]);

                if(dp[i][j]==dp[i][j-1])
                    dir[i][j]='L';
                else
                    dir[i][j]='U';
            }
        }
    }
        //cout<<dp[x][y]<<nl;
        /*printing the sub-string*/
        ll a=dp[x][y];
        //cout<<a<<nl;
        string sub="";
        while(a>0)
        {
            if(dir[x][y]=='S')
            {
                sub.pb(s[x-1]);
                x--; y--; a--;
                continue;
            }
            if(dir[x][y]=='L')
            {
                y--; continue;
            }
            if(dir[x][y]=='U')
            {
                x--; continue;
            }
        }

        reverse(all(sub));

        cout<<sub<<nl;

return 0;
}


Measured memory_bytes: 82780
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep1(i, n) for (ll i = 1; i <= (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
#define to_s to_string
#define len(v) (ll)v.size()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define print(x) cout << (x) << '\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;
ll MOD = 1e9 + 7;
ll devc(ll x, ll y) { return 1 + (x - 1) / y; }

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);

    ll N;
    cin >> N;
    ll a, b;
    cin >> a >> b;
    ll x = 0, y = abs(a - b);
    ll h, tpy, tpb;

    rep(i, N - 2){
        cin >> h;
        tpy = y;
        
        y = min(x + abs(h - a), y + abs(h - b));
        x = tpy;

        tpb = b;
        b = h;
        a = tpb;
    }

    print(y);

    return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())

p = 0
for score in range(1,n+1):
    if k <= score:
        # コインを振る必要が無い場合
        p += 1
    else:
        # コインを振る必要がある場合
        # 連続で何回表を連続する必要があるか？
        x = 1
        while(True):
            if (2**x) * score >= k:
                break
            else:
                x += 1
        p += (0.5) ** x

print(p/n)


Measured memory_bytes: 2940
n, k = map(int, input().split())

num = [0]*(k+1)
for i in range(1, n+1):
    num[i % k] += 1

ans = 0
for a in range(1, n+1):
    mod = a % k
    temp_mod = (k-mod)%k
    #print(temp_mod)
    if (temp_mod*2) % k != 0:
        continue
    ans += num[temp_mod]**2
print(ans)


Measured memory_bytes: 10424
import math
 
t8,t10=map(int,input().split(" "))
 
mint8=t8/0.08
maxt8=(t8+1)/0.08
mint10=t10/0.1
maxt10=(t10+1)/0.1
 
ans=list(set(range(math.ceil(mint8),int(maxt8))) & set(range(math.ceil(mint10),int(maxt10))))
if len(ans)==0:
    print(-1)
else:
    print(min(ans))

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

using namespace std;

int main(){
    long long n;
    cin >> n;
    int arr[n];
    int mid[n];
    for(int i = 0; i < n; ++i){
        cin >> arr[i];
        mid[i] = arr[i];
    }
    sort(mid, mid + n);
    for(int i = 0; i < n; ++i){
        if(arr[i] <= mid[n / 2 - 1]){
            cout << mid[n / 2] << endl;
        }else cout << mid[n / 2 - 1] << endl;
    }

    return 0;
}


Measured memory_bytes: 3712
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<functional>
using namespace std;
int p = 998244353;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(long long i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define V vector
#define Endl endl
#define veb vector<bool>
#define sq(a) (a)*(a)
int kai_size = 400001;
vel kai(kai_size, 1);
vel ink(kai_size, 1);
vel dist;
int RE() {
	vel v(3, 2);
	return v.at(4); 
}
int ru(int a, int r) {
	if (r == 0) { return 1; }
	int ans = ru(a, r / 2);
	ans *= ans; ans %= p;
	if (r % 2 == 1) { ans *= a; }
	return ans % p;
}
int inv(int a) {
	return ru(a, p - 2);
}
void make_kai() {
	rep(i, kai_size) { kai[i + 1] = (kai[i] * (i + 1)) % p; }
	rep(i, kai_size) { ink[i] = inv(kai[i]); }
}
int com(int n, int r) {
	int ans = kai[n] * ink[r];
	ans %= p; ans *= ink[n - r]; ans %= p;
	return ans;
}
int per(int n, int r) {
	int ans = kai[n] * ink[n - r];
	ans %= p;
	return ans;
}
vel dis(int mid1, vvel &way,vel &con) {
	int n = way.size();
	vel dist(n,-1);
	dist[mid1] = 0;
	queue<int> q;
	q.push(mid1);
	while (!q.empty()) {
		int st = q.front();
		q.pop();
		con.push_back(st);
		rep(i, way[st].size()) {
			int to = way[st][i];
			if (dist[to] == -1) {
				dist[to] = dist[st] + 1;
				q.push(to);
			}
		}
	}
	return dist;
}
int gr(int now, vvel &chi) {
	int ret = 0;
	for(auto to:chi[now]) {
		ret = ret xor (gr(to, chi) + 1);
	}
	return ret;
}
vel solve(V<pin> &lis, vel &a,int x) {
	int n = lis.size();
	int now_sum = 0;
	priority_queue<int> pq;
	rep(i, x) {
		int ind = lis[i].second;
		now_sum += a[ind];
		pq.push(-a[ind]);
	}
	vel sum_a(n, now_sum);
	for (int i = x; i < n; i++) {
		int ind = lis[i].second;
		if (a[ind] > -pq.top()) {
			now_sum += a[ind] - (-pq.top());
			pq.pop();
			pq.push(-a[ind]);
		}
		sum_a[i] = now_sum;
	}
	return sum_a;
}
signed main() {
	int x, y, z; cin >> x >> y >> z;
	int n = x + y + z;
	vel a(n);
	vel b(n);
	int ans = 0;
	V<pin> lis(n);
	rep(i, n) {
		int a1, b1, c1; cin >> a1 >> b1 >> c1;
		ans += c1;
		a[i] = a1 - c1;
		b[i] = b1 - c1;
		lis[i] = mkp(a[i] - b[i], i);
	}
	sor(lis);
	vel sum_b = solve(lis, b,y);
	reverse(sum_b.begin(), sum_b.end());
	reverse(lis.begin(), lis.end());
	vel sum_a = solve(lis, a,x);
	int pl = sum_a[x - 1] + sum_b[x];
	for(int i = x - 1; i < n - y; i++) {
		mmax(pl, sum_a[i] + sum_b[i+1]);
	}
	cout << ans + pl << endl;
	return 0;
}


Measured memory_bytes: 12104
#include <bits/stdc++.h>
#define ll long long
#define PI 3.141592653589
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define EPS 1e-7
#define f first
#define s second
using namespace std;
string s, t;
int memo[3005][3005];
int solve(int i, int j){
    if(i==s.size() || j==t.size())
        return 0;
    int &res = memo[i][j];
    if(res != -1)
        return res;
    if(s[i]==t[j])
        return res = 1 + solve(i+1, j+1);
    return res = max(solve(i+1, j), solve(i, j+1));
}
void print(int i, int j){
    if(i== s.size() || j==t.size())
        return;
    if(s[i]==t[j]){
        cout << s[i];
        print(i+1, j+1);
    }else if(memo[i][j] == memo[i+1][j])
        print(i+1, j);
    else
        print(i, j+1);
}
int main() {
    IO;
    memset(memo, -1, sizeof memo);
    cin >> s >> t;
    solve(0, 0);
    print(0, 0);
    return 0;
}


Measured memory_bytes: 35968
import itertools

n,m,r=map(int,input().split())
D=[[10**10]*n for _ in range(n)]
for i in range(n):
    D[i][i]=0
R=list(map(int,input().split()))
for i in range(m):
    a,b,c=map(int,input().split())
    D[a-1][b-1]=c
    D[b-1][a-1]=c

for k in range(n):
    for i in range(n):
        for j in range(n):
            D[i][j]=min(D[i][j],D[i][k]+D[k][j])

A=[]
for v in itertools.permutations(R,r):
    ans=0
    for i in range(r-1):
        ans+=D[v[i]-1][v[i+1]-1]
    A.append(ans)
print(min(A))

Measured memory_bytes: 48984
#include <cstdio>
#include <queue>
#include <algorithm>
using namespace std;

const int S = 40;
const int INF = 1 << 30;

int W, H;
int board[S][S], dist[S][S][4], cc[4];

// north, east, south, west
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, 1, 0, -1};

struct Elem {
    int x, y, dir;
    bool operator<(const Elem &e) const {
        return dist[x][y][dir] > dist[e.x][e.y][e.dir];
    }
};

int main() {
    while(scanf("%d%d", &W, &H)) {
        for(int i=0; i<S; i++) {
            for(int j=0; j<S; j++) {
                for(int k=0; k<4; k++) {
                    dist[i][j][k] = INF;
                }
            }
        }

        if(W == 0) break;

        for(int i=0; i<H; i++) {
            for(int j=0; j<W; j++) {
                scanf("%d", &board[i][j]);
            }
        }

        for(int i=0; i<4; i++) {
            scanf("%d", &cc[i]);
        }

        priority_queue<Elem> que;
        // initial: east
        que.push(Elem{0, 0, 1});
        dist[0][0][1] = 0;

        while(!que.empty()) {
            Elem cur = que.top(); que.pop();
            int x = cur.x, y = cur.y, d = cur.dir;

            for(int dd=0; dd<4; dd++) {
                int d_new = (d + dd) % 4;
                int cost = (board[x][y] == dd ? 0 : cc[dd]);
                int nx = x + dx[d_new], ny = y + dy[d_new];

                if(nx < 0 || nx >= H || ny < 0 || ny >= W) continue;
                if(dist[nx][ny][d_new] > dist[x][y][d] + cost) {
                    dist[nx][ny][d_new] = dist[x][y][d] + cost;
                    que.push(Elem{nx, ny, d_new});
                }
            }
        }

        int ans = *min_element(dist[H-1][W-1], dist[H-1][W-1] + 4);
        printf("%d\n", ans);
    }
    return 0;
}

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

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) (v.begin(),v.end())
#define COUT(x) cout<<(x)<< "\n"


int main(){
    int a,b,c;
    cin >> a >> b >> c;
    int max1 = max({a,b,c});
    int min1 = min({a,b,c});
    int cen1 = a+b+c-max1-min1;
    int ans = 2*max1 - min1 - cen1;
    if(ans%2==0)COUT(ans/2);
    else COUT((ans+1)/2+1);
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
 
int n, A[50];
 
int solve(int i, int m) {
    if (m == 0)return 1;
    if (i >= n)return 0;
    int res = solve(i + 1,m) || solve(i + 1, m - A[i]);
    return res;
}
 
int main() {
    int q, M, i;
 
    scanf("%d", &n);
    for (i = 0; i < n; i++)scanf("%d", &A[i]);
    scanf("%d", &q);
    for (i = 0; i < q; i++) {
        scanf("%d", &M);
        if (solve(0, M))printf("yes\n");
        else printf("no\n");
    }
    return 0;
}

Measured memory_bytes: 1764
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
N,K,S=map(int,input().split())

if S==10**9:
	for i in range(K):
		print(10**9)
	for j in range(N-K):
		print(12445677)

else:
	for j in range(N-K):
		print(S+1)
	for i in range(K):
		print(S)

Measured memory_bytes: 4212
#include<bits/stdc++.h>
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define rep(i,a,b) for (int i=(a); i<(b); i++)
#define per(i,a,b) for (int i=(b-1); i>=(a); i--)
#define de(x) cout << #x << " => " << x << endl
using namespace std;

#define fi first
#define se second
#define mp make_pair
typedef pair<int,int> pii;

#define pb push_back
typedef vector<int> vi;

typedef long long ll;
typedef long double ld;

const int N = 1e5 + 7;
vi G[N];
int n, m;
///----------------------------------------------
int dfn[N], low[N], _dfn;
bool vis[N];
void dfs(int u, int f) {
	vis[u] = true;
	dfn[u] = low[u] = _dfn++;
	rep(_v, 0, sz(G[u])) {
		int v = G[u][_v]; if (v == f) continue;
		if (!~dfn[v]) {
			dfs(v, u);
			low[u] = min(low[u], low[v]);
		} else low[u] = min(low[u], dfn[v]);
	}
}		
int main() {

	///read
	scanf("%d%d", &n, &m);
	rep(i, 0, m) {
		int a, b; scanf("%d%d", &a, &b); a--; b--;
		G[a].pb(b);
		G[b].pb(a);
	}

	rep(i, 0, n) dfn[i] = -1;
	dfs(0, -1);
	int ans = 0;
	//rep(i, 0, n) { de(low[i]); de(dfn[i]);}
	rep(i, 1, n) if (low[i] == dfn[i]) ans++;
	printf("%d", ans);

	return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,flag=1,ans=0,a[100009];
    scanf("%d",&n);
    for(int i=1; i<=n; i++)
    {
        scanf("%d",&a[i]);
        if(flag)
            ans+=a[i];
        else
            ans-=a[i];
        flag=!flag;
    }
    ans/=2;
    printf("%d ",ans*2);
    for(int i=1; i<n; i++)
    {
        ans=a[i]-ans;
        printf("%d ",ans*2);
    }
    return 0;
}

Measured memory_bytes: 1664
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF          1e9
#define INFLL        1e18
#define EPS          1e-9
#define MOD          1000000007
#define REP(i,n)     for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)    for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)    for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)   for(ll i=(n);i>0;--i)
#define REPC(i,obj)  for(auto i:obj)
#define ALL(obj)     (obj).begin(),(obj).end()
#define SETP(n)      cout<<fixed<<setprecision(n)
#define VV(T,h,w)    move(vector<vector<T>>(h,move(vector<T>(w))))
#define VVI(T,h,w,i) move(vector<vector<T>>(h,move(vector<T>(w,i))))
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

ll xor_1_to_n(ll n)
{
	ll res;
	switch (n % 4) {
	case 0:
		return n;
	case 1:
		return 1;
	case 2:
		return n + 1;
	case 3:
		return 0;
	}
}
int main()
{
	ll a = in(), b = in();
	cout << (xor_1_to_n(a - 1) ^ xor_1_to_n(b)) << endl;
}

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

using ll = long long;
using ull = unsigned long long;

#define MOD 1000000007

ll N, M, Q;
ll ANS;
vector<tuple<ll, ll, ll, ll>> values;

void dfs(vector<ll> A) {
    if(A.size() == N + 1) {
        ll ans = 0;
        for(auto &i: values) {
            if(A[get<1>(i)] - A[get<0>(i)] == get<2>(i)) ans += get<3>(i);
        }
        ANS = max(ANS, ans);
        return;
    }
    A.push_back(A.back());
    while(A.back() <= M) {
        dfs(A);
        A.back()++;
    }
}

int main(void) {
    cin >> N >> M >> Q;
    values.resize(Q);
    for(ll i = 0;i < Q;i++) cin >> get<0>(values[i]) >> get<1>(values[i]) >> get<2>(values[i]) >> get<3>(values[i]);
    dfs(vector<ll>{1});
    cout << ANS << endl;
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n,k;
vl a,b;

int main(){
	cin>>n>>k;
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		if(x>0) a.push_back(x);
		if(x<0) b.push_back(-x);
	}
	int n0=a.size(),n1=b.size();
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	if(n0+n1<k) cout<<0<<endl;
	else if(n0==0){
		if(k%2==0){
			ll t=1;
			reverse(b.begin(),b.end());
			for(int i=0;i<k;i++) (t*=b[i])%=mod;
			cout<<t<<endl;
		}
		else if(n0+n1<n) cout<<0<<endl;
		else{
			ll t=mod-1;
			for(int i=0;i<k;i++) (t*=b[i])%=mod;
			cout<<t<<endl;
		}
	}
	else{
		if(n0+n1==k&&n1%2==1){
			if(n0+n1<k) cout<<0<<endl;
			else{
				ll t=mod-1;
				for(int i=0;i<n0;i++) (t*=a[i])%=mod;
				for(int i=0;i<n1;i++) (t*=b[i])%=mod;
				cout<<t<<endl;
			}
			return 0;
		}
		reverse(a.begin(),a.end());
		reverse(b.begin(),b.end());
		int y=min(n1/2*2,k/2*2),x=k-y;
		while(x+1<n0&&y-2>=0&&a[x]*a[x+1]>b[y-1]*b[y-2]) x+=2,y-=2;
		ll t=1;
		for(int i=0;i<x;i++) (t*=a[i])%=mod;
		for(int i=0;i<y;i++) (t*=b[i])%=mod;
		cout<<t<<endl;
	}
}

Measured memory_bytes: 5528
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    long a[] = new long[3*N];
    for(int i=0;i<3*N;i++){
      a[i]=sc.nextLong();
    }
    Arrays.sort(a);
    long ans =0;
    boolean cnt=false;
    for(int i=3*N-1;i>N-1;i--){
      if(cnt){
        ans=ans+a[i];
        cnt=!cnt;
      }else{
        cnt=!cnt;
      } 
    }

    System.out.println(ans);

    






  }
  

  
}


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

vector<int>two,three,six,ans;

int main()
{
    int n;
    cin>>n;
    if(n==3)
    {
        cout<<"2 5 63"<<endl;
        return 0;
    }
    if(n==4)
    {
        cout<<"2 5 20 63"<<endl;
        return 0;
    }
    for(int i=2;i<=30000;i++)
    {
        if(i%6==0)
        {
            six.push_back(i);
            continue;
        }
        if(i%2==0)two.push_back(i);
        if(i%3==0)three.push_back(i);
    }

    ans.push_back(three.back());
    three.pop_back();
    ans.push_back(three.back());
    three.pop_back();
    n-=2;
    while(n>=2 && two.size()>=2)
    {
        ans.push_back(two.back());
        two.pop_back();
        ans.push_back(two.back());
        two.pop_back();

        n-=2;
    }
    while(n>=2 && three.size()>=2)
    {
        ans.push_back(three.back());
        three.pop_back();
        ans.push_back(three.back());
        three.pop_back();
        n-=2;
    }

    for(int i=0;i<n;i++)ans.push_back(six[i]);
    bool flag=0;
    for(int i=0;i<ans.size();i++)
    {
        if(flag)printf(" ");
        flag=1;
        printf("%d",ans[i]);
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 640
import sys
sys.setrecursionlimit(1000000)
def input():
    return sys.stdin.readline()[:-1]
from bisect import *
from collections import *
from math import *
from heapq import *

n, m = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
mod = 10**9+7
_a = 0
for i, a in enumerate(A):
    _a += i*a-(n-i-1)*a
    _a %= mod
_b = 0
for i, b in enumerate(B):
    _b += i*b-(m-i-1)*b
    _b %= mod
print(_a*_b%mod)

Measured memory_bytes: 19964
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define rep(i,n,m) for(int i=(n);i<(int)(m);i++)
#define reps(i,n,m) for(int i=(n);i<=(int)(m);i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define LB(a,x) lb(all(a), x) - a.begin()
#define UB(a,x) ub(all(a), x) - a.begin()
#define printfdouble(x) printf("%.12f\n",(x))
#define chartoint(c) (int)((c) - '0')
#define chartoll(c) (long long)((c) - '0')
#define MOD 1000000007
#define itn int
#define enld endl
#define ednl endl
#define icn cin
#define stirng string
using namespace std;
typedef long long ll;
const double pi = 3.141592653589793;
using Graph = vector<vector<int>>;
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 A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}


int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll N,W; cin >> N >> W;
    ll w[105],v[105];
    rep(i,0,N) cin >> w[i] >> v[i];
    ll dp[105][100100];
    Fill(dp, 0);
    rep(i,0,N){
        reps(j,0,W){
            if(j - w[i] >= 0){
                chmax(dp[i+1][j], dp[i][j-w[i]] + v[i]);
            }
            chmax(dp[i+1][j], dp[i][j]);
        }
    }

    cout << dp[N][W] << endl;
}


Measured memory_bytes: 85724
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(){
  char num[100];int i,sum=0,no;
  scanf("%s",num);
  for (i = 0; i < strlen(num); i++) sum+=(int)(num[i] - '0');
  no = atoi(num);
  if(no%sum == 0) printf("Yes");
  else printf("No");
  return 0;
}



Measured memory_bytes: 128
#include<iostream>
#include<cmath>
using namespace std;
int station[15][15];

int main()
{
	int n,d,sum,flag=0;
	float s;
	cin>>n>>d;
	for(int i=0;i<n;i++){
		for(int j=0;j<d;j++){
			cin>>station[i][j];
		}
	}
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			sum=0;
			for(int f=0;f<d;f++){
				sum+=(station[i][f]-station[j][f])*(station[i][f]-station[j][f]);
			}
			s=sqrt(sum);
			s=(int)s;
			if(s*s==sum) flag++;
		}
	}
	cout<<flag<<endl;
	return 0;
 } 

Measured memory_bytes: 256
from statistics import mean, median,variance,stdev
import sys
import math
import fractions

def j(q):
    if q==1: print("YES")
    else:print("NO")
    exit(0)


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())

x = ip()                              #入力整数1つ
#n,k= (int(i) for i in input().split())      #入力整数横2つ
#x,y,z = (int(i) for i in input().split())    #入力整数横3つ
#n,m,x,y= (int(i) for i in input().split())  #入力整数横4つ
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列

#jの変数はしようできないので注意
a =[]
for i in range(3):
    a.append(input())
sum = 0
for i in range(x):
    b = [a[0][i],a[1][i],a[2][i]]
    b.sort()
    if b[0] == b[1] or b[1]==b[2]:
        if b[0] == b[1] and b[1]==b[2]:
            f =0
        else: sum+=1
    else: sum+=2
print(sum)

Measured memory_bytes: 5784
m = gets.chomp.to_i
n = gets.chomp.to_i

ordrs = (0..m).map{(0..m).map{false}}

for x in (1..m)
  if x != 2
    ordrs[x][2] = true
  end
end

n.times.each do
  x, y = gets.chomp.split(" ").map{|s| s.to_i}
  ordrs[x][y] = true

  for x0 in (1..m)
    ordrs[x0][y] = true if ordrs[x0][x]
    ordrs[x][x0] = true if ordrs[y][x0]
    for y0 in (1..m)
      ordrs[x0][y0] = true if ordrs[x0][x] && ordrs[y][y0]
    end
  end
end

nums = []
for x in (1..m)
  min_id = 0

  for y in (1..m)
    if ordrs[y][x]
      id_y = nums.index(y)
      id = id_y.nil? ? 0 : id_y + 1
      min_id = id if min_id < id
    end
  end

  nums[min_id, 0] = x
end
puts nums

Measured memory_bytes: 6136
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <regex>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include<tuple>

using namespace std;

bool check(string str) {
	if (str[0] != 'A')return false;
	int C_cnt = 0;
	int L_cnt = 0;

	for (int i = 0; i < str.length(); i++) {
		if ('A' <= str[i] && str[i] <= 'Z')L_cnt++;
	}
	for (int i = 2; i < str.length() - 1; i++) {
		if (str[i] == 'C')C_cnt++;
	}
	return C_cnt == 1 && L_cnt == 2;
}

int main() {
	string str;

	cin >> str;

	if (check(str))cout << "AC" << endl;
	else cout << "WA" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <utility>
using namespace std;

#define MOD 1000000007
#define INF 1e9+7
#define INF_LONG 1e18
#define rep(i, n) for(int i=0; i<n; ++i)
#define rrep(i, m, n) for(int i=m; i<n; ++i)
typedef long long ll;

#define MAX_N 200000
#define MAX_M 100000
#define MAX_V 100
#define MAX_E 100
#define MAX_Q 100000

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

int ddx[] = {-1, 0, 1, 0, -1, 1, -1, 1};
int ddy[] = {0, -1, 0, 1, 1, 1, -1, -1};

ll gcd(ll x, ll y) {
  if(y==0) return x;
  else return gcd(y, x%y);
}

ll lcm(ll x, ll y) {
  return (x*y)/gcd(x, y);
}

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

int color[9];

void judge_color(int x) {

  int m = 400;
  rep(i, 8) {
    if(x<m) {
      ++color[i];
      break;
    }
    m += 400;
  }
  if(x>=3200) ++color[8];
}

int main() {

  int n; cin >> n;
  int a[n]; rep(i, n) cin >> a[i];
  int cnt = 0;

  rep(i, n) {
    judge_color(a[i]);
  }

  rep(i, 8) {
    if(color[i]!=0) ++cnt;
  }

  if(cnt==0) cout << 1 << " ";
  else cout << cnt << " ";

  cout << cnt+color[8] << endl;

  return 0;
}


Measured memory_bytes: 256
s = int(input())
min = 1000000
arr = [s]
count = 0
count_No1 = 0
n = 0
flg_exit = 0

def func(n):
    if(n % 2 == 0):
        return n / 2
    else:
        return 3 * n + 1

while (not flg_exit) or (min == 1000000):
    temp = func(arr[count])
    if temp == 1:
        count_No1 = count_No1 + 1
        flg_exit = 1 if count_No1 == 2 else flg_exit
    if (temp in arr) and (count_No1 != 1):
        min = count if count < min else min
    else:
        arr.append(int(temp))
        count = count + 1

count = 4 if s == 1 else count
count = 4 if s == 2 else count

print(count)

Measured memory_bytes: 3064
n = int(input())
a = [list(map(int, input().split())) for i in range(n)]
x = 0
y = 0
t = 0
for i in range(n):
    if abs(a[i][1] - x) + abs(a[i][2] - y) > abs(a[i][0] - t) or (a[i][1] - x + a[i][2] - y) % 2 != (a[i][0] - t) % 2:
        print('No')
        break
    else:
        x = a[i][1]
        y = a[i][2]
        t = a[i][0]
else:
    print('Yes')

Measured memory_bytes: 62808
n,k=map(int,input().split())
a=list(map(int,input().split()))
f=list(map(int,input().split()))
a.sort()
f.sort(reverse=1)
su=ok=ng=0
for i in range(n):
  ok=max(ok,a[i]*f[i])
  su+=a[i]
if su<=k:print(0);exit()
while ng+1!=ok:
  mid=(ok+ng)//2
  b=[mid//i for i in f]
  b.sort()
  h=0
  for i in range(n):h+=max(0,a[i]-b[i])
  if h<=k:ok=mid
  else:ng=mid
print(ok)

Measured memory_bytes: 127200
while (line = gets)
  lv = line.chop.split(",").map{|s| s.to_i}

  ls = lv[0..9]
  vs = lv[10..11]

  total = ls.inject{|s, k| s + k}
  d0 = total.to_f * vs[0] / (vs[0] + vs[1])
  #p dist0

  sum = 0
  for i in (0..9)
    sum += ls[i]
    if d0 <= sum
      puts i + 1
      break
    end
  end
end

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

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define eb emplace_back
#define pb push_back
#define size(s) (int)s.size()
#define int long long
#define vi vector<int>
#define vs vector<string>
#define vv vector<vector<int>>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcountll(x)
#define f first
#define se second
#define inc(v,n,x) v.assign(n,x)
#define incd(v,n) v.resize(n)
#define iniz(n) memset(n,0,sizeof(n))
#define inin(n) memset(n,-1,sizeof(n))
#define inimi(n) memset(n,0xc0,sizeof(n))
#define inima(n) memset(n,0x3f,sizeof(n))
#define all(v) (v).begin(),(v).end()
using namespace std;
using namespace __gnu_pbds;
template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }
double pi=acos(-1.0);
int md=1e9+7;
const int INF=1e15;
int dx1[]={0,0,-1,1};
int dy1[]={1,-1,0,0};
template<class T>
T abst(T a)
{return a<0?-a:a;}
template<class T> using ordered_set=tree<
T,
null_type,
less_equal<T>,
rb_tree_tag,
tree_order_statistics_node_update>;
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
struct HASH{
  size_t operator()(const pii &x)const{
    return (size_t) x.first * 37U + (size_t) x.second;}};
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int Pow(int n,int x){int ans=1;
 while(x>0)
 {if(x&1)ans=(ans*n)%md;n=(n*n)%md;x=x>>1;}
 return ans;}

 vi fact,inv;
void inverse(int n)
{inv.resize(n+1);inv[0]=1;
for(int i=1;i<=n;i++)inv[i]=Pow(fact[i],md-2);}
void factorial(int n)
{fact.resize(n+1);fact[0]=1;
for(int i=1;i<=n;i++)fact[i]=(fact[i-1]*i)%md;}
int ncr(int n,int r){
return (((fact[n]*inv[r])%md)*inv[n-r])%md;
}
template<class T>
T max2(T a,T b){return a>b?a:b;}
template<class T>
T min2(T a,T b){return a<b?a:b;}

template<class T>
T maxm(initializer_list <T> l){
	T ans=-INF;
	for(T i:l)
	ans=max2(ans,i);
	return ans;
}

void solve()
{
int a,b;cin>>a>>b;
cout<<a*b;
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t=1;
//cin>>t;
for(int i=1;i<=t;i++)
{
    solve();
}
}


Measured memory_bytes: 3656
"use strict";

const readData = input => {
  return {
    former: parseInt(input.substr(0, 2)),
    latter: parseInt(input.substr(2, 2))
  };
};

const mayBeMonth = n => n >= 1 && n <= 12;

const getType = data => {
  if (mayBeMonth(data.former)) {
    if (mayBeMonth(data.latter)) return "AMBIGUOUS";
    else return "MMYY";
  } else {
    if (mayBeMonth(data.latter)) return "YYMM";
    else return "NA";
  }
};

function Main(input) {
  let data = readData(input);
  console.log(getType(data));
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
#define u_b upper_bound
#define l_b lower_bound

struct SEG {
    static const int N = 1048576 / 2;
    int dat[2 * N + 10];

    SEG() {
        rep(i, N) {
            dat[i] = -2;
        }
        dat[0] = -1;
    }

    void update(int a, int b, int x, int l = 0, int r = N, int k = 0) {
        if (b <= l || r <= a)return;
        if (a <= l && r <= b) {
            dat[k] = x;
            return;
        }
        if (dat[k] != -2) {
            dat[2 * k + 1] = dat[k];
            dat[2 * k + 2] = dat[k];
        }
        int m = (l + r) / 2;
        update(a, b, x, l, m, 2 * k + 1);
        update(a, b, x, m, r, 2 * k + 2);
        dat[k] = -2;
    }

    int query(int a, int l = 0, int r = N, int k = 0) {
        if (a < l || r <= a)return -INF;
        if (dat[k] == -2) {
            int m = (l + r) / 2;
            int chl = query(a, l, m, 2 * k + 1);
            int chr = query(a, m, r, 2 * k + 2);
            return max(chl, chr);
        }
        return dat[k];
    }
};

int N, Q;
pair<int, pii> XST[200200];
int D[200200];
SEG seg;

signed main() {
    cin >> N >> Q;
    vector<int> time;
    rep(i, N) {
        int s, t, x;
        cin >> s >> t >> x;
        XST[i] = make_pair(x, pii(s, t));
        if (t - x - 1 < 0)continue;
        if (s - x < 0)time.push_back(0);
        time.push_back(t - x);
    }
    rep(i, Q) {
        cin >> D[i];
        time.push_back(D[i]);
    }
    sort(time.begin(), time.end());
    time.erase(unique(time.begin(), time.end()), time.end());
    rep(i, Q) {
        D[i] = l_b(time.begin(), time.end(), D[i]) - time.begin();
    }
    sort(XST, XST + N, greater<>());
    rep(i, N) {
        int x = XST[i].first;
        int s = XST[i].second.first;
        int t = XST[i].second.second;
        int sd = s - x;
        int td = t - x - 1;
        if (td < 0)continue;
        if (sd < 0)sd = 0;
        sd = l_b(time.begin(), time.end(), sd) - time.begin();
        td = l_b(time.begin(), time.end(), td + 1) - time.begin();
        seg.update(sd, td, x);

    }
    rep(i, Q) {
        cout << seg.query(D[i]) << endl;
    }
    return 0;
}


Measured memory_bytes: 19564
#include <bits/stdc++.h>
using namespace std;
//make_tuple emplace_back next_permutation push_back make_pair second first setprecision

#if MYDEBUG
#include "lib/cp_debug.h"
#else
#define DBG(...) ;
#endif

using LL = long long;
constexpr LL LINF=334ll<<53;
constexpr int INF=15<<26;
constexpr LL  MOD=1E9+7;

struct Problem{
    int h,w;
    vector<vector<char>> b;
    vector<vector<int>> diag;
    Problem(LL h, LL w):h(h),w(w),b (h,vector<char>(w)),diag (h-1,vector<int>(w-1)){};
    int largest_rectangle2d(vector<vector<int>> &table_){
        //find the rectanble of 1's that has largest area
        //imput[0,1]^(h*w)
        vector<vector<int>> table(table_);
        for(int j=0; j<(int)table_[0].size(); ++j){
            int count1 = 0;
            for(int i=0; i<(int)table_.size(); ++i){
                if(table_[i][j]==1)count1++;
                else count1=0;
                table[i][j]=count1;
            }
        }
        int ret = 0;
        for(int i=0; i<(int)table_.size(); ++i){
            DBG(i,table[i])
            ret = max(ret,largest_rectangle(table[i]));
        }
        return ret;
    }
    int largest_rectangle(vector<int> v){
        //find the rectanble in histogram
        //input: histogram (v[i] should be non-negative)
        int ret = 0;
        v.push_back(0);
        stack<pair<int,int>> S;
        S.emplace(0,-1);
        for(int i=0; i<(int)v.size(); ++i){
            if(v[i]>S.top().first) S.emplace(v[i],i);
            else {
                pair<int,int> t;
                while(v[i]<S.top().first){
                    t = S.top();
                    int area = (i-t.second+1)*(t.first+1);
                    ret = max(ret,area);
                    S.pop();
                }
                if(v[i]>S.top().first) S.emplace(v[i],t.second);
            }
        }
        DBG(ret)
        return ret;
    }
    void solve(){
        int ans = max(h,w);
        for(int i=0; i<h; ++i){
            for(int j=0; j<w; ++j){
                cin >> b[i][j];
            }
        }
        for(int i=0; i<h-1; ++i){
            for(int j=0; j<w-1; ++j){
                diag[i][j]=(!(b[i][j]==b[i+1][j+1])^(b[i+1][j]==b[i][j+1]));
            }
        }
        cout << max(ans,largest_rectangle2d(diag)) <<"\n";
    }
};

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    long long h,w;
    cin >> h >> w;

    Problem p(h,w);
    p.solve();
    return 0;
}



Measured memory_bytes: 35712
N = int(input())
S = input()

s = list(S)
alphabet = [chr(i) for i in range(65, 65 + 26)]

dst = ''
for k in range(len(s)):
  for i in range(26):
    if alphabet[i] == s[k]:
      num = (i + N) % 26
      dst = dst + alphabet[num]
      break
print(dst)

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

using ll=long long;
using P=pair<int, int>;
const ll INF=1LL<<60;
const ll MOD=1e9+7;

int main(){
    int n; cin >> n;
    vector<int> A(n);
    for(auto &x: A) cin >> x;
    int q; cin >> q;
    vector<int> m(q);
    for(auto &x: m) cin >> x;
    vector<bool> ans(q, 0);
    for(int bits; bits<(1<<n); bits++){
        int sum=0;
        for(int i=0; i<n; i++){
            if((bits>>i) & 1){
                sum+=A[i];
            }
        }
        for(int i=0; i<q; i++){
            if(sum == m[i]) ans[i]=true;
        }
    }
    for(int i=0; i<q; i++){
        if(ans[i]) cout << "yes" << endl;
        else cout << "no"  << endl;
    }
    return 0;
}


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int A,B,n;
    cin>>A>>B;
    if(A>=13){
        cout<<B<<endl;
    }
    else if(A<=12&&A>=6)
    {
        B/=2;
        cout<<B<<endl;

    }
    else if(A<=5)
    {
        cout<<"0\n";
    }

    return 0;
}


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

int main(){
  ll n, check = 0;
  string type;
  map<string, int> S;
  cin >> n;
  RAP(i,n){
    cin >> type;
    S[type]++;
  }
  for(auto x : S){
    check++;
  }
  cout << check << endl;
  return 0;
}


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

int main(){
  int N,C;
  cin >> N >> C;
  vector<tuple<int,int,int>> tpl(N);
  for (int i = 0; i < N; i++)
  {
    int s,t,c;
    cin >> s >> t >> c;
    s--;
    tpl[i]=make_tuple(c,s,t);
  }
  sort(tpl.begin(),tpl.end());

  vector<vector<pair<int,int>>> p(C+1);
  for (int i = 0; i < N; i++)
  {
    int ch = get<0>(tpl[i]);
    int left = get<1>(tpl[i]);
    int right = get<2>(tpl[i]);
    int j = i+1;

    while(ch==get<0>(tpl[j]) && j<N){
      if(right>=get<1>(tpl[j])){
        right=get<2>(tpl[j]);
        j++;
      }
      else break;
    }
    i=j-1;
    p[ch].push_back(make_pair(left,right));
  }

  vector<int> imos(100010,0);
  for(auto pv:p){
    for(auto s:pv){
      imos[s.first]++;
      imos[s.second]--;
    }
  }

  vector<int> anss(100010,0);
  int tmp = 0;
  for (int i = 0; i <= 100010; i++)
  {
    anss[i] = imos[i] + tmp;
    tmp = anss[i];
  }
  sort(anss.begin(),anss.end());
  reverse(anss.begin(),anss.end());
  
  cout << anss[0] << endl;
}

Measured memory_bytes: 3072
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define INF 10000000
using ll = long long ;
ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}
template< int id > struct CompTupleBy
{
  template<class T> 
  bool operator()( const T& a, const T& b ) const {
    return std::get<id>(a) < std::get<id>(b);
  }
};

using namespace std;

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

    int n;
    cin >> n;
    map<int,int> mp;
    rep(i,n){
        int a;
        cin >> a;
        if (mp.find(a) == mp.end()){
            mp[a] = 1;
        }else{
            mp[a] += 1;
        }  
        if (mp.find(a-1) == mp.end()){
            mp[a-1] = 1;
        }else{
            mp[a-1] += 1;
        }     
        if (mp.find(a+1) == mp.end()){
            mp[a+1] = 1;
        }else{
            mp[a+1] += 1;
        }        
    }
    int ans = 0;
    for(auto itr=mp.begin();itr != mp.end(); ++itr){
        ans = max(ans,itr->second);
    }
    cout << ans << endl;
    
    
}

Measured memory_bytes: 4736
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    int n = readint;
    writeln(180 * (n - 2));
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <bits/stdc++.h>
#define ff first
#define ss second
#define M 1000000007
typedef long long int ll;
using namespace std;
ll power(ll a,ll b){
    ll ans = 1;
    while(b>0){
        if(b%2!=0){
            ans = ((ans)*(a));
        }
        a = ((a)*(a));
        b=b/2;
    }
    return ans;
}
vector <vector <double>> dp;
double solve(const vector <double> &a,ll n,ll h,const ll &k){
    if(n==0){
        if(h>k/2)
            return 1.0;
        else
            return 0.0;
    }
    if(dp[n][h]!=-1.0){
        return dp[n][h];
    }
    return dp[n][h]=a[n-1]*(solve(a,n-1,h+1,k))+(1-a[n-1])*(solve(a,n-1,h,k));
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    vector <double> a(n);
    for(ll i=0;i<n;i++){
        cin>>a[i];
    }
    dp.assign(n+1,vector <double> (n+1,-1.0));
    cout<<fixed<<showpoint;
    cout<<setprecision(10);
    cout<<solve(a,n,0,n)<<endl;
    return 0;
}


Measured memory_bytes: 70912
n,k=map(int,input().split())
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 2000+1
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
for i in range(k):
  print(cmb(k-1,k-(i+1),mod)*cmb(n-k+1,i+1,mod)%mod)

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

long int plusAllPertern(string &s, int count, int size, int opPosition){
    if(count == size){
        long int subResult = 0;
        string divS = "";
        for(int i=0;i<s.size();i++){
            if(s[i] == '+'){
                subResult += atoi(divS.c_str());
                divS = "";
            }
            else{
                divS += s[i];
            }
            if(i == s.size()-1){
                subResult += atol(divS.c_str());
            }
        }
        return subResult;
    }
    else{
        // + version
        string newS = "";
        for(int i=0;i<opPosition;i++){
            newS += s[i];
        }
        newS += '+';
        for(int i=opPosition;i<s.size();i++){
            newS += s[i];
        }
        return plusAllPertern(newS, count+1, size, opPosition+2) + plusAllPertern(s, count+1, size, opPosition+1);
    }
}
int main() {
    string S;
    cin >> S;
    int size = S.size();
    long int result = plusAllPertern(S, 1, size, 1);
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

		int a = sc.nextInt();
		int b = sc.nextInt();
		
		a = a == 1 ? 14 : a;
		b = b == 1 ? 14 : b;
		
		if(a > b) {
			System.out.println("Alice");
		} else if (a < b) {
			System.out.println("Bob");
		} else {
			System.out.println("Draw");
		}
	}
}

Measured memory_bytes: 35632
#include <iostream>
#include <vector>
#include <cstdio>
using namespace std;

#define loop(i, n) for (int i = 3; i <= n; i++)

int main()
{
    int a, b;
    while (cin >> a >> b) {
        vector<int> data(101, 0);
        while (a != 0) {
            data[a]++;
            data[b]++;
            cin >> a >> b;
        }
        bool fl = true;
        if (!(data[1] % 2)) fl = false;
        if (!(data[2] % 2)) fl = false;
        loop(i, 100) {
            if (data[i] % 2) {
                fl = false;
            }
        }
        if (fl) {
            cout << "OK" << endl;
        } else {
            cout << "NG" << endl;
        }
    }
    return 0;
}

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

#include <math.h>
#include <stdlib.h>


#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;


int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int h, a; cin >> h >> a;
    cout << (h+a-1)/a << endl;    


    return 0;
}


Measured memory_bytes: 256
def main():
    N = int(input())
    *X, = map(int, input())

    memo = [-1] * 21

    def f(x):
        ret = 0
        while x > 0:
            x = x % bin(x)[2:].count('1')
            ret += 1
        return ret

    for x in range(21):
        memo[x] = f(x)

    cnt = X.count(1)

    if cnt == 1:
        ans = []
        i = 0
        for d in reversed(X):
            if d:
                ans.append(0)
                continue
            if i == 0 or X[-1]:
                ans.append(2)
            else:
                ans.append(1)
            i += 1
            
        ans.reverse()

        print(*ans, sep='\n')
        return

    pow2_0_1 = [1]
    pow2_1_0 = [1]

    t_0_1 = 1
    t_1_0 = 1
    for i in range(N):
        t_0_1 = t_0_1 * 2 % (cnt + 1)
        pow2_0_1.append(t_0_1)

        t_1_0 = t_1_0 * 2 % (cnt - 1)
        pow2_1_0.append(t_1_0)

    chg_0_1 = 0
    chg_1_0 = 0
    i = 0
    for d in reversed(X):
        if d:
            chg_0_1 = (chg_0_1 + pow2_0_1[i]) % (cnt + 1)
            chg_1_0 = (chg_1_0 + pow2_1_0[i]) % (cnt - 1)
        i += 1

    ans = []
    i = 0
    for d in reversed(X):
        if d:
            t = (chg_1_0 - pow2_1_0[i]) % (cnt - 1)
        else:
            t = (chg_0_1 + pow2_0_1[i]) % (cnt + 1)
        i += 1

        add_v = 1
        while t > 20 or memo[t] == -1:
            t = t % bin(t)[2:].count('1')
            add_v += 1
        ans.append(memo[t] + add_v)

    ans.reverse()

    print(*ans, sep='\n')


if __name__ == '__main__':
    main()

# import sys
# input = sys.stdin.readline
#
# sys.setrecursionlimit(10 ** 7)
#
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
#     while abs(ok - ng) > 1:
#         mid = (ok + ng) // 2
#         if func(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok


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

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

    string s[n];
    for (int i = 0; i < n; i++)
        cin >> s[i];

    sort(s, s + n);

    int ans = 1; string prev = s[0]; 
    for (int i = 1; i < n; i++)
        if (prev != s[i]) {
            ans++;
            prev = s[i];
        }

    cout << ans;
}

Measured memory_bytes: 9856
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  string s;
  cin >> N >> s;
  int r = 0;
  int b = 0;
 
  for (int i =0; i< N; i++ ) {
    if (s.at(i) == 'R'){
      r++;
    } else {
      b++;
    }
  }
  
  if (r > b){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256