akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

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

using namespace std;

typedef int64_t ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tupiii;
typedef tuple<ll, ll, ll> tuplll;

const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;
const int MOD = 1000000007;

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


class D {
	int n;
	vector<bool> v;
public:
	D()
	{
		cin >> n;
		v.resize(n, false);

		REP(i, n)
		{
			int a;
			cin >> a;

			if (i + 1 == a)
				v[i] = true;
		}
	}
	void solve()
	{
		int ans{ 0 };

		REP(i, n)
		{
			if (v[i])
			{
				if (v[i + 1])
					v[i + 1] = false;
				v[i] = false;

				++ans;
			}
		}

		cout << ans << endl;


	}
};


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

	return 0;
}

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

namespace ConsoleApplication1
{
    class Program
    {
        static int[] segment;
        static int size;

        static void Main(string[] args)
        {
            string[] input1 = Console.ReadLine().Split(' ');
            int n = int.Parse(input1[0]);
            int q = int.Parse(input1[1]);

            Init(n);

            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < q; i++)
            {
                string[] input2 = Console.ReadLine().Split(' ');
                int c = int.Parse(input2[0]);
                int x = int.Parse(input2[1]);
                int y = int.Parse(input2[2]);

                if (c == 0) Add(x - 1, y);
                else
                {
                    sb.AppendLine(GetSum(x - 1, y, 0, 0, size).ToString());
                }
            }
            Console.Write(sb);
        }

        static void Init(int n)
        {
            size = 1;

            while (size < n) size *= 2;

            segment = new int[2 * size];
        }

        static void Add(int x, int val)
        {
            x += size - 1;
            segment[x] += val;

            while (x > 0)
            {
                x = (x - 1) / 2;
                segment[x] = segment[x * 2 + 1] + segment[x * 2 + 2];
            }
        }

        static int GetSum(int a, int b, int k, int l, int r)
        {
            if (r <= a || b <= l) return 0;

            if (a <= l && r <= b) return segment[k];
            else
            {
                int vl = GetSum(a, b, k * 2 + 1, l, (l + r) / 2);
                int vr = GetSum(a, b, k * 2 + 2, (l + r) / 2, r);

                return vl + vr;
            }
        }
    }
}

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

using namespace std;

#define DEBUG 0
#define lli long long int
#define REP(i,n) for(int i=0;i<n;i++)

lli numSearch(lli order,vector<lli> v){
	lli size = v.size();
	vector<lli> s;
	REP(i,size){
		if(v.at(i)!=0){
			s.push_back(v.at(i));
		}
	}
	sort(s.begin(),s.end(),greater<lli>());
	lli ansNum = s[order];
	REP(i,size){
		if(v.at(i) == ansNum){
			return i;
		}
	}
	return -1;
}

int main(){
	lli n;
	cin>>n;
	vector<lli> v(100010),w(100010);
	REP(i,100010){
		v[i]=0;
		w[i]=0;
	}
	REP(i,n/2){
		lli tmpV,tmpW;
		cin>>tmpV>>tmpW;
		v[tmpV]++;
		w[tmpW]++;
	}

	lli ans = 1000000000;
	/* vについて1番多い数を考える,vの1番多い数とwの1番多い数が一致→wは2番目に多い数*/
	lli vmax = numSearch(0,v);
	if(DEBUG)cout<<"VMAX0 = "<<vmax<<endl;
	lli vmaxCnt = 0;
	REP(i,100010)if(vmax != i)vmaxCnt+=v[i];
	lli wmax = numSearch(0,w);
	if(DEBUG)cout<<"WMAX0 = "<<wmax<<endl;
	lli wmaxCnt = 0;
	if(wmax == vmax){
		wmax = numSearch(1,w);
		if(wmax == -1)wmax = 100010;
		if(DEBUG)cout<<"WMAX1 = "<<wmax<<endl;
	}
	REP(i,100010)if(wmax != i)wmaxCnt+=w[i];

	ans = min(ans, wmaxCnt+vmaxCnt);

	/* wについて1番多い数を考える。 */
	wmax = numSearch(0,w);
	if(DEBUG)cout<<"WMAX0 = "<<wmax<<endl;
	wmaxCnt = 0;
	REP(i,100010)if(wmax != i)wmaxCnt+=w[i];
	vmax = numSearch(0,v);
	if(DEBUG)cout<<"VMAX0 = "<<vmax<<endl;
	vmaxCnt = 0;
	if(wmax == vmax){
		vmax = numSearch(1,v);
		if(vmax == -1)vmax = 100010;
		if(DEBUG)cout<<"VMAX1 = "<<vmax<<endl;
	}
	REP(i,100010)if(vmax != i)vmaxCnt+=v[i];

	ans = min(ans, wmaxCnt+vmaxCnt);
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 3552
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    int[] dice;
    int i, n;
    String str;
    char[] ch;

    dice = new int[6];
    for(i = 0;i < 6;i++){
      dice[i] = sc.nextInt();
    }
    str = sc.next();
    n = str.length();
    ch = new char[n];
    for(i = 0;i < n;i++){
      ch[i] = str.charAt(i);
    }

    for(i = 0;i < n;i++){
      if(ch[i] == 'N'){
        nroll(dice);
      }else if(ch[i] == 'E'){
        eroll(dice);
      }else if(ch[i] == 'W'){
        eroll(dice);
        eroll(dice);
        eroll(dice);
      }else{
        nroll(dice);
        nroll(dice);
        nroll(dice);
      }
    }

    System.out.println(dice[0]);

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }

  private static void nroll(int[] dice){ //(1265)
    int tmp;
    tmp = dice[0];
    dice[0] = dice[1];
    dice[1] = dice[5];
    dice[5] = dice[4];
    dice[4] = tmp;
    return;
  }

  private static void eroll(int[] dice){ //(1463)
    int tmp;
    tmp = dice[0];
    dice[0] = dice[3];
    dice[3] = dice[5];
    dice[5] = dice[2];
    dice[2] = tmp;
    return;
  }

}

