akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<stack>
#include<vector>
#include<list>
#include<math.h>
using namespace std;

#define ll long long
#define vecint vector<int>
#define listint list<int>

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

#define INF 1000000007;

int main(){
  int N;
  list<int> A;
  ll ans=1;
  cin>>N;
  rep(i,N){
    int x;
    cin>>x;
    A.push_back(x);
  }
  A.sort();
  int i;
  if(N%2==0){
    i=1;
  }else{
    i=0;
  }
  
  list<int>::iterator it=A.begin();
  bool check=true;
  for(int j=i;j<N;j+=2){
    rep(k,2){
      if(*it!=j){
        check=false;
      }
      it++;
      if(j==0){
        break;
      }
    }
    if(check==false) break;
  }

  if(check){
    while(N-2>=0){
      ans*=2;
      ans%=INF;
      N-=2;
    }
  }else{
    ans=0;
  }

  print(ans);

  return 0;
}


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

using namespace std;
using ll = long long;
using ld = long double;
using Vec = vector<int>;


int main() {

ll H,W;
 cin >> H >> W;

if(H == 1 || W == 1){
cout << 1 << endl;
} 
else {
 cout << (H * W + 1) / 2 << endl;
 }

 
}

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

int main()
{
    int x,n,i,y1,y2,ans,j,flag,z;
    cin>>x>>n;
    int p[n];
    for (i = 0; i < n; i++) cin>>p[i];
    z=p[0];
    for (i = 1; i < n; i++) z=max(z,p[i]);
    y1=x;
    ans=0;
    z=max(z+1,x);
    for (i = 1; i <= z; i++)
    {
        flag=0;
        for (j = 0; j < n; j++)
        {
            if (p[j]==i)
            {
                flag=1;
                break;
            }
        }
        if (flag==0)
        {
            y2=abs(x-i);
            if (y2<y1)
            {
                y1=y2;
                ans=i;
            }
        }
    }
    cout<<ans<<endl;
}

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

using lint = long long;

// const int max_value = (int)1e5+10;
// int knapsack2(int n, int limit, vector<lint> &v, vector<lint> &w) {
//     vector<lint> dp(max_value, 2e18); dp[0] = 0;
//     for (int i = 0; i < n; ++i) 
//         for (int j = max_value - v[i] - 1; j >= 0; --j)   
//             dp[j + v[i]] = min(dp[j + v[i]], dp[j] + w[i]);
//     for (int i = max_value-1; i >= 0; --i)
//         if (dp[i] <= total) return i;
// }

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n, t;
    cin >> n >> t;
    vector<lint> w(n);
    vector<int> values(n);
    for (int i = 0; i < n; ++i) cin >> w[i] >> values[i];
    constexpr int limit = int(1e5) << 1;
    vector<lint> dp(limit, 1LL << 60);
    dp[0] = 0;
    for (int i = 0; i < n; ++i)
    	for (int j = limit - values[i] - 1; j >= 0; --j)
    		dp[j + values[i]] = min(dp[j+values[i]], dp[j] + w[i]);
    for (int i = limit-1; i >= 0; --i)
    	if (dp[i] <= t) {
    		cout << i << '\n';
    		exit(0);
    	}
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N,K;
  cin >>N>>K;
     vector<int> l(N);
   for (int i = 0; i < N; i++) {
    cin >> l.at(i);
  }
  sort(l.begin(), l.end());
  reverse(l.begin(), l.end());
  int count=0;
   for (int i = 0; i < K; i++) {
    count +=l[i];
  }
  cout<<count<<endl;
}


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

#define rep(i, a, b) for (ll i = a; i < b; i++)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef unordered_map<string, ll> u_map;

// input
void input() {}
template <class Head, class... Tail>
void input(Head &&a, Tail &&... b)
{
    cin >> a;
    input(forward<Tail>(b)...);
}

template <class V>
void input(vector<V> &v)
{
    for_each(v.begin(), v.end(), [](auto &i) { input(i); });
}

// output
template <class V>
void output(vector<V> &v)
{
    for_each(v.begin(), v.end(), [](auto &x) { cout << x << " "; });
    cout << endl;
}

// math functions
ll mpow(ll a, ll n, ll p)
{
    ll x = 1;
    while (n > 0)
    {
        if (n & 1)
        {
            x = a * x % p;
        }
        a = a * a % p;
        n >>= 1;
    }

    return x;
}

ll mfact(ll n, ll p)
{
    ll res = 1;
    for (ll i = 2; i <= n; i++)
    {
        res = res * i % p;
    }
    return res;
}

ll mcomb(ll n, ll r, ll p)
{
    if (n == 0 && r == 0)
    {
        return 1;
    }
    if (n < r || n < 0 || r < 0)
    {
        return 0;
    }

    ll a = mfact(n, p);
    ll b = mfact(n - r, p);
    ll c = mfact(r, p);
    return (((a * mpow(b, p - 2, p)) % p) * mpow(c, p - 2, p)) % p;
}

ll gcd(ll a, ll b)
{
    if (a < b)
    {
        a ^= b;
        b ^= a;
        a ^= b;
    }
    return b ? gcd(b, a % b) : a;
}

ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}

