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

using namespace std;

using int64 = long long;


int digit[] = {
    0b1110111,
    0b0010010,
    0b1011101,
    0b1011011,
    0b0111010,
    0b1101011,
    0b1101111,
    0b1010010,
    0b1111111,
    0b1111011
};

int main() {

  for(int i = 0; i < 10; i++) {
    int rev = 0;
    for(int j = 0; j < 7; j++) {
      rev |= ((digit[i] >> (6 - j) & 1)) << j;
    }
    digit[i] = rev;
  }


  int N, K;
  int mask[1333] = {};
  for(int i = 0; i < 1333; i++) {
    mask[i] = (1 << 8) - 1;
  }


  cin >> N >> K;
  for(int i = 0; i < K; i++) {
    int p, q;
    cin >> p >> q;
    mask[13 - p] ^= 1 << q;
  }

  const int m[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

  int latte[100] = {}, malta[100] = {};

  for(int i = 0; i < 10000; i++) {
    for(int j = 1; j <= 12; j++) {
      int x = m[j - 1];
      if(j == 2 && (i % 400 == 0 || (i % 100 != 0 && i % 4 == 0))) {
        ++x;
      }
      for(int k = 1; k <= x; k++) {
        int bit = i * 10000 + j * 100 + k, add = 0;
        for(int l = 6; l <= 13; l++) {
          add += __builtin_popcount(digit[bit % 10] & mask[l]);
          bit /= 10;
        }
        latte[add]++;
      }
    }
  }

  for(int i = 0; i < 24; i++) {
    for(int j = 0; j < 60; j++) {
      for(int k = 0; k < 60; k++) {
        int bit = i * 10000 + j * 100 + k, add = 0;
        for(int l = 0; l <= 5; l++) {
          add += __builtin_popcount(digit[bit % 10] & mask[l]);
          bit /= 10;
        }
        malta[add]++;
      }
    }
  }

  int64 ret = 0;
  for(int i = 0; i <= N; i++) {
    ret += 1LL * latte[i] * malta[N - i];
  }
  cout << ret << endl;
}




Measured memory_bytes: 3140
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main(){
  string s;
  cin >> s;
  int cnt = 0,ans = 0;
  for(int i=0;i < s.size();i++){
    if(s[i] == 'R'){
      cnt++;
      ans = cnt;
    }else if(s[i] == 'S'){
      ans = max(ans,cnt);
      cnt = 0;
    }
  }
    cout << ans << endl;
    return 0;
}
    


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e17)


signed main(){
    int n;
    cin >> n;
    int A[n];
    int xor_sum = 0;
    int ruijou[40];
    ruijou[0] = 1;
    FOR(i,1,35){
        ruijou[i] = ruijou[i-1] * 2;
    }


    int kosuu[40] = {};

    REP(i,n){
        cin >> A[i];
        xor_sum = xor_sum xor A[i];
        int ind = 0;
        while(1){
            if(A[i] & ruijou[ind] ) break;
            ind ++;
        } 
        kosuu[ind] ++; 

    }
    int res = 0;
    REPR(i,33){
        if( (xor_sum & ruijou[i]) ){
            if(kosuu[i] == 0){
                cout << -1 << endl;
                return 0;
            }
            res ++;
            kosuu[i] --;
            int tmp = ruijou[i] -1;
            xor_sum = xor_sum xor tmp;
        }
    }
    cout << res << endl;


}





Measured memory_bytes: 1024
from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math
import itertools
import numpy as np