Measured memory_bytes: 17360
str = gets.split
N,M = str[0].to_i, str[1].to_i
A = Array.new(N+1)
B = Array.new(M+1)
MOD = 1000000007

for x in 0...M
  B[x] = gets.chomp.to_i
end
B[M] = N+1

A[0] = 1
i = 0
if B[0] != 1
  A[1] = 1
else
  A[1] = 0
  i += 1
end

for x in 2..N
  if x != B[i]
    A[x] = (A[x-1] + A[x-2]) % MOD
  else
    A[x] = 0
    i += 1
  end
end

puts A[N]

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

int main() {
  long long n; 
  cin >> n;
  const int kVal = 26;
  string result;
  while (n > 0) {
    char c = (n-1) % kVal + 'a';
    result.push_back(c);
    n = (n-1)/kVal;
  }
  reverse(result.begin(), result.end());
  cout << result << endl;
}


Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <climits>
#include <queue>
#include <cstring>
#include <stack>
#include <map>
#include <ctime>
using namespace std;
#define rep(i,a,b) for(int i=a; i<=b; i++)
#define ii pair <int, int>
#define fi first
#define se second
#define ll long long
#define mod 1000000007
int d, f[10001][100][3];
string s;

int ss(int a, int b){
    if(a==b) return 1;
    if(a<b) return 0;
    return 2;
}

int tinh(){
    int n=s.size();
    rep(i,0,9) f[1][i%d][ss(i, s[0]-48)]++;
    rep(i,1,n-1) rep(r,0,d-1) rep(st,0,2) rep(x,0,9){
        if(f[i][r][st]==0) continue;
        (f[i+1][(r+x)%d][(st==1?ss(x, s[i]-48):st)]+=f[i][r][st])%=mod;
    }
    return (f[n][0][0] + f[n][0][1] - 1 + mod)%mod;
}

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0);
//	freopen("Test.inp", "r", stdin);
//    freopen("Test.out", "w", stdout);
    cin>>s>>d;
    cout<<tinh();
	return 0;
}


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

typedef long long ll;
typedef pair<ll, ll> P;

const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const int int_inf = 100000000;
const double eps = 1e-9;

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
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 main()
{
    int h, w, cnt = 0;
    cin >> h >> w;

    char grid[h][w];

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> grid[i][j];
            if (grid[i][j] == '#') cnt++;
        }
    }
    vector < vector <int>> dist(h, vector<int>(w, -1));
    dist[0][0] = 1;

    queue< pair<int, int> > que;
    que.push(make_pair(0, 0));

    while (!que.empty()) {
        auto now = que.front();
        que.pop();

        int now_x = now.first;
        int now_y = now.second;

        for (int i = 0; i < 4; i++) {
            int nx = now_x + dx[i];
            int ny = now_y + dy[i];

            if (nx < 0 or nx >= h or ny < 0 or ny >= w) continue;
            if (grid[nx][ny] == '#') continue;
            if (dist[nx][ny] == -1) {
                dist[nx][ny] = dist[now_x][now_y] + 1;
                que.push(make_pair(nx, ny));
            }
        }
    }

    if (dist[h-1][w-1] == -1) cout << -1 << endl;
    else cout << h * w - cnt - dist[h-1][w-1] << endl;

    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int n;
  scanf("%d", &n);
  switch(n%10){
  case 2:
  case 4:
  case 5:
  case 7:
  case 9:
    printf("hon\n");
    break;
  case 0:
  case 1:
  case 6:
  case 8:
    printf("pon\n");
    break;
  case 3:
    printf("bon\n");
    break;
  }
  return 0;
}


Measured memory_bytes: 1632
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define mt make_tuple
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vl vector <long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> >
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;

ll add(ll x, ll y) {ll res=x+y; return(res>=MOD?res-MOD:res);}
ll mul(ll x, ll y) {ll res=x*y; return(res>=MOD?res%MOD:res);}
ll sub(ll x, ll y) {ll res=x-y; return(res<0?res+MOD:res);}
ll lcm(ll x, ll y) {ll res=(x*y)/__gcd(x,y); return res;}
ll power(ll x, ll y) {ll res=1; x%=MOD; while(y){if(y&1)res=mul(res,x); y>>=1; x=mul(x,x);} return res;}

const int inf = 1e9 + 5;
const ll inf64 = 1e18 + 5;
int main()
{
	boost;
	ll n, k, i;
	cin >> n >> k;
	ll ans = 0;
	ll res[k + 1];
	for(i = k; i > 0; i--) {
		res[i] = power(k / i, n);
		for(int j = 2 * i; j <= k; j += i)
		res[i] = sub(res[i], res[j]);
		ans = add(ans, mul(res[i], i));
	}
	cout << ans;
}


Measured memory_bytes: 4364
from itertools import *
N = int(input())
csum = list(0 for _ in range(2000+1))
L = []
for l in map(int,input().split()):
    L.append(l)
    csum[l] += 1
csum = list(accumulate(csum))
ans = 0
for ib in range(N):
    for ia in range(ib):
        a, b = L[ia], L[ib]
        minL, maxL = abs(a-b), a+b
        ans += csum[maxL-1] - csum[minL]
        if minL < a and a < maxL: ans -= 1
        if minL < b and b < maxL: ans -= 1
