akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>
int max(int a,int b){return a>b?a:b;}
int min(int a,int b){return a<b?a:b;} 
int main(void)
{
  int n,m,a[10000]={0},suma=0;
  scanf("%d %d",&n,&m);
  for(int i=0;i<m;i++)
  {
    scanf("%d",&a[i]);
    suma=suma+a[i];
  }
  if(suma<=n)
    printf("%d",n-suma);
  else 
    printf("-1");
  
}


Measured memory_bytes: 1776
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef pair<int,int> P;
int main(){
    int n;
    char S[300][300],T[300][300];
    cin>>n;
    rep(i,n)rep(j,n) cin>>S[i][j];
    int ans=0;
    rep(i,n){
        int z=1;
        rep(j,n)rep(k,n) T[j][k]=S[(j+i)%n][k];
        rep(j,n)rep(k,n) if(T[j][k]!=T[k][j]) z=0;
        if(z) ans++;
    }
    cout<<ans*n;
}

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

int main(void){

  long long n,k,q;
  cin >> n >> k >> q;
  vector<int>a(q);
  vector<int>b(n);
  long long i = 0;
  for(i =0 ;i<q;i++){
    cin >> a[i];
  }
  
  for(i=0;i<n;i++){
    b[i] = 0;
  }

  for(i=0;i<q;i++){

    b[a[i]-1] = b[a[i]-1] + 1;
    
    
  }

  for(i=0;i<n;i++){
    if(b[i] >= q - k + 1){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;
    }
  }
  
  
  return 0;

}

Measured memory_bytes: 1408
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<bitset>
#include<set>
#define N (3010)
#define P (1000000007)
#define M ()
#define inf (0x7f7f7f7f)
#define rg register int
#define Label puts("NAIVE")
#define spa print(' ')
#define ent print('\n')
#define rand() (((rand())<<(15))^(rand()))
#define file(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
typedef long double ld;
typedef long long LL;
typedef unsigned long long ull;
using namespace std;
namespace fastIO1{
	inline char read(){
		static const int IN_LEN=1000000;
		static char buf[IN_LEN],*s,*t;
		return (s==t?t=(s=buf)+fread(buf,1,IN_LEN,stdin),(s==t?-1:*s++):*s++);
	}
	template<class T>
	inline void read(T &x){
		static bool iosig;
		static char c;
		for(iosig=false,c=read();!isdigit(c);c=read()){
			if(c=='-')iosig=true;
			if(c==-1)return;
		}
		for(x=0;isdigit(c);c=read())x=((x+(x<<2))<<1)+(c^'0');
		if(iosig)x=-x;
	}
	inline char readc(char &c){
		for(c=read();!isalpha(c)&&!isdigit(c);c=read())
		if(c==-1)return 0;
	}
	const int OUT_LEN = 10000000;
	char obuf[OUT_LEN],*ooh=obuf;
	inline void print(char c){
		if(ooh==obuf+OUT_LEN)fwrite(obuf,1,OUT_LEN,stdout),ooh=obuf;
		*ooh++=c;
	}
	template<class T>
	inline void print(T x){
		static int buf[30],cnt;
		if(x==0)print('0');
		else{
			if(x<0)print('-'),x=-x;
			for(cnt=0;x;x/=10)buf[++cnt]=x%10+48;
			while(cnt)print((char)buf[cnt--]);
		}
	}
	inline void flush(){fwrite(obuf,1,ooh-obuf,stdout);}
}
namespace fastIO2{
	template<class T>
	inline void read(T &x){
		static bool iosig;
		static char c;
		for(iosig=false,c=getchar();!isdigit(c);c=getchar()){
			if(c=='-')iosig=true;
			if(c==-1)return;
		}
		for(x=0;isdigit(c);c=getchar())x=((x+(x<<2))<<1)+(c^'0');
		if(iosig)x=-x;
	}
}
using namespace fastIO1;
int n,m,f[N][N],inv2,a[N],ans;
int ksm(int a,int p){
	int res=1;
	while(p){
		if(p&1)res=1ll*res*a%P;
		a=1ll*a*a%P,p>>=1;
	}
	return res;
}
int main(){
	read(n),read(m),inv2=ksm(2,P-2);
	for(int i=1;i<=n;i++)read(a[i]);
	for(int i=1;i<=n;i++)
	for(int j=1;j<=n;j++)
	f[i][j]=(int)(a[i]>a[j]);
	for(int i=1;i<=m;i++){
		int x,y; read(x),read(y);
//		if(x>y)swap(x,y);
		f[x][y]=f[y][x]=1ll*(f[x][y]+f[y][x])*inv2%P;
		for(int j=1;j<=n;j++)
		if(j!=x&&j!=y){
			f[x][j]=f[y][j]=1ll*(f[x][j]+f[y][j])*inv2%P;
			f[j][x]=f[j][y]=1ll*(f[j][y]+f[j][x])*inv2%P;
		}
	}
	for(int i=1;i<=n;i++)
	for(int j=i+1;j<=n;j++)
	(ans+=f[i][j])%=P;
	printf("%lld\n",1ll*ans*ksm(2,m)%P);
}

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


typedef long long ll;
ll MOD = 1000000007;
ll N;
//-----------------------------------------------------------------
ll solve(ll n) {
	set<int> cnt;
	rep(i, 0, n + 1) {
		int j = n - i;
		if (i > j) break;
		cnt.insert(i^j);
	}

	return cnt.size();
}

