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

int main()
{
  int n;
  cin >> n;
  priority_queue<double, vector<double>, greater<>> pq;
  for (int i = 0; i < n; i++) {
    double d;
    cin >> d;
    pq.push(d);
  }
  while(pq.size() > 1) {
    double a, b;
    a = pq.top(); pq.pop();
    b = pq.top(); pq.pop();
    pq.push((a + b) / 2);
  }
  cout << pq.top() << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef double dd;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef pair<ll , ll> lli;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;
typedef vector<lli> vlli;
 
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define in insert
#define f0(b) for(int i=0;i<(b);i++)
#define f00(b) for(int j=0;j<(b);j++)
#define f1(b) for(int i=1;i<=(b);i++)
#define f11(b) for(int j=1;j<=(b);j++)
#define f2(a,b) for(int i=(a);i<=(b);i++)
#define f22(a,b) for(int j=(a);j<=(b);j++)
#define sf(a) scanf("%lld",&a)
#define sff(a,b) scanf("%lld %lld", &a , &b)
#define pf(a) printf("%lld\n",a)
#define pff(a,b) printf("%lld %lld\n", a , b)
#define PI 3.14159265359
#define bug printf("**!\n")
#define mem(a , b) memset(a, b ,sizeof(a))
#define front_zero(n) __builtin_clzll(n)
#define back_zero(n) __builtin_ctzll(n)
#define total_one(n) __builtin_popcountll(n)

const ll mod = 998244353;
const ll maxn = (ll)1e5+5;
const int nnn = 1048590;
const int inf = numeric_limits<int>::max()-1;
//const ll INF = numeric_limits<ll>::max()-1;
const ll INF = 1e18;

ll dx[]={0,1,0,-1};
ll dy[]={1,0,-1,0};
ll dxx[]={0,1,0,-1,1,1,-1,-1};
ll dyy[]={1,0,-1,0,1,-1,1,-1};

vector < ll > v[maxn];
ll n,m, ans[maxn];

void solve(){ 
    
    cin >> n >> m;
    ll x,y;
    f0(m) cin >> x >> y , v[x].pb(y) , v[y].pb(x);
	mem(ans , -1);
	ans[1] = 0;
	queue < ll > q;
	q.push(1);
	while(!q.empty()){
		ll s = q.front();
		q.pop();
		for(auto u : v[s]){
			if(ans[u] == -1) ans[u] = s , q.push(u);
		}
	}
	f1(n){
		if(ans[i] == -1){
			cout << "No";
			return;
		}
	}
	cout << "Yes\n";
	for(ll i = 2; i <= n; i++) cout << ans[i] << '\n';
	return;
}


int main() {
   
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    ll T;
    T=1;
    //cin >> T;
    //scanf("%lld",&T);
    ll CT = 0;
    //work();
    while(T--){
    	//cout << "Case " << ++CT <<": " ;
    	//printf("Case %lld: ",++CT);
		solve();
	}
    
    return 0;
}


Measured memory_bytes: 13024
from itertools import combinations

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

A = {i: [] for i in range(N)}

for i in range(M):
  line = [int(i) for i in input().strip().split(' ')]
  for s in line[1:]:
    A[s - 1].append(i)

P = list(map(int, input().strip().split(' ')))

cmb = []
for i in range(N + 1):
  cmb.extend(list(combinations(range(N), i)))

counter = 0
for c in cmb:
  # print(c)
  tmp = [0] * M
  for i in c:
    for j in A[i]:
      tmp[j] = (tmp[j] + 1) % 2
  if tmp == P:
    counter += 1

print(counter)

Measured memory_bytes: 3188
#if __has_include("noamoa_atcoder_lib.h")
#include "noamoa_atcoder_lib.h"
#else
#include <bits/stdc++.h>
#define endl '\n'
#define all(x) (x).begin(),(x).end()
namespace atcoder {
	using namespace std;
	using ll = long long;
	using intv = vector<int>;
	using charv = vector<char>;
	using boolv = vector<bool>;
	using floatv = vector<float>;
	using doublev = vector<double>;
	using stringv = vector<string>;

	constexpr ll MOD  = 1000000007;
	constexpr ll MOD9 = 1000000009;

	template<typename T>
	void sort(vector<T>& v){
		sort(all(v));
	}
	template<typename T>
	void sortInv(vector<T>& v){
		sort(all(v), greater<T>());
	}

	template<typename T>
	T sum(const vector<T>& v){
		T ret = 0;
		for(const auto& e : v) ret += e;
		return ret;
	}

	template<typename T>
	inline vector<T>& operator+=(vector<T>& v, const T& e){
		v.push_back(e);
		return v;
	}

	template<typename T>
	void in(vector<T>& v){
		for(auto& e : v) cin >> e;
	}

	template<typename T>
	istream& operator>>(istream &stream, vector<T>& v){
		for(auto& e : v) stream >> e;
		return stream;
	}

	template<typename T>
	void out(const vector<T>& v){
		for(const auto& e : v) cout << e << ' ';
		cout << endl;
	}

	template<typename T>
	void outln(const vector<T>& v){
		for(const auto& e : v) cout << e << endl;
	}

	void init(){
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(15);
	}
}
using namespace atcoder;
#endif
#define _USE_MATH_DEFINES
int main(){
	init();

	double R;cin>>R;
	cout <<(acos(-1)*R*2);

	/*int N;cin>>N;
	intv A(N);cin>>A;*/
}

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

using ll=long long; 

bool used[1000010];

void solve(){
	int s;
	cin>>s;
	used[s]=1;
	int pos;
	pos=s;
	int cnt=1;
	while(1){
		cnt++;
		//cout<<pos<<endl;
		if(pos%2==0){
			pos/=2;
		}else{
			pos=pos*3+1;
		}
		if(used[pos]){
			cout<<cnt<<endl;
			return;
		}
		used[pos]=1;
	}
}

signed main(){
	//while(1)
	solve();
}

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

using namespace std;


int main() {
	int i,n,k;
	string s;
	cin>>n>>k;
	k--;
	cin>>s;
	if(s[k]=='A') s[k]='a';
	else if(s[k]=='B') s[k]='b';
	else if(s[k]=='C') s[k]='c';
	cout<<s;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<utility>
#include<string>
#include<vector>
#include<algorithm>
#include<deque>
#include<queue>
#include<set>
#include<map>
#include<functional>

using namespace std;
#define LL long long
#define LLBIG 1999999999999999999
#define INTBIG 1111111111
#define MOD 1000000007
#define PI pair<int,int>
#define VI vector<int>
#define VVI vector<vector<int>>

int N, M, K, ans = 0;
int par[100002], club[100002] = {};//1-origin
int A[200001], B[200001], C[200001];

int findp(int index) {
	if (index == par[index]) return index;//root
	int root = findp(par[index]);
	par[index] = root; club[index] = club[root];
	return root;
}
void unite(int a, int b) {//bの下にaをくっつける
	int ra = findp(a), rb = findp(b);
	if (ra != rb) par[ra] = rb;//not yet samegroup
	return;
}

int main() {
	cin >> N >> M >> K;
	for (int i = 1; i <= N; i++) par[i] = i;
	for (int i = 1; i <= K; i++) cin >> A[i] >> B[i] >> C[i];
	for (int i = 1; i <= K; i++) {
		if (A[i] == 1) {//comperney
			if (club[findp(B[i])] * club[findp(C[i])]) {
				if (club[par[B[i]]] != club[par[C[i]]]) {//failed
					ans = i; break;
				}
				unite(B[i], C[i]);//already same
			}else {
				if (club[findp(B[i])] + club[findp(C[i])]) 
					(club[par[B[i]]] ? unite(C[i], B[i]) : unite(B[i], C[i]));
				else unite(B[i], C[i]);//neither belongs
			}
		}
		else {//belong
			if(!club[findp(B[i])]) club[par[B[i]]] = C[i];
			else if (club[par[B[i]]] != C[i]) {
				ans = i; break;
			}
		}
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 6192
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
const int mo=998244353;
const int gx=3;
const int N=40000;
const int M=200;
int Sum(int x,int y) {
    x+=y;
    return (x>=mo)?x-mo:x;
}
int Sub(int x,int y) {
    x-=y;
    return (x<0)?x+mo:x;
}
int Mul(int x,int y) {
    return (long long)x*y%mo;
}
int Pow(int x,int y=mo-2) {
    int z=1;
    while (y) {
        if (y&1) z=Mul(z,x);
        y>>=1;
        x=Mul(x,x);
    }
    return z;
}
int f[M+10][8000+10],fac[N+10],inv[N+10],f1[N+10],g1[N+10];
int n,m;
namespace Conv {
    int rev[N+10],wx[N+10];
    int lst=1;
    void Pre(int n) {
        rev[0]=0;
        for (int i=1;i<n;i++)
            if (i&1) rev[i]=rev[i^1]+(n>>1);
            else rev[i]=rev[i>>1]>>1;
        for (;lst<n;lst<<=1) {
            int wn=Pow(gx,(mo-1)/(lst<<1));
            for (int i=lst,now=1;i<(lst<<1);i++,now=Mul(now,wn))
                wx[i]=now;
        }
    }
    void Dft(int *a,int n) {
        for (int i=0;i<n;i++)
            if (i<rev[i]) swap(a[i],a[rev[i]]);
        for (int i=2;i<=n;i<<=1)
            for (int j=0;j<n;j+=i) {
                int *l=a+j,*r=a+j+i/2,*now=wx+i/2;
                for (int k=0;k<i/2;k++,l++,r++,now++) {
                    int va1=*l,va2=Mul(*r,*now);
                    *l=Sum(va1,va2);
                    *r=Sub(va1,va2);
                }
            }
    }
    void Idft(int *a,int n) {
        Dft(a,n);
        reverse(a+1,a+n);
        int invn=Pow(n);
        for (int i=0;i<n;i++)
            a[i]=Mul(a[i],invn);
    }
}
void Prework() {
    fac[0]=1;
    for (int i=1;i<=N;i++) fac[i]=Mul(fac[i-1],i);
    inv[N]=Pow(fac[N]);
    for (int i=N-1;i>=0;i--) inv[i]=Mul(inv[i+1],i+1);
}
void Calc(int x) {
    int nx=1;
    while (nx<=n*2) nx<<=1;
    for (int i=0;i<nx;i++) f1[i]=g1[i]=0;
    for (int i=0;i<=n;i++)
        f1[i]=Mul(f[x][i+2],inv[i]);
    for (int i=0;i<=n;i++)
        g1[i]=inv[i];
    Conv::Pre(nx);
    Conv::Dft(f1,nx);
    Conv::Dft(g1,nx);
    for (int i=0;i<nx;i++) f1[i]=Mul(f1[i],g1[i]);
    Conv::Idft(f1,nx);
}
void Solve() {
    for (int i=0;i<=n;i++) f[0][i]=1;
    for (int i=1;i<=m;i++) {
        f[i][0]=1;
        for (int j=1;j<=n;j++)
            f[i][j]=Sub(Mul(f[i-1][j],j+1),Sum(Mul(f[i-1][j+1],j),f[i-1][j+2]));
        Calc(i-1);
        for (int j=1;j<=n;j++)
            f[i][j]=Sum(f[i][j],Mul(f1[j],fac[j]));
    }
    printf("%d\n",f[m][n]);
}
int main() {
    Prework();
    scanf("%d%d",&n,&m);
    Solve();
    return 0;
}


Measured memory_bytes: 7168
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c;
    set<int>aa;
    cin>>a>>b>>c;
    aa.insert(a);

    aa.insert(b);
    aa.insert(c);
    if(aa.size()==2)
    cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;

}


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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

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

//-----------------------------------------------------------------------------

int n,a;
string s;

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

	cin>>n>>a;
	int tmp=n%500;
	if(tmp<=a) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;

	return 0;
}


Measured memory_bytes: 256
while True:
    m,f,r = map(int, input().split())
    if (m, f, r) == (-1, -1, -1):
        break
    if -1 in (m, f): print('F')
    elif m + f >= 80: print('A')
    elif m + f >= 65: print('B')
    elif m + f >= 50 or r >= 50: print('C')
    elif m + f >= 30: print('D')
    else: print('F')



Measured memory_bytes: 5600
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String a = sc.next();
		String b = sc.next();
		String sumA = "";
		String sumB = "";
		List<String> list = new ArrayList();
		for (int i = 0; i < Integer.parseInt(b); i++) {
			sumA += a;
		}
		for (int i = 0; i < Integer.parseInt(a); i++) {
			sumB += b;
		}
		list.add(sumA);
		list.add(sumB);
		Collections.sort(list);
		System.out.println(list.get(0));
		sc.close();
	}
}

