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

int main(){
  long long int x;
  cin >> x;
  long long int a,b;
  long long int A_5,B_5;
  bool hantei=false;
  for(long long int i=1;i<150;i++){
    A_5=i*i*i*i*i;    
    for(long long int j=0;j<i;j++){
      B_5=j*j*j*j*j;
      if(A_5-B_5==x){
        a=i;
        b=j;
        hantei=true;
        break;
      }
      if(A_5+B_5==x){
        a=i;
        b=0-j;
        hantei=true;
        break;
      }
    }
    if(hantei)break;
  }
  cout << a << ' ' << b << endl;
    
}


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

using namespace std;

int visit[30][30],X[5]= {0,1,0,-1},Y[5]= {1,0,-1,0},ans=0,H,W;
char s[30][30];

struct node
{
    int x,y,sum;
};

queue <node> q;

void BFS(int sx,int sy,int ex,int ey)
{
    int x1,y1,p=0;
    node M,M1;
    while(!q.empty())
        q.pop();
    M.x=sx;
    M.y=sy;
    M.sum=0;
    visit[sx][sy]=-2;
    q.push(M);
    while(!q.empty())
    {
        M=q.front();
        q.pop();
        for(int i=0; i<4; i++)
        {
            x1=M.x+X[i];
            y1=M.y+Y[i];
            if(x1>=1&&x1<=H&&y1>=1&&y1<=W&&visit[x1][y1]==0)
            {
                if(x1==ex&&y1==ey)
                {
                    p=1;
                    ans=M.sum+1;
                    break;
                }
                else
                {
                    M1.x=M.x+X[i];
                    M1.y=M.y+Y[i];
                    M1.sum=M.sum+1;
                    visit[x1][y1]=-2;
                    q.push(M1);
                }
            }
        }
        if(p==1)
            break;
    }
}

void Clear()
{
    int i,j;
    for(i=1; i<=H; i++)
        for(j=1; j<=W; j++)
        {
            if(s[i][j]=='#')
                visit[i][j]=-1;
            else
                visit[i][j]=0;
        }
}

int main()
{
    int i,j,t,k,x,Max=0;
    cin>>H>>W;
    for(i=1; i<=H; i++)
        for(j=1; j<=W; j++)
            scanf(" %c",&s[i][j]);
    /*for(i=1; i<=H; i++)
    {
        for(j=1; j<=W; j++)
            printf("%c ",s[i][j]);
        cout<<endl;
    }*/
    Clear();
    for(i=1; i<=H; i++)
        for(j=1; j<=W; j++)
        {
            x=j+1;
            for(t=i; t<=H; t++)
            {
                for(k=x; k<=W; k++)
                {
                    if(visit[i][j]!=-1&&visit[t][k]!=-1&&(visit[i][j]==0||visit[t][k]==0))
                    {
                        Clear();
                        BFS(i,j,t,k);
                        if(ans>Max)
                        {
                            Max=ans;
                            //cout<<Max<<' '<<i<<' '<<j<<' '<<t<<' '<<k<<endl;
                        }
                    }
                }
                x=1;
            }
        }
    cout<<Max<<endl;
    return 0;
}


Measured memory_bytes: 256
import sys
N, H = map(int, input().split())
a = []
b = []
for i in range(N):
    s, t = map(int, input().split())
    a.append(s)
    b.append(t)
A = max(a)
b.sort(reverse=True)
num = 0
ans = 0
for x in b:
    if A < x:
        num += x
        ans += 1
        if num >= H:
            print(ans)
            sys.exit()
    else:
        break
if (H-num)%A == 0:
    ans += (H - num) // A
else:
    ans += (H - num) // A + 1
print(ans)

Measured memory_bytes: 11296
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000

int main() {
    string s;
    cin >> s;
    stack<char> STs;
    rep(i, s.size()) {
        if (s[i] == 'T') {
            if (STs.empty() || STs.top() != 'S')
                STs.push(s[i]);
            else
                STs.pop();
        } else
            STs.push(s[i]);
    }

    int res = STs.size();
    cout << res << endl;
}

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

int main() {
  int A, B;
  cin >> A >> B;
  if (A != 1 && B != 1) {  
    if (A > B) {
      cout << "Alice" << endl;
    }
    else if (B > A) {
      cout << "Bob" << endl;
    }
    else {
      cout << "Draw" << endl;
    }
  }
  else if (A == B == 1) {
    cout << "Draw" << endl;
  }
  else if (A == 1 && B != 1) {
    cout << "Alice" << endl;
  }
  else {
    cout << "Bob" << endl;
  }
    
}

Measured memory_bytes: 256
//abc145_e.cpp
//Sat Nov 16 20:53:16 2019

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	vector<P> food;
	for (int i=0;i<n;i++){
		int a,b;
		cin >> a >> b;
		food.push_back(make_pair(a,b));
	}

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

	int dp[2][6100];

	for (int i=0;i<2;i++){
		for (int j=0;j<6100;j++){
			dp[i][j] = 0;
		}
	}

	for (int i=0;i<n;i++){
		int first = 0;
		if (i%2==1){
			first = 1;
		}
		int second = (first+1)%2;
		for (int j=0;j<6010;j++){
			if (j<t){
				dp[second][j+food[i].first] = max({dp[first][j]+food[i].second,dp[second][j+food[i].first],dp[first][j+food[i].first]});
			}
			dp[second][j] = max(dp[first][j],dp[second][j]);
		}
	}

	int ans = 0;
	for (int i=0;i<6010;i++){
		ans = max({ans,dp[0][i],dp[1][i]});
	}

	cout << ans << endl;
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 384
//Author ::  ABHINAV3010 ::

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define endl "\n"
#define all(x) (x).begin(), (x).end()
#define fast ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
typedef long long ll;
typedef pair<ll,ll> p;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    new_data_set;
ll mod=1000000007;
ll gcd(ll a,ll b)
{
    return (b==0)?a:gcd(b,a%b);
}
ll power(ll x, ll y, ll p=mod)
{ll res = 1;x = x % p;while (y > 0){if (y & 1){res = (res*x) % p;}y = y>>1;x = (x*x) % p;}return res;}
int main()
{
fast;
ll a,b,n;
cin>>a>>b>>n;
ll z=min(b-1,n);
ll ans=floor((a*z)/(b*1.0));
cout<<ans<<endl;
return 0;
}


