akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<stdlib.h>
#include<cassert>
using namespace std;
const long long mod=1000000009;
const long long inf=mod*mod;
const long long d2=500000004;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
int dp[3100][3100];
int main(){
	int a,b,c,d,e,f;
	scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
	dp[0][0]=1;
	for(int i=0;i<=f;i++){
		for(int j=0;j<=i;j++){
			if(!dp[i][j])continue;
			if(i+a*100<=f)dp[i+a*100][j]=1;
			if(i+b*100<=f)dp[i+b*100][j]=1;
			if(i+c<=f)dp[i+c][j+c]=1;
			if(i+d<=f)dp[i+d][j+d]=1;
		}
	}
	int bb=100*a;
	int bs=0;
	for(int i=1;i<=f;i++){
		for(int j=0;j<=i;j++){
			if(dp[i][j]&&e*i>=(e+100)*j){
				if(j*bb>=i*bs){
					bb=i;bs=j;
				}
			}
		}
	}
	printf("%d %d\n",bb,bs);
}

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

int main(void)
{
        double xa = 0, ya = 0, ra = 0;
        double xb = 0, yb = 0, rb = 0;
        double ab = 0;
        int i = 0,n = 0;
        double r = 0;
        int flag = 5;

        scanf("%d",&n);
        for(i = 0; i < n; i++)
        {
                scanf("%lf %lf %lf %lf %lf %lf", &xa, &ya, &ra, &xb, &yb, &rb);

                ab=sqrt((xa-xb)*(xa-xb)+(ya-yb)*(ya-yb));

                if(ab > ra+rb)
                {
                        flag = 0;
                }
                else if(ab + rb < ra)
                {
                        flag = 2;
                }
                else if(ab + ra < rb)
                {
                        flag = -2;
                }
                else
                {
                        flag = 1;
                }
                printf("%d\n",flag);
        }
        return 0;
}

Measured memory_bytes: 640
def main():
    n = int(input())
    a = list(map(int,input().split()))
    ki = [0 for i in range(n+1)]
    ki[0] = 1   
    for i in range(1,n+1):
        ki[i] = 2*(ki[i-1] - a[i-1])
        if ki[i]<=0:
            print(-1)
            return
    if ki[-1]<a[-1]:
        print(-1)
        return
    ki[-1] = a[-1]
    for i in range(n):
        ki[n-1-i] = min(ki[n-1-i],ki[n-i]+a[n-1-i])
    print(sum(ki))

if __name__ == "__main__":
    main()


Measured memory_bytes: 674520
#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<math.h>

#define REPS(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define print(x) cout << #x << " = " << x << endl;

using namespace std;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;

const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;


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

	if (N == 1 && M == 1) {
		cout << 1 << endl;
	}
	else if (N == 1) {
		cout << M - 2 << endl;
	}
	else if (M == 1) {
		cout << N - 2 << endl;
	}
	else {
		cout << (N - 2) * (M - 2) << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

int main(){
    int X, Y, A, B, C;
    cin >> X >> Y >> A >> B >> C;
    vector<int> p_vec(A);
    vector<int> q_vec(B);
    vector<int> r_vec(C);
    for (int i = 0; i < A; ++i){
        cin >> p_vec[i];
    }
    sort(p_vec.begin(), p_vec.end(), greater<int>());
    for (int i = 0; i < B; ++i){
        cin >> q_vec[i];
    }
    sort(q_vec.begin(), q_vec.end(), greater<int>());
    for (int i = 0; i < C; ++i){
        cin >> r_vec[i];
    }
    sort(r_vec.begin(), r_vec.end(), greater<int>());

    vector<int> p_part(X);
    copy(p_vec.begin(), p_vec.begin() + X, p_part.begin());
    vector<int> q_part(Y);
    copy(q_vec.begin(), q_vec.begin() + Y, q_part.begin());

    // 解説後（p_part,q_part,rを全部あわせて大きさで並べ替えてよかったんだね）
    vector<int> pqr_vec(X + Y + C);
    copy(p_part.begin(), p_part.end(), pqr_vec.begin());
    copy(q_part.begin(), q_part.end(), pqr_vec.begin() + X);
    copy(r_vec.begin(), r_vec.end(), pqr_vec.begin() + X + Y);
    sort(pqr_vec.begin(), pqr_vec.end(), greater<int>());
    cout << accumulate(pqr_vec.begin(), pqr_vec.begin() + X + Y, 0LL) << endl;

    return 0;
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;i++)
#define ALL(x) (x).begin(),(x).end()
using namespace std;

//素因数分解
vector<pair<ll,int>> factorize(ll n){
    vector<pair<ll,int>>res;
    for(ll i=2;i*i<=n;i++){
        if(n%i)continue;
        res.emplace_back(i,0);
        while (n%i == 0)
        {
        n /= i;
        res.back().second++;
        }
        
    }
    if(n != 1) res.emplace_back(n,1);
    return res;
}

void trace(int A[],int N){
    REP(i,N){
        if(i>0)printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
}


int main(){
    int X,A,B;
    cin >> X >> A >> B;
    if(B<=A)cout << "delicious" << endl;
    else if(B<=X+A) cout << "safe" << endl;
    else cout << "dangerous" << endl;
}


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

int n;
vector<vector<pint> > v;

bool judge(int bit){
    for(int i = 0; i < n; i++){
        if(!(bit & (1<<i)))continue;
        for(pint xy : v[i]){
            int x = xy.first;
            int y = xy.second;
            if(y==1 && !(bit&(1<<x)))return false;
            if(y==0 &&  (bit&(1<<x)))return false;
        }
    }
    return true;
}

int main(){
    cin >> n;
    v.resize(n);
    for(int i = 0; i < n; i++){
        int a; cin >> a;
        v[i].resize(a);
        for(int j = 0; j < a; j++){
            cin >> v[i][j].first >> v[i][j].second;
            --v[i][j].first;
        }
    }
    int res = 0;
    for(int bit=0;bit<(1<<n);++bit){
        if(judge(bit)){
            int count = 0;
            for(int i = 0; i < n; i++){
                if(bit & (1<<i))count++;
            }
            res = max(res, count);
        }
    }
    cout << res << endl;
}

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

int main() {
    vector<int> x(5);
    for (int i = 0; i < 5; i++) {
        cin >> x.at(i);
    }
    int k; cin >> k;
    string J = "Yay!";
    for (int i = 0; i < 5; i++) {
        for (int j = 0; j < 5; j++) {
           if (abs(x.at(i) - x.at(j)) > k) {
                J = ":(";
                break;
            } 
        }
    }
    cout << J << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        if (a.length() == b.length()) {
            if (a.compareTo(b) < 0) {
                System.out.println("LESS");
            } else if (a.compareTo(b) == 0) {
                System.out.println("EQUAL");
            } else {
                System.out.println("GREATER");
            }
        } else {
            System.out.println(a.length() < b.length() ? "LESS" : "GREATER");
        }
    }

}


Measured memory_bytes: 23252
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
}