Measured memory_bytes: 21972
import java.util.*;

public class Main {
    private static int solve(int H, int W, char[][] grid) {
        int[][] paths = new int[H][W];
        paths[0][0] = 1;

        for (int d = 1; d < H + W - 1; d++)
            for (int r = Math.min(d, H-1), c = d-r; r >= 0 && c < W; r--, c++) {
                if (grid[r][c] == '#') continue;

                paths[r][c] = ((r > 0 ? paths[r - 1][c] : 0) + (c > 0 ? paths[r][c - 1] : 0)) % 1000000007;
            }

        return paths[H-1][W-1];
    }

    public static int run(Scanner scanner) {
        int H = scanner.nextInt();
        int W = scanner.nextInt();
        char[][] grid = new char[H][W];
        for (int r=0; r < H; r++) {
            String line = scanner.next();
            for (int c = 0; c < W; c++) grid[r][c] = line.charAt(c);
        }

        return solve(H, W, grid);
    }

    public static void main(String[] args) {
        try (Scanner scanner = new Scanner(System.in)) {
            System.out.println(run(scanner));
        }
        //Tests.run();
    }
}

Measured memory_bytes: 34564
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>

using namespace std;

int Sum(const vector<int>& Jwels, size_t a, size_t b, size_t suteru)
{
  int val = 0;
  
  list<int> Hands;
  while(a > 0)
  {
    const int temp = Jwels[a - 1];
    val += temp;
    if(temp < 0)
	    Hands.emplace_back(temp);    
    -- a;
  }
  
  while(b > 0)
  {
    const int temp = Jwels[Jwels.size() - b];
    val += temp;
    if(temp < 0)
	    Hands.emplace_back(temp);    
    -- b;
  }
  
  Hands.sort();
  for(auto Itr = Hands.cbegin(); suteru > 0 && Itr != Hands.cend(); -- suteru, ++ Itr)
  {
    if(*Itr > 0)
      break;
    
    val += -(*Itr);
  }
    
  return val;
}

