akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
const double pi = 3.14159265358979323846;
typedef long long  ll;
int main()
{
int n,k;
cin>>n>>k;
string s;
cin>>s;
int c=0;
for(int i=0;i<n;i++)
{
    if(s[i]==s[i+1]&&i!=n-1)
        c++;
}
    cout<<min(n-1,c+2*k);
return 0;
}


Measured memory_bytes: 512
def main():
    N,M = map(int, input().split())

    inf = 10**7
    dp = [inf]*(2**N)
    dp[0] = 0

    for i in range(M):
        a,b = map(int, input().split())
        c = list(map(int, input().split()))
        bit_c = 0
        for bi in c:
            bit_c |= 1 << bi-1
        #print(bit_c)
        for j in range(2**N):
            dp[j|bit_c] = min(dp[j] + a, dp[j|bit_c])

    if dp[-1] == inf:
        print("-1")
    else:
        print(dp[-1])


if __name__ == "__main__":
    main()

Measured memory_bytes: 3188
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;

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

	sort(a.begin(), a.end());
	cout << a[n-1] - a[0] << endl;

	return 0;
}

Measured memory_bytes: 256
// 
#include <bits/stdc++.h>
#define endl "\n"
#define rep(i,n) for(int i=0;i<int(n);i++)
#define e_b emplace_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> ipair;
typedef pair<ll,ll> lpair;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v) //vectorの中身を見る
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
void map_p(map<int,int>& d){cout<<"map: ";for(auto a : d){cout<<"{"<<a.first<<":"<<a.second<<"}";}cout<<endl;} //mapの中身を見る
void set_p(set<int>& d){cout<<"set: ";for(int a : d){cout<<a<<" ";}cout<<endl;} //setの中身を見る


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);

    int n,ans=0;
    cin>>n;
    string k;
    cin>>k;
    int l=k.size();
    int w_=0,r_=0;
    rep(i,l){
        if(k[i]=='R') r_++;
        else w_++;
    }
    if(r_==l) ans=0;
    else if(w_==l) ans=0;
    else{
        int r_le=0,w_ri=0,ind=0;
        while(k[ind]=='R' && ind<l){
            r_le++;
            ind++;
        }
        ind=l-1;
        while(k[ind]=='W' && ind>=0){
            w_ri++;
            ind--;
        }
        // cout<<r_le<<" "<<w_ri<<endl;
        int zan_r=r_-r_le;
        for(int i=r_le;i<=(l-1)-w_ri;i++){
            if(zan_r==0) break;
            if(k[i]=='W'){
                zan_r--;
                ans++;
            }else{
                zan_r--;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3760
//AUTHOR:BlackBox Inc.//
#include<bits/stdc++.h>
#include<unordered_map>
#include<tr1/unordered_map>
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define vlli vector<long long int>
#define vvi vector<vector<int>>
#define endl "\n"
#define vpii vector<pair<int,int>>
#define vs vector<string>
#define lin1(x) ll int x; x = scan();
#define lin2(x,y) ll int x, y; x = scan(), y = scan();
#define lin3(x,y,z) ll int x, y, z; x = scan(), y = scan(), z = scan();
#define pb(x) push_back(x)
#define makep(x,y) make_pair(x,y)
#define mx(a,b) (a)>(b)?(a):(b)
#define mn(a,b) (a)<(b)?(a):(b)
#define fori(s,e) for(i=s;i<=e;i++)
#define forj(s,e) for(j=s;j<=e;j++)
#define fork(s,e) for(k=s;k<=e;k++)
#define rep(i,s,e) for(int i=s;i<=e;i++)
#define brep(i,s,e) for(int i=s;i>=e;i--)
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x));
#define bits1(x) __builtin_popcount(x)
#define pi 3.14159265358979323846264338327950
#define MOD7 1000000007
#define MOD9 1000000009
#define cn cin>>
#define co cout<<
#define fast std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
using namespace std::tr1;

int main(){
// {


long long x;
cin>>x;
std::vector<int> v(x);

for (int i = 0; i < x; ++i)
{
	/* code */
	cin>>v[i];
}


std::vector<int> v2(x);
for (int i = 0; i < x; ++i)
{
	/* code */
	cin>>v2[i];
}

int ans=0;
for (int i = 0; i < x; ++i)
{
	/* code */
	if (v[i]>v2[i])
	{
		/* code */
		ans+=v[i]-v2[i];
	}
}

cout<<ans<<endl;
return 0;

}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n);; ++i)
using namespace std;
using ll = long long;
using p = pair<int, int>;
int a, b, c, d;
int main() {
    cin >> a >> b >> c >> d;
    while (a > 0 || c > 0) {
        c = c - b;
        if (c <= 0) {
            cout << "Yes";
            break;
        }
        a = a - d;
        if (a <= 0) {
            cout << "No";
            break;
        }
    }
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=100000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};


int main() {

	ll n;
	ll a[100001];
	ll total1=0,total2=0;

	cin>>n;

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


	sort(a, a + n, greater<ll>());

	if(n%2==0){
		for(int i=0; i<n/2; ++i){
			total1+=a[i]*2;
		}
		for(int j=n/2; j<n; ++j){
			total1-=a[j]*2;
		}
		total1=total1-a[n/2-1]+a[n/2];
	}

	if(n%2>0){
		for(int i=0; i<n/2+1; ++i){
			total1+=a[i]*2;
		}
		for(int j=n/2+1; j<n; ++j){
			total1-=a[j]*2;
		}
		total1=total1-a[n/2]-a[n/2-1];
		for(int i=0; i<n/2; ++i){
			total2+=a[i]*2;
		}
		for(int j=n/2; j<n; ++j){
			total2-=a[j]*2;
		}
		total2=total2+a[n/2]+a[n/2+1];

		total1=max(total1,total2);
	}

	cout<<total1<<endl;

	return 0;

}