func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var primes = []int{2}
var primeCursor = 3
// IsPrime judge the number is prime or not
func IsPrime(x int) bool {
	if primeCursor > x {
		for _, p := range primes {
			if p == x {
				return true
			}
		}
		return false
	}

	i := primeCursor
	prime := false
	for ; i <= x ; i++ {
		primeCursor = x + 1
		prime = isPrime(i)
		if prime {
			primes = append(primes, i)
		}
	}
	return prime
}

func isPrime(x int) bool {
	for _, p := range primes {
		if x % p == 0 {
			return false
		}
	}
	return true
}

func main() {
	x := nextInt()

	for i := 2; i < x; i++ {
		IsPrime(i)
	}

	c := x
	for !IsPrime(c) {
		c++
	}
	fmt.Printf("%d", c)
}


Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }

    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String A = scan.next();
        long len = A.length();
        char[] d = A.toCharArray();
        long[] count = new long[26];
        for (int i = 0; i < len; i++) {
            count[(int) (d[i]-'a')] += 1;
        }
        long ans = len * (len - 1) / 2 + 1;
        for (int i = 0; i < 26; i++) {
            if (1 < count[i]) {
                ans -= count[i] * (count[i]-1) / 2;
            }
        }
        System.out.println(ans);
    }
}


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

int main()
{
  int A, B, C, D, train, bus;
  cin >> A >> B >> C >> D;
  if(A > B) train = B;
  else train = A;
  
  if(C > D) bus = D;
  else bus = C;
  
  cout << train + bus << endl;
  return 0;
}

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

int main(void){
    int n;
    cin>>n;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    rep(i,n-1) a[i+1] += a[i];

    ll res = a[n-1];
    int left = 0, right = 0;
    rep(m,n){
        while(left < m){
            if(a[left]>=a[m]-a[left]) break;
            left++;
        }
        right = max(right,m+1);
        while(right < n-1){
            if(a[right]-a[m]>=a[n-1]-a[right]) break;
            right++;
        }

        int K = 2;
        for(int l = max(left-K,0); l < min(m,left+K); l++){
            for(int r = max(right-K,m+1); r < min(right+K,n-1); r++){
                vector<ll> seg = {a[l],a[m]-a[l],a[r]-a[m],a[n-1]-a[r]};
                sort(all(seg));
                res = min(res, seg[3]-seg[0]);
            }
        }
    }
    cout<<res<<endl;
    return 0;
}


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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)
#define PI 3.14159265358979

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

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



i64 n, a[303030];
void solve(){
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	
	i64 ans = 0;
	for(int i = 0; i <= 60; i++){
		i64 cnt = 0;
		for(int j = 0; j < n; j++){
			if(a[j] >> i & 1) cnt++;
		}
		ans += cnt*(n-cnt)%INF * ((1LL << i)%INF) %INF;
		ans %= INF;
	}
	cout << ans << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}


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

int main(){	
	long long K;
	long long N;
	scanf("%lld",&N);
	scanf("%lld",&K);
	ll res = 0;
	for (ll b=1; b<=N; b++) {
		if (b > K) res += N/b*(b-K)+max(0LL, N%b-max(0LL, K-1));
	}
	cout << res << endl;
	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int L, R, d;
  int k =0;
  int t =0;
  scanf("%d%d%d", &L, &R, &d);
  for(int i =0; k<=100; i++){
   k = d*i;
   if(L<=k && R>=k){
    ++t;
   }
  }
  printf("%d", t);
  return 0;
}


Measured memory_bytes: 1728
x,n = map(int, input().split())
if n == 0:
  print(x)
else:
  p = list(map(int, input().split()))

  l100 = list(range(102))
  for i in p:
    if i in l100:
      l100.remove(i)
  sa = []
  for i in l100:
    sa.append(abs(x-i))

  idx = sa.index(min(sa))
  print(l100[idx])

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