map<ll, ll> memo;
ll a(ll n) {
	if (0 < memo[n]) return memo[n];

	if (n < 2) {
		if (n < 1)
			return memo[n] = 1;
		else
			return memo[n] = 3;
	} else {
		if (n % 2 == 0) {
			if (n == 2)
				return memo[n] = 4;
			else
				return memo[n] = (a(n / 2 - 2) + 2 * a(n / 2 - 1) + 2) % MOD;
		}
		else {
			return memo[n] = (2 * a((n - 3) / 2) + a((n - 1) / 2) + 2) % MOD;
		}
	}
}

int main() {
	cin >> N;
	cout << (a(N - 1) + 1) % MOD << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>



using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

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

















int main(){
    ll n, t;
    cin >> n >> t;
    vector<ll> a(n), b(n);
    REP(i, n){
        cin >> a[i] >> b[i];
    }
    
    vector<vector<ll>> dp1(n + 2, vector<ll>(6005));
    vector<vector<ll>> dp2(n + 2, vector<ll>(6005));
    REP(i, n){
        REP(j, t){
            dp1[i + 1][j] = max(dp1[i + 1][j], dp1[i][j]);
            dp1[i + 1][j + a[i]] = max(dp1[i + 1][j + a[i]], dp1[i][j] + b[i]);
        }
    }
    for(ll i = n - 1; i >= 0; i--){
        REP(j, t){
            dp2[i + 1][j] = max(dp2[i + 1][j], dp2[i + 2][j]);
            dp2[i + 1][j + a[i]] = max(dp2[i + 1][j + a[i]], dp2[i + 2][j] + b[i]);
        }
    }
    ll ans = 0;
    for(ll i = 1; i <= n; i++){
        REP(j, t){
            ans = max(ans, dp1[i - 1][j] + dp2[i + 1][t - 1 - j] + b[i - 1]);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 282240
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

#define SQR(x) ((x) * (x))


double calcDirec(int r, int l)
{	return sqrt(SQR(r + l) - SQR(r - l));	}

double memo[12][1 << 12];
int n;

double rec(vint& rs, int prv, int u)
{
	if(u + 1 == 1 << n)	return prv;
	if(prv != -1 && memo[prv][u] != -1) return memo[prv][u];
	
	double res = 1 << 20;
	
	rep(i, n) if(!(u & 1 << i)) chmin(res, rec(rs, rs[i], u | 1 << i) + (prv == -1 ? rs[i] : calcDirec(prv, rs[i])));
	
	return (prv != -1 ? memo[prv][u] = res : res);
}

int main()
{
    for(string line; getline(cin, line);)
	{
		rep(i, 12) rep(j, 1 << 12) memo[i][j] = -1;
		vint rs;
		
		istringstream iss(line);
		
		string str; iss >> str;
		
		int H = atoi(str.c_str());
		
		for(n = 0; iss >> str; n++) rs.push_back(atoi(str.c_str()));
	
		cout << (rec(rs, -1, 0) <= H ? "OK" : "NA") << endl;
	}
}

Measured memory_bytes: 1304
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

constexpr ll infl = 10000000000000007LL;
constexpr int inf = 1000000007;

int main() {
    string s;
    cin >> s;
    int cnt = 0;
    for (int i = 0; i < s.size(); ++i) {
        cnt += s[i] == 'p';
    }
    cout << s.size() / 2 - cnt << endl;
    return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
#include<memory.h>
#define SMAX 330
int C[SMAX+1][1024];
int count(int n, int s, int U){
	int i, c, b;
	if(n == 0) {
		return s==0;
	} else {
		if(C[s][U] >= 0)
			return C[s][U];
		c = 0;
		for(i = 0; i <= 9; i ++){
			b = 1<<i;
			if(!(U & b) && n*i <= s){
				c += count(n-1, s-n*i, U|b);
			}
		}
		return C[s][U]=c;
	}
}
int main(){
	int n, s, U, c;
	while(~scanf("%d%d", &n, &s)){
		memset(C,0xFF,sizeof(C));
		U=0;
		if (s <= SMAX)
			c = count(n, s, U);
		else
			c = 0;
		printf("%d\n", c);
	}
	return 0;
}

Measured memory_bytes: 1736
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
typedef long long ll;
typedef vector<int> VI;
typedef vector< vector<int> > VII;
typedef pair<int,int> PII;

int main(){
  string S,T;
  cin>>S>>T;
  int ans=0;
  rep(i,3) if(S[i]==T[i]) ans++;
  cout<<ans<<endl;
}



Measured memory_bytes: 256
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {in_n: i64, in_k: i64};
    let m = in_n % in_k;
    let r = in_k - m;

    if m < r {
        println!("{}", m);
    } else {
        println!("{}", r);
    }
}


Measured memory_bytes: 2148
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cout << H << " "; debug_out(T...); }
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  ll n,k;
  cin >> n >> k;
  vector<ll> x(n);
  ll ans = 0;
  rep(i,n) {
    cin >> x[i];
    ans += 2 * min(fabs(x[i]), fabs(x[i] - k));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
S = input()
N = len(S)

if S[0] == "0" or S[-1] == "1":
    print(-1)
    exit()

D = {}
for i in range(N - 1):
    D[i + 1] = S[i]
for i in range(1, N):
    if D[i] != D[N - i]:
        print(-1)
        exit()

# 構築
T = [[] for i in range(N)]

next = 1
mark = 0
for i in range(N):
    child = mark + 1
    if S[i] == "0":
        next += 1
    else:
        for n in range(next):
            T[mark].append(child)
            child += 1
        next = 1
        mark = child - 1

for i in range(N):
    for t in T[i]:
        print(i + 1, t + 1)

Measured memory_bytes: 29152
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
template<class T> bool umin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool umax(T &a, T b) { return a < b ? (a = b, true) : false; }
#define ALL(x) (x).begin(), (x).end()
LL POW(LL a,LL p,LL M){ if(!p) return 1LL;LL T = POW(a,p/2,M);T = T*T%M; if(p&1) T=T*(a%M)%M; return T; }
LL SQRT(LL a) { LL b = (LL)sqrtl(((double)a)+0.5); while(b*b<a) ++b; while(b*b>a) --b; return (b*b==a)?b:-1; }
//endl
//<------------------------edits---------------------------------------------->
const LL MOD = 1e9+7;//998244353
// #define LOCAL LDD
// #define int LL

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);cout << fixed;
#ifdef LOCAL
  freopen("input.txt", "rt", stdin);
#endif
  int arr[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k;cin >> k;
  cout << arr[k-1] << endl;
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s\n";
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
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; }

const int MOD = 1000000007;
const int INF = 1e9;

const int mod = 1000000007;
const int inf = 1e9;
#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    ll n, a, b;
    cin >> n >> a >> b;
    vector<int> h(n);
    for(int i = 0; i < n; i++) cin >> h[i];

    auto ok = [&](ll x) {
        ll cost = 0;
        for(int i = 0; i < n; i++) {
            if(b*x>=h[i]) continue;
            cost += (h[i]-b*x+a-b-1)/(a-b);
        }
        return cost <= x;
    };

    ll l = -1, r = 1e9;
    while(r-l>1) {
        int mid = (l+r)/2;
        if(ok(mid)) r = mid;
        else l = mid;
    }

    cout << r << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define LiangJiaJun main
#define ll long long
using namespace std;
int h[100004],n,k;
int LiangJiaJun(){
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)scanf("%d",&h[i]);
    sort(h+1,h+n+1);
    int ans=h[n];
    for(int i=1;i+k-1<=n;i++){
        ans=min(ans,h[i+k-1]-h[i]);
    }
    printf("%d\n",ans);
    return 0;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector> 
 
using namespace std;
 
 
 
int main() {
	int n;
	int t;
	int a;
	vector<int> h;
	
	scanf("%d%d%d", &n, &t, &a);
	int u;
	for (int i = 0; i < n; i++) {
		scanf("%d", &u);
		h.push_back(u);
	}
	double min= abs(a - t + h[0] * 0.006);
	double v;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		v = abs(a-t + h[i] * 0.006);
		if (min > v) {
			ans = i;
			min = v;
		}
	}
	cout << ans+1  << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
#define ll long long

ll getNum(string s) {
	ll temp = 1;
	char prev = s[0];
	ll sl = s.size();
	ll ret = 0;
	for (ll i = 1; i < sl; ++i) {
		if (prev == s[i]) {
			++temp;
		}
		else if (temp != 1) {
			ret += temp / 2;
			temp = 1;
		}
		prev = s[i];
	}
	if (temp != 1) {
		ret += temp / 2;
	}

	return ret;
}

int main() 
{
	ll k;
	string s;
	cin >> s;
	cin >> k;

	ll sl = s.size();
	bool sameAll = true;
	char prev = s[0];
	for (ll i = 1; i < sl; ++i) {
		if (prev != s[i]) {
			sameAll = false;
			break;
		}
	}

	ll ret = 0;
	if (sameAll) {
		ret = sl * k / 2;
	}
	else {
		bool sameSE = (s[0] == s[sl-1]);
		if (sameSE) {
			string ps;
			string es;
			for (ll i = 1; i < sl; ++i) {
				if (s[i] != s[0]) {
					ps = s.substr(0, i);
					es = s.substr(i, sl - i);
					break;
				}
			}

			ll s1 = getNum(ps);
			ll s2 = getNum(es);
			ll s3 = getNum(es+ps);
			ret = s3 * (k - 1) + s1 + s2;
		}
		else {
			ret = getNum(s) * k;
		}

	}

	cout << ret << endl;

	return 0;
}

Measured memory_bytes: 256
S = input()
ans = 0
a = 0
bc = 0
now = 0
for s in S:
    if s == "A":
        if now == 1:
            a = 1
            bc = 0
            now = 0
        else:
            a += 1
    elif s == "B":
        if now == 0:
            now = 1
        else:
            a = 0
            bc = 0
            now = 0
    else:
        if now == 1:
            ans += a
            now = 0
        else:
            a = 0
            bc = 0
print(ans)


Measured memory_bytes: 3500
O = input()
E = input()
ans = ""
if len(O) > len(E):
    for i in range(len(E)):
        ans += O[i]+E[i]
    print(ans + O[-1])
elif len(O) < len(E):
    for i in range(len(O)):
        ans += O[i]+E[i]
    print(ans + E[-1])
else:
    for i in range(len(O)):
        ans += O[i]+E[i]
    print(ans)


Measured memory_bytes: 3064
#include<iostream>
using namespace std;
#define P 1000000007
int main(){
  unsigned long long a,b,s,l=1;
  cin>>b>>a;s=b;
  while(a!=1){
    if(a%2){
      l=l*s%P;
    }
    s=s*s%P;
    a/=2;
  }
  s=l*s%P;
  cout<<s<<endl;
}

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

int main() {
    string s; cin >> s;
    int l = 0; int ans = 0;
    string prev = "";
    for (int i = 0; i < s.size(); i++) {
        if (s.substr(l, i-l+1) != prev) {
            prev = s.substr(l, i-l+1);
            ans++; l = i+1;
        }
    }
    cout << ans << endl;
    return 0;
}

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


int main(){
	char b;
	cin >> b;
	if(b=='A') cout << 'T' << endl;
	if(b=='T') cout << 'A' << endl;
	if(b=='C') cout << 'G' << endl;
	if(b=='G') cout << 'C' << endl;
	return 0;
}













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

template <typename T> T gcd(T x, T y) {
  if (y == 0)
    return x;
  return gcd(y, x % y);
}

template <typename T> T lcm(T x, T y) {
  if (x == 0 || y == 0)
    return 0;
  return x / gcd(x, y) * y;
}

int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}

vector<int> p;
vector<int> r;

void init(int n) {
  p.reserve(n);
  r.reserve(n);
  for (int i = 0; i < n; i++) {
    p[i] = i;
    r[i] = 0;
  }
}

int root(int x) { return p[x] == x ? x : p[x] = root(p[x]); }

bool same(int x, int y) { return root(x) == root(y); }

void unite(int x, int y) {
  x = root(x);
  y = root(y);
  if (x == y)
    return;

  if (r[x] < r[y])
    p[x] = y;
  else {
    p[y] = x;
    if (r[x] == r[y])
      r[x]++;
  }
}

int main() {
  int N;
  cin >> N;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    ans += a - 1;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<math.h>
using namespace std;
int main(){
	int n,k,s;
	while(true){
	    cin>>n>>k>>s;
		if(n==0&&k==0&&s==0)
			break;
		int count=0;
		if(n==0&&k==0&&s==0)
			break;
		for(int i=0;i<pow(2.0,n+0.0);i++){
			int scount=0,kcount=0;
			int bit=i;
			for(int j=1;j<=n;j++){
				if((bit&1)==1){
					scount+=j;
					kcount++;
				}
				bit=bit>>1;
			}
			if(scount==s&&kcount==k)
				count++;
		}
		cout<<count<<endl;
	}
	return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
//#include "cpp/Solution.h"

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int>c(n);
    for(int i = 0;i < n;i++){
        cin >> c[i];
    }
    int ans = 0;
    for(int i = 0;i < n;i++){
        if(i % 2==0 && c[i] % 2!=0)
            ans++;
    }
    cout << ans << endl;
}





Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}

int main(){
    ll n, x, m;
    cin >> n >> x >> m;
    vl a;
    vi used(m+1, -1);
    a.emplace_back(x);
    used[x] = 0;
    int l = -1, r = -1;
    while(1) {
        x *= x;
        x %= m;
        if(used[x] >= 0) {
            l = used[x];
            r = a.size();
            break;
        }
        else {
            used[x] = a.size();
            a.emplace_back(x);
        }
    }
    ll ans = 0;
    ll sum = 0;
    int d = r - l;
    if(n <= l) {
        rep(i, n) ans += a[i];
        cout << ans << '\n';
        return 0;
    }
    rep(i, l) ans += a[i];
    REP(i, l, r) sum += a[i];
    n -= l;
    ans += sum * (n / d);
    n %= d;
    REP(i, l, l+n){
        ans += a[i];
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 4256
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

using ll=long long;
using vi=std::vector<int>;
using vvi=std::vector<vi>;
using vll=std::vector<ll>;
using vvll=std::vector<vll>;
template<typename T> using vvec=std::vector<std::vector<T>>;
template<typename T>
auto make_v(size_t sz){return std::vector<T>(sz);}
template<typename T,typename... Ts>
auto make_v(size_t sz,Ts...ts){return std::vector<decltype(make_v<T>(ts...))>(sz,make_v<T>(ts...));}
template<typename T>
void fill_v(T&var,const T&x){var=x;}
template<typename V,typename T>
void fill_v(V&v,const T&x){for(auto&& w:v){fill_v(w,x);}}

template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<std::vector<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<std::deque<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s, const std::set<T>&v){
  s<<"\n";for(auto&& elm:v){s<<elm<<"\t";}s<<"\n";return s;}

inline void scan(int&a){scanf("%d",&a);}
inline void scan(ll&a){scanf("%lld",&a);}
inline void scan(char&a){scanf(" %c",&a);}
inline void scan(double&a){scanf("%lf",&a);}
inline void scan(std::string&s){char BUF[3000000];scanf(" %s",BUF);s=std::string(BUF);}
template<typename T>
inline void scan(std::vector<T>&v){for(auto&& sv:v){scan(sv);}}
template<typename First,typename...Args>
inline void scan(First&f,Args&...args){scan(f);scan(args...);}
inline void print(int a){printf("%d\n",a);}
inline void print(ll a){printf("%lld\n",a);}
inline void print(double a){printf("%.12f\n",a);}
inline void print(std::string s){std::cout<<s<<"\n";}

using namespace std;

int main() {
  ll n; scan(n);
  vll a(5); scan(a);
  ll m = LLONG_MAX;
  rep (i, 5) {
    m = min(m, a[i]);
  }
  ll g = (n + m-1) / m;
  ll ans = g + 4;
  print(ans);
  return 0;
}


Measured memory_bytes: 888
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cstdio>
#include<cmath>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<string>
#include<tuple>
#include<utility>
#include<vector>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define REP(i, n)  for(int i=0; i<(int)(n); i++)
#define REPS(i, n)  for(int i=1; i<=(int)(n); i++)
#define PER(i, n) for(int i=(int)(n)-1; i>= 0; i--)
#define PERS(i, n)  for(int i=(int)(n)-1; i>0; i--)
#define FOR(i, c) for(__typeof((c).begin()) i = (c).begin(); i!=(c).end(); i++)
#define RFOR(i, c)  for(__typeof((c).rbegin()) i=(c).rbegin(); i!=(c).end(); i++)
#define ALL(container)  (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define SZ(container) (container).size()
#define FILL0(n)  setfill('0') << right << setw(n)
#define mp(a, b)  make_pair(a, b)
#define toLower(c)  c+0x20
#define toUpper(c)  c-0x20
#define pb  push_back
#define eb  emplace_back

const int INF = 1<<28;
const int MOD = 1000000007;

int main(){
  ll n, m; cin >> n >> m;
  vector<ll> ans(n+1, 0);
  vector<bool> stairs(n+1, true);
  REP(i, m){
    ll num;  cin >> num;
    stairs[num] = false;
  }
  ans[0] = 1;
  ans[1] = stairs[1] ? 1 : 0;
  rep(i, 2, n+1){
    if(stairs[i]){
      if(stairs[i-1])  ans[i] += ans[i-1];
      if(stairs[i-2])  ans[i] += ans[i-2];
      ans[i]%=MOD;
    }
  }
  cout << ans[n] << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
using namespace std;
#define ll           long long
#define all(v)       (v).begin() , (v).end()
#define vi           vector <ll>
#define vii          vector <pair<ll,ll>>
#define ii           pair<ll,ll>
#define sz(v)	     ((int)((v).size()))
#define lp(i,a,b)    for(int i=a;i<b;i++)
#define pb           push_back
#define pf           push_front
#define F            first
#define S            second
#define endl         "\n"
#define IOS          ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const double PI = 3.14159265358979323846;
const ll inf=2e9,MOD=1e9+7,MAX=1e5+1;
int n;
ll s;
set<pair<ll,ll>>adj[MAX];
vector<int>vis(MAX);
priority_queue<pair<ll,pair<ll,ll>>>st;
ll x;
ll dfs(int node){
    vis[node]=1;
    ll ret=0;
    for(auto i:adj[node]){
        if(!vis[i.first]){
            x=dfs(i.F);
            st.push({x*i.S,{i.S,x}});
            ret+=x;
        }
    }
    if(sz(adj[node])==1)
        ret++;
    return ret;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n,res=0;
    cin>>n;
    int a[n+1];
    lp(i,1,n+1)
        cin>>a[i],res+=(a[i]%2==1&&i%2==1);
    cout<<res;
}

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

#define fi first
#define se second
#define show(x) cerr << #x << "=" << "\n"
typedef long long ll;
typedef unsigned long long ull;

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;
#ifdef LOCAL_DEFINE
  FILE *stream1;
  FILE *stream2;
  stream1 = freopen("in.txt", "r", stdin);
  stream2 = freopen("out.txt", "w", stdout);
  if (stream1 == NULL) return 0;
  if (stream2 == NULL) return 0;
#endif
  int n;
  while (cin >> n, n) {
    int sum = 0;
    int a[10001];
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      sum += a[i];
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] * n <= sum) ans++;
    }
    cout << ans << endl;
  }
#ifdef LOCAL_DEFINE
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
  fclose(stream1);
  fclose(stream2);
#endif
  return 0;
}