int main()
{
    ll N, M;
    input(N, M);

    string a(N, ' ');
    rep(i, 0, M)
    {
        ll s, c;
        input(s, c);
        if (s == 1 && c == 0)
        {
            cout << (N == 1 ? 0 : -1) << endl;
            return 0;
        }

        if (a[s - 1] != ' ' && (a[s - 1] - '0') != c)
        {
            cout << -1 << endl;
            return 0;
        }

        if (a[s - 1] == ' ')
        {
            a[s - 1] = c + '0';
        }
    }

    rep(i, 0, N)
    {
        if (a[i] == ' ')
        {
            if (i == 0)
            {
                a[i] = N == 1 ? '0' : '1';
            }
            else
            {
                a[i] = '0';
            }
        }
    }

    cout << a << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<iomanip>
#include <string>
#include<vector>
#include<algorithm>
#include<utility>
#include<queue>
#include<math.h>
#include<stack>
#include<set>
#include<map>
#define INF  int(1e6+1)
#define rep(i,n,m) for(int i=n;i<m;i++)

using namespace std;

int ans(int x,int count) {
	int t = 0;
	int c = count;
	int xi = x;
	while (xi > 0) {
		if (xi % 2)t++;
		xi = (xi - xi % 2) / 2;
	}
	x = x % t;
	c++;
	if (x != 0)return ans(x, c);
	else return c;
}

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

	int count = 0;
	char c;
	vector<int>a(n);
	rep(i, 0, n) {
		cin >> c;
		a[i] = c - '0';
		if (a[i] == 1)count++;
	}
	int npop = 0, ppop = 0;
	rep(i, 0, n) {
		if (count > 1)npop = (npop * 2 + a[i]) % (count - 1);
		ppop = (ppop * 2 + a[i]) % (count + 1);
	}

	vector<int>np(n), pp(n);
	np[n - 1] = 1;
	pp[n - 1] = 1;
	for (int i = n - 1; i != 0; i--) {
		if(count>1)np[i - 1] = (np[i] * 2) % (count - 1);
		pp[i - 1] = (pp[i] * 2) % (count + 1);
	}
	rep(i, 0, n) {
		int x, X = 1;
		if (a[i] == 0) {
			x = (pp[i] + ppop) % (count + 1);
		}
		else if (count > 1) {
			x = (count - 1 - np[i] + npop) % (count - 1);
		}
		else {
			X = 0;
			x = 0;
		}
		if (x == 0)cout << X << endl;
		else cout << ans(x, X) << endl;

	}
}




Measured memory_bytes: 5608
#!/usr/local/gnu/bin/bash
read n m
a=(`tr ' ' 'x' | sed -r "s/$/x/g"`)
c=0
for i in `seq $m`
do
    ((`echo ${a[@]} | tr ' ' '\n' | grep x${i}x | wc -l`==n)) && c=$((c+1))
done
echo $c


Measured memory_bytes: 1388
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    int64 n;
    cin >> n;
    int64 ans = 0;
    for (int64 i=0; i<=n; i++) {
        if (i%3 == 0 || i%5 == 0) continue;
        ans += i;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3164
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

int main() {
    ll A, V, B, W, T;
    cin >> A >> V >> B >> W >> T;
    ll diff = (V - W);
    if(abs(A-B) <= diff*T){
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 3620
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <cctype>    // isupper, islower, isdigit, toupper, tolower
#include <cstdint>   // int64_t, int*_t
#include <cstdio>    // printf
#include <deque>     // deque
#include <iomanip>
#include <iostream> // cout, endl, cin
#include <map>      // map
#include <math.h>
#include <numeric>
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <string>        // string, to_string, stoi
#include <tuple>         // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility>       // pair, make_pair
#include <vector>        // vector
using namespace std;
#define _GLIBCXX_DEBUG
#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++)
const int INF = 1001001001;
const int BG = 1000000007;

int main()
{
    int N;
    cin >> N;
    vector<int> h(N);
    vector<int> dp(N, INF);
    rep(i, N) cin >> h[i];
    dp[0] = 0;
    rep(i, N - 1)
    {
        dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]));
        dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]));
    }
    // for (int i : dp)
    // {
    //     cout << i << " ";
    // }
    // cout << endl;
    cout << dp[N - 1] << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <queue>
#include <string>
using namespace std;
priority_queue <int> s;
int main() {
	string a;
	while (1) {
		cin >> a;
		if (a=="end") break;
		else if (a=="insert") {
			int x;
			cin >> x;
			s.push(x);
		} else {
			cout << s.top() << endl;
			s.pop();
		}
	}
	return 0;
}


