akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2010;
const ll mod=1e9+7;
ll f[N];
int main()
{
    int T=1;
    //cin>>T;
    while(T--)
    {
        int s;
        cin>>s;
        f[0]=1;
        for(int i=3;i<=s;i++)
            for(int j=3;j<=i;j++)
                f[i]=(f[i]+f[i-j])%mod;
        cout<<f[s]<<'\n';
    }
    return 0;
}

Measured memory_bytes: 3572
#include<cstdio>
#include<vector>
#include<set>
#define RI register int
#define CI const int&
using namespace std;
int n,x,ans; multiset <int> s; vector <int> tp;
int main()
{
	RI i; for (scanf("%d",&n),i=1;i<=n;++i) scanf("%d",&x),s.insert(x);
	for (i=(1<<30);i>1;i>>=1)
	{
		tp.clear(); while (s.size()>=2)
		{
			multiset <int>:: iterator it=s.end(); x=*(--it);
			if (x>=i) { s.erase(it); continue; } s.erase(it);
			if (s.count(i-x)) ++ans,s.erase(s.find(i-x)); else tp.push_back(x);
		}
		for (vector <int>:: iterator it=tp.begin();it!=tp.end();++it) s.insert(*it);
	}
	return printf("%d",ans),0;
}

Measured memory_bytes: 13252
#include <cstdio>

#define max(a, b) ((a) > (b) ? (a) : (b))

int main()
{
  int a, b, c;
  scanf("%d %d %d", &a, &b, &c);
  puts(2 * max(a, max(b, c)) == a + b + c ? "Yes" : "No");
  return 0;
}

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

namespace AC
{
    class Program
    {
        static void Main(string[] args)
        {
            var HW = ReadArrayLong();
            var H = HW[0];
            var W = HW[1];
            var ans = 0L;
            if (H == 1 || W == 1)
            {
                ans = 1;
            }
            else
            {
                if (W % 2 == 0)
                {
                    ans = H * W / 2;
                }
                else
                {
                    if (H % 2 == 0)
                    {
                        ans = H * W / 2;
                    }
                    else
                    {
                        ans = (H - 1) * W / 2 + W / 2 + 1;
                    }
                }
            }

            Console.WriteLine(ans);
            Console.ReadKey();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static string[] ReadArrayString() { return Read().Split(' '); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

Measured memory_bytes: 13268
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<math.h>
using namespace std;
int main(){
  string  s;
  int c[30]={};
  std::cin >> s;

  for (int i = 0; i < 4; i++) {
    c[s[i]-'A']++;
  }

  bool flag=true;
  for (int i = 0; i < 30; i++) {
    if(c[i]==2 || c[i]==0);
    else flag=false;
  }

  if(flag)std::cout << "Yes" << '\n';
  else std::cout << "No" << '\n';



  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<list>
#include<numeric>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
const ll MOD = 1e9 + 7;
using namespace std;
template<typename T>
T gcd(T a, T b) {
	if (b == 0) return a;
	return gcd(b, a % b);
	//return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	ll g = gcd(a, b);
	return a / g * b; // Be careful not to overflow
	//return a * b / gcd(a, b);
}

template<typename T>
T binarysearch(vector<T> A, T key) {
	ll left = 0;ll right = 4;ll mid;
	while (left < right) {
		mid = (left + right) / 2;
		if (key == A[mid]) return 1;
		if (key > A[mid]) left = mid + 1;
		else if (key < A[mid]) right = mid;
	}
	return 0;
}

template<typename T>
T finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}
ll frac(ll n)//階乗
{
	if (n == 0) {
		return 1;
	}
	return (n * frac(n - 1)) % MOD;
}

template<typename T>
T keta(T a) {
	ll kazu = 1;
	while (1) {
		if (a / 10 != 0) { a /= 10;kazu++; }
		else break;
	}
	return kazu;
}//桁数


template<typename T>
T nCr(ll n, T r) {
	ll ans = 1;
	for (int i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (int i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*/
//vector<vector<int>> data(3, vector<int>(4));

int main() {
	ll mod = 1e9 + 7;
	ll ans;
	string S, T;cin >> S >> T;
	for (ll i = 0;i < S.size();i++) {
		if (S[i] != T[i]) {
			cout << "No" << endl;
			break;
		}
		if (i == S.size() - 1)cout << "Yes" << endl;
	}
}

Measured memory_bytes: 3636
#pragma GCC optimize("Ofast,inline,unroll-loops,fast-math")
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
#include <sstream>
#include <bitset>
#include <memory>
#include <string>
#include <vector>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <deque>
#include <algorithm>
#include <random>
#include <iomanip>
using namespace std;

int main(int argc, char *argv[]) {

	int flag = 1;
	int n;
	cin >> n;
	unordered_set<int> us;
	for (int i = 0; i < n; i++)  {
		int t;
		cin >> t;

		if (us.find(t) != us.end())
			flag = 0;
		us.insert(t);
	}
	if (flag)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}









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

typedef long long ll;
using namespace std;

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

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

ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;}
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);}
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;}
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;}


bool isOk(ll key,ll value){
  return key >= value;
}

ll binary_search(vector<ll> a,ll key){
  ll ok = a.size()-1;
  ll ng = 0;

  while(abs(ok - ng) > 1){
    ll mid = (ok + ng) / 2;
    if(isOk(key,a[mid]))ok = mid;
    else ng = mid;
  }
  return ok;
}

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

  if(n % 2 == 1 || n == 0){
    print(0);
    return 0;
  }
  