def main():
    num = int(input())
    data = [int(input()) for i in range(num)]
    sum_num = sum(data)
    mod = 998244353

    dp = np.zeros(sum_num + 1, dtype=np.int64)
    dp[0] = 1
    for i in range(num):
        now_num = data[i]
        prev = dp
        dp = 2 * prev
        dp[now_num:] += prev[:-now_num]
        dp %= mod

    dp2 = np.zeros(sum_num + 1, dtype=np.int64)
    dp2[0] = 1
    for i in range(num):
        now_num = data[i]
        prev = dp2
        dp2 = 1 * prev
        dp2[now_num:] += prev[:-now_num]
        dp2 %= mod

    ans = pow(3, num, mod)
    hikukazu = 0
    for i in range(math.ceil(sum_num / 2), sum_num + 1):
        hikukazu += dp[i]
    if sum_num % 2 == 0:
        hikukazu -= dp2[sum_num // 2]
    ans -= hikukazu * 3
    ans %= mod
    print(ans)
    # print(dp)


if __name__ == '__main__':
    main()



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

using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

inline int toInt(string s) {int v; istringstream sin(s);sin>>v; return v;}

typedef long long ll;

int main(){
    int N;
    cin >> N;
    vector<int> a(N);
    for(int i = 0; i < N; i++) cin >> a[i];


    int right = 0;
    ll sum = 0, res = 0;

    for(int left = 0; left < N; left++){

        while(right < N && (sum + a[right]) == (sum ^ a[right]) ){
            sum += a[right];
            right++;
        }

        res += right - left;

        if(left == right) right++;
        else sum -= a[left];
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define REPr(i,n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m , n) for(int i = (n);i >=(m);--i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define VSCD(v,N) REP(i,N){int (x); SCD(x); v.PB(x);}
#define VSCLLD(v,N) REP(i,N){long long (x); SCLLD(x); v.PB(x);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x,y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int,int> PII;
typedef pair<long long,long long> PLL;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const ll MOD = 1000000007;
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

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

/*（๑•﹏•๑｀) */
int main() {
    int N; cin >> N;
    vector<ll> A(N);

    REP(i,N){
        cin >> A[i];
    }

    vector<ll> lrgcd(N);
    vector<ll> rlgcd(N);

    lrgcd[0] = A[0];
    REP(i,N){
        if (i == 0) continue;
        lrgcd[i] = gcd(lrgcd[i-1],A[i]);
    }

    rlgcd[N-1] = A[N-1];
    REPr(i,N){
        if (i == N-1) continue;
        rlgcd[i] = gcd(rlgcd[i+1],A[i]);
    }

    ll ans = 0;
    REP(i,N){
        if (i == 0) continue;
        if (i == N-1) continue;
        chmax(ans,gcd(lrgcd[i-1],rlgcd[i+1]));
    }

    chmax(ans,rlgcd[1]);
    chmax(ans,lrgcd[N-2]);

    cout << ans << "\n";



}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std; 
int main() 
{
  int n,sum=0,x;
  cin>>n;
  for(int i=1;i<=n;i++)
  {
    for(int j=1;j<=n;j++)
    {
      x=__gcd(i,j);
      for(int k=1;k<=n;k++)
      {
        sum+=__gcd(x,k);
      }
    }
  }
  cout<<sum;
  return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <iomanip>
#include <deque>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;
using vi = vector<int>;
using vll = vector<ll>;
ll mod = 1e9 + 7;

using namespace std;
using Graph = vector<vector<int>>;
Graph G;
const int AMAX = 100000;
/*int cnt_digit(ll N)
{
	int digit = 0;

	while (N > 0)
	{
		N /= 10;
		digit++;
	}
	return digit;
}

int n;
vll a;

ll solve(bool isp)
{
	ll sum = 0ll;
	ll ret = 0ll;

	for (int i = 0; i < n; i++)
	{
		sum += a[i];
		if (isp and sum <= 0)
		{
			ret += -sum + 1;
			sum = 1ll;
		}
		if (not isp and sum >= 0)
		{
			ret += sum + 1;
			sum = -1ll;
		}
		isp ^= 1;
	}
	return ret;
}

*/
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int A,B;
	
	cin >> A >> B;
	vector<int> data(A);
	

	for (int i = 0; i < A; i++)
	{
		cin >> data[i];
	}

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

	int ans = 0;
	for (int i = 0; i < B; i++)
	{
		ans += data[A -1 - i];
	}

	cout << ans << endl;
	
	
	return 0;

	


}


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

{
    int n,a,b;
    scanf("%d %d %d",&n,&a,&b);
    int i,j,x,y,s=0,hp;
    for(i=1;i<=n;i++)
    {
        x=0;
        y=i;
        for(j=0;;j++)
        {
            if(pow(10,j)>y)
            {
                hp=j-1;
                break;
            }
        }
        for(j=hp;j>=0;j--)
        {
            int power=pow(10,j);
            x=x+y/power;
            y=y%power;
        }



        if(x>=a&&x<=b)
        {
            s=s+i;
        }
    }
    printf("%d",s);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<vector>
#include<map>
using namespace std;

int main() {
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;
    char a = toupper(s1[0]);
    char b = toupper(s2[0]);
    char c = toupper(s3[0]);
    cout << a << b << c << endl;
    return 0;
}

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

using namespace std;

typedef long long int64;

deque< int > latte, malta;
int num;

void dfs(int64 p)
{
  if(p == 1) return;
  if(p & 1) dfs(p - 1), latte.push_front(num), malta.push_back(num++);
  else dfs(p / 2), latte.push_back(num), malta.push_back(num++);
}

int main()
{
  int64 N;
  cin >> N;

  num = 1;
  dfs(++N);

  cout << latte.size() + malta.size() << endl;
  for(int i = 0; i < latte.size(); i++) {
    cout << latte[i] << " ";
  }
  for(int i = 0; i < malta.size(); i++) {
    cout << malta[i] << " ";
  }
  cout << endl;
}

Measured memory_bytes: 256
a = gets.to_i
if a < 4
  puts 'No'
  exit
end
if (a % 4 == 0 || a % 7 == 0) || a % 11 == 0
  puts 'Yes'
else
  for i in 0...(a/4+1)
    for j in 0...(a/7+1)
      if a === j*7+i*4
        puts 'Yes'
        exit
      end
    end
  end
  puts 'No'
end

Measured memory_bytes: 1788
#include <iostream>
using namespace std;
int main()
{
	int n;
	int a[10000];
	long long sum = 0;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		sum += a[i];
	}
	for (int i = 0; i < n - 1; i++)
	{
		for (int j = 0; j < n - 1; j++)
		{
			if (a[j] > a[j + 1])
			{
				int t = a[j];
				a[j] = a[j + 1];
				a[j + 1] = t;
			}
		}
	}

	cout << a[0] << " " << a[n - 1] << " " << sum << endl;
	return 0;
}


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

int main(){
    int n;
    cin >> n;
    int count=0;
    vector<int> l(n),r(n);
    for(int i=0;i<n;i++){
        cin >> l[i] >> r[i];
        count += r[i]-l[i] + 1;
    }
    cout << count << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fast {ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
typedef long long int ll;
typedef string S;
#define M 1e18
#define AS 250005
#define in(x)  cin>>x
#define in4(w,x,y,z) cin>>w>>x>>y>>z
#define in3(x,y,z) cin>>x>>y>>z
#define o(x)  cout<<x
#define o2(x,y) cout<<x<<' '<<y;
#define o3(x,y,z) cout<<x<<' '<<y<<' '<<z
#define o4(w,x,y,z)cout<<w<<' '<<x<<' '<<y<<' '<<z
#define sp cout<<' '
#define nw cout<<endl
#define rt return
#define fr(i,a,n) for(ll i=a;i<=n;i++)
#define frm(i,a,n) for(ll i=n;i>=a;i--)
#define P pair<ll,ll>
#define vc vector<ll>
#define pb push_back
#define MP map<ll,ll>
bool sortin(const pair<ll,ll> &e,const pair<ll,ll> &f){return (e.first<f.first);}
bool POT(ll x){return x && (!(x&(x-1)));}
ll i,j,k,l,m,n,p,q,r,a,b,c,x,y,z,ts,mn=1e18,mod=1e9+7;
ll ar[AS],br[AS],xr[AS],tem[AS];
vc v[AS];
void dfs(ll nod)
{
    xr[nod]=1;
    c++;
    fr(j,0,(ll)v[nod].size()-1)
    {
        if(xr[v[nod][j]]==0)dfs(v[nod][j]);
    }
}
int main()
{
    fast;
    in(n>>m);
    fr(i,1,m)
    {
        in(p>>q);
        v[p].pb(q);
        v[q].pb(p);
    }
    fr(i,1,n)
    {
        if(xr[i]==0)
        {
            c=0;
            dfs(i);
            x=max(x,c);
        }
    }
    o(x);
}



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

int main() {
	int h, m, s;
	cin >> s;
	h = s / 3600;
	m = s - 3600 * h;
	s = m;
	m = m / 60;
	s = s - m * 60;
	cout << h << ":" << m << ":" << s << endl;
	return 0;
}

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

namespace ABC127
{
    class D
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split();
            long N = long.Parse(input[0]);
            long M = long.Parse(input[1]);
            long[] a = Console.ReadLine().Split().Select(long.Parse).OrderBy(x => x).ToArray();

            long[] B = new long[M];
            long[] C = new long[M];

            Dictionary<long, long> dict = new Dictionary<long, long>();
            for (long i = 0; i < N; i++)
            {
                if (!dict.ContainsKey(a[i])) dict.Add(a[i], 0);
                if (dict.ContainsKey(a[i])) dict[a[i]]++;
            }

            for (long i = 0; i < M; i++)
            {
                input = Console.ReadLine().Split();
                B[i] = long.Parse(input[0]);
                C[i] = long.Parse(input[1]);

                if (!dict.ContainsKey(C[i])) dict.Add(C[i], B[i]);
                else dict[C[i]] += B[i];
            }

            var dict2 = dict.OrderByDescending(x => x.Key);

            long res = 0;
            long count = 0;
            foreach (var item in dict2)
            {
                if (count + item.Value <= N) { res += item.Key * item.Value; count += item.Value; }
                else { res += item.Key * (N - count); Console.WriteLine(res); return; }
            }

            Console.WriteLine(res);



            /*
            foreach (var item in dict2)
            {
                Console.Write(item.Key);
                Console.Write(' ');
                Console.WriteLine(item.Value);
            }
            */
        }
    }
}


Measured memory_bytes: 44088
n = gets.chomp.to_i
require 'prime'

ps = Prime.prime_division(n)
zs = []
ps.each do |(p, e)|
  (1..e).each do |_e|
    break if (1.._e).sum > e
    zs.push (p**_e)
  end
end
puts zs.size


Measured memory_bytes: 14404
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
const double EPS = 1e-10;

signed main() {
	string s;
	getline(cin, s);
	string buf; bool f = true;
	rep(i, 0, s.size()) {
		if (s[i] == ' ' || s[i] == '.' || s[i] == ',') {
			if (3 <= buf.size() && buf.size() <= 6) {
				if (f)f = false;
				else cout << " ";
				cout << buf;
				buf = "";
			}
			else buf = "";
		}
		else buf += s[i];
	}
	if (3 <= buf.size() && buf.size() <= 6)cout << " " << buf;
	cout << endl;
	return 0;
}

Measured memory_bytes: 3072
/*#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
#include<bits/stdc++.h>
using namespace std;
# define ll long long
# define int long long  //comment it out when MLE
# define endl "\n"
#define gok ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//# define m 163577857
//# define MOD 163577857
# define pi acos(-1)
# define fi first
# define se second
#define REP(i,n) for (int i = 1; i <= n; i++)
const ll mod = 1000000007;
const int K = 2;
//typedef vector<vector<int> > matrix;
int add(int a, int b,int mod) {
    a%=mod;
    b%=mod;
	a += b;
	if (a >= mod) a -= mod;
	if(a<0)
    {
        a += mod;
        a %= mod;
    }
	return a;
}

int mul(ll a, int b,int mod) {
    a%=mod;
    b%=mod;
	a *= b;
	return a % mod;
}
int po(int a,int b,int mod)
{
    if(b==0)
        return 1;
    if(b%2==0)
        return po(mul(a,a,mod),b/2,mod);
    return mul(a,po(mul(a,a,mod),(b-1)/2,mod),mod);
}


ll fact[1000003];
ll inv[1000003];

void fact0()
{
	int i,j;
	fact[0]=1;
	for(i=1;i<=200000;i++)
	{
		fact[i]=i*fact[i-1]%mod;
	}
	inv[0]=1;
	inv[1]=1;
	ll p=mod;
	for (i=2; i<=200000; i++)
		inv[i] = (p - (p/i) * inv[p%i] % p) % p;

	for(i=2;i<=200000;i++)
	{
		inv[i]*=inv[i-1];
		inv[i]%=mod;
	}
}

signed main()
{
    gok
   //fact0();

 int a,b,c;
 cin>>a>>b>>c;
 int k;
 cin>>k;
 int an=0;
 int mi = min(a,k);
 a-=mi;
 k-=mi;
 an += mi;
 mi = min(b,k);
 k-=mi;
 mi = min(c,k);
 an -= mi;
 cout<<an;























 return 0;
}


Measured memory_bytes: 3640
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from itertools import accumulate
from itertools import chain
from collections import deque
def main():
    n = int(input())
    a1 = chain(tuple([0]), tuple(map(int, input().split())))
    a2 = chain(tuple([0]), tuple(map(int, input().split())))

    a1a = tuple(accumulate(a1))
    a2a = tuple(accumulate(a2))
    scores = deque()
    for i1 in range(1, n + 1):
        scores.append(a1a[i1] + a2a[n] - a2a[i1 - 1])
    r = max(scores)
    print(r)
if __name__ == '__main__':
    main()


Measured memory_bytes: 9316
//abc077_c.cpp
//Sun Mar 18 18:50:00 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>

using namespace std;

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

	long a[n];
	long b[n];
	long c[n];

	for (int i=0;i<n;i++){
		cin >> a[i];
	}
	for (int i=0;i<n;i++){
		cin >> b[i];
	}
	for (int i=0;i<n;i++){
		cin >> c[i];
	}

//Sort each array here!!
	sort(a,a+n);
	sort(b,b+n);
	sort(c,c+n);

	long bscore[n];
	for (int i=0;i<n;i++){
		bscore[i] = 0;
	}

	long btotal = 0;
	long k = 0;
	for (int j=0;j<n;j++){
		while (b[j]>=c[k] && k<n){
			k++;
		}
		if (k==n){
			break;
		}
		bscore[j] = n-k;
		btotal = btotal + n-k;
	}
	long bscoreinv[n];
	for (int i=0;i<n;i++){
		bscoreinv[i] = btotal;
		btotal = btotal - bscore[i];
	}

	long ans = 0;
	k=0;
	for (int x=0;x<n;x++){
		while (a[x]>=b[k] && k<n){
			k++;
		}
		if (k==n){
			break;
		}
		ans = ans + bscoreinv[k];
	}

	cout << ans << endl;
}

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

int main() {
    int a[10][10], n, b[15];
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> a[i][j];
        }
    }
    cin >> n;
    for (int i = 0; i < n; i++) cin >> b[i];

    bool c[10][10] = {false};
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 3; j++) {
            for (int k = 0; k < 3; k++) {
                if (b[i] == a[j][k]) c[j][k] = true;
            }
        }
    }

    for (int i = 0; i < 3; i++) {
        bool f = true;
        for (int j = 0; j < 3; j++) {
            if (c[i][j] == false) f = false;
        }
        if (f) { 
            cout << "Yes" << endl;
            return 0;
        }
    }
    for (int i = 0; i < 3; i++) {
        bool f = true;
        for (int j = 0; j < 3; j++) {
            if (c[j][i] == false) f = false;
        }
        if (f) { 
            cout << "Yes" << endl;
            return 0;
        }
    }
    if (c[0][0] == true && c[1][1] == true && c[2][2] == true || c[0][2] == true && c[1][1] == true && c[2][0] == true) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}

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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;

void solve()
{
    int N; cin >> N;
    map<int, int> m;
    vi count(N, 0);
    REP(i, N)
    {
        int A; cin >> A;
        if(m.find(A) == m.end())
        {
            m.insert(make_pair(A, i));
            count[i]++;
        }
        else
        {
            count[m.find(A)->second]++;
        }
    }

    int ans = 0;
    REP(i, N) if(count[i] %2 == 1) ans++;
    cout << ans << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    solve();

    return 0;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
//登録しよう！→ https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define gre greater //sortを降順にする
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示

void solve(long long N, long long M, long long X, std::vector<long long> A){
  int a=0,b=0;
  for (int i = 0; i < M; i++) {
    if(A[i] < X)b++;
    else a++;
  }
  cout << min(a,b) << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    long long X;
    scanf("%lld",&X);
    std::vector<long long> A(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, M, X, std::move(A));
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
	public static void main(String[] args) {
		var sc = new Scanner(System.in);
		var x = IntStream.range(0, 5).map(i -> sc.nextInt()).toArray();
		sc.close();

		int result = 0;
		for (var i = 0; i < x.length; i++) {
			if (x[i] == 0) {
				result = i + 1;
				break;
			}
		}

		System.out.println(result);
	}
}


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


signed main(){
  int K, N;
  cin >> K >> N;
  vector<int> A(N);
  for( int i = 0; i < N; i++ ) cin >> A.at(i);
  
  int ans = 1000000000000;
  for( int i = 0; i < N; i++ ){
    if( i == 0 ){
      ans = min(ans, A.at(N-1)-A.at(0));
      ans = min(ans, A.at(0)+(K-A.at(i+1)));
    }else if( i < N-1 ){
      ans = min(ans, K-A.at(i)+A.at(i-1));
      ans = min(ans, A.at(i)+K-A.at(i+1));
    }else if( i == N-1 ){
      ans = min(ans, K-A.at(i)+A.at(i-1));
      ans = min(ans, A.at(i)-A.at(0));
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1792
b = "AKIHABARA"
def akiba(a, b):
    i = -1
    lenght = len(a)
    for one_b in b:
        i += 1
        if i > lenght-1:
            if one_b == '$':
                return True
            else:
                return False
        if not a[i] == b[i]:
            if not b[i] == 'A':
                return False
            if akiba(a[i:], b[i+1:]):
                return True
            else:
                return False
    return True

if __name__=="__main__":
    a = input("")
    if akiba(a + '$', b + '$'):
        print("YES")
    else:
        print("NO")

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <numeric>
#include <set>
using namespace std;
typedef long long ll;

int main(){
   
  int D,G;cin>>D>>G;
  vector<int> p(D),c(D);
  for(int i=0;i<D;i++)cin>>p[i]>>c[i];
  int ans=1<<30;
  for(int bit=0;bit<1<<D;bit++){
      int tmp=0,num=0;
      for(int i=0;i<D;i++){
          if(bit&(1<<i)){
              tmp+=p[i]*(i+1)*100+c[i];
              num+=p[i];
          }
      }
      if(G<=tmp&&ans>num)ans=num;
      else {
          for(int i=D-1;i>=0;i--){
              if(!(bit&(1<<i))){
                  if((G-tmp)<p[i]*(i+1)*100){
                      while(tmp<G){
                          tmp+=(i+1)*100;
                          num++;
                      }
                    if(ans>num)ans=num;
                  }       
              }
          }
      }
  }
  cout<<ans;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int a,b;
	scanf("%d%d",&a,&b);
	
	if(a==b){
		printf("a == b\n");
	}else if(a>b){
		printf("a > b\n");
	}else{
		printf("a < b\n");
	}		
	return 0;
}

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

int main(){
    int N, M, a, b;
    cin >> N >> M;
    int i1[200001], iN[200001];
    for(int i=0;i<200001;i++){
      i1[i]=0;
      iN[i]=0;
    }
    for(int i=0;i<M;i++){
        cin >> a >> b;
        if(a == 1)
            i1[b] = 1;
        if(b == N)
            iN[a] = 1;
    }
    for(int i=2;i<N;i++){
        if(i1[i] == 1 && iN[i] == 1){
            cout << "POSSIBLE" << endl;
            return 0;
        }
    }
    cout << "IMPOSSIBLE" << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

double DP[301][301][301];
int visited[301][301][301];

double DFS(int c1, int c2, int c3,int N)
{
  // DEBUG(c1,c2,c3,"\n");
  if(visited[c1][c2][c3] == 1)return DP[c1][c2][c3];
  visited[c1][c2][c3] = 1;
  if(c1 == 0 && c2 ==0 && c3 == 0)return 0;

  double res = (double)1/((double)1-(double)(N-c1-c2-c3)/(double)N);
  double X = res;
  if(c1 > 0)res += DFS(c1-1,c2,c3,N)*(double)c1/(double)N*X;
  if(c2 > 0)res += DFS(c1+1,c2-1,c3,N)*(double)c2/(double)N*X;
  if(c3 > 0)res += DFS(c1,c2+1,c3-1,N)*(double)c3/(double)N*X;

  return DP[c1][c2][c3] = res;
}

void solve(void)
{
  int C1 = 0,C2 = 0,C3 = 0;
  int N;
  cin>>N;
  for (int i = 0; i < N; i++)
  {
    int X ;cin>>X;
    if(X==1)C1++;
    else if(X==2)C2++;
    else C3++;
  }
  // vector<vector<vector<int> > > visited (600+1,vector<vector<int> >(600+1,vector<int>(600+1,0)));
  // vector<vector<vector<double> > > DP (600+1,vector<vector<double> >(600+1,vector<double>(600+1,0)));
  cout<<DFS(C1,C2,C3,N)<<endl;
  
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


Measured memory_bytes: 426240
#include<iostream>
#include<cmath>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int fnc(int n){
	if(n<10)return 0;
	int ans=0;
	for(int i=1;(int)pow(10,i)<n;i++){
		int pre=n/(int)pow(10,i),la=n%((int)pow(10,i));
		ans=max(ans,pre*la);
	}
	return fnc(ans)+1;
}

int main(){
	int q;
	cin>>q;
	int num;
	rep(p,q){
		cin>>num;
		cout<<fnc(num)<<endl;
	}
	return 0;
}

Measured memory_bytes: 3264
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pi;
typedef pair<ll,pi> pii;
typedef vector<pi> vpi;
typedef set<ll> si;
typedef long double ld;
#define mp make_pair
#define pb push_back
#define f first
#define s second
ll INF = 1e18;
ll MOD = 1e9;
#define lb lower_bound
#define ub upper_bound
#define SZ(x) (ll)x.size()
#define ALL(x) x.begin(),x.end()

vi l, r;
vpi V;
ll N,a,b,C,ans;

int main(){
  //freopen("input.txt","r",stdin);
  cin>>N>>C;
  for (int i=0;i<N;++i){
		cin>>a>>b;
		V.pb(mp(a,b));
	}
	sort(ALL(V));
	pi cur = mp(0,0);
	l.pb(0);
	for (int i=N-1; i >= 0; --i){
		cur.f = (C - V[i].f)*2;
		cur.s += V[i].s;
		if (cur.s - cur.f > l.back())l.pb(cur.s - cur.f);
		else l.pb(l.back());
	}
	//for (auto i : l)cout<<i<<' ';
	r.pb(0);
	cur = mp(0,0);
	for (int i=0;i<N;++i){
		cur.f = V[i].f;
		cur.s += V[i].s;
		if (cur.s - cur.f > r.back())r.pb(cur.s - cur.f);
		else r.pb(r.back());
	}
	reverse(ALL(r));
	for (int i=0;i<=N;++i){
		//cout<<l[i]<<' '<<r[i]<<'\n';
		ans = max(ans, l[i] + r[i]);
	}
	l.clear(); r.clear();
	cur = mp(0,0);
	l.pb(0);
	for (int i=N-1; i >= 0; --i){
		cur.f = (C - V[i].f);
		cur.s += V[i].s;
		if (cur.s - cur.f > l.back())l.pb(cur.s - cur.f);
		else l.pb(l.back());
	}
	//for (auto i : l)cout<<i<<' ';
	r.pb(0);
	cur = mp(0,0);
	for (int i=0;i<N;++i){
		cur.f = V[i].f*2;
		cur.s += V[i].s;
		if (cur.s - cur.f > r.back())r.pb(cur.s - cur.f);
		else r.pb(r.back());
	}
	reverse(ALL(r));
	for (int i=0;i<=N;++i){
		//cout<<l[i]<<' '<<r[i]<<'\n';
		ans = max(ans, l[i] + r[i]);
	}
	cout<<ans;
}


Measured memory_bytes: 4464
#include <cstdio>
#include <cstring>
using namespace std;

int main(){

	char s1[101],s2[201],p[101];
	scanf("%s %s",s1,p);
	strcpy(s2,s1);
	strcat(s2,s1);

	if(strstr(s2,p) == NULL)printf("No\n");
	else printf("Yes\n");

	return 0;
}

Measured memory_bytes: 2760
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

int main() {
  string s,t;
  cin >> s >> t;
  ll n=s.size();
  ll m=t.size();
  mat dp(n+1,vec(m+1));
  for(ll i=0;i<n;i++) {
    for(ll j=0;j<m;j++) {
      dp[i+1][j+1]=max({dp[i+1][j],dp[i][j+1],dp[i][j]});
      if(s[i]==t[j]) {
        dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j]+1);
      }
    }
  }
  if(dp[n][m]==0) {
    cout << endl;
    return 0;
  }
  string ans;
  while(n>0&&m>0) {
    while(n>0&&dp[n][m]==dp[n-1][m]) {
      n--;
    }
    while(m>0&&dp[n][m]==dp[n][m-1]) {
      m--;
    }
    if(n<1||m<1) break;
    ans=s[n-1]+ans;
    n--,m--;
  }
  cout << ans << endl;
}

Measured memory_bytes: 72832
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int H1 ,M1 ,H2 ,M2,K;
  cin >> H1 >> M1 >> H2 >> M2 >> K;
  int A = H1 * 60 + M1;
  int B = H2 * 60 + M2;
  if(B-A<=K)
  {
    cout << 0 << endl;
  }
  else
  {
    cout << B - A - K << endl;
  }
  return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define ll long long int
#define vll vector<pair<ll, ll> >
#define vl vector<ll>
#define vi vector<int>
#define vii vector<pair<int, int> >
const ll mod = 1e9 + 7;
const ll inf = LLONG_MAX;
using namespace std;

ll power_mod(ll x, ll y, ll p)
{
	ll ans = 1;
	x = x%p;
	if(x==0)
	return p;

	while(y>0)
	{
		if(y&1)
		{
			ans = (ans*x)%p;
		}
		y = y>>1;
		x = (x*x)%p;
	}
	return ans;
} 

int counter(int x) {
    if(x == 0) return 0;
    return counter(x >> 1) + (x & 1);
}


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int i,j,k,l,m,n;
	cin>>n;
	int a[20];
    int x[20][20];
    int y[20][20];
	
	for(i=1;i<=n;i++)
	{
	    cin>>a[i];
	    for(j=1;j<=a[i];j++)
	    {
	        cin>>x[i][j]>>y[i][j];
	    }
	}
	int ans = 0;
	for(j=1;j<(1<<n);j++)
	{
	    bool ok = true;
	    
	    for(i=1;i<=n;i++)
	    {
	        if(!(j & 1<<(i-1)))
	        {
	            continue;
	        }
	        
	        for(k=1;k<=a[i];k++)
	        {
	            if(((j >> (x[i][k]-1)) & 1) ^ y[i][k])
	            ok = false;
	        }
	    }
	    
	    if(ok)
	    ans = max(ans, counter(j));
	}
	cout<<ans<<"\n";
	return 0;
}


Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
                     
#define int             long long
#define ld              long double
#define mp              make_pair
#define ff              first
#define ss              second
#define pb              push_back
#define fo(i,n)         for(i=0;i<n;i++)
#define fo1(i,n)        for(i=1;i<=n;i++)
#define FO(i,k,n)       for(i=k;k<=n?i<=n:i>=n;k<=n?i++:i--)
#define all(c)          c.begin(),c.end()
#define rall(c)         c.rbegin(),c.rend()
#define si              set<int>
#define vi              vector<int>
#define mii             map<int,int>
#define pii             pair<int,int>
#define usi             unordered_set<int>
#define umii            unordered_map<int,int>
#define pqmx            priority_queue<int>
#define pqmn            priority_queue<int,vi,greater<int> >
#define sp(x)           cout<<setprecision(x)<<fixed;
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)     __builtin_ctzll(x)
#define in(a,n)         vi a(n);fo(i,n)cin>>a[i];
#define in1(a,n)        vi a(n+1);fo1(i,n)cin>>a[i];
#define w(t)            int t;cin>>t;while(t--)
#define gcd             __gcd
#define lcm(x,y)        x*(y/gcd(x,y))
#define endl            '\n'
#define PI              3.14159265358979323846
#define inf             1e18
#define mod             1000000007
void __p(int x) {cout<<x;}
void __p(int32_t x){cout<<x;}
void __p(float x){cout<<x;}
void __p(double x){cout<<x;}
void __p(ld x) {cout<<x;}
void __p(char x){cout <<'\''<<x<<'\'';}
void __p(const char *x){cout <<'\"' <<x<<'\"';}
void __p(const string &x) {cout<<'\"'<<x<<'\"';}
void __p(bool x) {cout<<(x?"true":"false");}
template<typename T,typename V>     void __p(const pair<T,V> &x) {cout<<'{';__p(x.first);cout<<',';__p(x.second);cout<<'}';}
template<typename T>                void __p(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __p(i); cout << "}";}void _p() {cout << "]\n";}
template <typename T,typename... V> void _p(T t, V... v) {__p(t);if(sizeof...(v))cout<<", ";_p(v...);}
int po(int x,int p,int m = inf) {int ans=1;x%=m;while(p>0){if(p&1)ans=(ans*x)%m;p=p>>1;x=(x*x)%m;}return ans;}
int inv(int x,int m=mod){return po(x,m-2,m)%m;}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout<<"["<<#x<<"]=[";_p(x)
#else 
#define dbg(x...)
#endif
//=========================================================




const int N=1e6+6;
int n,m,k,x,y,z,a,b,c,d,i,j,l,r;
ld eps=1e-9;






void sol()
{   
    cin>>a>>b>>c;
    d=c-a-b;

    if(d>0 && d*d>4*a*b)cout<<"Yes";
    else cout<<"No";
    

}





int32_t main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //sp(10);
    // w(t)
    sol();
    return 0;
}

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

int main() {
    string str;
    cin >> str;
    int n = 0;

    for(int i=0; i<4; i++) {
	    if(str[i] == '+') {
	        n++;
	    } else {
	        n--;
	    }
    }

    cout << n << endl;
    return 0;
}


Measured memory_bytes: 256
while line = gets
  weight = line.to_f
  case true
  when weight <= 48 then puts "light fly"
  when weight <= 51 then puts "fly"
  when weight <= 54 then puts "bantam"
  when weight <= 57 then puts "feather"
  when weight <= 60 then puts "light"
  when weight <= 64 then puts "light welter"
  when weight <= 69 then puts "welter"
  when weight <= 75 then puts "light middle"
  when weight <= 81 then puts "middle"
  when weight <= 91 then puts "light heavy"
  else puts "heavy"
  end
end

Measured memory_bytes: 8576
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using P = pair<lint, lint>;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
void yes(bool expr) {
  cout << (expr ? "Yes" : "No") << "\n";
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  lint N, A, B, C, D;
  cin >> N >> A >> B >> C >> D;
  REP(k, N) {
    lint max = k*D - (N-1-k)*C;
    lint min = k*C - (N-1-k)*D;
    if(B-A <= max && B-A >= min) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
}

Measured memory_bytes: 256
N, Y = map(int, input().split())
# 10000*a + 5000 * b + 1000 * c = Y
# a + b + c = N
for i in range(N + 1):
    if Y < 10000 * i:
        continue
    for j in range(N + 1):
        if N < i + j :
            continue
        if Y == 10000 * i + 5000 * j + 1000 * (N - i - j):
            print(i , j , N -i -j)
            exit()

print(-1,-1,-1)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
const int MX=1e9;
int dp[1000000][52];
int c[1000000][20];
int n;
int a[20];
int b[20];
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    cin>>n;
    int i,j,k;
    for(i=0 ; i<n ; i++)cin>>a[i];
    for(i=0 ; i<n ; i++)cin>>b[i];
    for(i=0 ; i<=50 ; i++)dp[0][i]=0;
    for(i=1 ; i<(1<<n) ; i++)for(j=0 ; j<=50 ; j++)dp[i][j]=MX;
    for(i=0 ; i<(1<<n) ; i++){
        int k=n;
        for(j=n-1 ; j>=0 ; j--){
            if(((1<<j)&i)==0){
                c[i][j]=k--;
            }
        }
    }
    for(i=1 ; i<(1<<n) ; i++){
        int t=i;
        int s=0;
        while(t){
            s+=t%2;
            t/=2;
        }
        for(k=0 ; k<n ; k++){
            if(((1<<k)&i)==0)continue;
            if(s%2!=k%2){
                dp[i][a[k]]=min(dp[i][a[k]],dp[i^(1<<k)][a[k]]+abs(s-c[i^(1<<k)][k]));
            }
            else{
                dp[i][b[k]]=min(dp[i][b[k]],dp[i^(1<<k)][b[k]]+abs(s-c[i^(1<<k)][k]));
            }
        }
        for(j=1 ; j<=50 ; j++)dp[i][j]=min(dp[i][j],dp[i][j-1]);

    }
    int ans=dp[(1<<n)-1][50];
    if(ans<MX)cout<<ans;
    else cout<<-1;
    return 0;
}


Measured memory_bytes: 78080
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <random>
#include <chrono>
#include <tuple>
#include <random>
#include <cmath>

using namespace std;

typedef long long ll;
typedef long double ld;
#define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

const ll SIZE = 1e6 * 2 + 10, INF = 1e9 * 1e9 + 10;



int main()
{
    fastInp;

	string s;
	cin >> s;

	if (s == "RRR") {
		cout << 3;
		return 0;
	} 
	if (s == "RRS" || s == "SRR") {
		cout << 2;
		return 0;
	}
	if (s == "SSS") {
		cout << 0;
		return 0;
	}
	cout << 1;
	
    
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <vector>

int main() {
	std::size_t n;
	long long a, b;
	std::cin >> n >> a >> b;
	std::vector<long long> x(n);
	for (std::size_t i = 0; i < n; i++) {
		std::cin >> x[i];
	}
	
	long long ans = 0;
	for (std::size_t i = 0; i + 1 < n; i++) {
		long long d = x[i + 1] - x[i];
		ans += std::min(d * a, b);
	}
	
	std::cout << ans << '\n';
	
	return 0;
}

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

long long luca(int a,vector<long long> &memo){
 
  if ( a == 0 )return 2;
  if ( a == 1 )return 1;

  if ( memo[a] != -1 )return memo[a];
  
  return memo[a] = luca(a-1,memo) + luca(a-2,memo);
  
}

int main() {
  
  int n;
  cin >> n;
  
  vector<long long> memo(n+1,-1);
  
  cout << luca(n,memo) << endl;

}

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

int main() {
  
  int n;
  cin >> n;
  int A[20];
  int x[20][20];
  int y[20][20];
  rep(i, 0, n) {
    cin >> A[i];
    rep(j, 0, A[i])
      cin >> x[i][j] >> y[i][j];
  }
  
  int ans = 0;
  for(int bit = 0; bit < (1 << n); bit++) {
    bool ok = true;
    rep(i, 0, n) {
      if(!(bit & (1 << i))) continue; 
      rep(j, 0, A[i])
        if(((bit >> (x[i][j]-1)) & 1) ^ y[i][j]) ok = false;
    }
    if(ok) {
      int ret = 0;
      rep(k, 0, n)
        if(bit & (1 << k)) ret++;
      ans = max(ans, ret);
    }
  }
  cout << ans << "\n";
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    long N, A, B, Sa, Nrem;

    scanf("%ld%ld%ld",&N ,&A ,&B);

    Sa = A*(N / (A + B));
    Nrem = N % (A + B);
    if(Nrem > A){
        Sa = Sa + A;
    }else{
        Sa = Sa + Nrem;
    }

    printf("%ld\n",Sa);
    return 0;
}

Measured memory_bytes: 128
#include<vector>
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<string.h>
#include<list>
#include<limits>
#include<bitset>
#include<ctype.h>
#include<set>
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
const ll MOD=10007;
const ll INF=1000000000;
const int MAX=100001;
typedef pair<int,int> P;
int d[100010];
vector<edge> G[100010];
void dijkstra(int s){
    priority_queue<P,vector<P>,greater<P>> que;
    fill(d,d+100010,INF);
    d[s]=0;
    que.push(P(0,s));
    while(!que.empty()){
        P p=que.top();
        que.pop();
        int v=p.second;
        if(d[v]<p.first){
            continue;
        }
        for(int i=0;i<G[v].size();i++){
            edge e=G[v][i];
            if(d[e.to]>d[v]+e.cost){
                d[e.to]=d[v]+e.cost;
                que.push(P(d[e.to],e.to));
            }
        }
    }
}
int main(){
    ios::sync_with_stdio(false);
    int k;
    cin>>k;
    for(int i=0;i<k;i++){
        G[i].push_back({(i+1)%k,1});
        G[i].push_back({(i*10)%k,0});
    }
    dijkstra(1);
    cout<<d[0]+1<<endl;
}

                           


Measured memory_bytes: 6780
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <tuple>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <cstdio>
#define REP(i, n) for(LL i = 0;i < n;i++)
#define REPR(i, n) for(LL i = n;i >= 0;i--)
#define FOR(i, m, n) for(LL i = m;i < n;i++)
#define FORR(i, m, n) for(LL i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;
typedef pair<int, P> PP;
typedef pair<LL, LP> LPP;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

/*************** using variables ***************/
int n, m;
int a, b;
bool graph[10][10];
bool closed[10];
int ans = 0;
/**********************************************/

bool isAllClosed(){
    REP(i, n){
        if(!closed[i]) return false; 
    }
    return true;
}

void dfs(int now){
    if(isAllClosed()){ 
        ans++;
        return;
    }
    
    /*REP(i, m){
        if(closed[i]) cout << "true ";
        else cout << "false ";
    }
    cout << endl;
    */
    REP(i, n){
        if(!closed[i] && (graph[now][i] || graph[i][now])){
            closed[i] = true;
            dfs(i);
            closed[i] = false;
        }
    }
    return;
}

int main(){
    cin >> n >> m;
    closed[0] = true;
    REP(i, m){
        cin >> a >> b;
        graph[a-1][b-1] = true;
        graph[b-1][a-1] = true;
    }
    
    dfs(0);
    cout << ans << endl;
}


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

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

  bool fp, fw, fg, fy;
  fp = fw = fg = fy = false;

  for (int i = 0; i < N; i++) {
    string c;
    cin >> c;
    
    if (c == "P") {
      fp = true;
    } else if (c == "W") {
      fw = true;
    } else if (c == "G") {
      fg = true;
    } else {
      fy = true;
    }
  }
  
  if (fp && fw && fg && fy) {
    cout << "Four" << endl;
  } else {
    cout << "Three" << endl;
  }
}


Measured memory_bytes: 3604
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        if (String.valueOf(s.charAt(s.length() - 1)).equals("s")) {
            System.out.println(s + "es");
        } else {
            System.out.println(s + "s");
        }
    }
}

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

public static class Program
{
    public static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        for (var a = 1; a <= 9; a++)
        {
            for (var b = 1; b <= 9; b++)
            {
                if (a * b == n)
                {
                    Console.WriteLine("Yes");
                    return;
                }
            }
        }
        Console.WriteLine("No");
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define ll long long
#define PB push_back
#define MP make_pair

#define REP(i, n) for(int i=0;i<(int)(n);++i)
#define FOR(i,l,h) for(int i=(int)(l);i<=(int)(h);++i)
#define FORD(i,h,l) for(int i=(int)(h);i>=(int)(l);--i)

#define max(a,b) a>b?a:b
#define min(a,b) a>b?b:a

ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }

#define dump(x)  cerr << #x << " = " << (x) << endl
#define ALL(t) (t).begin(),(t).end()

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a,b;cin>>a>>b;
    bool arr[4];
    memset(arr , false, sizeof(arr));
    arr[a] = true;
    arr[b] = true;
    for (int i = 1; i <=3; i++) {
        if(arr[i]==false){
            cout<<i;
            return 0;
        }
    }
  return 0;
}

Measured memory_bytes: 256
while True:
    n, x = map(int, input().split())
    
    if n == x == 0:
        break
        
    count = 0
    
    for a in range(1, n + 1):
        for b in range(a + 1, n + 1):
            c = x - a - b
            if b < c <= n:
                count += 1
                
    print(count)


Measured memory_bytes: 5596