akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
using namespace std;
#define MAX_LIST 1000000

int main(){
	bool prime[MAX_LIST];
	for(int i=0;i<MAX_LIST;i++){
		prime[i]=1;
	}
	prime[0]=prime[1]=0;
	for(int i=0;i*i<MAX_LIST;i++){
		if(prime[i]==1){
			for(int j=i*2;j<MAX_LIST;j=j+i){
				prime[j]=0;
			}
		}
	}
	int n;
	while(cin>>n){
		int count=0;
		for(int i=0;i<=n;i++){
			if(prime[i]==1){
				count++;
			}
		}
		cout<<count<<endl;
	}
	return 0;
}

Measured memory_bytes: 2136
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <unordered_map>

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

using namespace std;

int main()
{
  int a, b, c;
  cin >> a >> b >> c;
  int result = c;
  if (b / a < c)
  {
    result = b / a;
  }

  cout << result << endl;
}

Measured memory_bytes: 888
#include<stdio.h>
int main(void){
	int a,b,d=0,r=0;
	double f=0;
	
	scanf("%d %d",&a,&b);
	d=a/b;
	r=a%b;
	f=(double)a/b;
	
	printf("%d %d %f\n",d,r,f);
	return 0;
}

Measured memory_bytes: 636
#include<bits/stdc++.h>
using namespace std;
class Trees{
  vector<int> par;
  vector<int> rank;
  long g;
  public:
  int root(int i){
    int rt;
    if(par[i]==i){rt=i;rank[i]=1;}
    else{rt=root(par[i]);par[i]=rt;rank[i]=2;}
    return rt;
  }
  void unite(int i,int j){
    g--;
    int rki=rank[i];int rkj=rank[j];
    if(rki<rkj){par[root(i)]=root(j);rank[i]++;}
    else{par[root(j)]=root(i);rank[j]++;}
  }
  bool same(int i,int j){
    return root(i)==root(j);
  }
  Trees(int n):g(n){
    for(int i=0;i<n;i++) {par.push_back(i);rank.push_back(1);};
  }
  long get_g(){return g;}
};
struct S{
  long x;long y;long id;
};
typedef pair<long,pair<long,long>>P;
bool cmpx(S a,S b){return a.x<b.x;}
bool cmpy(S a,S b){return a.y<b.y;}
bool cmpid(S a,S b){return a.id<b.id;}
int main(){
  long N;cin>>N;
  vector<S>s(N);
  for(long i=0;i<N;i++){
    cin>>s[i].x>>s[i].y;s[i].id=i;
  }
  vector<P> e;
  sort(s.begin(),s.end(),cmpx);
  for(long i=0;i<N-1;i++){
    e.push_back(P(abs(s[i+1].x-s[i].x),pair<long,long>(s[i].id,s[i+1].id)));
  }
  sort(s.begin(),s.end(),cmpy);
  for(long i=0;i<N-1;i++){
    e.push_back(P(abs(s[i+1].y-s[i].y),pair<long,long>(s[i].id,s[i+1].id)));
  }
  sort(e.begin(),e.end());
  Trees tree(N);
  long ans=0;
  for(long i=0;i<e.size();i++){
    if(!tree.same(e[i].second.first,e[i].second.second)){
      tree.unite(e[i].second.first,e[i].second.second);
      ans+=e[i].first;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 11888
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T, class U>bool chmax(T& a, U&& b) { return a < b ? a = b, 1 : 0; }
template<class T, class U>bool chmin(T& a, U&& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

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

    if (a < 10 && b < 10) {
        write(a * b);
    }
    else {
        write(-1);
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cctype>
#include <cstring>
#define rep(i, m, n) for (int i = m; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define ll long long
#define ull unsigned long long
#define push(a) push_back(a)
#define pop(a) pop_back(a)
#define debug(x) cout << #x << ": " << x << endl
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int a,b,h;

int main(){
    cin>>a>>b>>h;
    cout<<(a+b)*h/2<<endl;
}

Measured memory_bytes: 256
s = gets.chop
t = gets.chop
d = t.length
(s.length - t.length + 1).times do |idx|
  count = 0
  s[idx, t.length].chars.each.with_index do |c, cidx|
    count += 1 if c != t[cidx]
  end
  d = [d, count].min
end
puts d

Measured memory_bytes: 14372
import Data.List
import Control.Monad

g :: [String] -> Float
g = read.head.words.head

f :: [String] -> Float -> Float
f l x = if null l then x else if(((last.words.head) l)=="JPY")then f (tail l) (x+(g l)) else f (tail l) (x+(g l)*380000.0)

main=do
 n<-readLn
 l<-replicateM n getLine
 print$f l 0

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

int main() {
  string s; cin >> s;
  int sn = s.size();
  vector<int> a(sn);
  int rc=0, lc=0;
  for (int i=0; i<sn; i++) {
    if (s[i] == 'R') {
      rc++;
    } else {
      a[i-1] += rc;
      rc = 0;
    }
  }
  for (int i=sn-1; 0<=i; i--) {
    if (s[i] == 'L') {
      lc++;
    } else {
      a[i+1] += lc;
      lc = 0;
    }
  }
  for (int i=0; i<sn-1; i++) {
    if (s[i] == 'R' && s[i+1] == 'L') {
      int sum = a[i] + a[i+1];
      int flag;
      if (a[i] < a[i+1]) {
        flag = a[i+1] % 2;
        a[i] = sum / 2;
        a[i+1] = sum - a[i];
      } else {
        flag = a[i] % 2;
        a[i+1] = sum / 2;
        a[i] = sum - a[i+1];
      }
      if (flag == 0) swap(a[i], a[i+1]);
    }
  }
  for (int i=0; i<sn; i++) {
    cout << a[i];
    if (i != sn-1) cout << " ";
    else cout << endl;
  }
  return 0;
}

Measured memory_bytes: 3816
#include <bits/stdc++.h>
using namespace std;
#define MAXN 100009
#define MAXM 320
#define EPS 1e-9
#define MOD 1000000007
#define INF 1000000009
#define FOR(x,n) for(int x=0; x<n; x++)
#define FOR1e(x,n) for(int x=1; x<=n; x++)
#define pb push_back
#define all(x) x.begin(), x.end()
typedef long long ll;

struct edge {
	int u, v, w;
	bool operator <(const edge& a) {
		return w < a.w;
	}
};

class UnionFind {
private:
	vector<int> parent, rank;
public:
	UnionFind(int N) {
		rank.assign(N+1, 0);
		parent.assign(N+1, 0);
		for (int i = 0; i <= N; i++) parent[i] = i;
	}
	int find(int i) {
		while(i != parent[i]) i = parent[i];
		return i;
	}
	bool isSameSet(int i, int j) {
		return find(i) == find(j);
	}
	void unionSet (int i, int j) {
		if (isSameSet(i, j)) return;
		int x = find(i), y = find(j);
		if (rank[x] > rank[y]) parent[y] = x;
		else {
			parent[x] = y;
			if (rank[x] == rank[y]) rank[y]++;
		}
	}
};

edge e[MAXN];

ll total(int index, int n, int m) {
	UnionFind uf(n+1);
	ll ans = e[index].w;

	uf.unionSet(e[index].u, e[index].v);
	FOR(i, m) {
		if (i == index) continue;
		if (uf.isSameSet(e[i].u, e[i].v)) continue;
		ans += e[i].w;
		uf.unionSet(e[i].u, e[i].v);
	}
	return ans;
}

int main() {
	int n, m; ll x;
	scanf("%d %d", &n, &m);
	scanf("%lld", &x);
	FOR(i, m) { scanf("%d %d %d", &e[i].u, &e[i].v, &e[i].w); }
	sort(e, e+m);
	int lo = 0, hi = 0, mi = 0;

	FOR(i, m) {
		ll tot = total(i, n, m);
		if (tot == x) mi++;
		if (tot < x) lo++;
		if (tot > x) hi++;
	}
	
	if (mi == 0) printf("0\n");
	else if (lo == 0) {
		ll ans = 1;
		FOR(i, mi) {
			ans *= 2; ans %= MOD;
		}
		ans -= 2; if (ans < 0) ans += MOD;
		FOR(i, hi) {
			ans *= 2; ans %= MOD;
		}
		printf("%lld\n", ans);
	} else {
		ll ans = 1;
		FOR(i, mi) {
			ans *= 2; ans %= MOD;
		}
		ans -= 1; if (ans < 0) ans += MOD;
		ans *= 2; ans %= MOD;
		FOR(i, hi) {
			ans *= 2; ans %= MOD;
		}
		printf("%lld\n", ans);
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <string>
#include <cstdlib>
#include <iomanip>
using namespace std;

int main(){
    int N,A;
    string s = "APPROVED";
    cin >> N;
    for(int i=0; i<N; i++){
        cin >> A;
        if(A%2==0){
            if(A%3!=0 && A%5!=0){
                s = "DENIED";
                break;
            }
        }
    }
    cout << s;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,K,X,Y,num;
  num = 0;
  cin >> N >> K >> X >> Y;
  for (int i = 0; i < N; i++) {
    if (i < K) num += X;
    else num += Y;
  }
  cout << num << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define pragi(a,b) for(ll i = a;i<b;i++)
#define pragj(a,b) for(ll j = a;j<b;j++)
#define pragk(a,b) for(ll k = a;k>=b;k--)
#define pragp(a,b) for(ll p = a;p >= b;p--)
#define all(v) (v.begin(),v.end())
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define MP make_pair
#define MT make_tuple
#define F first
#define S second
#define KAKA ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int mod = 1e9 + 7;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef long double ld;
typedef pair<int, int> pii;
//typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef pair<ll, ll> pll;

void Compute(ll h,ll w)
{
    KAKA
    string grid[h];
    ll dp[h][w];
    pragi(0,h)
    {
        
            cin>>grid[i];
        
    }
   memset(dp,-1,sizeof(dp));
    dp[h-1][w-1] = 1;
    pragk(h-1,0)
    {
      pragp(w-1,0)
      {
       if(grid[k][p] == '#')//If corresponding grid cell is a wall cell
       {
           dp[k][p] = 0;
       }
       else if(grid[k][p] == '.')
       {
           if((k < h-1) and (p < w-1))
           {
               dp[k][p] = ((dp[k+1][p]%mod) + (dp[k][p+1]%mod))%mod;
           }
           else if(k < h-1) 
           {
               dp[k][p] = dp[k+1][p]%mod;
           }
           else if(p < w-1)
           {
               dp[k][p] = dp[k][p+1]%mod;
           }
       }
       

      }
    }
    cout<<dp[0][0]%mod<<"\n";
}
int main()
{
    KAKA
    ll h,w;
    cin>>h>>w;
    Compute(h,w);
}

Measured memory_bytes: 9088
#include <iostream>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <vector>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <queue>
#include <cmath>
#include <cstdio>
using namespace std;
int s[10],a,b,c,bi,sm,ans;
int main(){
sm=14232;
for(int i=0;i<=2;i++){
cin>>s[i];
bi=max(bi,s[i]);
sm=min(sm,s[i]);}
a=bi;
c=sm;
for(int i=0;i<=2;i++)
b+=s[i];
b-=(bi+sm);
if((a*2-b-c)%2==0){
ans=(a-b+a-c)/2;
cout<<ans;
system("pause");
return 0;}
else{
while((a-b)!=1&&a!=b){
b+=2;
ans++;}
if(a-b==1){
b++;c++;ans++;}
while((a-c)!=1&&a!=c)
{c+=2;ans++;}
cout<<ans+2;
}
system("pause");
return 0;
}

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

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

  int64_t l1 = 1;
  int64_t l2 = 2;
  int64_t l;

  if(N == 1){
    l = 1;
  }

  else{
    for(int i=0; i<N-1; i++){
      l = l1 + l2;
      l2 = l1;
      l1 = l;
    }
  }

  cout << l << endl;
}

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

int main(){
  int N;
  cin >> N;
  const int64_t mod=1e9+7;
  vector<int> v(N,0);
  for(int i=0;i<N;i++){
    int A;
    cin >> A;
    if(N%2==0){
      if(A%2==0){
        cout << 0 << endl;
        return 0;
      }
    }else{
      if(A%2!=0){
        cout << 0 << endl;
        return 0;
      }
    }
    v.at(A)++;
    if(A==0){
      if(v.at(A)>1){
        cout << 0 << endl;
        return 0;
      }
    }else{
      if(v.at(A)>2){
        cout << 0 << endl;
        return 0;
      }
    }
  }
  int64_t ans=1;
  int n=N/2;
  int64_t a=2;
  while(n>0){
    if(n&1){
      ans=ans*a%mod;
    }
    a=a*a%mod;
    n>>=1;
  }
  cout << ans << endl;
  return 0;
}


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

#define ll long long
#define pb push_back
#define F first
#define S second
#define ld long double

using namespace std;

const int MAXN = 1001 * 1001 , MOD = 1e9 + 7 ; 

int32_t main() 
{
	ios::sync_with_stdio(0) ; 
	cin.tie(0) ;
	string s ; 
	cin >> s ; 
	int n = s.size() ; 
	for(int i = 0 ; i < n - 8 ; i ++ ) cout << s[i]  ; 
	cout << endl ; 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int maxn=100010,mod=998244353,w=1000000000000000000%mod;
#define MP make_pair
#define PB push_back
#define lson o<<1,l,mid
#define rson o<<1|1,mid+1,r
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define ROF(i,a,b) for(int i=(a);i>=(b);i--)
#define MEM(x,v) memset(x,v,sizeof(x))
inline ll read(){
	char ch=getchar();ll x=0,f=0;
	while(ch<'0' || ch>'9') f|=ch=='-',ch=getchar();
	while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
	return f?-x:x;
}
inline int qmo(int x){return x+(x>>31)*mod;}
int n,m,sq[3],sg[3][maxn],sum[3][maxn],cnt[maxn],el,head[maxn],to[maxn],nxt[maxn],pw[maxn],ans;
inline void add(int u,int v){
	to[++el]=v;nxt[el]=head[u];head[u]=el;
}
int main(){
	n=read();
	pw[0]=1;
	FOR(i,1,n) pw[i]=1ll*pw[i-1]*w%mod;
	FOR(_,0,2){
		m=read();
		sq[_]=sqrt(2*m);
		FOR(i,1,m){
			int u=read(),v=read();
			if(u>v) swap(u,v);
			add(u,v);
		}
		ROF(i,n,1){
			for(int j=head[i];j;j=nxt[j]) cnt[sg[_][to[j]]]++;
			while(cnt[sg[_][i]]) sg[_][i]++;
			for(int j=head[i];j;j=nxt[j]) cnt[sg[_][to[j]]]--;
		}
		FOR(i,1,n) sum[_][sg[_][i]]=(sum[_][sg[_][i]]+pw[i])%mod;
		FOR(i,1,n) head[i]=0;
		FOR(i,1,el) to[i]=nxt[i]=0;
		el=0;
	}
	FOR(i,0,sq[0]) FOR(j,0,sq[1]) ans=(ans+1ll*sum[0][i]*sum[1][j]%mod*sum[2][i^j])%mod;
	printf("%d\n",ans);
}

Measured memory_bytes: 6460
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;



int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, m, s, t;
    cin >> n >> m >> s >> t;
    --s, --t;

    vector<pair<int,int>> edges;
    vector<long long> A(m);
    vector<long long> B(m);

    vector<vector<int>> graph(n);
    for (int i = 0; i < m; ++i) {
        int u, v, a, b;
        cin >> u >> v >> a >> b;
        --u, --v;
        edges.emplace_back(u, v);
        A[i] = a;
        B[i] = b;
        graph[u].push_back(i);
        graph[v].push_back(i); 
    }

    const long long INF = 1LL << 60;

    using PII = pair<long long, int>;
    auto dijkstra = [&](int s, vector<long long>& W) -> vector<long long> {
        vector<long long> dis(n, INF);
        dis[s] = 0;

        priority_queue<PII, vector<PII>, greater<PII>> pq;
        pq.emplace(0, s);

        while (!pq.empty()) {
            long long d = pq.top().first;
            int u = pq.top().second;
            pq.pop();
            if (d != dis[u]) {
                continue;
            }

            for (auto e : graph[u]) {
                int v = edges[e].first + edges[e].second - u;

                long long nd = d + W[e];
                if (dis[v] > nd) {
                    dis[v] = nd;
                    pq.emplace(nd, v);
                }
            }
        }

        return dis;
    };

    auto DS = dijkstra(s, A);
    auto DT = dijkstra(t, B);

    priority_queue<PII, vector<PII>, greater<PII>> pq;
    for (int i = 0; i < n; ++i) {
        pq.emplace(DS[i] + DT[i], i);
    }

    const long long M = 1e15;
    for (int i = 0; i < n; ++i) {
        long long ans = M;
        while (!pq.empty()) {
            auto x = pq.top().first;
            int v = pq.top().second;
            if (v >= i) {
                ans -= x;
                break;
            } else {
                pq.pop();
            }
        }
        cout << ans << '\n';
    }
    return 0;
}

Measured memory_bytes: 12912
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<iostream>
#include<map>
#include<string>
#include<bitset>

#define maxn 1000005
#define MOD 998244353

using namespace std;

inline long long getint()
{
	long long num=0,flag=1;char c;
	while((c=getchar())<'0'||c>'9')if(c=='-')flag=-1;
	while(c>='0'&&c<='9')num=num*10+c-48,c=getchar();
	return num*flag;
}

int n,m;
int fac[maxn],inv[maxn];

inline int ksm(int num,long long k)
{
	int ret=1;
	for(;k;k>>=1,num=1ll*num*num%MOD)if(k&1)ret=1ll*ret*num%MOD;
	return ret;
}
inline int C(int p,int q)
{return 1ll*fac[p]*inv[q]%MOD*inv[p-q]%MOD;}

int main()
{
	n=getint(),m=getint();
	if(n>m)swap(n,m);
	fac[0]=fac[1]=inv[0]=inv[1]=1;
	for(int i=2;i<=m;i++)fac[i]=1ll*fac[i-1]*i%MOD;
	for(int i=2;i<=m;i++)inv[i]=1ll*inv[MOD%i]*(MOD-MOD/i)%MOD;
	for(int i=2;i<=m;i++)inv[i]=1ll*inv[i]*inv[i-1]%MOD;
	long long ans=0;
	for(int i=0;i<=n;i++)
	{
		int tmp=1ll*C(n,i)*C(m,i)%MOD*fac[i]%MOD*ksm(m+1,n-i)%MOD*ksm(n+1,m-i)%MOD;
		if(i&1)ans=(ans-tmp+MOD)%MOD;
		else ans=(ans+tmp)%MOD;
	}
	printf("%lld\n",(ans+MOD)%MOD);
}

Measured memory_bytes: 7556
#include <stdio.h>
long long a [100010];
int main (){
int n;
scanf("%d",&n);
for(int i=0;i<n;i++) scanf("%lld",&a[i]);
int zero =0;
for(int i=0;i<n;i++)if(a[i]==0) zero ++;
if(zero >0){
// a[i] contains 0
printf("0\n");
return 0;
}
long long prod =1;
for(int i=0;i<n;i++){
if(a[i ] <=1000000000000000000/ prod ){
// This condition is equivalent to prod*a[i] <=10ˆ18
prod *=a[i];
}else{
printf("-1\n");
return 0;
}
}
printf("%lld\n",prod );
}


Measured memory_bytes: 3944
#include <iostream>

using namespace std;

int main(){
    int dish[5],min=10,ans=0;
    for(int i=0;i<5;i++){
        cin >> dish[i];
        if(dish[i]%10>0 && dish[i]%10<min){
            min = dish[i]%10;
        }
        if(dish[i]%10){
            ans += dish[i] /10 * 10 + 10;
        }else{
            ans += dish[i];
        }
    }
    if(min < 10){
        ans -= 10 - min;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	_ = sc.Scan()
	i, _ := strconv.ParseInt(sc.Text(), 10, 64)
	if i >= 30 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 1776
n, m = map(int, input().split())
a = [0] * n
d = {}
ok = True
for i in range(m):
    s, c = map(int, input().split())
    if s not in d or d[s] == c:
        d[s] = c
        a[s - 1] = c
    else:
        ok = False
if n != 1 and 1 not in d:
    a[0] = 1
if ok and a[0] != 0:
    print(*a, sep="")
elif ok and n == 1:
    print(0)
else:
    print(-1)

Measured memory_bytes: 3064
N, K = map(int, input().split())
A = list(map(int, input().split()))
bit = list(bin(K)[2:])
d = len(bit)
count = [0] * d
for a in A:
    b = bin(a)[2:]
    for j in range(d):
        count[d-j-1] += a >> j & 1
less = False
X = 0
for i in range(d):
    X <<= 1
    if less or bit[i] == '1':
        if 2*count[i] < N:
            X += 1
        else:
            less = True
ans = 0
for a in A:
    ans += X ^ a
print(ans)


Measured memory_bytes: 69392
#include<stdio.h>
int main(void)
{
	int n,a,b;
	scanf("%d %d %d",&n,&a,&b);
	if(n*a<=b){
		printf("%d\n",n*a);
	}
	else{
		printf("%d\n",b);
	}
	return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

class Program {

    static bool ReadLine72(ref int num1, ref int num2, char Spliter, bool Fin0 = true) {
        string str = Console.ReadLine();
        num1 = int.Parse(str.Split(Spliter)[0]);
        num2 = int.Parse(str.Split(Spliter)[1]);
        return (Fin0 && num1 == 0);
    }

    static void LoopI(ref int i, int max) { i++; if (i == max)i = 0; }

    static void Main(string[] args) {
        while (true) {
            int n=0, p=0;
            if (ReadLine72(ref n, ref p, ' ')) return;
            int[] Stones = Enumerable.Repeat(0, n).ToArray();
            int i = 0; int MaxStone = p;
            for(i = 0;Stones[i] != MaxStone; LoopI(ref i,n)){
                if (p > 0) {
                    Stones[i]++; p--;
                }else{
                    p = Stones[i]; Stones[i] = 0;
                }
              //  Console.WriteLine(String.Join(",",Stones) + "::p="+ p + "::i="+i );
            }
            Console.WriteLine(i);


        }


    }
}

Measured memory_bytes: 5896
# -*- coding: utf-8 -*-


# 入力を整数に変換して受け取る
def input_int():
    return int(input())


# マイナス1した値を返却
def int1(x):
    return int(x) - 1


# 半角スペース区切り入力をIntに変換してMapで受け取る
def input_to_int_map():
    return map(int, input().split())


# 半角スペース区切り入力をIntに変換して受け取る
def input_to_int_tuple():
    return tuple(map(int, input().split()))


# 半角スペース区切り入力をIntに変換してマイナス1した値を受け取る
def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))

def main():
    define = {
        "8": (400, 599),
        "7": (600, 799),
        "6": (800, 999),
        "5": (1000, 1199),
        "4": (1200, 1399),
        "3": (1400, 1599),
        "2": (1600, 1799),
        "1": (1800, 1999),
    }

    x = input_int()

    for k, v in define.items():
        if v[0] <= x <= v[1]:
            return k


if __name__ == "__main__":
    print(main())


Measured memory_bytes: 9204
#include<cstdio>
#include<iostream>
#include<set>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>

using namespace std;

const int CMax = 100002;

int n, ats, sk;
set<int> S;
pair<set<int>::iterator,bool> ret;

int main(){
    scanf("%d", &n);
    for (int i = 0; i < n; i++){
        scanf("%d", &sk);
        ret = S.insert(sk);
        if (ret.second) ats++;
        else {
            ats--;
            S.erase(ret.first);
        }
    }

    cout << ats << endl;
}


Measured memory_bytes: 4864
#include <iostream>
using namespace std;
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
int main() {
  
  ll int n;
  cin>>n;
  ll int a[n];
  ll sum = 0;
    for(ll int i=0;i<n;i++)
   {
        cin>>a[i];
        sum =(sum%mod +a[i]%mod)%mod;
    } 
    ll dp[n]={0};
    dp[0]=sum-a[0];
    for(int i=1;i<n;i++)
    dp[i] = dp[i-1]%mod-a[i]%mod;
    ll tt =0 ;
    for(int i=0;i<n;i++)
    {
        tt = (tt%mod+ (dp[i]%mod*a[i])%mod+mod)%mod;
    }
    cout<<tt%mod<<endl;



}


Measured memory_bytes: 6796
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=0;
        int p=0;

        //haveListに入れる
        while (true) {

            List<Integer> haveStoneList = new ArrayList<>();

            //String[] data = s.split(" ");
            n = sc.nextInt();
            p = sc.nextInt();
            if(n==0&&p==0)break;

            for (int j = 0; j < n; j++) {
                haveStoneList.add(0);
            }
            int i = 0;
            int wan = p;

            while (true) {
                if (haveStoneList.get(i) == p) {
                    System.out.println(i);
                    break;
                }

                if (wan == 0) {
                    wan += haveStoneList.get(i);
                    haveStoneList.set(i, 0);
                } else {
                    haveStoneList.set(i, haveStoneList.get(i) + 1);
                    wan -= 1;
                }
                if (i == n - 1) {
                    i = 0;
                } else {
                    i++;
                }

            }
        }

    }

}


Measured memory_bytes: 27840
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())



int fact2(int n) {
	int p2 = 2;
	int r = 0;
	while (p2 <= n) {
		r += n / p2;
		p2 *= 2;
	}

	return r;
}

int C2(int n, int r) {
	if (n < 0 || r < 0 || r > n)return 0;
	if (r > n / 2)r = n - r;
	int a = n, b = n - r, c = r;

	return fact2(a) - fact2(b) - fact2(c);
}

bool is1(vector<int> v) {
	int n = v.size();
	uint32_t x = 0;
	
	for (int i = 0; i < n; i++) {
		if (C2(n - 1, i) == 0) x += v[i];
	}
	x &= 1;

	return x == 1;
}

bool is2(vector<int> v) {
	int n = v.size();
	if( count(all(v), 1)) return false;

	for (int& a : v)if (a == 2)a = 1;
	return is1(v);
}

int n;
string a;


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


	cin >> n >> a;
	

	vector<int> v(n);
	rep(i, n) {
		v[i] = a[i] - '0' - 1;
	}

	if (is1(v)) {
		cout << 1 << endl;
	}
	else {
		cout << (is2(v) ? 2 : 0) << endl;
	}

	return 0;
}

Measured memory_bytes: 13016
n = input()
find = []
c = []
for i in ['S ','H ','C ','D ']:
    for j in map( str , xrange(1,14) ):
        find.append( i+j )   
for i in xrange(n):
    find.remove( raw_input() )
for i in xrange( len( find ) ):
    print find[i]

Measured memory_bytes: 6372
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <cstring>
#include <numeric>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define F0(i,n) for (int i = 0; i < n; i++)
#define F1(i,n) for (int i = 1; i <= n; i++)
#define CL(a,x) memset(x, a, sizeof(x));
#define SZ(x) ((int)x.size())
const double eps = 1e-10;
const int inf = 1000000009;
int i, j, k, m, n, l;
int ans; int a[1000000];

int main() {
	//freopen("x.in", "r", stdin);

	string s;
	cin >> s;
	cout << s.substr(0, 4) + " " + s.substr(4) << endl;
	return 0;

	cin >> n;
	F1(i, n) cin >> a[i];
	ans = 0; F1(i, n) if (a[a[i]] == i) ans++;
	cout << ans / 2 << endl;
	return 0;
}


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

int main()
{
    ll a, b; cin >> a >> b;
    if ((a + b) % 2 == 0) {
        cout << (a + b) / 2 << endl;
    } else {
        cout << "IMPOSSIBLE" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

S = readline().rstrip().decode('utf-8')
K = int(read())

# どうせ2つしか状態数がない。十分大きなKで、周期2の等差数列だろう

def F(S):
    arr = list(S)
    prev = 'A' # 衝突回避
    cnt = 0
    for x in S:
        if x == prev:
            cnt += 1
            prev = 'A'
        else:
            prev = x
    return cnt

arr = [F(S*i) for i in range(10)]

if K < 10:
    answer = arr[K]
else:
    if K&1:
        d = arr[9] - arr[7]
        answer = arr[9] + d * ((K-9)//2)
    else:
        d = arr[8] - arr[6]
        answer = arr[8] + d * ((K-8)//2)
print(answer)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define cinf(n,x) for(int i=0;i<(n);I++) cin >> x[i];

int main(){
  int N;
  cin >> N;
  int x,y ;
  x = N*800 ;
  y = (N/15)*200 ;
  cout << x-y << endl;
}


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 n, m;
  scanf("%d%d", &n, &m);
  vector<tuple<int, int, int>> pref_year_city(m);
  rep(i, m) {
    int p, y;
    scanf("%d%d", &p, &y);
    pref_year_city[i] = make_tuple(p, y, i);
  }
  sort(pref_year_city.begin(), pref_year_city.end());
  unordered_map<int, int> city_pref;
  unordered_map<int, int> city_cnt;
  vector<int> cnt(n + 1);
  for(auto & pyc : pref_year_city) {
    long long p;
    int c;
    tie(p, ignore, c)= pyc;
    ++cnt[p];
    city_pref[c] = p;
    city_cnt[c] = cnt[p];
  }
  rep(i, m) {
    printf("%06d%06d\n", city_pref[i], city_cnt[i]);
  }
}


Measured memory_bytes: 11336
#include<bits/stdc++.h>
 
#define rep(i,n) for(ll i = 0;i < n;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
typedef pair<int,int> P;
 
const int INF = 1001001001;
const long double PI = (acos(-1));
const int mod = 1e9+7;
const int vx[6] = {0,1,0,-1,1,-1};
const int vy[6] = {1,0,-1,0,1,1};



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

    char c;
    cin >> c;
    if(c >= 'a' && c <= 'z'){
        cout << 'a' << endl;
    }else{
        cout << 'A' << endl;
    }

    cout << endl;
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef tuple<int, int> duo;

#define TT template<typename T>
#define TTF template<typename T, typename F>
#define ET(T) typename T::value_type
TT inline T sq(T x){return x*x;}
TT inline T In(){T x;cin>>x;return x;}
TT inline void Out(T&x){cout<<x;}
TT inline void sort(T&v){sort(begin(v),end(v));}
TT inline void revs(T&v){reverse(begin(v),end(v));}
TT inline void uniq(T&v){sort(v);v.erase(unique(begin(v),end(v)),end(v));}
TT inline int ubnd(T&v,ET(T)&x){return upper_bound(begin(v),end(v),x)-begin(v);}
TT inline int lbnd(T&v,ET(T)&x){return lower_bound(begin(v),end(v),x)-begin(v);}
TTF inline void inpt(T&v,int n,F f){for(v.reserve(n);n--;v.emplace_back(f()));}
TTF inline void show(T&v,F f,string d=" ",string e="\n"){int i=0;for(auto&x:v)i++&&(cout<<d),f(x);cout<<e;}
#undef TT
#undef TTF
#undef ET

inline void fast_io(){ios::sync_with_stdio(0);cin.tie(0);}
inline int in(){int x;scanf("%d",&x);return x;}
inline ll pow_mod(ll a,ll k,ll m){ll r=1;for(;k>0;a=a*a%m,k>>=1)if(k&1)r=r*a%m;return r;}
inline ll mod_inv(ll a,ll p){return pow_mod(a,p-2,p);}

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

int main()
{
  int n;
  while (n = in()){
    vector<int> v;
    inpt(v, n + 1, in);
    for (int i = 0; i < n + 1; i++){
      vector<int> dv;
      for (int j = 0; j < n + 1; j++){
        if (i != j) dv.push_back(v[j]);
      }
      vector<int> ddv;
      for (int j = 1; j < n; j++){
        ddv.push_back(dv[j] - dv[j - 1]);
      }
      uniq(ddv);
      if (ddv.size() == 1u){
        cout << v[i] << endl;
        break;
      }
    }
  }
  return (0);
}

// priority_queue queue deque front stringstream max_element min_element insert count make_tuple

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

int n, k, nx, ny;
int a[2][1002][1002];
int solve(int y, int x, int f){
	int ans = a[f][y][x]*2;
	ans += a[f][k-1][k-1]-(a[f][y][k-1]+a[f][k-1][x]);
	ans += a[!f][y][k-1]+a[!f][k-1][x]-2*a[!f][y][x];
	return ans;
}

int main(){
	char c;
	scanf("%d%d", &n, &k);
	for(int i = 0;i < n;i++){
		scanf("%d%d %c", &nx, &ny, &c);
		int f = (c == 'B' ? 1 : 0);
		if((nx/k+ny/k+f)%2 == 1)a[0][ny%k][nx%k]++;
		else a[1][ny%k][nx%k]++;
	}
	
	rep(i,k)rrep(j,k-1)rep(d,2){
		a[d][i][j] += a[d][i][j-1];
	}
	rep(j,k)rrep(i,k-1)rep(d,2){
		a[d][i][j] += a[d][i-1][j];
	}
	
	int ans = 0;
	rep(i,k)rep(j,k)rep(d,2)ans = max(ans, solve(i, j, d));
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 8064
//fold
#ifndef KHALIL
#include <bits/stdc++.h>
#else
#include "header.h"
#endif
#define endl '\n'
#define mp make_pair
#define tostr(x) static_cast<ostringstream&>((ostringstream()<<dec<<x)).str()
#define rep(i,begin,end) for(auto i = begin;i < end;i++)
#define repr(i,begin,end) for(auto i = begin-1;i >= end;i--)
#define pb push_back
#define sz(a) ((int)(a).size())
#define fi first
#define se second
#define abs(a) ((a) < (0) ? (-1)*(a) : (a))
#define SQ(a) ((a)*(a))
#define eqd(a,b) (abs(a-b)<1e-9)
#define X real()
#define Y imag()
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename t> t in(t q){cin >> q;return q;}
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v){os << "[";for (int i = 0; i < sz(v); ++i) { os << v[i]; if (i != sz(v) - 1) os << ",";}os << "]";return os;}
template <typename T, typename S>ostream& operator<<(ostream& os, const map<T, S>& v){for (auto it : v)os << "(" << it.first << ":" << it.second << ")";return os;}
template <typename T, typename S>ostream& operator<<(ostream& os, const pair<T, S>& v){os << "(" << v.first << "," << v.second << ")";return os;}
const long double PI = acosl(-1);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng64(chrono::steady_clock::now().time_since_epoch().count());
inline int rand(int l,int r){return uniform_int_distribution<int>(l, r)(rng);}
inline ll rand(ll l,ll r){return uniform_int_distribution<ll>(l, r)(rng64);}
//endfold
#define  N  (100'005)
#define MOD (1'000'000'007ll)
#define OO (1'050'000'000)
#define OOL (1'100'000'000'000'000'000ll)

//global
ll x[N];
ll dp[N];

int main(){
	//fold
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cout << setprecision(10);
	//endfold
	ll n,e,t;
	cin >> n >> e >> t;
	rep(i,0,n){
		cin >> x[i];
	}
	dp[n] = 0;
	x[n] = e;
	queue<pair<ll,ll>> q;
	ll mi = OOL;
	for (int i = n-1; i >= 0; --i){
		ll k = lower_bound(x+i+1,x+n,x[i]+(t+1)/2)-x;
		if(sz(q)) while(q.front().first >= k){
			mi = min(mi,q.front().second);
			q.pop();
			if(q.empty()) break;
		}
		ll ans = mi-3*x[i];
		k--;
		ans = min(ans,t+x[k+1]-x[i]+dp[k+1]);
		dp[i] = ans;
		q.push({i,2*x[i]+x[i+1]+dp[i+1]});
	}
	cout << dp[0]+x[0] << endl;
	return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

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

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;(i) < ((int)(n));++(i))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

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

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

#define SUM(vec) accumulate(all(vec),0LL) // 配列の中身を全部足す
template<typename T>void print(T&& x){cout<<x<<endl;}// 改行付き出力
ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int ctoi(char c){return c-'0';}

// TODO: write
int main() {
  int n;cin>>n;
  string s;cin>>s;
  // 2j-i != k
  vector<int> r(n,0),g(n,0),b(n,0);

  rep(i,n){
    if(i){
      r[i] = r[i-1];
      g[i] = g[i-1];
      b[i] = b[i-1];
    }

    if(s[i] == 'R')r[i]++;
    if(s[i] == 'G')g[i]++;
    if(s[i] == 'B')b[i]++;
  }

  ll ans = 0;
  rep(i,n){
    for(int j = i+1;j < n;++j){
      if(s[i] == s[j])continue;
      char c;
      rep(k,3)if("RGB"[k] != s[i] && "RGB"[k] != s[j])c = "RGB"[k];

      int cnt;
      if(c == 'R')cnt = r[j]-r[i];
      if(c == 'G')cnt = g[j]-g[i];
      if(c == 'B')cnt = b[j]-b[i];

      int notK = 2*j-i;
      if(notK < n){
        if(s[notK] != s[j] && s[notK] != s[i])cnt--;
      }

      ans += cnt;
    }
  }
  print(ans);
  return 0;
}


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

using namespace std;

int main(){

	ios_base::sync_with_stdio(false);

	int a,b,c;
	cin >> a >> b >> c;

	if(a+b+c >= 22)
		cout << "bust" << endl;
	else 
		cout << "win" << endl;
	

return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int A,B,C,D,E;
  scanf("%d",&A);
  scanf("%d",&B);
  scanf("%d",&C);
  scanf("%d",&D);
  scanf("%d",&E);

  int min = 10;
  if (min>A%10 && A&10 !=0) {
    min = A%10;
  }
  if (min>B%10 && B&10 !=0) {
    min = B%10;
  }
  if (min>C%10  && C&10 !=0) {
    min = C%10;
  }
  if (min>D%10  && D&10 !=0) {
    min = D%10;
  }
  if (min>E%10 && E&10 !=0) {
    min = E%10;
  }

  int ans = ((A+9)/10)*10 + ((B+9)/10)*10 + ((C+9)/10)*10 + ((D+9)/10)*10 + ((E+9)/10)*10 -10+min;

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


Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>

#define NUMBER 20000

int main() {
	int x[NUMBER];
	int y[NUMBER];
	char c[NUMBER][1];
	int count;

	for (int i = 0; i < NUMBER; i++) {
		std::cin >> x[i] >> c[i] >> y[i];
		if (c[i][0] == '?') {
			count = i;
			break;
		}
		i++;
	}
	for (int i = 0; i < count; i++) {
		switch (c[i][0]) {
		case '+':std::cout << x[i] + y[i] << std::endl; continue;
		case '-':std::cout << x[i] - y[i] << std::endl; continue;
		case'*':std::cout << x[i] * y[i] << std::endl; continue;
		case'/':std::cout << x[i] / y[i] << std::endl; continue;
		}
	}
	return 0;
}

Measured memory_bytes: 3108
S = gets.chomp
T = gets.chomp

# 対応表を作る
l = {}

can_match = true
S.length.times do |i|
  if l[S[i]].nil? # 対応表がない
    l[S[i]] = T[i] # ci -> cj の変換表を作る
  elsif l[S[i]] != T[i] # 別の変換先への対応が既にある
    can_match = false # 変換不可
    break
  end
end

# 対応表の値が重複 == 複数の変換先が存在する
can_match = false if l.values.size != l.values.uniq.size

if can_match
  puts 'Yes'
else
  puts 'No'
end

Measured memory_bytes: 2624
# include <cstdio>
# include <iostream>
using namespace std;
# define MAX 123
typedef long long LL;
LL num[MAX];
int main(void)
{
	int n; scanf("%d",&n);
	num[0] = 2;
	num[1] = 1;
	for ( int i = 2;i <= 86;i++ ) {
		num[i] = num[i-1]+num[i-2];
	}
	printf("%lld\n",num[n]);



	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<string>
#include<utility>
#include<unordered_set>
#include<unordered_map>
#include<map>
#include<iterator>
#include<vector>
#include<math.h>
#include<algorithm>
using namespace std;

typedef long long int ll;
typedef vector <long long int> vll;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector <vector<char>> vvc;
typedef vector <vector <int>> vvi;
typedef vector <vector <long long int>> vvl;
typedef pair <int, int> pi;
typedef pair<long long int, long long int> pll;
typedef vector <pair <int, int>> vpi;
typedef vector <pair <long long int, long long int>> vpl;
typedef unordered_set <int> si;
typedef unordered_map <int, int> mi;

#define all(v) v.begin() , v.end()
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int mod = 1e9 + 7;

template <typename Type>
istream& operator >> (istream& in , vector<Type>& v)
{
	ll n = v.size();
	for (int i = 0; i < n; i++)
		in >> v[i];
    return in;
}

template <typename Type>
ostream& operator << (ostream& out , vector<Type>& v)
{
	for (auto value : v)
		out << value << " ";
    out << endl;
    return out;
}
int main(void)
{
	IOS
		int n, m;
	cin >> n >> m;
	vvc a(n, vc(m));
	cin >> a;
	vvl dp(n, vll(m, 0));
	a[0][0] == '.' ? dp[0][0] = 1 : dp[0][0] = 0;
	for (int i = 1; i < m; ++i)
	{
		if (a[0][i] == '.')
			dp[0][i] = dp[0][i - 1];
	}
	for (int i = 1; i < n; ++i)
	{
		if (a[i][0] == '.')
			dp[i][0] = dp[i - 1][0];
	}
	for (int i = 1; i < n; ++i)
	{
		for (int j = 1; j < m; ++j)
		{
			if (a[i][j] == '.')
				dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod;
		}
	}
	cout << dp[n - 1][m - 1] % mod;
	return 0;
}

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

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

    if(n > 81){
        cout << "No" << endl;
    }
    else{
        bool ans = false;
        for(int i = 1; i <=9; i++){
            if(((n % i) == 0) && ((n / i) <= 9)){
                ans = true;
            }
        }
        if(ans == true){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 256
//#include "pch.h"
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <utility>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <bitset>

#define ll long long
#define fri(n) for(i=0;i<(n);i++)
#define frj(n) for(j=0;j<(n);i++)
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))
#define INF 1000000000000000000//10^18
#define INFINT 2000000001//2*10^9+1
#define MOD 1000000007
#define MODANOTHER 998244353
#define PI acos(-1)

using namespace std;



int main(void)
{
	//変数の宣言
	int n,m;
	int k[11];
	int s[11][11];
	int p[11];
	int t[11];

	//よく使う変数
	int i,j,l;
	int flag=0;
	ll int ans=0;
	int count=0;
	int temp=0;
	int temp1=0;
	int temp2=0;
	int max=0;
	int min=INFINT;
	int len=0;
	int sum=0;
	int ok=0;
	int ng=0;
	char dummy;
	char stemp[11];


	//データの読み込み


	scanf("%d %d",&n,&m);
//	scanf_s("%d %d",&n,&m);

//	scanf("%s",&s);
//	scanf_s("%s",&s,5);


	for(i=0;i<m;i++){
		scanf("%d",&k[i]);
//		scanf_s("%d",&k[i]);
		for(j=0;j<k[i];j++){
			scanf("%d",&s[i][j]);
//			scanf_s("%d",&s[i][j]);
		}
	}


	for(i=0;i<m;i++){
		scanf("%d",&p[i]);
//		scanf_s("%d",&p[i]);
	}

	//	printf("nは%dです\n", n);
	//	printf("データの読み込み終了\n");
	//実際の処理

	for(i=0;i<(1<<n);i++){
		for(j=0;j<n;j++){
			if(i&(1<<j)){
				t[j]=1;
			}else{
				t[j]=0;
			}
		}
		
		flag=1;
		for(j=0;j<m;j++){
			temp=p[j];
			for(l=0;l<k[j];l++){
				temp=temp+t[s[j][l]-1];
			}
			if(temp%2!=0) flag=0;
		}

		ans=ans+flag;
	}

	

	//	printf("計算部分終了\n");

	//出力
	printf("%lld",ans);

	//	printf("結果の出力終了\n");

	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <map>
#include <set>
#include <stack>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()
 
#define REP(i,s,e)	for(ll i=(s); i<(e); i++)
#define rep(i,n)	REP(i,0,n)
#define REPE(i,s,e)	for(ll i=s; i>e; i--)
#define repe(i,n)	REPE(i,n,-1)
 
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
typedef vector<vi> vvi;
 
const int IMAX=((1<<30)-1)*2+1;
const int INF=100000000;
const double EPS=1e-10;
//int mod=1000000007




int main(){
	int n, m;
	cin>>n>>m;
	map<int,string> mp;
	int t;
	string s;
	for(int i = 0; i < n; i++) {
		cin>>t>>s;
		mp[t] = s;
	}
	mp[0] = "kogakubu10gokan";
	auto it = mp.upper_bound(m);
	it--;
	cout<<it->se<<endl;
}

Measured memory_bytes: 1216
#include <iostream>
#include <cstring>
#include <string>
using namespace std;

const int INF = 1 << 28;

int decimal(char a, char b) {
    int d;
    if (isdigit(a)) d += a - '0';
    else d += a - 'a' + 10;
    d *= 16;

    if (isdigit(b)) d += b - '0';
    else d += b - 'a' + 10;
    
    return d;
}

struct color_t {
    int r, g, b;
    color_t(int r=0, int g=0, int b=0) : r(r), g(g), b(b) {}
    color_t(string s) {
        r = decimal(s[1], s[2]);
        g = decimal(s[3], s[4]);
        b = decimal(s[5], s[6]);
    }
};

int square_distance(color_t a, color_t b) {
    return (a.r - b.r) * (a.r - b.r) + (a.g - b.g) * (a.g - b.g) + (a.b - b.b) * (a.b - b.b);
}

int main() {
    string color[8];
    color_t color_v[8];

    color[0] = "black";   color_v[0] = color_t("#000000");
    color[1] = "blue";    color_v[1] = color_t("#0000ff");
    color[2] = "lime";    color_v[2] = color_t("#00ff00");
    color[3] = "aqua";    color_v[3] = color_t("#00ffff");
    color[4] = "red";     color_v[4] = color_t("#ff0000");
    color[5] = "fuchsia"; color_v[5] = color_t("#ff00ff");
    color[6] = "yellow";  color_v[6] = color_t("#ffff00");
    color[7] = "white";   color_v[7] = color_t("#ffffff");

    string s;
    while (getline(cin, s)) {
        if (s == "0") break;
        color_t c(s);
        int min_sq_dist = INF;
        string min_dist_color_name;
        for (int i = 0; i < 8; i++) {
            int sq_dist = square_distance(color_v[i], c);
            //cout << color[i] << ' ' << sq_dist << endl;
            if (min_sq_dist > sq_dist) {
                min_sq_dist = sq_dist;
                min_dist_color_name = color[i];
            }
        }
        cout << min_dist_color_name << endl;
    }
    return 0;
}

Measured memory_bytes: 0
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define rep(i,n) for(i=0;i<n;i++)
#define PI 3.14159265358979323846264338327950L
int main(){
    int n,m,i;
    scanf("%d%d",&n,&m);
    int l,r,largel=0,smallr=100020;
    rep(i,m){
        scanf("%d%d",&l,&r);
        if(largel<l) largel=l;
        if(r<smallr) smallr=r;
    }
    if(largel<=smallr) printf("%d",smallr-largel+1);
    else printf("0");
    return 0;
}

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

using namespace std;


int main() {
	int N;
	cin >> N;
	vector<int>D( N );
	for( size_t i = 0; i < N; i++ ) {
		cin >> D[i];
	}
	double maxans = 1, minans = 0;
	for( size_t idx = 0; idx < 50; idx++ ) {
		double midans = ( maxans + minans ) / 2;
		set<int>prev;
		prev.insert( 1 );
		for( size_t i = 0; i < N; i++ ) {
			double minvalue = D[i] * ( 1. - midans );
			double maxvalue = D[i] * ( 1. + midans );
			set<int>next;
			for( auto one : prev ) {
				for( int j = minvalue / one + 1; j <= maxvalue / one; j++ ) {
					next.insert( j*one );
				}
			}
			prev = next;
		}
		if( prev.size() ) {
			maxans = midans;
		} else {
			minans = midans;
		}

	}
	cout << fixed << setprecision( 20 ) << minans << endl;
}

Measured memory_bytes: 10748
H, W, K, *C = open(0).read().split()
C = sum([list(c) for c in C], [])
H = int(H)
W = int(W)
K = int(K)
ans = 0

# bits: h1 h2 w1 w2 w3
for row in range(1 << H):
    for col in range(1 << W):
        cnt = 0
        for h in range(H):
            for w in range(W):
                if (row >> h) & 1 and (col >> w) & 1 and C[h*W+w] == "#":
                    cnt += 1
        if cnt == K:
            ans += 1
print(ans)

Measured memory_bytes: 9140
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <math.h>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <functional>

using namespace std;

typedef long long int ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, int> pli;
typedef std::pair<ll, ll> pll;

#define FOR(i,n,m) for(ll i=(ll)(m);i<(ll)(n);++i)
#define REP(i,n) FOR(i,n,0)
#define IREP(i,n) for(ll i=(ll)(n);i>=0;--i)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

struct Dice
{
	int f;
	int a[4];
};

int main()
{
	Dice d[6];
	int k[6];
	REP(i, 6)
	{
		cin >> k[i];
	}

	d[0].f = k[0];
	d[0].a[0] = k[4];
	d[0].a[1] = k[2];
	d[0].a[2] = k[1];
	d[0].a[3] = k[3];

	d[1].f = k[1];
	d[1].a[0] = k[0];
	d[1].a[1] = k[2];
	d[1].a[2] = k[5];
	d[1].a[3] = k[3];

	d[2].f = k[2];
	d[2].a[0] = k[0];
	d[2].a[1] = k[4];
	d[2].a[2] = k[5];
	d[2].a[3] = k[1];

	d[3].f = k[3];
	d[3].a[0] = k[0];
	d[3].a[1] = k[1];
	d[3].a[2] = k[5];
	d[3].a[3] = k[4];

	d[4].f = k[4];
	d[4].a[0] = k[0];
	d[4].a[1] = k[3];
	d[4].a[2] = k[5];
	d[4].a[3] = k[2];

	d[5].f = k[5];
	d[5].a[0] = k[1];
	d[5].a[1] = k[2];
	d[5].a[2] = k[4];
	d[5].a[3] = k[3];

	int q;
	cin >> q;
	int ans[24];
	REP(i, q)
	{
		int u, f;
		cin >> u >> f;
		REP(j, 6)
		{
			if (d[j].f != f)continue;
			REP(l, 4)
			{
				if (d[j].a[l] != u)continue;
				ans[i] = d[j].a[(l + 1) % 4];
				break;
			}
			break;
		}
	}

	REP(i, q)
	{
		cout << ans[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 3100
#include<iostream>
#include<string>
using namespace std;
int main(){
	string a,b;
	getline(cin,a);
	b=a;
	for(int i=0;i<a.size();i++){
		for(int j=0;j<=25;j++){
			if(a[i]=='a'+j)b[i]='A'+j;
		}
	}
	cout<<b<<endl;
	return 0;
}

Measured memory_bytes: 1176
n,x=gets.split.map &:to_i
a=[1];b=[1]
n.times{|i|a<<a[i]*2+3;b<<b[i]*2+1}
f=->n,x{
	n==0 ? x<=0 ? 0 : 1 : x<=1+a[n-1] ? f[n-1,x-1] : b[n-1]+1+f[n-1,x-2-a[n-1]]
}
p f[n,x]

Measured memory_bytes: 3836