print(ans//3)

Measured memory_bytes: 3188
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
static const double EPS = 1e-8;
typedef long long ll;


const int MAX = 100000;
const int mod = 100000007;

int dp5[MAX + 5], dp3[MAX + 3];
int dpp5[MAX + 6], dpp3[MAX + 4];

char buf[MAX + 1];

int main()
{
	dp5[0] = dp3[0] = 1;
	for (int i = 0; i < MAX; ++i)
	{
		for (int j = 1; j <= 5; ++j)
			(dp5[i + j] += dp5[i]) %= mod;
		for (int j = 1; j <= 3; ++j)
			(dp3[i + j] += dp3[i]) %= mod;
	}
	for (int i = 1; i <= MAX; ++i)
	{
		dpp5[i + 5] = ((dpp5[i] += dp5[i]) %= mod);
		dpp3[i + 3] = ((dpp3[i] += dp3[i]) %= mod);
	}

	while (cin.getline(buf, sizeof(buf)), *buf != '#')
	{
		char* p = buf;
		ll res = 1;

		char c = '@';
		int count = 1;
		do
		{
			if (*p == c)
				++count;
			else
			{
				if (c != '8' && c != '0')
					res *= dpp5[count];
				else
					res *= dpp3[count];

				res %= mod;
				c = *p;
				count = 1;
			}
		} while (*p++ != '\0');

		printf("%d\n", res);
	}

	return 0;
}

Measured memory_bytes: 2528
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<algorithm>
#include<queue>
#include<vector>
#include<map>
#define ll long long
#define min(a,b) (a<b?a:b)
#define max(a,b) (a>b?a:b)
ll read()
{
	ll tmp=0; char f=1,c=getchar();
	while(c<'0'||'9'<c){if(c=='-')f=-1; c=getchar();}
	while('0'<=c&&c<='9'){tmp=tmp*10+c-'0'; c=getchar();}
	return tmp*f;
}
using namespace std;
int n,y;
int main()
{
	n=read(); y=read();
	if(y%1000){
		printf("-1 -1 -1\n"); return 0;
	}
	y/=1000;
	for(int i=0;i*10<=y;i++)
		for(int j=0;j*5<=y-10*i;j++)
			if(i+j+(y-10*i-5*j)==n){
				printf("%d %d %d\n",i,j,y-10*i-5*j); return 0;
			}
	printf("-1 -1 -1\n");
	return 0;
}

Measured memory_bytes: 128
#include<cstdio>
#include<cstring>
#include<cmath>
#include<map>
#include<algorithm>
using namespace std;
int main()
{
    char a[2];
    int b;
    while(~scanf("%s",a))
    {
        b=a[0]+1;
        printf("%c\n",b);
    }
}


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

using namespace std;
vector<long long> factors;
#define ll long long


#define pii pair<int,int>
#define pll pair<ll,ll>
#define _ <<'\n'
#define __ << ' '
#define all(x) (x).begin(), (x).end()
#define gcd __gcd
int IT_MAX = 1 << 17;
int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1);
const double ERR = 1e-10;
#define szz(x) (int)(x).size()
#define IOS ios_base::sync_with_stdio(false); cout.tie(0);cin.tie(0);
#define flush fflush(stdout)

ll mod(ll a, ll m)
{ return (a + (abs(a) / m) * m + m) % m; }

//****************************don't use int!!!!!!!****************************//
//***************************code starts here!!!!!****************************//


