akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 1e9 + 7;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }

int main(){
    int n;
    cin >> n;
    int p[n];
    cins(p, p + n);
    int ans = 0;
    for(int i = 1; i < n - 1; i++){
        ans += (p[i] != min({p[i - 1], p[i], p[i + 1]}) && p[i] != max({p[i - 1], p[i], p[i + 1]}));
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
program speedrun
  implicit none
  integer::N
  integer,allocatable,dimension(:)::a
  integer::ANS
  real(8)::AVE,L
  integer::i
  read*,N
  allocate(a(N))
  read*,a
  AVE=real(SUM(A))/real(N)
  L=huge(L)
  do i=N,1,-1
    if(ABS(A(i)-AVE)<=L)then
        ANS=i-1
        L=ABS(A(i)-AVE)
    endif
end do
print"(i0)",ANS
end program speedrun

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (a); i < n; i++)
#define print(x) cout << x << endl;
using namespace std;
typedef long long ll;

string N; int K;
ll dp[101][2][5];
//---------------------------------------------------------------------------------------------------
int main() {
    cin >> N >> K;

    int n = N.length();

    dp[0][0][0] = 1;
    rep(dgt, 0, n) rep(isless, 0, 2) rep(k, 0, K + 1) {
        int c = N[dgt] - '0';
        rep(nxt, 0, 10) {
            if (c < nxt && isless == 0) continue;

            int dgt2 = dgt + 1;
            int isless2 = isless;
            if (nxt < c) isless2 = 1;
            int k2 = k;
            if (nxt != 0) k2++;

            dp[dgt2][isless2][k2] += dp[dgt][isless][k];
        }
    }
    ll ans = dp[n][0][K] + dp[n][1][K];
    cout << ans << endl;
    return 0;
}

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

using namespace std;
 
int main() {
	int A, B, C;
    cin >> A >> B >> C;
    bool res = false;
    for (int i = 1; i <= B; ++i) {
        if ((A * i) % B == C) res = true;
        if (res) break;
    }

    if (res) cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef DEBUG
#include "_debug.cpp"
#include "callable.hpp/callable.hpp"
#endif
#define endl '\n'
using namespace std;
using ll = long long;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin >> s;
    s[3] = '8';
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define nl "\n"
#define rep(i,n) for(ll i=0; i<(n); i++)
typedef vector<ll> vl;
typedef vector<vector<ll>> matrix;//matrix A(n, vl(m)); //n*m行列
typedef vector<string> vs;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define sortup(V) sort(V.begin(), V.end())
#define sortdown(V) sort(V.rbegin(), V.rend())
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;}
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007 //998244353


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

    // solution comes here

    string S;
    cin >> S;

    if(S=="zyxwvutsrqponmlkjihgfedcba") {
        cout << -1 << nl;
        return 0;
    }

    ll N=S.size();
    vl cnt(26);
    rep(i, N) cnt[S[i]-'a']++;

    if(N<26) {
        char c;
        for(c='a'; cnt[c-'a']; c++) ;
        cout << S << c << nl;
        return 0;
    }

    for(ll i=25; ; i--) {
        cnt[S[i]-'a']--;
        char c;
        for(c=S[i]+1; c<='z'; c++){
            if( !cnt[c-'a'] ){
                rep(j, i) cout << S[j];
                cout << c << nl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int a,b,c;
    int i;//アクセス用
    int count=0;//カウント用
    
    scanf("%d %d %d",&a,&b,&c);
    
    for(i=a;i<=b;i++){
        if(c%i==0){
            count++;
        }
    }
    printf("%d\n",count);
    return 0;
}



Measured memory_bytes: 2108
#include <atcoder/lazysegtree>
#include <atcoder/modint>
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mint atcoder::modint998244353

ll mod = 998244353;

struct S {
    mint value;
    ll size;
};

struct F {
    mint b;
    mint c;
};

S op(S x, S y) {
    return S{x.value+y.value, x.size+y.size};
}

S e() {
    return S{0, 0};
}

S mapping(F f, S x) {
    return S{f.b*x.value + f.c*x.size, x.size};
}

F composition(F f, F g) {
    return F{f.b*g.b, f.c+f.b*g.c};
}

F id() {
    return F{1, 0};
}

int main() {
    int N, Q;
    scanf("%d %d", &N, &Q);
    vector<S> A(N);
    for (int i = 0; i < N; i++) {
        ll a;
        scanf("%lld", &a);
        A[i] = S{a, 1};
    }

    atcoder::lazy_segtree<S, op, e, F, mapping, composition, id> lsgt(A);
    for (int q = 0; q < Q; q++) {
        int T;
        scanf("%d", &T);
        if (T == 0) {
            int l, r;
            ll b, c;
            scanf("%d %d %lld %lld", &l, &r, &b, &c);
            lsgt.apply(l, r, F{b, c});
        }
        if (T == 1) {
            int l, r;
            scanf("%d %d", &l, &r);
            printf("%lld\n", lsgt.prod(l, r).value);
        }
    }

}

Measured memory_bytes: 31368
#include <iostream>
#include <string>
using namespace std;
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <set>
#include <map>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200010
#define LIMIT2 500010
#define LIMIT3 1000010
#define INF ((1<<30)-1)
#define LLINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef long double ld;
typedef const void cv;
typedef pair<ll,ll> P;
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
#define per(i,n) for((i)=(n)-1;(i)>=0;(i)--)
template<class T,class C> T max(T a,C b){ return ((a)>(T)(b) ? (a) : (T)(b)); }
template<class T,class C> T min(T a,C b){ return ((a)<(T)(b) ? (a) : (T)(b)); }
#define zt(a,b) (max((a),(b))-min((a),(b)))
#define setpre(n) fixed << setprecision(n)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[8]={1,0,-1,0,1,-1,-1,1},dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(cv *a, cv *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(cv *a, cv *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(cv *left, cv *right) {return strcmp((char *)left,(char *)right);}
int downchar(cv *left, cv *right) {return strcmp((char *)right,(char *)left);}
ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1){
      res *= a; if(mod>=1) res %= mod;
    }
    a *= a; if(mod>=1) a %= mod;
    n >>= 1;
  }
  return res;
}
void initialize(){
  
}
int main(void){
  initialize();
  ll n,m,i,j,k,result=0;
  int h[LIMIT2]={0};
  ll dp[LIMIT1]={0};
  char s[LIMIT1];
  
  cin >> n >> k;
  rep(i,n){
    dp[i]=LLINF;
    cin >> h[i];
  }
  dp[0]=0;
  for(i=1;i<=n;i++){
    for(j=1;j<=k;j++){
      if(i-j<0) break;
      dp[i] = min(dp[i],dp[i-j]+llabs(h[i]-h[i-j]));
    }
  }
  cout << dp[n-1] << endl;
  return 0;
}