Measured memory_bytes: 3756
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

char s[80001];

int main() {
	for (;;) {
		scanf("%s", s);
		if (s[0] == '0') break;
		int n = strlen(s);
		vector<int> mod(n + 1);
		vector< vector<int> > a(n + 1);
		a[0] = vector<int>(11);
		for (int i = 1; i <= n; i++) {
			int x = s[i - 1] - '0';
			if (i % 2) x = 11 - x;
			mod[i] = (mod[i - 1] + x) % 11;
			a[i] = a[i - 1];
			a[i][mod[i]]++;
		}
		int cnt = 0;
		for (int i = 0; i <= n; i++)
			if (s[i] != '0')
				cnt += a[n][mod[i]] - a[i][mod[i]];
		cout << cnt << endl;
	}
}

Measured memory_bytes: 8396
#include <iostream>
#include <math.h>
#include <algorithm>
#define ll long long
#define mod 1000000007

using namespace std;

ll dp[1010][1010];
int main()
{
	int n, m;
	cin >> n >> m;
	char grid[1010][1010];
	dp[1][1] = 1;
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++)
			cin >> grid[i][j];

	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= m; j++)
		{
			if (grid[i][j] == '#')
				continue;
			dp[i][j] += dp[i - 1][j] + dp[i][j - 1];
			dp[i][j] %= mod;
		}
	}
	cout << dp[n][m] << endl;
}


Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long long i=0; i<(n); ++i)
#define REP(i, d, n) for(long long i=(d); i<(n); ++i)
#define all(v) v.begin(), v.end()
using ll = long long;
int main() {//---------------------------------------------------------
  
  int x,y; cin>>x>>y;
  int ans=0;//99=false
  
  if(4*x<y){ans=99;}
  if(2*x>y){ans=99;}
  if(y%2==1){ans=99;}
  
  if(ans==99){cout<<"No"<<endl;}
  else{cout<<"Yes"<<endl;}
  
  
  
  
return 0; }


Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <stdio.h>
using namespace std;

int main(void){
 string a,b;
 cin>>a>>b;
 string c=a+b;
 int num=atoi(c.c_str());
 for(int i=1;i<=1000;i++){
     if(num==i*i){
         cout<<"Yes"<<endl;
         return 0;
     }
 }
 cout<<"No"<<endl;
 return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
typedef long long ll;
int main(){
	string a,b,c;
	cin >> a>>b>>c;

	cout << a[0] << b[1]<<c[2] << endl;
	return 0;
}


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

#define ln                '\n'
#define all(dat)           dat.begin(), dat.end()
#define loop(i, to)        for (int i = 0; i < to; ++i)
#define cont(i, to)        for (int i = 1; i <= to; ++i)
#define circ(i, fr, to)    for (int i = fr; i <= to; ++i)
#define foreach(i, dat)    for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)

typedef long long          num;

using namespace std;

const int nsz = 2e5;
int n;
num a[nsz + 5], b[nsz + 5], ans;
priority_queue<pair<num, int>> q;

int inline pre(int id) {
    return id != 1 ? id - 1 : n;
}

int inline nxt(int id) {
    return id != n ? id + 1 : 1;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin >> n;
    cont (i, n) {
        cin >> a[i];
    }
    cont (i, n) {
        cin >> b[i];
        if (a[i] != b[i]) {
            q.push(make_pair(b[i], i));
        }
    }
    for (; !q.empty();) {
        int id = q.top().second;
        num cur = q.top().first;
        q.pop();
        num del = b[pre(id)] + b[nxt(id)], cnt = max(1LL, (b[id] - a[id]) / del);
        ans += cnt;
        b[id] = cur - cnt * del;
        if (a[id] > b[id]) {
            ans = -1;
            break;
        } else if (a[id] != b[id]) {
            q.push(make_pair(b[id], id));
        }
    }
    cout << ans << ln;
}


Measured memory_bytes: 9072
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(v) (v).begin(),(v).end()
#define endl "\n"
#define deb(x) cout<<#x<<" : "<<x<<endl;
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}


signed main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    
    int n,m;
    cin>>n>>m;
    cout<<(n==m?"Yes":"No");

}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