int main()
{
  size_t n, k;
  cin >> n >> k;
  
  vector<int> Jwels(n, 0);
  for(size_t i = 0; i < n; ++ i)
    cin >> Jwels[i];
  
  const int min_pop = min(n, k);
  int max_val = 0;
  for(size_t a = 0; a <= min_pop; ++ a)
  {
    for(size_t b = 0; b <= min_pop - a; ++ b)
    {
      const int val = Sum(Jwels, a, b, k - (a+b));
      if(max_val < val)
        max_val = val;
    }
  }
  cout << max_val << endl;
  
  return 0;
}


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

int main(){
	int N, L; cin >> N >> L;
	
	int taste = 0;
	for(int i = 1; i <= N; i++) taste += L + i - 1;

	int minTatse = 2147483647;
	for(int i = 1; i <= N; i++){
		if(abs(minTatse) > abs(L + i - 1)) minTatse = L + i - 1;
	}

	cout << taste - minTatse;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <map>
#include <algorithm>
#include <fstream>
#include <queue>
#include <cmath>
#include <unordered_map>

using namespace std;

#define endl '\n'

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

	const int INF = 1e9 + 7;

	int mn = INF;
	int mx = -INF;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		mn = min(mn, a);
		mx = max(mx, a);
	}

	cout << mx - mn;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD=998244353;
int main()
{
	int n, s;
    cin>>n>>s;
    int a[3030];
    for(int i=0; i<n; i++) cin>>a[i];
    ll dp[3030][3030]={};
    dp[0][0]=1;
    for(int i=0; i<n; i++){
        for(int j=0; j<=s; j++){
            if(dp[i][j]==0) continue;
            if(j==0 && j+a[i]<s){
                (dp[i+1][j+a[i]]+=dp[i][j]*(i+1))%=MOD;
            }else if(j && j+a[i]==s){
                (dp[i+1][j+a[i]]+=dp[i][j]*(n-i))%=MOD;
            }else if(j==0 && j+a[i]==s){
                (dp[i+1][j+a[i]]+=dp[i][j]*(n-i)*(i+1))%=MOD;
            }else if(j+a[i]<=s){
                (dp[i+1][j+a[i]]+=dp[i][j])%=MOD;
            }
            (dp[i+1][j]+=dp[i][j])%=MOD;
        }
    }
    cout<<dp[n][s]<<endl;
	return 0;
}