Measured memory_bytes: 7052
#include <bits/stdc++.h>
using namespace std;
#define int long long int
char grid[55][55];
int ar[55][55];
int32_t main(){
	int n,m;cin>>n>>m;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			cin>>grid[i][j];
			if(grid[i][j]=='#'){
				for(int k1=-1;k1<=1;k1++){
					for(int k2=-1;k2<=1;k2++){
						if(k1||k2){
							ar[i+k1][j+k2]++;
						}
					}
				}
			}
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			if(grid[i][j]=='.') cout<<ar[i][j];
			else cout<<"#";
		}
		cout<<"\n";
	}
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include "sstream"
#define quick ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
const int N=1e5+1;
map<string,int>mp; vector<string>vc;
int main() {
    quick
int n,mx=0; cin>>n; string s;
while(n--){
 cin>>s; mp[s]++;   mx=max(mx,mp[s]);
}
for(auto i:mp){
    if(i.second==mx){vc.push_back(i.first);}
}
sort(vc.begin(),vc.end());
for(int i=0;i<vc.size();i++){
cout<<vc[i];
if(i!=vc.size()-1){cout<<'\n';}
}
}

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

using ll = long long;
using ii = pair<int,int>;

const int N = 1e5+10;
int n; char s[N];

int main() { 
  scanf(" %s", s);
  n = strlen(s);
  if(s[0] == s[n - 1]) {
    if(n & 1) puts("Second");
    else puts("First");
  }
  else {
    if(n & 1) puts("First");
    else puts("Second");
  }
  return 0;
}


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