int main() {
    int n;
    cin >> n;
    ll sum = 0, x = 0, ans = 1000000000000000000LL;
    vector<ll> a(n);
    rep(i, n) {
        cin >> a[i];
        sum += a[i];
    }
    rep(i, n-1) {
        x += a[i];
        ans = min(ans, abs(sum - 2*x));
    }

    cout << ans;

    cout << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int N;
  cin >> N;
  vector<int> v(N);
  for(int i=0;i<N;i++){
    cin >> v[i];
  }
  int ans = N;
  for(int i=0;i<N;i++){
    for(int j=0;j<i;j++){
      if(v[i]<v[j]) {
        ans--;
        break;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import math

A, B, H, M = map(int, input().split())

h = 30 * H + 0.5 * M
m = 6 * M
kakudo = abs(h - m)

if kakudo > 180:
    kakudo = 360 - kakudo
    ans = (A**2 + B**2 - 2*A*B*math.cos(math.radians(kakudo)))**0.5
    print(ans)
elif kakudo < 180:
    ans = (A**2 + B**2 - 2*A*B*math.cos(math.radians(kakudo)))**0.5
    print(ans)
else:
    print(A+B)

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

int main(){
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if(a==b&&b==c)printf("1\n");
	else if(a==b||b==c||c==a)printf("2\n");
	else printf("3\n");
}

Measured memory_bytes: 256
#include <stdio.h>
int main (void)

{
	int i;
	char a[26]={0}, ch;

	while((ch = getchar()) != EOF){
		if(('a'<=ch) && (ch<='z'))
			a[ch-'a']++;

		if(('A'<=ch)&& (ch<='Z'))
			a[ch-'A']++;

	}
	for(i='a'; i<='z'; i++){

		printf("%c : %d\n",i, a[i-'a']);
	}

	return 0;	
}

Measured memory_bytes: 524
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <limits>
#include <algorithm>
#include <array>
#include <random>
#include <complex>
#include <regex>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef complex<ld> compd;
#define quickIO()	{cin.tie(0);	cout.sync_with_stdio(false);}
#define reach(i,a)	for(auto i:a)
#define rep(i,n)	for(int i=0;i<((int)n);i++)
#define REP(i,n)	for(int i=0;i<=((int)n);i++)
#define srep(i,a,n)	for(int i=a;i<((int)n);i++)
#define SREP(i,a,n)	for(int i=a;i<=((int)n);i++)
#define rrep(i,n)	for(int i=n-1;i>=0;i--)
#define RREP(i,n)	for(int i=n;i>=0;i--)
#define all(a)	(a).begin(),(a).end()
#define mp(a,b)	make_pair(a,b)
#define mt	make_tuple
#define pb	push_back
template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec)	is >> x;
	return is;
}
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec) {
	rep(i, vec.size())	os << (i ? " " : "") << vec[i];
	return os;
}
int bitcnt(ll x) {
	x = ((x & 0xAAAAAAAAAAAAAAAA) >> 1) + (x & 0x5555555555555555);
	x = ((x & 0xCCCCCCCCCCCCCCCC) >> 2) + (x & 0x3333333333333333);
	x = ((x & 0xF0F0F0F0F0F0F0F0) >> 4) + (x & 0x0F0F0F0F0F0F0F0F);
	x = ((x & 0xFF00FF00FF00FF00) >> 8) + (x & 0x00FF00FF00FF00FF);
	x = ((x & 0xFFFF0000FFFF0000) >> 16) + (x & 0x0000FFFF0000FFFF);
	x = ((x & 0xFFFFFFFF00000000) >> 32) + (x & 0x00000000FFFFFFFF);
	return x;
}
int bitcnt(int x) {
	x = ((x & 0xAAAAAAAA) >> 1) + (x & 0x55555555);
	x = ((x & 0xCCCCCCCC) >> 2) + (x & 0x33333333);
	x = ((x & 0xF0F0F0F0) >> 4) + (x & 0x0F0F0F0F);
	x = ((x & 0xFF00FF00) >> 8) + (x & 0x00FF00FF);
	x = ((x & 0xFFFF0000) >> 16) + (x & 0x0000FFFF);
	return x;
}
ll sqrtll(ll x) {
	ll left = 0, right = x;
	rep(i, 100) {
		ll mid = (left + right) >> 1;
		if (mid*mid <= x)	left = mid;
		else	right = mid;
	}
	return left;
}
ll gcd(ll a, ll b) {
	return a % b == 0 ? b : gcd(b, a%b);
}
#define debug(x)	printf("Case #%d: ", x)
#define DEBUG 0
const ll inf = 1LL << 60;
const ld infl = 1e100;
const ll mod = 1e9 + 7;
const ld eps = 1e-9;
const int dx[] = { 1,0,-1,0,0 };
const int dy[] = { 0,1,0,-1,0 };

int main() {
	int n, k;	cin >> n >> k;
	vint a(n);	cin >> a;
	int pos = 0;
	while (a[pos] != 1)	pos++;
	cout << (n + k - 3) / (k - 1) << endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using namespace std;


void solve(long long S){
  long long x0, x1, x2, y0, y1, y2;
  if (S == 1000000000000000000) {
    x0 = 0;
    y0 = 0;
    x1 = 0;
    y1 = 1000000000;
    x2 = 1000000000;
    y2 = 0;
    std::cout << x0 << " " << y0 << " " << x1 << " " << y1 << " " << x2 << " " << y2 << std::endl;
    return;
  }
  x0 = 0;
  y0 = 0;
  x1 = 1;
  y1 = 1000000000;
  x2 = S / y1 + 1;
  y2 = y1 - (S % y1);
  std::cout << x0 << " " << y0 << " " << x1 << " " << y1 << " " << x2 << " " << y2 << std::endl;
}

int main(){
  long long S;
  scanf("%lld",&S);
  solve(S);
  return 0;
}


Measured memory_bytes: 256
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */


import java.util.Scanner;

/**
 *
 * @author Nour
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        String x;
        Scanner n =new Scanner(System.in);
        x=n.next();
        if(x.equals("Sunny"))
            System.out.print("Cloudy");
        else if(x.equals("Cloudy"))
            System.out.print("Rainy");
        else if(x.equals("Rainy"))
            System.out.print("Sunny");
    }
    
}


Measured memory_bytes: 20692
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(void){
    string s;
    cin>>s;
    int ans=0;
    for(int i=0;i<=3;i++){
        if(s[i]=='+'){
            ans++;
        }else{
            ans--;
        }
    }
    cout<<ans<<endl;
    
}




Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int [] count = new int [26];
		char a = 'a';

		while(true){
			String str = br.readLine();
			if(str == null){
				break;
			}
			for(int i = 0; i <str.length(); i++){
				if(Character.isUnicodeIdentifierStart(str.charAt(i))){
					int num = Character.toLowerCase(str.charAt(i)) - 'a';
					count[num]++;
				}
			}

		}
		for(int i = 0; i < count.length; i++){
			System.out.println((a++)+" : "+count[i]);
		}
	}
}

Measured memory_bytes: 24304
x,k,d = map(int,input().split())
r = abs(x)//d
ans = 0
if r>=k:
    ans = abs(x) - k*d
else:
    if (k-r)%2==0:
        ans = abs(x)-r*d
    else:
        ans = abs(x)-(r+1)*d
        ans = abs(ans)

print(ans)

Measured memory_bytes: 9188
#include <iostream>
#include <string>

using namespace std;
int main() {
int N,K;
cin>>N>>K;
  int P[N];
  for(int i=0;i<N;i++){
  cin>>P[i];
  }
  
  int sum=0;
  for(int j=0;j<K;j++){
int min,m;
min=10000;
m=0;
for(int i=0;i<N;i++){
if(P[i]<min){m=i;
min=P[i];
}
}
sum+=P[m];
P[m]=10000;
}
cout<<sum;
  
}

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

typedef long long ll;
const ll mod = 1e9 + 7;
const ll inf = 184467440737095516;

int n, k;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(); cout.tie(); 

	cin >> n >> k;
	vector<int> stone(n + 1);
	vector<int> dp(k + 1);
	for (ll i = 1; i <= n; i++){
		cin >> stone[i];
	}
	for (ll i = 1; i <= k; i++){
		for (ll j = 1; j <= n; j++){
			if(i - stone[j] >= 0){         
				if (dp[i - stone[j]] == 0){   // Kalo ini false berarti taro yang menang
					dp[i] = 1;				  // dengan kata lain true
				}
			}
		}
	}
	if (dp[k] == 1){
		cout << "First" << '\n';
	}
	else{
		cout << "Second" << '\n';
	}
}
  

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
typedef long long ll;

struct A
{
    bool operator<(const A &t)const{
        return x<t.x;
    }
    ll x,h;
};
A b[N];
ll n,d,a;
ll c[N];

void add(int x,int v){
    for(;x<=n;x+=x&-x)c[x]+=v;
}
ll ask(int x){
    ll ans=0;
    for(;x;x-=x&-x)ans+=c[x];
    return ans;
}

int main()
{
    cin>>n>>d>>a;
    for(int i=1;i<=n;++i)
        cin>>b[i].x>>b[i].h;
    sort(b+1,b+1+n);
    for(int i=1;i<=n;++i){
        add(i,b[i].h);
        add(i+1,-b[i].h);
    }
    ll ans=0;
    for(int i=1;i<=n;++i){
        ll tmp=ask(i);
        if(tmp<=0)continue;
        ll t=(tmp+a-1)/a;
        ans+=t;
        t*=a;
        add(i,-t);

        int l=i,r=n+1,mi;
        while(l<r){
            mi=(l+r)>>1;
            if(b[mi].x<=b[i].x+2*d)
                l=mi+1;
            else 
            
                r=mi;
        }
        add(l,t);
    }
    cout<<ans;
    return 0;
}
/*

*/

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

int main() {
    ll n,ans=0;
    cin>>n;
    for(ll i=2; i*i<=n; i++) {
        if(n % i != 0) continue;
        ll num = 0;
        while(n % i == 0) {
            n /= i;
            num++;
        }
        for(int j=1; ; j++) {
            if(num >= j) {
                num -= j;
                ans++;
            }
            else break;
        }
    }
    if(n != 1) ans++;
    cout<<ans<<endl;
}

Measured memory_bytes: 3640
#define _USE_MATH_DEFINES // for C++  
#include <cmath> 
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <array>
#include <iterator>
#include <utility>
#include <set>
#include <random>
#include <map>
#include <stack>
#include <queue>
#include <list>
#include <functional>
 
 
using namespace std;
 
int main() {
    char a, b;
    cin >> a >> b;
    if (a == 'H' && b == 'H')
    {
        cout << 'H' << endl;
    }
    else if (a == 'H' && b == 'D')
    {
        cout << 'D' << endl;
    }
    else if (a == 'D' && b == 'H')
    {
        cout << 'D' << endl;
    }
    else if (a == 'D' && b == 'D')
    {
        cout << 'H' << endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>          // printf(), scanf()
#include <stdbool.h>

#define MAX_N 12
#define MAX_V 100

int
main(int argc, char **argv)
{
	int s[MAX_N];
	int c[MAX_V];
	int n, i;

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

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

		int count = 0;
		while (true)
		{
			for (i = 0; i < MAX_V; ++i)
				c[i] = 0;

			for (i = 0; i < n; ++i)
				c[s[i]] += 1;

			for (i = 0; i < n; ++i)
			{
				if (s[i] != c[s[i]])
					break;
			}

			if (i >= n)
				break;

			count++;
			for (i = 0; i < n; ++i)
				s[i] = c[s[i]];
		}

		printf("%d\n", count);
		for (i = 0; i < n; ++i)
			printf("%d%c", s[i], (i < n - 1) ? ' ' : '\n');
	}

	return 0;
}

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

typedef long long  ll;
typedef vector<int> vec;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int>par;
typedef vector<par>vpar;

#define forn(i,n) for(ll i=0;i<n;i++)
#define wez(n) ll (n); cin>>(n);
#define setmax(a,b) (a)=max((a),(b))
#define setmin(a,b) (a)=min((a),(b))
#define pb push_back
#define mp make_pair
#define outa(a,e) forn(i,e) cout << a[i] << (i==e-1?'\n':' ')
#define oute(n) cout<<n<<"\n"

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   /* #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    const ll inf=1e18L+5;
    wez(n);
    wez(W);
    vector<ll>weight(n);
    vector<ll>value(n);
    forn(i,n)cin>>weight[i]>>value[i];
    ll sum=0;
    forn(i,n)sum+=value[i];
    vector<ll>dp(sum+1,inf);
    dp[0]=0;
    forn(i,n){
      for(ll curr=sum-value[i];curr>=0;--curr){
        dp[curr+value[i]]=min(dp[curr+value[i]],dp[curr]+weight[i]);
      }
    }
    ll answer=0;
    forn(i,sum+1){
      if(dp[i]<=W){
        answer=max(answer,(ll)i);
      }
    }
    cout<<answer<<endl;
return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
typedef long long ll;
#define MOD 1000000007
#define INF -99999999 
using namespace std;

int main(){
    string n; cin >> n;
    if(n[0] == '7' || n[1] == '7' || n[2] == '7') cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3592
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#define rep(i, n) for(int i=0; i<n; i++)
using namespace std;
typedef long long ll;

int main(){
    int N; cin >> N;
    ll K; cin >> K;
    int A[N], B[N];
    rep(i, N){
        cin >> A[i];
        A[i]--;
        B[i] = -1;
    }
    //cout << "end input" << endl;
    ll now = 0;
    ll circ = -1;
    rep(i, K){
        //cout << "now" << now << endl;
        if(B[now] != -1){
            //cout << "end_now" << now << endl;
            circ = i-B[now];
            //cout << "i "<<i << endl;
            //cout << "B[A[now]]" << B[A[now]] << endl;
            break;
        }
        B[now] = i;
        now = A[now]; 
    }
    if(circ == -1){
        cout << now+1 << endl;
        return 0;
    }
    ll city = now;
    ll iter = 0;
    //cout << "circ" << circ <<  endl;
    /*
    while(city != now){
        city = A[city];
        iter++;
    }*/

    //cout << "iter" << iter << endl;
    ll count = (K-B[now])%circ;
    //cout << "count" << count << endl;
    while(count != 0){
        city = A[city];
        count--;
    }
    //cout << "end input" << endl;
    cout << city+1 << endl;
}


Measured memory_bytes: 5164
#include <stdio.h>
#define N 100000
#define Q 50000
#define NOT_FOUND -1


int count=0,n;

int binary(int a[],int key){
  int left=0,right=n,mid;

  while(left<right){
    mid=(left+right)/2;
    if(a[mid]==key)return mid;
    else if(key<a[mid])right=mid;
    else left=mid+1;
  }
  return NOT_FOUND;
}




int main(){
  int a[N],b[Q],i,q;

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

  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&b[i]);
  }
  for(i=0;i<q;i++)
    if(binary(a,b[i])!=NOT_FOUND)count++;
  
  printf("%d\n",count);
  return 0;
}





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

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

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

    long long ans = 0LL;
    for (int r = 0; r <= 3000; r++)
    {
        for (int g = 0; g <= 3000; g++)
        {
            if ((r * R + g * G == N) || (r * R + g * G < N && (N - r * R - g * G) % B == 0))
            {
                ans++;
            }
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include<math.h>
int main(){
    int n;
    scanf("%d", &n);
    int cont=0, yes=0;
    for(int i =0;i< n;++i){ 
        int a=0, b=0;
        scanf("%d %d", &a, &b);
        if(a==b)
            cont++;
        else
            cont=0 ; 
        if(cont>=3){
            yes=1;
            break;
        }
    }
    if(yes == 1)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}

Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long 
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define all(x) (x).begin(),(x).end()
#define forn(i, a, b) for (int i=a; i<(signed)(b); ++i)
#define pb push_back
 
 
// debug templates 
#define debug(x)       cerr<< #x <<" : "<< x << endl;
#define debuga(A,N)    cerr<< #A <<" : [";for(int i = 0; i<N;i++) cerr<<A[i]<<" "; cerr<<"]\n";
#define debuga2(A,N,M) cerr<< #A << " : \n"; for(int i=0;i<N;i++){cerr<<"[";for(int j=0;j<M;++j) cerr<<A[i][j]<<" ";cerr<<"]\n";}
#define debugp(p)      cerr<< #p <<" : "<<"("<<(p).first<<","<<(p).second<<")\n";
#define debugv(v)      cerr<< #v <<" : "<<"[";for(int i = 0; i< (v).size(); i++) cerr<<v[i]<<" "; cerr<<"]\n";
#define debugv2(v)     cerr<< #v << " : \n"; for(int i=0;i<v.size();i++){cerr<<"[";for(int j=0;j<(v[0].size());++j) cerr<<v[i][j]<<" ";cerr<<"]\n";}
#define debugs(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin(); itr!=m.end();itr++) cerr<<*itr<<" "; cerr<<"]\n";
#define debugm(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin();itr!=m.end(); itr++) cerr<<"("<<itr->first<<","<<itr->second<<") ";cerr<<"]\n";
 

void solve(){
	int n,k; cin >> n >> k;
	int a[n];
	forn(i,0,n) cin >> a[i];
	int dp[n];
	memset(dp,inf,sizeof(dp));
	dp[0] = 0;
	forn(i,0,n){
		forn(j,1,k+1){
			if(i-j >= 0){
				dp[i] = min(dp[i],dp[i-j] + abs(a[i-j]-a[i]));
			}
		}
	}
	cout << dp[n-1];
}
 
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	solve();
	return 0;
}
 


Measured memory_bytes: 4384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using iii = pair<ii, int>;
#define vt vector
#define pq priority_queue
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define __lcm(a, b) a * b / __gcd(a, b)
const int MOD = 1e9 + 7;
const int INF = 2e9;
const int N = 1e5 + 5;

int n, k;
int a[N], dp[N];

int f(int idx) {
    if(idx == n) return 0;
    int &sol = dp[idx];
    if(sol != -1) return sol;
    sol = f(idx + 1) + abs(a[idx + 1] - a[idx]);
    for(int i = 2; i <= k; i++) {
        if(idx + i <= n) 
            sol = min(sol, f(idx + i) + abs(a[idx + i] - a[idx]));
    }
    return sol;
}

void solve() {
    cin >> n >> k;
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    memset(dp, -1, sizeof(dp));
    cout << f(1) << "\n";
}

int main() {
 
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    
    solve();
    
}

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

//const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define what_is(x) cerr << #x << " is " << x << endl;
#define debug(v) {for (auto x : v) cerr << x << ' '; cerr << endl;}

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vll = vector<long long>;
using vii = vector<pair<int,int>>;

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);
	int n;
	double total = 0;
	for (cin >> n; n > 0; n--) {
		double v;
		string s;
		cin >> v >> s;
		if (s == "BTC") v *= 380000;
		total += v;
	}
	printf("%.6f\n", total);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define N 200100