Measured memory_bytes: 72064
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n; cin >> n;
    string in; cin >> in;

    int cnt = 1;
    rep(i, 1, n){
        if(in[i] != in[i-1]){
            cnt++;
        }
    }

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin>>S;
  int a=0;
  for(int i=0;i<S.size();i++){
    if(S[i]=='+'){
      a++;
    }else{
      a--;
    }
  }
  cout<<a<<endl;
  return 0;
}

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

int main() {
  int h,w;
  long long ans=0;
  queue<pair<int,int>> q;
  pair<int,int> v;
  cin >> h >> w;
  vector<int> d(10),m(10);
  vector<vector<int>> a(10,vector<int>(10));
  for (int i=0;i<10;i++){
      for (int j=0;j<10;j++){
          cin >> a.at(i).at(j);
      }
  }
  for (int i=0;i<10;i++){
      for (int o=0;o<10;o++){
          d.at(o)=100000000;
      }
      v.first=i;v.second=0;
      q.push(v);
      while(!q.empty()){
          //cout << 3 << endl;
          int n=q.front().first,p=q.front().second;
          q.pop();
          for (int j=0;j<10;j++){
              if (p+a.at(n).at(j)<d.at(j)) {
                  //cout << j << endl;
                  d.at(j)=p+a.at(n).at(j);
                  v.first=j;v.second=p+a.at(n).at(j);
                  q.push(v);
              }
          }
      }
      m.at(i)=d.at(1);
  }
  int u;
  for (int i=0;i<w;i++){
      for (int j=0;j<h;j++){
        cin >> u;
        if (u==1 || u==-1) continue;
        ans+=m.at(u);
      }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
/*The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep.*/

//PRABHJOT SINGH A.K.A. PRABHI
//~~~~~conquizztador~~~~~


#include<bits/stdc++.h>
using namespace std;
using lli = long long int;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
const int MOD = 1000000007;
const int MOD1 = 998244353;
const int maxn = 100010;
const int lim = (int)1e9;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n = 0;
	cin >> n;
	int r = n % 1000;
	cout << (1000 - r) % 1000 << endl;
}

Measured memory_bytes: 3612
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate
from math import sqrt, ceil, floor
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
import sys
def I(): return int(input())  # '123' -> 123
def Is(): return map(int, input().split())  # '123 456' -> 123, 456
def LI(): return list(map(int, input().split()))  # '123 456' -> [123, 456]
def TI(): return tuple(map(int, input().split()))  # '123 456' -> (123, 456)
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()  # 'aa bb' -> 'aa','bb' or ['aa','bb']
def LS(): return list(input())  # 'abc123' -> ['a','b','c','1','2','3']
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(1000000)
MOD = 1000000007
INF = float('inf')

r = I()
print(r*6.28318530717958623200)

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

// Binary search
int search(int A[], int n, int key) {
  int start = 0;
  int end = n;
  while (start<end) {
    int mid = (start+end)/2; // Floor
    if (key == A[mid]) {
      return 1;
    } else if (key < A[mid]) {
      end = mid;
    } else {
      start = mid+1;
    }
  }
  return 0;
}

int main() {
  int n, q, key, sum = 0;
  cin >> n;
  int S[n];
  for (int i=0; i<n; i++) {
    cin >> S[i];
  }
  cin >> q;
  for (int i=0; i<q; i++) {
    cin >> key;
    if (search(S, n, key)) {
        sum++;
    }
  }
  cout << sum << endl;
  return 0;
}



Measured memory_bytes: 3468
from heapq import heappop,heappush,heapify

class Graph():
    def __init__(self,n,edge,directed=False):
        self.n = n
        self.graph = [[] for _ in range(n)]
        for e in edge:
            self.graph[e[0]].append((e[1],e[2]))
            if not directed:
                self.graph[e[1]].append((e[0],e[2]))
    def bellman_ford(self,s,INF=10**18):
        dist = [INF for _ in range(self.n)]
        dist[s] = 0
        update = True
        for i in range(self.n):
            update = False
            for node, g in enumerate(self.graph):
                for adj,adjcost in g:
                    if dist[node] != INF and dist[node]+adjcost < dist[adj]:
                        dist[adj] = dist[node]+adjcost
                        update = True
            if not update:
                return dist
        return False

INF = 10**18

import sys
input = sys.stdin.readline

V,E,r = map(int,input().split())
edge = [tuple(map(int,input().split())) for _ in range(E)]

g = Graph(V,edge,True)
D = g.bellman_ford(r,INF)

if D:
    for i in range(V):
        if D[i] == INF: D[i] = 'INF'
    print('\n'.join(map(str,D)))

else:
    print('NEGATIVE CYCLE')



Measured memory_bytes: 6216
#include <iostream>
#include <iomanip>
#include <vector>
#include <array>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <tuple>
#include <cmath>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cfloat>
#include <climits>
#include <cassert>
#include <random>

int main()
{
	std::cin.tie(0); std::cin.sync_with_stdio(false);
	std::vector<int> cubic, tetrahedral;
	for (auto i = 0; i < 54; ++i) {
		cubic.push_back(i * i * i);
	}
	for (auto i = 0; i < 96; ++i) {
		tetrahedral.push_back(i * (i + 1) * (i + 2) / 6);
	}
	while (true) {
		int n; std::cin >> n; if (n == 0) break;
		int max = 0;
		for (const auto c : cubic) {
			if (c > n) break;
			max = std::max(max, c + *std::prev(std::upper_bound(tetrahedral.begin(), tetrahedral.end(), n - c)));
		}
		std::cout << max << '\n';
	}
}


Measured memory_bytes: 3120
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <complex>

int main(){
  long long int X,Y;
  scanf("%lld%lld", &X, &Y);
  long long int ans = 0;
  if(X == 3){
    ans += 100000;
  }
  else if(X == 2){
    ans += 200000;
  }
  else if(X == 1){
    ans += 300000;
  }

  if(Y == 3){
    ans += 100000;
  }
  else if(Y == 2){
    ans += 200000;
  }
  else if(Y == 1){
    ans += 300000;
  }

  if(X == Y && X == 1){
    ans += 400000;
  }

  std::cerr << "Answer: " << std::endl;
  std::cout << ans << std::endl;

  return 0;
}


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

using namespace std;
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define sz size
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORN(i,a,b) for(int i=a;i<=b;i++)
#define FORRN(i,a,b) for (int i = (a); i >= (b); i--)
#define FORR(i,a,b) for (int i = (a); i > (b); i--)
typedef unsigned long long ull;
typedef long long ll;

int main(){
    ios_base::sync_with_stdio(false); //Fast I/O
    cin.tie(0);
    cout.tie(0);
	//freopen("input.in","r",stdin);
	//freopen("output.out","w",stdout);

	int n;
	cin >> n;
	
	bool flag=false;

	while(n--){
		ll a;
		cin >> a;

		if(a%2)
			flag=true;
	}

	if(flag)
		cout << "first\n";
	else
		cout << "second\n";

    return 0;
}


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

using namespace std;

#define ll long long int

int main() {
    ll t[2], a[2], b[2];
    cin >> t[0] >> t[1] >> a[0] >> a[1] >> b[0] >> b[1];

    if (a[0] < b[0]) swap(a[0], b[0]), swap(a[1], b[1]);

    if (a[0] * t[0] - b[0] * t[0] == b[1] * t[1] - a[1] * t[1]) {
        cout << "infinity" << endl;
        return 0;
    }

    if (a[0] * t[0] + a[1] * t[1] > b[0] * t[0] + b[1] * t[1]) {
        cout << 0 << endl;
        return 0;
    }

    ll diff = t[0] * (b[0]-a[0]) + t[1] * (b[1]-a[1]);

    ll diffA = t[0] * (a[0]-b[0]);

    ll res = 1;
    res += 2 * ((diffA-1)/diff);
    if (diffA%diff == 0) ++res;
    cout << res << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, X;
  cin >> N >> X;
  
  int sum = 0;
  vector<int> vec(N);
  
  //N個のドーナツの質量の和を計算　かつ　N個のドーナツの質量の配列作成
  for(int i = 0; i < N; i++){
    int m;
    cin >> m;
    vec[i] = m;
    sum += m;
  }

  
  //質量の配列を小さい順に取り出す
  sort(vec.begin(), vec.end());
    
   //最小質量を取り出す
  int mini = vec[0];
  int R;
  R = X - sum; //素の残量R

  
  cout << R/mini + N << endl;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (a, b) = readLine()!!.split(' ').map { it.toInt() }
    var ans = -1
    for (i in 1..1000) {
        if (i * 8 / 100 == a && i / 10 == b) {
            ans = i
            break
        }
    }
    println(ans)
}


Measured memory_bytes: 38360
#include <stdio.h>
#define n_max 101
#define INF 20000000
#define WHITE 0
#define BLACK 1
#define NIL -1


int main(){
  int i,j,min,u,z,sum=0;
  int n,a[n_max][n_max],vat[n_max],ed[n_max],color[n_max];

  scanf("%d",&n);//input
  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      scanf("%d",&a[i][j]);
    }
  }
  
  //processing
  for(i=1;i<=n;i++){//初期化
    vat[i] = INF;
    ed[i] = NIL;
    color[i] = WHITE;
  }
  
  vat[1] = 0;
  
  while(1){
    min=INF;
    for(i=1;i<=n;i++){
      if(color[i]!=BLACK && vat[i]<min){
	min=vat[i];
	u=i;
      }
    }
    
    if(min==INF)break;
    color[u]=BLACK;
    
    for(z=1;z<=n;z++){
      if(color[z]!=BLACK && a[u][z]<vat[z] && a[u][z]!=-1){
	ed[z]=u;
	vat[z]=a[u][z];
      }
    }
  }
  for(i=1;i<=n;i++){
    sum+=vat[i];
  }
  //output
  printf("%d\n",sum);
  return 0;
}