  ll ans = 0;
  ll tmp = 1;
  while(n/(2*tmp)){
    tmp *= 5;
    ans += n/(2*tmp);
  }
  print(ans);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
int main(){
	string s;cin>>s;
	string t="ATCG";
	int ans=0;
	int now=0;
	rep(i,s.size()){
		bool isATCG=false;
		rep(j,t.size()){
			if(s[i]==t[j])isATCG=true;
		}
		if(!isATCG){
			now=0;
		}else{
			now++;
			ans=max(now,ans);
		}
	}
	cout<<ans<<endl;
}

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

template <typename T>
using Matrix = vector<vector<T>>;

template <typename T>
Matrix<T> matrix(const int R, const int C, const T x = T()) { return Matrix<T>(R, vector<T>(C, x)); }

struct Mod
{
    static const auto P = int(924844033);
    using ll = long long;
    ll k;

    Mod() = default;
    Mod(ll k) : k((k %= P) < 0 ? k+P : k) {}
};

Mod operator+(const Mod a, const Mod b) { return a.k + b.k; }
Mod operator*(const Mod a, const Mod b) { return a.k * b.k; }
Mod& operator+=(Mod& a, const Mod b) { return a = a+b; }

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

    auto ways = matrix<Mod>(N+1, 2);
    ways[0][false] = 1;

    for (auto offset = 0; offset < 2*K; offset++)
    {
        for (auto i = offset < K ? offset+K : offset; i < N; i += 2*K)
        {
            const auto previous = ways;
            ways[0] = previous[0];
            for (auto r = 1; r <= N; r++)
            {
                ways[r][false] = previous[r-1][false] + previous[r][true] + previous[r][false];
                if (i+K < N) ways[r][true] = previous[r-1][false] + previous[r-1][true];
                else ways[r][true] = 0;
            }
        }

        for (auto r = 0; r <= N; r++)
        {
            ways[r][false] += ways[r][true];
            ways[r][true] = 0;
        }
    }

    auto factorials = vector<Mod>(N+1);
    factorials[0] = 1;
    for (auto i = 1; i <= N; i++)
        factorials[i] = factorials[i-1] * i;

    auto result = Mod(0);
    for (auto r = 0, sign = 1; r <= N; r++, sign *= -1)
        result += sign * ways[r][false] * factorials[N-r];
    cout << result.k << endl;
}


Measured memory_bytes: 512
import sys
import numpy as np
input=sys.stdin.readline

n=int(input())
#d=list(map(int,input().split()))
n=str(n)
if n[-1]=="2" or n[-1]=="4" or  n[-1]=="5" or n[-1]=="7" or n[-1]=="9":
    print("hon")  
elif n[-1]=="3":
    print("bon")  
else:
    print("pon")

Measured memory_bytes: 27120
/*_47*/
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define pll pair<ll,ll>
#define pk pair<pll,ll>
#define endl "\n"
#define si(x) (ll)((x).size())
#define pb push_back
#define F first
#define S second
#define rep(i,n) for(ll i=0;i<n;i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define per1(i,n) for(ll i=n;i>=1;i--)
#define all(x) (x).begin(), (x).end()
#define pr_vec(v) for(auto __:v) cout<<__<<" ";
#define make_unique(x) (x).resize(unique(all(x))-(x).begin())
const int N = 1e6 + 5;
ll dp[N];
void solve()
{
    ll n, k, c;
    cin >> n >> k >> c;
    string s;
    cin >> s;
    std::vector<ll> a;
    rep(i, n)
    if(s[i] == 'o')
        a.pb(i);

    std::vector<ll> p(n + 20), ss(n + 20);

    rep(i, n)
    {
        if(s[i] == 'o')
        {
            p[i] = 1;
            if(i - c - 1 >= 0)
                p[i] += p[i - c - 1];

        }
        else if(i)
            p[i] = p[i - 1];
    }
    per(i, n)
    {
        if(s[i] == 'o')
        {
            ss[i] = 1;
            if(i + c + 1 < n)
                ss[i] += ss[i + c + 1];
        }
        else if(i != n - 1)
            ss[i] = ss[i + 1];
    }
    rep(i, n)
    {
        if(s[i] == 'o')
        {
            ll count = 0;

            ll l = lower_bound(all(a), i) - a.begin();

            if(a[l] == i)
                l--;
            if(l >= 0 and a[l] < i)
            {
                count = p[a[l]];
                l += 2;
                if(l < si(a))
                    count += ss[a[l]];
            }
            else
            {
                count = ss[i + 1];
            }
            // cout << count << " " << i + 1 << endl;

            if(count < k)
            {
                cout << i + 1 << endl;

            }
        }
    }



}

int main()
{




    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    // cin >> t;
    rep1(i, t)
    {
        // cout << "Case #" << i << ": ";
        solve();
        // cout << endl;
    }


}


Measured memory_bytes: 6536
#include <cstdio>
#include<iostream>
#include<map>
#include<algorithm>
#include<vector>
#include <cmath>
#include <iomanip>
#include <regex>
#include <bits/stdc++.h>
#include <string>
using namespace std;
using ll = long long;

int main(){
    string s;
    cin>>s;
    long N = s.size();
    long K;
    cin>>K;
    vector<string> S;
    map<string,int> mp;
    
    for(long j=1;j<=K;j++){
        for(long i=0;i<=N-j;i++){
            string c = s.substr(i,j);
            if(mp[c]==0){
                S.push_back(c);
                mp[c] = 1;
            }
        }
    }
    
    
    sort(S.begin(),S.end());

    cout<<S[K-1]<<endl;
}


Measured memory_bytes: 2048
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,l=map(int,input().split())
    A=[l+i for i in range(n)]
    S=sum(A)
    a=INF
    for i in range(n):
        if(abs(a)>abs(A[i])):
            a=A[i]
    print(S-a)
resolve()

Measured memory_bytes: 38256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <bitset>
#include <cstdio>
#include <iomanip>
#include <climits>
#include <string>
#include <sstream>
#include <numeric>
#include <stack>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define EPS 1e-9
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	cin >> N;
	vector< int > A(N);
	rep(i, N) cin >> A[i];
	multiset< int > s;
	rep(i, N) {
		if (s.empty() || A[i] <= (*(s.begin())))
			s.insert(A[i]);
		else {
			auto it = s.lower_bound(A[i]);
			it--;
			s.erase(it);
			s.insert(A[i]);
		}
	}
	cout << s.size() << endl;
	return 0;
}

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