Measured memory_bytes: 1024
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using namespace std;

constexpr int INF = numeric_limits<int>::max();

int main() {
  ll N;
  cin >> N;
  vec<ll> X(N);
  REP(i, N) {
    cin >> X[i];
  }

  ll answer = INF;
  REP1(P, 100) {
    ll c = 0;
    REP(i, N) {
      c += (X[i] - P) * (X[i] - P);
    }
    answer = min(answer, c);
  }
  cout << answer << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
  int i,d[5];
  for(i=0;i<5;i++)
    scanf("%d",&d[i]);

  int t,tt=700,j,k,l,m,tmp=0;
  for(i=0;i<5;i++){
    for(j=0;j<5;j++){
      if(j==i)
        continue;
      for(k=0;k<5;k++){
        if((k==i)||(k==j))
          continue;
	for(l=0;l<5;l++){
          if((l==i)||(l==j)||(l==k))
            continue;
	  for(m=0;m<5;m++){
            if((m==i)||(m==j)||(m==k)||(m==l))
              continue;

	    t += ((d[i]+9)/10)*10;
            t += ((d[j]+9)/10)*10;
	    t += ((d[k]+9)/10)*10;
	    t += ((d[l]+9)/10)*10;
	    t += d[m];

	    if(tt>t)
              tt = t;
	    
	    t=0;
          }
	}
      }
    }
  }

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

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>

#define ll long long int
#define mod 1000000007

using namespace std;


int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    unordered_map<string, int> um;
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        string s;
        cin >> s;
        um[s]++;
    }
    cout << "AC x " << um["AC"] << '\n';
    cout << "WA x " << um["WA"] << '\n';
    cout << "TLE x " << um["TLE"] << '\n';
    cout << "RE x " << um["RE"];
}









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

A, B, C, D = map(int, input())

if A + B + C + D == 7:
    print('{}+{}+{}+{}=7'.format(A, B, C, D))
elif A + B + C - D == 7:
    print('{}+{}+{}-{}=7'.format(A, B, C, D))
elif A + B - C + D == 7:
    print('{}+{}-{}+{}=7'.format(A, B, C, D))
elif A + B - C - D == 7:
    print('{}+{}-{}-{}=7'.format(A, B, C, D))
elif A - B + C + D == 7:
    print('{}-{}+{}+{}=7'.format(A, B, C, D))
elif A - B + C - D == 7:
    print('{}-{}+{}-{}=7'.format(A, B, C, D))
elif A - B - C + D == 7:
    print('{}-{}-{}+{}=7'.format(A, B, C, D))
elif A - B - C - D == 7:
    print('{}-{}-{}-{}=7'.format(A, B, C, D))


Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;

const int MAX_N = 200000;