Measured memory_bytes: 2044
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define gep(i,g,j) for(int i = g.head[j]; i != -1; i = g.e[i].next)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcount
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define df(x) int x = in()
#define dame { puts("0"); return 0;}
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,vector<T>,greater<T> >
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
inline void priv(vi a) { rep(i,sz(a)) printf("%d%c",a[i],i==sz(a)-1?'\n':' ');}
template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(vector<T>&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,vector<T>&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;



int main() {
  string s;
  cin >> s;
  int ans = 0, x = 0;
  rep(i,sz(s)) {
    if (s[i] == 'S') {
      x++;
    } else {
      if (x) {
        --x;
      } else {
        ans++;
      }
    }
  }
  ans += x;
  cout<<ans<<endl;
  return 0;
}







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

int main() {
	int a, b, m;
	cin >> a >> b;
	m = a + b;
	if (m < a - b) {
	    m = a - b;
	}
	if (m < a * b) {
	    m = a * b;
	}
	cout << m;
	return 0;
}


Measured memory_bytes: 256
# input
s = gets.chomp

# define
bw = 0
wb = 0

# main
(s.length).times do |i|
  if s[i].to_i % 2 == i % 2 then
    bw += 1
  else
    wb += 1
  end
end
  
# output
puts [bw, wb].min


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

using namespace std;

#define N 3200
#define LL long long

const int mod=1000000007,i2=500000004;
int n,m,x,y,a[N],f[N][N],ans;

int main(){
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;++i) scanf("%d",a+i);
	for (int i=1;i<=n;++i)
		for (int j=1;j<=n;++j) f[i][j]=a[i]>a[j];
	for (int i=1;i<=m;++i){
		scanf("%d%d",&x,&y);
		for (int j=1;j<=n;++j){
			if (j==x||j==y) continue;
			f[x][j]=f[y][j]=((LL)f[x][j]+f[y][j])*i2%mod;
			f[j][x]=f[j][y]=((LL)f[j][x]+f[j][y])*i2%mod;
		}
		f[x][y]=f[y][x]=((LL)f[x][y]+f[y][x])*i2%mod;
	}
	for (int i=1;i<=n;++i)
		for (int j=i;j<=n;++j) ans=(ans+f[i][j])%mod;
	while (m--) ans=ans*2%mod;
	printf("%d\n",ans);
	
	return 0;
}
			