bool mm(char a, char b)
{
    if (a == '0' && in(b, '1', '9'+1)) {
        return true;
    } else if (a == '1' && (b == '0' || b == '1' || b == '2')) {
        return true;
    }
    return false;
}

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

    string st;
    cin >> st;

    if (mm(st[0], st[1])) {
        if (mm(st[2], st[3])) {
            std::cout << "AMBIGUOUS" << std::endl;
        } else {
            std::cout << "MMYY" << std::endl;
        }
    } else {
        if (mm(st[2], st[3])) {
            std::cout << "YYMM" << std::endl;
        } else {
            std::cout << "NA" << std::endl;
        }
    }
    

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define ff first
#define pb push_back
#define ss second
#define debug 0
#define ff first
#define mp make_pair
 
using namespace std;
 
const ll MOD = 1000000007LL;
 
ll fact[1000006];
ll ifact[1000006];
ll power2[1000006];
 
ll ar[2000056];
ll visit[2000056];
ll least_prime[1000005];
ll level[300005];
vector<int> adj[5000005];

const long double pi=3.1415926535897;

set<string> st;
 
bool vis[500020];
 
bool prime[10000006];
 
vector<int> primes,pec,vec;

vector<pair<ll,ll> > vp;

map<ll,ll> has;


ll day[3000006];
 
 
 
ll powr (ll a, ll  b)
{
    if (b == 0)
        return 1;
    long long int x = powr(a, b/2);
    if (b % 2 == 0)
        return (x*x)%MOD;
    else
        return ((x*x)%MOD*a%MOD)%MOD;
}
 
inline ll inv(ll x) {
  return powr(x, MOD - 2);
}
 
inline ll mulMod(ll a, ll b) {
  return (a%MOD * b%MOD) % MOD;
 
}
 
inline void process() {
  fact[0] = 1;
  power2[0] = 1;
  for(int i = 1; i < 200003; i++) {
    fact[i] = mulMod(fact[i - 1], i);
    power2[i] = mulMod(power2[i - 1], 2);
  }
  ifact[200002] = inv(fact[200002]);
  for(int i = 200002 - 1; i >= 0; i--) {
    ifact[i] = mulMod(ifact[i + 1], i + 1);
  }
}
 
inline ll ncr(ll n, ll r) {
  if(n < r) return 0;
  return mulMod(fact[n], mulMod(ifact[r], ifact[(n - r)]));
}
 
 
 
void sieve()
{
    memset(prime,true,sizeof(prime));
    prime[0]=prime[1]=false;
    
    for(ll i=2;i*i<=1000006;i++)
    {
        if(prime[i])
        {
            for(ll j=i*2;j<=1000006;j+=i)
            {
                prime[j]=false;
            }
        }
    }
    
    for(int i=2;i<=100005;i++)
    {
    	if(prime[i])
    	primes.pb(i);
	}
}





void LeastPrimeFactor(){
	int tot=1000003;
	least_prime[1]=1;
	for (ll i = 2; i <tot; i += 2)	least_prime[i] = 2;
	for (ll i = 3; i < tot; i += 2){
		if (!visit[i]){
			least_prime[i] = i;
			for (ll j = i; (j*i) < tot; j += 2){
				if (!visit[j*i])
				{
					visit[j*i] = true;
					least_prime[j*i] = i;
				}
			}
		}
	}
}

ll solve(ll n, ll k)
{
    ll res = 1;
  
    
    if (k > n - k)
        k = n - k;
  
    for (int i = 0; i < k; ++i)
    {
        res *= (n - i);
        res%=MOD;
        ll p =inv(i+1);
        res=(res%MOD*p%MOD)%MOD;
    }
    
    return res;
  
}
  
ll catalan(ll n)
{
   
    ll c = solve(2*n, n);
    ll d= inv(n+1);
    ll ans = (c%MOD*d%MOD)%MOD;
    return ans;
}




 

int main() 
{
//	freopen("input4.in","r",stdin);
//	freopen("output4.out","w",stdout);
    ll n,m,t,p,q,s,c,d,e,f,g,h,res=0,u,v,i,j,l=0,k,len,tot=0,rad,w,pos=0,y,r=0,z,x,maxm=-1;
	ll cycle,val,max1=0,max2=0,num=0,zero,ans=0,min1=INT_MAX,min2=INT_MAX,sum=0;
    bool flag=0;
    ll a,b,minm=INT_MAX;
    ll x1,x2;
    
    string str;
    
   cin>>str;
   
   len=str.length();
   
   
   for(i=0;i<len-1;i++)
   {
   	 if(str[i]=='A' && str[i+1]=='C')
   	 {
   	 	flag=1;
   	 	break;
		}
   }
    
    if(flag)
    cout<<"Yes";
    else
    cout<<"No";
   
	
    
	return 0;
    
}    

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

int main() {
    string s;
    cin >> s;
    if(s.at(s.size()-1) == 's') cout << s << "es" << endl;
    else cout << s << "s" << endl;
}


Measured memory_bytes: 3624
N,T = list(map(int,input().split()))
TL = list(map(int,input().split()))
ans = 0
for i in range(1,N):
    if TL[i] - TL[i-1] < T:
        ans += TL[i] - TL[i-1]
    else:
        ans += T
ans += T
print(ans)

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

long long a[4];
long long n,i;
int main(){
	for(i=1;i<=3;i++)
	   cin>>a[i];
	sort(a+1,a+4);
	if(a[3]%2==1)
	   cout<<a[1]*a[2]<<endl;
	else
	   cout<<0<<endl;
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}