int main() {
  int N,K,num;
  num=1;
  cin >> N >> K;

  for(int i=0 ; i<N ; i++) {
    if (num < K)
      num*=2;
    else
      num+=K;
  }
    cout << num << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define si(n) scanf("%d",&n);
#define PI acos(-1.0)
#define sl(n) scanf("%lld",&n);
#define sf(n) scanf("%lf",&n);
#define ss(n) scanf("%s",n);
#define for0(i,n) for(ll i=0;i<n;i++)
#define for1(i,n) for(ll i=1;i<=n;i++)
#define forc(i,j,n) for(ll i=j;i<n;i++)
#define pb push_back
#define sor(n) sort(n.begin(),n.end())
#define sorcmp(n) sort(n.begin(),n.end(),cmp)
#define rev(n) reverse(n.begin(),n.end())
#define pi(x)  printf("%d",x);
#define pl(x)  printf("%lld",x);
#define pf(x)  printf("%.10lf",x);
#define ps(x)  printf("%s",x);
#define en() printf("\n");
#define random_shuffle(r...)random_shuffle(r,[](int _){return rand()%_;})
#define SQR(a) (a)*(a)
#define sp(x) fixed<<setprecision(x)
#define mod 1000000007
#define endl '\n'
#define pii pair<int,int>
#define pll pair<ll,ll>
#define bug cout<<"Here"<<endl
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}
template <typename T> T POW(T B,T P){ if(P==0) return 1; if(P&1) return B*POW(B,P-1);  else return SQR(POW(B,P/2));}
ll powmod(ll a, ll b){ll ans = 1;while(b){if(b&1) ans = ans*a%mod;a = a*a%mod;b >>= 1;}return ans;}

#define mxn 200005
vector<int>g[mxn];
int vis[mxn];

int bfs(int x)
{
    vis[x]++;
    queue<int>q;
    q.push(x);
    int cnt=1;
    while(!q.empty())
    {
        int v=q.front();
        q.pop();

        for(auto u:g[v])
        {
            if(vis[u]) continue;
            vis[u]++;
            cnt++;
            q.push(u);
        }
    }

    return cnt;
}


int main()
{


    int n,m;
    cin>>n>>m;

    while(m--)
    {
        int a,b;
        cin>>a>>b;
        g[a].pb(b);
        g[b].pb(a);
    }
    int mx=-1;
    for(int i=1;i<=n;i++)
    {
        if(vis[i]) continue;
        mx=max(mx,bfs(i));
    }

    cout<<mx<<endl;





	return 0;
}



Measured memory_bytes: 15804
#include<stdio.h>
int min(int x,int y){
  if(x>y)
    return y;
  else
    return x;
}
int main(void){
  int A,B,K,div,c,i;
  scanf("%d %d %d",&A,&B,&K);
  div=min(A,B);
  c=0;
  for(i=div;i>=1;i--){
  if(A%i==0&&B%i==0)
    c++;
    if(c==K)
      break;
  }
  printf("%d",i);
  return 0;
}
  

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)

#define ACT 0
#define CHARGE 1
#define WAIT   2

class Robot{
public:
  int state;
  int p;
  vector<int> pdata;
  int curtime;
};


int solve(int n,Robot *in,int dur){
  int ret=0;
  int vattery=-1;
  queue<int> Q;
  REP(t,1,dur){
    rep(i,n){
      in[i].curtime++;
      if (in[i].curtime == 
	  in[i].pdata[in[i].p]){
	in[i].curtime=0;
	if (in[i].state == ACT){
	  in[i].state=WAIT;
	  Q.push(i);
	}else if (in[i].state==CHARGE){
	  in[i].state=ACT;
	  in[i].p=(in[i].p+1)%in[i].pdata.size();
	  in[i].curtime=0;
	  vattery=-1;
	}else if (in[i].state==WAIT){
	  in[i].curtime=0;
	}
      }
    }
    
    
    if (vattery == -1 && !Q.empty()){
      int change=Q.front();Q.pop();
      in[change].state=CHARGE;
      in[change].p++;
      in[change].curtime=0;
      vattery = change;
    }

    ret+=Q.size();
  }
  
  return ret;
}


main(){
  int n,dur;
  while(cin>>n>>dur && n){
    Robot in[n];
    rep(i,n){
      in[i].p=0;
      in[i].curtime=0;
      in[i].state=ACT;
      while(true){
	int ch,cm;
	cin>>ch;
	if (ch == 0)break;
	cin>>cm;
	in[i].pdata.push_back(ch);
	in[i].pdata.push_back(cm);
      }
    }
    cout << solve(n,in,dur) << endl;
  }
}