Measured memory_bytes: 39296
#include<bits/stdc++.h>
typedef long long ll;
ll gi(){
	ll x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch))f^=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
int a[300010];
int main(){
#ifdef XZZSB
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	int n=gi();
	for(int i=1;i<=n*3;++i)a[i]=gi();
	std::sort(a+1,a+n*3+1,std::greater<int>());
	ll ans=0;for(int i=2;i<=n*2;i+=2)ans+=a[i];
	printf("%lld\n",ans);
	return 0;
}


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

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

using ll = long long;

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

int main() {
  string S;
  cin >> S;
  if(S=="ABC") cout<<"ARC"<<endl;
  else cout<<"ABC"<<endl;
}

Measured memory_bytes: 3572
function Main(input){

N=parseInt(input);

answer = "AB";
a1="C";
a2="D";

if (N < 1000) {
    answer = answer + a1;
}
else {
    answer = answer + a2;
}

console.log(answer);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 21064
# -*- coding: utf-8 -*-
import numpy as np

def solve():
    N = int(input())
    E = np.array([[0,1],[0,0]])
    for i in range((N-1).bit_length()-1):
        E_ = E+(E>0)
        E = np.vstack([np.hstack([E_,np.ones_like(E)]),np.hstack([np.zeros_like(E), E_])])
    res = '\n'.join(' '.join(map(str,e[i+1:N])) for i, e in enumerate(E[:N]))
    return str(res)

if __name__ == '__main__':
    print(solve())

Measured memory_bytes: 21888
import heapq

N, K = map(int, input().split())
sushi = []
for i in range(N):
    t, d = map(int, input().split())
    heapq.heappush(sushi, (-d, t))

total = 0
types = set()
remain = []
for i in range(K):
    d, t = heapq.heappop(sushi)
    total -= d
    if t not in types:
        types.add(t)
    else:
        # 余りの寿司はremainにappend
        heapq.heappush(remain, -d)

types_len = len(types)
ans = total + types_len ** 2

while sushi and remain:
    d, t = heapq.heappop(sushi)
    if t not in types:
        types.add(t)
        remain_d = heapq.heappop(remain)
        total = total - d - remain_d
        types_len += 1
        ans = max(ans, total + types_len ** 2)

print(ans)


Measured memory_bytes: 19332
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")

//# include <x86intrin.h>
# include <bits/stdc++.h>

//# include <ext/pb_ds/assoc_container.hpp>
//# include <ext/pb_ds/tree_policy.hpp>

//using namespace __gnu_pbds;
using namespace std;
 
//template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

inline void Input_Output () {
	//freopen(".in", "r", stdin);
   //freopen(".out", "w", stdout);
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int n, m, k;
int cnt[N];
string s;
int a[N];
vector < int > g[N];
int u[N];
int ans, res;
int cur;
//	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//	shuffle(permutation.begin(), permutation.end(), rng);



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

	cout << (n/500) * 1000 + 5 * ((n%500)/5) << '\n';
	return Accepted;
}

// B...a

Measured memory_bytes: 18688
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <stack>
#include <iomanip>
#include <functional>
#include <array>
#include <memory>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#undef NDEBUG
#include <assert.h>

using namespace std;
typedef long long ll;


int n, m;
set<int> adj[(int)2e5];
bool removed[(int)2e5];
string s;

bool valid(const int u) {
	bool ok[2] = { false, false };
	for (auto &&v : adj[u])
		if (!removed[v])
			ok[s[v] - 'A'] = true;
	return ok[0] && ok[1];
}

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

	cin >> n >> m >> s;
	for (int i = 0; i < m; ++i) {
		int a, b;
		cin >> a >> b;
		--a, --b;
		adj[a].insert(b);
		adj[b].insert(a);
	}

	queue<int> q;
	for (int i = 0; i < n; ++i)
		if (!valid(i)) {
			removed[i] = true;
			q.push(i);
		}

	while (!q.empty()) {
		const int u = q.front();
		assert(removed[u]);
		q.pop();
		for (const int &v : adj[u]) {
			if (v != u) {
				// adj[v].erase(u);
				if (!removed[v] && !valid(v)) {
					removed[v] = true;
					q.push(v);
				}
			}
		}
	}

	const bool ans = any_of(removed, removed + n, [](const bool x) { return x == false;  });
	cout << (ans ? "Yes" : "No") << '\n';
	return 0;
}