Measured memory_bytes: 3136
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Queue;
import java.util.Random;
import java.util.Scanner;
 


public class Main {
	private static Scanner sc = new Scanner(System.in);
	//result = Math.pow(num1, num3)
	//StringBuffer str = new StringBuffer(hoge1);
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)

	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
	//ArrayList<String> cc = new ArrayList<>(n);
	//Collections.sort(list);
	//Array.sort(list);   cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");//1 1 2 3 5
	static long mod =1000000007;
	//static 	ArrayList<Integer> cc = new ArrayList<>(100);
	
	
	public static void main(String[] args) {
		//int N=sc.nextInt();for(int i=0;i<N;i++) {}
		//int a[]=new int[N];
		//Ae2+Be2=Ce2
		//StringBuffer str = new StringBuffer(hoge1);
		//for(int i=0;i<N;i++) {}
		
		//int N=sc.nextInt();for(int i=0;i<N;i++) {}
		long N=sc.nextInt();
		String S=sc.next();
		long  v[]=new long[26];
		for(int i=0;i<N;i++) {
			v[S.charAt(i)-97]++;
		}
		//long T=modPow(2,N);
		long P=1;
		for(int i=0;i<26;i++) {
			if(v[i]==0)continue;
			P*=v[i]+1;
			P%=mod;
			
		}
		P--;
		p(P);
			
		
		
		
	}
	
		
	
	
		
	
	public static long modPow(long g,long N) {
		long T=1;
		for(int i=0;i<N;i++) {
			T*=g;
			T%=mod;
		}
		return T;
	}
	
	public static long lcm(long a, long b) {
        return a / gcd(a, b) * b;
	}
	
	public static long gcd(long a, long b) {
        return b == 0 ? a: gcd(b, a % b);
	}

	


	
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	
}
	


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

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
	cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args&&... args) {
	const char *comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << " | ";
	__f(comma + 1, args...);
}
#define pi 3.141592653589
#define MOD 1000000007
#define to() int t; cin>>t; while(t--)
#define pb push_back
#define in insert
#define mp make_pair
#define ff first
#define ss second
#define si(s) s.size()
#define fori(it,v) for(it=v.begin();it!=v.end(); it++)
#define for1(low,high,k) for(int i=low;i<high;i+=k)
#define for11(low,high,k) for(int j=low;j<high;j+=k)
#define for2(low,high,k) for(int i=low;i<=high;i+=k)
#define rev(high,low,k)  for(int i=high;i>=low ;i-=k)
#define all(x) x.begin(), x.end()
#define fil(x,i) memset(x,i,sizeof(x));
#define setbits(x) __builtin_popcount(x)
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define read freopen("input.txt","r",stdin)
#define write freopen("output.txt","w",stdout)
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
void i_o() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin) ;
	freopen("output.txt", "w", stdout) ;