Measured memory_bytes: 7048
A, B = map(int, input().split())
ans = 0
for i in range(A, B + 1):
    s = str(i)
    f = True
    for j in range(len(s) // 2):
        # print(s[j], s[-j])
        if s[j] != s[-(j+1)]:
            f = False
    # print(i)
    if f:
        
        ans += 1
print(ans)
# else:
#     for j in range(len(s) //2):


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

// int/long:		-2,147,483,648 - 2,147,483,648 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define	INF (1<<29)
//536,870,912

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

#define	MOD 1000000007

int	main() {
	string S;
	int X, Y;
	cin >>S >>X >>Y;
	vector<int> x, y;
	int i=0;
	int X0=0;
	while((i<S.size())&&('F'==S.at(i)))
		i++;
	X -=i;
	if (i==S.size()) {
		if ((X==0)&&(Y==0)) {
			cout <<"Yes" <<endl;
		} else {
			cout <<"No" <<endl;
		}
		return 0;
	}
	int phase=0;
	while(true) {
		if (0==phase) {
			if ('F'==S.at(i))
				x.back()++;
			else {
				phase=1;
				y.push_back(0);
			}
		} else {
			if ('F'==S.at(i))
				y.back()++;
			else {
				phase=0;
				x.push_back(0);
			}
		}
		i++;
		if (i==S.size())
			break;
	}
	sort(x.begin(), x.end());
	reverse(x.begin(), x.end());
	sort(y.begin(), y.end());
	reverse(y.begin(), y.end());
	int XX=X0;
	for (int i=0; i<x.size(); i++)
		XX +=x.at(i);
	int YY=0;
	for (int i=0; i<y.size(); i++)
		YY +=y.at(i);
	vector<bool> xx(XX*2+1, false);
	vector<bool> yy(YY*2+1, false);
	xx.back()=true;
	yy.back()=true;
	X +=XX;
	Y +=YY;
	if ((X<0)||(X>=xx.size())||(Y<0)||(Y>=yy.size())) {
		cout <<"No" <<endl;
		return 0;
	}
	for (int i=0; i<x.size(); i++) {
		for (int j=X+1; j<xx.size(); j++) {
			if (xx.at(j)) {
				if (j-x.at(i)*2>=X) {
					xx.at(j-x.at(i)*2)=true;
				}
			}
		}
		if (xx.at(X))
			break;
	}
	if (!xx.at(X)) {
		cout <<"No" <<endl;
		return 0;
	}
	for (int i=0; i<y.size(); i++) {
		for (int j=Y+1; j<yy.size(); j++) {
			if (yy.at(j)) {
				if (j-y.at(i)*2>=Y) {
					yy.at(j-y.at(i)*2)=true;
				}
			}
		}
		if (yy.at(Y))
			break;
	}
	if (yy.at(Y)) {
		cout <<"Yes" <<endl;
		return 0;
	} else {
		cout <<"No" <<endl;
		return 0;
	}
	return 0;
}



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

int main()
{
    int a_hel, a_atk, b_hel, b_atk;
    cin >> a_hel >> a_atk >> b_hel >> b_atk;

    while (a_hel > 0 && b_hel > 0)
    {
        b_hel -= a_atk;
        a_hel -= b_atk;
    }

    if (b_hel <= 0)
        cout << "Yes";
    else
        cout << "No";
}

Measured memory_bytes: 3616
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#define pai 3.1415926535


int main(void) {
	int a, b;
	scanf("%d%d", &a, &b);
	int c;
	if (a < 0 && b < 0) {
		c = b - a;
		if (c % 2 == 0) {
			printf("Negative");
		}
		else {
			printf("Positive");
		}
	}
	else if (a <= 0 && b>=0) {
		printf("Zero");
	}
	else if (a > 0 && b > 0) {
		printf("Positive");
	}



	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	void run() {
		Scanner sc = new Scanner(System.in);

		int n = sc.next().length();
		for (int i = 0; i < n; i++) {
			System.out.print("x");
		}
		System.out.println();
	}

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


Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    int n;
    cin>>n;
        int arr[n];
        for(int i=0;i<n;i++){
            cin>>arr[i];
        }
        sort(arr,arr+n);
        bool flag=true;
        ll alice=0,bob=0;
        for(int i=0;i<n;i++){
            if(flag){
                alice+=arr[i];
                flag=false;
            
            }
            else {
                bob+=arr[i];
                flag=true;
            
            }
        }
    
        cout<<abs(alice-bob)<<endl;

    return 0;
    }


Measured memory_bytes: 256
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pint;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define Rep(i, n) for(ll i = 1; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fac[MAX], finv[MAX], inv[MAX];


template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }

}
ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


ll GCD(ll a,ll b) {
  return b ? GCD(b,a%b) : a;
}