Measured memory_bytes: 28496
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << x << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010


int main(){
  int n,a,b1=0,b2=0;

  scanf("%d",&n);

  for(int i=0;i<n;i++){
    scanf("%d",&a);

    if(a%2==1)b1++;
    else b2++;

    if(b1 >= 2){
      b1 -=2;
      b2++;
    }

    while(b2 >= 2) b2--;
  }

  
  if(b1 == 0 && b2%2 == 1) puts("YES");
  else if(b1 == 1 && b2%2 == 0) puts("YES");
  else puts("NO");
  
  return 0;
}


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

int LEN = 60;
int MOD = 1e9+7;

int main(){
    int N;
    cin >> N;
    vector<long long> a(N);
    for (int i=0; i<N; i++){
        cin >> a[i];
    }
    vector<vector<int>> cnt(LEN,vector<int>(2));

    for (int i=0; i<N; i++){
        for (int j=0; j<LEN; j++){
            cnt[j][a[i]>>j&1]++;
        }
    }

    int ans=0;
    for (int i=0; i<LEN; i++){
        ans += (1LL << i) % MOD * cnt[i][0] % MOD * cnt[i][1] % MOD;
        ans %= MOD;
    }

    cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2560
n = int(input())
a = [list(map(int, input().split()))]
tmp = 0
for i in range(n-1):
  a.append(list(map(int, input().split())))
for i in range(n-1):
  for j in range(i+1,n):
    tmp += pow((a[i][0] - a[j][0])**2 + (a[i][1] - a[j][1])**2, 1/2)
print(tmp*2/n)

Measured memory_bytes: 3188
import numpy as np
n = int(input())
a = np.array([int(i) for i in input().split()])
cumsum = np.cumsum(a)
s = cumsum[-1]
m = float('inf')
for i in range(n - 1):
    t = cumsum[i]
    m = min(m, abs(2 * t - s))
print(m)

Measured memory_bytes: 32952
#include<stdio.h>
const int N = 100, M = 100; 
int main()
{
	int a[N][M], b[M], n, m;
	
	scanf("%d %d", &n, &m);
	
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < m; j++)
		{
			scanf("%d", &a[i][j]);
		}
	}
	for(int j = 0; j < m; j++)
	{
		scanf("%d", &b[j]);
	}
	
	int c[M];
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < m; j++)
		{
			c[i] += a[i][j]*b[j];			
		}
	}
	for(int i = 0; i< n; i++)
	{
		printf("%d\n", c[i]);
	}
	return 0;
	
} 


Measured memory_bytes: 2736
let a, b, c = Scanf.sscanf (read_line()) "%d %d %d" (fun a b c -> a,b,c)
let k = read_int ()

let rec loop red green blue i =
  if blue > green && green > red then "Yes" else 
  if i >= k then "No" else (
    if red >= green then (loop red (green*2) blue (i+1)) else
    loop red green (blue*2) (i+1)
  )

let () = print_endline @@ loop a b c 0


Measured memory_bytes: 3728
// AOJ 0162
#include <iostream>

using namespace std;

bool is_hamming(int num){
	while (num % 2 == 0){
		num /= 2;
	}
	while (num % 3 == 0){
		num /= 3;
	}
	while (num % 5 == 0){
		num /= 5;
	}

	return (num == 1);
}