#define MOD 1000000007
#define fn(i,n) for(int i=0;i<n;i+=1)
#define rep(i,l,r) for(int i=l;i<=r;i+=1)
#define INF 100000000000000
#define pii pair<int,int>
#define speed ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);


signed main()
{
    
    speed
    int n;string s;
    cin>>n;cin>>s;
    vector <int> v(n,0);
    int c[4]={0};
    for(int i=0;i<n;i++){
        if(s[i]=='R')v[i]=1;
        if(s[i]=='G')v[i]=2;
        if(s[i]=='B')v[i]=3;
        c[v[i]]+=1;
    }
    //cout<<c[1]<<" "<<c[2]<<" "<<c[3]<<endl;
    int ans=c[1]*c[2]*c[3];
    for(int i=0;i<n;i++){
        for(int k=i+2;k<n;k+=2){
            int j=(i+k)/2;
            set <int> xd;
            xd.insert(v[i]);
            xd.insert(v[j]);
            xd.insert(v[k]);
            if(xd.size()==3){
                ans-=1;
            }
        }
    }
    cout<<ans<<endl;

    
    
    
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int n, c, k;
int t[100005];
int ans = 1;
int main() {
	scanf ("%d %d %d", &n, &c, &k);
	for (int i = 1; i <= n; i++)
		scanf ("%d", &t[i]);
	sort (t + 1, t + n + 1);
	int st = t[1], per = 1;
	for (int i = 2; i <= n; i++) {
		if (t[i] - st > k) {
			ans++;
			st = t[i];
			per = 1;
			continue;
		}else if (t[i] - st <= k) {
			if (per == c) {
				ans++;
				st = t[i];
				per = 1;
				continue;
			} else {
				per++;
				continue;
			}
		}
	}
	printf ("%d", ans);
	return 0;
}

Measured memory_bytes: 640
A, B = map(int,input().split())
 #最大公約数
def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a

 #最小公倍数
def lcm(a,b):
  return a*b//gcd(a,b)

print(lcm(A,B))

Measured memory_bytes: 38384
using System;
using System.Collections.Generic;
using System.Linq;

namespace kakomon
{
    class Program
    {
        static void Main(string[] args)
        {
            diverta2019_b();
        }

        static void diverta2019_b()
        {
            // B - RGB Boxes
            int[] input = Console.ReadLine().Trim().Split().Select(int.Parse).ToArray();
            int r = input[0];
            int g = input[1];
            int b = input[2];
            int n = input[3];
            int ans = 0;
            // 3重ループにせず2重ループで済ませる
            for (int i=0; i<=3000; i++)
            {
                // 必要数を超過したら目的を満たさないので探索終了
                if (i * r > n) break;

                for (int j=0; j<=3000; j++)
                {
                    // 必要数を超過したら目的を満たさないので探索終了
                    if (i * r + j * g > n) break;

                    // redとgreenの箱数が定まると、残り必要なボール個数が決まり、blueでちょうど買えるならOK
                    int k = n - i * r - j * g;
                    if (k % b == 0) ans += 1;
                }
            }
            Console.WriteLine(ans);
        }
    }
}

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

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

    int ma = max({a, b, c});
    if ((3 * ma - a - b - c) % 2 == 0)
        cout << (3 * ma - a - b - c) / 2;
    else
        cout << (3 * (ma + 1) - a - b - c) / 2;
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
// C - *3 or /2
#include <bits/stdc++.h>
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
const lli INF = 2147483647;
const lli MINF = -2147483648;
const lli LINF = 9223372036854775807;
const lli MOD = 1000000007; //10^9+7
const long double PI = acos(-1);
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define Vec(K, L, N, S) vector<L> K(N, S)
#define rt sqrt
#define pb push_back
#define eb emplace_back
#pragma GCC optimize("Ofast")
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using P = pair<lli, lli>;
// vector<P> vp;
// vp.emplace_back(a[i], b[i]);
using vs = vector<string>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli b, c, h, k, n, w, ans = 0, count = 0;
  string s, t;
  cin >> n;
  vlli a(n);
  rep(i, 0, n)
  {
    cin >> a[i];
    while (a[i] % 2 == 0)
    {
      a[i] /= 2;
      count++;
    }
  }
  cout << count << "\n";
}