ll n,m;
vector<P> vp;

int main(){
	cin >> n >> m;
	rep(i,n){
		ll a;
		cin >> a;
		vp.push_back(P(a,1));
	}
	rep(i,m){
		ll b,c;
		cin >> b >> c;
		vp.push_back(P(c,b));
	}
	sort(ALL(vp));
	reverse(ALL(vp));
	ll cnt = 0;
	ll ans = 0;
	rep(i,n){
		for(ll j = 0;j < vp[i].second && cnt < n;j++){
			ans += vp[i].first;
			cnt++;
		}
		if(cnt == n)break;
	}
	cout << ans << endl;
}

Measured memory_bytes: 6256
#include<iostream>
using namespace std;
int main () {

int B;
cin >> B;
int h, m, s;
h = (B-(B%3600))/3600;
m = (B%3600-((B%3600)%60))/60;
s = B-h*3600-m*60;
cout << h << ':' << m << ':' << s << endl;
}


Measured memory_bytes: 3100
#include<iostream>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)

typedef long long ll;
const ll MAX=1000000001;
ll base[100];//power of 10
ll knum[100];//


int solve(int p,int x,ll b){
  int pos =p-1- x%p;
  ll num =b+x/p;
  rep(i,pos)num/=10;
  return num%10;
}

main(){
  ll b=1;
  int index=0;
  while(true){
    base[index]=b;
    knum[index]=(index+1)*(b*10-b);
    base[index]=b*10;
    b*=10;
    if ( knum[index++] > MAX)break;
  }
  base[0]=0;
  knum[0]++;
  ll n;
  int m;
  while(cin>>n>>m && n){
    rep(k,m){
      ll tmp = n+k;
      rep(i,index){
	if ( tmp-knum[i]<0){
	  cout << solve(i+1,tmp,base[i]/10);
	  break;
	}
	else tmp-=knum[i];
      }
    }
    cout << endl;
  }
  

}

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

 using namespace std;
 typedef long long ll;

 int main() {
   int N, RH;
   string s;
   cin >> N >> s;

   for (int i = 0; i < N; i++) {
     if (s.at(i) == 'R') RH++;
   }
   if (RH > N - RH) cout << "Yes" << endl;
   else cout << "No" << endl;
  }


Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import math

X = int(input())
A = 1
found = False

while True:
    a5 = math.pow(A, 5)
    b5max = math.pow(A - 1, 5)
    if a5 + b5max >= X and a5 - b5max <= X:
        found = True
        for B in range(A):
            b5 = math.pow(B, 5)
            if a5 - b5 == X:
                print(A, B)
                break
            if a5 + b5 == X:
                print(A, -B)
                break
        A += 1
    elif found:
        break
    else:
        A += 1



Measured memory_bytes: 9456
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
#include<cstring>

using namespace std;

#ifdef LDEBUG
#define debug(x) cout << #x << ":" << x << endl
#else
#define debug(...)
#endif

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

typedef unsigned long long u64;
typedef long long i64;

u64 n;
u64 a,b,c,d,e;

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

        cin >> n;
        cin >> a >> b >> c >> d >> e;

        u64 m = min(a, min(b, min(c, min(d,e))));


        u64 c = 0;
        if (n % m == 0) {
                c = n/m;
        }else {
                c = (u64)(n/m) + 1;
        }

        cout << c+4 << endl;


        return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ldb;
typedef complex<double> base;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const bool debug=false;
const ll mod=200003;

// this is actually C

void fft(vector<base> &a, bool inv)
{
	int n=a.size(), j=0;
	vector<base> roots(n/2);
	for(int i=1; i<n; i++)
	{
		int bit=(n>>1);
		while(j>=bit)
		{
			j-=bit;
			bit>>=1;
		}
		j+=bit;
		if(i<j) swap(a[i],a[j]);
	}
	double ang=2*acos(-1)/n*(inv?-1:1);
	for(int i=0; i<n/2; i++) roots[i]=base(cos(ang*i), sin(ang*i));
	for(int i=2; i<=n; i<<=1)
	{
		int step=n/i;
		for(int j=0; j<n; j+=i)
		{
			for(int k=0; k<i/2; k++)
			{
				base u=a[j+k], v=a[j+k+i/2]*roots[step*k];
				a[j+k]=u+v;
				a[j+k+i/2]=u-v;
			}
		}
	}
	if(inv) for(int i=0; i<n; i++) a[i] /= n;
}

vector<ll> multiply(vector<ll> &v, vector<ll> &w)
{
	vector<base> fv(v.begin(), v.end()), fw(w.begin(), w.end());
	int n=2; while(n<v.size()+w.size()) n<<=1;
	fv.resize(n); fw.resize(n);
	fft(fv,false); fft(fw,false);
	for(int i=0; i<n; i++) fv[i]*=fw[i];
	fft(fv, true); vector<ll> ret(n);
	for(int i=0; i<n; i++) ret[i]=(ll)round(fv[i].real());
	return ret;
}

ll ans, n, g=2;
vector<ll> X, Y;
ll a[222222];
ll cnt[222222];
ll inv[222222];