int N;
vector<int> S;
int main(){
  // int res = 0;
  // for (int n = 1; n <= MAX_N; n++){
  //   set<int> div;
  //   for (int j = 2; j * j <= n; j++){
  //     if (n % j == 0){
  // 	div.insert(j);
  // 	div.insert(n / j);
  //     }
  //   }
  //   res = max(res, (int)div.size());
  // }
  // cout << res << endl;


  cin >> N;
  S.resize(N);
  for (int i = 0; i < N; i++){
    cin >> S[i];
  }
  set<long long> div;
  for (long long j = 2; j * j <= N; j++){
    if (N % j == 0){
      div.insert(j);
      div.insert(N / j);
    }
  }
  div.insert(N);
  long long res = 1;
  for (const long long K : div){
    bool ok = true;
    int len = N / K;
    int i;
    for (i = 0; i + len < N; i++){
      if (S[i] != S[i + len]){
	ok = false;
	break;
      }
    }
    if (ok && N - len == i){
      res = max(res, K);
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 3656
//submitted by Himj
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pb push_back
#define fi first
#define se second
#define fr(i,s,e) for(i=s;i<e;i++)
#define ms(arr,val) memset(arr,val,sizeof(arr))
using namespace std;

const ll mxn=2e5+1;
ll seg[4*mxn];
ll query(ll ss,ll se,ll si,ll l,ll r)
{
  if(l<=ss and r>=se)
    return seg[si];
  if(l>se or r<ss)
    return 0;
  ll mid=ss+se>>1;
  return max(query(ss,mid,2*si,l,r),query(mid+1,se,2*si+1,l,r));
}
void update(ll ss,ll se,ll si,ll i,ll val)
{
  if(i<ss or i>se)
    return ;
  if(ss==se)
  {
    seg[si]=max(seg[si],val);
    return;
  }
  ll mid=ss+se>>1;
  update(ss,mid,2*si,i,val);
  update(mid+1,se,2*si+1,i,val);
  seg[si]=max(seg[2*si],seg[2*si+1]);
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

  ll t=1;
  //cin>>t;
    while(t--){
      int n,i;
      ll ans=0;
      cin>>n;
      ll val[n+1];
      pair<ll,ll> height[n+1];
      fr(i,1,n+1)
      {
        cin>>height[i].fi;
        height[i].se=i;
      }
      fr(i,1,n+1)
      cin>>val[i];
      sort(height+1,height+1+n);
      fr(i,1,n+1)
      {
        ll himj=query(1,n,1,1,height[i].se-1);
        update(1,n,1,height[i].se,himj+val[height[i].se]);
        ans=max(ans,himj+val[height[i].se]);
      }
      cout<<ans;
      
       
    }
  return 0;
  }



Measured memory_bytes: 11136
fun main(args: Array<String>) {
    val (inputA, inputB) = readLine()!!.split(" ").map { it.toInt() }

    println(comparisonInt(inputA, inputB))
}

fun comparisonInt(inputA: Int, inputB: Int): String {
    return when {
        inputA > inputB -> "a > b"
        inputA < inputB -> "a < b"
        else -> "a == b"
    }
}


Measured memory_bytes: 31996
#include <iostream>

using namespace std;

int main() {
	std::string input;
	int N, M;
	cin >> N >> M;
	int a{ min(N, M) };
	int b{ max(N, M) };
	if (a == 1) {
		cout << (b == 1 ? 1 : b - 2) << endl;
	}
	else if (a == 2 || b == 2) {
		cout << 0 << endl;
	}
	else {
		cout << (int64_t)(a - 2)*(b - 2) << endl;
	}
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

INF = float('inf')

def solve():
    n, m = MI()
    dct = {}
    for i in range(m):
        p, y = MI()
        dct.setdefault(p, [])
        dct[p].append((i, y))
    # print(dct)

    ans = ['' for _ in range(m)]
    for key, value in dct.items():
        st = sorted(value, key=lambda x: x[1])
        # print(st)
        for idx, (i, year) in enumerate(st):
            id = str(key).zfill(6) + str(idx+1).zfill(6)
            # print(id)
            ans[i] = id

    for iid in ans:
        print(iid)

if __name__ == '__main__':
    solve()


Measured memory_bytes: 44480
#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <algorithm>

#define MOD_BIG 1000000007
#define MOD_BIG2 998244353
using std::string;
using std::cin;
using std::cout;
using std::cerr;
using std::endl;
using ll = long long;
using std::vector;

template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) {
    vec.resize(len);
    for (auto &v : vec) ndarray(v, args...);
}

//////////////////////////////////////

//////////////////////////////////////

int main() {
    
    ll X, Y;
    cin >> X >> Y;
    
    if ((2*X-Y)%3 != 0 || (-X + 2*Y)%3 != 0) {
        cout << 0 << endl;
        return 0;
    }
    ll a, b, n;
    a = (2*X-Y)/3;
    b = (-X+2*Y)/3;
    n = a + b;
    
    if (a < 0 || b < 0) {
        cout << 0 << endl;
        return 0;
    }
    vector<ll> m(n+1), mi(n+1), inv(n+1);
    m[0] = 1;
    m[1] = 1;
    mi[0] = 1;
    mi[1] = 1;
    inv[1] = 1;
    for (int i = 2; i <= n; i++) {
        m[i] = m[i - 1] * i % MOD_BIG;
        inv[i] = MOD_BIG - inv[MOD_BIG%i] * (MOD_BIG / i) % MOD_BIG;
        mi[i] = mi[i - 1] * inv[i] % MOD_BIG;
    }
    
    ll ans = m[n] * (mi[a] * mi[b] % MOD_BIG) % MOD_BIG;
    
    cout << ans << endl;
    
    return 0;
}


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


int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  set<int> s;
  rep(i,n) s.insert(a[i]);
  if (s.size() == n) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 10368
N, MOD = int(input()), 10 ** 9 + 7
memo = [{} for i in range(N + 1)]

def ok(last4):
    for i in range(4):
        t = list(last4)
        if i >= 1:
            t[i - 1], t[i] = t[i], t[i - 1]
        if ''.join(t).count('AGC') >= 1:
            return False
    return True

def dfs(cur, last3):
    if last3 in memo[cur]:
        return memo[cur][last3]
    if cur == N:
        return 1
    ret = 0
    for c in 'ACGT':
        if ok(last3 + c):
            ret = (ret + dfs(cur + 1, last3[1:] + c)) % MOD
    memo[cur][last3] = ret
    return ret

print(dfs(0, 'TTT'))

Measured memory_bytes: 3872
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define uid uniform_int_distribution
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
#define bpop(x) __builtin_popcountll((ulli)x)
#define blead(x) __builtin_clzll((ulli)x)
#define btrail(x) __builtin_ctzll((ulli)x)
const double PI = acos(-1);
template<class my>
using ind_set = tree<my,null_type,less<my>,rb_tree_tag,tree_order_statistics_node_update>;

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define ppb pop_back()
#define ppf pop_front()
#define all(vec) vec.begin(), vec.end()
#define fol(i,a,b) for(int i=a;i<b;i++)
#define loop(i,a,b) for(int i=a;i>=b;i--)
#define forr(x,arr) for(auto& x:arr)
#define mod 1000000007
#define INF 0x3f3f3f3f3f3f3f3f
#define EPS 1e-7
#define sz(x) (int)(x).size()

using lli   = long long;
using ulli  = unsigned long long int;
using pll   = pair<lli, lli>;
using ttt   = pair<lli, pll>;
using vttt  = vector<ttt>;
using vll   = vector<pll>;
using vl    = vector<lli>;
using vi    = vector<int>;
using vvi   = vector<vector<int>>;
using cd    = complex<long double>;

#ifdef tejasp
template<typename T>
void __p(T a) { cout << a << " "; }
template<typename T, typename F>
void __p(pair<T, F> a) { cout << "{ "; __p(a.ff); __p(a.ss); cout << "} "; }
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
	cout<<name<<" : ";__p(arg1); cout<<endl;
}
template<typename Arg1>
void __t(const char *name, Arg1 &&arg1)
{ cout<<name<<" : { "; for (auto p : arg1) __p(p); cout<<"}"<<endl; }
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
	int bracket=0,i=0;
	for(; ;i++)
		if(names[i]==','&&bracket==0)
			break;
		else if(names[i]=='(')
			bracket++;
		else if(names[i]==')')
			bracket--;
	cout.write(names,i)<<" : ";
	__p(arg1);  cout<<"| ";
	__f(names+i+1,args...);
}
template<typename Arg1, typename Arg2>
void __f(const char *names, Arg1 arg1[], Arg2 &&arg2){
    int i=0;
	for(; ;i++) if(names[i]==',') break;
	cout.write(names,i)<<" : { ";
	fol(i,0,arg2) __p(arg1[i]);
	cout << "} "<<endl;
}
#define trace(...) { cout<<"Line:"<<__LINE__<<" | "; __f(#__VA_ARGS__, __VA_ARGS__); }
#define cotra(...) { cout<<"Line:"<<__LINE__<<" | "; __t(#__VA_ARGS__, __VA_ARGS__); }
#else
#define endl '\n'
#define trace(...)
#define cotra(...)
#endif

lli dp[100010];

void tejas_919(int kkkk)
{
    int n, W;
    cin>>n>>W;
    fol(i,0,100010) dp[i]=INF;
    fol(i,1,n+1)
    {
        int w, v;
        cin>>w>>v;
        loop(j,100010,v)
            dp[j]=min(dp[j],dp[j-v]+w);
        dp[v]=min(dp[v],(lli)w);
    }
    loop(i,100009,0) if(dp[i]<=W) {cout<<i<<endl; return;}
}

int main()
{
    #ifndef tejasp
        ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    #endif
    cout << fixed << setprecision(10);
    int t=1;
    //cin>>t;
    fol(i,0,t) { tejas_919(i+1); }
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"


int main() {
	int id = 0;
	while (1) {
		int N; cin >> N;
		if (!N)break;
		if (id)cout << endl;
		id++;
		vector<vector<vector<int>>>field(5, vector<vector<int>>(5, vector<int>(5)));
		for (int i = 0; i < 5; ++i) {
			for (int j = 0; j < 5; ++j) {
				string st; cin >> st;

				for (int k = 0; k < 5; ++k) {
					field[i][j][k] = st[k] == '1';
				}
			}
		}
		int A; cin >> A;
		vector<int>as, bs;
		for (int i = 0; i < A; ++i) {
			int a; cin >> a;
			as.push_back(a);
		}
		int B; cin >> B;
		for (int i = 0; i < B; ++i) {
			int b; cin >> b;
			bs.push_back(b);
		}
		vector<vector<vector<int>>>nfield(field);
		while (N--) {
			for (int i = 0; i < 5; ++i) {
				for (int j = 0; j < 5; ++j) {
					for (int k = 0; k < 5; ++k) {
						int num = 0;
						for (int a = i-1; a <= i+1; ++a) {
							for (int b = j-1; b <= j+1; ++b) {
								for (int c = k-1; c <= k+1; ++c) {
									if (a >= 0 && a < 5 && b >= 0 && b < 5 && c >= 0 && c < 5) {
										if(a!=i||b!=j||c!=k)num += field[a][b][c];
									}
								}
							}
						}
						if (!field[i][j][k]) {
							nfield[i][j][k] = (find(as.begin(), as.end(), num) != as.end());
						}
						else {
							nfield[i][j][k] = (find(bs.begin(), bs.end(), num) != bs.end());
						}
					}
				}
			}
			field = nfield;
		}
		cout << "Case " << id << ":" << endl;
		for (int i = 0; i < 5; ++i) {
			for (int j = 0; j < 5; ++j) {
				for (int k = 0; k < 5; ++k) {
					cout << field[i][j][k];
				}
				cout << endl;
			}
			if(i!=4)cout << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3248
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;

int main(){
    int l,i=0,N,K;
    cin>>N;
    cin>>K;
    int a[N];
    for (int i = 0; i<N; i++){
        cin>>l;
        a[i]=l;
    }
    sort(a,a + N );
    int b = 0;
    for (int i = 0; i<K; i++){
        b+=a[i];
    }
    cout<<b<<endl;
    return 0;
}
    

Measured memory_bytes: 3628
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		int[] slist = new int[S.length()];
		int[] tlist = new int[T.length()];
		Map<Character, Integer> appear = new HashMap<>();
		int count = 0;
		for(int i = 0; i < S.length(); i++) {
			char tmp = S.charAt(i);
			if(appear.containsKey(tmp)) {
				slist[i] = appear.get(tmp);
			} else {
				appear.put(tmp, count);
				slist[i] = count;
				count++;
			}
		}
		appear.clear();
		count = 0;
		for(int i = 0; i < T.length(); i++) {
			char tmp = T.charAt(i);
			if(appear.containsKey(tmp)) {
				tlist[i] = appear.get(tmp);
			} else {
				appear.put(tmp, count);
				tlist[i] = count;
				count++;
			}
		}
		boolean ans = true;
		for(int i = 0; i < S.length(); i++) {
			ans = ans && slist[i] == tlist[i];
		}
		if(ans) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

}


Measured memory_bytes: 31204
def prime(n):
    if n > 1:  
        for i in range(2, n): 
            if (n % i) == 0: 
                return False
                break
        else: 
            return True 
    else: 
        return False
n = int(input())
c = 1
ans = []
for i in range(n):
  flag = True
  while flag:
    val = prime((c*5)+1)
    if val:
      ans.append((c*5)+1)
      flag = False
    c+=1
print(*ans)

Measured memory_bytes: 8968
#include "bits/stdc++.h"
typedef long long ll;
using namespace std;

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

    if (2000 <= x) {
        cout << 1 << endl;
        return 0;
    }
    for (int oni = 0; oni <= 20; ++oni) {
        for (int sand = 0; sand <= 20; ++sand) {
            for (int cookie = 0; cookie <= 20; ++cookie) {
                for (int cake = 0; cake <= 20 ; ++cake) {
                    for (int ame = 0; ame <= 20; ++ame) {
                        for (int pc = 0; pc <= 20; ++pc) {
                            int price = oni * 100 + sand * 101 + cookie * 102 + cake * 103 + ame * 104 + pc * 105;
                            if (price == x) {
                                cout << 1 << endl;
                                return 0;
                            }
                        }
                    }
                }
            }
        }
    }
    cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define Infty 2000000000
int mothernum, mother[500000], left[300000], right[300000], counter=0;
int merge(int mother[], int Start, int Center, int End)
{
 int leftnum, rightnum, i, j, k;
 leftnum  = Center - Start;
 rightnum = End - Center;
 for(i = 0; i < leftnum; i++){
   left[i] = mother[Start+i];
 }
 for(i = 0; i < rightnum; i++){
   right[i] = mother[Center+i];
 }
 
 left[leftnum]   = Infty;
 right[rightnum] = Infty;
 i = 0;
 j = 0;  
 
 for(k = Start; k < End; k++){
   if (left[i] <= right[j]) {
     mother[k] = left[i];
     i = i + 1;
     counter++;
   } else {
     mother[k] = right[j];
     j = j + 1;
     counter++;
   }
 }
 return 0;
}

int mergeSort(int mother[], int Start, int End)
{
 int Center;
 if ( (Start+1) < End ) {
   Center = (End + Start) / 2;
   mergeSort(mother, Start, Center);
   mergeSort(mother, Center, End);
   merge(mother, Start, Center, End);
 }
 return 0;
}

int main()
{
 int i;
 scanf("%d", &mothernum);
 for (i = 0; i < mothernum; i++) {
   scanf("%d", &mother[i]);
 }
 
 mergeSort(mother, 0, mothernum);
 
 for (i = 0; i < mothernum-1; i++) {
   printf("%d ",mother[i]);
 }
 printf("%d\n",mother[mothernum-1]);
 
 printf("%d\n",counter);
 
 return 0;
}

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

int main() {
    string s,t,u;
    int a,b;
    cin>>s>>t>>a>>b>>u;

    if(s==u) cout<<a-1<<' '<<b<<endl;
    else cout<<a<<' '<<b-1<<endl;


    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#define Endl endl
#define mp make_pair
#define rep(N) for(int i=0;i<N;i++)
#define repj(N) for(int j=0;j<N;j++)
#define ll long long 
#define pii pair<int,int>
#define pll pair<ll,ll>
#define For(I,N) for(int I=0;I<N;I++)
#define cinone(N) int N;cin>>N;
#define scanfone(N) int N;cin>>N;
#define cinng(N,M) int N[M];for(int yiuytvnm=0;yiuytvnm<M;yiuytvnm++) cin>>N[yiuytvnm];
#define scanfng(N,M) int N[M];for(int qrwuoiq=0;qrwuoiq<M;qrwuoiq++) scanf("%d",&N[qrwuoiq]);
#define over(A) {cout<<A<<endl;exit(0);}
#define all(A) A.begin(),A.end()
#define ceil(a,b) ((a-1)/b+1)
typedef unsigned long long ull;
const int inf=1039074182;
const int mod=1e9+7;
using namespace std;
ll dp[100005];
ll sum[200005];
int n,k;
int a[100005];

int main()
{
	cin>>n>>k;
	for(int i=0;i<n;i++)
	{
		scanf("%d",a+i);
	}
	dp[0]=1;
	for(int i=0;i<n;i++)
	{
		memset(sum,0,sizeof(sum));
		for(int j=0;j<=k;j++)
		{
			sum[j]+=dp[j];
			sum[j]%=mod;
			sum[j+a[i]+1]-=dp[j];
			sum[j+a[i]+1]%=mod;
		}
		dp[0]=sum[0];
		for(int j=1;j<=k;j++)
		{
			dp[j]=dp[j-1]+sum[j];
			dp[j]%=mod;
		}
	}
	cout<<(dp[k]+mod)%mod<<endl;
	return 0;
}

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

#define LL long long
const int mod = 1e9 + 7, N = 200005;

LL fac[500007];

LL power(LL x, LL y){return y ? power(x * x % mod, y / 2) * (y % 2 ? x : 1) % mod : 1;}

LL modInverse(LL n) { return power(n, mod-2); } 
 
LL nCr(LL n, LL r) { 
    if (n < 0 || r < 0 || r > n) return 0;  
    return (fac[n]* modInverse(fac[r]) % mod * modInverse(fac[n-r]) % mod) % mod; 
} 

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

    fac[0] = 1LL; 
    for (LL i=1;i<=500006;++i) 
        fac[i] = fac[i-1]*i%mod;
    
    LL n, k, ans; cin >> n >> k;

    for(LL i = 1; i <= k; i++) {
        ans =  nCr(n - k + 1, i);
        ans *= nCr(k - 1, i - 1);
        ans %= mod;
        cout << ans << '\n';
    }    
}

Measured memory_bytes: 7520
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define U 998244353
#define N 1000005
#define int long long
#define sz(c) (int)c.size()
#define fr first
#define ll long long 
#define sc second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a ; i<n ; i++)
#define r0 return 0;
#define endl '\n'
#define INF (int)1e15

/* Debug Begins */ 
# define trace(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
string to_string(char c) { return "'" + string(1, c) + "'";}
string to_string(string s) { return '"' + s + '"';}
string to_string(bool f) { if(f) return "True"; else return "False";}
string to_string(const char* s) { return to_string((string) s);}
template<typename A> string to_string(A);
template<typename A, typename B> string to_string(pair<A, B> p){
  return "(" + to_string(p.first) + ": " + to_string(p.second) + ")";}
template<typename A> string to_string(A v) {bool f = false; string r = "{"; 
  for (auto x: v) {if (f) r += ", "; r += to_string(x); f = true;} return r += "}";}
template<typename A> string to_string(vector<vector<A>> v) {string r; 
  for (auto x: v) r += "\n" + to_string(x); return r;}
int Nerr;
template<typename A> string to_string(A *p) {return to_string(vector<A>(p, p + Nerr));}
void err(istream_iterator<string>) { cerr << endl; }
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << to_string(a) << "; "; err(++it, args...); }
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
#define Lu(...) [&] (auto &&u) { return __VA_ARGS__; }
#define Luv(...) [&] (auto &&u, auto &&v) { return __VA_ARGS__; }
/***************************************************************/



signed main()
{
    ios_base::sync_with_stdio(0);
    int TESTS=1;
    // cin>>TESTS;
    while(TESTS--)
    {   
        int n;
        cin >> n;
        int ans = (n*(n+1)*(n+2))/6;
        rep(i,0,n-1){
            int u,v;
            cin >> u >> v;
            if(u > v) swap(u,v);
            ans -= u*(n-v+1);
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3656
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace B
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var NAB = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            var N = NAB[0];
            var A = NAB[1];
            var B = NAB[2];
            var answer = 0;
            for (var i = 1; i <= N; i++)
            {
                var val = i.ToString().Sum(x => x - '0');
                if (A <= val && val <= B) answer += i;
            }
            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 28836
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

template<typename T>
istream& operator >> (istream& is, vector<T>& vs){
  for(T& v: vs) is >> v;
  return is;
}

LL add(LL a, LL b) { return a + b; }

int main() {
  int N; cin >> N;
  vector<LL> A(N); cin >> A;

  LL x = 0, y = 0, r = 0, cnt = 0;
  for (LL l = 0; l < N; ++l) {
    for (; r < N; ++r) {
      x = x ^ A[r];
      y = y + A[r];
      if (x != y) {
        x = x ^ A[r];
        y = y - A[r];
        break;
      }
    }
    x = x ^ A[l];
    y = y - A[l];
    cnt += r - l;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 4848
use std::io::{self, Write};

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main() {
    let n = read::<usize>();
    let mut a = vec![];
    for _ in 0..n {
        let ai = read::<usize>();
        a.push(ai);
    }

    let mut sorted = a.clone();
    sorted.sort_by(|x, y| y.cmp(x));

    let mut s = vec![];

    for ai in a.into_iter() {
        let res = if ai == sorted[0] {
            sorted[1]
        } else {
            sorted[0]
        };
        writeln!(s, "{}", res).unwrap();
    }

    io::stdout().write_all(&s).unwrap();
}

Measured memory_bytes: 10492
#include <iostream>
#include <string>
#include <vector>

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

long long gcd(long long a, long long b)
{
  if (a == 0)
    return b;
  else
    return gcd(b % a, a);
}

long long lcm(long long a, long long b)
{
  return a * b / gcd(a, b);
}

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

  long long count = 0;

  long long div_c = B / C - (A - 1) / C;
  long long div_d = B / D - (A - 1) / D;
  long long lcm_ = lcm(C, D);
  long long div_c_d = B / lcm_ - (A - 1) / lcm_;

  cout << B - A + 1 - div_c - div_d + div_c_d << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define lb long double
#define pb push_back
#define l first
#define r second
#define qwerty3 -> first
#define qwerty4 -> second
#define umap unordered_map
#define uset unordered_set
#define pii pair < int , int >

using namespace std;

const int N = 100005;
const int M = 1000000007;
const lb PI = acos(-1);

ll n , a , b , c , d , e;

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

    cin >> n;
    cin >> a;
    cin >> b;
    cin >> c;
    cin >> d;
    cin >> e;

    ll mini = min({a , b , c , d , e});
    cout << n / mini + (n % mini > 0) + 4;

    return 0;
}


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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if((c+b-1)/b > (a+d-1)/d){
        cout<<"No";
    }
    else{
        cout<<"Yes";
    }
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,b,a) for(int i=b;i>=a;i--)
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Forenska(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define sqr(x) ((x)*(x))
#define lowbit(x) ((x)&(-x))
#define GREATER(x) x,vector<x>,greater<x>
#define randIn(L,R) (((LL)rand()*rand())%(R-L)+L)
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pLL;
typedef vector<int> vec;
typedef vector<LL> vecL;
typedef vector<pii> vecP;
typedef vector<pLL> vecPL;
typedef vector<string> vecS;
typedef vector<vec> mat;
typedef complex<double> point;
const long double PI=3.14159265358979323846264338327950;
const LL INFLL=0x3f3f3f3f3f3f3f3f;
const int INF=0x3f3f3f3f;
const long double EPS=1e-10;
int read()
{
    int x=0;
    char ch=' ';
    bool flag=false;
    while(ch<'0' || ch>'9')
    {
        if(ch=='-')flag=true;
        ch=getchar();
    }
    while(ch>='0' && ch<='9')
    {
        x=(x<<3)+(x<<1)+ch-'0';
        ch=getchar();
    }
    return flag?-x:x;
}
int lcm(int a,int b)
{
	return a/__gcd(a,b)*b;
}
const int MAX_N=505;
int n;
int C[MAX_N],S[MAX_N],F[MAX_N];
int T[MAX_N];
void solve(int s)
{
	T[s]=S[s];
	For(i,s+1,n-1)
	{
		T[i]=T[i-1]+C[i-1];
		T[i]=ceil(1.0*T[i]/F[i])*F[i];
		T[i]=max(T[i],S[i]);
	}
	if(s<n)T[n]=T[n-1]+C[n-1];
	cout<<T[n]<<endl;
}
int main()
{
	cin>>n;
	For(i,1,n-1)cin>>C[i]>>S[i]>>F[i];
	For(i,1,n)solve(i);
	return 0;
}




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

int main(){
	int n, x, max, cnt;
	cin >> n;
	vector<int> h;
	for(int i=0; i<n; i++){
		cin >> x;
		h.push_back(x);
	}
	max = 0;
	cnt = 0;
	for(int i=0; i<n; i++){
		if(h[i] >= max){
			cnt++;
			max = h[i];
		}
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 256
#define MAX_H 500000

#include <iostream>
using namespace std;

int H = 0;

int left(int i){return 2 * i;}
int right(int i){return 2 * i + 1;}

void maxHeapify(int A[], int i){
    int l = left(i);
    int r = right(i);
    
    int largest;
    
    if(l <= H && A[l] > A[i])largest = l;
    else largest = i;
    if(r <= H && A[r] > A[largest])largest = r;
    
    if(largest != i){
        int tmp = A[i];
        A[i] = A[largest];
        A[largest] = tmp;
        maxHeapify(A, largest);
    }
    
}

void buildMaxHeap(int A[]){
    for (int i=H/2; i > 0; i--){
         maxHeapify(A, i);
    }
}

int main(void){
    // Your code here!
    int A[MAX_H + 1];
    int n;
    cin >> n;
    H=n;
    for(int i = 1; i <= n; ++i){
        cin >> A[i];
    }
    
    buildMaxHeap(A);
    
    for(int i = 1; i <= n; ++i){
        cout << " " << A[i];
    }
    
    cout << endl;
    
    return 0;
}



Measured memory_bytes: 5008
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

template <typename T>
struct edge
{
    int src, to;
    T cost;
    edge(int to, T cost) : src(-1), to(to), cost(cost) {}
    edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
    edge &operator=(const int &x)
    {
        to = x;
        return *this;
    }
    operator int() const { return to; }
};

template <typename T>
using Edges = vector<edge<T>>;

template <typename T>
using WeightedGraph = vector<Edges<T>>;

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

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

//G[i][i] = 0 ; if G[i][i] < 0 -> G has negative cycles
//check!!! infll
template <typename T>
void Warshall_Floyd(Matrix<T> &g, T INF)
{
    int N = g.size();
    for (int k = 0; k < N; k++)
    {
        for (int i = 0; i < N; i++)
        {
            for (int j = 0; j < N; j++)
            {
                if (g[i][k] == INF || g[k][j] == INF)
                    continue;
                g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
            }
        }
    }
}

int main()
{
    int V, E;
    scanf("%d %d", &V, &E);
    Matrix<int> mat(V, vector<int>(V, INT_MAX));
    for (int i = 0; i < V; i++)
        mat[i][i] = 0;
    for (int i = 0; i < E; i++)
    {
        int x, y, z;
        scanf("%d %d %d", &x, &y, &z);
        mat[x][y] = z;
    }
    Warshall_Floyd(mat, INT_MAX);
    for (int i = 0; i < V; i++)
    {
        if (mat[i][i] < 0)
        {
            puts("NEGATIVE CYCLE");
            return 0;
        }
    }
    for (int i = 0; i < V; i++)
    {
        for (int j = 0; j < V; j++)
        {
            if (j > 0)
                putchar(' ');
            if (mat[i][j] == INT_MAX)
                printf("INF");
            else
                printf("%d", mat[i][j]);
        }
        putchar('\n');
    }
}


Measured memory_bytes: 3296
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
long long getDigit(long long n);      // 数字の桁数を取得する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      ((a)/GCD((a),(b))*(b))
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;

// code
// ------------------------------------------------
int main()
{

  ll n,m;
  cin >> n >> m;

  vll l(n,0),r(n+1,0);

  rep(i,m)
  {
    ll a,b;
    cin >> a >> b;

    l[a-1]++;
    r[b]++;
  }

  ll imo = 0;
  ll cnt = 0;
  rep(i,n)
  {
    imo += l[i] - r[i];
    if(imo ==  m) cnt++;
  }

  cout << cnt << endl;

  return 0;
}
// funcの実体
// ------------------------------------------------
ll getDigit(ll n)
{
  int i = 1;
  while(1)
  {
    n = n / 10;
    if(n == 0)
      break;
    i++;
  }
  return i;
}
ll CalcSumOfDigit(ll n)
{
  ll s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 1792
#include <stdio.h>

int main()
{
	
	int n, i, a;
	int ans = 0;
	
	scanf ("%d", &n);
	
	while (n--) {
		scanf ("%d", &a);
		
		for(i = 2; i * i <= a; i++) {
			if(a % i == 0)
				break;
		}
		
		if(i * i > a) ans++;
	}
	
	printf ("%d\n", ans);
	
	return 0;
}


Measured memory_bytes: 2124
#include <bits/stdc++.h>
#include <math.h>
#define ALL(a)    a.begin(), a.end() 
#define rep(i, K, N)  for(long long int i = K; i < N; i++)
#define ll long long int
#define PP 1000000007
using namespace std;

ll N, M;

ll f(ll A){
ll countA = 0;

while(A > 0){
A /=10;
countA++;}
return countA;
}

ll F(ll a, ll b){
  
if(b > f(a))return -1;

else{
  
  rep(i, 0, b - 1)a /= 10;

  return a%10;
  
}

}

int main() {
ll Ans = 0;cin >> N;
vector<vector<ll>> V(10, vector<ll> (10));

rep(i, 1, N + 1){

  V[F(i, f(i))][F(i, 1)]++;
  
  //cout << F(i, 1) << " " << F(i, f(i)) << endl;

}

rep(i, 0, 10){

  rep(j, 0, 10){

    Ans += V[i][j]*V[j][i];

  }
}

cout << Ans;

}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod = 1000000007;

ll r(ll x, ll y) {
  if (y == 0) return 1;
  else if (y % 2 == 0) return r(x, y/2) * r(x, y/2) % mod;
  else return x * r(x, (y-1)/2) % mod * r(x, (y-1)/2) % mod;
}

int n;
vector<ll> v(0);
vector<bool> F(10, 1);
ll f, s;
ll ff, ss;

void dfs(ll x) {
  int N = r(10, n-1);
  if (x / N > 0) {
    v.push_back(x);
    if (x == f) ff = v.size();
    if (x == s) ss = v.size();
    return;
  }

  for (int i = 0; i < n; i++) {
    if (F[i]) {
      ll y = 10 * x + i + 1;
      F[i] = 0;
      dfs(y);
      F[i] = 1;
    }
  }
}


int main() {
  cin >> n;
  for (int i = 0; i < n;i++) {
    int x;
    cin >> x;
    f = f * 10 + x;
  }
  for (int i = 0; i < n;i++) {
    int x;
    cin >> x;
    s = s * 10 + x;
  }
  dfs(0);
  cout << max(ss, ff) - min(ss, ff) <<endl;
}

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

const string YES = "Yes";
const string NO = "No";

void solve(std::string S)
{
    map<char,int> mp;
    for(unsigned int i=0;i<S.size();i++)
    {
        mp[S[i]]++;
    }
    if(mp['A']&&mp['B'])
        cout<<YES<<endl;
    else
        cout<<NO<<endl;
}

int main()
{
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

int main(int argc, char const *argv[]) {
    int n,d;cin>>n>>d;
    int ans = 0;
    int now = 0;
    while (true) {
        ans++;
        now++;
        now+=d;now+=d;
        if (now>=n) break;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
lst = list(map(int, input().split()))
lst.sort(reverse=True)
comdiv = [1]
MAX = lst[0] // 2 + 1
for i in range(2, MAX + 1):
	if n == 2:
		if lst[0] % i == 0 and lst[1] % i == 0:
			comdiv.append(i)
	if n == 3:
		if lst[0] % i == 0 and lst[1] % i == 0 and lst[2] % i == 0:
			comdiv.append(i)

for j in comdiv:
	print(j)



Measured memory_bytes: 5596
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


x = int(input())
ans = -((x+1)//200 + int((x+1)%200!=0))+11
print(ans)

Measured memory_bytes: 61836
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}

signed main() {
    string s;
    cin >> s;

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

Measured memory_bytes: 256
#include<stdio.h>

int main(){

  int f[45],i,n;

  scanf("%d",&n);

  f[0]=1;
  f[1]=1;

  for(i=2;i<=n;i++){
    f[i]=f[i-2]+f[i-1];
  }

  printf("%d\n",f[n]);

  return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class X> void DEBUG(X d, T e){if(DEBUG_OUT == false)return;std::cout <<d<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//CODE
template< typename T >
size_t longest_increasing_subsequence(const vector< T > &a, bool strict) {
  vector< T > lis;
  for(auto &p : a) {
    typename vector< T >::iterator it;
    if(strict) it = lower_bound(begin(lis), end(lis), p);
    else it = upper_bound(begin(lis), end(lis), p);
    if(end(lis) == it) lis.emplace_back(p);
    else *it = p;
  }
  return lis.size();
}

void solve(void)
{
  int N,A;
  cin>>N>>A;
  if(N%500 - A <= 0)
  {
    cout<<"Yes"<<endl;
  }
  else
  {
    cout<<"No"<<endl;
  }
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();
  

 
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;
#define N 26

int main(){
 ll d;
 cin>>d;
 ll c[N];
 for(ll i=0;i<N;i++)cin>>c[i];
 ll s[d][N];
 for(ll i=0;i<d;i++)for(ll j=0;j<N;j++)cin>>s[i][j];

 ll ansv=0,v=0;
 vector<ll> ans(d,0),now(d,0);
 for(ll i=0;i<N;i++){
  vector<ll> tmp(d,i);
  ll tv = 0;
  for(ll j=0;j<d;j++)  tv += s[j][i];
  if( tv > v ){
   ansv = v = tv;
   ans = now = tmp;
  }
 }


 for(ll i=0;i<d;i++)cout<<ans[i]+1<<endl;


    return 0;
}


Measured memory_bytes: 3732
h = gets.chomp.to_i

if h == 0
  puts '0'
  exit
end

powers = 0
loop do
  if h < 2 ** powers
    break
  end
  powers = powers + 1
end

atks = (0...powers).map { |x| 2 ** x }.reduce(:+)

puts "#{atks}"


Measured memory_bytes: 1788