Measured memory_bytes: 384
#include <iostream>
   
    using namespace std;
    int main(void){
        // Your code here!
        int a;
        cin >> a;
        int b = a % 100;
        
        if(a%10 == 7||(b>69 && b<80)||(a>699 && a<800)){
            cout << "Yes" <<endl;
        }else{
            cout << "No" << endl;
        }
}

Measured memory_bytes: 3132
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
ll a[1000000];
bool cmp(int i, int j){
   return a[i]<a[j];
}
int main()
{
    int n;
    cin>>n;
    int o;
    if(n&1){
        o = n/2+1;
        double d = o/(double)n;
        printf("%.7f\n",d);
        return 0;
    }
    else {cout<<"0.5000000000"<<'\n';return 0;}
}


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

using namespace std;

#define N 3030
#define LL long long

LL n,p,ans,f[N],g[N][N],C[N][N];

LL pw(LL k,LL mod){
	if (k==0) return 1;
	LL tmp=pw(k>>1,mod);
	return k&1?tmp*tmp*2%mod:tmp*tmp%mod;
}

LL inv(LL x){return x==1?1:(p-p/x)*inv(p%x)%p;}

int main(){
	scanf("%lld%lld",&n,&p);
	g[0][0]=1;
	for (int i=1;i<=n;++i){
		g[i][0]=1;
		for (int j=1;j<=i;++j)
			g[i][j]=(g[i-1][j]*(j+1)+g[i-1][j-1])%p;
	}
	f[0]=pw(pw(n,p-1),p);
	for (int i=1;i<=n;++i){
		for (int j=0;j<=i;++j){
			g[i][j]=g[i][j]*pw(j*(n-i)%(p-1),p)%p;
			f[i]=(f[i]+g[i][j])%p;
		}
		f[i]=f[i]*pw(pw(n-i,p-1),p)%p;
	}
	C[0][0]=1;
	for (int i=1;i<=n;++i){
		C[i][0]=1;
		for (int j=1;j<=i;++j)
			C[i][j]=(C[i-1][j]+C[i-1][j-1])%p;
	}
	for (int i=0;i<=n;++i)
		ans=(ans+(i&1?p-1:1)*f[i]%p*C[n][i])%p;
	printf("%lld\n",ans);
	
	return 0;
}
			