#endif
}

const int N=1e6+5;
int spf[N];
void spf_cal(){
	for(int i=1;i<N;i++) spf[i]=i;
	for(int i=4;i<N;i+=2) spf[i]=2;
	for(int i=3;i*i<N;i+=2){
		if(spf[i]!=i) continue;
		for(int j=i*i;j<N;j+=2*i) 
			spf[j]=i;
	}
}



int main()
{
	boost; i_o();
	spf_cal();
	int n; cin>>n;
	ll ans=0;
	for(int i=1;i<n;i++){
		int j=i;
		ll res=1;
		while(j>1){
			ll cnt=0;
			int k=spf[j];
			while(j%k==0){
				j/=k; cnt++;
			}
			res*=(cnt+1);
		}
		ans+=res;
	}
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 7592
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
const int MAXN = 100005;
const int mod = 998244353;

vector<int> gph[MAXN];
int d1[MAXN], d2[MAXN];

void dfs(int x, int p, int *d){
	for(auto &i : gph[x]){
		if(i != p){
			d[i] = d[x] + 1;
			dfs(i, x, d);
		}
	}
}

int main(){
	int n; scanf("%d",&n);
	for(int i=1; i<n; i++){
		int s, e; scanf("%d %d",&s,&e);
		gph[s].push_back(e);
		gph[e].push_back(s);
	}
	dfs(1, 0, d1);
	dfs(n, 0, d2);
	int r1 = 0, r2 = 0;
	for(int i=1; i<=n; i++){
		if(d1[i] <= d2[i]) r1++;
		else r2++;
	}
	if(r1 <= r2) puts("Snuke");
	else puts("Fennec");
}


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

int main(){
    int N;
    cin >> N;
    vi a(N);
    rep(i, N) cin >> a[i];

    sort(a.begin(), a.end(), greater<int>());

    int Alice = 0, Bob = 0;

    rep(i, N){
        if(i % 2) Bob += a[i];
        else Alice += a[i];
    }

    cout << Alice - Bob << endl;
    return 0;
}

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

using namespace std;
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

int main()
{

    int A,B;

    cin>>A>>B;

     cout<<max((A+B),max(A-B,A*B));

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>& p) { os << p.first << " " << p.second; return os; }
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) { for(int i = 0; i < (int) v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }

void solve()
{
    int n; cin >> n;
    double sum = 0.0;
    cout << fixed << setprecision(8);
    for(int i = 0; i < n; i++)
    {
        double x; cin >> x;
        sum += 1 / x;
    }
    cout << 1.0 / sum << endl;
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <functional>
#include <algorithm>
#include <numeric>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <boost/range/irange.hpp>
#include <boost/container/static_vector.hpp>
#include <boost/utility/string_ref.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/math/common_factor_rt.hpp>

class input
{
    std::istream& cin;

public:
    input() : cin(std::cin)
    {
        std::cin.tie(nullptr);
        std::ios::sync_with_stdio(false);
    }

    template <class T>
    inline input& operator>>(T& var)
    {
        cin >> var;
        return *this;
    }
    template <class T>
    inline input& operator,(T& var)
    {
        cin >> var;
        return *this;
    }

    template <class T>
    inline T read()
    {
        T var;
        cin >> var;
        return var;
    }

    template <class InputIterator>
    inline void read(InputIterator head, std::size_t n)
    {
        for (std::size_t i = 0; i < n; ++i) {
            cin >> *head;
            ++head;
        }
    }

    template <class T>
    inline std::vector<T> read(std::size_t n)
    {
        std::vector<T> res;
        res.reserve(n);

        for (std::size_t i = 0; i < n; ++i) {
            T tmp;
            cin >> tmp;
            res.emplace_back(tmp);
        }
        return res;
    }

    template <class T, class F>
    inline void online(std::size_t n, F&& f)
    {
        T var;
        for (std::size_t i = 0; i < n; ++i) {
            cin >> var;
            f(var);
        }
    }
};
template <class T, std::size_t n>
std::istream& operator>>(std::istream& in, std::array<T, n>& var)
{
    for (std::size_t i = 0; i < n; ++i) {
        in >> var[i];
    }
    return in;
}

class output
{
    std::ostream& cout;

public:
    template <bool nl>
    class proxy
    {
        std::ostream& cout;

    public:
        proxy() : cout(std::cout) {}
        ~proxy() { final(); }
        template <class T>
        proxy& operator,(T&& val)
        {
            cout << ' ' << val;
            return *this;
        }
        template <bool f = nl>
        auto final() -> std::enable_if_t<f> { cout << '\n'; }
        template <bool f = nl>
        auto final() -> std::enable_if_t<!f> {}
    };

public:
    output() : cout(std::cout)
    {
        cout << std::fixed << std::setprecision(15);
    }

    template <class T>
    proxy<true> operator,(T&& val)
    {
        cout << val;
        return {};
    }
    proxy<false> noreturn() { return {}; }

    template <class T>
    void print(const T& container)
    {
        bool first = true;
        for (auto&& x : container) {
            if (!first) {
                cout << ' ';
            }
            cout << x;
            first = false;
        }
    }
};

void prog()
{
    input in;
    output out;

    int x, a;
    in >> x, a;
    out, x < a ? 0 : 10;
}

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


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

using namespace std;

#define fi first
#define se second
#define eb emplace_back
#define mt make_tuple
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

const ll INF=LLONG_MAX;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	int n; cin >> n;
	int even = n/2;
	int odd = n-even;
	cout << odd*even << endl;
}
	
// READ & UNDERSTAND
// ll, int overflow, array bounds, memset(0)
// special cases (n=1?), n+1 (1-index)
// do smth instead of nothing & stay organized
// WRITE STUFF DOWN


Measured memory_bytes: 256
using System;

namespace ALDS1_1_C
{
    class Program
    {
        static void Main(string[] args)
        {
            //入力
            int inputCount = int.Parse(Console.ReadLine().Trim());
            int[] inputNum = new int[inputCount];
            for (int lp = 0; lp < inputCount; lp++)
            {
                inputNum[lp] = int.Parse(Console.ReadLine().Trim());
            }

            // 計算
            int conter = 0;
            for (int lp = 0; lp < inputCount; lp++)
            {
                conter += isPrime(inputNum[lp]) ? 1 : 0;
            }
            Console.WriteLine(conter);
        }

        static bool isPrime(int val)
        {
            if (val == 2) return true;
            if (val < 2 || val % 2 == 0) return false;
            var i = 3;
            while (i <= Math.Sqrt(val))
            {
                if (val % i == 0) return false;
                i += 2;
            }
            return true;
        }
    }
}



Measured memory_bytes: 15928
const maxn = trunc(1e5);
var a,b:array[1..maxn + 2] of longint;
    i,n:longint;
    re:int64;

begin
	readln(n);
	for i:=1 to n + 1 do read(a[i]);
	for i:=1 to n do read(b[i]);
	re:=0; b[n+1]:=0; a[n+2]:=0;
	for i:=1 to n + 1 do  
		  begin
		    if a[i] >= b[i] then 
		      begin
		        re:= re + b[i];
	          b[i]:=0;
		      end
		    else
		      begin
		        re:= re + a[i];
		        b[i]:=b[i] - a[i];
	          if a[i+1] >= b[i] then 
	            begin
	              re:= re + b[i];
	              a[i+1]:=a[i+1] - b[i];
	              b[i]:=0;
	            end
	          else 
	            begin
	              re:= re + a[i+1];
	              a[i+1]:=0; b[i]:=0;
	            end;
		      end;
		  end;
	write(re);
end.

Measured memory_bytes: 896
#include <algorithm>
#include <iostream>
#include <queue>
#include <cmath>
#include <string>
#include <iterator>
#include <map>
#include <set>
#include <iomanip>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define INF 100000000
#define MAX 200001
#define MOD 1000000007
ll fac[MAX], finv[MAX], inv[MAX];
const int MX = 1000005;

int main(){
    ll n,a,b;cin>>n>>a>>b;
    ll sum=a+b;
    ll ans=(n/sum)*a;
    ans+=min(n-(n/sum)*sum,a);
    cout<<ans<<endl;
}


Measured memory_bytes: 256
from itertools import permutations as perm
from math import sqrt

n = int(input())
xy = [(x, y) for x, y in (map(int, input().split()) for _ in range(n))]
ans = 0
for order in perm(range(n)):
    for i, j in zip(order, order[1:]):
        xi, yi = xy[i]
        xj, yj = xy[j]
        ans += sqrt((xi-xj)**2+(yi-yj)**2)

nfact = 1
for i in range(1, n + 1):
    nfact *= i

print(ans/nfact)


Measured memory_bytes: 40684
def main():
    N = int(input())
    A = list(map(int, input().split()))
    prod = 1
    maxVal = 10**18
    if 0 in A:
        print(0)
        return
    for a in A:
        prod *= a
        if prod > maxVal:
            print(-1)
            return
    print(prod)

if __name__ == '__main__':
    main()



Measured memory_bytes: 21708
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<long long>;
using pll = pair<long long, long long>;
#define rep(i,n) for(long long i(0);(i)<(n);(i)++)
ll INF = 1LL << 60;

void solve(long long N, long long H, std::vector<long long> a, std::vector<long long> b){
    ll H_old = H;
    priority_queue<pll > que;
    rep(i, N){
        que.push(make_pair(a[i], 0));
        que.push(make_pair(b[i], 1));
    }
    ll cnt = 0;
    while(!que.empty()){
        auto P = que.top();
        
        if(P.second){
            que.pop();
            cnt ++;
            H -= P.first;
            if (H <= 0)
                break;
        }
        else{
            cnt += (H + P.first - 1)/ P.first;
            break;
        }
    }

    cout << cnt << endl;


}

int main(){
    long long N;
    scanf("%lld",&N);
    long long H;
    scanf("%lld",&H);
    std::vector<long long> a(N);
    std::vector<long long> b(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&a[i]);
        scanf("%lld",&b[i]);
    }
    solve(N, H, std::move(a), std::move(b));
    return 0;
}


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