int main(void)
{
	fio; ll i, x, j, cur=1;
	for(i=0 ; i<=mod-2 ; i++)
	{
		inv[cur]=i;
		cur=(cur*g)%mod;
		if(i!=mod-2) assert(cur!=1);
	}
	cin>>n;
	for(i=1 ; i<=n ; i++)
	{
		cin>>x; a[i]=x;
		if(x==0) continue;
		cnt[inv[x]]++;
	}
	for(i=0 ; i<=mod-2 ; i++) 
	{
		X.push_back(cnt[i]);
		Y.push_back(cnt[i]);
	}
	vector<ll> Z=multiply(X, Y); cur=1;
	for(i=0 ; i<Z.size() ; i++)
	{
		ans+=Z[i]*cur;
		cur=(cur*g)%mod;
	}
	for(i=1 ; i<=n ; i++) ans-=(a[i]*a[i])%mod;
		cout<<ans/2; return 0;
}




Measured memory_bytes: 32020
N, P = list(map(int, input().split()))
A = list(map(int, input().split()))
NO = 0
NE = 0
for a in A:
    if a % 2 == 0:
        NE += 1
    else:
        NO += 1


def comb(n, k):
    w = min(n - k, k)
    if n <= 1 or w == 0:
        return 1
    a = n
    for i in range(n - 1, n - w, -1):
        a *= i
    b = 1
    for i in range(2, w + 1):
        b *= i
    return a // b


e = 2 ** NE
o = 0
for i in range(P, NO + 1, 2):
    o += comb(NO, i)
if P == 0:
    res = e * o if o > 0 else e
else:
    res = o * e if e > 0 else o
print(res)


Measured memory_bytes: 9232
#include <iostream>
using namespace std;
int main(){
    int n,k;
    cin >> n >> k;
    int ans = 0;
    for(int i=0; i<n; i++){
        int t;
        cin >> t;
        if(t >= k) ans++;
    }
    cout << ans << endl;
    return 0;
}


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

int n;
vector<long int> friendly;

int main() {
    cin >> n;
    friendly.resize(n);
    for (int i = 0; i < n; i++) {
        cin >> friendly.at(i);
    }

    sort(friendly.begin(), friendly.end(), [](auto const &lhs, auto const &rhs) {
        return lhs > rhs;
    });

    long long int res = 0;
    int max_i = 0;
    int next = 1;
    for (int i = 0; i < n - 1; i++) {
        res += friendly.at(max_i);
        next++;
        if (next == 2) {
            max_i++;
            next = 0;
        }
    }

    cout << res << endl;
}

Measured memory_bytes: 4784
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        String s;
        try(Scanner cin = new Scanner(System.in)) {
            s = cin.next();
        }
        long count = s.chars().filter((c) -> c == '+').count();
        System.out.println(count - (4 - count));
    }

}

Measured memory_bytes: 26960
N = int(input())
S = ""
alphabets=["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"]

while N > 0:
  if N%26 != 0:
    S = alphabets[(N%26)-1] + S
    N = (N-N%26)//26
  else:
    S = alphabets[(N%26)-1] + S
    N = (N-26)//26

print(S)

Measured memory_bytes: 9084
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<map>
#include<queue>
#include<string>
#include<numeric>
#include<sstream>
#include<cmath>
using namespace std;
long long int mod = 1e9;

int main(){
  int n; cin >> n;
  long long int sum = 0;
  long long int mn = 1e9;
  int c = 0;
  for(int i=0; i<n; i++) {
    long long int a;
    cin >> a;
    if(a < 0) c++;
    a = abs(a);
    mn = min(mn, a);
    sum += a;
  }
  
  if(c%2 == 0) cout << sum << endl;
  else cout << sum - mn*2 << endl;


  return 0;
}




// EOF


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define reptr(i,n) for(int (i)=(n);(i)>=0;--(i))
#define All(x) (x).begin(),(x).end()
const ll MOD=1e9+7;
using namespace std;

int main(){
  string s;
  cin >> s;
  ll sum=0;
  for(ll i=0;i<(1<<(s.size()-1));i++){
    ll ans=0;
    int l=0,num=1;
    for(ll tmp=0;tmp<s.size()-1;tmp++){
      if((1<<tmp)&i){
        ans+=stoll(s.substr(l,num));
        l+=num;
        num=1;
      }else{
        num++;
      }
    }
    ans+=stoll(s.substr(l,num));
    sum+=ans;
  }
  cout << sum << endl;
}

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

int main() {
  int n;
  cin >> n;
  int a[30],b[30],c[30];
  rep(i,n){
  cin >> a[i]; a[i]--;
  }
  rep(i,n)
  cin >> b[i];
  rep(i,n-1)
  cin >> c[i];
  int ans=b[a[0]];
  for(int i=1;i<n;i++){
     ans+=b[a[i]];
     if(a[i]==a[i-1]+1)
     ans+=c[a[i-1]];
  }
  cout << ans << endl;
}

Measured memory_bytes: 384
N, H = map(int, input().split())
a = [0 for i in range(N)]
b = [0 for i in range(N)]
s = []
for i in range(N):
    a[i], b[i] = map(int, input().split())
    s.append(a[i])
    s.append(b[i])

a.sort(reverse=True)
b.sort(reverse=True)
s.sort(reverse=True)
low=0
high=2*N
t=(low+high) // 2
while(low<=high):
    if s[t] == a[0]:
        break
    elif s[t] < a[0]:
        high=t
    else:
        low=t
    t=(low+high) // 2

m = 0
P = 0
flag = False
for i in range(t+1):
    m+=1
    P+=s[i]
    if P >= H:
        flag = True
        break

