akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define int long long
#define double long double
#define pb push_back
#define ff first
#define ss second
#define PI acos(-1)
#define bp __builtin_popcountll
#define all(x) x.begin(),x.end()
#define sp fixed<<setprecision
#define pii pair<long long,long long>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

int MOD = (1e9)+7;
const int N = 1000005;

signed main()
{
    FAST
    int tc=1;
    //cin>>tc;
    for(int ti=1;ti<=tc;ti++)
    {
        double r;
        cin>>r;
        r = 2*PI*r;
        cout<<sp(5)<<r<<endl;
    }
    return 0;
}
/*
Test Case
*/


Measured memory_bytes: 3812
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int ans=s.size();
  for(int i=0;i<2;i++){
    int cnt=0;
    for(int j=0;j<s.size();j++){
      if(j%2==0&&s.at(j)!=(char)(i+'0')){
        cnt++;
      }
      if(j%2==1&&s.at(j)==(char)(i+'0')){
        cnt++;
      }
    }
    ans=min(ans,cnt);
  }
  cout<<ans<<endl;
}


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

int main() {
// #ifndef ONLINE_JUDGE
//     freopen("input1.txt", "r", stdin);
//     freopen("output1.txt", "w", stdout);
// #endif


    ios_base::sync_with_stdio(false);
    cin.tie(NULL);


    string s;
    cin >> s;
    int l = s.size();
    for ( int i = 0; i < l; ++i) {
        if (s[i] == '?') {
            s[i] = 'D';
        }
    }

    // ll ans = 0;
    // for (int i = 0; i < l; ++i) {
    //     if (s[i] == 'D') {
    //         ans++;
    //     }
    // }
    // for (int i = 0; i < l - 1; ++i) {
    //     if (s[i] == 'P' && s[i + 1] == 'D') {
    //         ans++;
    //     }
    // }
    cout << s << "\n";

    return 0;

}

Measured memory_bytes: 3776
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007,mod2 = 998244353;

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}

int main() {
    ll a;
    string b;
    cin >> a;
    cin >> b;
    int tmp,tmp2,tmp3;
    tmp = (b[0]-'0');
    tmp2 = (b[2]-'0');
    tmp3 = (b[3]-'0');
    a = a*(tmp*100+tmp2*10+tmp3);
    cout << a/100 << endl;
    return 0;
}

Measured memory_bytes: 3600
a=[]
b=[]
op=[]
while(True):
    x,symbol,y = map(str,input().split())
    if symbol == "?":
        break
    else:
        a.append(int(x))
        b.append(int(y))
        op.append(symbol)
for i in range(len(a)):
    if op[i] == "+":
        print(a[i]+b[i])
    elif op[i] == "-":
        print(a[i]-b[i])
    elif op[i] == "*":
        print(a[i]*b[i])
    elif op[i] == "/":
        print(int(a[i]/b[i]))


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

using namespace std;
typedef long long ll;
#define REP(i,n) for (ll i = 0; i < (n); ++i)


struct mint{
    static const long long MOD = 1000000007;

    long long v;

    mint() : v(0) {}
    mint(long long x){
        x = x % MOD;
        if(x < 0){ x += MOD; }
        v = x;
    }
    mint& operator+=(mint a){
        v += a.v;
        if(v >= MOD){ v -= MOD; }
        return *this;
    }
    mint& operator*=(mint a){
        v *= a.v;
        v %= MOD;
        return *this;
    }
    mint& operator-=(mint a){
        v -= a.v;
        if(v < 0){ v += MOD; }
        return *this;
    }
    mint& operator/=(mint a){
        return (*this) *= a.inv();
    }

    mint operator*(mint a) const{
        return mint(v) *= a;
    }

    mint operator+(mint a) const {
        return mint(v) += a;
    }

    mint operator-(mint a) const {
        return mint(v) -= a;
    }

    mint operator/(mint a) const {
        return mint(v) /= a;
    }

    mint pow(long long k) const {
        mint res(1),tmp(v);
        while(k){
            if(k&1) res *= tmp;
            tmp *= tmp;
            k >>= 1;
        }
        return res;
    }
    mint inv(){return pow(MOD - 2); }

    static mint comb(long long n, int k){
        mint res(1);
        for(int i = 0; i < k; ++i){
            res *= mint(n - i);
            res /= mint(i + 1);
        }
        return res;
    }

    static mint factorial(long long n){
        mint res(1);
        for(int i = n; i > 1; --i){
            res *= mint(i);
        }
        return res;
    }

    bool operator<(const mint &a) const {
        return v < a.v;
    };
};

mint operator*(long long l, mint r){ return r * l; }

std::ostream& operator<<(std::ostream& stream, const mint& m){
    stream << m.v;
    return stream;
}


