akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
 
////////////// Prewritten code follows. Look down for solution. ////////////////

#define fs first
#define sc second
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define len(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef pair<ll, ll> pll;

template<typename T>
const T INF = (is_same<T, int>::value ? 1e9 : 1e18);
template<typename T>
inline T mod(T n, T mod){ T res = n%mod; if(res < 0) res += mod; return res; }
 
////////////////////////// Solution starts below. //////////////////////////////

double v[55];

int main(){
  fastio;
  int n;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> v[i];
  }
  sort(v, v+n);
  for(int i = 1; i < n; i++){
    v[i] = (v[i]+v[i-1])/2.0;
  }
  cout << setprecision(10) << fixed << v[n-1] << '\n';
  return 0;
}

Measured memory_bytes: 256
import math
n,h = map(int ,raw_input().split())
ais = [map(int, raw_input().split()) for _ in range(n)]
ais.sort(key = lambda x: (-x[1],x[0]))
cumul = 0
r = +float('inf')
m = max(ais)[0]
for i in range(-1,len(ais)):
	if i >= 0:
		cumul += ais[i][1]
	r = min(r, i+1 + math.ceil(max(0,h - cumul) /  float(m)))
print int(r)


Measured memory_bytes: 94780
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i=a; i<n; i++)
#define RREP(i, a, n) for(ll i=n-1; i>=a; i--)
typedef long long ll;
const ll mod =1e9+7;
const ll inf =1e18;
using namespace std;

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

    string ans="";
    while(n != 0){
        if(n%2!=0){
            ans="1"+ans;
            n--;
        }
        else ans="0"+ans;
        n /= -2;
    }

    if(ans=="") ans="0";

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

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

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>
using lll = long long;
using ull = unsigned long long;
using namespace std;


void insert(vector<lll>* heap,lll val){
  heap->push_back(val);
  lll ii = heap->size();
  lll jj = ii/2;

  while(ii>1 && heap->at(ii-1) > heap->at(jj-1)){
    lll t = heap->at(ii-1);
    heap->at(ii-1) = heap->at(jj-1);
    heap->at(jj-1) = t;
    ii = jj;
    jj = ii/2;
  }
}

lll deleteMax(vector<lll>* heap){
  int ret = heap->at(0);
  heap->at(0) = heap->at(heap->size()-1);
  heap->erase(heap->end()-1);
  lll ii=1,jj=ii*2;
  lll num = heap->size();

  while(jj <= num){
    if(jj+1 <= num && heap->at(jj-1) < heap->at(jj)){jj++;}

    if( heap->at(ii-1) < heap->at(jj-1)){
      lll tmp = heap->at(ii-1);
      heap->at(ii-1) = heap->at(jj-1);
      heap->at(jj-1) = tmp;

    }
      ii = jj;
      jj = ii*2;    
  }

  
  return ret;
}