Measured memory_bytes: 141952
#include<stdio.h>
int main()
{
   char a[48];
  
    scanf("%s", a);
  
       if('A'==a[0])
         printf("T");
        if('C'==a[0])
         printf("G");
         if('G'==a[0])
         printf("C");
        if('T'==a[0])
          printf("A");
    
    return 0;
}

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

#define int long long
#define vi vector <int>
#define endl "\n"
#define vvi vector <vector<int> >
#define vii vector <pair<int,int> >
#define rep(i,a,b) for (int i=a;i<b;i++)
#define repD(i,a,b) for (int i=a;i>=b;i--)
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define init(i,k) memset(i,k,sizeof i)
#define pb push_back
#define pii pair <int,int>
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
const int N=2e5+5 , MOD=1e9+7;

int a[N];

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


void solve()
{
    int n,k;
    cin >> n >> k;
    rep(i,0,n) cin >> a[i];

    sort(a,a+n);

    int ans=0;
    rep(i,0,n-k) ans += a[i];

    cout << ans  << endl;
}

signed main()
{
    speed;
    
 //    int t; cin >> t;
 //    rep(tt,1,t+1)
 //    {
	// cout <<"Case #"<<tt<<": ";
	solve();
 //    }
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
int main(){ 
    string s,t;
    cin>>s;
    cin>>t;

    int ans=0;

    for(int i=0;i<s.length();i++){
        if(s[i]!=t[i]){
            ans++;
            break;
        }
    }
    if(ans==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
 
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <utility>
typedef long long ll;
using namespace std;

int main(){
  ll i,j,k,r,d,x;
  cin >> r >> d >> x;
  for(i=0;i<10;i++){
    x = r*x-d;
    cout << x << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    Integer[] a=new Integer[n];
    for(int i=0;i<n;i++){
      a[i]=sc.nextInt();
    }
    Arrays.sort(a);
    System.out.println(a[n/2]-a[n/2-1]);
  }
}

Measured memory_bytes: 64460
#include <iostream>

using namespace std;

int main(void){
  string S;
  cin >> S;

  int i;
  for(i=0; i<S.length(); i++)
    S[i] = 'x';

  for(i=0; i<S.length(); i++)
    cout << S[i];

  cout << endl;
    
  return 0;
}


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

typedef struct{
	int startarea;
	int allarea;
}Area;

void S1push(int);
int S1pop();
void S2push(int,int);
Area S2pop();
void anspush(int);

int top1,top2,top3,S1[20000],ans[20000];
Area S2[20000];

int main(void){
	
	char ch[20001];
	int sum=0,i=0,b;
	Area c;
	top1=0;
	top2=0;
	top3=0;
	
	scanf("%s",ch);
	
	for(i=0;ch[i]!='\0';i++){
		if(ch[i]=='\\'){
			S1push(i);
		}
		else if(ch[i]=='/' && top1>0){
			int j=S1[top1];
			b=S1pop();
			sum+=i-j;
			int a=i-j;
			while(top2>0 && S2[top2].startarea>j){
				a+=S2[top2].allarea;
				c=S2pop();
			}
			S2push(j,a);
		}
	}
	int another_ans[20000];
	
	while(top2>0){
		anspush(S2[top2].allarea);
		c=S2pop();
	}
	for(int k=0;k<top3;k++){
		another_ans[k]=ans[top3-k];
	}
	for(int k=0;k<top3;k++){
		ans[k]=another_ans[k];
	}
	
	printf("%d\n",sum);
	printf("%d",top3);
	for(int i=0;i<top3;i++){
		printf(" ");
		printf("%d",ans[i]);
	}
	printf("\n");
	
	return 0;
}

void S1push(int x){
	top1++;
	S1[top1]=x;
}
int S1pop(){
	top1--;
	return S1[top1+1];
}

void S2push(int x,int y){
	top2++;
	S2[top2].startarea=x;
	S2[top2].allarea=y;
}
Area S2pop(){
	top2--;
	return S2[top2+1];
}
void anspush(int x){
	top3++;
	ans[top3]=x;
}



Measured memory_bytes: 2092
#include <bits/stdc++.h>
using namespace std;
#define sz(x) ((int) (x).size())
#define forn(i,n) for (int i = 0; i < int(n); ++i)
typedef long long ll;
typedef long long i64;
typedef long double ld;
const int inf = int(1e9) + int(1e5);
const ll infl = ll(2e18) + ll(1e10);

int main() {
    #ifdef LOCAL
    assert(freopen("c.in", "r", stdin));
    #else
    #endif
    int n;
    cin >> n;
    multiset<int> s;
    forn (i, n) {
        int x;
        cin >> x;
        s.insert(x);
    }
    int mx = *s.rbegin();
    s.erase(s.find(mx));
    if (s.find(mx) == s.end()) {
        cout << "Impossible\n";
        return 0;
    }
    s.erase(s.find(mx));
    int mn = mx;
    for (int i = 1; i < mx; ++i) {
        int d = max(i, mx - i);
        if (s.find(d) == s.end()) {
            cout << "Impossible\n";
            return 0;
        }
        s.erase(s.find(d));
        mn = min(mn, d);
    }
    if (!s.empty() && *s.begin() <= mn) {
        cout << "Impossible\n";
        return 0;
    }
    cout << "Possible\n";
}

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

int main() {
    int h, w, k;
    cin >> h >> w >> k;
    // cout << h << " " << w << " " << k << endl;
    vector<vector<char>> in(h, vector<char> (w));
    rep(i, h) {
        rep(j, w) {
            char a;
            cin >> a;
            in[i][j] = a;
        }
    }


    int ans = 0;
    for(int bith = 0; bith < (1<<h); ++bith) {
        for(int bitw = 0; bitw < (1<<w); ++bitw) {
            int black = 0;
            for(int i = 0; i < h; ++i) {
                for(int j = 0; j < w; ++j) {
                    if(in[i][j] == '#' && !(bith & (1<<i) || bitw & (1<<j))) ++black;
                    // bool sample = in[i][j] == '#';
                    // cout << sample << endl;
                }
            }
            // cout << black << endl;
            if(black == k) ++ans;
        }
    }

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


Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
int main(){
  string x,z;
  cin>>x>>z;
  if(x.at(0)!=z.at(2)) cout<<"NO"<<endl;
  else if(x.at(1)!=z.at(1)) cout<<"NO"<<endl;
  else if(x.at(2)!=z.at(0)) cout<<"NO"<<endl;
  else cout<<"YES"<<endl;
}

Measured memory_bytes: 3576
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    private static final int MOD = 1_000_000_007;
    private static final String YES = "YES";
    private static final String NO = "NO";

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

        int N = sc.nextInt();
        int[] a = new int[N];
        for (int i=0; i<N; i++) {
            a[i] = sc.nextInt();
        }

        int[] ans = solve(N, a);

        System.out.println(ans.length);
        for (int i=0; i<ans.length; i++) {
            System.out.println(ans[i]);
        }
    }

    /**
     * 参考(mikit): https://atcoder.jp/contests/abc134/submissions/6454355
     * 方針はEditorialと同じ
     */
    private static int[] solve(int N, int[] a) {
        int[] box = new int[N];

        for (int i=N; i>0; i--) {
            int c = 0;
            for (int j=i; j<=N; j+=i) {
                if (box[j-1] == 1) c++;
            }

            if (a[i-1] != c%2) {
                box[i-1] = 1;
            }
        }

        return toAns(box);
    }


    private static int[] toAns(int[] box) {
        List<Integer> list = new ArrayList();

        for (int i=0; i<box.length; i++) {
            if(box[i] == 1) {
                list.add(i);
            }
        }

        int[] ans = new int[list.size()];
        int cnt = 0;
        for (Integer i : list) {
            ans[cnt++] = i+1;
        }

        return ans;
    }
}

Measured memory_bytes: 86484
#include<iostream>

using namespace std;

bool isPrime( int x ) {
	if ( x == 2 ) return true;
	if ( x < 2 ) return false;
    if ( x % 2 == 0 ) return false;
	
	for( int i = 3; i*i <= x; i += 2) {
		if( x % i == 0 ) return false;
		
	}
	return true;
}

int main() {
	int n, x;
	int cnt = 0;
	cin >> n;
	while( n-- ) {
		cin >> x;
		if ( isPrime(x) ) cnt++;
	}
	cout << cnt << endl;
}


Measured memory_bytes: 3060
#include <stdio.h>
#include <math.h>
#define M_PI acos(-1.0);
int main (void)
{
    int R;
    double area;
    const double PI=acos(-1.0);
    scanf("%d",&R);
    area = (2 * PI * R);
    printf("%lf",area);
    return 0;
}

Measured memory_bytes: 2200
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int M1 = sc.nextInt();
        int D1 = sc.nextInt();
        int M2 = sc.nextInt();
        int D2 = sc.nextInt();

        if( M2 != M1 + 1 || (M1 == 12 && M2 == 1)){
            System.out.println("0");
        }else{
        System.out.println("1");
        }
    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a, b, k;
	cin >> k >> a >> b;
	if(a%k == 0 || b %k == 0)
	{
		cout << "OK" << endl;
		return 0;
	}
	a = a/k;
	b = b/k;
	if(abs(a-b) >= 1)
		cout<< "OK" << endl;
	else
		cout << "NG" << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define v(T) vector<T>
#define yn {puts("Yes");}else{puts("No");}
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const double eps = 1e-10;

void solve() {
  string s;
  cin >> s;
  if (s.back() != 's') {
    cout << s << "s" << endl;
  } else {
    cout << s << "es" << endl;
  }
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cout << fixed << setprecision(15);
  solve();
  return 0;
}


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

using namespace std;

int main(void)
{
    int n;
    cin >> n;
    int a[n];
    int i;
    
    for (i=0; i<n; i++)
    {
        cin >> a[i];
    }
    
    sort(a,a+n);

    int c;
    int out=0;
    i=0;

    while(i<n)
    {
        int f=0;
        c=a[i];
        while(a[i]==c)
        {
            i++;
            f++;
        }
        out+=f%2;
    }

    cout << out << endl;


    return 0;
}

Measured memory_bytes: 896
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b)-1);i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int, int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))