int main(){
    ll n;
    cin >> n;
    vector<ll> count(n, 0);
    REP(i, n){
        ll ai;
        cin >> ai;
        count.at(ai)++;
    }
    mint ans = 1;
    REP(i, n){
        if(count.at(i) > 2){
            cout << 0 << endl;
            return 0;
        }else if(count.at(i) == 0 && (n - i) % 2 != 0){
            cout << 0 << endl;
            return 0;
        }else if(count.at(i) > 0 && (n - i) % 2 == 0){
            cout << 0 << endl;
            return 0;
        }else if(count.at(i) == 1){
            if(i != 0 || n % 2 == 0){
                cout << 0 << endl;
                return 0;
            }
        }else if(count.at(i) == 2){
            ans *= 2;
        }
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(int i=st; i<ed; i++)
#define repn(i, st, ed) for(int i=st; i<=ed; i++)
#define repb(i, ed, st) for(int i=ed; i>=st; i--)

typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  =3.141592653589793238463;
const int N = 5e5 + 10;
const ll INF = 1LL << 60;

template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}


vector<int> g[N];
bool viss[N];
int vis[N];

// Normal DFS
void dfs(int curr, int par)
{
  for(auto x: g[curr])
    if(x != par)
      dfs(x, curr);
}

// DFS with visiting status
void dfs1(int curr, int par)
{
  viss[curr] = 1;
  for(auto x: g[curr])
    if(!viss[x])
      dfs1(x, curr);
}

// DFS with strongly connected component
void dfs2(int curr, int par, int num)
{
  vis[curr] = num;
  for(auto x: g[curr])
    if(vis[x] == 0 || vis[x] > (num+1))
      dfs2(x, curr, num+1);
}

// XOR from 0 to n
ll fxor(ll n)
{
  if(n < 0) return 0;
  if(n % 4 == 3) return 0;
  else if(n % 4 == 0) return n;
  else if(n % 4 == 1) return n^(n-1);
  else if(n%4 == 2) return n^(n-1)^(n-2);
}

// Power in logn with mod 1000000007
llt ppow(llt x, llt y)
{
  llt res = 1;
  while(y > 0){
    if(y&1)
      res = (res * x)%M;
    y = y >> 1;
    x = (x * x)%M;
  }
  return res;
}

// Factorial with dp
llt factdp[N];
llt fact(llt x)
{
  if(x == 0) return 1;
  if(x == 1) return 1;
  if(factdp[x] != 0) return factdp[x];
  return factdp[x] = (x*fact(x-1))%M;
}
// Combination
ll modcomb(ll n, ll r)
{
  if(n < r) return 0;
  ll res = fact(n);
  (res *= ppow(fact(r), M-2)) %= M;
  (res *= ppow(fact(n-r), M-2)) %= M;
  return res;
}

// String return to base b
string ansConv ="";
void convert10tob(llt N, int b)
{
     if (N == 0)
        return;
     int x = N % b;
     N /= b;
     if (x < 0)
        N += 1;
     convert10tob(N, b);
     ansConv += to_string(x);
     return;
}

// Convert string to num wiht base b
llt convertstrtob(string a, int b)
{
  llt aa = 0;
  llt mul = 1;
  for(int i=a.length()-1; i>=0; i--)
  {
    int curr = a[i] - '0';
    aa += (curr * mul);
    mul *= b;
  }
  return aa;
}

// Union Find
// Find()
int parent[N], ran[N];
int find(int x)
{
    if(parent[x]==x)return x;
    else return parent[x]=find(parent[x]);
}
// Union()
void unite(int x,int y){
    x=find(x);
    y=find(y);
    if(x==y)return;

    if(ran[x]<ran[y])
        parent[x]=y;
    else{
        parent[y]=x;
        if(ran[x]==ran[y])ran[x]++;
    }
}

// Main Code

int main()
{
  string s;
  cin>>s;
  cout<<s[0]<<s.length()-2<<s[s.length()-1]<<endl;
  return 0;
}


Measured memory_bytes: 14080
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_D main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions
ll digit_sum(ll n) {
    if (n < 10) return n;
    else return n%10 + digit_sum(n/10);
}
#endif


ll get_next_sunuke_num(ll x) {
    if (x < 9) return x + 1;

    x++;
    vl cands;
    string s = to_string(x);
    int N = s.size();

    FOR(i,1,N) {
        string t = s.substr(0, N - i) + string(i, '9');
        //cerr << t << endl;
        cands.push_back(stoll(t));
    }

    vector<pair<double, ll>> sn;
    for(ll i : cands){
        sn.push_back(pair<double,ll>(((double)i)/digit_sum(i), i));
    }
    sort(sn.begin(), sn.end());

    return sn[0].second;
}


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

    ll K; cin >> K;

    ll ans = 1;
    REP(i,K) {
        cout << ans << endl;
        ans = get_next_sunuke_num(ans);
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int[] a = new int[N];
   for(int i=0;i<N;i++) a[i] = sc.nextInt();
   Arrays.sort(a);
   int ans = 1;
   int tmp = a[0];
   for(int i =1;i<N;i++)
   {
     if(a[i]!= tmp)
     {
       tmp = a[i];
       ans++;
     }
   }
   
   if(ans%2==0) ans--;
   System.out.println(ans);
 }
}

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

int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    c -= (a + b);
    if (c > 0 && 4 * a * b < c * c) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

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

typedef pair<int, int> PI;

const int N = 2e5 + 5;

PI work[N];

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++ i) {
    cin >> work[i].second >> work[i].first;
  }
  sort(work, work + n);
  int last = 0;
  for (int i = 0; i < n; ++ i) {
    last += work[i].second;
    if (last > work[i].first) {
      puts("No");
      return 0;
    }
  }
  puts("Yes");
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define mset(a, b) memset(a, b, sizeof(a))
#define mcpy(a, b) memcpy(a, b, sizeof(a))
using namespace std;
typedef long long LL;