ll LCM(ll a,ll b){
  return a/GCD(a,b)*b;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

void runlength(string s,vector<pair<char,ll>> &p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
}




ll COM(ll n,ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

const int MAX_N=100010;
vector<bool> sieve_of_eratosthenes(){
  vector<bool> isPrime(MAX_N+1,true);
  for(int i=2;i<=MAX_N;i++){
    if(isPrime[i]){
      for(int j=2*i;j<=MAX_N;j+=i){
        isPrime[j]=false;
      }
    }
  }
  return isPrime;
}

vector<pint> prime_factorize(ll n){
  vector<pint> ans;
  for(ll p=2;p<=sqrt(n);p++){
    if(n%p!=0) continue;
    ll cnt=0;
    while(n%p==0){
      n/=p;
      cnt++;
    }
    ans.push_back(make_pair(p,cnt));
  }
  if(n!=1) ans.push_back(make_pair(n,1));
  return ans;
}

/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  ll n,k;
  cin>>n>>k;
  vector<ll> v(n);
  rep(i,n) cin>>v[i];
  vector<ll> tmp(n+1);
  tmp[0]=0;
  rep(i,n) tmp[i+1]=tmp[i]+v[i];
  vector<ll> ans(n-k+1);
  rep(i,n-k+1) ans[i]=tmp[i+k]-tmp[i];
  ll ans2=0;
  rep(i,n-k+1) chmax(ans2,ans[i]);
  cout<<setprecision(7)<<(double)(k+(ans2-k)*0.5)<<endl;
}

Measured memory_bytes: 4992
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <complex>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cwchar>
#include <cwctype>
#include <exception>
#include <locale>
#include <numeric>
#include <new>
#include <stdexcept>
#include <limits>
#include <valarray>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <list>
#include <utility>
#include <bitset>
#include <algorithm>
#include <functional>
#define rep(i, n) for(int i = 0; i < (int)(n); i ++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i ++)
#define MP make_pair
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int INF = 1e9 + 7;

int main()
{
	int n, m;
	scanf("%d%d", &n, &m);
	if(n > m) swap(n, m);
	if(m == 1) printf("1\n");
	else if(n == 1) printf("%d\n", m - 2);
	else printf("%lld\n", LL(n - 2) * (m - 2));
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=1e5+5;
ll h[N];
vector<ll> adj[N];
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll n,m;cin>>n>>m;
    for(ll i=1;i<=n;i++)cin>>h[i];
    for(ll i=0;i<m;i++){
        ll u,v;cin>>u>>v;
        adj[u].push_back(h[v]);
        adj[v].push_back(h[u]);
    }
    ll ans = 0;
    for(ll i=1;i<=n;i++){
        ll flg=1;
        for(auto &ele:adj[i])if(ele>=h[i])flg=0;
        ans+=flg;
    }
    cout<<ans;
}


Measured memory_bytes: 10284
from collections import defaultdict
from collections import deque
from collections import Counter
import math

def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

d,t,s = readInts()

if d<=t*s:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9416
# -*- coding: utf-8 -*-
import math

N = int(input())
f = [0] * N
for i in range(1, N+1):
  count = 0
  for x in range(1, i):
    if x**2 > N:
      break
    for y in range(x, i):
      if y**2 > N:
        break
      z = i-x-y
      if z < y:
        break
      n = x**2 + y**2 + z**2 + x*y + y*z + z*x
      if z > math.sqrt(n + 1):
        break
      if n <= N:
        if x == y and x == z:
          f[n-1] += 1
        elif x == y or y == z:
          f[n-1] += 3
        elif x != y and x != z and y != z:
          f[n-1] += 6
for i in f:
  print(i)



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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define per(i, a, b) for(int i = a; i >= (b); --i)
#define trav(a, x) for(auto &a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

ll mod  = 1e9 + 7;


ll power(ll n, ll p) {
  if (p == 0) return 1;
  ll t = power(n, p / 2);
  t = (t * t) % mod;
  if (p & 1)
    return (t * n) % mod;
  return t;
}



int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  
  ll n; cin >> n;
  ll ss = (power(10, n) - power(8, n)) % mod;
  ll ab = (power(9, n) - power(8, n)) % mod;
  ab = (ab * 2) % mod;

  ll res = (ss - ab + mod) % mod;
  cout << res;
  
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int max_n=200005;
char s[max_n];
int main(){
    scanf(" %s",s+1);
    int n=strlen(s+1);
    for(int i=1;i<=n;i++)if(s[i]=='?')s[i]='D';
    printf("%s\n",s+1);
    return 0;
}

Measured memory_bytes: 3860
import numpy as np

N = int(input())
a = np.array(list(map(int, input().split())))

if (a/a[0]).sum() == len(a):
    total = 0

total = 10**9
for i in range(a.min(), a.max()+1):
    total_new = ((a - i)**2).sum()
    if total_new <= total:
        total = total_new
print(total)

Measured memory_bytes: 17996
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;

int a,b;

long long n;

int main()
{
	scanf("%lld",&n);
	long long sqt = sqrt(n);
	long long ans = n-1;
	for(int i=2;i<=sqt;i++)
	{
		if(n%i==0) ans =min(ans,n/i+i-2);
	}
	printf("%lld\n",ans);
	return 0;
}

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

using namespace std;
using ll = long long;

int main() {
    int N = 0;
    cin >> N;
    int K;
    cin >> K;
    vector<int> A(N,0);
    for(int i = 0; i < N; i++) {
        cin >> A.at(i);
    }
    cout << (N + K -3)/(K - 1) << endl;

    return 0;
}
//1:     2 K        K-1 2K-3
//2:   K+1 2K-1    2K-2 3K
//3:    2K 3K-2
//4:  3K-1 4K-3
//5:


Measured memory_bytes: 3572
#include <iostream>
#include <sstream>
using namespace std;
#include <bits/stdc++.h>
#include<utility>
#include <algorithm>
#include<iterator>
#define  go return 0
#define pb push_back
#define lp(j, n)  for(int j=0; j<(int)(n); ++j)
#define rep(i,n) for(int i=0;i<n;++i)
#define all(v)   ((v).begin()), ((v).end())
#define sz(v)    ( (int)((v).size()) )
#define F first
#define S second
typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<pair<int,string> > vpii;
typedef map<int, int> mii;
const ll N=1e5+5;
ll arr[N],A[N]  ;
bool visited[N]={} , cnt[N]={};
bool f;
int main()
{

 ll n,m,k,sum=0;
 cin>>n;
 m=n , k=n;
 while(m>0)
 {
     sum+=(m%10);
     m/=10;
 }
   if(k%sum==0)
    cout<<"Yes";
   else
    cout<<"No";
go;
}


Measured memory_bytes: 256
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys

# import itertools
# import math

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

H, N = map(int, read().split())
print('Yes' if H==N else 'No')

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

class segtree{
public:
	static const int N=1<<18;
	int dp[1<<19];
	int lazy[1<<19];
	segtree(){
		memset(dp,0,sizeof(dp));
	}

	void lazy_eval(int k){
		dp[k]+=lazy[k];
		if(k<N-1){
			lazy[k*2+1]+=lazy[k];
			lazy[k*2+2]+=lazy[k];
		}
		lazy[k]=0;
	}
	void lazy_upd(int k){
		dp[k]=max(dp[k*2+1],dp[k*2+2]);
	}
	void update(int a,int b,int v,int k=0,int l=0,int r=N){
		lazy_eval(k);
		if(b<=l || r<=a)return;
		if(a<=l && r<=b){
			lazy[k]+=v;
			lazy_eval(k);
			return;
		}
		int mid=(l+r)/2;
		update(a,b,v,k*2+1,l,mid);
		update(a,b,v,k*2+2,mid,r);
		lazy_upd(k);
		return;
	}

	int query(int a,int b,int k=0,int l=0,int r=N){
		lazy_eval(k);
		if(b<=l || r<=a)return -214514;
		if(a<=l && r<=b)return dp[k];
		int mid=(l+r)/2;
		int vl=query(a,b,k*2+1,l,mid);
		int vr=query(a,b,k*2+2,mid,r);
		lazy_upd(k);
		return max(vl,vr);
	}
};

segtree seg;

int n,q;
int b[200002];
int sum[200002];
P p[200002];

int main(void){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&b[i]);
		sum[i+1]+=sum[i];
		sum[i+1]+=b[i];
		seg.update(i+1,n+1,-b[i]);
	}
	scanf("%d",&q);
	for(int i=0;i<q;i++){
		scanf("%d%d",&p[i].first,&p[i].second);
		p[i].first--;
	}
	sort(p,p+q);
	int now=0;
	for(int i=0;i<n;i++){
		while(now<q && p[now].first==i){
			int v=seg.query(0,p[now].second);
			int prev=seg.query(p[now].second,p[now].second+1)+sum[p[now].second]-sum[i];
			seg.update(p[now].second,p[now].second+1,max(v+sum[p[now].second]-sum[p[now].first]-prev,0));
			now++;
		}
		int prev=seg.query(i+1,i+2)+b[i];
		if(b[i]==0){
			seg.update(i+1,i+2,max(seg.query(i,i+1)-prev+1,0));
		}else{
			seg.update(i+1,i+2,max(seg.query(i,i+1)-prev,0));
		}
		seg.update(i+1,n+1,b[i]);
	}
	printf("%d\n",n-seg.query(n,n+1));
	return 0;
}

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

 using namespace std;

 int main() {
   string S, T = "0000000000";

   cin >> S;

   for (int i = 0; i < S.length(); i++) {
     if (S.at(i) == 'A' || S.at(i) == 'C' || S.at(i) == 'G' || S.at(i) == 'T') T.at(i) = '1';
   }

   int ans = 0;
   for (int i = S.length(); i > 0; i--) {
     for (int j = 0; j <= S.length() - i; j++) {
       int counter = 0;
       for (int k = 0; k < i; k++) {
         if (T.at(j + k) == '1') counter++;
       }
       if (counter == i) {
         ans = i;
         break;
       }
     }
     if (ans != 0) break;
   }

   cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int field[10][10][10];

void Init(){
  int val,x,y;
  bool state = true; //上へまいる
  bool halfin = false;
  for(int i=1;i<10;i++){
    val = 1;
    x = y = 0;
    halfin = false;
    
    while(true){
      field[y][x][i] = val++;     
      if(x >= i-1 && y >= i-1){
	break;
      }    
      
      if(state){
	x++;y--;
	if(y<0 || (halfin && x>i-1)){
	  if((halfin && x>i-1)){
	    x--;y+=2;
	  }else{ 
	    y++;
	  }
	  state = false;
	}
      }else{
	x--;y++;
	if(x<0 || (halfin && y>i-1)){
	  if((halfin && y>i-1)){
	    x+=2;y--;
	  }else{
	  
	    x++;
	  }
	  state = true;
	}
      }


      if(!halfin&&( (x>i-1) || (y>i-1))){

	halfin = true;
	if(x>i-1){
	  x--;y++;
	  state = false;
	}
	if(y>i-1){
	  x++;y--;
	  state = true;
	}
      }

    }
    
    
  }
}

int main(){
  int n,NARI = 1;
  Init();
  while(cin >> n && n){
    cout << "Case " << NARI++ << ":" << endl;
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){

	printf("%3d",field[i][j][n]);
      }
      cout << endl;
    } 

  }
  return 0;
}