int main()
{
	IOS

	string st;
	cin >> st;

	ll day =0;
	ll m = 0;
	ll y = 0;
	day = st[9] - '0';
	day += (st[8] -'0' ) * 10;
	m = st[6] - '0';
	m += (st[5] -'0') * 10;
	if(m > 4){
		cout << "TBD";
		return 0;
	}else{
		if(m == 4){
			if(day > 30){
				cout << "TBD";
				return 0;
			}
			}
		cout << "Heisei";
		return 0;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <set>
#include <string>
#include <vector>
#include <cmath>

int main(void){
    int n;
    std::cin >> n;
    bool check = false;
    for(int i = 0; i < n; i++){
        char x;
        std::cin >> x;
        if(x == 'Y'){
            check = true;
            break;
        }
    }
    std::cout << (check ? "Four" : "Three");
    return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <limits>
#include <string>
#include <bitset>
#include <functional>

using namespace std;
using lint = long long;
using pii = pair<int, int>;
using vec = vector<int>;
using pq = priority_queue<int>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n); i > 0; i--)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define all(x) (x).begin(), (x).end()
#define foreach(it, x) for (auto it = (x).begin(); it != (x).end(); it++)
#define mp(x, y) make_pair((x), (y))
#define space " "

constexpr lint MOD = 1e9 + 7;
int A, B, C, F, H, I, J, K, L, M, N, P, Q, S, T, U, W, X, Y;
// lint A, B, F, H, I, J, K, L, M, N, P, Q, S, T, U, W, X, Y;
int ans = 0;
// string ans;
int dp[10][10];

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

	cin >> H >> W;
	rep(i, 10) {
        rep(j, 10) {
            cin >> dp[i][j];
        }
	}

    rep(k, 10) {
        rep(i, 10) {
            rep(j, 10) {
                dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
            }
        }
    }
	
	rep(i, H) {
        rep(i, W) {
            cin >> N;
            if (N != -1 && N != 1) ans += dp[N][1];
        }
    }

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

Measured memory_bytes: 256
n,m,x,y=map(int,input().split())
xmax=max(list(map(int,input().split())))
ymin=min(list(map(int,input().split())))

ans='War'
for i in range(xmax+1,ymin+1):
  if x<i<=y:
    ans='No War'
    break
print(ans)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define REP(i,x,n) for(int i = (x); i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1);

int main(void)
{
    ll n; cin>>n;
    ll a=1, b=1, c=1;
    rep(i,n){
        a *= 10;
        a %= mod;
        b *= 9;
        b %= mod;
        c *= 8;
        c %= mod;
    }
    cout << ((a%mod)-(b%mod)-(b%mod)+(c%mod)+2*mod)%mod << endl;
    return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0);cin.tie(0)
#define endl '\n'
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
using ld =long double;

const int maxn = 3005;
const int half = 1505;
ld dp[maxn][half],p,ans;

int32_t main(){
    IOS;
    int n;
    cin>>n;
    dp[0][0]=1;
    rep1(i,n){
        cin>>p;
        for(int j=min(i,n/2);j>0;j--)
            dp[i][j]=(dp[i-1][j-1]*(1-p)+dp[i-1][j]*p);
        dp[i][0]=dp[i-1][0]*p;
    }

    rep(i,n/2+1)
        ans+=dp[n][i];

    cout<< fixed << setprecision(10) << ans<<endl;
    return 0;
}

Measured memory_bytes: 69120
#include <stdio.h>

int main(void)
{
	int a, b;
	int sa, sb;
	int n;
	
	while (1){
		scanf("%d", &n);
		if (!n){
				break;
			}
		sa = sb = 0;
		
		while (n--){
			scanf("%d%d", &a, &b);
			
			
			
			if (a > b){
				sa += (a + b);
			}
			else if (a < b){
				sb += (a + b);
			}
			else {
				sa += a;
				sb += b;
			}
		}
		
		printf("%d %d\n", sa, sb);
	}
	
	return (0);
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vp;
typedef vector<vi> vv;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define OUT(x) cout << (x) << endl;
#define OUTA(a, n) \
    REP(i, n) { cout << (a[i]) << (i == n - 1 ? "\n" : " "); }
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) \
    SORT(a);     \
    reverse(a.begin(), a.end())
const ll INF = 1e18;
const ll MOD = 1e9 + 7;

ll N;
vi X, L;

int main()
{
    cin >> N;
    X = vi(N);
    L = vi(N);
    REP(i, N)
    {
        cin >> X[i] >> L[i];
    }

    vp A = vp(N);
    REP(i, N)
    {
        A[i] = ii(X[i] + L[i], X[i] - L[i]);
    }
    SORT(A);
    ll prev = -INF;
    ll ans = 0;
    REP(i, N)
    {
        if (prev <= A[i].second)
        {
            ++ans;
            prev = A[i].first;
        }
    }

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

Measured memory_bytes: 3328
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef pair<pii,pii> pippi;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
typedef vector<vector<ll>> mat;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<61;
int iinf=1<<30;
double pi=3.14159265358979323846;
double pi2=pi/2.0;
double eps=1e-8;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto& itr:mp)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
//#define endl "\n"
int dh[4]={1,0,-1,0};
int dw[4]={0,1,0,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define umh unordered_map<int,int,custom_hash>
ll gcd(ll a,ll b){
    if(a<0)a=-a;
    if(b<0)b=-b;
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll c=gcd(a,b);
    return a*b/c;
}
ll Pow(ll n,ll k){
    if(k<0)return 0;
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
    now%=md;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll popcount(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}

int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n,k;cin>>n>>k;
    ll a[n];
    rep(i,0,n)cin>>a[i];
    ll u=1000000001,d=0;
    while(u-d>1){
        ll mid=(u+d)/2;
        ll sum=0;
        rep(i,0,n){
            sum+=(a[i]-1)/mid;
        }
        if(sum<=k)u=mid;
        else d=mid;
    }
    cout<<u<<endl;
}


Measured memory_bytes: 5172
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repl(i, l, r) for (ll i = (l); i < (r); i++)
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define CST(x) cout << fixed << setprecision(x)
using ll = long long;
const ll MOD = 1000000007;
const int inf = 1e9 + 10;
const ll INF = 4e18;
const int dx[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
const int dy[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	int n, a, b;
	cin >> n >> a >> b;
	if ((b - a) % 2)
		cout << "Borys" << endl;
	else
		cout << "Alice" << endl;
	return 0;
}

Measured memory_bytes: 256
/*
 *
 *
 */

#include <bits/stdc++.h>

using namespace std;

#define LOG(...) fprintf(stderr, __VA_ARGS__)
//#define LOG(...)
#define FOR(i, a, b) for(int i = (int)(a); i < (int)(b); ++i)
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define RREP(i, n) for(int i = (int)(n - 1); i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SQ(n) (n) * (n)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vc> vvc;
typedef vector<vll> vvll;

int main() {
  int n;
  cin >> n;
  REP(ii, n){

    int y, m, d;
    cin >> y >> m >> d;
    int cnt = 0;
    for(;y < 1000;y++) {
      for(; m <= 10; m++) {
        int D = m % 2 == 0 ? 19 : 20;
        if (y % 3 == 0) D = 20;
        for(; d <= D; d++) {
          cnt++;
        }
        d = 1;
      }
      m = 1;
    }
    cout <<  cnt << endl;
  }
}

Measured memory_bytes: 2992
import Data.List

main = interact $ show' . solve . read'
  where
    show' True = "Yes\n"
    show' False = "No\n"
    solve [xs, ys] = solve' $ xs ++ xs'
      where
        solve' ss | length ss < lys = False
                  | isPrefixOf ys ss = True
                  | otherwise = solve' $ tail ss
        (xs', _) = splitAt lys xs
        lys = length ys
    read' = lines



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

#define PI 3.141592653589
#define ll long long int
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define ii pair<int,int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pll pair<ll,ll>
#define vv vector
int MOD=1e9+7;
ll power(ll a, ll b){//a^b
    ll res=1;
    a=a%MOD;
    while(b>0){
        if(b&1){res=(res*a)%MOD;b--;}
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
ll min(ll a,ll b){return (a>b)?b:a;}
ll max(ll a,ll b){return (a>b)?a:b;}
bool prime[1000001];
vi primes;
void SieveOfEratosthenes(int n) 
{ 
    memset(prime, true, sizeof(prime)); 
    for (int p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
    for(int p=2;p<1000001;p++)
        if(prime[p])
            primes.pb(p);
}
ll fact[100005];
ll finv[100005];
void factorial(int n){
    fact[0]=1;
    finv[0]=1;
    for(int i=1;i<=n;i++)
        fact[i]=fact[i-1]*i,fact[i]%=MOD,finv[i]=fermat_inv(fact[i]);
}
ll ncr(ll n,ll r)
{
    if(n<r)
        return -1;
    else{
        ll x=finv[r]*finv[n-r]%MOD;
        return fact[n]*x%MOD;
    }
}
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

    string s,t;
    cin>>s>>t;
    ll ans=t.size();
    for(int i=0;i<=s.size()-t.size();i++){
        int cnt=0;
        for(int j=0;j<t.size();j++){
            if(s[i+j]!=t[j])
                cnt++;
        }
        ans=min(ans,cnt);
    }
    cout<<ans;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define int long long
using namespace std;

const int MAXN = 1000000 + 10;
const int MOD = 1e9 + 7;
int n, p;
int a[MAXN];

int q0, q1;

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin >> n >> p;

    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        if (x % 2 == 0) q0++;
        else q1++;
    }


    int res = 0;
    if (p == 0) {
        res = 1LL<<q0;
        if (q1 > 0) 
            res = res * ((1LL<<q1) / 2);
    } else {
        res = 1LL<<q0;
        if (q1 == 0) res = 0;
        else res = res * (1LL<<q1) / 2;
    }

    cout << res << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long solve()
{
    long long N;
    cin>>N;
    long long last = 1;
    for(long long i=2; i*i<=N; i++){
        if(N%i==0){
            last = i;
        }
    }
    return (N/last)+last-2;
}
int main()
{
    cout << solve() << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
#define endl '\n'
#define MP make_pair
#define pb push_back

using namespace std;

typedef pair<int, int> P;
typedef pair<int, P> i_P;
typedef long long LL;

static const int INF = INT_MAX;
static const int MIN = INT_MIN;
static const LL L_INF = LLONG_MAX;
static const int MOD = 1000000000 + 7;
static const int SIZE = 100005;

map< LL, LL > mp;

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

    LL n, k;
    cin >> n >> k;
    LL a[n];
    for( int i = 0; i < n; ++i ) {
        cin >> a[i];

    }
    sort( a, a + n );
    int cnt = 1;
    vector< LL > v;
    for( int i = 1; i < n; ++i ) {
        if( a[i] != a[i - 1] ) {
            v.pb( cnt );
            cnt = 0;

        }
        ++cnt;

    }
    v.pb( cnt );


    sort( v.begin(), v.end(), greater< LL >() );
    int pos = 0;
    LL res = 0;
    while( pos < v.size() && pos < k ) {
        res += v[pos];
        ++pos;
    }

    if( v.size() <= k ) cout << 0 << endl;
    else cout << n - res << endl;

    return 0;
}



Measured memory_bytes: 3956
#include<bits/stdc++.h>
using namespace std;
#define FasterIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

typedef unsigned long long ull;
typedef long long ll;

#define mem(a,x) memset(a,x,sizeof(a))
#define pb push_back
#define ff first
#define ss second
#define mk make_pair
#define pi pair<int,int>
#define vi vector<int>
#define pL pair<ll,ll>
#define vL vector<ll>
#define vp vector<pi>
#define vpL vector<pL>
#define pL3 pair<pL, ll>

const int MX=1000000;
const ll inf=1e18;
const ll mod=1e9+7;


int main()
{
    FasterIO;

//    int tc, cs=1; cin>>tc;
//    while(tc--)
    {
        int x; cin>>x;
        cout<<(1^x)<<endl;
    }
    return 0;
}


Measured memory_bytes: 3648
//666yuchen
#include<iostream>
#include<cmath>
#include<cstdio>
#include<string>
#include<cstring>
#include<cstdlib>
#include<algorithm>
using namespace std;
int x,a,b;
int main()
{
  cin>>x>>a>>b;
  x-=a;
  cout<<x%b;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Scanner sc1 = new Scanner(System.in);
		int i = 0, j = 0, k = 0, flag;
		i = sc.nextInt();
		j = sc.nextInt();
		k = sc.nextInt();
		if (i == j && i != k) {
			System.out.println("Yes");

		} else if (j == k && j != i) {
			System.out.println("Yes");

		} else if (k == i && k != j) {
			System.out.println("Yes");
		} else
			System.out.println("No");
	}
}


Measured memory_bytes: 20948
#include<iostream>
#include<string>
using namespace std;
int main(){
string S;
  cin>>S;
  if(S=="SAT"){
  cout<<1<<endl;}
  else if(S=="FRI"){
  cout<<2<<endl;}
  else if(S=="THU"){
  cout<<3<<endl;}
  else if(S=="WED"){
  cout<<4<<endl;}
  else if(S=="TUE"){
  cout<<5<<endl;}
  else if(S=="MON"){
  cout<<6<<endl;}
  else{
  cout<<7<<endl;}
}

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

ans=0
for i in range(1, n+1):
  j=0
  if i < k:
    while i*(2**j) < k:
      j+=1
    ans+=(1/n) * 1/(2**j)
  else:
    ans+=(1/n)

print(ans)

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

using namespace std;

#define inf 1<<30
#define llong long long
#define usd unsigned
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
typedef pair<int, int> P;
typedef struct data{
	int now;
	int cost;
}data;
int nw[9] = {0, 1, 0, -1, -1, 1, 1, -1, 0};
int nh[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};




int main(){
	llong int N, A[200000];
	cin >> N;
	for(int i = 0; i < N; i++){
		cin >> A[i];
		A[i] -= i + 1;
	}
	sort(A, A+N);
	llong int ret[3]; ret[0] = A[N/2], ret[1] = A[N/2+1], ret[2] = A[N/2-1];
	llong int def[3] = {};
	for(int i = 0; i < N; i++){
		for(int j = 0; j < 3; j++){
			def[j] += abs(A[i] - ret[j]);
		}
	}
	sort(def, def+3);
	cout << def[0] << endl;

	return 0;
}

Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int main ()
{
  int A, B = 0;
  int answer = 0;
  
  cin >> A >> B;
  
  if ( A > B )
  {
    answer = A + (A - 1);
  }
  else if ( A < B )
  {
    answer = B + ( B - 1 );
  }
  else if ( A == B )
  {
    answer = A + B;
  }
  
  cout << answer << endl;
  
  return 0;
}

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

hll = []
cnt = 0

zero_check = []
tmp = []
for h in hl:
    if h != 0:
        tmp.append(h)
    elif h == 0 and len(tmp) > 0:
        zero_check.append(tmp)
        tmp = []

if len(tmp) > 0:
    zero_check.append(tmp)

hl = zero_check[:]
# print(hl)

while len(hl) > 0:
    for h in hl:
        cnt += 1
        tmp_num = []
        for num in h:
            if num - 1 != 0:
                tmp_num.append(num - 1)
            elif num - 1 == 0 and len(tmp_num) > 0:
                hll.append(tmp_num)
                tmp_num = []
                # cnt += 1
            # print('num:{}, tmp_num:{}, hll:{}, cnt:{}'.format(num, tmp_num, hll, cnt))

        if len(tmp_num) > 0:
            hll.append(tmp_num)

    hl = hll
    hll = []
    # print('hl:{}'.format(hl))

print(cnt)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1000000007;
const int INF = INT_MAX / 2;

int main(){
    int N, M; cin >> N >> M;
    vector<int> v(M);
    for (int i = 0; i < M; i++) cin >> v[i];
    if(N>=M) {
        cout << 0 << endl;
        return 0;
    }

    sort(v.begin(), v.end());
    vector<int> diffs(M);
    adjacent_difference(v.begin(), v.end(), diffs.begin());
    sort(diffs.begin()+1, diffs.end());

    int ans = 0;    
    for (int i = 0; i < M-N; i++)
    {
        ans += diffs[1+i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define MP(a,b) make_pair(a,b)
typedef long long LL;
typedef pair<int, int> PI;
typedef pair<LL, LL> PLL;
typedef vector<int> VI;
const LL MOD = 1000000007LL;
vector<int> pos[26];
int main() {
	string s;
	cin >> s;
	rep(i, s.size()) {
		pos[s[i] - 'a'].push_back(i);
	}
	rep(i, 26) {
		int min_l = 1 << 30, min_j = -1;
		REP(j, 1, pos[i].size()) {
			if (min_l > pos[i][j] - pos[i][j - 1] + 1) {
				min_l = pos[i][j] - pos[i][j - 1] + 1;
				min_j = j;
			}
		}
		if (min_l <= 3) {
			cout << pos[i][min_j - 1] + 1 << " " << pos[i][min_j]+1 << endl;
			return 0;
		}
	}
	cout << -1 << " " << -1 << endl;
}

Measured memory_bytes: 1148
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define req(i,n) for(int i = 1;i <=n;i++)
#define pai 3.14159265358979323846
const int INF = 1001001001;
typedef long long ll;
int A[3][3], N;
bool punched[3][3];
bool ok[3][3];
using Graph = vector<vector<int>>;
vector<vector<int>> field;
vector<bool> seen;

const int MOD = 1000000007;
typedef pair<int,int> P;

//最大公約数
ll gcd(ll a,ll b){
	if (a%b == 0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}

}

//最小公倍数
ll lcm(ll a,ll b){
	return a /gcd(a,b) * b;
}

//素数判定
bool is_prime(long long N) {
    if (N == 1) return false;
    for (long long i = 2; i * i <= N; ++i) {
        if (N % i == 0) return false;
    }
    return true;
}

// 素因数分解
vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

// 10進数から2進数
int binary(int bina){
    int ans = 0;
    for (int i = 0; bina>0 ; i++)
    {
        ans = ans+(bina%2)*pow(10,i);
        bina = bina/2;
    }
    return ans;
}






int main() {
  ll n,m;
  cin >> n >> m;
  if (abs(n-m) >= 2){
    cout << 0 << endl;
    return 0;
  }
  ll a=1,b=1;
  for (int i = 1;i <= n;i++){
    a *= i;
    a %= MOD; 
    //cout << a << endl;
  }
  for (int i = 1;i <= m;i++){
    b *= i;
    b %= MOD; 
    //cout << b << endl;
  }
  if (abs(m-n)==1){
    cout << (a*b)%MOD << endl;
  }
  else cout << (a*b*2)%MOD << endl;
 

}

Measured memory_bytes: 3724
#include<algorithm>
#include<iostream>
#include<math.h>

using namespace std;

int main(){
	string s;
	cin >> s;
	char a = s[0];
	for (int i = 1; i < s.size(); i++) {
		if (a == s[i]) {
			cout << "Bad" << endl;
			return 0;
		}
		a = s[i];
	}
	cout << "Good" << endl;
}

Measured memory_bytes: 256
def main():
    A, B, C, K = map(int, input().split())

    d = abs(A - B)
    if d > 10**18:
        print("Unfair")

    else:
        if A > B:
            if K % 2 == 0:
                print(d)
            else:
                print(-d)

        elif A < B:
            if K % 2 == 0:
                print(-d)
            else:
                print(d)

        else:
            print("0")

if __name__ == "__main__":
    main()

Measured memory_bytes: 9080
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
	string S;
	cin>>S;
	if (!S.compare("AAA") || !S.compare("BBB")){
		cout<<"No"<<endl;
	}else{
		cout<<"Yes"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
lena, lenb, lenm = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
m = []
m.append(min(a) + min(b))
for i in range(lenm):
    x, y, c = [int(i) for i in input().split()]
    m.append(a[x - 1] + b[y - 1] - c)

print(min(m))


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

int main(){
  int a,b,c,d,right,left;
  cin >> a >> b >> c >> d;
  left = a + b;
  right = c + d;
  if(left < right){
    cout << "Right" << endl;
  }
  
  if(left > right){
    cout << "Left" << endl;
  }
  
  if(left == right){
    cout << "Balanced" << endl;
  }
}

Measured memory_bytes: 256
import math
A,B,H,M=map(int,input().split())
 
hun=6*M
ji=30*H+(1/2)*M
 
if math.radians(hun-ji)==0:
    a=abs(A-B)
elif hun-ji==180 or ji-hun==180:
    a=A+B
else:
    a = (A ** 2 + B ** 2 - 2* A * B * math.cos(math.radians(hun-ji))) ** (1 / 2)
print(a)

Measured memory_bytes: 9564
N = int(input())
maxv1 = 0
maxv2 = 0

for i in range(N):
    a = int(input())
    if a >= maxv1:
        maxv1, maxv2 = a, maxv1
        flag = i
        continue
    if a >= maxv2:
        maxv2 = a

for i in range(N):
    if i == flag:
        print(maxv2)
    else:
        print(maxv1)


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

#define INF 2140000000
#define MaxN 100005

using namespace std;

int K,node,d[MaxN];
deque<int>Q;

int main()
{
    cin>>K;
    for(int i=0;i<K;i++)
        d[i]=INF;
    d[1]=1;
    Q.push_back(1);
    while(!Q.empty())
    {
        node=Q.front();
        Q.pop_front();
        if(d[(node*10)%K]>d[node])
            Q.push_front((node*10)%K),d[(node*10)%K]=d[node];
        if(d[(node+1)%K]>1+d[node])
            Q.push_back((node+1)%K),d[(node+1)%K]=1+d[node];
    }
    cout<<d[0];
    return 0;
}


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

int main() {
    int A = 0;//高橋体力
    int B = 0;
    int C = 0;//青木体力
    int D = 0;

    cin >> A >> B >> C >> D;
    
    while((A > 0) && (C > 0)){
        C = C - B;
        if(C <= 0){
            break;
            cout <<  "Yes" << endl;
        }
        A = A - D;
        if(A <= 0){
            break;
            cout << "No" << endl;
        }
        
    }
    if(C <= 0){
            
            cout <<  "Yes" << endl;
        }
    if(A <= 0){
            
            cout << "No" << endl;
        }
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int K,A,B;
  cin >> K >> A >> B;
  int result = 0;

  for (int i = A; i < B+1; i++) {
    if(i%K == 0){
        cout << "OK" << endl;
        result = 0;
        break;
    }else{
        result = 1;
    }
  }
  if(result == 1){
        cout << "NG" << endl;
  }
  
}

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

int main()
{
  int N; cin >> N;
  vector<double> A(N);
  rep(i,N) cin >> A[i];
  
  double sum_bumbo = 0;
  rep(i,N)
  {
    sum_bumbo += 1/A[i];
  }
  cout << setprecision(10) << 1/sum_bumbo << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>

using namespace std;

int main()
{
  int N;
  int sum = 0;
  cin >> N;
  for (int i = 0; i < N; ++i) {
    int l, r;
    cin >> l >> r;
    sum += (r - l + 1);
  }
  cout << sum << endl;
  return 0;
}


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

double combination(int a, int b){
  double ret = 1;
  for(int i = 0; i < b; ++i){
    ret *= (double)(a-i)/(i+1);
  }
  return ret;
}

int main(){
  int N, M, L;
  cin >> N >> M >> L;
  int P[N], T[N], V[N];
  for(int i = 0; i < N; ++i){
    cin >> P[i] >> T[i] >> V[i];
  }
  double prob[N][M+1];
  //cout << "______prob_______" << endl;
  for(int i = 0; i < N; ++i) prob[i][0] = 1.0;
  for(int i = 0; i < N; ++i){

    for(int j = 1; j <= M; ++j){
      prob[i][j] = prob[i][j-1]*P[i]/100.0*(M-j+1)/j;
    }
    double t = 1.0;
    for(int j = M; j >= 0; --j){
      prob[i][j] *= t;
      t *= (1.0 - (double)P[i]/100.0);
    }
    //cout << i << " | " << prob[i][0] << " | ";
    //for(int j = 1; j <= M; ++j) cout << prob[i][j] << " | ";
    //cout << endl;
  }
  double acum[N][M+2];
  for(int i = 0; i < N; ++i) acum[i][M+1] = 0;
  for(int i = 0; i < N; ++i){
    for(int j = M; j >= 0; --j){
      acum[i][j] = acum[i][j+1] + prob[i][j];
    }
  }
  /*
  cout << "______acum_______" << endl;
  for(int i = 0; i < N; ++i){
    for(int j = 0; j <= M; ++j){
      cout << acum[i][j] << " | ";
    }
    cout << endl;
  }
  */
  
  //cout << "______time_______" << endl;
  vector< vector<double> > time(N,vector<double>(M+1));
  for(int i = 0; i < N; ++i) time[i][0] = (double)L/V[i];
  for(int i = 0; i < N; ++i){
    //cout << i << " | " << time[i][0] << " | ";
    for(int j = 1; j <= M; ++j){
      time[i][j] = time[i][j-1] + T[i];
      //cout << time[i][j] << " | ";
    }
    //cout << endl;
  }
  for(int i = 0; i < N; ++i){
    double ans = 0.0;
    for(int j = M; j >= 0; --j){
      double t = prob[i][j];
      for(int k = 0; k < N; ++k){
        if(k == i) continue;
        int id = upper_bound(time[k].begin(),time[k].end(),time[i][j]) - time[k].begin();
        if(id > M){
          t = 0;
          break;
        }
        t *= acum[k][id];
      }
      //cout << i << " " << j << " " << t << endl;
      ans += t;
    }
    printf("%.12f\n",ans);
  }
  return 0;
}

Measured memory_bytes: 3344
N = int(input())
S = [input() for _ in range(N)]

counts = [0] * 5
for i, c in enumerate('MARCH'):
    counts[i] = len([s for s in S if s[0] == c])

count = 0
for i in range(5):
    for j in range(i + 1, 5):
        for k in range(j + 1, 5):
            count += counts[i] * counts[j] * counts[k]

print(count)

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

typedef long long ll;

int N;
char S[300005];

int pW, pE;
int fW, fE;

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

	for (int i = 0; i < N; ++i) {
		if (S[i] == 'W') fW++;
		if (S[i] == 'E') fE++;
	}

	int mn = 1e9;
	for (int i = 0; i < N; ++i) {
		if (S[i] == 'W') {
			fW--;
			mn = min(mn, fE + pW);
			pW++;
		}
		if (S[i] == 'E') {
			fE--;
			mn = min(mn, fE + pW);
			pE++;
		}
	}

	printf("%d\n", mn);
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;cin>>S;
  string ans="No";
  for(int i=0;i<S.size()-1;i++){
    if(S[i]=='A'&&S[i+1]=='C')ans="Yes";
  }
  cout<<ans<<endl;
}

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

using namespace std;
#define _for(i,j,N) for(int i = (j); i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define ALL(x) x.begin(),x.end()
typedef long long LL;
int get_int(){int x;scanf("%d",&x);return x;}
int get_ll(){LL x;scanf("%lld",&x);return x;}

void tests(){
    ;
}

int main()
{
    int a = get_int();
    int b = get_int();
    int res = 0;
    if(a < b) swap(a,b);
    res += a;
    a--;
    if(a < b) swap(a,b);
    res+=a;
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
N=1e7,a[1<<26];main(i,j){for(i=j=2;i*i<N;a[i]||j>N?j=++i:a[j+=i]++);for(;i=~scanf("%d",&j);j&&printf("%d\n",j))for(;a[j]+a[j-2]+a[j-6]+a[j-8];j--);}

Measured memory_bytes: 0
// Try AtCoder
// author: Leonardone @ NEETSDKASU

fn main() {
	let mut stdin = String::new();
    std::io::Read::read_to_string(
    	&mut std::io::stdin(),
        &mut stdin).unwrap();
	let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
    	($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    let t = get!(f64);
    let x = get!(f64);
    let ans = t / x;
    println!("{}", ans);
    
}

Measured memory_bytes: 4352
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
bool b[33000];
int main() {	
	int n;
	while (cin >> n&&n) {
		int a=10000000, b=-100,x;
		long long sum = 0;
		for (int i = 0; i < n; i++) {
			cin >> x;
			sum += x;
			a = min(a, x);
			b = max(b, x);
		}
		sum -= a;
		sum -= b;
		double c = floor((double)sum / (double)(n - 2));
		cout << c << endl;
	}
}

Measured memory_bytes: 3184
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()
XL = [LIST() for _ in range(N)]

range_lis = [(x[0]-x[1], x[0]+x[1]) for x in XL]
# print(range_lis)

range_lis.sort(key=lambda x:x[1])

tmp = range_lis[0][1]
ans = 1
for i in range(1, N):
	if range_lis[i][0] >= tmp:
		tmp = range_lis[i][1]
		ans += 1
print(ans) 


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

int main () {
    int N;
    int ans = 0;
    int find_ab = 0, last_a = 0, first_b = 0, first_b_last_a = 0;
    string str[10000];
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> str[i];
    }

    for (int i = 0; i < N; i++) {
        if ((str[i][0] == 'B') && (str[i][str[i].size() - 1] == 'A')) {
            first_b_last_a++;
        }
        else if (str[i][0] == 'B') {
            first_b++;
        }
        else if (str[i][str[i].size() - 1] == 'A') {
            last_a++;
        }
        for (int j = 0; j < str[i].size() - 1; j++) {
            if (str[i][j] == 'A') {
                if (str[i][j + 1] == 'B') {
                    find_ab++;
                }
            }
        }
    }
    if (first_b_last_a == 0) {
        ans = find_ab + min(first_b, last_a);
    }
    else {
        if (first_b + last_a > 0) {
            ans = find_ab + min(first_b, last_a) + first_b_last_a;
        }
        else {
            ans = find_ab + first_b_last_a - 1;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 768