using namespace std;

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

int main() {
  int A, B, C;
  cin >> A >> B >> C;

  int result = B;
  result += min(C, A + B + 1);
  cout << result << endl;

  return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include <algorithm>
#include <cmath>
#include <climits>
#include <vector>
#include <cstring>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <unordered_map>
#include <string.h>
#include <iomanip>
using namespace std;
#define int long long
#define ull unsigned long long
#define F first
#define S second
#define nl "\n"
#define ld long double
#define div 1000000007
#define pi 3.14159265358979323846

void solve()
{
    int n,k;cin>>n>>k;
    int r=n%k;
    if(abs(r-k)<r)
        cout<<abs(r-k)<<nl;
    else
        cout<<r<<nl;
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

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


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

#define ll long long
#define deb(x) cerr << #x << ":" << x << "\n"
#define all(x) x.begin(),x.end()
#define sz(x) x.size()

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

int n,q;
vector<int> v;
vector<pair<int,int>> queries;
int block_size;
map<pair<int,int>,int> mp;

void process(){
    int curL=0,curR=-1;
    vector<int> cur(n+1);
    int ans=0;
    for(auto P:queries){
        int l=P.first-1,r=P.second-1;
        while(curL<l){
            cur[v[curL]]--;
            ans-=(cur[v[curL]]==0);
            curL++;
        }
        while(curL>l){
            cur[v[curL-1]]++;
            ans+=(cur[v[curL-1]]==1);
            --curL;
        }
        while(curR<r){
            cur[v[curR+1]]++;
            ans+=(cur[v[curR+1]]==1);
            ++curR;
        }
        while(curR>r){
            cur[v[curR]]--;
            ans-=(cur[v[curR]]==0);
            --curR;
        }
        assert(ans>=0);
        mp[P]=ans;
    }
}

void solve()
{
    cin>>n>>q;
    v.resize(n);
    for(auto &x:v)cin>>x;
    queries.resize(q);
    for(auto &P:queries)cin>>P.first>>P.second;
    vector<pair<int,int>> dummy(queries);
    block_size=int(sqrt(n));
    sort(all(queries),[&](pair<int,int> a,pair<int,int> b){
        if((a.first/block_size)!=(b.first/block_size))return (a.first/block_size)<(b.first/block_size);
        return a.second<b.second;
    });
    process();
    for(auto P:dummy)cout<<mp[P]<<"\n";
}

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

Measured memory_bytes: 46236
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

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

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

    vector<int> x_asc(x);
    sort(x_asc.begin(), x_asc.end());

    for (int i = 0; i < n; i++) {
        if (x[i] <= x_asc[n / 2 - 1]) {
            cout << x_asc[n / 2] << endl;
        } else {
            cout << x_asc[n / 2 - 1] << endl;
        }
    }
}


Measured memory_bytes: 3840
#include<iostream>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
using namespace std;
using ll = long long;
int main(){
  int n, m;
  cin >> n >> m;
  vector<int> sh1(n), sh2(n);
  for(int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    if(a == 1){
      sh1[b] = 1;
    }
    if(b == n){
      sh2[a] = 1;
    }
  }
  for(int i = 0; i<min(sh1.size(), sh2.size()); i++){
    if(sh1[i] == 1 && sh2[i] == 1){
      cout << "POSSIBLE\n";
      return 0;
    }
  }
  cout << "IMPOSSIBLE\n";
  return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define Bye return 0

using namespace std;

const int MAX = 1e6+1;
int hash_table[MAX] = {};

void solve(){
    vector<int> a;
    int n, ans = 0; cin>>n;

    for (int i=0; i<n; i++){
        int num; cin>>num;
        hash_table[num]++;
        a.push_back(num);
    }

    for (int i=0; i<n; i++){
        int item = a[i];
        hash_table[item]--;
        bool flag = 1;

        for (int i=1; i*i<=item; i++){
            if(item%i) continue;

            if(hash_table[i]) flag = 0;

            if(hash_table[item/i]) flag = 0;
        }

        hash_table[item]++;

        if(flag) ans++;

    }

    printf("%d\n", ans);
}

int main()
{
    solve();

    Bye;
}


Measured memory_bytes: 8216
A, B, C = map(int, input().split())
K = int(input())

for i in range(K):
    if A < B < C:
        print("Yes")
        exit()
    elif A <= C <= B:
        C *= 2
    elif B <= A <= C:
        B *= 2
    elif B <= C <= A:
        C *= 2
    elif C <= A <= B:
        C *= 2
    elif C <= B <= A:
        C *= 2

if A < B < C:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9192