Measured memory_bytes: 928
import numpy as np
from copy import copy

N = int(input())
A = list(map(int, input().split()))

# 1 <= N  <= 10000  O(N^2)
# 1 <= ai <= 10^9   O(ai)

def divider(n, p):
    # Return the number of p in n
    k = 0
    while n % p == 0:
        n = n / p
        k += 1
    return k

ks = []

for a in A:
    k = divider(a, 2)
    ks.append(k)

print(sum(ks))


Measured memory_bytes: 13252
# ???????????????.
roomDict = {}
for b in range(1, 4 + 1):
    for f in range(1, 3 + 1):
        for r in range(1, 10 + 1):
            roomNum = b * 100 + f * 10 + r
            roomDict[roomNum] = 0

# ??\???????????????????????????.
n = int(input())
for i in range(n):
    input_b, input_f, input_r, input_v = map(int, input().split()) # b?£?f??????r???????????¨?±????v?????\?±?.v???????????????????????????.
    roomNum = input_b * 100 + input_f * 10 + input_r
    numOfPeople = roomDict[roomNum]
    roomDict[roomNum] = numOfPeople + input_v

# ???????????¨?????????.
isFirst = True
for b in range(1, 4 + 1):
    if isFirst:
        isFirst = False
    else:
        print("####################")
    for f in range(1, 3 + 1):
        for r in range(1, 10 + 1):
            roomNum = b * 100 + f * 10 + r
            print(" {0}".format(roomDict[roomNum]), end='')
        print('')

Measured memory_bytes: 7728
#include <iostream>

using namespace std;
string s,t;
int n,mx;
bool check(int len)
{
   for(int i=n-len;i<=n-1;i++)
   {
       if(s[i]!=t[i-(n-len)])
          return 0;
   }
   return 1;

}
int main()
{
    cin>>n;
    cin>>s>>t;
    for(int i=1;i<=n;i++)
        if(check(i))
          mx=i;
    cout<<2*n-mx;
    return 0;
}


Measured memory_bytes: 256
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

N = read()
A = [0] + reads() + [0] # len(A) = N + 2
planned = sum(abs(A[i+1] - A[i]) for i in range(N+1))
for i in range(1, N+1):
  diff = abs(A[i+1]-A[i]) + abs(A[i]-A[i-1]) - abs(A[i+1]-A[i-1])
  print(planned - diff)


  


Measured memory_bytes: 14416
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<vector>
#include<cmath>
#define Inf 0x3f3f3f3f

const int maxn=2e3+5;
typedef long long ll;
using namespace std;

struct node
{
    int pos;
    int w;
    node (int x,int y)
    {
        pos=x;
        w=y;
    }
    bool friend operator < (node x,node y)
    {
        return x.w>y.w;
    }
};
vector<node>vec[maxn];
int dis[maxn];
int vis[maxn];
int n,x,y;
void init()
{
    for(int t=1;t<=n;t++)
    {
        dis[t]=Inf;
      
    }
    memset(vis,0,sizeof(vis));
}