int main(){
  lll ii,jj,kk;

  lll n,m;
  vector<lll> a;
  vector<lll> heap;
  cin >> n >> m;

  a.resize(n);

  for(ii=0;ii<n;ii++){
    cin >> a[ii];
  }


  for(ii=0;ii<n;ii++){
    insert(&heap,a[ii]);
  }
  
  for(ii=0;ii<m;ii++){
    lll max = deleteMax(&heap);
    max = max/2;
    insert(&heap,max);
  }

  lll sum = 0;


  for(ii=0;ii<n;ii++){
    sum += heap[ii];
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 2168
#include<bits/stdc++.h>
using namespace std;
int gcd(int x, int y) {
    return !y ? x : gcd(y, x % y);
}
const int N = 2010;
int a[N], e[N][N], n, d[N];
bool vis[N];
vector<int> g[N];
void dfs(int x) {
    vis[x] = 1;
    for (int i = 1; i <= n; i++) 
        if (!vis[i] && e[x][i]) {
            g[x].push_back(i); d[i]++;
            dfs(i);
        }
}
priority_queue<int> q;
int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    sort(a + 1, a + 1 + n);
    for (int i = 1; i <= n; i++)
        for (int j = i + 1; j <= n; j++)
            if (gcd(a[i], a[j]) > 1)
                e[i][j] = e[j][i] = 1;
    for (int i = 1; i <= n; i++)
        if (!vis[i]) dfs(i);
    for (int i = 1; i <= n; i++) if (!d[i]) q.push(i);
    while (!q.empty()) {
        int u = q.top(); q.pop();
        printf("%d ", a[u]);
        for (int i = 0; i < g[u].size(); i++) {
            int v = g[u][i];
            if (!(--d[v])) q.push(v);
        }
    }
    return 0;
}

Measured memory_bytes: 16256
/// Code By t_bone_289 (Tushar Singh)
/// An Immature Programmer.... I'm still developing !!
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pll pair<ll,ll>
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define endl '\n'
#define M 1000000007
#define error(x) cout << #x << " = " << x << endl;
#define pi 3.14159265358979323846
typedef long long ll;
typedef long double ld;
template <typename T>
void ContainerError(T &v){cout<<"{";for(auto &x:v){cout<<x<<',';}cout<<"}"<<endl;return;}
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
ll powmod(ll base,ll exp,ll MOD){ll res=1;while(exp>0){if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return (res%MOD);}
ll mpow(ll base,ll exp){ll res=1;while(exp>0){if(exp%2==1) res=(res*base);base=(base*base);exp/=2;}return (res);}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    std::vector<ll> v(3);
    cin>>v[0]>>v[1]>>v[2];
    sort(v.begin(),v.end());
    if(v[0]==v[1] && v[1]!=v[2])
    {
    	cout<<"Yes";
    }
    else if(v[1]==v[2] && v[0]!=v[1])

    {
    	cout<<"Yes";
    }
    else cout<<"No";
    return 0;
}



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

typedef long long ll;
typedef vector<ll> v1;
typedef vector<vector<ll>> graph;

const ll INF = 1ll << 50;
const ll mod = 1000000007;

class union_find {
private:
  v1 *par;
  v1 *rnk;
  v1 *siz;
public:
  union_find (ll n){
    par = new v1(n);
    iota(par->begin(),par->end(),0);
    rnk = new v1(n,0);
    siz = new v1(n,1);
  }
  ll find(ll x){
    if(par->at(x) == x) return x;
    else return par->at(x) = find(par->at(x));
  }
  ll size(ll x){
    return siz->at(find(x));
  }
  void unite(ll x,ll y){
    x = find(x);y = find(y);
    if(x == y)return;
    if(rnk->at(x) < rnk->at(y)){
      par->at(x) = y;
      siz->at(y) += siz->at(x);
    }
    else {
      par->at(y) = x;
      siz->at(x) += siz->at(y);
      if(rnk->at(x) == rnk->at(y)) rnk->at(x)++;
    }
  }
  bool same(ll x,ll y){
    return find(x) == find(y);
  }
};

ll n;
ll x[100000];
ll y[100000];
ll ans = INF;

int main(){
    cin >> n;
    for(ll i = 0;i < n;i++){
        cin >> x[i] >> y[i];
    }
    for(ll i = 0;i < n;i++){
        for(ll j = 0;j < n;j++){
            ll p = x[i] - x[j];
            ll q = y[i] - y[j];
            union_find uf(n);
            for(ll k = 0;k < n;k++){
                for(ll l = 0;l < n;l++){
                    if(x[k]-x[l] == p && y[k]-y[l] == q){
                        uf.unite(k,l);
                    }
                }
            }
            set<ll> s;
            for(ll k = 0;k < n;k++){
                s.insert(uf.find(k));
            }
            ans = min(ans,(ll)s.size());
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3584
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <numeric>
#include <deque>
#include <cstring>
#include <iterator>
#include <map>
#include <cstdlib>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <complex>
#include <bitset>
#include <chrono>
#include <random>
using namespace std;

#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define eb emplace_back
#define el '\n'
typedef  long long  ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<string> vs;

ll inf=(ll)2e18;
const int mod=1000000007;
//const int mod=998244353;
int n,m;






int main()
{   ios_base::sync_with_stdio(false);cin.tie(NULL);
    int q,t,k,u,v;
    ll x,a,b,c,d,y,l,p;
    cin >> n;
    if(n%1000)
        cout << 1000-n%1000 << el;
    else
        cout << 0 << el;
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
 
using namespace std;
 
#define ll long long
 
int main(){
	#ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
    #endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout<<fixed;
    srand(time(0));

    int n;cin>>n;
    ll ans = 0;
    for(int i=1;i<=n;i++){
    	ll x = n / i;
    	ans += x * (x + 1) * i / 2;
    }
    cout<<ans;

    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>
#include <cassert>
#include<string>
#include<vector>
#include <utility>
#include <math.h>
#include<cmath>
#include<map>
#include <limits>
# include <iomanip>
#include <queue>
#define INF 1000000009;

using namespace std;
int gcd(int a, int b) {
	while (a % b != 0) {
		int c = 0;
		c = a % b;
		a = b;
		b = c;
	}
	return  b;
}
int kaizyo(int a) {
	long long ans = 1;
	for (int i = a; i > 0; i--) {
		ans *= i;
		ans = ans % 1000000007;
		//cout << ans << endl;
	}
	ans = ans % 1000000007;
	return ans;
}

int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int R, C;
int sx, sy, gx, gy;
char manji[60][60];
int rut[60][60] = { 0 };
void bfs() {


	pair<int, int> copyp;
	queue<pair<int, int>> asp;
	for (int i = 0; i < R; i++) {
		for (int j = 0; j < C; j++) {
			cin >> manji[i][j];
			if (manji[i][j] == '.') {
				rut[i][j] = INF;
			}
		}
	}
	rut[sy - 1][sx - 1] = 0;
	asp.push(make_pair(sy - 1, sx - 1));
	while (asp.size()) {
		copyp = asp.front();
		asp.pop();
		for (int i = 0; i < 4; i++) {
			if (copyp.first + dy[i] >= 0 && copyp.first + dy[i] < R && copyp.second + dx[i] >= 0 && copyp.second + dx[i] < C) {
				if (rut[copyp.first + dy[i]][copyp.second + dx[i]] == 1000000009) {
					rut[copyp.first + dy[i]][copyp.second + dx[i]] = rut[copyp.first][copyp.second] + 1;
					asp.push(make_pair(copyp.first + dy[i], copyp.second + dx[i]));
					//cout << "ok" << ' ' << copyp.first + dy[i] << ' ' << copyp.second + dx[i] << endl;
					//cout << "ok" << ' ' << rut[copyp.first + dy[i]][copyp.second + dx[i]] << endl;
				}
			}
		}
	}

	return;
}

int main() {
	int N = 0,a=0;
	vector<int> manji;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> a;
		manji.push_back(a);
	}
	sort(manji.begin(), manji.end());
	manji.erase(unique(manji.begin(), manji.end()), manji.end());
	if ((N-manji.size()) % 2 == 1) {
		cout << manji.size() -1 << endl;
	}
	else{ cout << manji.size() << endl; }
	return 0;
}



Measured memory_bytes: 892
import java.util.Scanner;

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

    public static void solve(Scanner sc) {
        int numOfPattern = 1023;
        int[] benefits = new int[numOfPattern];
        int n = sc.nextInt();
        sc.nextLine();
        
        int[][] fss = new int[n][10];
        for (int i = 0; i < n; i++) {
            String[] fs = sc.nextLine().split(" ");
            int[] fint = new int[10];
            for (int j = 0; j < 10; j++) {
                fint[j] = Integer.parseInt(fs[j]);
            }
            fss[i] = fint;
        }

        int[][] pss = new int[n][11];
        for (int i = 0; i < n; i++) {
            String[] ps = sc.nextLine().split(" ");
            int[] pint = new int[11];
            for (int j = 0; j < 11; j++) {
                pint[j] = Integer.parseInt(ps[j]);
            }
            pss[i] = pint;
        }

        for (int i = 0; i < n; i++) {
            for (int j = 1; j <= numOfPattern; j++) {
                int count = 0;
                for (int k = 0; k < 10; k++) {
                    if ((j & (1 << k)) != 0 && fss[i][k] == 1) {
                        count++;
                    }
                }
                benefits[j - 1] += pss[i][count];
            }
        }

        int max = Integer.MIN_VALUE;
        for (int i = 0; i < benefits.length; i++) {
            max = Math.max(max, benefits[i]);
        }
        System.out.println(max);
    }
}

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



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

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

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




















 
int main(){
    ll n;
    cin >> n;
    vector<pair<ll, ll>> v(n);
    REP(i, n){
        cin >> v[i].first >> v[i].second;
    }
    sort(v.begin(), v.end());
    ll ans = INF;
    REP(i, n){
        REP(j, n){
            if(i == j) continue;
            ll x2 = v[j].first, x1 = v[i].first, y2 = v[j].second, y1 = v[i].second;
            ll p = x2 - x1, q = y2 - y1;
            ll cnt = 1;
            map<pair<ll, ll>, ll> mp;
            mp[{x2, y2}] = true;
            REP(k, n){
                if(k == i || k == j) continue;
                ll x3 = v[k].first, y3 = v[k].second;
                if(mp[{x3 - p, y3 - q}]){
                    mp[{x3 - p, y3 - q}] = false;
                    mp[{x3, y3}] = true;
                }
                else{
                    mp[{x3, y3}] = true;
                    cnt++;
                }
            }
            ans = min(ans, cnt);
        }
    }
    cout << ((ans == INF)? n : ans) << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
 
typedef long long int ll;
 
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
 
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

#define  ff          first
#define  ss          second
#define  pb          push_back
#define  IOS         ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define  lb          lower_bound
#define  ub          upper_bound
#define  D2(x)       { cerr << "[" << #x << ": "; for(auto it:x) cerr << it << " "; cerr << "]\n"; }
#define  all(x)      (x).begin(), (x).end()
#define  mem(a)      memset(a , 0 ,sizeof a)
#define  deb(x)      cout << #x << " - " << x << "\n";
#define  ps(x,y)     fixed<<setprecision(y)<<x
#define  setbit(x)   __builtin_popcount(x)
#define  deb2(x,y)   cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n"
#define  rep(i,a,b)  for(int i=a ; i<b ; ++i)
 
#define PI 3.141592653589793
const ll p = 5;
const ll INF = 1000000000;
const ll MAX_N = 1e5 + 2;

vi adj[100],vis(100),in(100),pos_low(100);
map<int,int>bridges;
int timer,cnt;

void dfs(int node,int par){
    vis[node] = 1;
    in[node] = pos_low[node] = timer++; 
    
    for(auto child:adj[node]){
        if(child == par) continue;
        
        if(vis[child]){
            // Back edge
            pos_low[node] = min(pos_low[node] , in[child]);
        } else{
            // Forward edge
            dfs(child , node);
            
            if(in[node] < pos_low[child]) cnt++;
            
            pos_low[node] = min(pos_low[node] , pos_low[child]);
        }
    }
}

void solve(){
    int n,m; cin >> n >> m;
    int a,b;
    rep(i,0,m){
        cin >> a >> b;
        adj[a].pb(b), adj[b].pb(a);
    }
    dfs(1 , -1);
    cout << cnt;
}
 
int main() {
    IOS;
    // int t; cin >> t;
    int t=1; 
    while(t--) solve();
    return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n;      cin >> n;
    long long *h = new long long[n];
    int i;
    for (i = 0; i < n; i++)
        cin >> h[i];
    bool can = true;

    for (i = n-1; i > 0; i--) {
        if (h[i] + 1 == h[i-1])
            h[i-1]--;
        else if (h[i] + 1 < h[i-1]) {
            can = false;
            break;
        }
    }

    if (can)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 1024
s = gets.chomp.to_i
#初期化
a = s
a_array = []
iterater = 1
a_array.push(a)

while true
  iterater += 1
  if a % 2 > 0
    a = 3 * a + 1
  else
    a = a / 2
  end
  if a_array.include?(a)
    break
  else
    a_array.push(a)
  end
end

print("#{iterater}\n")

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
  cin>>N;
  
  vector<int>a(N);
  
  for(int i=0;i<N;i++){
    cin>>a.at(i);
  }

  sort(a.begin(),a.end());
  
  cout<<a.at(N-1)-a.at(0)<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
const ll MOD = 1000000007;

int main() {
  ll k, n, a;
  cin >> k >> n;
  vector<ll> v;
  REP(i, n) {
    cin >> a;
    v.push_back(a);
  }
  sort(v.begin(), v.end());

  ll d = v[v.size() - 1] - v[0], md = d;
  REP(i, n - 1) {
    if (i == 0) {
      d = d - (v[i + 1] - v[i]) + (k + v[i] - v[(i + n - 1) % n]);
    } else {
      d = d - (v[i + 1] - v[i]) + (v[i] - v[(i + n - 1) % n]);
    }
    md = min(d, md);
  }

  cout << md << endl;

  return 0;
}
// (5, 10), (5,)
// (5, 5), (10, 5)

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

int main(){
 int n;
  cin>>n;
  vector<int>a(n),b(n);
  for(int i=0;i<n;i++)cin>>a[i];
  for(int i=0;i<n;i++){
    b[a[i]-1]=i+1;
  }
  for(int i=0;i<n-1;i++){
    cout<<b[i]<<" ";
  }
  cout<<b[n-1]<<endl;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
#define gap ' '
#define L(i) ((i) - (&i))

const int inf = 1e7 + 7;
const int MAX = 21;
vector<vector<int> >d(410, vector<int>(410, inf));
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void Warshall_Floyd(int n){
    for(int k = 1; k <= n; ++k){
        for(int i = 1; i <= n; ++i){
            for(int j = 1; j <= n; ++j){
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
}

	
int main(){	
	int h, w; cin >> h >> w;
	vector<vector<char> >a(h+2, vector<char>(w+2, '#'));
	for(int i = 1; i <= h; ++i){
		for(int j = 1; j <= w; ++j){
			cin >> a[i][j];
		}
	}
	for(int i = 1; i <= h; ++i){
		for(int j = 1; j <= w; ++j){
			if(a[i][j] == '#')continue;
			d[(i-1)*w+j][(i-1)*w+j] = 0;
			for(int k = 0; k < 4; ++k){
				int nx = i + dx[k], ny = j + dy[k];
				if(a[nx][ny] == '.'){
					d[(i-1)*w+j][(nx-1)*w+ny]=1;
				}
			}
		}
	}
	Warshall_Floyd(h*w);
	int ans = 0;
	for(int i = 1; i <= h*w; ++i){
		for(int j = 1; j <= h*w; ++j){
			if(d[i][j] < inf){
				ans = max(ans, d[i][j]);
			}
		}
	}
	cout << ans << endl;


	return 0;
}


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

#define ll long long
#define inf 100000000000

vector<ll> dp;

ll frog(ll *a,ll n, ll start,ll k)
{
    
    if(start==n-1)
    {
        return 0;
    }
    else if(start>=n) 
    {
        return inf;
    }
    
    if(dp[start]!=-1)
        return dp[start];
    ll ans=inf,i;
    for(i=1;i<=k;i++)
    {
        if((start+i)<n)
        {
            ll b = abs(a[start]-a[i+start])+frog(a,n,start+i,k);
            ans=min(ans,b);
        }
        else
        break;
    }
    dp[start]=ans;
    return dp[start];
}


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    
    ll n,k;
    cin>>n>>k;
    ll a[n];
    dp.resize(n+10,-1);
    std::vector<ll> v(n+1,0) ;
    for(ll i=0;i<n;i++){
        cin>>a[i];
    }
    cout<<frog(a,n,0,k)<<endl;
    
	return 0;
}

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

using namespace std;
typedef long long ll;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vd = vector<double>;
using vvd = vector<vd>;

#define out(a) cout << a << endl
#define out1(a) cout << a
#define in(a) cin >> a
#define in2(a, b) cin >> a >> b
#define in3(a, b, c) cin >> a >> b >> c
#define rep(i, N) for (ll i = 0; i < (ll)N; i++)
#define rep1(i, N) for (ll i = 1; i <= (ll)N; i++)
#define repi(i, j, N) for (ll j = (ll)i + 1; j < (ll)N; j++)
#define all(v) v.begin(), v.end()

template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

constexpr int inf = 1e9;
constexpr ll linf = 1e18;
constexpr ll mod = 1e9 + 7;

void solve();

int main()
{
    solve();
}

void solve()
{
    int a;
    string s;
    in2(a, s);
    if (a >= 3200)
    {
        out(s);
    }
    else
    {
        out("red");
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i,s,n) for(int i = (s); i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(){
   int n;
   cin >> n;
   int a[n];
   rep(i, n) cin >> a[i];
   int num = 1, count = 0;
   rep(i,n){
       if(a[i]==num){
           num++;
       } else {
           count++;
       }
   }
    if(count==n)
        count = -1;
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define lli unsigned long long int
#define MOD 1000000007
#define KING 1000000002
#define queen 1000002
#define fi first
#define se second
#define se second
#define nl cout<<'\n'
#define TEST cout<<"TEST",nl
#define pr pair<lli,lli>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define vi vector<lli>
#define vpi vector<pr> 
#define P pair<lli,pr>
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL)
#define NA(i,s,n) for(lli i=s;i<n;i++)
using namespace std;

void solve(){
    lli h,res = 1,p=0; cin>>h; 
    while( (h/2) >= 1){
        h = h/2;
        p += res, res *= 2;
    }
    cout<<res+p;
    return;
}
int main(){
    fastIO;
    solve();
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast","inline","-ffast-math")
#pragma GCC target("avx,sse2,sse3,sse4,mmx")
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
//#define int long long
using namespace __gnu_pbds;
using namespace std;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

signed main()
{
	ios::sync_with_stdio(false);
	int d,t,s;
	cin>>d>>t>>s;
	if(t*s>=d) cout<<"Yes\n";
	else cout<<"No\n";	
	return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
typedef long double ld;
#define loopi(n) for(i=0;i<n;i++) 
#define loopj(n) for(j=0;j<n;j++)
#define loopnode(v) for(ll i : v)
#define mod7 1000000007
#define mod9 1000000009
#define mod8 100000000
#define modl 998244353
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef std::vector<ll> vecl;
typedef std::vector<bool> vecb;
typedef std::vector<long double> vecd;
typedef std::vector<string> vecstr;
typedef std::vector<char> vecch;
typedef std::vector< pair<ll,ll> >  vecpair;
typedef unordered_map<ll,ll> umap;
typedef unordered_map<long double,int> umapd;
typedef unordered_map<string,ll> umapstr;
typedef unordered_map<char,ll> umapc;
typedef set< ll,greater<ll>  > st;
typedef priority_queue<ll> q_max;
typedef priority_queue<ll,vector<ll>,greater<ll> > q_min;
ll j=0,i=0;//ll maxm = INT_MIN;

//vecl node[300001];vecl color(300001,-1);umap u;vecl res(300001,0);//ll flag = 1;
//vecb visited(300000+1,false);

int main(int argc, char const *argv[])
{	umap u;
	ll n;cin>>n;vecl v;loopi(n){ll p;cin>>p;v.pb(p);u[p]++;} sort(v.begin(),v.end());
	vecl lcm(n+1,1);vecl prod(1000001,0); ll count = 0;
	loopi(n)
	{
		for(j=2;j<=v[n-1]/v[i];j++)
		{
			prod[j*v[i]]++;
		}
	}

	loopi(n)
	{
		if(prod[v[i]]==0 && u[v[i]]==1)
			count++;
	}
	cout<<count<<"\n";




	return 0;
	
}


Measured memory_bytes: 22192
N = int(input())
A = list(map(int, input().split()))

while len(A) > 1:
  A.sort()
  #print(A)
  for i in range(1,len(A)):
    #print(A[i],A[0])
    A[i] = A[i] % A[0]
  A = list(filter(lambda x: x != 0,A))

print(A[0])

Measured memory_bytes: 14252
n, m = io.read('n'), io.read('n'), io.read('l')
s = {}
for i = 1, n do s[i] = io.read('l') end
ans = {}
for i = 1, n do ans[i] = {} end

local BAKU = 35
local AKI = 46
local MOV = {{-1, -1}, {-1, 0}, {-1, 1}, {0, -1}, {0, 1}, {1, -1}, {1, 0}, {1, 1}}

for i = 1, n do
    for j = 1, m do
        if s[i]:byte(j) == AKI then
            local count = 0
            for k = 1, #MOV do
                local ni, nj = i + MOV[k][1], j + MOV[k][2]
                if ni >= 1 and ni <= n and nj >= 1 and nj <= m and
                    s[ni]:byte(nj) == BAKU
                then
                    count = count + 1
                end
            end
            ans[i][j] = string.char(48 + count)
        else
            ans[i][j] = '#'
        end
    end
end

for i = 1, n do
    for j = 1, m do io.write(ans[i][j]) end
    io.write('\n')
end


Measured memory_bytes: 760
#ifdef _MSC_VER
#include <__msvc_all_public_headers.hpp>
#undef min
#undef max
#else
#define NDEBUG
#include <bits/stdc++.h>
#endif

using namespace std;
using large = long long;

int main() {
    large a;
    cin >> a;

    cout << a + a * a + a * a * a << endl;
    return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
#include <stdlib.h> 
#include <time.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rrep(i,n) REP(i,1,n+1)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> PII;
typedef vector<ll> Vl;
typedef vector<int> VI;
typedef tuple<int, int, int> TT;
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(), v.end()
#define dmp(x,y) make_pair(x,y)
#define dmt(x, y, z) make_tuple(x, y, z)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
const int MAX = 500000;
const ll inf = 10000000000000000;
const ll mod = 1000000007;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;

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


int a, b;

int main() {

	cin >> a >> b;

	if (a > b)cout << a - 1 << endl;
	else cout << a << endl;

	return 0;
} 

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define erep(i,a,n) for(int i = a;i<=n;i++)
typedef long long ll;
#define int long long
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 1101010101010101010
#define MOD 1000000007
#define P = pair<int,int>;
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; }

signed main(){
  int n;
  cin >> n;
  vvint to(n);
  rep(i,0,n-1){
    int a,b;
    cin >> a >> b;
    a--;b--;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  vint C(n);
  rep(i,0,n) cin >> C[i];
  sort(C.rbegin(),C.rend());
  int sum = 0;
  rep(i,0,n) sum += C[i];
  queue<int> que;
  vint ans(n);
  vbool seen(n);
  que.push(0);
  int cur = 0;
  while(!que.empty()){
    int v = que.front();
    que.pop();
    seen[v] = true;
    ans[v] = C[cur];
    cur++;
    for(auto p:to[v]){
      if(seen[p]) continue;
      que.push(p);
    }
  }
  cout << sum - C[0] << endl;
  rep(i,0,n) cout << ans[i] << " ";
}

Measured memory_bytes: 1152
n = int(input())

l = list(map(int,input().split()))

s_1 = 0
s_2 = sum(l)


ans = 100

for i in range(n):
    s_1 += l[i]
    s_2 = sum(l) - s_1
    temp = abs(s_1-s_2)
    
    if temp < ans:
        ans = temp

print(ans)





Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

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

int main(){
   int n, k;
   cin >> n >> k;
   cout << n - k + 1 << endl;
   return 0;
}

Measured memory_bytes: 256
H, W, A, B = map(int, input().split())

if A == 0 and B == 0:
    for i in range(H):
        ans = ["1"] * W
        print("".join(ans))
elif A == 0:
    for i in range(B):
        ans=[]
        temp = ["1"] * W
        ans.extend(temp)
        print("".join(ans))
    for i in range(H - B):
        ans=[]
        temp = ["0"] * W
        ans.extend(temp)
        print("".join(ans))
elif B == 0:
    for i in range(H):
        ans1=[]
        ans1 = ["1"] * A
        ans2 = ["0"] * (W - A)
        ans1.extend(ans2)
        print("".join(ans1))
else:
    for i in range(B):
        ans1 = ["1"]*A
        ans2=["0"]*(W-A)
        ans1.extend(ans2)
        print("".join(ans1))
    for i in range(H-B):
        ans1=["0"]*A
        ans2=["1"]*(W-A)
        ans1.extend(ans2)
        print("".join(ans1))



Measured memory_bytes: 4084
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

#ifdef _DEBUG
#include "../../library/library/debug_template.cpp"
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

struct init {
	init() {
		cin.tie(nullptr); ios::sync_with_stdio(false);
		cout << fixed << setprecision(10);
	}
} init_;

int main() {

	lint h, w;
	cin >> h >> w;

	if (h == 1 || w == 1) {
		cout << 1 << "\n";
		return 0;
	}

	cout << ((w + 1) / 2) * ((h + 1) / 2) + (w / 2) * (h / 2) << "\n";

	return 0;
}



Measured memory_bytes: 3572
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <fstream>
#include <queue>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <sstream>
#include <math.h>
#include <functional>

#define For(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  For(i,0,n)

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
#define SORT(c) sort((c).begin(),(c).end())
#define vi(m,a) vector<int> m(a)
#define vti(m,a,i) vector<vector<int>> m(a,vector<int>(i))
#define ALL(it,a) for(auto it = a.begin(); it!=a.end(); it++)
#define Fe(it,a) for(auto &it : a)
#define all(a) begin(a),end(a)

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
#define WARU 1000000007;

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

int main() {
	int n,q;
	cin >> n >> q;
	vector<vector<int>> vmp(n);
	map<int, vector<int>> mp;
	rep(i,n-1){
		int a, b;
		cin >> a >> b;
		vmp[a-1].push_back(b-1);
	}

	vector<int> w(n);
	rep(i, q) {
		int p,x ;
		cin >> p >> x;
		w[p - 1] += x;
	}
	vector<int> result(n);
	queue<pii> que;
	que.push(make_pair(0, 0));
	while (que.size() != 0) {
		int node = que.front().first;
		int additiona_weight = que.front().second;
		que.pop();
		additiona_weight += w[node];
		result[node] += additiona_weight;
		for (int next : vmp[node]) {
			que.push(make_pair(next, additiona_weight));
		}
	}
	rep(i, n) {
		cout << result[i] << " ";
	}
	cout << endl;

}



Measured memory_bytes: 14848
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.StringTokenizer;

public class Main {
    static PrintWriter out;
    static CF_Reader in;

    public static void main(String[] args) throws IOException {
        out = new PrintWriter(new OutputStreamWriter(System.out));
        in = new CF_Reader();

        long n = in.longNext();
        out.println(solve(n));

        out.close();
    }

    static String solve(long n) throws IOException {
        HashSet<Long> seen = new HashSet<>();
        for (int i = 0; i < n; i++) {
            long num = in.longNext();
            if (seen.contains(num)) return "NO";
            seen.add(num);
        }
        return "YES";
    }

    static class CF_Reader {
        BufferedReader br;
        StringTokenizer st;

        public CF_Reader() throws IOException {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine().trim());
            return st.nextToken();
        }

        long longNext() throws IOException {
            return Long.parseLong(next());
        }

        int intNext() throws IOException {
            return Integer.parseInt(next());
        }

        double doubleNext() throws IOException {
            return Double.parseDouble(next());
        }

        char charNext() throws IOException {
            return next().charAt(0);
        }

        public int[] nextIntArray(final int n) throws IOException {
            final int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = intNext();
            return a;
        }

        public long[] nextLongArray(final int n) throws IOException {
            final long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = longNext();
            return a;
        }

        String line() throws IOException {
            return br.readLine().trim();
        }
    }
}


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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int a, b, k;
  while (cin >> a >> b >> k) {
    vector<int> v;
    for (int i = 1; i <= 100; ++i) {
      if (a % i == 0 && b % i == 0) v.push_back(i);
    }
    reverse(v.begin(), v.end());
    cout << v[k - 1] << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
from sys import stdin

def main():
    input = lambda: stdin.readline()[:-1]
    S = input()

    for i, s in enumerate(S, start=1):
        if i % 2:
            if s not in 'RUD':
                print('No')
                break
        else:
            if s not in 'LUD':
                print('No')
                break
    else:
        print('Yes')

main()


Measured memory_bytes: 2940
import java.util.*;

public class Main {
    public static void main(String[] args ) throws Exception {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int Y = sc.nextInt();
        int leg = 0;
        int count = X;
        boolean flag = false;

        if(Y == X*2 || Y == X*4){
            System.out.println("Yes");
        } else {
            for(int i = 1;i <= X;i++) {
                leg = (count - i) * 2;
                leg += (count - (count - i))*4;
                if (leg == Y) {
                    flag = true;
                    break;
                }
            }
            if(flag){
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
        }
    }

Measured memory_bytes: 27092
#include <iostream>
#include <cmath>
#include <string>
#include <map>
#include <queue>

using namespace std;

#define N 3
#define N2 9

struct Puzzle{
	int f[N2];
	int space;
	string path;
	
	bool operator < (const Puzzle &p) const{
		for(int i=0;i<N2;i++){
			if(f[i]==p.f[i]) continue;
			return f[i]>p.f[i];
		}
		return false;
	}
};

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

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

static const char dir[4]={'u','a','d','r'};

bool isTarget(Puzzle p){
	for(int i=0;i<N2;i++){
		if(p.f[i]!=(i+1)) return false;
	}
	return true;
}


string bfs(Puzzle s){
	queue<Puzzle> Q;
	map<Puzzle,bool> V;
	Puzzle u,v;
	s.path="";
	Q.push(s);
	V[s]=true;
	
	while(!Q.empty()){
		u=Q.front();Q.pop();
		if(isTarget(u)) return u.path;
		int sx=u.space/N;
		int sy=u.space%N;
		for(int r=0;r<4;r++){
			int tx=sx+dx[r];
			int ty=sy+dy[r];
			if(tx<0||ty<0||tx>=N||ty>=N) continue;
			v=u;
			swap(v.f[u.space],v.f[tx*N+ty]);
			v.space=tx*N+ty;
			if(!V[v]){
				V[v]=true;
				v.path+=dir[r];
				Q.push(v);
			}
		}
	}
	
	return "unsolvable";
}


int main(){
	Puzzle in;
	
	for(int i=0;i<N2;i++){
		cin>>in.f[i];
		if(in.f[i]==0){
			in.f[i]=N2;
			in.space=i;
		}
	}
	
	string ans = bfs(in);
	
	cout<<ans.size()<<endl;
}

Measured memory_bytes: 30596
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF LLONG_MAX/5
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
int mypow(int a,int b,int c){
	if(b==0)return 1;
	if(b%2)return mypow(a,b-1,c)*a%c;
	int z=mypow(a,b/2,c);
	return z*z%c;
}
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
signed main(){
	int a,ans=0;
	cin>>a;
	if(a%2==0){
		a/=2;
		while(a>=5){
			ans+=a/5;
			a/=5;
		}
	}
	cout<<ans<<endl;
}


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

int main() {
    int N, W;
    std::cin >> N >> W;

    std::vector<int> dp(W + 1, 0);
    for (int i = 0; i < N; ++i) {
        int v, w;
        std::cin >> v >> w;
        for (int j = W; j - w >= 0; --j) {
            dp[j] = std::max(dp[j], dp[j - w] + v);
        }
    }

    std::cout << *std::max_element(dp.begin(), dp.end()) << std::endl;
    return 0;
}



Measured memory_bytes: 3124
#include <iostream>
#include <string>

using namespace std;

int main()
{
    int N, K;
    string S;
    cin >> N >> K;
    cin >> S;

    const char ch = S[K - 1];
    if (ch == 'A')
    {
        S[K - 1] = 'a';
    }
    else if (ch == 'B')
    {
        S[K - 1] = 'b';
    }
    else
    {
        S[K - 1] = 'c';
    }
    cout << S;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <numeric>
#include <limits>
using namespace std;

string w; int a[26]; string ans;
int main(){
    cin >> w;
	for (int i = 0; i < w.size(); i++) {
		a[w[i] - 'a']++;
	}

    for(size_t i = 0; i < 26; i++)
    {
        if(a[i] % 2 == 0) ans = "Yes";
        else {
            ans = "No";
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#define _GIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;


int main(void) {
  ll N, M;
  cin >> N >> M;
  vector<int> broken(N + 1);   // 壊れている段
  rep(i, M) {
    int a;
    cin >> a;
    broken[a] = 1;
  }

  vector<ll> dp(N + 2);
  const int mod = 1000000007;
  dp[N] = 1;
  for (int i = N - 1; i >= 0; --i) {
    if (broken[i]) {
      dp[i] = 0;
      continue;
    }
    dp[i] = (dp[i + 1] + dp[i + 2]) % mod;
  }

  cout << dp[0] << endl;

  return 0;
}

Measured memory_bytes: 1408
N,C,K = map(int,input().split())
T = [int(input()) for i in range(N)]
T = sorted(T)
counter = 0
ans = 1
A = []
while counter != N :
    if len(T) > 0 and len(A) < C and ((len(A) == 0) or (T[0] <= A[0] + K)) :
        A.append(T[0])
        T.pop(0)
        counter += 1
    else :
        A = []
        ans += 1
print(ans)


Measured memory_bytes: 8276
#include <stdio.h>
int main(){

  char ans[] = "CODEFESTIVAL2016";
  char read[17];
  int i,a = 0;
  
  scanf("%s", read);
  for(i = 0; i < 16; i++){
    if(ans[i] != read[i])
      a++;
  }
  printf("%d\n", a);
  return 0;
}


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

int main()
{
    int A, B, K; cin>>A>>B>>K;
    set<int> res;
    for(int i=0; i<K; ++i) if (A+i<=B) res.insert(A+i);
    for(int i=0; i<K; ++i) if (B-i>=A) res.insert(B-i);
    for(auto& e: res) cout<<e<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

int main(void){
    ll n, t;
    cin >> n >> t;

    ll a[n];
    ll b[n];
    rep(i, 0, n){
        cin >> a[i];
    }

    b[0] = a[0];
    rep(i, 1, n){
        b[i] = min(b[i - 1], a[i]);
    }

    ll ma = 0;
    rep(i, 0, n){
        ma = max(ma, a[i] - b[i]);
    }

    ll count = 0;
    rep(i, 0, n){
        if(a[i] - b[i] == ma){
            count++;
        }
    }

    cout << count << endl;
    return 0;
}


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

int main()
{
    int x,y;
    cin>>x>>y;
    
    int s=0;

    for(int i=0;i<=100;++i)
    {
        for(int j=0;j<=100;++j)
        {
            if(2*i==y-2*x&&2*j==4*x-y){
                s++;
            }
        }
    }
    if(s==0)
    {
        cout<<"No"<<endl;
    }
    else{
        cout<<"Yes"<<endl;
    }
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std; 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define pp(...) "\033[94m [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define dg1(x) debug() << pp(x)
#define dg2(x,y) debug() << pp(x) pp(y)
#define dg3(x,y,z) debug() << pp(x) pp(y) pp(z)
#define dg4(w,x,y,z) debug() << pp(w) pp(x) pp(y) pp(z)
#define msg(x) debug() << x
#define int long long
const int xx = 1e8;
const int mod = 1e9 + 7;
signed main(){
  ios::sync_with_stdio(false);cin.tie(0);

  int n;
  cin >> n;
  vector<int>a(n);
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  int ans = 0;
  for(int k=0;k<60;k++){
     int cnt0 = 0 , cnt1 = 0;
     for(int i=0;i<n;i++){
       int x = (a[i] >> k) & 1;
       if(x) cnt1++;
       else cnt0++;
     }
     int pow = 1;
     for(int i=0;i<k;i++){
       pow = pow * 2;
       pow = pow % mod;
     }
     int pair = (cnt1 * cnt0) % mod;
     ans += (pair * pow % mod) % mod;
     ans = ans % mod;
  }
  cout << ans << '\n';
}

Measured memory_bytes: 2560
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#define fi first
#define se second
#define L(i,u) for (int i=head[u]; i!=0; i=nxt[i])
#define rep(i,a,b) for (register int i=a; i<=b; i++)
#define per(i,a,b) for (register int i=a; i>=b; i--)
typedef long long ll;
using namespace std;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
inline void read(int &x) {
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
const int N = 534444;
int n,a[N];
ll qz[N],res=1e18;
int x=1,y=3;
inline ll gs(int l, int r){return qz[r]-qz[l-1];}
void update(ll &mn, ll &mx, ll a, ll b){
	if(a>b)swap(a,b);
	if(a>mn)mn=a,mx=b;
}
inline ll solve(int k){//[1,k] [k+1,n]
	while(qz[x+1]*2LL<=qz[k])x++;
	while((qz[y+1]-qz[k])*2LL<=qz[n]-qz[k])y++;
	ll min1=-1e18,max1=1e18;
	update(min1,max1,qz[x],qz[k]-qz[x]);
	update(min1,max1,qz[x+1],qz[k]-qz[x+1]);
	ll min2=-1e18,max2=1e18;
	update(min2,max2,qz[y]-qz[k],qz[n]-qz[y]);
	update(min2,max2,qz[y+1]-qz[k],qz[n]-qz[y+1]);
//	printf("%d : %d %d\n",k,x,y);
	return max(max1,max2)-min(min1,min2);
}
int main() {
	read(n);rep(i,1,n)read(a[i]),qz[i]=qz[i-1]+a[i];
	rep(i,2,n-2)res=min(res,solve(i));
	cout<<res;
	return 0;
}


Measured memory_bytes: 3840
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <functional>
#include <math.h>
using namespace std;

#define ll long long
//#define int long long
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;

#define dump(x)  cerr << #x << " = " << (x) << endl; 
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; 


typedef pair<int, int> P;
struct Point{
	int x, y;
};
int dx[4] = { 0, 1, 0, -1 };
int dy[4] = {1,0,-1,0};



int main(){

	int N;
	cin >> N;
	if (N == 1){
		cout << "Hello World" << endl;
		return 0;
	}
	int A, B;
	cin >> A >> B;

	cout << A + B << endl;

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define N 100
int main()
{
  int i,j,v,num;
  int A[N];
  scanf("%d",&num);
  for(i=0;i<num;i++)
    {  
      scanf("%d",&A[i]);
    }
  for(i=0;i<num-1;i++)
	{
	  printf("%d ",A[i]);
	}
      printf("%d\n",A[i]);


  for(i=1;i<num;i++)
    {
      v=A[i];
      j=i-1;
      while(j>=0 && A[j]>v)
	{
	  A[j+1]=A[j];
	  j--;
	  A[j+1]=v;
	}
      for(j=0;j<num-1;j++)
	{
	  printf("%d ",A[j]);
	}
      printf("%d\n",A[j]);
    }
  return 0;
}

Measured memory_bytes: 600
"""
AtCoder 社は、毎週土曜日にコンテストを開催しています。
コンテストには ABC と ARC の 2 つの種類があり、毎週どちらか一方が開催されます。
ABC が開催された次の週には ARC が開催され、ARC が行われた次の週には ABC が開催されます。

先週開催されたコンテストを表す文字列 S が与えられるので、今週開催されるコンテストを表す文字列を出力してください。
"""
s = input()
ans = 'ABC'
if s == 'ABC':
    ans = 'ARC'

print(ans)


Measured memory_bytes: 9088
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,l;
  cin>>n>>l;
  vector<string> s(n);
  for(int i=0;i<n;i++)cin>>s[i];
  sort(s.begin(),s.end());
  for(int i=0;i<n;i++)cout<<s[i];
  cout<<endl;
  return 0;
}

Measured memory_bytes: 256