Measured memory_bytes: 1208
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <list>

long long int INF = 1e18;
using namespace std;

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

int main(){
	
	int n, q;
	cin >> n;
	
	int S[20000];
	
	for(int i = 0; i < n; i++){
		cin >> S[i];
	}
	
	cin >> q;
	
	int ans = 0;
	
	for(int i = 0; i < q; i++){
		int T;
		cin >> T;
		for(int j = 0; j < n; j++){
			if(S[j] == T){
				ans++;
				break;
			}
		}
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 3104
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
using ll=long long;

const ll INF = pow(10,18)+1;

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

template<typename T> bool chmin(T& a, T b) {return a > b ? a = b, true : false;}
template<typename T> bool chmax(T& a, T b) {return a < b ? a = b, true : false;}
 
int main(){
    int N, M, C;
    cin >> N >> M >> C;
    vector<int> B;
    REP(i,M){
        int tmpb;
        cin >> tmpb;
        B.push_back(tmpb);
    }
    int A[25][25];
    REP(i,N){
        REP(j,M){
            cin >> A[i][j];
        }
    }
    int cnt = 0;
    REP(i,N){
        int tmp = 0;
        REP(j,M){
            tmp += A[i][j]*B[j];
        }
        tmp += C;
        if(tmp > 0) cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
 
int main(){
	int n, m, lmax=0,rmin=100001,l,r;
	cin >> n >> m;
	for (int i = 0; i < m; ++i){
		cin >> l >> r;
		lmax = max(lmax, l);
		rmin = min(rmin, r);
	}
	cout << ((rmin - lmax + 1 > 0) ? (rmin - lmax + 1) : 0) << endl;
	return 0;
}

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

const bool DEBUG = false;

long long K, N;
vector<long long> A;

void input() {
  cin >> K >> N;
  A = vector<long long>(N);
  for (size_t i = 0; i < N; i++) cin >> A[i];
}

int main(int argc, char const *argv[]) {
  input();

  long long longest = A[0];
  long long current = 0ll;
  for (size_t i = 1; i < N; i++) {
    current = A[i] - A[i - 1];
    if (longest < current) {
      longest = current;
    }
  }
  cout << K - max(longest, K - A[N - 1] + A[0]) << endl;
  return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).bigin(), (c).end())

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

    if (a < 9 && b < 9)
        cout << "Yay!" << endl;
    else
        cout << ":(" << endl;

    return 0;
}

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

using namespace std;

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

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

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}

vector<vector<int>> g;
vector<int> ans, used;

int main()
{
	int n;
	cin>>n;
	g.resize(n);
	ans.resize(n,0);
	used.resize(n,-1);
	rep(i,n-1){
		int a;
		cin>>a;
		a--;
		g[a].push_back(i+1);
	}


	rep(i,n)cout<<g[i].size()<<endl;

	return 0;
}

Measured memory_bytes: 15604
from math import gcd

n,x = map(int,input().split())
c = list(map(int,input().split()))
c.append(x)
c.sort()
arr = []
for i in range(n):
    arr.append(abs(c[i]-c[i+1]))
ans = arr[0]
if n>1:
    ans = gcd(arr[0],arr[1])
    for i in range(2,n):
        ans = gcd(ans,arr[i])
print(ans)

Measured memory_bytes: 85096
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

signed main() {
    int n;
    cin >> n;
    int a[n], b[n];
    rep(i, n) {
        cin >> a[i];
    }
    rep(i, n) {
        cin >> b[i];
    }
    ll ans = 0;
    int ma[n], mb[n];
    for (int i = 0; i < 30; i++) {
        ll T = 1 << i;
        rep(i, n) {
            ma[i] = a[i] % (2 * T);
        }
        rep(i, n) {
            mb[i] = b[i] % (2 * T);
        }
        sort(mb, mb + n);
        ll sum = 0;
        rep(i, n) {
            sum += lower_bound(mb, mb + n, 2 * T - ma[i]) -
                   lower_bound(mb, mb + n, T - ma[i]);
            sum += lower_bound(mb, mb + n, 4 * T - ma[i]) -
                   lower_bound(mb, mb + n, 3 * T - ma[i]);
        }
        if (sum % 2 == 1) {
            ans += T;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6692
import sys
import bisect
import numpy
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(readline())
A = list(map(int, readline().split()))
B = list(map(int, readline().split()))
C = list(map(int, readline().split()))
A = sorted(A)
B = sorted(B)

ans = 0
ind_list = []
for b in B:
  index = bisect.bisect_left(A,b)
  ind_list.append(index)
  
res = numpy.cumsum(ind_list)
for c in C:
  index = bisect.bisect_left(B,c)
  if index == 0:
    continue
  ans += res[index-1]
print(ans)

Measured memory_bytes: 30020
using System;

class Program {
    static void Main(string[] args) {
        //入力
        int N = int.Parse(Console.ReadLine());
        string A = Console.ReadLine();
        string B = Console.ReadLine();
        string C = Console.ReadLine();

        //カウンター変数
        int ans = 0;

        //計算
        for (int i = 0; i < N; i++) {
            if (A[i] == B[i] && B[i] == C[i]) {

            } else if (A[i] == B[i] && B[i] != C[i]) {
                ans++;
            } else if (B[i] == C[i] && C[i] != A[i]) {
                ans++;
            } else if (C[i] == A[i] && A[i] != B[i]) {
                ans++;
            } else {
                ans += 2;
            }
        }

        //出力
        Console.WriteLine(ans);

    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cassert>
using namespace std;

#define GET_ARG(a,b,c,F,...) F
#define REP3(i,s,e) for (i = s; i <= e; i++)
#define REP2(i,n) REP3 (i,0,(int)(n)-1)
#define REP(...) GET_ARG (__VA_ARGS__,REP3,REP2) (__VA_ARGS__)
#define RREP3(i,s,e) for (i = s; i >= e; i--)
#define RREP2(i,n) RREP3 (i,(int)(n)-1,0)
#define RREP(...) GET_ARG (__VA_ARGS__,RREP3,RREP2) (__VA_ARGS__)
#define DEBUG(x) cerr << #x ": " << x << endl

typedef long long ll;

constexpr int MOD = 1e9+7;

int a[400], b[400];
int dp[401][401][401];

int main(void) {
    int i, j, k, n, c;
    cin >> n >> c;
    REP (i,n) cin >> a[i];
    REP (i,n) cin >> b[i];

    dp[0][0][0] = 1;
    REP (i,1,n) {
        REP (j,0,c) REP (k,0,b[i-1]-a[i-1]) {
            dp[i][j][k] = dp[i-1][j][0];
            if (j == 0) continue;
            dp[i][j][k] = (dp[i][j][k] + (ll)dp[i][j-1][k] * (k+a[i-1])) % MOD;
        }
        REP (j,0,c) RREP (k,b[i-1]-a[i-1]) dp[i][j][k] = (dp[i][j][k] + dp[i][j][k+1]) % MOD;
    }
    cout << dp[n][c][0] << endl;
    return 0;
}


Measured memory_bytes: 251520
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstdint>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <utility>
#include <limits>
#include <list>
#include <type_traits>

/* template start */
 
#define rep(i, a, b) for (long long i = (a); (i) < (b); (i)++)
#define all(i) i.begin(), i.end()

#ifdef LOCAL
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  if(sizeof...(t)>0)std::cout<<" :";
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}

template<typename Num>
constexpr Num mypow(Num a, long long b) {
  if(b==0)return 1;
  if (a==0)return 0;
  Num x = 1;
  while (b > 0) {
    if(b & 1)x*=a;
    a*=a;
    b >>= 1;
  }
  return x;
}

/* template end */

using ll = long long;

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

  ll k,a,b;
  std::cin>>k>>a>>b;

  if(k<a-1){
    std::cout<<k+1<<"\n";
    return 0;
  }

  k-=a-1;

  std::cout<<a+(k/2)*std::max(b-a,2ll)+k%2<<"\n";

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define llu unsigned long long
#define ll long long
#define INF 0x3f3f3f3f
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;

int main()	
{
	#ifdef SANS
		freopen("C:\\Users\\ASUS\\Documents\\Sublime\\input_output\\inputf.txt","r",stdin);
		freopen("C:\\Users\\ASUS\\Documents\\Sublime\\input_output\\outputf.txt","w",stdout);
	#endif
	fast
	int t=1;
	// cin>>t;
	while(t--)
	{
		int n;
		ll k, count=0;
		cin>>n>>k;
		int arr[n+1];
		for(int i=1; i<=n; i++)cin>>arr[i];
		int at=arr[1];
		bool visited[n+1], done=false;
		memset(visited,false,n+1);
		// visited[at]=true;
		vector<int> path;
		while(!visited[at])
		{
			visited[at]=true;
			path.push_back(at);
			at=arr[at];
			count++;
			if(count==k)
			{
				done=true;
				at=path[path.size()-1];
				break;
			}
		}
		count++;
		// cout<<count<<endl;
		if(done)
		{
			cout<<at<<endl;
			continue;
		}
		k-=count;
		for(int i=0; i<path.size(); i++)
		{
			// cout<<path[i]<<" ";
			if(at==path[i])
			{
				count=i;
				break;
			}
		}
		// cout<<count<<endl;
		// return 0;

		ll temp=k%(path.size()-count);
		cout<<path[temp+count]<<endl;
	}
	#ifdef SANS
		cout<<"\nTime Elapsed:"<<1.0*clock()/CLOCKS_PER_SEC <<"sec\n";
	#endif
}

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

int main() {
   string S,T;
   cin >> S >> T;
   int count=0;
   for (int i=0; i<S.size(); i++) {
       if (S.at(i)!=T.at(i)) count++;
   }
   cout << count << endl;
}

Measured memory_bytes: 3920
import java.util.*;
class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Set<Integer> list = new TreeSet<Integer>();
        int count =1;
        int min = sc.nextInt();
        for(int i = 1;i<n;i++){
            int tmp = sc.nextInt();
            if(tmp<=min){
                count ++;
                min = tmp;
            }
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 64356
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<string>

using namespace std;

int main(void)
{
	int a, b;
	cin >> a >> b;
	int sum;
	sum = a + b;
	if (sum > 9)
	{
		cout << "error" << endl;
	}
	else
	{
		cout << sum << endl;
	}
	return 0;
}


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

using namespace std;

int main(){
	int i, j, n, *prime;
	while(cin >> n){
		int ans = 0;
		prime = new int[n];
		for(i = 0; i < n; ++i) prime[i] = 1;
		prime[0] = 0;
		for(i = 1; i < sqrt(n); ++i){
			if(prime[i] == 1){
				for(j = (i + 1); (i + 1) * j <= n; ++j){
					prime[(i + 1) * j - 1] = 0;
				}
			}
		}
		for(i = 0; i < n; ++i){
			if(prime[i] == 1) ++ans;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 59944
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
#define MOD 2019
int main(){
  ll L,R;cin>>L>>R;
  ll i,j,k,l;
  ll ans=2018;
  for(i=L;i<L+2019;i++){
    for(j=i+1;j<=min(i+2019,R);j++){
      ll tmp = i%MOD * j%MOD %MOD;
      ans = min(tmp,ans);
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <cstdio>
using namespace std;
int main()
{
	int a,b,c,d,l,r;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	l=a+b;
	r=c+d;
	if(l>r)
	{
		printf("Left"); 
	}
	else if(r>l)
	{
		printf("Right");
	}
	else
	{
		printf("Balanced");
	}
	return 0;
} 

Measured memory_bytes: 128
#include <utility>
#include <vector>
#include <set>
#include <iostream>
#include <numeric>

using namespace std;
#define REP(i, n)  for(int i=0;i<(int)(n);++i)
#define FOR(i, b, n)  for(int i=b;i<(n);++i)
#define ALL(c) (c).begin(),(c).end()
#define PB(c) push_back(c)
#define SS size()
#define ST first
#define ND second
typedef long long ll;
typedef vector<int> vi;
typedef set<int> si;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef set<int> si;
template<typename T, typename U> static void amin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> static void amax(T &x, U y) { if (x < y) x = y; }
template<typename T> T gcd(T a, T b) {return a==0 ? b : gcd(b%a,a);}
template<typename T> void sout(T &w) { for(auto x : w) cout << x << ", "; cout << endl;}


int main() {
   string s; cin >> s;
   int n = 0;
   for(char c : s) if (c=='+') n++; else n--;
   cout << n << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
using llong = long long;

llong x;
llong a, b;

int main() {

    cin >> x >> a >> b;

    x -= a;
    x %= b;

    cout << x << endl;

    return 0;
}


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

int gcd(int a, int b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifdef DEBUG
        freopen("in.txt", "r", stdin);
    #endif
    
    int a[100001];
    int n; cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    
    sort(a, a + n);
    
    int min_val = INT_MAX;
    for (int i = 0; i < n - 1; i++) {
        min_val = min(min_val, gcd(a[i], a[i + 1]));
    }
    
    cout << min_val << '\n';
    
    return 0;
}


Measured memory_bytes: 640
D =[]
N = int(input())
for i in range(N):
    S = input()
    D.append(S)
    
#print(D)


print("AC " + "x " + str(D.count("AC")) )
print("WA " + "x " + str(D.count("WA")) )
print("TLE "+ "x " + str(D.count("TLE")) )
print("RE " + "x " + str(D.count("RE")) )



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

int main(){
    int x,y;
    cin>>x>>y;
    for (int i=0;i<=x;++i){
        if ((2*i + 4*(x-i))==y){
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
}

Measured memory_bytes: 3596
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll MOD = 1e9 + 7;
const ll inf = 1LL << 60;
#define all(x) (x).begin(),(x).end()
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)
#define INF INT_MAX/2

void err() {
	cout << "No" << endl;
	exit(0);
}

int main() {
	int N;
	cin >> N;
	vector<pair<ll, ll>>time(N);
	rep(i, 0, N) {
		ll A, B;
		cin >> A >> B;
		time[i] = { B,A };
	}
	sort(all(time));

	ll cur = 0;
	rep(i, 0, N) {
		ll A = time[i].second;
		ll B = time[i].first;
		cur += A;
		if (cur <= B)continue;
		else err();
	}
	cout << "Yes" << endl;

	return 0;
}


Measured memory_bytes: 3328
n=int(input())
lst=list(map(int,input().split()))
ans=0
temp=0
for i in range(1, n):
  if lst[i]<=lst[i-1]:
    temp+=1
  else:
    if temp>ans:
      ans=temp
    temp=0
if temp>ans:
  ans=temp
print(ans)

Measured memory_bytes: 20432
n = int(input())
def sieve(limit):
    a = [True] * limit
    a[0] = a[1] = False
    for (i, isprime) in enumerate(a):
        if isprime:
            yield i
            for n in range(i*i, limit, i):
                a[n] = False
a = list(sieve(55555))
ans = []

for i in a:
    if i % 5 == 1:
        ans.append(i)
    if len(ans) == n:
        break
print(*ans)


Measured memory_bytes: 3572
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
def counter(array):
    from collections import Counter
    return list(Counter(array).most_common())
c = counter(prime_factorize(int(input())))
table = [(i + 1)*i//2 for i in range(100)]


from bisect import bisect_right
ans = 0
for x in c:
    ans += bisect_right(table,x[1]) - 1
print(ans)


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

int nn(int a){
	if(a==1)a=300000;
	else if(a==2)a=200000;
	else a=100000;
	return a;
}

int main(){
	int a,b;
	int aux=0;
	cin>>a>>b;
	if(a==1&&b==1)aux=400000;
	if(a<=3)a=nn(a);
	else a=0;
	if(b<=3)b=nn(b);
	else b=0;
	cout<<a+b+aux;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
using namespace std;
int solve(int dp[][2],vector<int>* edges,int n,int x,int constraint,int parent){
    //base case is not necessary
    // if(edges[x].size()==1 && parent!=-1){
    //     if(constraint==0){
    //         return 2;
    //     }
    //     else{
    //         return 1;
    //     }
    // }
    if(dp[x][constraint]!=-1){
        return dp[x][constraint];
    }
    
    int ans=1;
    for(int i=0;i<edges[x].size();i++){
        if(edges[x][i]!=parent)
            ans=(ans*solve(dp,edges,n,edges[x][i],0,x))%mod;
    }
    if(constraint==0){
        int ans2=1;
        for(int i=0;i<edges[x].size();i++){
            if(edges[x][i]!=parent)
                ans2=(ans2*solve(dp,edges,n,edges[x][i],1,x))%mod;
        }
        ans=(ans+ans2)%mod;
    }
    return dp[x][constraint]=ans;
}
int32_t main(){
    int n;
    cin>>n;
    vector<int> edges[n];
    for(int i=1;i<=n-1;i++){
        int u,v;
        cin>>u>>v;
        edges[u-1].push_back(v-1);
        edges[v-1].push_back(u-1);
    }
    int dp[n][2];
    memset(dp,-1,sizeof dp);
    cout<<solve(dp,edges,n,0,0,-1)<<endl;
    return 0;
}

Measured memory_bytes: 15616