akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define PI acos(-1.0)
#define mod 1e9+7
using namespace std;
ll seg[4*2*100000];
void update(int node, int left, int right, int pos, ll val)
{
    if(pos<left || pos>right) return;
    if(left==right)
    {
        seg[node]=val;
        return;
    }
    int mid=(left+right)/2;
    update(node*2, left, mid, pos, val);
    update((node*2)+1, mid+1, right, pos, val);
    seg[node]=max(seg[node*2], seg[(node*2)+1]);
}
ll query(int node, int left, int right, int i, int j)
{
    if(i>right || j<left) return 0;
    if(i<=left && j>=right) return seg[node];
    int mid=(left+right)/2;
    ll p1=query(node*2, left, mid, i, j);
    ll p2=query((node*2)+1, mid+1, right, i, j);
    return max(p1, p2);
}
int h[200010], v[200010];
int main()
{
    int n;
    scanf("%d", &n);
    for(int i=0; i<n; i++)
        scanf("%d", &h[i]);
    for(int i=0; i<n; i++)
        scanf("%d", &v[i]);
    for(int i=0; i<n; i++)
    {
        int x=h[i];
        ll temp=query(1, 0, n, 0, x-1);
        update(1, 0, n, x, temp+v[i]);
    }
    printf("%lld\n", seg[1]);
    return 0;
}


Measured memory_bytes: 6400
s=input()
if(len(s)%2==1):
    print("No")