struct edge {
    int to, cost;
};
class dijkstra {
    int V;
    int d[100002];
    priority_queue<P, vector<P>, greater<P>> que;
    void update(int s, vector<edge> G[]) {
        fill(d, d + V + 1, 100000000000ll);
        d[s] = 0;
        que.push(make_pair(0, s));
        while (!que.empty()) {
            P p = que.top();
            que.pop();
            int v = p.second;
            if (d[v] < p.first) continue;
            rep(i, G[v].size()) {
                edge e = G[v][i];
                if (d[e.to] > d[v] + e.cost) {
                    d[e.to] = d[v] + e.cost;
                    que.push(make_pair(d[e.to], e.to));
                }
            }
        }
    }

public:
    dijkstra(int v, int s, vector<edge> G[]) {
        V = v;
        update(s, G);
    }
    int find(int e) {
        return d[e];
    }
};
int gcd(int a, int b) {
    if (a % b == 0)
        return b;
    else
        return gcd(b, a % b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
bool prime(int a) {
    if (a == 1) return false;
    for (int i = 2; i * i <= a; i++) {
        if (a % i == 0) return false;
    }
    return true;
}
class Union_Find {
private:
    vector<int> t, s;

public:
    Union_Find(int max_length) {
        rep(i, max_length + 1) {
            t.push_back(i);
            s.push_back(1);
        }
    }
    void Union(int x, int y) {
        if (same(x, y)) return;
        int tx = Find(x), ty = Find(y);
        if (s[tx] < s[ty]) {
            s[ty] += s[tx];
            t[tx] = ty;
        }
        else if (s[tx] > s[ty]) {
            s[tx] += s[ty];
            t[ty] = tx;
        }
        else if (tx > ty) {
            t[tx] = ty;
            s[ty] += s[tx];
        }
        else {
            t[ty] = tx;
            s[tx] += s[ty];
        }
    }
    int Find(int n) {
        if (t[n] == n)
            return n;
        else
            return t[n] = Find(t[n]);
    }
    bool same(int x, int y) {
        return Find(x) == Find(y);
    }
    int get_Size(int a) {
        return s[a];
    }
};
signed main() {
    int n;
    cin>>n;
    cout<<(n-2)*180<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

	public static void main(String[] args) {
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int rem = A % B;
		boolean ans = false;
		for (int i = 0; i < 100; i++) {
			if (rem == C) {
				ans = true;
				break;
			}
			rem += A;
			rem %= B;
		}
		if (ans) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}


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

 int main(){
  int x, y;

  cin >> x >> y;


  if (x==2 && y==2) cout << "Yes" << endl;
  
  else if ((x==4 || x==6 || x==9 || x==11)
           
       && (y==4 || y==6 || y==9 || y==11))
   cout << "Yes" << endl;


  else if ((x==1 || x==3 || x==5 || x==7 || x==8 || x==10 || x==12)
       && (y==1 || y==3 || y==5 || y==7 || y==8 || y==10 || y==12))       
   cout << "Yes" << endl;
  
  else cout << "No" << endl;
  
 return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;


int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a==b) cout<<c<<endl;
  else if(a==c) cout<<b<<endl;
  else cout<<a<<endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

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

        int A = sc.nextInt();

        int B = sc.nextInt();

        int C = sc.nextInt();

        int D = sc.nextInt();

        String flag;
        while (true) {
            C -= B;
            if (C <= 0) {
                flag = "t";
                break;
            }
            A -= D;
            if (A <= 0) {
                flag = "a";
                break;
            }
        }
        if (flag.equals("t")) System.out.println("Yes");
        else System.out.println("No");
    }

}


Measured memory_bytes: 35696
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
#pragma GCC optimize("Ofast")
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,tune=native")
 
using namespace __gnu_pbds;
using namespace std;
     
#define mp make_pair
#define sz(x) (int)((x).size())
#define all(x) (x).begin(),(x).end()
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define eb emplace_back
 
typedef pair< int, int > pii;
typedef pair< long long, long long > pll;
typedef long long ll;
typedef unsigned long long ull;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef vector< ll > vll;
typedef vector< vll > vvll;
typedef vector< pii > vpii;
typedef vector< vpii > vvpii;
typedef vector< pll > vpll;
typedef long double ld;
typedef vector< ld > vld;
typedef unsigned int uint;
 
const ll MOD2 = 1e9 + 7;
const int MOD = 1e9 + 7;
 
const ull infull = numeric_limits<unsigned long long>::max();
 
void fix(int &x, ll MOD) {
    x = (x % MOD);
    if(x < 0) x += MOD;
    return;
}
 
ll lgput(ll a, ll b, ll MOD) {
    ll ret = 1;
    a %= MOD;
    while(b) {
        if(b&1) ret = ret*a % MOD;
        a = a*a % MOD;
        b >>= 1;
    }
 
    return ret;
}
 
ll inv(ll a, ll MOD) {
    return lgput(a, MOD-2, MOD);
}
 
template <uint MD> struct ModInt {
    using M = ModInt;
    const static M G;
    uint v;
    ModInt(ll _v = 0) { set_v(uint(_v % MD + MD)); }
    M& set_v(uint _v) {
        v = (_v < MD) ? _v : _v - MD;
        return *this;
    }
    explicit operator bool() const { return v != 0; }
    M operator-() const { return M() - *this; }
    M operator+(const M& r) const { return M().set_v(v + r.v); }
    M operator-(const M& r) const { return M().set_v(v + MD - r.v); }
    M operator*(const M& r) const { return M().set_v(uint(ull(v) * r.v % MD)); }
    M operator/(const M& r) const { return *this * r.inv(); }
    M& operator+=(const M& r) { return *this = *this + r; }
    M& operator-=(const M& r) { return *this = *this - r; }
    M& operator*=(const M& r) { return *this = *this * r; }
    M& operator/=(const M& r) { return *this = *this / r; }
    bool operator==(const M& r) const { return v == r.v; }
    const bool operator<(const M& o) const {return v < o.v; }
    M pow(ll n) const {
        M x = *this, r = 1;
        while (n) {
            if (n & 1) r *= x;
            x *= x;
            n >>= 1;
        }
        return r;
    }
    M inv() const { return pow(MD - 2); }
    friend ostream& operator<<(ostream& os, const M& r) { return os << r.v; }
};
 
using Mint = ModInt<998244353>;

int main() { 
    #ifdef BLAT
        freopen("stdin", "r", stdin);
        freopen("stderr", "w", stderr);
    #endif
 
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(12);
    srand(time(NULL));

    string s;
    cin >> s;

    cout << (s[2] == s[3] && s[4] == s[5] ? "Yes" : "No");
    return 0; 
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <time.h>
#define ll long long
long long maxim(long long a, long long b) { return a > b ? a : b; }
int main(){
    ll a,b,c,d,ans=0;
    scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
    ans=maxim(a*c,a*d);
    ans=maxim(ans,b*c);
    ans=maxim(ans,b*d);
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 1732
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sqr(x) ((x)*(x))
#define ull unsigned long long
#define mp make_pair
#define ld long double
#define PI pair<int,int>
#define fi first
#define se second
#define pol vector<poly>
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read(){
	ll x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(ll a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(ll a){write(a); puts("");}
inline void wri(ll a){write(a); putchar(' ');}
const int N=15,mod=1000000007;
struct poly{
	ll a[1<<N|2];
	poly(){
		memset(a,0,sizeof(a));
	}
	void clear(){
		memset(a,0,sizeof(a));
	}
	inline ll& operator [](int x){
		return a[x];
	}
	void fwt(int n){
		for(int i=0;i<n;i++){
			for(int j=0;j<(1<<n);j++)if(j>>i&1){
				a[j]=a[j]+a[j^(1<<i)]>=mod?a[j]+a[j^(1<<i)]-mod:a[j]+a[j^(1<<i)];
			}
		}
	}
	void ufwt(int n){
		for(int i=0;i<n;i++){
			for(int j=0;j<(1<<n);j++)if(j>>i&1){
				a[j]=a[j]>=a[j^(1<<i)]?a[j]-a[j^(1<<i)]:a[j]-a[j^(1<<i)]+mod;
			}
		}
	}
}f[N+1],g[N+1];
PI Q[105];
ll v[105];
int cnt[1<<N|2];
ll ksm(ll a,int b){
	int ans=1;
	for(;b;b>>=1){
		if(b&1)ans=ans*a%mod;
		a=a*a%mod;
	}
	return ans;
}
void fft(pol &a,pol &b){
	int q=a.size()-1; 
	pol c(q+1);
	for(int i=0;i<=q;i++){
		//for(int k=0;k<(1<<q);k++)cout<<c[i][k]<<" "; puts("");
		for(int j=0;j<=i;j++){
			for(int k=0;k<(1<<q);k++){
				c[i][k]+=a[j][k]*b[i-j][k]; c[i][k]%=mod;
				//if(c[i][k]<0){cout<<q<<" "<<a[j][k]<<" "<<b[i-j][k]<<" "<<c[i][k]<<endl; exit(0);}
			}
		}
		for(int k=0;k<(1<<q);k++)c[i][k]%=mod;
	}
	swap(c,a);
}
void pf(pol &a){
	fft(a,a);
}
ll calc(int len){
	return (ksm(10,len)-1)*ksm(9,mod-2)%mod;
}
int main(){
	int n=read(),q=read();
	for(int i=0;i<q;i++){
		Q[i]=mp(read()-1,i);
		Q[i+q]=mp(read(),i);
	}
	sort(&Q[0],&Q[2*q]); Q[2*q].second=q;
	for(int i=0;i<2*q;i++){
		if(i==2*q-1)v[i]=ksm(10,n-Q[i].fi); else v[i]=calc(Q[i+1].fi-Q[i].fi); 
	}
	pol f(q+1);
	for(int i=0;i<(1<<q);i++){
		if(i)cnt[i]=cnt[i>>1]+(i&1);
		f[cnt[i]][i]=1;
		for(int j=0;j<2*q;j++)if(i>>Q[j].se&1){
			//if(i==3)cout<<v[j]<<" fjzzq "<<(i>>Q[j+1].se&1)<<endl;
			f[cnt[i]][i]=f[cnt[i]][i]*(v[j]+(i>>Q[j+1].se&1))%mod;
		}
		//cout<<f[cnt[i]][i]<<" "<<i<<endl;
	}
	for(int i=0;i<=q;i++)f[i].fwt(q);
	//pf(f); f[q].ufwt(q);
	pol ans=f;
	pf(f); pf(f); pf(f);
	fft(ans,f);//ans[q].ufwt(q);cout<<ans[q][(1<<q)-1]<<endl;
	ans[q].ufwt(q);
	ll an=ans[q][(1<<q)-1]*ksm(9,mod-2)%mod,t=calc(Q[0].fi);
	cout<<((9*t+1)%mod*an%mod+mod)%mod<<endl;
}

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

using namespace std;

int main(void)
{
	int n;
	cin >> n;
	vector<int> num(n);
	int i;
	for (i = 0; i < n; i++)
	{
		cin >> num[i];
	}
	sort(num.begin(), num.end());
	cout << num[n - 1] - num[0] << endl;
	return 0;
}


Measured memory_bytes: 256
<?php
function data_split($str, $start, $end) {
  $head = "";
  if ($start > 0) {
    $head = substr($str, 0, $start);
  }

  $tail = "";
  if ($end < strlen($str) - 1) {
    $tail = substr($str, $end + 1);
  }

  $target = substr($str, $start, $end - $start + 1);
  return array($head, $target, $tail);
}


$data = trim(fgets(STDIN));
$num_op = trim(fgets(STDIN));

do {
  $input = trim(fgets(STDIN));
  $op = explode(" ", $input);

  List($head, $target, $tail) = data_split($data, $op[1], $op[2]);
  switch ($op[0]) {
  case "print":
    echo $target . PHP_EOL;
    break;
  case "reverse":
    $target = strrev($target);
    $data = $head . $target . $tail;
    break;
  case "replace":
    $data = $head . $op[3] . $tail;
    break;
  default:
    echo "Syntax Error." . PHP_EOL;
  }

  $num_op--;
} while ($num_op > 0);

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

int main(void)
{
    int N;
    cin >> N;
    vector<int> L(N);
    vector<int> lenMap(1e3);
    for (int i = 0; i < N; i++)
    {
        cin >> L[i];
        
    }

    sort(L.begin(), L.end());
    ll cnt = 0;

    for(int i = 0; i < N-2; i++){
        for(int j = i+1; j < N-1; j++){
            int lb = lower_bound(L.begin(), L.end(), L[i] + L[j]) - L.begin();
            cnt += lb - j - 1;
        }
    }

    cout << cnt<< endl;

    return 0;
}


Measured memory_bytes: 3612
until(s=gets.gsub(/\d+/){|k|?1*k.hex})[?#]
n=1+s.index(?/)
eval"s[n*c-n+e-1]=?1;s[n*g-n+i-1]=?bdfh".tr('c-i',gets)
$><<s.gsub(/1+/,&:size)
end

Measured memory_bytes: 8824
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> a(n),b(n);
  for(int i=0;i<n;++i){
    cin>>a[i]>>b[i];
  }
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  int x=0,y=0,cnt=0,max=0;
  for(int i=1;i<=1000000000;++i){
    if(a[x]==i) {
      ++cnt;
      if(max<cnt) ++max;
      ++x;
      --i;
    }
    if(b[y]==i){
      --cnt;
      ++y;
      --i;
    } 
  }
  cout<<max<<endl;
  return 0;
}



Measured memory_bytes: 3636
def read():
    N, K = list(map(int, input().strip().split()))
    A = list(map(int, input().strip().split()))
    return N, K, A

def solve(N, K, A):
    if K == 1:
        return 0
    
    S = [0 for _ in range(N+1)]
    for i in range(N):
        S[i+1] = S[i] + A[i]
    
    count_sum = 0
    count = dict()
    for j in range(1, N+1):
        j_mod_k = (S[j] - j) % K  # 0 <= jmodk < K
        if j == 1:
            for i in range(max(0, j-K+1), j):
                # (S[i] - i) % K の値 i_mod_k は、次のループでもほぼ重複する
                # i = max(0, j-K+1) の時の i_mod_k は、i+1で破棄する
                # i = j の時の i_mod_k は、i+1で生成する
                i_mod_k = (S[i] - i) % K
                if i_mod_k in count:
                    count[i_mod_k] += 1
                else:
                    count[i_mod_k] = 1
        else:
            if max(0, j-K+1) != max(0, (j-1)-K+1):
                i = max(0, (j-1)-K+1)
                i_mod_k = (S[i] - i) % K
                if i_mod_k in count:
                    if count[i_mod_k] == 1:
                        count.pop(i_mod_k)
                    else:
                        count[i_mod_k] -= 1
            i = j-1
            i_mod_k = (S[i] - i) % K
            if i_mod_k in count:
                count[i_mod_k] += 1
            else:
                count[i_mod_k] = 1
        if j_mod_k in count:
            count_sum += count[j_mod_k]
    return count_sum

if __name__ == '__main__':
    inputs = read()
    print('%d' % solve(*inputs))


Measured memory_bytes: 112256
import math

def ispalindrome(str): return True if str == str[::-1] else False

if __name__ == "__main__":
    S = input()
    N = len(S)
    s1 = S[:math.floor((N-1)/2)]
    # print(s1)
    s2 = S[math.ceil((N+3)/2)-1:]
    # print(s2)

    if ispalindrome(S) and ispalindrome(s1) and ispalindrome(s2) :
        ret = "Yes"
    else:
        ret = "No"
    print(ret)



Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<set>
using namespace std;
typedef long long ll;
double a[200100];
int main(){
	ll n,k;
	cin>>n>>k;
	ll i,j;
	for(i=0;i<n;i++){
		cin>>a[i];
		a[i]=(a[i]+1)/2;
		if(i<k)
			a[i]+=a[i-1];
		else
			a[i]=a[i]+a[i-1];
	}
	for(i=n;i>=k;i--)
		a[i]-=a[i-k];
	sort(a,a+n);
	printf("%.12lf",a[n-1]);
	
}


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

int N, M;
int A[50], B[50];
int G[50][50];
bool visited[50];

void dfs(int u) {
    visited[u] = true;
    for (int v = 0; v < N; v++) {
        if (!visited[v] && G[u][v]) {
            dfs(v);
        }
    }
}

int main() {
    cin >> N >> M;
    for (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        A[i] = a, B[i] = b;
        G[a][b] = G[b][a] = 1;
    }

    int res = 0;
    for (int i = 0; i < M; i++) {
        G[A[i]][B[i]] = G[B[i]][A[i]] = 0;
        for (int j = 0; j < N; j++)
            visited[j] = false;

        dfs(0);

        for (int j = 0; j < N; j++) {
            if (!visited[j]) {
                res++;
                break;
            }
        }
        G[A[i]][B[i]] = G[B[i]][A[i]] = 1;
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <math.h>
#include<iostream>
#include <string>
using namespace std;
typedef long long ll;
#define pb pushback
#define fr(i,n) for(int i=0;i<n;i++)
#define ifr(i,n) for(int i=n-1;i>=0;i--)


int main() {
    int N;
    int task=0;
	cin >> N;
    vector<pair<long, long>> pairs(N);
    int B[N];
    int A[N];
    for(int i=0;i<N;i++){
    cin >> B[i];
    cin >> A[i];
    pairs[i] = make_pair(A[i], B[i]);
  }
  sort(pairs.begin(), pairs.end());
  string ans = "Yes";
  for(int i=0;i<N;i++){
    task+=pairs[i].second;
    if(task>pairs[i].first){
      ans = "No";
      break;
    }
  }
   cout << ans << endl;
}


Measured memory_bytes: 4992
N,M,X=map(int,input().split())
C=[]
A=[]
for _ in range(N):
    L=list(map(int,input().split()))
    C.append(L[0])
    A.append(L[1:])

ans=float('inf')

for bit in range(1<<N):
    ML=[0]*M
    cost=0
    for i in range(N):
        if bit>>i & 1 == 1:
            cost+=C[i]
            for j in range(M):
                ML[j]+=A[i][j]
    if all(m>=X for m in ML):
        ans=min(ans,cost)
if ans==float("inf"):
    print(-1)
else:
    print(ans)




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

int main(){
  int n;
  cin >> n;
  
  vector<int> dia(n);
  for(int i=0; i<n; i++){
    cin >> dia.at(i);
  }
  
  sort(dia.begin(), dia.end());
  reverse(dia.begin(), dia.end());
  
  int count = 1;
  
  for (int i=0; i<n-1; i++){
    if (dia.at(i) > dia.at(i+1)){
      count++;
    }
  }
  
  cout << count << endl;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

void solve(){
    int A, B;
    cin >> A >> B;

    if (A % 2 == 0 || B % 2 == 0) {
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


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

    #define ff first
    #define ss second
    #define mp make_pair
    #define eb emplace_back
    #define trav(i,a) for(auto i: a)
    #define all(v) (v.begin(),v.end())
    #define rall(v) (v.rbegin(),v.rend())
    #define tc(t) ll t; cin>>t; while(t--)
    #define prec(n) fixed<<setprecission(n)
    #define mst(arr,value) memset(arr,value,sizeof(arr)) /* -1 or 0 */
    
    const long long sz = (long long)1e4+5;
    const long long mx = (long long)2e5+5;
    const long long inf = (long long)1e18;
    const long long mod = (long long)1e9+7;
    
    #define f(i,n)     for(ll i=0;   i<n;  i++)
    #define fab(i,a,b) for(ll i=a;   i<b;  i++)
    #define fr(i,n)    for(ll i=n-1; i>=0; i--)
    #define fba(i,b,a) for(ll i=b-1; i>=a; i--)

    long long pw(long long x,unsigned long long y) 
    { 
        if (y==0) return 1; 
        else if (y%2==0)  return pw(x,y/2)*pw(x,y/2); 
        else return x*pw(x,y/2)*pw(x,y/2);
    }

    int main() 
    {
        ios_base::sync_with_stdio(0);
        cin.tie(NULL);
        cout.tie(NULL);
        ll h,n,k,ans=0;
        cin>>n>>k;
        ll a[n];
        f(i,n){ cin>>a[i]; }
        sort(a,a+n);
        f(i,n-k)
            ans+=a[i];
        cout<<ans;
        return 0;
    }

Measured memory_bytes: 1792
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), t = sc.nextInt(), a = sc.nextInt(), x=0;
        double ans = 100000;
        for(int i=0;i<n;i++){
            int h = sc.nextInt();
            if(Math.abs(a - (t - h * 0.006)) < ans){
                ans = Math.abs(a - (t - h * 0.006));
                x = i;
            }
        }
        System.out.println(x + 1);
    }
}

Measured memory_bytes: 22356
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, m int
	l := make(map[int]int)

	fmt.Scan(&n, &m)
	for i := 0; i < n; i++ {
		var tmpA, tmpB int
		fmt.Scan(&tmpA, &tmpB)
		if _, ok := l[tmpA]; ok {
			l[tmpA] += tmpB
		} else {
			l[tmpA] = tmpB
		}
	}

	var keys []int
	for k := range l {
		keys = append(keys, k)
	}
	sort.Ints(keys)

	var bought int
	var sum int
	for _, v := range keys {
		for i := 0; i < l[v]; i++ {
			if bought >= m {
				break
			}
			bought++
			sum += v
		}
	}

	fmt.Println(sum)
}


Measured memory_bytes: 10368
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
using namespace std;

typedef long long ll;

ll a[100003], ma[100003], prof[100003];

int main() {
	int n; ll t; cin >> n >> t;
	t -= t % 2;
	for (int i = 0; i < n; ++i) cin >> a[i];
	ma[n - 1] = a[n - 1];
	for (int i = n - 2; i >= 0; --i) ma[i] = max(a[i], ma[i + 1]);
	ll m = 0;
	for (int i = 0; i < n - 1; ++i) {
		prof[i] = ma[i] * t / 2 - a[i] * t / 2;
		m = max(m, prof[i]);
	}
	int ans = 0;
	for (int i = 0; i < n - 1; ++i) {
		ans += prof[i] == m;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 2560
#include<iostream>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;

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

int card[51];
int ncard[51];
int n, r, c, p;

int main()
{
    while(cin >> n >> r && n)
    {
        REP(n) card[i] = n - i;

        REP(r)
        {
            cin >> p >> c;

            rep(j,n) ncard[j] = card[j];
            //rep(j,n)cout <<j<< ":" << card[j] << endl;
            
            rep(j,p - 1) ncard[c + j] = card[j];
            rep(j, c) ncard[j] = card[j + p - 1];
            
            rep(j,n) card[j] = ncard[j];
        }
       // REP(n)cout <<i << ":" << card[i] << endl;

        cout << card[0] << endl;

    }
    
    return 0;
}

Measured memory_bytes: 0
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include<cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include<bitset>

#define REP(i, b, n) for(int i=b;i<(int)n;i++)
#define rep(i, n)   REP(i,0,n)
#define ALL(C)     (C).begin(),(C).end()
#define FOR(it, o)  for(__typeof((o).begin()) it=(o).begin(); it!=(o).end(); ++it)
#define dbg(x) cout << __LINE__ << ' ' << #x << " = " << (x) << endl


typedef long long ll;

using namespace std;

//ハマったらチェックリスト見ろ!!

int main() {
    int N;
    cin >> N;
    map<int, int> D;
    rep(i, N){
        int tmp;
        cin >> tmp;
        D[tmp]++;
    }
    int M;
    cin >> M;
    rep(i, M){
        int tmp;
        cin >> tmp;
        D[tmp]--;
        if(D[tmp]<0){
            cout << "NO"<<endl;
            return 0;
        }
    }
    cout << "YES" <<endl;



    return 0;
}

Measured memory_bytes: 9600
#include <stdio.h>

int main(){
    int A, B, X;
    int ans, c;
    scanf("%d%d%d", &A, &B, &X);
    if(A >= B * 2){
        ans = ((X - 1) / 500 + 1) * B;
    }else{
        ans = X / 1000 * A;
        c = X % 1000;
            if(c > 0){
                if(c <= 500 && B < A){
                ans += B;
                }else{
                ans += A;
            } 
            }
            }
        
    
    printf("%d\n", ans);
    return 0;
}




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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

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

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,pii> ppii;

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

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

int main(){
    bool flag=false;
    ll ans=0,sum=0;

    int n,k;
    cin>>n>>k;
    int like[10]={};
    vector<int>tr;

    rep(i,k){
        int ki;
        cin>>ki;
        like[ki]=1;
    }

    rep(i,10)if(like[i]!=1)tr.pb(i);
    sort(all(tr));

    //for(int i:tr)db(i);
    //ln;

    int pay;
    rep1(i,n,11*n){
        int t=i;
        bool ok=true;
        while(t>0){
            if(!binary_search(all(tr),t%10)){ok=false;break;}
            t/=10;
        }
        if(ok){
            pay=i;
            break;
        }
    }

    //cout <<fixed<<setprecision(16)<< << endl;
    cout<<pay<<endl;
    
    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String aa = scan.next();
    int a = Integer.parseInt(aa);
    String bb = scan.next();
    int b = Integer.parseInt(bb);
    int pie = a * b;
    int syuu = (2 * a) + (2 * b);
    System.out.println(pie + " " + syuu);
  }
}

Measured memory_bytes: 25968
def last_number(n):
    if n == 0:
        return [0, 1]
    elif n == 9:
        return [8, 9]
    else:
        return [n-1, n, n+1]

k = int(input())
lun = {1, 2, 3, 4, 5, 6, 7, 8, 9}
temp = set()
while len(lun) < k:
    for i in lun:
        last = int(str(i)[-1])
        for j in last_number(last):
            temp.add(int(str(i) + str(j)))
    lun.update(temp)
    temp = set()
answer = sorted(list(lun))
print(answer[k - 1])


Measured memory_bytes: 90588
#include <iostream>

int log2recursively(int i, int tmp) {
  int r = i / 2;

  if (r == 0) {
    return tmp;
  } else {
    return log2recursively(r, tmp * 2);
  }
}

int main() {
  int n;

  std::cin >> n;
  std::cout << log2recursively(n, 1) << std::endl;

  return 0;
}



Measured memory_bytes: 3104
#include <stdio.h>
#include <stdlib.h>
#define p (int)(1e9 + 7)

long long int mod(long long int x){
	if(x < 0){
		return p + x % p;
	}
	else{
		return x % p;
	}
}

int main(){
	long long int n;
	scanf("%lld", &n);
	long long int *A = (long long int *)malloc(sizeof(long long int) * (n + 1));
	long long int *sum = (long long int *)malloc(sizeof(long long int) * (n + 1));
	A[0] = 1;
	A[1] = n;
	sum[1] = n;
	int i;
	for(i = 2; i <= n; i++){
		A[i] = mod(n * (n - 1) + 3 - i + sum[i - 1] - A[i - 2]);
		sum[i] = mod(sum[i - 1] + A[i]);
	}
	printf("%lld\n", A[n]);
	return 0;
}

Measured memory_bytes: 15744
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<vector>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define R max(i,max(j,k))
using namespace std;
const int N=310,mod=1e9+7;
int n,m,f[N][N][N],ans;
vector<pair<int,int> > E[N];
void add(int &a,int b) {a+=b;if(a>=mod) a-=mod;}
int main()
{
	cin>>n>>m;f[0][0][0]=1;
	for(int i=1,l,r,x;i<=m;i++) cin>>l>>r>>x,E[r].pb(mp(l,x));
	for(int i=0;i<=n;i++)
		for(int j=0;j<=n;j++)
			for(int k=0;k<=n;k++)
			{
				int &s=f[i][j][k];if(!s) continue;
				if((i&&i==k)||(j&&j==k)||(i&&i==j)) s=0;
				for(auto x:E[R]) if((i>=x.fi)+(j>=x.fi)+(k>=x.fi)!=x.se) s=0;
				if(!s) continue;add(f[R+1][j][k],s);
				add(f[i][R+1][k],s);add(f[i][j][R+1],s);
				if(R==n) (ans+=f[i][j][k])%=mod;
			}
	cout<<ans<<endl;return 0;
}


Measured memory_bytes: 114944
#pragma GCC optimize ("Ofast")
#include "bits/stdc++.h"
// #include "ext/pb_ds/assoc_container.hpp"
// #include "ext/pb_ds/tree_policy.hpp"
// using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
#define int long long 
#define pb push_back
#define fi first
#define se second
#define deb cerr << "Line no." << __LINE__
#define fr(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
#define IO ios :: sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define pii pair<int,int>
#define sz(x) (int)x.size()
const int mod = 1e9 + 7;
const int mod1 = 998244353;
typedef double f80;
#ifndef LOCAL
#define endl '\n'
#endif

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

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rand(int l, int r){
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}
ll pwr(ll a,ll b){
    int ans = 1;
    while(b){
        if(b & 1) ans = (ans * a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return ans;
}
int g(int x){
    return x ^ (x >> 1);
}
int tr[1 << 18], mask1[1 << 18];
int curr;
int n;
void dfs(int u){
    if(u <= (1 << (n - 1)) - 1){
        dfs(2 * u);
    }
    curr ^= tr[u];
    cout << curr << " ";
    if(u <= (1 << (n - 1)) - 1){
        dfs(2 * u + 1);
    }
}
void solve(){
    int a, b;
    cin >> n >> a >> b;
    int tot = (1 << n) - 1;
    if(!(__builtin_popcount((a ^ b)) & 1)){
        cout << "NO";
        return;
    }
    cout << "YES" << endl;
    int cur = 1;
    int mask = (a ^ b);
    while(mask){
        fr(i, 0, n - 1){
            if(mask & (1 << i)){
                mask1[cur] = (1 << i);
                tr[cur++] = (1 << i);
                mask ^= (1 << i);
                break;
            }
        }
    }
    int gg = (1 << n) - 1;
    fr(i, 1, (1 << (n - 1)) - 1){
        if(!tr[2 * i]){
            fr(j, 0, n - 1){
                if(!(mask1[i] & (1 << j)))
                {
                    mask1[2 * i] = mask1[i] ^ (1 << j);
                    tr[2 * i] = (1 << j);
                    break;
                }
            }
        }
        else{
            mask1[2 * i] ^= mask1[i];
        }
        if(!tr[2 * i + 1]){
            fr(j, 0, n - 1){
                if(!(mask1[i] & (1 << j)))
                {
                    mask1[2 * i + 1] = mask1[i] ^ (1 << j);
                    tr[2 * i + 1] = (1 << j);
                    break;
                }
            }
        }
        else{
            mask1[2 * i + 1] ^= mask1[i];
        }
    }
    curr = a;
    cout << a << " ";
    dfs(1);
}
signed main(){
    IO;
    #ifdef LOCAL
        freopen("inp.txt","r", stdin);
        // freopen("out.txt", "w", stdout);
    #endif
    clock_t clk = clock();
    int t = 1;
    // cin >> t;
    fr(tt, 1, t){
        solve();
    }
    cerr << endl << setprecision(10) << fixed << (double)(clock() - clk) / CLOCKS_PER_SEC;
    return 0;
}

Measured memory_bytes: 4096
antennas = []

for _ in range(5):
  antennas.append(int(input()))

k = int(input())

available = True

for send in range(5):
  if not available:
    break
  for receive in range(5):
    if antennas[receive] - antennas[send] > k:
      available = False
      break

if available:
  print("Yay!")
else:
  print(":(")


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);

const int N = 2e5 + 5, M = 1e6+6, OO = 0x3f3f3f3f;
int n, m;
int freq[N];
int main()
{
    // FIO
    cin>>n;
    for(int i = 0 ; i < n-1 ; i++)
    {
        int x; 
        cin>>x;
        freq[x]++;
    }
    for(int i = 1 ; i <= n ; i++)
        cout<<freq[i]<<endl;

}

Measured memory_bytes: 4376
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ll long long
#define ll_MAX LONG_LONG_MAX
#define ll_MIN LONG_LONG_MIN
#define pi pair<int,int>
#define endl "\n"
#define MAXN 100005
#define mod 1000000007
using namespace std;

void solve()
{
    
}
ll expo(ll x, ll y)
{
    ll res = 1;
    while(y)
    {
        if( (y&1) == 1)
        {
            res = (res*x)%mod;
        }
        y = y>>1;
        x = (x*x)%mod;
    }
    return res;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);
    solve();
    ll n;
    cin>>n;
    if(n==1)
    {
        cout<<0<<'\n';
        return 0;
    }
    // ll ans = (n*(n - 1))%(ll)mod;
    ll val = (expo(10, n) - expo(9, n) - expo(9, n) + expo(8, n) + 2*mod)%(ll)mod;
    cout<<val<<'\n';
}

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

int compter(vector<bool> v)
{
    int sum = 0;
    for (int i=0; i<v.size(); i++)
        if (v[i] == 1)
            sum++;
    // if (sum == 0)
    //     cout << "abc";
    return max(sum - 1,0);
}

int main() 
{
    // Input
    int n, A, B, C;
    cin >> n >> A >> B >> C;
    vector<int> bambo(n);
    for (int i=0; i<n; i++)
        cin >> bambo[i];
    int ans = INT_MAX;
    // mask 1 = 0 ou 1?
    for(int mask1 = 1; mask1 < (1<<n); mask1++)
    {
        // A
        vector<bool> bina(n, 0);
        for(int i = 0; i < n; i++) if(mask1 & (1<<i))
            bina[i] = 1;
        for(int mask2 = 1; mask2 < (1<<n); mask2++)
        {
            if ((mask1 & mask2) != 0) continue;
            // B
            vector<bool> binb(n, 0);
            for(int i = 0; i < n; i++) if(mask2 & (1<<i))
                binb[i] = 1;
            for(int mask3 = 1; mask3 < (1<<n); mask3++)
            {
                if ((mask1 & mask3) != 0 || (mask2 & mask3) != 0) continue;
                // C
                vector<bool> binc(n, 0);
                for(int i = 0; i < n; i++) if(mask3 & (1<<i))
                    binc[i] = 1;
                // Work
                int tA=0, tB=0, tC=0;
                for (int i=0; i<n; i++)
                    if (bina[i] == 1)
                        tA += bambo[i];
                for (int i=0; i<n; i++)
                    if (binb[i] == 1)
                        tB += bambo[i];
                for (int i=0; i<n; i++)
                    if (binc[i] == 1)
                        tC += bambo[i];
                int res = 10*compter(bina) + 10*compter(binb) + 10*compter(binc) + abs(A-tA) + abs(B-tB) + abs(C-tC);
                // if (compter(bina))
                ans = min(res, ans);           
            }
        }
    }
    cout << ans;
    return 0;
}

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

using namespace std;

int main()
{
    int n,i;
    cin>>n;
    double m,s=0,p;
    string t;
    for (i=1;i<=n;++i){

        cin>>m;
        cin>>t;

        if (t=="BTC"){

            p=m*380000.0;
            s+=p;

        }
        else s+=m;


    }

    printf ("%lf\n",s);

    return 0;

}


Measured memory_bytes: 256
import java.util.*;

public class Main {

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

        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        if (a == b && a == c) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }

}


Measured memory_bytes: 22996
#include <stdio.h>

int main(void){
    int H,W;
    while(1){
    scanf("%d %d",&H,&W);
    if(H==0&&W==0)
    break;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if((i+j)%2==0){
                printf("#");
            }else{
                printf(".");
            }
        }
        printf("\n");
    }printf("\n");
    }
    return 0;
}



Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    for (int i = 0; i <= n; i += 4){
        for (int j = 0; j <= n; j += 7){
            if (i+j == n){cout << "Yes" << endl;return 0;}
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <map>
using namespace std;

class UnionFind{
private:
    vector<int> p,s;
public:
	UnionFind(){}
	UnionFind(int N){
		p = s = vector<int>(N+1,0);
		for(int i=1;i<=N;i++){
			p[i] = i; s[i] = 1;
		}
	}
	int find(int x){
		if(p[x]==x) return x;
		else return p[x] = find(p[x]);
	}
	void unite(int x,int y){
		x = find(x); y = find(y);
		if(x==y) return;
		if(s[x]>s[y]){
			p[y] = x;
			s[x] += s[y];
		}else{
			p[x] = y;
			s[y] += s[x];
		}
	}
	bool is_same_set(int x,int y) {return find(x)==find(y);}
	int size(int x) {return s[find(x)];}
};

int N,K,L,p,q,r,s;
int main(){
    cin >> N >> K >> L;
    UnionFind uf1(N),uf2(N);
    for(int i=0;i<K;i++){
        cin >> p >> q;
        uf1.unite(p,q);
    }
    for(int i=0;i<L;i++){
        cin >> r >> s;
        uf2.unite(r,s);
    }
    map<pair<int,int>,int> m;
    for(int i=1;i<=N;i++){
        m[{uf1.find(i),uf2.find(i)}]++;
    }
    for(int i=1;i<=N;i++){
        cout << m[{uf1.find(i),uf2.find(i)}] << (i!=N? " ":"\n");
    }
}

Measured memory_bytes: 15104