template <typename T> inline void read(T &AKNOI) {
	T x = 0, flag = 1;
	char ch = getchar();
	while (!isdigit(ch)) {
		if (ch == '-') flag = -1;
		ch = getchar();
	}
	while (isdigit(ch)) {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	AKNOI = flag * x;
}

inline void Edge(int u, int v) {
	printf("%d %d\n", u, v);
}

void solve() {
	int n; read(n);
	int x;
	for (x = 1; x < n; x <<= 1);
	if (x == n) {
		printf("No\n"); 
		return;
	}
	
	printf("Yes\n");
	for (int i = 2; i < n; i += 2) {
		Edge(1, i);
		Edge(i, i + 1);
		Edge(1, n + i + 1);
		Edge(n + i + 1, n + i);
	}
	Edge(n + 1, 3);
	
	if (n % 2 == 0) {
		for (int i = 2; i < n; ++i) {
			int j = n ^ i ^ 1;
			if (j != i && 2 <= j && j < n) {
				Edge(n, i + n * (i & 1));
				Edge(n + n, j + n * (j & 1));
				return;
			}
		}
	}
}

int main() {
	solve();
	return 0;
}


Measured memory_bytes: 2304
def main():
    import math
    a, b, x = map(int, input().split())
    if a * a * b >= x * 2:
        c = x * 2 / (b * a)
        print(math.degrees(math.atan(b / c)))
    else:
        d = 2 * (b - x / a / a)
        print(math.degrees(math.atan(d / a)))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int main()
{
	int N, M;
	cin >> N >> M;
	priority_queue<int> que;
	for (int i = 0; i < N; i++) {
		int A;
		cin >> A;
		que.push(A);
	}
	for (int i = 0; i < M; i++) {
		int num = que.top();
		que.pop();
		que.push(num / 2);
	}
	ll ans = 0;
	for (int i = 0; i < N; i++) {
		int num = que.top();
		que.pop();
		ans += num;
	}
	cout << ans << endl;
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n), b(n), c(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i] >> c[i];
  }
  vector<int> A(n, 0), B(n, 0), C(n, 0);
  A[0] = a[0];
  B[0] = b[0];
  C[0] = c[0];
  for (int i = 1; i < n; i++) {
    A[i] = a[i] + max(B[i - 1], C[i - 1]);
    B[i] = b[i] + max(C[i - 1], A[i - 1]);
    C[i] = c[i] + max(A[i - 1], B[i - 1]);
  }
  cout << max({A[n - 1], B[n - 1], C[n - 1]}) << '\n';
  return 0;
}

Measured memory_bytes: 5544
#include "bits/stdc++.h"
constexpr auto MAX = 10E9+1;
using namespace std;
using ll = long long;
using VI = vector<int>;

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

    if (x <= 599) {
        cout << "8\n";
    }
    else if (x <= 799) {
        cout << "7\n";
    }
    else if (x <= 999) {
        cout << "6\n";
    }
    else if (x <= 1199) {
        cout << "5\n";
    }
    else if (x <= 1399) {
        cout << "4\n";
    }
    else if (x <= 1599) {
        cout << "3\n";
    }
    else if (x <= 1799) {
        cout << "2\n";
    }
    else if (x <= 1999) {
        cout << "1\n";
    }

    return 0;
}


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

using namespace std;

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

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vvd = vector<vd>;
using vvvi = vector<vvi>;
using vvvll = vector<vvll>;
using vvvd = vector<vvd>;

const double pi=acos(-1);
const ll MOD=1e9+7;
const ll INF=(1LL<<60);

const int N=pow(10,6);
//Nは適宜変更
vector<bool> isp(N+1,true);
void sieve(){
    isp[0]=false;
    isp[1]=false;
    for (int i=2;pow(i,2)<=N;i++){ 
        if(isp[i]) for (int j=2;i*j<=N;j++)isp[i*j]=false;
    }
}

int main() {
    sieve();
    int d[100010];
    d[0]=0;
    d[1]=0;
    d[2]=0;
    for (int i=3;i<100001;i++){
        d[i]=d[i-1];
        if (isp[i] && isp[(i+1)/2]) d[i]+=1;
    }
    int q;
    cin>>q;
    rep(i,q){
        int r,l;
        cin>>l>>r;
        cout<<d[r]-d[l-1]<<endl;
    }
    

    return 0;
}

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

int solve(vector<int> arr,int n,int k){
	vector<int> dp(n+1);
	dp[1] = 0;
	for(int i=2;i<=n;i++){
		dp[i] = INT_MAX;
		for(int j=i-1;j>=1 && (i-j)<=k;j--){
			dp[i] = min(dp[i],abs(arr[i]-arr[j])+dp[j]);
		}
	}

	return dp[n];
}

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

	vector<int> arr(n+1);
	for(int i=1;i<=n;i++){
		cin>>arr[i];
	}

	cout<<solve(arr,n,k);

	return 0;
}

