akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000, boost::int128_type>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }
template<class T> inline bool isSosuu(const T& n) { if (n == T(1)) { return false; } for (T i = 2; i*i <= n; ++i) { if (n % i == 0) { return false; } } return true; }
template<class T> vector<vector<T>> split (const vector<T>& S, T delim) { vector<vector<T>> ret{}; vector<T> buff{}; for (auto c : S) { if (c == delim) { if (!buff.empty()) ret.push_back(buff); buff.clear(); } else { buff.push_back(c); } } if (!buff.empty()) ret.push_back(buff); return ret; }
template<class T> inline void printYesNo(const T& t) { cout << (t ? "Yes" : "No") << CRLF; }
template<class T = int64_t> T modpow(T N, T P, T M) { T ret{1}; N %= M; while (P) { if (P & 0x01) { ret *= N; ret %= M; } P >>= 1; N *= N; N %= M; } return ret; }

/** code for assert debug begin */
int gErr = 0;
#define ASSERT(p) if(!(p)){ gErr = 1; }else{ ; }
/** code for assert debug end */

struct Tmp
{
public:
  int N;
  Tmp(int N)
  : N(N)
  {}
};

void solve(void)
{
  int N; cin >> N;
  ll X; cin >> X;
  vector<ll> A(N);
  for (auto& a : A) { cin >> a; }
  
  boost::sort(A, std::less<ll>());
  vector<ll> B(N);
  boost::partial_sum(A, B.begin());
  auto itr = boost::upper_bound(B, X);
  auto num = std::distance(B.begin(), itr);
  if (itr == B.end() && B[N-1] != X) {
    --num;
  }
  auto ans = num;
  cout << ans << CRLF;
  return;
}

int main(void)
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);

  solve();

  return 0;
}


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

int main(){
    int n,c;

    cin>>n>>c;

    while( n % 500 != 0 && c >0){

        n -=1;

        c--;
    }

    if(n % 500 ==0) cout<<"Yes"<<endl;

    else cout<<"No"<<endl;

    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    long long k;
    cin>>k;
    long long sum=0;
    for(long long i=1;i<=k;i++)
    {
        for(long long j=1;j<=k;j++)
        {
            for(long long h=1;h<=k;h++)
            {
                sum+=__gcd(i,(long long)__gcd(j,h));
            }
        }
    }
    cout<<sum;
    return 0;
}

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

int main()
{
    char alphabet;
    cin >> alphabet;

    if ((alphabet >= 'A') && (alphabet <= 'Z')) {
        cout << 'A' << endl;
    }
    else if ((alphabet >= 'a') && (alphabet <= 'z')) {
        cout << 'a' << endl;
    }
    else {}

    return 0;
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
void init_ios() {ios_base::sync_with_stdio(false); cin.tie(nullptr);}

long long N, C;

int main() {
    init_ios();
    
    cin >> N >> C;
    vector<pair<long long, long long>> xv(N);
    for (auto& p : xv) cin >> p.first >> p.second;

    auto res = 0LL;

    vector<long long> cw(N), ccw(N);

    // clockwise
    {
        auto pos = 0LL, col = 0LL, mx = -(1LL << 62);
        for (int i = 0; i < N; ++i) {
            col += -(xv[i].first - pos) + xv[i].second;
            pos = xv[i].first;
            mx = max(mx, col);
            cw[i] = mx;
        }
        res = max(res, mx);
    }

    // counterclockwise
    {
        auto pos = C, col = 0LL, mx = -(1LL << 62);
        for (int i = N - 1; 0 <= i; --i) {
            col += -(pos - xv[i].first) + xv[i].second;
            pos = xv[i].first;
            mx = max(mx, col);
            ccw[i] = mx;
        }
        res = max(res, mx);
    }

    // counterclockwise -> clockwise
    {
        auto pos = C, col = 0LL;
        for (int i = N - 1; 1 <= i; --i) {
            col += -(pos - xv[i].first) + xv[i].second;
            pos = xv[i].first;
            res = max(res, col - (C - pos) + cw[i - 1]);
        }
    }

    // clockwise -> counterclockwise
    {
        auto pos = 0LL, col = 0LL;
        for (int i = 0; i < N - 1; ++i) {
            col += -(xv[i].first - pos) + xv[i].second;
            pos = xv[i].first;
            res = max(res, col - pos + ccw[i + 1]);
        }
    }

    cout << res << endl;

    return 0;
}


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

using namespace std;

#define fi(n) for(int i=0;i<n;i++)
#define fj(n) for(int j=0;j<n;j++)
#define fr(n) for(int i=n-1;i>=0;i--)
#define fo(i,a,n) for(int i=a;i<n;i++)
#define vi vector<int>
#define vs vector<string>
#define int long long int
#define all(a) (a).begin(),(a).end()
#define sortall(x) sort(all(x))
#define itr(a) for(auto it=a.begin();it!=a.end();it++)
#define pb push_back
#define setbits(x) __builtin_popcountll(x)
#define zerbits(x) __builtinctzll(x)
#define mod 1000000007
#define sz(x) (int)x.size()
#define inf 1e18
#define W(x) int x;cin>>x;while(x--)
#define ps(x,y) fixed<<setprecision(y)<<x
#define mp make_pair
#define INT_SIZE 32
#define pr pair<int,int>
#define deb(x) cout<<#x<<"="<<x<<endl;
#define F first
#define S second
#define pii pair<int,int>

int mpow(int exp, int base);
void aeh()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("aana.txt", "r", stdin);
	freopen("jj.txt", "w", stdout);
#endif
}
vector<int>a[100001];
vi res;
int vis[100001];
// char a[100001];
int dp[100001];
int dfs(int i)
{
	if (dp[i] != -1)
	{
		// cnt += dp[i];
		return dp[i];
	}
	int temp = 0;
	for (int j = 0; j < a[i].size(); j++)
	{
		temp = max(temp, dfs(a[i][j]) + 1);
	}
	// res.pb(cnt);
	// cnt--;
	dp[i] = temp;
	return temp;
}
int32_t main()
{
//	aeh();
	int n, m;
	cin >> n >> m;
	fi(100001)
	dp[i] = -1;
	fi(m)
	{
		int a1; cin >> a1;
		int b; cin >> b;
		a[a1].pb(b);
	}
	int ans = 0;
	for (int i = 1; i <= n; i++)
	{
		ans = max(ans, dfs(i));
		// cnt = dfs(i);
		// dp[i] = dfs(i);
		// cnt = 0;
	}
	cout << ans << endl;
}