void Dijkstra(int s)
{
    init();
    priority_queue<node>q;
    q.push(node(s,0));
    dis[s]=0;
    while(!q.empty())
    {
        node now=q.top();
        q.pop();
        if(vis[now.pos])continue;
        vis[now.pos]=1;
        for(int t=0;t<vec[now.pos].size();t++)
        {
            node to=vec[now.pos][t];
            if(to.w+dis[now.pos]<dis[to.pos])
            {
                dis[to.pos]=to.w+dis[now.pos];
                to.w=dis[to.pos];
                q.push(to);
            }
        }
    }
}
int cnt[maxn];
int main()
{
    scanf("%d%d%d",&n,&x,&y);
    for(int i=1;i<n;i++){
       vec[i].push_back(node(i+1,1));
       vec[i+1].push_back(node(i,1));

    }
    vec[x].push_back(node(y,1));
    vec[y].push_back(node(x,1));
    for(int i=1;i<=n;i++){
        Dijkstra(i);
        for(int j=i+1;j<=n;j++){
         //   cout<<dis[j]<<endl;
            cnt[dis[j]]++;
        }
    }
    for(int i=1;i<n;i++){
        cout<<cnt[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 384
s = input()
n = len(s)
first_divider = int(((n-1)/2))
second_divider = int(((n+3)/2))
first_frag = s[:first_divider]
second_frag = s[second_divider-1 :]
if (first_frag == second_frag):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<string>
#include<map>
#include<set>

#define INF 100000001
using namespace std;
typedef long long ll;

int main() {
	int k;
	string s;
	cin >> s >> k;
	set<string> x;
	for (int i = 0; i<s.size(); i++) {
		for (int j = 1; j < k + 1; j++) {
			if (i + j == 1 + s.size()) {
				break;
			}
	//		cout << s.substr(i, j) << endl;
			x.insert(s.substr(i, j));
		}
	}
	auto itr = x.begin();
	advance(itr, k-1);
	cout << *itr;
	return 0;
}

Measured memory_bytes: 1664
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<map>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define P pair<int,int>
#define ll __int64
int n,a;

int main(){
cin>>n>>a;
while(n>=500)n-=500;
if(n<=a)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<string>
#include<queue>
#include<vector>
#include<algorithm>
#include<tuple>
#include<numeric>
#include<map>
#include<cmath>
#define ll long long
#define rep(i,n) for(int i=0;i<(int) (n);i++)
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
using namespace std;
int main(){
  int a,b,c,f=0;
  cin>>a>>b>>c;
  if(a==b&&a==c)f=1;
  if(f==0&&(a==b||a==c||b==c))cout<<"Yes";
  else cout<<"No";
}

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

using namespace std;

int main() {
	int n;

	cin >> n;

	vector <long long int> a(n);

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

	vector <pair<int, int>> p;
	int s = 0;
	for (int i = 1; i < n; i++) {
		if (a[i] < a[i-1]) {
			p.push_back({s, i-1});
			s = i;
		}
	}

	p.push_back({s, n-1});

	long long int yen = 1000;

	for (auto it: p) {
		int i = it.first;
		int j = it.second;

		long long int stocks = yen / a[i];
		yen = yen - stocks * a[i];
		yen = yen + stocks * a[j];
	}

	cout << yen << "\n";

	return 0;
}

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

using ll = long long;
using P = pair<ll, ll>;

const ll MOD = 1e9+7;
// const ll MOD = 998244353;
const ll INF = 1ll<<60;

#define FOR(i,a,b) for (ll i=(a);i<(ll)(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()


int main(int argc, char **argv)
{
	string s; cin >> s;
	std::cout << s.substr(0, 3) << std::endl;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
int m;
int n[10001];	
bool check(){
	bool p=1;
	for (int i=1;i<=m;i++){
		if (n[i]%2==0)
			n[i]/=2;
		
		else p=0;
	}
	return p;
}
int main() {
	cin>>m;
	for (int i=1;i<=m;i++)
	cin>>n[i];
	int sum=0;
	while (check()==1){
		
		sum++;
	}
	cout<<sum;
	return 0;
}

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

using namespace std;

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

	int n;
	cin >> n;

	vector<int> a(n + 1);
	int v;
	for(int i = 1; i <= n; i++) {
		cin >> v;
		a[v] = i;
	}

	for(int i = 1; i <= n; i++) {
		cout << a[i] << ' ';
	}

	return 0;
}


Measured memory_bytes: 1280
#include<stdio.h>
#include<math.h>
int main()
{
  int i,n,l,tao[200],flavors[200],vtri=0,min;
  long sum=0;
  scanf("%d %d", &n , &l);
  for (i=0; i<n; i++)
    {
      flavors[i]=l+i;
      sum += flavors[i];
      if (!i) 
	    {
	      min=abs(flavors[i]);
	      vtri=0;
	    }
      if (min>abs(flavors[i])) 
        {
          min=abs(flavors[i]); vtri=i;
        }
    }
  printf("%ld", sum-flavors[vtri]);
  return 0;
}


Measured memory_bytes: 128
S = input()

n = S.count('N')
s = S.count('S')
w = S.count('W')
e = S.count('E')
a = 0

if n > 0:
    a += 1
if s > 0:
    a -= 1
if w > 0:
    a += 2
if e > 0:
    a -= 2

if a == 0:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 9056
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<ll> a(n);
	rep(i, n) cin >> a[i];
	ll ans = a.front();
	rrep(i, n) ans = gcd(ans, a[i]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3972
#include <stdio.h>
#include <stdlib.h>

#define MAX 101

static int top = 0;
static int stack[MAX];

void push(int x);
int pop(void);
int isEmpty(void);
int isFull(void);


int main(void){
  int n;

  while(scanf("%d", &n) != EOF){
    if(n != 0){
      push(n);
    }else{
      printf("%d\n", pop());
    }
  }
  return 0;
}


void push(int x){
  if(isFull()){
    printf("?????????????????????\n");
    exit(1);
  }
  stack[++top] = x;
}


int pop(void){
  if(isEmpty()){
    printf("??¢??????????????????\n");
    exit(1);
  }
  return stack[top--];
}


int isEmpty(void){
  return top == 0;
}


int isFull(void){
  return top >= MAX-1;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
//			#include <ext/pb_ds/assoc_container.hpp>
//			#include <ext/pb_ds/tree_policy.hpp>

		using ll = long long;
		using ld = long double;
		#define rep(i, a, n) for(ll i = (a); i < (n); i++)
		#define per(i, a, n) for(ll i = (n-1); i >= (a); i--)
		#define F first
		#define S second
		#define endl "\n"
		#define all(x) begin(x), end(x)
		#define maxx(a, b) a = max(a, b)
		#define minn(a, b) a = min(a, b)
		#define db(x) cerr<<#x<<" = "<<x<<endl
		#define N 1111111
		#define mod 998244353
		#define rt return
		#define inf 1234567891123456789ll

		using namespace std;
//			random_device rd;
//			mt19937 mt(rd());
//			using namespace __gnu_pbds;
//
//			typedef tree<pair<ll,ll>, null_type, less<pair<ll,ll>>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

		#define error(args...){string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

		void err(istream_iterator<string> it) {}
		template<typename T, typename... Args>
		void err(istream_iterator<string> it, T a, Args... args)
		{
			cerr<<*it<<" = "<<a<<endl;
			err(++it, args...);
		}

		ll modlaber(ll a, ll m = mod)
		{
			rt ((a+m)%m+m)%m;
		}

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

			ll a,b,c; cin>>a>>b>>c;
			ll ans = 0;
			rep(i,a,b+1)
				ans += i%c == 0;

			cout<<ans;

			rt 0;
		}




















Measured memory_bytes: 3632
from sys import stdin

n = int(stdin.readline().rstrip())
h = list(map(int, stdin.readline().rstrip().split(' ')))

if n == 1:
    print("Yes")
    exit()
for i in range(n-2, -1, -1):
    if h[i] - h[i+1] == 1:
        h[i] -= 1
    elif h[i] - h[i+1] > 1:
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 14396
#include <cstdio>

const int maxn = 3030;

const int mod = 1e9 + 7;

int n, m, far[maxn], dp[maxn][maxn], a[maxn], s[maxn];

int main() {
	scanf("%d%d", &n, &m);
	char c = getchar();
	while(c != '0' && c != '1') {
		c = getchar();
	}
	for (int i = 1; i <= n; ++i) {
		a[i] = c - '0';
		s[i] = s[i - 1] + a[i];
		c = getchar();
	}
	while(m--) {
		int l, r;
		scanf("%d%d", &l, &r);
		(r > far[l]) && (far[l] = r);
	}
	int mx = 0;
	for (int i = 1; i <= n; ++i) {
		(far[i] > mx) ? (mx = far[i]) : (far[i] = 0);
	}
	dp[0][0] = 1;
	for (int i = 1; i <= n; ++i) {
		if(far[i]) {
			for (int j = i; ; ++j) {
				if(j > i && far[j] || j > far[i]) {
					--j;
					for (int k = 0; k + far[i] - j < s[far[i]]; ++k) {
						dp[j][k] = 0;
					}
					i = j;
					break;
				}
				for (int k = 0; k <= s[far[i]]; ++k) {
					dp[j][k] = dp[j - 1][k];
					if(k) {
						(dp[j][k] += dp[j - 1][k - 1]) %= mod;
					}
				}
			}
		}
		else {
			dp[i][s[i]] = dp[i - 1][s[i - 1]];
		}
	}
	printf("%d\n", dp[n][s[n]]);
	return 0;
}

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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

bool odd_digit(int n)
{
    int cnt = 0;
    while (n)
    {
        cnt++;
        n /= 10;
    }
    return cnt & 1;
}

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

    int ans = 0;
    rep2(i, 1, n + 1)
    {
        if (odd_digit(i))
        {
            ans++;
        }
    }
    cout << ans << '\n';
    return (0);
}


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

int main(){
    int N, M;
    cin >> N >> M;
    vector<vector<int>> edge(N+1, vector<int>());
    for (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }
    vector<bool> visited(N+1, false);
    visited[1] = true;
    visited[edge[1][0]] = true;
    vector<int> lroute, rroute;
    lroute.push_back(1);
    rroute.push_back(edge[1][0]);
    
    int now = 1;
    for (int z = 0; z < N; z++) {
        bool stop = true;
        for (int nxt : edge[now]) {
            if (!visited[nxt]) {
                visited[nxt] = true;
                lroute.push_back(nxt);
                now = nxt;
                stop = false;
                break;
            }
        }
        if (stop) break;
    }
    
    now = edge[1][0];
    for (int z = 0; z < N; z++) {
        bool stop = true;
        for (int nxt : edge[now]) {
            if (!visited[nxt]) {
                visited[nxt] = true;
                rroute.push_back(nxt);
                now = nxt;
                stop = false;
                break;
            }
        }
        if (stop) break;
    }
    
    printf("%d\n", (int)lroute.size()+(int)rroute.size());
    for (int i = 0; i < (int)lroute.size(); i++) {
        if (i == 0) printf("%d", lroute[lroute.size()-1-i]);
        else printf(" %d", lroute[lroute.size()-1-i]);
    }
    for (int i = 0; i < (int)rroute.size(); i++) {
        printf(" %d", rroute[i]);
    }
    printf("\n");
    return 0;
}

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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

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

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

ll N;
ll A[1000005];

ll insertSort(ll g, ll cnt) {
    for (ll i = g; i < N; ++i) {
        ll v = A[i];
        ll j = i - g;
        while (j >= 0 && A[j] > v) {
            A[j + g] = A[j];
            j = j - g;
            cnt++;
        }
        A[j + g] = v;
    }
    return cnt;
}

void shellSort() {
    ll cnt = 0;
    vector<ll> v;
    ll t = 1LL;
    while (t <= N) {
        v.push_back(t);
        t *= 2LL;
    }

    cout << v.size() << endl;
    for (int i = v.size() - 1; i >= 0; --i) {
        cnt = insertSort(v[i], cnt);
        cout << v[i];
        if (i > 0)
            cout << " ";
    }
    cout << endl;
    cout << cnt << endl;
    REP(i, N) {
        cout << A[i] << endl;
    }
}

int main() {
    cin >> N;
    REP(i, N) {
        cin >> A[i];
    }

    shellSort();
    return 0;
}


Measured memory_bytes: 10980
#! /usr/bin/python
# -*- coding: utf-8 -*-
import re
import heapq

while 1:
    n = int(raw_input())
    if n==0:break
    q = []
    lg = []
    Max = 0
    for i in range(n):
        t = map(int, re.split(r'\s|:', raw_input()))
        lg.append([t[0]*60*60+t[1]*60+t[2], t[3]*60*60+t[4]*60+t[5]])
    lg.sort()
    for i in range(n):
        while len(q) > 0:
            top = heapq.heappop(q)
            if top > lg[i][0]:
                heapq.heappush(q, top)
                break
        heapq.heappush(q, lg[i][1])
        if Max < len(q):
            Max = len(q)
    print Max

Measured memory_bytes: 6288
<?php

$str   = file_get_contents('php://stdin');
$chars = str_split($str);

$alphabet = array_fill_keys(range('a', 'z'), 0);
foreach ($chars as $c) {
    if (! ctype_alpha($c)) { continue; }

    $alphabet[strtolower($c)]++;
}

foreach ($alphabet as $char => $count) {
    printf('%s : %d%s', $char, $count, PHP_EOL);
}

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

using namespace std;

int main()
{
  int N, L; cin >> N >> L;
  int min = 100;
  int sum = 0;
  for (int i = 0; i < N; i++) {
      int p = L + i;
      if (abs(min) > abs(p)) min = p;
      sum += p;
  }
  
  cout << sum- min << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(!isdigit(ch))
	{
		if(ch=='-') f=-1;
		ch=getchar();
	}
	while(isdigit(ch))
	{
		x=(x<<1)+(x<<3)+ch-'0';
		ch=getchar();
	}
	return x*f;
}
const int N=20;
int n,a[N];
inline int solve(int l,int r,int x,int y)
{
	if(l+1>=r) return 0;
	int res=1e18;
	for(int i=l+1;i<=r-1;i++)res=min(res,solve(l,i,x,x+y)+solve(i,r,x+y,y)+a[i]*(x+y));
	return res;
}
signed main(void)
{
	n=read();
	for(int i=1;i<=n;i++)a[i]=read();
	printf("%lld\n",a[1]+a[n]+solve(1,n,1,1));
	return 0;
}

Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]A - Something on It
            string s = Console.ReadLine();
            int toppings = s.Count(x => x == 'o');

            Console.WriteLine(700 + toppings * 100);
        }
    }
}