Measured memory_bytes: 4208
#include <bits/stdc++.h>
using namespace std;
// define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (((a)%mod) * ((b)%mod)) % mod
#define rollcall cout << "I'm Sucu." << endl;
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define dmt(x, y, z) make_tuple(x, y, z)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define fi first
#define se second
// debug
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p){
  os << "(" << p.first << "," << p.second << ")";return os;
}
template <typename T, typename U, typename V>
ostream &operator<<(ostream &os, const tuple<T, U, V> &t){
  os << "(" << get<0>(t) << "," << get<1>(t) << "," << get<2>(t) << ")";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  for (auto it = v.begin();it != v.end();++it){
    if(it != v.begin())os << " ";os << *it;
  }return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &mp){
  for(auto x: mp)os << "(" << x.first << "," << x.second << ")" << endl;
  return os;
}
template<typename T, int SIZE>
int array_length(const T (&)[SIZE]){return SIZE;}
template<typename T, int N>
void PRINTF(const T (&a)[N], int s = N, int t = -1, bool f = true){
	if(t == -1){rep(i,s){if(i)cout << " ";cout << a[i];}}
	else repi(i,s,t){if(i!=s)cout << " ";cout << a[i];}
	if(f)cout << "\n";
}
template<typename T, int N1, int N2>
void PRINTF(const T (&a)[N1][N2], int h = N1, int w = N2){
	rep(i,h){rep(j,w){cout << a[i][j] << " \n"[j==w-1];}}
}
string substr(const string &str, int S1, int S2 = -1){
  if(S2 == -1)return str.substr(S1);
  return str.substr(S1, S2-S1);
}
// typedef
typedef complex<double> Point;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef tuple<int, int, int> TT;
typedef pair<int, TT> PT;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;
// int sum = accumulate(a, a+n, 0LL);
// int mx = max_element(a, a+n);
// int mn = min_element(a, a+n);
// int cnt = count(a, a+n, k);

int x[4], y[4];
void rotate(int *dx, int *dy){
  int xx = -(*dy), yy = *dx;
  *dx = xx;*dy = yy;
}
signed main(){
  cin >> x[0] >> y[0] >> x[1] >> y[1];
  int xx = x[1], yy = y[1];
  int dx = x[1] - x[0], dy = y[1] - y[0];
  rotate(&dx, &dy);
  xx = xx+dx, yy = yy+dy;
  cout << xx << " " << yy << endl;
  
  dx = xx-x[1], dy = yy-y[1];
  rotate(&dx, &dy);
  xx = xx+dx, yy = yy+dy;
  cout << xx << " " <<yy << endl;
  return 0;
}






Measured memory_bytes: 256
import itertools
n,*abc=map(int,input().split())
l=[int(input()) for i in range(n)]
inf=100000000000000
mi=inf
for i in list(itertools.product([i for i in range(3)],repeat=n)):#(1)↓
    sub=[[] for j in range(3)]
    for j in range(n):
        sub[i[j]].append(j)
    mi_sub=0
    for j in range(3):
        l_sub=len(sub[j])
        if l_sub==0:#(2)
            mi_sub=inf
            break
        mi_subsub=inf
        for k in range(2**l_sub):#(3)↓
            mi_subsubsub=[0,0]
            for l_subsub in range(l_sub):#(5)↓
                if ((k>>l_subsub) &1):
                    mi_subsubsub[0]+=1
                    mi_subsubsub[1]+=l[sub[j][l_subsub]]
            if mi_subsubsub[0]!=0:#(4)
                mi_subsub=min(mi_subsub,abs(mi_subsubsub[1]-abc[j])+mi_subsubsub[0]*10-10)
        mi_sub+=mi_subsub
    mi=min(mi,mi_sub)
print(mi)

Measured memory_bytes: 3828
import java.io.*;
import java.util.*;
import static java.lang.System.*;

public class Main {
	static FastScanner sc = new FastScanner(System.in);
	public static void main(String[] args) {
		int[] prime = new int[1000000];
		for (int i=2; i<=999999; i++) {
			if (isPrime(i)) {prime[i] = 1;}
		}
		for (int i=2; i<=999999; i++) {
			prime[i] = prime[i]+prime[i-1];
		}
		while (sc.hasNext()) {
			out.println(prime[sc.nextInt()]);
		}
	}
	
	static boolean isPrime (int n) {
		if (n==2) {return true;}
		if (n<2 || n%2==0) {return false;}
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2) if(n%i==0){return false;}
		return true;
	}
}



class FastScanner implements Closeable {
	private final InputStream in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	public FastScanner(InputStream in) {this.in = in;}
	private boolean hasNextByte() {
		if (ptr < buflen) {return true;}
		else{
			ptr = 0;
			try {buflen = in.read(buffer);}
			catch (IOException e) {e.printStackTrace();}
			if (buflen <= 0) {return false;}
		}
		return true;
	}
	private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
	private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
	public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
	public String next() {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while(isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	public long nextLong() {
		if (!hasNext()) throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {throw new NumberFormatException();}
		while(true){
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			}else if(b == -1 || !isPrintableChar(b)){return minus ? -n : n;}
			else{throw new NumberFormatException();}
			b = readByte();
		}
	}
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) nl;
	}
	public double nextDouble() { return Double.parseDouble(next());}
	public void close() {
		try {in.close();}
		catch (IOException e) {}
	}
}


Measured memory_bytes: 28536
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ll n,m;
	cin>>n>>m;
	ll arr[m];
	for(ll i=0;i<m;i++)
	cin>>arr[i];
	ll sum=accumulate(arr,arr+m,0);
	//cout<<sum<<"\n";
	if((n-sum)<0)
	cout<<-1;
	else
	cout<<(n-sum);
	return 0;
}