int mpow(int base, int exp)
{
	base %= mod;
	int result = 1;
	while (exp > 0)
	{
		if (exp & 1)result = (result * base) % mod;
		base = (base * base) % mod;
		exp >>= 1;
	}
	return result;
}

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

int main() {
  long long ans = 0;
  int N, c = 0;
  cin >> N;
  vector<int> A(N);
  for(int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  for(int i = 0; i < N; i++) {
    if(A.at(i) < 0) c++;
  }
  for(int i = 0; i < N; i++) {
    A.at(i) = abs(A.at(i));
    ans += A.at(i); 
  }
  if(c % 2 == 0) cout << ans;
  else cout << ans - *min_element(A.begin(), A.end()) * 2;
}

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

#define                           int                         long long
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<int,int>
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);




using namespace std;

const int inf=1e18;
const int mod=1e9+7;
const int M=100009;
inline int bigmod(int B,int P){int R=1;while(P>0){if(P&1){R=(R*B)%mod;}P>>=1;B=(B*B)%mod;}return R;}

int cnt1[M+3];
int cnt2[M+3];
bool cmp(pi x,pi y)
{
    return x.fi>y.fi;
}
int a[M+3];
 main()

{
    fast
    int n;
    cin>>n;
    f(i,1,n)
    {
        cin>>a[i];
    }
     f(i,1,n)
     {
         if(i%2==0)
         {
            cnt2[a[i]]++;
         }
         else
         {
             cnt1[a[i]]++;
         }
     }
     vector<pi>v1,v2;
     f(i,1,M)
     {
         if(cnt1[i]>0)
         {
             v1.pb(mp(cnt1[i],i));
         }
     }
     f(i,1,M)
     {
         if(cnt2[i]>0)
         {
             v2.pb(mp(cnt2[i],i));
         }
     }
     v1.pb(mp(0,M+1));
     v2.pb(mp(0,M+3));
     v1.pb(mp(0,M+2));
     v2.pb(mp(0,M+4));
     sort(v1.begin(),v1.end(),cmp);
     sort(v2.begin(),v2.end(),cmp);
     int ses=n;
     if(v1[0].si==v2[0].si)
     {
         int x=v1[0].fi+v2[1].fi;
         int y=v1[1].fi+v2[0].fi;
         ses-=max(x,y);
     }
     else
     {
        ses-=v1[0].fi;
        ses-=v2[0].fi;
     }
     cout<<ses<<endl;














    return 0;

}














Measured memory_bytes: 4980
#include <bits/stdc++.h>
#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 INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;