if flag == False:
    k = (H-P)//a[0]
    m += k
    P += k * a[0]
    if H > P:
        m+=1

print(m)


Measured memory_bytes: 13576
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>

using namespace std;

int pairs[100000];
int non_pairs[100000];
map<int,int> nums;

int main(){
    int N,M;
    cin>>N>>M;
    for(int i=0;i<N;i++){
        int X;
        cin>>X;
        nums[X]++;
    }
    for(auto n:nums){
        int N=n.first%M;
        int C=n.second;
        if(C>1){
            if(C%2){
                non_pairs[N]++;
                C--;
            }
            pairs[N]+=C;
        }else{
            non_pairs[N]++;
        }
    }
    // for(int i=0;i<M;i++){
    //     cout<<i<<' '<<non_pairs[i]<<' '<<pairs[i]<<endl;
    // }
    int ans=(non_pairs[0]+pairs[0])/2;
    for(int i=1;i<M;i++){
        if(M%2==0&&i*2==M){
            ans+=(non_pairs[i]+pairs[i])/2;
            non_pairs[i]=pairs[i]=0;
            continue;
        }
        if(non_pairs[i]>0){
            int P=min(non_pairs[i],non_pairs[M-i]);
            ans+=P;
            non_pairs[i]-=P;
            non_pairs[M-i]-=P;
            // if(P)cout<<'P'<<P<<' '<<i<<' '<<M-i<<endl;
            if(non_pairs[i]>0&&pairs[M-i]>0){
                int Q=min(non_pairs[i],pairs[M-i]);
                if(Q%2==0){
                    ans+=Q;
                    non_pairs[i]-=Q;
                    pairs[M-i]-=Q;
                }else{
                    ans+=Q;
                    non_pairs[i]-=Q;
                    pairs[M-i]-=Q+1;
                    non_pairs[M-i]+=1;
                }
                // if(Q)cout<<'Q'<<Q<<' '<<i<<' '<<M-i<<endl;
            }
        }
    }
    // cout<<ans<<endl;
    for(int i=1;i<M;i++){
        ans+=pairs[i]/2;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 5376
#include <iostream>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <stack>
#include <fstream>
#include <string>
#include <sstream>
#include <algorithm>
#include <climits>
#include <cmath>

using namespace std;
void all_possible_subsets_of_rows_and_columns(int h, int w, int k, vector<vector<char>> &v) {
	int count = pow(2, h + w);
	int all_count = 0;
	for (int i = 0; i < count; i++)
	{
		int cnt = 0;
		for(int j = 0; j < h; ++j) {
			for(int l = 0; l < w; ++l) {
				if(i & (1 << j) || i & (1 << h + l)) {
					continue;
				} else if(v[j][l] == '#') {
					cnt++;
				}
			}
		}
		if(cnt == k) all_count++;
	}
	cout << all_count << "\n";
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
    int h, w, k;
    cin >> h >> w >> k;
    vector<vector<char>> v(h, vector<char>(w));
    for(int i = 0; i < h; ++i) {
    	for(int j = 0; j < w; ++j) {
    		char c;
    		cin >> c;
    		v[i][j] = c;
    	}
    }
    all_possible_subsets_of_rows_and_columns(h, w, k, v);
	return 0;
}


Measured memory_bytes: 3172
N = int(input())

cont = 0

if 1 <= N < 10:
    print(N)
elif 10 <= N < 100:
    print(9)
elif 100 <= N < 1000:
    print(N - 90)
elif 1000 <= N < 10000:
    print(909)
elif 10000 <= N < 100000:
    print(N - 9090)
else:
    print(90909)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#include <x86intrin.h>
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4,sse4.1,sse4.2,tune=native")

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

int main() {
	cin.tie(0); ios_base::sync_with_stdio(false);
	int x;
	cin >>x;
	

	VI dp(x+10);
	dp[0]=1;
	
	VI z={100,101,102,103,104,105};
	
	rep(i, 6) rep(j, x) if(dp[j]>0){
		if(j+z[i] <= x) dp[j+z[i]] = 1;
	}
	cout << dp[x] <<"\n";
	return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<int,int>pa;

const int N=2e5+100;
const int mod=1e9+7;
int vis[N];
vector <int>ve[N];
queue<int>q;
void bfs()
{
    while(q.size()){
        int k=q.front();q.pop();
        for(auto v:ve[k]){
            if(!vis[v]){
                vis[v]=vis[k];
                q.push(v);
            }
        }
    }
}
int main()
{
   ios::sync_with_stdio(0);cin.tie(0);
   int n;cin>>n;
   for(int i=1;i<n;i++){
    int a,b;
    cin>>a>>b;
    ve[a].push_back(b);
    ve[b].push_back(a);
   }
   q.push(1);q.push(n);
   vis[1]=1;vis[n]=2;
   bfs();
   int k=0;
   for(int i=1;i<=n;i++){
      if(vis[i]==1) k++;
   }
   if(k>n-k) puts("Fennec");
   else puts("Snuke");
   return 0;
}



Measured memory_bytes: 11968
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		long X = long.Parse(Console.ReadLine());
		bool flag = false;
		for(long i=-1000;i<=1000;i++){
			for(long j=-1000;j<=1000;j++){
				long a = (i*i*i*i*i)-(j*j*j*j*j);
				if(a==X){
					Console.WriteLine(i+" "+j);
					flag = true;
					break;
				}
			}
			if(flag){
				break;
			}
		}
	}
}

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

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define ull unsigned long long
#define ld long double

template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;
template <class T>
using VVV = V<V<V<T>>>;

#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) rep2(i, 0, n)
#define rep1(i, n) rep1(i, 1, n + 1)

// #define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
// #define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()  //

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

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

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::fixed << std::setprecision(15);
    //    cout << std::setfill('0') << std::setw(2);

    long long N;
    std::cin >> N;
    std::vector<long long> a(N);
    for (int i = 0; i < N; i++) {
        std::cin >> a[i];
    }

    int sum = accumulate(all(a), 0);
    sum -= N;
    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 256
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#include<bits/stdc++.h>
#define pll              pair<long,long>
#define pii              pair<int,int>
#define scn(a)           scanf("%d", &a)
#define scn2(a, b)       scanf("%d%d", &a, &b)
#define scn3(a, b, c)    scanf("%d%d%d", &a, &b, &c)
#define pairl            pair<ll , ll >
#define scnl(a)          scanf("%lld", &a)
#define scnl2(a, b)      scanf("%lld%lld", &a, &b)
#define scnl3(a, b, c)   scanf("%lld%lld%lld", &a, &b, &c)
#define scns(s)          scanf("%s",s)
#define prts(s)          printf("%s\n",s)
#define prt(a)           printf("%d\n", a)
#define prtl(a)          printf("%lld\n", a)
#define prs(a)           printf("%d ", a)
#define prt2(a, b)       printf("%d %d\n", a, b)
#define prt3(a, b, c)    printf("%d %d %d\n", a, b, c)
#define prsl(a)          printf("%lld ", a)
#define prtl2(a, b)      printf("%lld %lld\n", a, b)
#define prtl3(a, b, c)   printf("%lld %lld %lld\n", a, b, c)
#define ptcs(a)          printf("Case %d: ", a)
#define pf               printf
#define sc               scanf
#define vi               vector<int >
#define vil              vector<ll >
#define pb               push_back
#define mem(a, b)        memset((a), (b), sizeof(a))
#define lg2(n)           (31-__builtin_clz(n))
#define N                300005
#define inf              9999999
#define ll               long long
#define ull              unsigned long long
#define MIN              INT_MIN
#define MAX              INT_MAX
#define fast             ios_base::sync_with_stdio(false),cin.tie(NULL)
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
typedef tree<pair<int, int> , null_type, less<pair<int, int> >, rb_tree_tag, tree_order_statistics_node_update> odrst;
ll gcd(ll a, ll b){if(b==0) {return a;}return gcd(b, a % b);}
ll BigMod(ll B,ll P,ll M){     ll R=1; while(P>0)      {if(P%2==1){R=(R*B)%M;}P/=2;B=(B*B)%M;} return R;}
//___________________________________________________________________________________________________________________

int main()
{
    string s,t;
    cin>>s>>t;
    cout<<t<<s<<endl;
    return 0;
}


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

int main(void){
    int A, B, H, M;
    cin >> A >> B >> H >> M;
    
    double H_angle = 360/12 * H + 360.0/12/60 * M;
    double M_angle = 360/60 * M;
    //cout << H_angle << " " << M_angle << endl;
    H_angle = H_angle / 360 * 2 * M_PI;
    M_angle = M_angle / 360 * 2 * M_PI;
    //cout << cos(H_angle - M_angle) << " " << cos(M_angle-H_angle) << endl;
    printf("%.10f\n", sqrt(A*A + B*B - 2*A*B*cos(H_angle-M_angle)));
}


Measured memory_bytes: 4212
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>

using namespace std;

long long int dp[105][12][2];

string S;

int K;

int C[150];

int main(void) {

	cin >> S;

	cin >> K;

	int M = S.size();

	for (int i = 0; i < M; i++) {
		C[M - i ] = S[i] - '0';
	 }

	/*for (int i = 1; i <= M; i++) {
		cout << C[i] << endl;
	}*/

	
		dp[M+1][0][0] = 1;
	

	for (int i = M + 1; i >= 1; i--) {
		for (int k = 0; k <= 8; k++) {
			for (int s = 0; s <= 1; s++) {
				int max_val;
				if (s == 1) { max_val = 9; }
				else { max_val = C[i]; }
				for (int m = 0; m <= max_val; m++) {
					int next_k = k;
					if (m != 0) { next_k++; }
					dp[i][next_k][s | (C[i] > m)] += dp[i + 1][k][s];
				}
			}
		}
	}

	/*for (int i = 3; i >= 1; i--) {
		for (int k = 0; k <= 3; k++) {
			for (int s = 0; s <= 1; s++) {
				cout << "dp[" << i << "][" << k << "][" << s << "]= " << dp[i][k][s] << endl;
			}
		}
	}*/

	cout << dp[1][K][0] + dp[1][K][1] << endl;


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
const double eps=1e-10;

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

int main(){
    ll a, b, x; cin>>a>>b>>x;
    if(x-b<=0) cout << x%MOD << endl;
    else cout << ((((x-b)/(a-b))%MOD)*(b%MOD)+(x%MOD))%MOD << endl;
}


Measured memory_bytes: 3112
import sys
import os
import math

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    K, S = il()
    P = [1 for x in range(K + 1) for y in range(K + 1) if 0 <= S - x - y <= K]
    print(sum(P))


if __name__ == '__main__':
    main()


Measured memory_bytes: 39832
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            // 解答はココに書く
            // 入力受け取り
            List<int> intList = cin.ReadIntArray(3).ToList();
            intList.Sort();
            WriteLine(intList[0] + intList[1]);
        }

    }

        public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

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

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define rep(i,n) for (int i = 0; i < (int)n; ++i)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define ALL(x) x.begin(),x.end()