Measured memory_bytes: 3664
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {

    int N;
    cin >> N;

    vector<int> H(N + 1);

    H[0] = 0;
    for (int i = 1; i <= N; ++i) {
        cin >> H[i];
    }

    int counter = 0;
    for (int i = 1; i <= N; ++i) {

        bool  topFlg = true;
        for (int j = 0; j < i; ++j) {
            if (H[j] > H[i]) {
                topFlg = false;
                break;
            }
        }

        if (topFlg) {
            ++counter;
        }
    }
    cout << counter;
}



Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;
 
int main() {
    int N; scanf("%d", &N);

    vector<int> A(N), B(N);
    ll pre = 0;
    for(int i=0; i<N; i++) {
        printf("? %d %d\n", 1, i+1);
        fflush(stdout);
        
        ll v; scanf("%lld", &v);
        A[i] = i - (v - pre);
        pre = v;
    }

    pre = 0;
    for(int i=N-1; i>=0; i--) {
        printf("? %d %d\n", i+1, N);
        fflush(stdout);

        ll v; scanf("%lld", &v);
        B[i] = v - pre;
        pre = v;
    }

    printf("!");
    for(int i=0; i<N; i++) printf(" %d", A[i] + B[i] + 1);
    printf("\n");
    fflush(stdout);
    return 0;
}



Measured memory_bytes: 288952
#!/usr/bin/env python3
import sys


def solve(X: int, N: int, p: "List[int]"):
    return min(filter(lambda x: x not in p, range(-1, 102)),
               key=lambda x: (abs(X-x), x))


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    p = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(solve(X, N, p))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()