Measured memory_bytes: 11220
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;
const int INF=100000000;
const int MAX=800;
char maze[MAX][MAX+1];
int N, M, K;
int sx, sy;

int d[MAX][MAX];

int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};
int ans=INF;
int bfs(){
    queue<P> que;
    
    rep(i,0,N)
    rep(j,0,M) d[i][j]=INF;
    que.push(P(sx, sy));
    d[sx][sy]=0;
    ans=ans=min(ans,1+(K-1+min(min(sx,N-sx-1),min(sy,M-sy-1)))/K);
    while(que.size()){
        P p=que.front(); que.pop();
        rep(i,0,4){
            int nx=p.first+dx[i], ny=p.second+dy[i];
            
            if (0<=nx && nx<N && 0<=ny && ny<M && maze[nx][ny]!='#' && d[nx][ny]==INF){
                que.push(P(nx,ny));
                d[nx][ny]=d[p.first][p.second]+1;
                if(d[nx][ny]<=K) ans=min(ans,1+(K-1+min(min(nx,N-nx-1),min(ny,M-ny-1)))/K);
                else ans=min(ans,(K-1+d[nx][ny]+min(min(nx,N-nx-1),min(ny,M-ny-1)))/K);
            }
        }
    }
    return ans;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>N>>M>>K;
    rep(i,0,N){
        rep(j,0,M){
            cin>>maze[i][j];
            if(maze[i][j]=='S'){
                sx=i;
                sy=j;
            }
        }
    }
    cout <<bfs()<<"\n";
}