else:
    kano=True
    for i in range(len(s)//2):
        if(s[i*2:i*2+2]!="hi"):
            kano=False
            break
    if(kano):
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 38384
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

#define maxN 100000

vector<int> G[maxN];
int col[maxN];

bool dfs(int n){
  for(int i = 0; i < (int)G[n].size(); i++){
    int nxt = G[n][i];
    if(col[nxt] == 0){
      col[nxt] = -col[n];
      if(!dfs(nxt)){
        return false;
      }
    }
    else {
      if(col[nxt] == col[n]){
        return false;
      }
      else {
        //何もしない
      }
    }
  }

  return true;
}

int main(){
  int N, M;
  cin >> N >> M;
  for(int i = 0; i < M; i++){
    int a, b;
    cin >> a >> b;
    a--; b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  //0:未確定　1:シロ　-1：黒
  fill(col, col + N, 0);
  col[0] = 1;
  bool isBipGraph = dfs(0);

  ll ans = 0;
  if(isBipGraph){
    //cout << "nibu" << endl;
    ll cnt1 = 0;
    ll cnt2 = 0;
    for(int i = 0; i < N; i++){
      if(col[i] == 1) cnt1++;
      if(col[i] == -1) cnt2++;
    }

    ans = cnt1 * cnt2 - M;
  }
  else {
    ans = (ll)N * (ll)(N - 1) / 2 - M;
  }

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


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

int main() {
  int a,b;
  cin >> a >> b;
  //奇数＝2で割った時の余りが1となる数
  //偶数＝2で割り切れる数
  //(a,b)＝(奇数,奇数)⇨積は奇数、それ以外は偶数
  if (a % 2 == 1 && b % 2 == 1) {
    cout << "Odd" << endl;
  } else {
    cout << "Even" << endl;
  }
}


Measured memory_bytes: 256
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")


#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define chmax(a, b) a = max(a, b);
#define chmin(a, b) a = min(a, b);
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;

int n, x[15], y[15], p[15];
ll ans[16];
int main() {
    scanf("%d", &n);
    rep(i, n) {
        scanf("%d%d%d", &x[i], &y[i], &p[i]);
    }
    rep(i, 16) ans[i] = 1002003004005006001LL;
    int bitmx = 1;
    rep(i, n) bitmx *= 3;
    vi xordered(n), yordered(n);
    rep(i, n) xordered[i] = yordered[i] = i;
    sort(all(xordered), [](int a, int b) { return x[a] < x[b];});
    sort(all(yordered), [](int a, int b) { return y[a] < y[b];});
    rep(b, bitmx) { // 3 ^ 15
        int xs[15], ys[15];
        int xssize = 0, yssize = 0;
        int cnt = 0;
        int ybucket[15] = {};
        {
            int t = b;
            rep(i, n) {
                if (t % 3 == 1) {
                    xs[xssize++] = x[xordered[i]];
                    cnt++;
                }
                else if (t % 3 == 2) {
                    ybucket[xordered[i]] = 1;
                    cnt++;
                }
                t /= 3;
            }
        }
        rep(i, n) {
            int yi = yordered[i];
            if (ybucket[yi]) ys[yssize++] = y[yi];
        }

        int d[15];
        rep(i, n) d[i] = min(abs(x[i]), abs(y[i]));
        if (xssize > 0) {
            int j = 0;
            for(int i: xordered) {
                while(j < xssize-1 && xs[j+1] < x[i]) j++;
                if (xs[j] >= x[i]) chmin(d[i], xs[j] - x[i])
                else {
                    chmin(d[i], x[i] - xs[j]);
                    if (j < xssize - 1) chmin(d[i],xs[j+1] - x[i])
                }
            }
        }
        if (yssize > 0){
            int j = 0;
            for(int i: yordered) {
                while(j < yssize-1 && ys[j+1] < y[i]) j++;
                if (ys[j] >= y[i]) chmin(d[i], ys[j] - y[i])
                else {
                    chmin(d[i], y[i] - ys[j])
                    if (j < yssize - 1) chmin(d[i],ys[j+1] - y[i])
                }
            }
        }
        ll s = 0;
        rep(i, n) s += (ll)d[i] * p[i];
        chmin(ans[cnt], s);
    }
    rep(i, n+1) printf("%lld\n", ans[i]);
}

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

int main(){
    int n;
    cin >> n;
    vector<string> s(n);
    vector<int>  p(n);
    for(int i = 0; i < n; i++){
        cin >> s.at(i);
        cin >> p.at(i);
    }
    vector<string> S(n);
    for(int i = 0; i < n; i++){
        S.at(i) = s.at(i);
    }
    sort(s.begin(), s.end());
    s.erase(unique(s.begin(), s.end()), s.end());
    
    vector<vector<int>> o(n, vector<int>(3));
    
    
    for(int i=0;i<n;i++){
        o.at(i).at(0) = p.at(i);
        o.at(i).at(2) = i;
        for(int j=0;j<s.size();j++){
            if(S.at(i)==s.at(j)) o.at(i).at(1) = j;
        }
    }
    
    

    sort(o.rbegin(), o.rend());


    vector<int> ans(n);
    int count = 0;
    for(int i=0;i<s.size();i++){
        for(int j=0;j<n;j++){
            if(o.at(j).at(1)==i){
                ans.at(count) = o.at(j).at(2);
                cout << ans.at(count) + 1 << endl;
                count++;
            } 
        }
    }

}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<queue>
using namespace std;
int n,d1,d2,c1[605][605],c2[605][605],*c[605];
int vx[10005],vy[10005],r[360005],num;
int cnt[2][2];
queue<int>qx,qy;
void solve(int d,int**c)
{
	num=0;
	for(int i=0;i*i<=d;i++)
	{
		if(r[d-i*i]!=-1)
		{
			vx[++num]=i;
			vy[num]=r[d-i*i];
			vx[++num]=i;
			vy[num]=-r[d-i*i];
			vx[++num]=-i;
			vy[num]=r[d-i*i];
			vx[++num]=-i;
			vy[num]=-r[d-i*i];
		}
	}
	int stx=1,sty=1;
	while(stx<=n)
	{
		c[stx][sty]=0;
		qx.push(stx);
		qy.push(sty);
		while(!qx.empty())
		{
			int x=qx.front();
			int y=qy.front();
			qx.pop();
			qy.pop();
			for(int i=1;i<=num;i++)
			{
				int xx=x+vx[i];
				int yy=y+vy[i];
				if(xx>=1&&xx<=n&&yy>=1&&yy<=n&&c[xx][yy]==-1)
				{
					c[xx][yy]=!c[x][y];
					qx.push(xx);
					qy.push(yy);
				}
			}
		}
		while(stx<=n&&c[stx][sty]!=-1)
		{
			sty++;
			if(sty>n)
			{
				sty-=n;
				stx++;
			}
		}
	}
}
int main()
{
	scanf("%d%d%d",&n,&d1,&d2);
	n<<=1;
	memset(r,-1,sizeof(r));
	memset(c1,-1,sizeof(c1));
	memset(c2,-1,sizeof(c2));
	for(int i=0;i<=n;i++)r[i*i]=i;
	for(int i=1;i<=n;i++)c[i]=c1[i];
	solve(d1,c);
	for(int i=1;i<=n;i++)c[i]=c2[i];
	solve(d2,c);
	for(int i=1;i<=n;i++)
	  for(int j=1;j<=n;j++)
	    cnt[c1[i][j]][c2[i][j]]++;
	int ans1=0,ans2=0;
	if(cnt[0][0]>cnt[ans1][ans2])ans1=0,ans2=0;
	if(cnt[0][1]>cnt[ans1][ans2])ans1=0,ans2=1;
	if(cnt[1][0]>cnt[ans1][ans2])ans1=1,ans2=0;
	if(cnt[1][1]>cnt[ans1][ans2])ans1=1,ans2=1;
	int tot=n*n/4;
	for(int i=1;i<=n;i++)
	for(int j=1;j<=n;j++)
	{
		if(tot==0)break;
		if(c1[i][j]==ans1&&c2[i][j]==ans2)
		{
			printf("%d %d\n",i-1,j-1);
			tot--;
		}
	}
	return 0;
}

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

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

#define MOD 1000000007

#define rep(i, n) for(ll (i) = 0;(i) < (ll)(n);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1;(i) >= 0LL;(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N;
    map<ll, ll> A;
    vector<pair<ll, ll>> B;
    cin >> N;
    rep(i, N) {
        ll temp;
        cin >> temp;
        A[temp]++;
    }
    copy_if(A.begin(), A.end(), back_inserter(B), [](pair<ll, ll> a) { return a.second >= 2; });
    sort(B.begin(), B.end(), [](pair<ll, ll> a, pair<ll, ll> b) { return a.first > b.first; });
    if(B.size() < 2) {
        cout << 0 << endl;
    } else {
        if(B.front().second >= 4) cout << B.front().first * B.front().first << endl;
        else cout << B[0].first * B[1].first << endl;
    }
    return 0;
}


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

#define REP(i, n ,N) for(ll i = (n); i < (N); i++)
#define RREP(i, n ,N) for(ll i = (N-1); i >= 0; i--)
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
ll inf = 1e18;

ll N;
string s;
ll ans=1;
int main(){
	cin >> N;
	cin >> s;
	REP(i,1,N){
		if(s[i-1] != s[i]) ans++;
	}
	p(ans);
	return 0;
}

Measured memory_bytes: 512
#include <cstdio>
#include <algorithm>

using namespace std;

const int maxn = 2e5 + 10;
const int inf = 1e9;

int a[maxn];

int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 1; i <= n; ++ i) scanf("%d", a + i);
	if (a[1]) return puts("-1"), 0;
	for (int i = 2; i <= n; ++ i)
		if (a[i] > a[i - 1] + 1) return puts("-1"), 0;
	int Mx = -inf;
	long long ans = 0;
	for (int i = n; i; -- i)
	{
		if (Mx + i == a[i]) continue;
		ans += a[i];
		Mx = a[i] - i;
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
using namespace std;
ll a,b,c,ans;
int main()
{
	cin>>a>>b>>c;
	ll sum=a+b;
	if (sum>=c) ans=b+c;
	else if (sum<c) ans=sum+1+b;
	cout<<ans;
	return 0;
}

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

int main(void){
	while(1){
		int n, i;
		double r=1, t=0;
		
		scanf(" %d", &n);
		if(n==-1) break;
		
		for(i=1; i<n; i++){
			t += atan(1/r);
			r = sqrt(r*r + 1);
		}
		
		printf("%.2lf\n%.2lf\n", r*cos(t), r*sin(t) );
	}

	return 0;
}

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

using namespace std;

struct Team {
	int tid, correct, penalty;

	Team() {}
	Team(int tid, int correct, int penalty) : tid(tid), correct(correct), penalty(penalty) {}
};
bool operator >(const Team& t1, const Team& t2) {
	if (t1.correct == t2.correct) return t1.penalty == t2.penalty ? t1.tid < t2.tid : t1.penalty < t2.penalty;
	else return t1.correct > t2.correct;
}

int main() {
	int T, P, R;
	while ( cin >> T >> P >> R, T || P || R ) {
		int correct[50] = {0}, wrong[50][10] = {0};
		bool solved[50][10] = {0};
		int penalty[50] = {0};
		for (int i = 0; i < R; ++i) {
			int tid, pid, time; string message; cin >> tid >> pid >> time >> message;
			--tid, --pid;
			if (!solved[tid][pid]) {
				if (message == "CORRECT") {
					++correct[tid];
					penalty[tid] += wrong[tid][pid] * 1200 + time;
					solved[tid][pid] = true;
				}
				else {
					++wrong[tid][pid];
				}
			}
		}

		vector<Team> v(T);
		for (int i = 0; i < T; ++i) {
			v[i] = Team(i+1, correct[i], penalty[i]);
		}
		sort( v.begin(), v.end(), greater<Team>() );

		for (int i = 0; i < T; ++i) {
			cout << v[i].tid << " " << v[i].correct << " " << v[i].penalty << endl;
		}
	}
}

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

#define INF 1e9
using namespace std;

int main() {

    int R, G, B, N; cin >> R >> G >> B >> N;

    int ans = 0;

    for (int i = 0; i <= N/R; ++i) {
        for (int j = 0; j <= N/G; ++j) {
            if ((N - R * i - G * j) % B == 0 && (N - R * i - G * j) / B >= 0) {
                ++ans;
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
from decimal import Decimal

while 1:
    n = Decimal(input())
    if n < 0:break
    d1 = int(n)
    d2 = n - d1
    s1 = format(d1,'b').zfill(8)
    if len(s1) > 8:
        print('NA')
        continue
    r = str(s1) + '.'
    for i in range(4):
        spam = int(d2 * 2)
        r += str(spam)
        d2 = d2*2 - spam
    if d2 > 0:
        print('NA')
        continue
    print(r)
    

Measured memory_bytes: 14716
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n, a[N];
int32_t main(){_

   int x, y;
   cin>>x>>y;
   cout<< max({2*x-1, 2*y-1, x+y});

   return 0;
}

// Common sense: do smth instead of nothing

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<stdio.h>
#include<math.h>

using namespace std;

int main(){

    double x1,y1,x2,y2;
    cin>>x1>>y1>>x2>>y2;

    double ans;

    ans = pow( pow((x2-x1),2) + pow((y2-y1),2),(0.5));
    printf("%.4f\n", ans ) ;
    return 0;
}

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


int main() {

    int l, i = 0;
    std::vector<int> v(3);

    for (int i=0; i<3 ; i++){
        std::cin >> l;
        v[i] = l;
    }

    std::sort(v.begin(),v.end(),std::greater<int>());

    int max = 10*v[0] + v[1] + v[2];

    std::cout << max << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <climits>
#include <sstream>

using namespace std;
 
int main() {
    int N;
    int t[110000], x[110000], y[110000];
    cin >> N;
    t[0] = x[0] = y[0] = 0;
    for (int i = 1; i < N+1; i++) cin >> t[i] >> x[i] >> y[i];

    bool flag = true;
    for (int i = 1; i < N+1; i++) {
        int dt = t[i] - t[i-1];
        int dist = abs(x[i] - x[i-1]) + abs(y[i] - y[i-1]);
        if (dt < dist) flag = false;
        if (dist % 2 != dt % 2) flag = false;
    }

    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))

using namespace std;
typedef pair<llint, llint> P;

llint n;

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	llint ans = 0;
	for(int i = 1; i <= n-1; i++){
		ans += (n-1)/i;
	}
	cout << ans << endl;
	
	return 0;
}

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

using namespace std;

const int MAX_N = 330, mod = 998244353;

int threshold, len, n, pre[MAX_N], dp[MAX_N][MAX_N][MAX_N], units[MAX_N];
char str[MAX_N];

int main()
{
    scanf("%s%d", str + 1, &threshold), len = strlen(str + 1);
    int last_pos = 0, ones = 0;
    for (int i = 1; i <= len; i++)
        ones += str[i] == '1';
    for (int i = 1; i <= len + 1; i++)
        if (str[i] != '1')
            units[++n] = i - last_pos - 1, last_pos = i;
    for (int i = 1; i <= n; i++)
        pre[i] = pre[i - 1] + units[i];
    dp[0][0][0] = 1, threshold = min(threshold, ones);
    for (int i = 0; i < n; i++)
        for (int j = pre[i]; j <= pre[n]; j++)
            for (int k = 0; k <= threshold; k++)
                if (dp[i][j][k])
                {
                    for (int g = max(j, pre[i + 1]); g <= pre[n]; g++)
                        if (k + g - j - units[i + 1] <= threshold)
                        {
                            if (i + 1 == n && g - j > units[i + 1])
                                break;
                            int cost = g - j <= units[i + 1] ? 0 : g - j - units[i + 1];
                            dp[i + 1][g][k + cost] = (0LL + dp[i + 1][g][k + cost] + dp[i][j][k]) % mod;
                        }
                }
    int ans = 0;
    for (int i = 0; i <= threshold; i++)
        ans = (0LL + ans + dp[n][ones][i]) % mod;
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 18892
import java.io.PrintWriter
import java.util.*
import kotlin.math.abs

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun nextDoubleList() = nextList().map(String::toDouble)

val pw = PrintWriter(System.out)
fun print(s: Any = "") = pw.print(s)
fun println(s: Any = "") = pw.println(s)

fun <T> Iterable<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)
fun <T> Array<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)

fun main(args: Array<String>) {
    main()
    pw.flush()
}

fun main() {
    val N = nextInt()
    val zque = ArrayDeque<P>()
    val que = ArrayDeque<P>()
    repeat(N) {
        val (x, y, h) = nextLongList()
        if (h == 0L) {
            zque.add(P(x, y, h))
            return@repeat
        }
        if (que.isEmpty()) {
            for (X in 0L..100L) {
                for (Y in 0L..100L) {
                    val H = h + abs(X - x) + abs(Y - y)
                    que.add(P(X, Y, H))
                }
            }
            return@repeat
        }
        repeat(que.size) {
            val p = que.poll()
            val (X, Y, H) = p
            if (h + abs(X - x) + abs(Y - y) == H) {
                que.add(p)
            }
        }
    }
    for (zp in zque) {
        val (x, y, _) = zp
        repeat(que.size) {
            val p = que.poll()
            val (X, Y, H) = p
            if (H - abs(X - x) - abs(Y - y) <= 0L) {
                que.add(p)
            }
        }
    }
    val (X, Y, H) = que.first
    println("$X $Y $H")
}

data class P(val x: Long, val y: Long, val h: Long)

Measured memory_bytes: 38680
#include<bits/stdc++.h>
using namespace std;
int main() {
    stack<int> s1;
    stack<pair<int,int> > s2;
    char ch;
    int sum = 0;
    for( int i = 0; cin >> ch; i++ ) {
        if(ch == '\\') {
            s1.push(i);
        }
        else if(ch == '/' && s1.size() > 0) {
            int j = s1.top(); s1.pop();
            sum += i-j;
            int a = i-j;
            while(s2.size() > 0 && s2.top().first > j) {
                a += s2.top().second;
                s2.pop();
            }
            s2.push(make_pair(j,a));
        }
    }
    
    vector<int> ans;
    while(s2.size() > 0) {
        ans.push_back(s2.top().second);
        s2.pop();
    }
        reverse(ans.begin(),ans.end());
        cout << sum << endl;
        cout << ans.size();
        for(int i = 0; i < ans.size(); i++) {
            cout << " ";
            cout << ans[i];
        }
    cout << endl;
    return 0;
}


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

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

int main() {
	int n, k;
	cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++) {
		cin >> a[i];
	}
	sort(a, a+n);
	int sum = 0;
	for(int i=0;i<k;i++) {
		sum += a[i];
	}
	cout << sum << "\n";
	return 0;
}

Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <stack>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;

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

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
const long long INF = 1LL << 60;
// spring s; cin >> s;
// cout << res << endl;
// --------write my code!!!!!----------//

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


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

a = list(map(int,input().split()))

bc = []
for _ in range(m):
    b, c = (int(x) for x in input().split())
    bc.append([b,c])

bc = sorted(bc, key=lambda x: -x[1])

memo = []

limit = 0

for i in range(m):
    a += [bc[i][1]]*bc[i][0]
    limit += bc[i][0]
    if limit >= n:
        break

a.sort(reverse=True)

print(sum(a[:n]))

Measured memory_bytes: 91288
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
}
signed main(){
  init_io();
  ll k,kt=1,sum=0;
  ll cnt = 0;
  cin >> k;
  vector<bool> lst(k+5,false);
  while(true){
    cnt++;
    sum = (sum+kt*7)%k;
    if(sum==0){
      cout <<cnt<<endl;
      break;
    }
    if(lst[sum]){
      cout <<-1<<endl;
      break;
    }
    lst[sum] = true;
    kt = (kt*10)%k;
  }
}


Measured memory_bytes: 3732
#include <bits/stdc++.h>
#include <chrono>
#include <math.h>
using namespace std;
using ll = long long;
using ld = long double;
using namespace std::chrono; 
#define fo(i,z,n) for(int i = z;i<n;i++)
#define Fo(i,z,n) for(ll i = z;i<n;i++)
#define INT_BITS 32
#define mod 1000000007
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> > 
#define pb push_back
#define f first
// #define s second
#define int long long
#define float long double
#define all(c) (c).begin(), (c).end()
#define endl '\n'
#define pi 3.14159265358979323846

ll power(ll a,ll p,ll m=mod)
{ll res=1;while(p>0){if(p&1)res=(res*a)%m;a=(a*a)%m;p>>=1;}
return res;}

int pow(int a,int b){
	if(b == 0)return 1;
	int res = pow(a,b/2);
	res = res*res;
	if(b&1)res *= a;
	return res;
}



int32_t main()
{
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     cout.tie(0);
   	
 //    int t;
 //     cin >> t;

 //     while(t--){

     
 // }

ld r;
cin >> r;
r = 2*pi*r;
cout <<fixed;
cout << setprecision(5);
cout << r << endl;







return 0;
	
	}




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

int main() {
	int n, a;
	cin >> n;
	int n4 = 0, n2 = 0, n1 = 0;
	for (int i = 0; i < n; i++) {
		cin >> a;
		if (a % 4 == 0) {
			n4++;
			continue;
		}
		else if (a % 2 == 0) {
			n2++;
			continue;
		}
		else {
			n1++;
		}
	}
	if (n2 == 0) {
		if (n4 + 1 >= n1) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	else {
		if (n4 >= n1) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
import copy
class SegmentTree:
    def __init__(self, N, func, I):
        self.sz = N
        self.func = copy.deepcopy(func)
        self.I = I
        self.seg = [I for i in range(self.sz * 2)]
 
    def assign(self, k, x):
        self.seg[k + self.sz] = x
 
    def build(self):
        for i in range(self.sz - 1, 0, -1):
            self.seg[i] = self.func(self.seg[2 * i], self.seg[2 * i + 1])
 
    def update(self, k, x):
        k += self.sz
        self.seg[k] = x
        while k > 1:
            k //= 2
            self.seg[k] = self.func(self.seg[2 * k], self.seg[2 * k + 1])
 
    def query(self, a, b):
        R = self.I
        a += self.sz
        b += self.sz
        while a < b:
            if a % 2 == 1:
                R = self.func(R, self.seg[a])
                a += 1
            if b % 2 == 1:
                b -= 1
                R = self.func(self.seg[b], R)
            a //= 2
            b //= 2
        return R

def main():
    import sys
    read = sys.stdin.buffer.read
    readline = sys.stdin.buffer.readline
    from fractions import gcd
    N = int(readline())
    m = map(int,read().split())
    seg = SegmentTree(N , gcd , 0)
    for i in range(N):
        seg.assign(i , next(m))
    seg.build()
    ans = 1
    for i in range(N):
        ans = max(ans,gcd(seg.query(0,i) , seg.query(i+1,N)))
    print(ans)

main()


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

struct Point{
  double x, y;

  Point operator+(const Point &other) {
    Point ret;
    ret.x = x + other.x;
    ret.y = y + other.y;
    return ret;
  }

  Point operator-(const Point &other) {
    Point ret;
    ret.x = x - other.x;
    ret.y = y - other.y;
    return ret;
  }

  Point operator*(const double &c) {
    Point ret;
    ret.x = c * x;
    ret.y = c * y;
    return ret;
  }

  Point rotate(double a) {
    Point ret;
    ret.x = x * cos(a) - y * sin(a);
    ret.y = x * sin(a) + y * cos(a);
    return ret;
  } 

  void print() {
    printf("%.10f %.10f\n", x, y);
  }
};

void koch(Point p1, Point p2, int n) {
  if (n > 0) {
    Point s, t, u;
    s = p1 * (2/3.0) + p2 * (1/3.0);
    u = p1 * (1/3.0) + p2 * (2/3.0);
    t = s + (u - s).rotate(M_PI/3.0);
    koch(p1, s, n - 1);
    s.print();
    koch(s, t, n - 1);
    t.print();
    koch(t, u, n - 1);
    u.print();
    koch(u, p2, n - 1);
  }
}

int main() {
  Point p1 = {0, 0}, p2 = {100, 0};
  int n;
  cin >> n;
  p1.print();
  koch(p1, p2, n);
  p2.print();
}


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

int main(){
    int N, M, X;
    cin >> N >> M >> X;

    vector<int> C(N);
    vector<vector<int>> A(N, vector<int>(M));
    vector<int> sum(M, 0);

    rep(i,N){
        cin >> C[i];
        rep(j,M){
            cin >> A[i][j];
            sum[j] += A[i][j];
        }
    }

    rep(i,M){
        if(sum[i] < X){
            cout << -1 << endl;
            return 0;
        }
    }

    int ans = 1e8;
    rep(bits, 1<<N){
        vector<int> sum_now(M,0);

        int now = 0;
        rep(i,N){
            if(bits>>i & 1){
                rep(j,M) sum_now[j] += A[i][j];
                now += C[i];
            }
        }

        bool flag = false;
        rep(i,M){
            if(sum_now[i] < X) flag = true;
        }
        if(flag) continue;
        ans = min(ans, now);
    }

    cout << ans << endl;
}


Measured memory_bytes: 3632
import java.util.*;

public class Main {

	public static void main(String[] argv) {

		Scanner sc = new Scanner(System.in);
		
		int m = sc.nextInt();
		int d = sc.nextInt();
	
		
		int number;
		if(d>=m)number= m;
		else number = m-1;
		
		System.out.println(number);
	}
}


Measured memory_bytes: 21716
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

template<class U, class V>
istream& operator >>(istream& in, pair<U, V>& pr) {
    return in >> pr.first >> pr.second;
}

template<class U, class V>
ostream& operator <<(ostream& out, pair<U, V>& p) {
    return out << p.first << " " << p.second;
}

template<class T>
ostream& operator <<(ostream& out, vector<T> vec) {
    for (T& e : vec)
        out << e << " ";
    return out << endl;
}

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

const int _inf = 1<<20;

VEC(VEC(int)) FW(VEC(VEC(int))& Graph)
{
    const int N = Graph.size();
    VEC(VEC(int)) Ret(N + 1, VEC(int)(N + 1, _inf));
    FOR(i, 0, N) {
        FOR(j, 0, N)
            Ret[i][j] = Graph[i][j];
        Ret[i][i] = 0;
    }

    FOR(i, 1, N + 1)
        FOR(j, 1, N + 1)
            FOR(k, 1, N + 1)
                Ret[j][k] = min(Ret[j][k], Ret[j][i] + Ret[i][k]);

    return Ret;
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int N;
    cin >> N;
    VEC(VEC(int)) Graph(N + 1, VEC(int)(N + 1, _inf));
    VEC(Pii) Edges;
    FOR(i, 0, N - 1) {
        int a, b;
        cin >> a >> b;
        Edges.push_back(Pii(a, b));
        Graph[b][a] = Graph[a][b] = min(Graph[a][b], 1);
    }

    int M;
    cin >> M;
    VEC(Pii) Queries(M);
    READVEC(Queries);

    VEC(int) EdgeMasks(N - 1, 0);

    FOR(i, 0, N - 1) {
        Pii& edge = Edges[i];
        int a = edge.first, b = edge.second;
        Graph[a][b] = Graph[b][a] = _inf;
        VEC(VEC(int)) fw2 = FW(Graph);
        Graph[a][b] = Graph[b][a] = 1;

        FOR(j, 0, M) {
            int u = Queries[j].first, v = Queries[j].second;
            if (fw2[u][v] >= _inf)
                EdgeMasks[i] |= 1 << j;
        }
    }

    VEC(lint) dp(1 << M, 0LL), dp2(1 << M, 0LL);
    dp[0] = 1LL;
    FOR(i, 0, N - 1) {
        FOR(mask, 0, 1 << M)
            dp2[mask] = 0;

        FOR(mask, 0, 1 << M) {
            dp2[mask] += dp[mask];
            dp2[mask | EdgeMasks[i]] += dp[mask];
        }

        FOR(mask, 0, 1 << M)
            dp[mask] = dp2[mask];
    }

    cout << dp[(1 << M) - 1] << endl;
    return 0;
};

Measured memory_bytes: 16640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define irep(i,a,b) for(typeof(i) i = (a); i < (b); ++i)
#define itrep(it,c) for(auto it = (c).begin(); it != (c).end(); ++it)


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

	ll K,A,B;
	cin >> K >> A >> B;

	for (ll i = A; i <= B; i++) {
		if (i % K == 0) {
			cout << "OK" << endl;
			return 0;
		}
	}
	cout << "NG" << endl;
}


Measured memory_bytes: 3600
//============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;
char chr;
int N,M,D;
int A[101][101];
int main() {
	cin>>N>>M>>D;

	for(int i=0;i<N;i++){
		for(int j=0;j<M;j++){
			cin>>chr;
			if(chr=='.')A[i][j]=1;
			if(chr=='#')A[i][j]=0;
		}
	}
	int S=0;

	for(int i=0;i<N;i++){
		for(int j=0;j<M;j++){
			int R=1;
			for(int k=0;k<D;k++){
				if(A[i][j+k]==0){
					R=0;
					k=D;
				}
			}
			S+=R;
			R=1;
			for(int k=0;k<D;k++){
				if(A[i+k][j]==0){
					R=0;
					k=D;
				}
			}
			S+=R;
		}
	}

	cout<<S<<endl;
	return 0;
}

Measured memory_bytes: 3076
#include<stdio.h>

int main(){
 int x, y;

while(1){
 scanf("%d %d", &x,&y);
 if ( x == 0 && y == 0 ) break;
 if ( x < y ){
   printf("%d %d\n", x,y);
 }  else {
   printf("%d %d\n", y,x);
 }
}
}




Measured memory_bytes: 2024
#include <iostream>
#include <cstdio>
#include <string>
#include <set>
using namespace std;

int main() {
	int n;
	string com,word;
	set<string> dic;
	scanf("%d",&n);
	for(int i=0; i<n; ++i) {
		cin >> com >> word;
		if(com=="insert") {
			dic.insert(word);
		} else if(com=="find") {
			if(dic.find(word)!=dic.end()) {
				printf("yes\n");
			} else {
				printf("no\n");
			}
		}
	}
	return 0;
}

Measured memory_bytes: 32596
#include <iostream>
#include <map>
using namespace std;
int main()
{
  long s;
  cin >> s;
  long f[1000001] = {};
  f[1] = s;
  long idx = 2;
  map<long, long> m;
  m[f[1]] = 1;
  while (true)
  {
    long val = 0;
    if (f[idx - 1] % 2 == 0)
      val = f[idx - 1] / 2;
    else
      val = 3 * f[idx - 1] + 1;
    f[idx] = val;
    if (m.find(f[idx]) == m.end())
      m[f[idx]] = 1;
    else
    {
      cout << idx << endl;
      return 0;
    }
    idx++;
  }
  return 0;
}

Measured memory_bytes: 8064
<?php
// # 整数の入力
// fscanf(STDIN, "%d", $a);
# スペース区切りの整数の入力
// fscanf(STDIN, "%d %d %d", $a, $b, $c);
// # 文字列の入力
// fscanf(STDIN, "%s", $s);
// 一行分をそのまま変数に格納
// $n = trim(fgets(STDIN));
// 空白で区切られたのを配列に格納
// $arr = explode(' ', trim(fgets(STDIN)));

// 1.Circle
$r = trim(fgets(STDIN));
$circle_rond = $r * 2 * 3.14;
 echo $circle_rond;




# 出力
// echo ($a+$b+$c)." ".$s."\n";


Measured memory_bytes: 16064
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
typedef pair<int,int> P;
const int MOD = 1000000007;
const ll INF = 1e10;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 




////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////

int n;vector<int> a, p;unordered_map<int,int> mp;
signed main(){
  cin>>n;int ans = 0;
  rep(i,n){
    int aa;cin>>aa;a.push_back(aa);
    mp[aa]++;
  }
  sort(a.begin(), a.end());
  p.push_back(1);
  repd(i,1,35)p.push_back(p[i-1]*2);
  for(int i = n-1;i >= 0;i--){
    if(!mp.count(a[i]) || mp[a[i]] <= 0)continue;
    mp[a[i]]--;
    rep(j,p.size()){
      if(mp.find(p[j]-a[i]) != mp.end() && mp[p[j]-a[i]]){
        mp[p[j]-a[i]]--;ans++;break;
      }
    }
  }
  cout << ans << endl;
}


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

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

int main(){
  int N;
  cin >> N;
  
  int a[N];
  int ans=1;
  for(int i=0;i<N;i++){
    cin >> a[i];
  }
  sort(a,a+N);
  
 
  for(int i=0;i<N-1;i++){
    ans=gcd(a[i],a[i+1]);
    a[i+1]=ans;
  }
  
  cout << ans << endl;
  return 0;
}
  

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int N=in();
	vector<pair<ll,ll>> P(N);
	REP(i,N){
		int X=in(),L=in();
		P[i].first=X-L;
		P[i].second=X+L;
	}
	sort(ALL(P),PAIRCOMP(first,>));
	
	int S=1,E=P[0].first;
	REP(i,N-1){
		if(P[i+1].second<=E){
			S++;
			E=P[i+1].first;
		}
	}

	out(S);
	return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>

typedef struct {
	int left;
	int right;
} pool;

int main(void)
{
	int i, j, len, k, kl, kr, le, ri, he, flag, h[20001], area[10000], areasum;
	char ch;
	pool pleft[10000], pright[10000], p[10000];
	
	h[0] = 0;
	i = 0;
	while(1) {
		scanf("%c",&ch);
		if( ch == '\n' ) break;
		switch (ch) {
		case '/':
			h[i+1] = h[i] + 1;
			break;
		case '\\':
			h[i+1] = h[i] - 1;
			break;
		case '_':
			h[i+1] = h[i];
			break;
		}
		i++;
	}
	len = i;
	
	kl = 0;
	flag = 1;
	for (i=0; i<=len-1; i++) {
		if( h[i] < h[i+1] ) {
			flag = 1;
		} else if( flag == 1 && h[i] > h[i+1] ) {
			flag = 0;
			for (j=i+1; j<=len; j++) {
				if( h[i] == h[j] ) {
					pleft[kl].left = i;
					pleft[kl].right = j;
					kl++;
					i = j - 1;
					flag = 1;
					break;
				}
			}
		}
	}
	
	kr = 0;
	flag = 1;
	for (i=len; i>=1; i--) {
		if( h[i] < h[i-1] ) {
			flag = 1;
		} else if( flag == 1 && h[i] > h[i-1] ) {
			flag = 0;
			for (j=i-1; j>=0; j--) {
				if( h[i] == h[j] ) {
					pright[kr].left = j;
					pright[kr].right = i;
					kr++;
					i = j + 1;
					flag = 1;
					break;
				}
			}
		}
	}
	
	
	k = 0;
	le = 0;
	ri = kr - 1;
	for (i=0; i<len; i++) {
		if( le == kl && ri == -1 ) {
			break;
		} else if(le==kl) {
			while ( ri != -1 ) {
				p[k].left = pright[ri].left;
				p[k].right = pright[ri].right;
				k++;
				ri--;
			}
		} else if(ri==-1) {
			while ( le != kl ) {
				p[k].left = pleft[le].left;
				p[k].right = pleft[le].right;
				k++;
				le++;
			}
		} else {
			if( i == pleft[le].left ) {
				p[k].left = pleft[le].left;
				p[k].right = pleft[le].right;
				i = pleft[le].right - 1;
				k++;
				le++;
				while ( i >= pright[ri].left ) {
					ri--;
					if(ri==-1) break;
				}
			} else if( i == pright[ri].left ) {
				p[k].left = pright[ri].left;
				p[k].right = pright[ri].right;
				i = pright[ri].right - 1;
				k++;
				ri--;
				while ( i >= pleft[le].left ) {
					le++;
					if(le==kl) break;
				}
			}
		}
	}
	
	areasum = 0;
	for (i=0; i<k; i++) {
		le = p[i].left;
		ri = p[i].right;
		area[i] = 0;
		he = h[le];
		for (j=le; j<ri; j++) {
			area[i] += ( he - h[j] ) + ( he - h[j+1] );
		}
		area[i] /= 2;
		areasum += area[i];
	}
	
	if( k == 0 ) {
		printf("0\n0\n");
	} else {
		printf("%d\n",areasum);
		printf("%d ",k);
		for (i=0; i<k-1; i++) {
			printf("%d ",area[i]);
		}
		printf("%d\n",area[k-1]);
	}
	
	return 0;
}

Measured memory_bytes: 696
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<functional>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;

int main(){
    int a,b;
    cin>>a>>b;
    if(a*b%2==1){
        cout<<"Odd";
    }else{
        
        cout<<"Even";
    }
    return 0;
}

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  string s;
  cin >> s;

  ll cnt = 0;
  ll ans = -INF;
  REP(i, s.size()){
    if(s[i] == 'S')
      cnt--;
    else
      cnt++;
    ans = max(ans, cnt);
  }

  cout << ans*2 << endl;

}


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

#include <iostream>

using namespace std;

typedef long long ll;

int n, k;

int main()
{
    scanf("%d%d", &n, &k);
    if(k == 0) return !printf("%lld", 1LL * n * n);
    ll ans = 0;
    for(int b = k + 1; b <= n; b++)
    {
        ans += n / b * (b - k);
        if(n % b >= k) ans += n % b - k + 1;
    }
    printf("%lld", ans);
    return 0;
}

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

using ll = long long;

#define for_(i,a,b) for(int i = (a);i < (b);i++)
#define rfor_(i,a,b) for(int i = (b)-1;i >= (a);i--)
#define rep(i,n) for_(i,0,(n))
#define rrep(i,n) rfor_(i,0,(n))

int N, M, T, X;

map<ll, int> d;

ll c;

int main(){
  cin.tie(0);
  
  cin>>N>>M;
  
  rep(i, N) {
  	cin>>X;
  	T = (T+X)%M;
  	if(T==0)c++;
  	d[T]++;
  }
  
  for (auto i : d) {
        ll it = i.second;
        c += it * (it - 1) / 2;
  }
  
  cout<<c<<endl;
  
  return 0;
}


Measured memory_bytes: 4224
#include <iostream>
#include <algorithm>

int imos[100010];

using namespace std;


int main() {
  int n;
  cin >> n;
  
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    imos[a - 1]++;
    imos[b]--;
  }

  int ans = 0;
  int current = 0;
  for (int i = 1; i < 100010; i++) {
    current += imos[i];
    if (current >= i) {
      ans = i;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3436
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().solveA();
		// new Main().solveB();
		// new Main().solveC();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;

		try {
			scanner = new Scanner(System.in);

			System.out.println((scanner.nextInt() - scanner.nextInt()) + 1);

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveC() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
}

Measured memory_bytes: 25300
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#define maxn 100005
using namespace std;
int n;
int cnt[maxn];
int main()
{
	scanf("%d",&n);
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		int x;
		scanf("%d",&x);
		cnt[x]++;
		ans=max(ans,cnt[x]);
		cnt[x+1]++;
		ans=max(ans,cnt[x+1]);
		if(x-1>=0)
			cnt[x-1]++,ans=max(ans,cnt[x-1]);
	}
	printf("%d\n",ans);
}


Measured memory_bytes: 640
from sys import stdin
input=lambda : stdin.readline().strip()
from math import ceil,sqrt,factorial,gcd
n,k=map(int,input().split())
s=set()
for i in range(k):
	a=int(input())
	l=list(map(int,input().split()))
	for j in  l:
		s.add(j)
print(n-len(s))

Measured memory_bytes: 9188
//g++ -std=c++14 test.cpp -o test.out
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
using namespace std;

#define LL long long int

int X,Y,Z;
int K;
LL A[1000],B[1000],C[1000];

LL ans[3000];

void solve(){
	vector<LL> AB;
	for(int i=0;i<X;i++){
		for(int j=0;j<Y;j++) AB.push_back(A[i]+B[j]);
	}
	sort(AB.begin(),AB.end(),greater<LL>());
	sort(C,C+Z,greater<LL>());

	priority_queue<LL> q;
	for(int i=0;i<min(K,X*Y);i++){
		for(int j=0;j<min(K,Z);j++){
			q.push(-(AB[i] + C[j]));
			if(q.size()>K) q.pop();
		}
	}
	for(int i=K-1;i>=0;i--){
		ans[i] = -q.top();
		q.pop();
	}
}
 
int main(){
	cin >> X >> Y >> Z >> K;
	for(int i=0;i<X;i++) cin >> A[i];
	for(int i=0;i<Y;i++) cin >> B[i];
	for(int i=0;i<Z;i++) cin >> C[i];
 
	solve();

	for(int i=0;i<K;i++) cout << ans[i] << " " << endl;
	return 0;
}


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

int main(){
  int n; cin>>n;
  int num[n];
  for(int i=0;i<n;i++){
    cin>>num[i];
  }
  sort(num,num+n);
  double ans=num[0];
  for(int i=1;i<n;i++){
    ans=(ans+num[i])/2;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();

		int[] a = new int[n];
		int[] b = new int[n];
		int[] c = new int[n];

		for(int i =0 ; i<n;i++) {
			a[i] = sc.nextInt();
		}
		for(int i =0 ; i<n;i++) {
			b[i] = sc.nextInt();
		}
		for(int i =0 ; i<n-1;i++) {
			c[i] = sc.nextInt();
		}
		c[n-1]=0;

		int sum = 0;
		int lastone = -1;
		for(int i =0;i<n;i++) {
			sum+=b[a[i]-1];
			if(lastone+1==a[i]) {
				sum+=c[lastone-1];
			}
			lastone=a[i];
		}


		System.out.println(sum);
	}
}
/*
class City{
	int order;
	int prefecture;
	int year;
	int number;
	City(int order,int prefecture, int year){
		this.order = order;
		this.prefecture = prefecture;
		this.year = year;
	}
}
*/

Measured memory_bytes: 22996
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;
int a[SIZE],b[SIZE];
bool inter(int x1,int y1,int x2,int y2){
    if(x1>y1)swap(x1,y1);
    if(x2>y2)swap(x2,y2);
    if(x1>y2||x2>y1)return 0;
    return 1;
}
int main(){
    DRI(N);
    REP(i,N)RI(a[i]);
    REP(i,N)RI(b[i]);
    sort(a,a+N);sort(b,b+N);
    int ll=0;
    LL an=1;
    REPP(i,1,N){
        while(!inter(a[i],b[i],a[ll],b[ll]))ll++;
        an=an*(i-ll+1)%MOD;
    }
    cout<<an<<endl;
    return 0;
}


Measured memory_bytes: 1024