Measured memory_bytes: 9204
#include<iostream>
using namespace std;
int main()
{
       unsigned short int a[3];
       for(int j=0;j<3;j++)
       {
           int k;
           cin>>k;
           if(k>=1&&k<=100)
            a[j]=k;
           else
            exit(0);
       }
        int t=a[0];
         a[0]=a[1];
         a[1]=t;
        int t2=a[0];
         a[0]=a[2];
         a[2]=t2;
         for(int y=0;y<3;y++)
            cout<<a[y]<<" ";
            cout<<"\n";

return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string a,b;
int ans=0;
int main()
{
	cin>>a;
	b="CODEFESTIVAL2016";
	for(int i=0;i<16;i++)
	{
		if(a[i]!=b[i])
			ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
from collections import deque

N, M = map(int, input().split())

room = [[] for i in range(N)]
temp = [0 for i in range(N)]
for i in range(M):
    A, B = map(int, input().split())
    room[B - 1].append(A - 1)
    room[A - 1].append(B - 1)

way = [0 for i in range(N)]
way[0] = 1
que = deque([0])

while True:
    if len(que) == 0:
        break
    a = que.popleft()
    for i in room[a]:
        if way[i] == 0:
            way[i] = a + 1
            que.append(i)

if 0 in way:
    print("No")
else:
    print("Yes")
    for i in way[1:]:
        print(i)

Measured memory_bytes: 38672
#include <iostream>
#include <string>
using namespace std;
int main(void){
    int siz,time;
    string name;
    while(true){
        cin>>name;
        if(name[0]=='-')break;
        cin>>time;
        for(int abc=0;abc<time;abc++){
            cin>>siz;
            name=name.substr(siz)+name.substr(0,siz);
        }
        cout<<name<<endl;
    }
     
}


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

int main(void){
  int N, Alice = 0, Bob = 0;
  int a[100];
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> a[i];
  }
  //ソートして奇数番目の数字の和を求める
  sort(a, a + N, greater<int>());
  for(int i = 0; i < N; i++){
    if(i % 2 == 0){Alice += a[i];}
    else {Bob += a[i];}
  }
  cout << Alice - Bob << endl;
  return 0;
}


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

  int S = 0;
	string ans;

int main(){
  cin >> ans;
  if(ans[0] == '1'){
    S++;
}
    if(ans[1] == '1'){
    S++;
}
    if(ans[2] == '1'){
    S++;
}
  cout<<S<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

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

    for (int i = 1; i <= 3; i++)
    {
        if (i != a && i != b)
        {
            cout << i << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
//イントとダブルが入り乱れるときはどちらかに統一しよう。

int max(int x,int y){
  if(x>y) return x;
  return y;
}

int min(int x,int y){
  if(x<y) return x;
  return y;
}

int sumofdigits(int n){
  int sum=0;
  while(n>0){
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main(){
  int n,count=100000000,res;
  cin >> n;
  for(int a=1; a<n ; a++){
    res=sumofdigits(a)+sumofdigits(n-a);
    count=min(res,count);
  }
  cout << count << endl;
}


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

map<long long, int> prime_factor(long long N){
    map< long long, int> ret;
    for(long long n = 1; n <= N; n++){
        ll tmpn = n;
        for(long long i = 2; i * i <= n; i++){
            while(tmpn % i == 0){
                ret[i]++;
                tmpn /= i;
            }
        }
        if(tmpn != 1) ret[tmpn]++;
    }
    return ret;
}

int main(){
    ll N; cin >> N;
    map<ll,int> ret = prime_factor(N);
    int cnt = 0;
    for(auto e: ret){
        for(auto f: ret){
            if(e == f) continue;
            for(auto g: ret){
                if(e == g || f == g) continue;
                
                if(e.second >= 2 && f.second >= 4 && g.second >= 4) cnt++;
            }
        }
    }
    cnt /= 2;

    for(auto e: ret){
        for(auto f: ret){
            if(e == f) continue;

            if(e.second >= 14 && f.second >= 4) cnt++; 
        }
    }

    for(auto e: ret){
        for(auto f: ret){
            if(e == f) continue;

            if(e.second >= 24 && f.second >= 2) cnt++;
        }        
    }

    for(auto e: ret){
        if(e.second >= 74) cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
N, M = gets.split.map(&:to_i)
A = gets.split.map(&:to_i)
BC_pre = []
M.times do
  line = gets.split.map(&:to_i)
  BC_pre << line
end
A.sort!
BC = BC_pre.sort_by {|k, v| v }

ind = 0
BC.reverse_each do |bc|
  count = bc[0]
  while count > 0 and ind < N
    if A[ind] >= bc[1]
      ind += 1
    else 
      A[ind] = bc[1]
      ind += 1
      count -= 1
    end
  end
end

p A.inject(:+)

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

#define loop(i, n) for(int i = 0;i < int(n);i++)
#define rloop(i, n) for(int i = int(n);i >= 0;i--)
#define range(i, a, b) for(int i = int(a);i <= int(b);i++)
#define sz(c) int(c.size())
#define clr(v, d)   memset(v, d, sizeof(v))
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define INF             INT64_MAX
#define NINF            INT64_MIN

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<pll> vll;
typedef vector<ll> vl;

string neg2base(ll num)
{
    string res="";
    while(num!=0)
    {
        ll rem=num%(-2);
        num=num/(-2);
        if(rem<0)
        {
            num++;
            rem+=1;
        }
        res=to_string(rem)+res;

    }
    return res;
}
ll vis_row[101];
ll vis_col[101];
int main()
{
    //    std::ios_base::sync_with_stdio(false);
    //    cin.tie(NULL);
    //    cout.tie(NULL);

    //    freopen("popcorn.in", "r", stdin);

    //    ll t;
    //    cin>>t;
    //    while(t--)
    //    {
    ll n,m;
    cin>>n>>m;
    vector<string> lines(n);
    for(int i=0;i<n;i++)
        cin>>lines[i];

    for(int i=0;i<n;i++)
    {

        for(int j=0;j<m;j++)
        {
            if(lines[i][j]!='.')
            {
                vis_col[j]=true;
                vis_row[i]=true;
            }
        }
    }
    for(int i=0;i<n;i++)
    {

        for(int j=0;(j<m)&&(vis_row[i]);j++)
        {
            if(vis_col[j])
                cout<<lines[i][j];
        }
        if(vis_row[i])
            cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    // 整数の入力
    int n;
    cin >> n;
    n = n%100;
    n = n%10;
    if(n==2 || n==4 || (n>=5 && n%2==1) )
      cout << "hon" << endl;
    else if( n==1 || n%2==0)
      cout << "pon" << endl;
    else
      cout << "bon" << endl;
    return 0;
}

Measured memory_bytes: 3120
d='URLD'
*y,s,t=open(0).read().split()
h,w,n,r,c=map(int,y)
b=[h,w,w,h]
o=[h-r+1,c,w-c+1,r]
a=0
for i,j in enumerate(d):
  x=o[i]
  for k in range(n):
    x+=(s[k]==j)
    a|=x>b[i]
    x-=(dict(zip(d,d[::-1]))[t[k]]==j)*x>1
print('YNEOS'[a::2])

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

int main() {
  int e, y;
  cin >> e >> y;
  if (e == 0) {
    if (y >= 1989) cout << "H" << y - 1988;
    else if (y >= 1926) cout << "S" << y - 1925;
    else if (y >= 1912) cout << "T" << y - 1911;
    else cout << "M" << y - 1867;
  }
  else if (e == 1) cout << 1867 + y;
  else if (e == 2) cout << 1911 + y;
  else if (e == 3) cout << 1925 + y;
  else cout << 1988 + y;
  cout << "\n";
}


Measured memory_bytes: 3104
#include<set>
#include<map>
#include<deque>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<bitset>
#include<string>
#include<vector>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<complex>
#include<iostream>
#include<algorithm>
#define ll long long
#define lowbit(x) x&(-x)
using namespace std;

const int maxn = 210000;

int n,K;
int a[maxn];
struct node{int t,k;ll x;}s[maxn<<1]; int sn;
inline bool cmp(const node x,const node y){return x.x==y.x?x.k>y.k:x.x>y.x;}

int tr[maxn];
void add(int x){for(;x<=n;x+=lowbit(x))tr[x]++;}
int query(int x){int re=0;for(;x;x-=lowbit(x))re+=tr[x];return re;}

ll ans=0;

int main()
{
	scanf("%d%d",&n,&K); for(int i=1;i<=n;i++) scanf("%d",&a[i]),a[i]-=K;
	
	ll now=0;
	s[++sn]=(node){0,0,0};
	for(int i=1;i<=n;i++)
	{
		now+=a[i];
		s[++sn]=(node){i,0,-now};
		s[++sn]=(node){i,1,-now+a[i]};
	}sort(s+1,s+sn+1,cmp);
	
	for(int i=1;i<=sn;i++)
	{
		if(s[i].k) add(s[i].t);
		else ans+=query(s[i].t);
	}
	printf("%lld\n",ans);
	
	return 0;
}


Measured memory_bytes: 8448
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <istream>
#include <map>
#include <set>
#include <queue>
#define rep0(i,n) for (int i = 0; i <= (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define REP(a,b) for (int i = a; i <= (b); ++i) 
#define mREP(a,b) for (int i = a; i == (b); --i) 
typedef long long ll;
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
/*
	　　　  　 ,ﾍ／L──- 、
	　　　   　Lﾆ)r_」=＝= ｲ
	　　 　,ﾍ、i ﾉノλﾉﾊﾉﾍ
	　　   ,'　｀(ﾊﾘ ﾟ ヮﾟﾉi)　',
	　　 .i　　 >〈(つ,i!と)　　i
	　　  vﾍγk´_/___i,ゝﾍノ
	　　　　　 ｀ﾞr_,ｨ_ｧﾞ´
*/
  string s;
  long long a;
  cin>>s>>a;
  rep0(i,a-1){
    if(s[i] != '1'){cout<<s[i]<<endl;
              return 0;     
                   }
    }
  cout<<1<<endl;
  
return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
#define INF      (int)1e9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
typedef pair<int,int> pii;
template<class Type_a,class Type_b> bool chmax(Type_a &a,const Type_b &b){if(a<b){a=b;return true;}return false;}
template<class Type_a,class Type_b> bool chmin(Type_a &a,const Type_b &b){if(a>b){a=b;return true;}return false;}
template<class Type> Type igcd(Type x,Type y){if(x==0||y==0)return (x>y)?x:y;return (y%x)?igcd(y%x,x):x;}
template<class Type> Type ilcm(Type x,Type y){return x/igcd(x,y)*y;}
template<class Type> void line(const Type &a){int cnt=0;for(const auto &elem:a){if(cnt++)cout<<' ';cout<<elem;}cout<<endl;}

int main(){
	int n;
	cin>>n;
	
	REP(i,n){
		int a;
		cin>>a;
		
		if(a%2==0){
			if(a%3==0 or a%5==0){}
			else{
				cout<<"DENIED"<<endl;
				return 0;
			}
		}
	}
	
	cout<<"APPROVED"<<endl;
}

Measured memory_bytes: 768
s = gets.chomp
t = gets.chomp

try_count = s.length - t.length
try_count += 1 if try_count == 0

answer = s.length 
try_count.times do |count|

  diff = 0
  t.length.times do |i|
    #puts "#{s[i+count]} #{t[i]}"
    if s[i+count] != t[i]
      diff += 1
    end
  end

  answer = diff if diff < answer
end

puts answer


Measured memory_bytes: 14308
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
    string s;
    int a=0;
    cin>>s;
    for(int i=0;i<3;i++){
        if(s[i]=='1')
            a++;
    }
    cout<<a<<endl;
    return 0;
}


Measured memory_bytes: 256
info = Array.new(4){Array.new(3){Array.new(10, 0)}}

n = gets.chomp.to_i
for i in 1..n do
  b,f,r,v = gets.chomp.split(" ").map{|x| x.to_i}
  info[b-1][f-1][r-1] += v
end

for b in 1..4 do
  if b!=1
    printf("%s\n","#"*20)
  end
  for f in 1..3 do
    for r in 1..10 do
      printf(" %d",info[b-1][f-1][r-1])
    end
    printf("\n")
  end
end


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

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

Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
    int W, H, x, y, r;
    scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
    if((x - r >= 0 && x + r <= W) && (y - r >= 0 && y + r <= H) )
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }
    return 0;
}    


Measured memory_bytes: 2100
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100000;

int main() {
	cout << fixed << setprecision(15);
	int w, h, x, y;
	cin >> w >> h >> x >> y;
	cout << ((double)w * h) / 2.0 << ' ' << ((w == 2 * x) && (h == 2 * y)) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
    int date;
    cin >> date;
    switch(date%7){
        case 4:
        cout<<"mon";
        break;
        case 5:
        cout <<"tue";
        break;
        case 6:
        cout << "wed";
        break;
        case 0:
        cout << "thu";
        break;
        case 1:
        cout << "fri";
        break;
        case 2:
        cout << "sat";
        break;
        case 3:
        cout << "sun";
        break;
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3096
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>
#define pb push_back
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define rep(i,n) for(int i=0;i<n;i++)
#define INF (1<<30)
#define LLINF (1LL<<60)
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main(){
    string t;
    cin>>t;
    if(t=="ABC")cout<<"ARC";
    else cout<<"ABC";
    return 0;
}


Measured memory_bytes: 3628
import java.io.*;
import java.util.*;

public class Main {

	static long m = (long) (1e9 + 7);

	public static void main(String[] args) throws IOException {
		Scanner scn = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = scn.nextInt();
		int x = scn.nextInt();
		if (n * 500 >= x) {
			System.out.println("Yes");
		} else
			System.out.println("No");
	}

	static class Scanner {

		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
	}
}

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

int main() {
    int N,K;
    
    ll sum = 0;
    
    cin >> N >> K;
    
    vector<ll> A(N);
    
    if(K>=N){
    cout << 0 << endl;
    }
    else{

    for(int i=0;i < N;i++){
        cin >> A[i];
    }
    
    sort(A.begin(),A.end());
    reverse(A.begin(),A.end());
    
    for(int i=0;i<K;i++){
        A[i] = 0;
    }
    
    for(int i=K;i<N;i++){
        sum += A[i];
    }
    
    cout << sum << endl;
    }
    
}







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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T1, class T2> inline void minup(T1& m, T2 x){ if(m>x) m=static_cast<T2>(x); }
template<class T1, class T2> inline void maxup(T1& m, T2 x){ if(m<x) m=static_cast<T2>(x); }

#define INF 1000000000
#define MOD 1000000009
#define EPS 1E-9

int a[4];
int b[4];
bool used[2][4];

int main()
{
  while(cin >> a[0]){
    rep(i, 3) cin >> a[i+1];
    rep(i, 4) cin >> b[i];

    int hit = 0;
    int blow = 0;
    rep(i, 4) used[0][i] = used[1][i] = false;
    rep(i, 4) if(a[i] == b[i]) hit += 1,  used[0][i] = used[1][i] = true;
    rep(i, 4) rep(j, 4) if(a[i] == b[j] && !used[0][i] && !used[1][j]) blow += 1;

    cout << hit << " " << blow << endl;
  }

  return 0;
}

Measured memory_bytes: 1160
use proconio::input;

#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars, Usize1};
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::ops::*;

#[derive(Clone, Debug, Default)]
struct Struct;



//#[proconio::fastout]
fn main() {
    input! {
        h:usize,
        w:usize,
        m:usize,
        mut hw:[(Usize1,Usize1);m],
    }

    let mut hm:HashMap<(usize,usize),usize> = HashMap::new();
    for i in 0..m {
        hm.insert(hw[i],i);
    }

    let mut hct = vec![(0,0);h]; // (i,ct)
    let mut wct = vec![(0,0);w]; // (j,ct)
    for i in 0..h {
        hct[i].0 = i;
    }
    for i in 0..w {
        wct[i].0 = i;
    }

    for i in 0..m {
        hct[hw[i].0].1 += 1;
        wct[hw[i].1].1 += 1;
    }

    let mut ans = 1;
    hct.sort_by_key(|x|300000-x.1);
    wct.sort_by_key(|x|300000-x.1);


    for i in 0..h {
        for j in 0..w {
            let mut ct = hct[i].1 + wct[j].1;
            if ct <= ans {
                break;
            }
            if let Some(_k) = hm.get(&(hct[i].0, wct[j].0)) {
                ct -= 1;
            }
            ans = max( ans, ct );
        }
    }

    println!( "{}", ans);

}


Measured memory_bytes: 35924
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
using namespace std;
#define INF 0x3f3f3f3f
//#define INF 0x3f3f3f3f3f3f3f3f
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=100050;
//ここまでテンプレ
int main(){
	int N;
	cin>>N;
	int alpha,beta;
	cin>>alpha>>beta;
	vector<tint> A;
	for(int i=0;i<N;i++){
		int a,b,c;
		cin>>a>>b>>c;
		A.pb(mt(a,b,c));
	}
	int DP[41][450][450]={};
	for(int i=0;i<41;i++)
		for(int j=0;j<450;j++)
			for(int k=0;k<450;k++)
				DP[i][j][k]=INF;
	DP[0][0][0]=0;
	for(int i=0;i<N;i++){
		int a,b,c;
		tie(a,b,c)=A[i];
		for(int j=0;j<401;j++){
			for(int k=0;k<401;k++){
				DP[i+1][j][k]=min(DP[i+1][j][k],DP[i][j][k]);
				DP[i+1][j+a][k+b]=min(DP[i+1][j+a][k+b],DP[i][j][k]+c);
			}
		}
	}
	int ans=INF;
	for(int C=1;alpha*C<=400 && beta*C<=400;C++){
		ans=min(ans,DP[N][alpha*C][beta*C]);
	}
	if(ans==INF)
		cout<<-1<<endl;
	else
		cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 32640
#include <bits/stdc++.h>
using namespace std;
int n , a[16];
int x[16][16] , y[16][16];
inline bool check(int k) {
	for(int i = 1; i <= n; ++i) {
		if(!(k & (1 << (i - 1)))) continue;
		for(int j = 1; j <= a[i]; ++j)
			if(((k >> (x[i][j] - 1)) & 1) ^ y[i][j]) return false;
	}
	return true;
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin >> n;
	for(int i = 1; i <= n; ++i) {
		cin >> a[i];
		for(int j = 1; j <= a[i]; ++j) {
			cin >> x[i][j];
			cin >> y[i][j];
		}
	}
	int tot = (1 << n);
	int ans = 0;
	for(int i = 0; i < tot; ++i) {
		if(check(i))
			ans = max(ans , __builtin_popcount(i));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#![allow(unused_imports)]

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::cmp::{min, max};
use std::collections::{HashMap, HashSet, VecDeque, BinaryHeap};

fn main() {
    input!{
        x: chars,
        y: chars
    }
    if x[0] < y[0] {
        println!("<");
    } else if x[0] > y[0] {
        println!(">");
    } else {
        println!("=");
    }
}


Measured memory_bytes: 4352
from bisect import bisect
from bisect import bisect_left

_ = input()
l = input()
l = sorted(list(map(int, l.split())))
count = 0
n = len(l)

for i in range(n):
	for j in range(i+1, n):
		
		count += bisect_left(l,l[i]+l[j]) - (j+1)

print(count)


Measured memory_bytes: 3188