int main() {
	int p, q, r;
	cin >> p >> q >> r;
	cout << max({p,q,r}) - min({p,q,r}) << endl;
	return 0; 
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#include<chrono>
using namespace std;
using ll = long long;

int main() {
  int N;
  cin >> N;
  ll A = 1000000007;
  ll sum = 1;
  for (int i = 1; i <= N; i++) {
    sum *= i;
    if (sum > A) {
      sum = sum % A;
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <limits>
#include <map>

using namespace std;

int main(){
    long N,K,Q;
    cin >> N >>K >>Q;
    map<long,long> ans;
    for(int i=0;i<Q;i++){
        int Ai;cin>>Ai;
        ans[Ai]++;
    }
    for(int i=1;i<=N;i++){
        if( K - Q + ans[i] >0 )cout << "Yes" << endl;
        else cout <<"No"<<endl;
    }


    return 0;
}

Measured memory_bytes: 6912
const int isDebugMode = 1;
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
struct edge{long long to,cost;};
const int inf = 1 << 27;
const long long INF = 1LL << 60;
const int COMBMAX = 1001001;
const long long MOD = 1000000007;
const long long dy[] = {-1, 0, 0, 1};
const long long dx[] = {0, -1, 1, 0};
string abc = "abcdefghijklmnopqrstuvwxyz";
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define eachdo(v, e) for (const auto &e : (v))
#define all(v) (v).begin(), (v).end()
#define lower_index(v, e) (long long)distance((v).begin(), lower_bound((v).begin(), (v).end(), e))
#define upper_index(v, e) (long long)distance((v).begin(), upper_bound((v).begin(), (v).end(), e))
long long mpow(long long a, long long n, long long mod = MOD){long long res = 1; while(n > 0){if(n & 1)res = res * a % mod; a = a * a % mod; n >>= 1;} return res;}
void pt(){cout << endl; return;}
template<class Head> void pt(Head&& head){cout << head; pt(); return;}
template<class Head, class... Tail> void pt(Head&& head, Tail&&... tail){cout << head << " "; pt(forward<Tail>(tail)...);}
void dpt(){if(!isDebugMode) return; cout << endl; return;}
template<class Head> void dpt(Head&& head){if(!isDebugMode) return; cout << head; pt(); return;}
template<class Head, class... Tail> void dpt(Head&& head, Tail&&... tail){if(!isDebugMode) return; cout << head << " "; pt(forward<Tail>(tail)...);}
template<class T> void debug(T v){if(!isDebugMode) return; rep(i, v.size()) cout << v[i] << " " ; cout << endl;}
template<class T> void debug2(T v){if(!isDebugMode) return; rep(i, v.size()){rep(j, v[i].size()) cout << v[i][j] << " " ; cout << endl;}}
template<class T1, class T2> inline bool chmin(T1 &a, T2 b){if(a > b){a = b; return true;} return false;}
template<class T1, class T2> inline bool chmax(T1 &a, T2 b){if(a < b){a = b; return true;} return false;}
template<class T1, class T2> long long recgcd(T1 a, T2 b){return a % b ? recgcd(b , a % b) : b;}
bool valid(long long H, long long W, long long h, long long w) { return 0 <= h && h < H && 0 <= w && w < W; }

int main(){
    ll L, R, D; cin >> L >> R >> D;
    ll ans = 0;
    for(ll i = L; i <= R; i++){
        if(i % D == 0) ans++;
    }
    pt(ans);
}

Measured memory_bytes: 3624
import numpy as np

n, m, c = map(int, input().split())
B = np.array(list(map(int, input().split())))
count = 0

for i in range(n):
    A = np.array(list(map(int, input().split())))
    T = A * B
    if sum(T) + c > 0:
        count += 1

print(count)


Measured memory_bytes: 13228
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n,m = inpl()
s = list(input())[::-1]
res = []
now = 0
while now != n:
    nex = min(now + m, n)
    while s[nex] == '1':
        nex -= 1
        if nex == now:
            print(-1)
            quit()
    res += [nex - now]
    now = nex
print(*res[::-1])

Measured memory_bytes: 81524
#include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
using namespace std;

bool intersects(double a, double b, double c, double d) {
    bool result = true;
    if ( (a < c && b < c) || (a > d && b > d) ) result = false;

    return result;
}

int main() {

    double a, b, c, d, e, f, g, h;
    while(cin >> a >> b >> c >> d >> e >> f >> g >> h) {
        if ( intersects(a, c, e, g) && intersects(b, d, f, h) ) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
     
    return 0;
}

Measured memory_bytes: 0
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)

int main(){
    int v[3][3];
    rep(i,3)rep(j,3)cin>>v[i][j];
    
    rep(i,3){
        for(int j=2;j>=0;j--){
            v[i][j] -= v[i][0];
        }
    }
    
    rep(j,3){
        for(int i=2;i>=0;i--){
            v[i][j] -= v[0][j];
        }
    }
    
    rep(i,2){
        rep(j,3){
            if(v[i][j]!=v[i+1][j]){
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    
    rep(j,2){
        rep(i,3){
            if(v[i][j]!=v[i][j+1]){
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout<<"Yes"<<endl;
}


Measured memory_bytes: 256