Measured memory_bytes: 3456
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define fi first
#define se second
#define FF first
#define SS second
#define mp make_pair
#define ll long long
#define int long long
#define pii pair<ll,ll>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define endl '\n'
#define fr(i, a, b) for(int i = a; i <= b; i++)
#define sz(x) (int)x.size()
typedef long double f80;
#define all(x) x.begin(), x.end()
const int mod = 1e9 + 7;

ll pwr(ll a, ll b) {
    a %= mod;
    ll ans = 1;
    while(b) {
        if(b & 1) ans = (ans * a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return ans;
}

const int N = 1e5 + 5;
int b[N];

signed main()
{
    #ifdef LOCAL
        freopen("inp.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    int n, h;
    cin >> n >> h;
    int val = 0;
    fr(i, 1, n) {
        int x;
        cin >> x;
        val = max(val, x);
        cin >> b[i];
    }
    sort(b + 1, b + n + 1);
    int ans = (h + val - 1) / val;
    for(int i = n; i >= 1; i--) {
        h -= b[i];
        if(h <= 0)
            ans = min(ans, n - i + 1);
        else
            ans = min(ans, (h + val - 1) / val + n - i + 1);
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <limits.h>
using namespace std;

#define Rep(i,n) for(int i = 0; i < n; ++i )
#define For(i,s,e) for(int i = s; i < e; ++i )
#define ll long long

ll N, X;
ll L[51];
ll C[51];

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

	cin >> N >> X;
	L[0] = 1;
	C[0] = 1;
	For(i,1,N+1) L[i]=2*L[i-1]+3;
	For(i,1,N+1) C[i]=2*C[i-1]+1;
	ll len = L[N];
	ll t = 0;
	ll sp = 0;
	ll ep = len - 1;
	ll spx = C[N];
	ll epx = 0;
	ll p = ep;
	int k = N;
	while( true )
	{
		if( X == len - ep ){
			t = epx;
			break;
		}
		if( X == len - sp ){
			t = spx;
			break;
		}
		if( 0 == k || ep <= sp )
			break;
		ll mp = (ep+sp)/2;
		ll mpx = spx - C[--k];
		if( X == len - mp ){
			t = mpx;
			break;
		}
		else if( X < len - mp ){
			sp = mp + 1;
			spx = mpx - 1;
			ep = ep - 1;
			epx = epx + ( 0 == k ? 1 : 0 );
		}
		else{
			sp = sp + 1;
			spx = spx;
			ep = mp - 1;
			epx = mpx + ( 0 == k ? 1 : 0 );
		}
	}
	cout << t << std::endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	char a[5];
	int flg = 0;
	
	for(int i = 0;i < 4;i++){
	    scanf("%c",&a[i]);
	}
	for(int i = 0;i < 3;i++){
	    if(a[i] == a[i+1]){
	        
	        flg =1;
	    }
	}
	if(flg == 0){
	    printf("Good");
	}else{
	    printf("Bad");
	}
	return 0;
}



Measured memory_bytes: 128
N, M =map(int,input().split())
class UnionFind(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
        self.size = [1 for _ in range(n)]

    def find(self, x):
        """
        x が属するグループを探索
        """
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):
        """
        x と y のグループを結合
        """
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
            self.size[x] += self.size[y]

    def is_same(self, x, y):
        """
        x と y が同じグループか否か
        """
        return self.find(x) == self.find(y)

    def get_size(self, x):
        """
        x が属するグループの要素数
        """
        x = self.find(x)
        return self.size[x]
uf = UnionFind(N)
cnt = 0
for i in range(M):
  x, y, z = map(int, input().split())
  if not uf.is_same(x-1, y-1):
    cnt += 1
    uf.union(x-1,y-1)
    
print(N-cnt)

Measured memory_bytes: 8692
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

using namespace std;

#define FOR(a,b) for(int a=0;a<b;a++)
#define F0R(a,b,c) for(int a = b; a<=c; a++)
#define f first
#define s second
#define m0(x) memset(x,0,sizeof(x))

typedef pair<int,int> pi;
typedef long long ll;
typedef vector<int> vi;
typedef vector<pi> vpi;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    bool z; cin >> z;
    cout << (int)(z^1) << "\n";
    return 0;
}


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

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

  for(int i=1;i<=10000;i++){
    
    if(floor(i*0.08)==a && floor(i*0.1)==b) {
      cout<<i<<endl;
      break;
    }
    
    if(i==10000) cout<<-1<<endl;
  }
}


Measured memory_bytes: 3636
def is_prime(q):
    q = abs(q)
    if q == 2:
        return True
    if q < 2 or q & 1 == 0:
        return False
    return pow(2, q - 1, q) == 1


if __name__ == '__main__':
    n = int(input())
    prime_list = []

    for i in range(int(55555 / 5)):
        if is_prime(i * 5 + 4):
            prime_list.append(i * 5 + 4)
    print(" ".join(map(str, prime_list[:n])))


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

bool solve(int mx, int n, int order[])
{
	queue<int> search;
	queue<int> back[252];

	bool start[252];
	for (int i = 0; i <= n + 1; i++) start[i] = false;
	start[0] = true;
	search.push(0);
	while (!search.empty()){
		int now = search.front();
		search.pop();
		for (int i = 1; i <= mx; i++){
			int next;
			if (now + i <= 0) continue;
			else if (now + i > n + 1) next = n + 1;
			else if (now + i + order[now + i] <= 0) continue;
			else if (now + i + order[now + i] > n + 1) next = n + 1;
			else next = now + i + order[now + i];
			back[next].push(now);
			if (start[next]) continue;
			start[next] = true;
			search.push(next);			
		}
	}
	if (!start[n + 1]) return false;
	
	bool goal[252];
	for (int i = 0; i <= n + 1; i++) goal[i] = false;
	goal[n + 1] = true;	
	search.push(n + 1);
	while (!search.empty()){
		int now = search.front();
		search.pop();
		while (!back[now].empty()){
			int from = back[now].front();
			back[now].pop();
			if (goal[from]) continue;
			goal[from] = true;
			search.push(from);
		}
	}
	for (int i = 0; i <= n + 1; i++){
		if (start[i] && !goal[i]) return false;
	}
	return true;
}

int main()
{
	while (true){
		int mx;
		cin >> mx;
		if (!mx) break;
		int n, order[252];
		cin >> n;
		order[0] = order[n + 1] = 0;
		for (int i = 1; i <= n; i++){
			cin >> order[i];
		}
		if (solve(mx, n, order)) cout << "OK" << endl;
		else cout << "NG" << endl;
	}
	return 0;
}

Measured memory_bytes: 1356
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>

#define _GLIBCXX_DEBUG
using namespace std;
using vi = vector<int64_t>;
using vvi = vector<vi>;

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int64_t n,tmp,minusCount=0,zeroCount=0;
    cin >> n;
    vi a(n);
    for(int i=0; i<n; i++){
        cin >> tmp;
        if(tmp < 0) minusCount++;
        if(tmp == 0) zeroCount++;
        a.at(i) = abs(tmp);
    }
    int64_t res = 0;
    if((minusCount%2 == 0) || zeroCount>0){
        for(int i=0; i<n; i++){
            res += a.at(i);
        }
    }else{
        sort(a.begin(), a.end());
        res -= a.at(0);
        for(int i=1; i<n; i++){
            res += a.at(i);
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;
template<class T> inline void chmax(T& a, T b) { a = max(a, b); }
template<class T> inline void chmin(T& a, T b) { a = min(a, b); }

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x > 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2) % mod;
}
/*--------Library Zone!--------*/


signed main() {
	int a, b; cin >> a >> b;
	if (abs(b - a) % 2)cout << "IMPOSSIBLE" << endl;
	else cout << (a + b) / 2 << endl;
}

Measured memory_bytes: 256
import java.util.*;

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

      String s = sc.next();

      if(s.equals("Sunny")){
        System.out.println("Cloudy");
      }
      else if(s.equals("Cloudy")){
        System.out.println("Rainy");
      }
      else if(s.equals("Rainy")){
        System.out.println("Sunny");
      }

    }
}


Measured memory_bytes: 20688