int main(void)
{
	int m, n;
	while (cin >> m, m){
		cin >> n;
		int ret = 0;
		for (int i = m; i <= n; i++){
			if (i == 1){
				ret++;
				continue;
			}
			if (is_hamming(i)){
				ret++;
				// cout << i << endl;
			}
		}
		cout << ret << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
using namespace std;

int main(){
	int N;
	cin >> N;
	vector<int> a(N+1);
	int idx = -1, b = 0;
	for(int i = 1; i <= N; ++i) {
		cin >> a[i];
		if(abs(a[i]) > b) {
			idx = i;
			b = abs(a[i]);
		}
	}
	if(b == 0) {
		cout << 0 << endl;
		return 0;
	}
	cout << 2 * (N - 1) << endl;
	if (a[idx] > 0) {
		cout << idx << " " << 2 << endl;
		cout << idx << " " << 2 << endl;
		for(int i = 2; i < N; ++i) {
			cout << i << " " << i + 1 << endl;
			cout << i << " " << i + 1 << endl;
		}
	} else {
		cout << idx << " " << N - 1 << endl;
		cout << idx << " " << N - 1 << endl;
		for(int i = N -1; i >= 2; --i) {
			cout << i << " " << i - 1 << endl;
			cout << i << " " << i - 1 << endl;
		}
	}
	return 0;
}


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

int main()
{
    string a,b;
    ll m=999999999999999,i,j,p,u;
    cin>>a;
    for(i=0; i<(a.length()-2); i++)
    {
        b=a.substr(i,3);
        stringstream g(b);
        ll x=0;
        g>>x;
        p=abs(x-753);
        m=min(p,m);
        b.clear();

    }
    cout<<m<<endl;
    return 0;

}


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

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define fst first
#define snd second
#define pf push_front
#define pb push_back
#define eb emplace_back
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  VI a(m, 0);
  rep(i, m)
  {
    int c, d;
    cin >> c >> d;
    c--;
    d--;
    a[c]++;
    a[d]++;
  }
  bool ans = false;
  rep(i, n)
  {
    if ((a[i] % 2) & 1) {
      ans = true;
      break;
    }
  }

  puts(ans ? "NO" : "YES");
  return 0;
}


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

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




using namespace std;

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

inline void yo(int &x)
{
    if(x<0)x+=mod;
    x=x%mod;

}
int fact[M+4];
int infact[M+4];
int ncr(int n,int r)
{
    int ret=1;
    if(n<0 || r<0 || n<r)return 0;
    if(n==r || r==0)return 1;
    ret=fact[n]*infact[n-r];
    yo(ret);
    ret=(ret*infact[r]);
    yo(ret);
    return ret;
}
void init()
{
    fact[0]=1; infact[0]=1;
    f(i,1,M)fact[i]=(fact[i-1]*i)%mod;
    infact[M]=bigmod(fact[M],mod-2);
    rf(i,M-1,1)infact[i]=(infact[i+1]*(i+1))%mod;
}
int pre[M+4];
int suf[M+4];
 main()

{
    fast
    //init();
    int n,k;
    cin>>n>>k;
    pre[1]=0;
    for(int i=2;i<=n+1;i++)
    {
        pre[i]=(pre[i-1]+(i-1));
    }
    suf[1]=n;
    int j=2;
    rf(i,n,1)
    {
        suf[j]=suf[j-1]+(i-1);
        j++;
    }
    int ses=0;
    for(int i=k;i<=(n+1);i++)
    {
        int lft=pre[i];
        int rgt=suf[i];
        //cout<<lft<<" "<<rgt<<endl;
        int cnt=rgt-lft+1;
        ses=(ses+cnt);
        yo(ses);
    }
    cout<<ses<<endl;
    return 0;

}













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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 998244353;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

LL d(LL a, LL b) {
    LL exp = MOD - 2;
    while(exp) {
        if(exp % 2 != 0) {
            a *= b;
            a %= MOD;
        }
        b *= b;
        b %= MOD;
        exp >>= 1;
    }
    return a;
}

LL dp[3005][6005];

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

    int N, S;
    cin >> N >> S;

    LL t = 1;
    for(int i = 1; i <= N; ++i) {
        t *= 2;
        t %= MOD;
    }

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

    dp[0][0] = t;
    for(int i = 0; i < N; ++i) {
        for(int j = 0; j <= S; ++j) {
            dp[i][j] %= MOD;
            dp[i + 1][j] = (dp[i][j] + dp[i + 1][j]) % MOD;
            dp[i + 1][j + v[i]] += d(dp[i][j], 2ll);
            dp[i + 1][j + v[i]] %= MOD;
        }
    }

    cout << dp[N][S] % MOD << endl;

    return 0;
}


Measured memory_bytes: 97824
#include <cstdio>
#include <iostream>
using namespace std;
int n,m;
string s,t;
int dp[2050][2050][2];
int ans=-1;
int main()
{
	scanf("%d %d",&n,&m);
	cin >> s;
	cin >> t;
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<=m;j++)
		{
			if(i<n&&s[i]=='I')dp[i+1][j][1]=max(dp[i+1][j][1],dp[i][j][0]+1);
			else if(i<n)dp[i+1][j][0]=max(dp[i+1][j][0],dp[i][j][1]+1);
			if(j<m&&t[j]=='I')dp[i][j+1][1]=max(dp[i][j+1][1],dp[i][j][0]+1);
			else if(j<m)dp[i][j+1][0]=max(dp[i][j+1][0],dp[i][j][1]+1);
		}
	}
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<=m;j++)
		{
			ans=max(ans,dp[i][j][1]);
		}
	}
	if(ans==0)
	{
		printf("0\n");
	}
	else printf("%d\n",ans-((ans+1)%2));
	return 0;
}

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

int main() {
    int N;
    cin >> N;
    long long cnt[10] = {};
    string pattern = "MARCH";
    for (int i = 0; i < N; i++) {
        string S;
        cin >> S;
        for (int j = 0; j < 5; j++) {
            if (S[0] == pattern[j]) cnt[j]++;
        }
    }

    long long ans = 0;
    for (int i = 0; i < 5; i++) {
        for (int j = i + 1; j < 5; j++) {
            for (int k = j + 1; k < 5; k++) {
                ans += cnt[i] * cnt[j] * cnt[k];
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <climits>
#include <iomanip>
#include <deque>
#include <limits>

using namespace std;

int64_t gcd(int64_t x, int64_t y)
{
  if (x > y) {
    swap(x, y);
  }

  // x < y を仮定して解く

  while (true) {
    int64_t x_dash = y % x;
    if (x_dash == 0) {
      return x;
    }

    y = x;
    x = x_dash;
  }
}

int main()
{
  int64_t K;

  cin >> K;

  int64_t sum = 0;
  for (int64_t a = 1; a <= K; a++) {
    for (int64_t b = 1; b <= K; b++) {
      for (int64_t c = 1; c <= K; c++) {
        sum += gcd(a, gcd(b, c));
      }
    }
  }

  cout << sum << endl;

  return 0;
}


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

#define FOR(i,l,r) for(int i = int(l);i < int(r);i++)
template<typename T> bool chmax(T& a,const T& b){ return a < b ? (a = b,true) : false; }
template<typename T> bool chmin(T& a,const T& b){ return b < a ? (a = b,true) : false; }
typedef long long ll;

string S;

int main()
{
	cin >> S;

	if(S.substr(0,4) == "YAKI"){
		puts("Yes");
	}
	else{
		puts("No");
	}

	return 0;
}


Measured memory_bytes: 256