int main(void){
	string s;
	cin >> s;
	
	rep(i, s.size() - 1) if(s[i] == s[i+1]){
		cout << i+1 << " " << i+2 << endl;
		return 0;
	}
	
	rep(i, s.size() - 2) if(s[i] == s[i+2]){
		cout << i+1 << " " << i+3 << endl;
		return 0;
	}
	
	cout << -1 << " " << -1 << endl;
	
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>

using namespace std;

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

	int n,y;
	cin >> n >> y;

	int sum=0;
	for(int i=0;i<=n;i++){
		sum += 10000*i;
		if(sum>y) continue;
		for(int j=0;j<=n-i;j++){
			int tmp=sum;
			sum += 5000*j + 1000*(n-i-j);
			if(sum == y){
				cout <<  i << " " << j << " " << n-i-j << "\n";
				return 0;
			}else if(sum > y) break;

			sum = tmp;
		}
		sum=0;
	}
	cout << "-1 -1 -1\n";
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<math.h>
using namespace std;
int main()
{
int b,c,d,e,f,g,h,i,j,k,l,m,t;

long long a;
cin>>a;
string s;
while(a--)
{
s+=('a'+a%26);
a=a/26;

}
reverse(s.begin(),s.end());
cout<<s;
}

Measured memory_bytes: 3652