int main()
{
  int X, Y;
  cin >> X >> Y;
  if(X*2<=Y&&X*4>=Y&&Y%2==0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<ll,ll> pint;
 
ll a[100001];
int main(){
    int n;
    cin>>n;
    rep(i,n) cin>>a[i];
    int mx=*max_element(a,a+n);
    int cur=(mx-1)/2+1;
    int sub=1000100010;
    int id;
    sort(a,a+n);
    if(n==2){
        cout<<a[1]<<" "<<a[0]<<endl;
        return 0;
    }
    rep(i,n){
        if(abs(a[i]-cur)<=sub) sub=abs(a[i]-cur),id=i;
    }
    cout<<mx<<" "<<a[id]<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
#define FILL(ptr, value) FILL_((ptr), sizeof(ptr)/sizeof(value), (value))
template <typename T>
void FILL_(void * ptr, size_t size, T value){
  std::fill((T*)ptr, (T*)ptr+size, value);
}
//4方向ベクトル→↑←↓
int dx[] ={1,0,-1,0};
int dy[] ={0,-1,0,1};
/*

    1: . , ! ? (スペース)
    2: a b c
    3: d e f
    4: g h i
    5: j k l
    6: m n o
    7: p q r s
    8: t u v
    9: w x y z
    0: 確定ボタン */
char keitai[10][5]={
  {'.', ',' ,'!','?',' '},
  {'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'},
};
string str;
int main()
{
  int n;
  cin >>n;
  for(int i = 0;i < n;i++){
    int cnt[15] = {0};
    cin >>str;
    for(int i = 0;i < str.length();i++){
      if(i >0&&str[i]=='0'&&str[i-1]!='0'){
	if((str[i-1]=='1')){
	  cout <<keitai[(str[i-1]-'0')-1][(cnt[(str[i-1]-'0')]-1)%5];
	  cnt[str[i-1]-'0'] = 0;
	}
	else if((str[i-1]=='7'||str[i-1]=='9')){
	  cout <<keitai[(str[i-1]-'0')-1][(cnt[str[i-1]-'0']-1)%4];
	  cnt[str[i-1]-'0'] = 0;
	}else{
	  cout <<keitai[(str[i-1]-'0')-1][(cnt[str[i-1]-'0']-1)%3];
	  cnt[str[i-1]-'0'] = 0;	  
	}
      }
      if(str[i] !='0'){
	cnt[str[i]-'0'] +=1;
      }
    }
    cout <<endl;
  }
  return 0;
}

Measured memory_bytes: 1196
/*------U Have To DO It------*/
/* BY-> RicoProg */
/*        ___ 
           __|__|
          |  |___       */
#include <bits/stdc++.h>
using namespace std;
 
 
//---------------------------------------------------MACROS----------------------------------------------------------
#define ll long long
#define ld long double
#define beg(i ,n) for(ll i=0;i<n;i++)
#define beg1(i ,n) for(ll i=1;i<n;i++)
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define pb push_back 
#define mp make_pair
#define nl "\n" 
#define vec(v , n) vector<ll> v(n)
#define all(x) x.begin() , x.end()
#define pii pair<int , int>
#define pll pair<ll , ll>
#define mii map<int , int>
#define mll map<ll , ll>
#define msi map<string , int>
#define mci map<char , int>
#define f1 first
#define f2 second
#define inf 1e18 + 10

//---------------------------------------------------GLOBAL----------------------------------------------------------
const ll MOD = 1e9 + 7 ;
const ll MAX = 1e5 + 7 ;

//---------------------------------------------------FUNCTIONS-------------------------------------------------------

ll dp[3001][3001] , ar[3001] , n ;

void rec(ll s , ll e){
	if(s==e){
		dp[s][e] = ar[s] ;
		return ;
	}
	else if(dp[s][e] != -1){
		return ;
	}
	rec(s+1 , e) ;
	rec(s , e-1) ;
	dp[s][e] = max(ar[s] - dp[s+1][e] , ar[e] - dp[s][e-1]) ;
	return ;
}

void solve(){
	memset(dp , -1 , sizeof(dp)) ;
	scanf("%lld" , &n) ;
	beg(i , n) scanf("%lld" , &ar[i]) ;
	rec(0 , n-1) ;
	printf("%lld" , dp[0][n-1]) ;
}

//---------------------------------------------------DRIVER----------------------------------------------------------
int main()
{
    fast ;
    int t=1 ;
    //cin >> t ;
    while(t--){
        solve() ;
    }
    return 0;
}	

Measured memory_bytes: 70784
#include<bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(ll i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    int n, m, now = 0;
    cin >> n >> m;
    vector<int> a(n);
    rep(i, n)cin >> a.at(i);
    sort(all(a));
    vector<P> b(m);
    rep(i, m)cin >> b[i].second >> b[i].first;
    sort(rall(b));
    rep(i, n){
        if(a.at(i) < b[now].first){
            a.at(i) = b[now].first;
            b[now].second--;
        }
        if(b[now].second <= 0)now++;
        if(now >= m)break;
    }
    cout << accumulate(all(a), 0LL) << endl;
}


Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef long long ll;

using ipair = pair<ll,ll>;

ll INF = 1e16+7;

bool operator>(const ipair a,const ipair b){return a.first > b.first;}

int mod = 1e9+7;

int main(){

  ll X;
  cin >> X;
  ll mul = 100;

  int cnt = 0;
  while(mul<X){
    mul *= 1.01;
    cnt++;
  }

  cout << cnt << endl;


  return 0;
}


Measured memory_bytes: 3636
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define INF 100000000
#define rep(i,s,n) for (int i = (int)(s); i < (int)(n); i++)
#define repp(i,n,s) for (int i= (int)(n); i >= (int)(s); i--)
#define mp make_pair
ll mod = 1000000007;
ll mod2 = 998244353;

int main(){
	cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin>>n;
    int ans = 0;
    rep(i,0,n){
        int a;cin>>a;
        if ((i+1)%2==1 && a%2==1) ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3652
#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import itertools
import math
import sys

INF = float('inf')


def solve(x: "List[int]"):
    return x.index(0) + 1


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    x = [int(next(tokens)) for _ in range(5)]  # type: "List[int]"
    print(solve(x))


if __name__ == '__main__':
    main()


Measured memory_bytes: 75288
//! 尺卂乃卂.卂ﾌ乇乇ㄒ
#include<bits/stdc++.h>
//#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
//Using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> Ordered_set;

#define ll              long long
#define int             long long
#define ld             long double
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define vii             vector<vi>
#define vip            vector<pii>
#define mii             map<int,int>
#define mip             map<pair<int,int>,int>
#define mic             map<char,int> 
#define all(v)          v.begin(),v.end()  
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define lb(x)           (x&(-x))
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            int x; cin>>x; while(x--)
#define itr(it,v)          for(auto it:v)
#define show(arr,n)     for(int i=0;i<n;i++) cout<<arr[i]<<" "; cout<<"\n";
#define fi(i,n)         for(int i=0;i<n;i++)
#define fir(i,k,n)       for(int i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ff               first 
#define ss               second
#define deb(x) cout << #x << "=" << x << endl
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define check(x) (x && cout<<"Yes\n")||(cout<<"No\n");
#define fin(s)          freopen(s,"r",stdin);  
#define fout(s)         freopen(s,"w",stdout);

const ld pi = 3.141592653589793238462643383279502884;
const int xd[]={-1,0,1,0};
const int yd[]={0,-1,0,1};
int XX[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int YY[] = { -1, 0,  1, -1, 1, -1, 0, 1 };

int expo(int a,int b,int m);
int mmi(int a,int m);
void ipgraph(int m);

const int N=5*(1e5)+10;
vii adj(N);
int a[N],b[N],dp[N];
void  solve(){

}
int32_t main()
{
    FIO
    int n,w; cin>>n>>w;
    int tv=0;
    fi(i,n) {
        cin>>a[i]>>b[i];
        tv+=b[i];
    }
    fi(i,tv+1) dp[i]=INT_MAX;
    dp[0]=0;
    for(int i=0;i<n;i++){
        for(int j=tv-b[i];j>=0;j--){
            dp[j+b[i]]=min(dp[j+b[i]],dp[j]+a[i]);
        }
    }
    for(int i=tv;i>=0;i--){
        if(dp[i]<=w){
            cout<<i<<"\n";
            return 0;
        }
    }
    return 0;

}

void ipgraph(int m){
    int i, u, v;
    while(m--){
          cin>>u>>v;
         u--, v--;
    adj[u].pb(v);
    adj[v].pb(u);
    }
}
int expo(int a,int b,int m){
    if(b==0) return 1;
    if(b==1) return a;
    int val=(expo(a,b/2,m)*expo(a,b/2,m))%m;
    if(b & 1) return (val*a)%m;
    else return val;
}
int mmi(int a,int m){
    return expo(a,m-2,m);
}

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

int main()
{
	int k,s;
  	cin>>k>>s;
  	int ans=0;
  	for(int i=k ;i>=0 ; --i)
    {
    	for(int j=k ; j>=0 ; --j)
        {
          	int curr=i+j;
          	if(curr>s)
          	continue;
          	if((s-curr)<=k)
            {
            	++ans;
            }
          	else
            break;
        }
    }
  	cout<<ans<<endl;
  	return 0;
}

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

double eps = 1e-14;
bool eq(double a,double b){
  return (-eps<a-b&&a-b<eps);
}
bool eq(P a,P b){
  return eq(a.real(),b.real())&&eq(a.imag(),b.imag());
}
P getCrossPointCC(P p1,double r1,P p2,double r2,bool flag=false){
  double a=r2,b=r1,c=abs(p1-p2);
  double cos_A = (b*b+c*c-a*a) / (2.0*b*c);
  double zero=0;
  double sin_A = sqrt( max(zero,1.0-cos_A*cos_A));
  P v=(p2-p1);
  v *= r1;
  v /= c;
  return p1+v*P(cos_A,sin_A);
}

bool isCross(P p1,double r1,P p2,double r2){
  double k=abs(p1-p2);
  if( r1+r2 < k - eps )return false;
  if( k+r1 < r2 - eps)return false;
  if( k+r2 < r1 - eps)return false;
  return true;
}

int n;
P t[200];
double r[200];
vector< P > u,v;


bool check(P p,double r){
  bool res=false;
  v.clear();
  for(int i=0;i<(int)u.size();i++){
    P k=u[i];
    //printf("%.8f %.8f\n",k.real(),k.imag());
    if( abs(p-k) < r + eps )res=true;
    if( abs(p-k) > r - eps )v.push_back(k);
  }
  u=v;
  return res;
}

int main(){
  while(1){
    u.clear(),v.clear();
    cin>>n;
    if(n==0)break;
    for(int i=0;i<n;i++){
      double x,y;
      cin>>x>>y>>r[i];
      t[i]=P(x,y);
      u.push_back(t[i]);
      u.push_back( P(t[i].real(),t[i].imag()+r[i]) );
    }
    for(int i=0;i<n;i++){
      for(int j=i+1;j<n;j++){
        if(isCross(t[i],r[i],t[j],r[j])){
          u.push_back(getCrossPointCC(t[i],r[i],t[j],r[j]));
          u.push_back(getCrossPointCC(t[j],r[j],t[i],r[i]));
        }
      }
    }
    //    cout<<u.size()<<endl;
    int ans=0;
    for(int i=n-1;i>=0;i--){
      if(check(t[i],r[i]))ans++;
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 1368
#include <bits/stdc++.h>
#define endl 			"\n"
#define forn(n) 		for(int i=0;i<n;i++)
#define REP(i,a,n) 		for(int i=a;i<n;i++)
#define pb 				push_back
#define mp 				make_pair
#define ll 				long long
using namespace std;

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

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい
// https://github.com/atcoder/live_library
// cppdbg: test.exeのterminalに標準入力を打てる

#define ALL(x) x.begin(),x.end()
#define get_tp(t,i) get<i>(t)
#define len(x) (ll)(x.size())
#define ub(a,x) (upper_bound(ALL(a),x)-a.begin())
#define lb(a,x) (lower_bound(ALL(a),x)-a.begin())
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef pair<long long,long long> pllll; //pair<ll,ll>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<ll, vector<ll>, greater<ll> > gpq; //逆順priority_queue
typedef priority_queue<ll> pq;

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const long double PI=3.1415926535897932;

int main(){
    int total=0,m=0;
    for(int i=0;i<5;i++){
        int p;cin>>p;
        total+=p-p%10;
        if(p%10){
            total+=10;
            m=max(m,10-p%10);
        }
    }
    cout<<total-m<<endl;
}

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

struct Card{char suit,value; };

void bubble(struct Card A[], int N){
    for(int i=0 ; i < N;i++){
        for(int j = N-1; j > i; j--){
            if(A[j].value < A[j-1].value){
                Card t = A[j]; A[j] = A[j-1]; A[j-1]=t;
            }
        }
    }
}

void selection(struct Card A[], int N){
    for(int i=0; i<N; i++){
        int minj = i;
        for(int j=i; j<N; j++){
            if(A[j].value < A[minj].value){
                minj = j;
            }
        }
        Card t = A[i]; A[i] = A[minj]; A[minj] = t;
    }
}

void print(struct Card A[], int N){
    for(int i=0; i < N; i++){
        if(i > 0) cout << " ";
        cout << A[i].suit << A[i].value;
    }
    cout << endl;
}

bool isStable(struct Card C1[], struct Card C2[], int N){
    for(int i=0; i<N; i++){
        if(C1[i].suit != C2[i].suit) return false;
    }
    return true;
}

int main(){
    Card C1[100],C2[100];
    int N;
    char ch;

    cin >> N;
    for(int i=0; i<N; i++) cin >> C1[i].suit >> C1[i].value;
    for(int i=0; i<N; i++) C2[i] = C1[i];

    bubble(C1,N);
    selection(C2,N);

    print(C1,N);
    cout << "Stable" << endl;
    print(C2,N);
    if(isStable(C1,C2,N)){
        cout << "Stable" << endl;
    }else{
        cout << "Not stable" << endl;
    }

    return 0;

}


Measured memory_bytes: 3100
#include <stdio.h>
int n;
struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node  Node;

int main(){
    Node x[100];
    int i;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%d",&x[i].key);
    }
    for(i=1;i<=n;i++){
        printf("node %d: key = %d, ",i,x[i].key);
        if(i!=1){
            printf("parent key = %d, ",x[i/2].key);
        }
        if(2*i<=n){
            printf("left key = %d, ",x[i*2].key);
        }
        if(2*i+1<=n){
            printf("right key = %d, ",x[i*2+1].key);
        }
        printf("\n");
    }
    
return 0;
}


Measured memory_bytes: 2104
#include<stdio.h>

void putQueen(int);
void printBoard(void);

#define FREE 0
#define NOT_FREE 1
#define TRUE 2
#define FALSE -1
#define N 8

int row[N];
int col[N]={};
int dpos[2*N-1]={};
int dneg[2*N-1]={};
int Board[N][N]={};

int main(){
  int n, u, m, i, j;

  for( i=0 ; i<N ; i++ ){
    for( j=0 ; j<N ; j++ ){
      Board[i][j] = FALSE;
    }
  }
  
  scanf("%d", &n);
  for( i=0 ; i<n ; i++ ){
    scanf("%d%d", &u, &m);
    
    Board[u][m] = TRUE;
  }

  putQueen(0);

  return 0;
}

void putQueen(int i){
  int j;
  
  if( i==N ){
    printBoard();
    return;
  }			   
  
  for( j=0 ; j<N ; j++ ){

    if(col[j] == NOT_FREE || dpos[i+j] == NOT_FREE || dneg[i-j+N-1] == NOT_FREE){
      continue;
    }
    
    row[i] = j;
    col[j] = dpos[i+j] = dneg[i-j+N-1] = NOT_FREE;

    putQueen(i+1);
    
    col[j] = dpos[i+j] = dneg[i-j+N-1] = FREE;
  }
}

void printBoard(){
  int i, j;

  for( i=0 ; i<N ; i++ ){
    for( j=0 ; j<N ; j++ ){
      if( Board[i][j] == TRUE && row[i] != j){
	return;
      }
    }
  }

  for( i=0 ; i<N ; i++ ){
    for( j=0 ; j<N ; j++ ){
      if( row[i] == j ){
	printf("Q");
      }
      else{
	printf(".");
      }
    }
    printf("\n");
  }
  return;
}

Measured memory_bytes: 572
s=input()
s=s[::-1]
tmp=['dream','dreamer', 'erase', 'eraser']
for i in range(4):
  tmp[i]=tmp[i][::-1]
while 1:
  if len(s)>=5:
    if s[:5]==tmp[0]:
      if len(s)>5:
        s=s[5:]
      else:
        s=[]
      continue
    if s[:5]==tmp[2]:
      if len(s)>5:
        s=s[5:]
      else:
        s=[]
      continue
    if len(s)>=6:
      if s[:6]==tmp[3]:
        if len(s)>6:
          s=s[6:]
        else:
          s=[]
        continue
      if len(s)>=7:
        if s[:7]==tmp[1]:
          if len(s)>7:
            s=s[7:]
          else:
            s=[]
          continue
  break

if s==[]:
  print('YES')
else:
  print('NO')


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

#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dump() fprintf(stderr, "#%s.%d\n", __func__, __LINE__);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
typedef std::vector<long> LI;
typedef std::queue<long> QI;
#define rep(i,n) for(long i = 0; i < (long)n; ++i)
const double pi = M_PI;

template<typename T> void scan1(T& x) { fprintf(stderr, "unknown type\n"); }
template<> void scan1(long& x) { if( scanf("%ld", &x) < 0 ) exit(0); }
template<> void scan1(std::string& x) { if( not ( std::cin >> x ) ) exit(0); }
void scan() {}
template<typename Head, typename... Tail>
void scan(Head& x, Tail&... xs) {
  scan1(x); scan(xs...);
}

struct Solver {
   Solver() { fprintf(stderr, "--------Solver begin--------\n"); }
   ~Solver() { fprintf(stderr, "--------Solver end--------\n"); }
   void solve() {
      long n; scan(n);
      LI xs(n); for(long &x : xs) scan(x), x -= 1;
      std::vector<bool> visited(n, false);
      long t = 0;
      long res = 0;
      loop {
         if( visited[t] ) break;
         visited[t] = true;
         if( t == 1 ) break;
         res += 1;
         t = xs[t];
      }
      printf("%ld\n", res == 0 or not visited[1] ? -1 : res);
   }
};

int main() {
   loop std::unique_ptr<Solver>(new Solver())->solve();
}



Measured memory_bytes: 1024
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>
#include <stack>
 
using namespace std;
 
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f3f3f3f3fLL
#define SIZE 200105
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
 
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
ll MOD=998244353;
typedef ll Weight;
struct Edge {
	int src, dst;
	Weight weight;
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;

const int ST_SIZE = (1<<18) -1;
int A[114514];
ll N,K;
int main(){
	cin>>N>>K;
	if(K%2==0){
		ll hoge=N/K;
		ll hoge2=(N+K/(ll)2)/K;
		cout<<hoge*hoge*hoge+hoge2*hoge2*hoge2<<endl;
	}else{
		ll hoge=N/K;
		cout<<hoge*hoge*hoge<<endl;
		
	}
}

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

if abs(x) >= d*k:
    if x > 0: x -= d*k
    else: x += d*k
    ans = abs(x)
else:
    k -= x//d
    x %= d
    if k%2 != 0:
        if abs(x+d) < abs(x-d): ans = abs(x+d)
        else: ans = abs(x-d)
    else: ans = abs(x)
print(ans)

Measured memory_bytes: 9188
n, a, b = map(int, input().split())
s = input()

pass_a = 0
pass_b = 0
for c in s:
    if c == 'a':
        if pass_a + pass_b < a + b:
            print('Yes')
            pass_a += 1
        else:
            print('No')
    elif c == 'b':
        if pass_a + pass_b < a + b and pass_b < b:
            print('Yes')
            pass_b += 1
        else:
            print('No')
    else:
        print('No')


Measured memory_bytes: 9200
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mp make_pair
const int maxn = 1e5+10;
const int mod = 1e9+7;
const int INF = 0x3f3f3f3f;
int d[4][2]={1,0,0,1,-1,0,0,-1};
int main() {
    ios::sync_with_stdio(0);
    string s;
    cin>>s;
    if(s=="ABC"){
        cout<<"ARC";
    }else{
        cout<<"ABC";
    }
    return 0;
}

Measured memory_bytes: 3652
#include <cstdio>
#include <utility>
#include <queue>
#include <vector>
#include <iostream> 
#include <algorithm>
#include <math.h>
#include <map>  
#include <string.h> 

using namespace std;

int par[100001],p[100001];

bool mark[100001];

void init(int n){
  for(int i=1; i<=n; i++){
    par[i]=i;
    }
  }

int findancestor(int x){
  if(mark[x]){
    return x;
    }else{
      return findancestor(par[x]);
    }
  }
  
void unite(int x,int y){
     par[y]=x;         
  }

int main() {
  
  while(1){

   int N,Q;  scanf("%d %d",&N,&Q);
   
   if(N==0&&Q==0) break;
   
   memset(mark,0,sizeof(mark));
   
   init(N);   mark[1]=1;
   
   for(int i=1; i<=N-1; i++){
     int x; cin>>x;
     p[i+1]=x;
     }
     
   for(int i=N; i>=2; i--){
     unite(p[i],i);
     }
     
   long long ans=0;
     
   for(int i=0; i<Q; i++){
     
     char t; cin>>t;
     
       if(t=='M'){
       
        int v; cin>>v; mark[v]=1;
       
       }else if(t=='Q'){
         
        int v; cin>>v; 
        ans+=findancestor(v);
         
       }
     
     }
               
              cout<<ans<<endl;
              
    }
     
}

Measured memory_bytes: 2128
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <climits>

constexpr int SINT_MAX = std::numeric_limits<int>::max();
constexpr int SINT_MIN = std::numeric_limits<int>::min();

using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;

template<class T>
T choose(bool b, T t, T f)
{
    if (b) return t;
    else return f;    
}

const char *YesNo(bool b)
{
    return choose(b, "Yes", "No");
}

const char *YESNO(bool b)
{
    return choose(b, "YES", "NO");
}

template<class NumT>
NumT diffabs(NumT l, NumT r)
{
    if (l < r) return r-l;
    else return l-r;    
}

struct myinout_t {} io;

template<class T>
myinout_t &operator >>(myinout_t &my, T &i)
{
    cin >> i;
    return my;
}

myinout_t &operator >>(myinout_t &my, int &i)
{
    int r = scanf("%d", &i);
    if (r != 1) exit(EXIT_FAILURE);
    return my;
}

myinout_t &operator >>(myinout_t &my, ll &i)
{
    int r = scanf("%lld", &i);
    if (r != 1) exit(EXIT_FAILURE);
    return my;
}

template<class T>
myinout_t &operator <<(myinout_t &my, const T &i)
{
    cout << i;
    return my;
}

myinout_t &operator <<(myinout_t &my, int i)
{
    printf("%d", i);
    return my;
}

myinout_t &operator <<(myinout_t &my, ll i)
{
    printf("%lld", i);
    return my;
}

myinout_t &operator <<(myinout_t &my, double i)
{
    printf("%.20f", i);
    return my;
}

constexpr char BR = '\n';


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

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

    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        if(i % 2 == 0 && a[i] % 2 == 1) ++ans;
    }
    io << ans << BR;
}

Measured memory_bytes: 3760
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string A;
  string B;
  int C=0;
  cin >> A >> B;
  for (int i=0; i<A.size(); i++)
  {
    if(A.at(i)!=B.at(i))
    {
      C++;
    }
  }
  cout << C << endl;
}

Measured memory_bytes: 3856
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

class Main {

    public static void main(String[] args) throws Exception {

        try {

            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

            List<String> input = Arrays.asList(br.readLine().split(" "));
            List<Integer> numbers = new ArrayList<>();

            for (String s : input) {
                numbers.add(Integer.parseInt(s));
            }

            int limitOfbucketA = numbers.get(0);
            int limitOfbucketC = numbers.get(2);
            int inBucketA = numbers.get(1);

            int result = limitOfbucketA - inBucketA - limitOfbucketC;

            if (result < 0) {
                result *= -1;
            } else {
                result = 0;
            }

            System.out.println(result);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }
}

Measured memory_bytes: 23124
#include <stdio.h>

int main()
{
    int age;
    scanf("%d", &age);

    if (age == 1) {
        printf("Hello World\n");
    } else {
        int a, b;
        scanf("%d%d", &a, &b);
        printf("%d\n", a + b);
    }

    return 0;
}


Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main(int argc, char* argv) {
    int a, b, c;
    long k;
    cin>>a>>b>>c>>k;
    if (k%2) {
        cout << b - a << endl;
    } else {
        cout << a - b << endl;
    }
    return 0;
}


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

int n;
cin>>n;
long long ans=1e18;
vector<long long>v;
long long sum=0;
long long s=0;
for(int i = 0 ; i < n ; ++i){
long long x;
cin>>x;
if(i+1<n)
v.push_back(x);
sum+=x;
}
for(int i = 0 ; i < n-1;++i)
{s+=v[i];
	ans=min(ans,abs(s-(sum-s)));
//cout<<s<<" "<<sum-s<<endl;
}cout<<ans<<endl;
}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll f(string S) {
    ll res = 0;
    S = S+"$";
    char c = S[0];
    int k = 1;
    for (int i = 1; i < S.size(); i++) {
        if (S[i] != c) {
            res += k/2;
            k = 1;
            c = S[i];
        }
        else {
            k++;
        }
    }
    return res;
}
int main () {
    string S;
    ll K;
    cin >> S >> K;
    ll ans = 0;
    if (S.front() != S.back()) {
        ans = f(S)*K;
    }
    else {
        ll x = 0, y = 0;
        for (int i = 0; i < S.size(); i++) {
            if (S[i] == S[0]) {
                x++;
            }
            else {
                break;
            }
        }
        for (int i = S.size()-1; i >= 0; i--) {
            if (S[i] == S[0]) {
                y++;
            }
            else {
                break;
            }
        }
        int z = x+y;
        if (z > S.size()) z = S.size();
        if (z == S.size()) {
            ans = S.size()*K/2;
        }
        else {
            string T = "";
            for (int i = x; i < S.size()-y; i++) {
                T += S[i];
            }
            ans = f(T)*K + (x+y)/2*(K-1) + x/2 + y/2;
        }
    }
    cout << ans << endl;
}

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

typedef long long ll;

const int MOD = 1000000007;
const int INF = 1001001001;
const double PI = acos(-1);

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

int main() {
    int n;
    cin >> n;
    vector<int> a(n), b(n, 0);
    rep(i, n) cin >> a[i];
    int ans = 1;
    int ansn = 1;
    rep(i, n) {
        ans *= 3;
        if (a[i] % 2 == 0) ansn *= 2;
    }

    ans -= ansn;

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>

using namespace std;
static const int MAXV = 1000000;

int sosuu_list[MAXV];

void make_sosuu_list() {
  for(int i=0;i<MAXV;i++) sosuu_list[i] = 1;
  sosuu_list[0] = sosuu_list[1] = 0;
  for(int i=2;i<MAXV;i++) {
    if(sosuu_list[i]) {
      for(int j=i+i;j<MAXV;j+=i) sosuu_list[j] = 0;
    }
  }
  for(int i=1;i<MAXV;i++)sosuu_list[i]+=sosuu_list[i-1];
}

int main() {
  int n;
  make_sosuu_list();
  while(/*scanf("%d", &n) == 0) {*/!feof(stdin)) {
    scanf("%d", &n);
    if(feof(stdin)) break;
    printf("%d\n", sosuu_list[n]);
  }
}

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

#define int long long
#define pb push_back
#define f first
#define s second
#define all(container) container.begin(),container.end()

#define fast ios::sync_with_stdio(0); cin.tie(0)
#define print(...) __f(#__VA_ARGS__, __VA_ARGS__)

template <typename Arg1> void __f(const char* name, Arg1&& arg1){
	cout << name << ": " << arg1 << '\n';
}

template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}

int32_t main(){
		
		fast;
		int a,b,c; cin >> a >> b >> c;
		cout << c - min(a-b,c);
 
 
		return 0;
} 

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

int getLCS(char*, char*);
int C[1001][1001];
 
int main(){
    char x[N], y[N];
    int q, i;
 
    scanf("%d", &q);
    for (i = 0; i < q; i++){
        scanf("%s%s", x, y);
        printf("%d\n", getLCS(x, y));
    }
    return 0;
}
 
int getLCS(char *x, char *y){
    int i, j, lenX, lenY;
 
    lenX = strlen(x);
    lenY = strlen(y);
 
    for (i = 0; i < lenX; i++){
        for (j = 0; j < lenY; j++){
            if (x[i] == y[j]) C[i + 1][j + 1] = C[i][j] + 1;
            else C[i + 1][j + 1] = ((C[i][j+1] > C[i+1][j])?  C[i][j+1] : C[i+1][j]);
        }
    }
 
    return C[lenX][lenY];
}
 

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

int main()
{
  int a[3];
  rep(i,3) {
    cin >> a[i];
  }

  if(a[0] == a[1]) cout << a[2] << endl;
  else if(a[0] == a[2]) cout << a[1] << endl;
  else cout << a[0] << endl;
  
  return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

const int MAX_N = 10000;
bool is_prime[MAX_N + 1];

bool sieve(int n)
{
    if(n % 2 == 0) return false;

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

int main()
{
    int n, p;
    is_prime[1] = true;
    is_prime[2] = true;

    for(int i = 3; i <= MAX_N; i++)
        is_prime[i] = sieve(i);

    while(cin >> n && n) {
        p = 0;
        for(int i = 5; i <= n; i+=2) {
            if(is_prime[i - 2] && is_prime[i]) {
                p = i;
            }
        }
        cout << p - 2 << " " << p << endl;
    }
}

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

int main() {
	vector<int> x(5);
	int k;
	for (int i = 0; i < 5; i++) cin >> x.at(i);
	cin >> k;

	for (int i = 1; i < 5; i++) {
		if(x.at(i) - x.at(0) > k) {
			cout << ":(" << endl;
			return 0;
		}
	}
	cout << "Yay!" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	int n, a; cin >> n >> a;
	cout << n * n - a << endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
Scanner kb=new Scanner(System.in);
double x1=kb.nextDouble();
double y1=kb.nextDouble();
double x2=kb.nextDouble();
double y2=kb.nextDouble();
double xd=x2-x1;
double yd=y2-y1;

System.out.printf(
		"%f\n",Math.sqrt(xd*xd+yd*yd));
	}

}

Measured memory_bytes: 28272
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <deque>

long long mod = 1e9+7;
class Mint {
public:
  long long x;
  Mint(){}; // 引数なしでも定義できるように引数なしコンストラクタも用意しておく
  Mint(long long a){
    x = a%mod;
    while(x<0){
      x += mod;
    }
  };
  Mint& operator += (const Mint &a){
    x+=a.x;
    x%=mod;
    return *this;
  }
  Mint& operator -= (const Mint &a){
    x += (mod - a.x);
    x%=mod;
    return *this;
  }
  Mint& operator *= (const Mint &a){
    x*=a.x;
    x%=mod;
    return *this;
  }

  // a^n mod を計算する
  // Useaeg: Mint z = y.pow(y, n);
  Mint pow(Mint a, long long n) const {
    Mint y(1);
    Mint b(a);
    while (n > 0) {
      if (n & 1) y *= b;
      b *= b;
      n >>= 1;
    }
    return y;
  }

  // a^{-1} mod を計算する
  Mint modinv(const Mint &a) const {
    return pow(a, mod-2);
  }

  Mint& operator /= (const Mint &a) {
    x *= modinv(a).x;
    x %= mod;
    return *this;
  }

  Mint operator + (Mint &a) const {
    Mint y(*this);
    y += a;
    return y;
  }

  Mint operator - (Mint &a) const {
    Mint y(*this);
    y -= a;
    return y;
  }

  Mint operator * (Mint &a) const {
    Mint y(*this);
    y *= a;
    return y;
  }

  Mint operator / (Mint &a) const {
    Mint y(*this);
    y/=a;
    return y.x;
  }

  // nCk @mod を計算する
  Mint nCk(Mint &n, const long long k) const {
    Mint y = Mint(1);
    for (Mint i(0); (i.x)<k; i.x++){
      y *= (n-i);
      y /= i;
    }
    return y;
  }

  // nPk @mod を計算する
  Mint nPk(Mint &n, long long k) const {
    Mint y(1);
    for (Mint i(0); (i.x)<k; i.x++){
      y *= (n-i);
    }
    return y;
  }
};

long long sum1[26][2504];
long long sum2[26][2504];
std::vector<int > x(52);

void dfs(int i, int size, int offset, int tot, int cnt, int id){
  if (i==size){
    //if (id==0) printf("dfs(%d, %d, %d, %d, %d)\n", i, size, offset, tot, cnt);
    if (tot>2500) return;
    if(id==0) sum1[cnt][tot]++;
    else sum2[cnt][tot]++;
    return;
  }
  dfs(i+1, size, offset, tot+x[i+offset], cnt+1, id);
  dfs(i+1, size, offset, tot, cnt, id);
  return;
}

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

  for (int i=0; i<N; i++){
    scanf("%d", &x[i]);
  }
  int half1 = N/2;
  dfs(0, half1, 0, 0, 0, 0);
  int half2 = N-half1;
  dfs(0, half2, half1, 0, 0, 1);
  long long ans = 0;
  //printf("half1=%d, half2=%d\n", half1, half2);
  for (int c1 = 0; c1<=half1; c1++){
    for (int j=0; j<=2500; j++){
      for (int c2 = 0; c2<=half2; c2++){
        //if (c1==0 && c2==1 && j==0) printf("Hi\n");
        int total = (c1+c2)*A;
        if (c1+c2==0) continue;
        if (total-j<0) continue;
        //if (c1==0 && c2==1 && j==0) printf("Hi2\n");
        ans += sum1[c1][j]*sum2[c2][total-j];
        /*if (c1==0 && c2==1 && j==0){
          printf("+= sum1[%d][%d]*sum2[%d][%d]=%lld*%lld\n", c1, j, c2, total-j,sum1[c1][j],sum2[c2][total-j]);
        }*/
      }
    }
  }
  std::cout << ans << std::endl;
  return 0;
}

Measured memory_bytes: 3556
import bisect
import numpy
n, m, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a = numpy.cumsum(A)
b = numpy.cumsum(B)
ans = 0
for i in range(n):
    if a[i] <= k:
        c = bisect.bisect(b, k-a[i])
        ans = max(ans, i+c+1)
for i in range(m):
    if b[i] <= k:
        c = bisect.bisect(a, k-b[i])
        ans = max(ans, i+c+1)

print(ans)


Measured memory_bytes: 58672