akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <cmath>
#include <iomanip>
#include <ios>
#include <sstream>
using namespace std;

int main(){
    // input
    unsigned int n;
    int t, a, tmp;
    cin >> n >> t >> a;
    vector<int> data(n);
    for (int i = 0; i < n; ++i) {
        cin >> tmp;
        data[i] = tmp;
    }

    //process
    double nc = abs((t - data[0] * 0.006) - a), np = 0, c;
    for (int j = 0; j < n; ++j) {
        c = t - data[j] * 0.006;
        if (abs(c - a) < nc) {
            nc = abs(c - a);
            np = j;
        }
    }

    // output
    cout << np + 1 << endl;

    return 0;
}


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

int main() {
    int N;
    scanf("%d",&N);
    int h[N];
    int dp[N];
    for (int i = 1; i <= N; i++) {
        scanf("%d",&h[i]);
    }
    
    dp[0] = 0;
    for (int i = 1; i <= N -1; i++) {
        dp[i] = dp[i - 1] + abs(h[i]-h[i+1]);
        if (i > 1) {
            if (dp[i] > (dp[i - 2] + abs(h[i - 1]-h[i + 1] ))) {
                dp[i] = dp[i - 2] + abs(h[i - 1] - h[i + 1]);
            }
        }
    }
    printf("%d",dp[N -1]);
    return 0;
}


Measured memory_bytes: 896
/*He who forgives and acknowledges himself... that is what it truly means to be strong!*/
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <functional>
#include <list>
#include <deque>
#include <bitset>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <sstream>
#include <complex>
#include <iomanip>
#include <numeric>
#include <cassert>
#include <climits>
#include <utility>
#include <ctime>
#include <tuple>
#include <fstream>
#define T int test_case; scanf("%d",&test_case); while(test_case--)
#define FOR(i,a,n) for(i=a;i<n;i++)
#define FORD(i,a,n) for(i=a;i>=n;i--)
#define FORS(i,a) for(i=0;a[i];i++)
#define si(x) scanf("%d",&x)
#define sc(x) cin>>x
#define sd(x) scanf("%lf",&x)
#define sll(x) scanf("%lld",&x)
#define ss(x) scanf("%s",x)
#define prs(x) printf("%d ",x)
#define pls(x) printf("%lld ",x)
#define pc(x) printf("%c",x)
#define pi(x) printf("%d\n",x)
#define pd(x) cout.precision(10),cout<<fixed<<x<<endl;
#define pll(x) printf("%lld\n",x)
#define ps(x) printf("%s\n",x)
#define M 1000000007
#define ll long long
#define mp make_pair
#define all(x) x.begin(),x.end()
#define pb push_back
#define fr first
#define se second
#define in insert
#define er erase
#define pii pair<int, int>
#define plll pair<long long, long long>
#define tr(x,it) for(auto it : x)
#define INF 1ll<<60
#define PI 3.14159265358979323846264338327950288419716939937510582097494459230
#define bs(x,lo,hi,mid) cout<<x<<" "<<lo<<" "<<hi<<" "<<mid<<endl;
using namespace std;
ll gcd (ll a, ll b) {return ( a ? gcd(b%a, a) : b );}
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n&1) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n&1) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}
vector<int> prime;
bool primee[10000000];
void primegen(ll x) { for(ll i=2;i*i<=x;i++) if(!primee[i]) for(ll j=i*i;j<=x;j+=i) primee[j]=true; for(ll i=2;i<=x;i++) if(!primee[i]) prime.push_back(i);}

int a[55][2],b[55][2];

int main()
{
   int i,j;
   int n,m;
   si(n);
   si(m);
   FOR(i,0,n)
   	si(a[i][0]),si(a[i][1]);
   FOR(i,0,m)
   	si(b[i][0]),si(b[i][1]);
   FOR(i,0,n)
   {
   	int mn=INT_MAX,k;
   	FOR(j,0,m)
   		if(abs(a[i][0]-b[j][0])+abs(a[i][1]-b[j][1])<mn)
   		{
   			mn=abs(a[i][0]-b[j][0])+abs(a[i][1]-b[j][1]);
   			k=j;
   		}
   	pi(k+1);
   }
   return 0;
}


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

using namespace std;

int main()
{
  int a;
  string s;
  
  cin >> a;
  cin >> s;
  
  if(a >= 3200)
  {
    cout << s;
  }
  else
  {
    cout << "red";
  }
}

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

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if (a+b > c+d){
    cout << "Left" << endl;
  }
  else if (a+b < c+d){
    cout << "Right" << endl;
  }
  else {
    cout << "Balanced" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <inttypes.h>
 
#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dump() fprintf(stderr, "#%s.%d\n", __func__, __LINE__);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
typedef int64_t Int;
typedef std::vector<Int> LI;
typedef std::queue<Int> QI;
#define rep(i,n) for(Int i = 0; i < (Int)n; ++i)
const double pi = 3.14159265358979323846264338;
const Int mod = 1000000007;
 
template<typename T> void scan1(T& x) { fprintf(stderr, "unknown type\n"); }
template<> void scan1(Int& x) { if( scanf("%" PRId64, &x) < 0 ) exit(0); }
template<> void scan1(std::string& x) { if( not ( std::cin >> x ) ) exit(0); }
template<> void scan1(LI& xs) { for(Int &x : xs) scan1(x); }
void scan() {}
template<typename Head, typename... Tail>
void scan(Head& x, Tail&... xs) {
  scan1(x); scan(xs...);
}
 
struct Solver {
   Solver() { fprintf(stderr, "--------Solver begin--------\n"); }
   ~Solver() { fprintf(stderr, "--------Solver end--------\n"); }
   void solve() {
      Int x, t; scan(x, t);
      Int res = std::max((Int)0, x - t);
      printf("%" PRId64 "\n", res);
   }
};
 
int main() {
   loop std::unique_ptr<Solver>(new Solver())->solve();
}

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

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

int main(){
	while(true){
		int a,b;
		cin>>a>>b;
	
		if(cin.eof())
			break;
	
		int g=gcd(a,b);
		cout<<g<<' '<<a/g*b<<endl;
	}
	return 0;
}


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

int main(){
	int n, k;
	cin >> n >> k;
	vector<int> p(n);
	for(int i=0;i < n;i++){
		cin >> p.at(i);
	}
	sort(p.begin(),p.end());
	int ans = 0;
	for(int i=0;i < k;i++){
		ans += p.at(i);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  int A, B;
  cin >> A >> B;

  char white = '.';
  char black = '#';

  A--;
  B--;
  vector<vector<char>> field(100,vector<char>(100,'*'));
  rep(i,100){
    rep(j,100){
      if(i<50){
        field[i][j] = black;
      }else{
        field[i][j] = white;
      }
    }
  }
  for(int i=0; i<50; i+=2){
    for(int j=0; j<100; j+=2){
      if(A>0){
        field[i][j] = white;
        A--;
      }
      if(B>0){
        field[i+51][j] = black;
        B--;
      }
    }
  }

  

  
  cout << 100 << " " << 100 << endl;
  rep(i,100){
    rep(j,100){
      cout << field[i][j];
    }
    cout << endl;
  }
  
  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	string a;
	cin>>a;
	if(n>=a.length())
	{
		cout<<a;
		return 0;
	}
	for(int i=0;i<n;i++)
	{
		cout<<a[i];
	}
	cout<<"...";
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define inf 0x3f3f3f3f

using namespace std;

struct Edge {
  int t,f,next;
  Edge() {}
  Edge(int a,int b,int c):t(a),f(b),next(c) {}
};

Edge e[1000000];
int head[200005],vs,vt,tot=-1;

inline void addEdge(int x,int y,int z) {
  e[++tot]=Edge(y,z,head[x]);
  head[x]=tot;
  e[++tot]=Edge(x,0,head[y]);
  head[y]=tot;
}

namespace Flow {
	
int d[200005],cur[200005];
queue <int> q;

bool bfs() {
  while (!q.empty()) q.pop();
  memset(d,255,sizeof(d));
  d[vs]=0;cur[vs]=head[vs];
  q.push(vs);
  while (!q.empty()) {
  	int x=q.front();q.pop();
  	for(int i=head[x];i!=-1;i=e[i].next)
  	  if (e[i].f&&d[e[i].t]==-1) {
  	  	  int u=e[i].t;
  	  	  d[u]=d[x]+1;
  	  	  cur[u]=head[u];
  	  	  if (u==vt) return 1;
  	  	  q.push(u);
		}
  }
  return 0;
}

int dfs(int x,int a) {
  if (x==vt||!a) return a;
  int ans=0;
  for(int &i=cur[x];i!=-1;i=e[i].next)
    if (e[i].f&&d[e[i].t]==d[x]+1) {
    	int u=e[i].t;
    	int f=dfs(u,min(a,e[i].f));
    	if (f) {
    		e[i].f-=f;
    		e[i^1].f+=f;
    		ans+=f;
    		a-=f;
    		if (!a) break;
		}
	}
  return ans;
} 

int maxflow() {
  int ans=0;
  while (bfs())
    ans+=dfs(vs,inf);
  return ans;
}
	
}

vector <int> bel[100005];
bool vis1[100005],vis2[100005];
int id[100005],nxt[100005];

queue <int> q;

bool solve(int n) {
  for(int i=1;i<n;i++)
    for(int j=head[n+i];j!=-1;j=e[j].next)
      if (e[j].t&&!e[j].f) {
      	int u=e[j].t;
      	id[i]=u;
      	vis1[u]=1;
	  }
  for(int i=1;i<=n;i++)
    if (!vis1[i]) q.push(i);
  int cnt=0;
  while (!q.empty()) {
  	int x=q.front();q.pop();
  	cnt++;
  	for(int i=0;i<bel[x].size();i++)
  	  if (!vis2[bel[x][i]]) {
  	  	  int u=bel[x][i];
  	  	  vis2[u]=1;
  	  	  nxt[u]=x;
  	  	  q.push(id[u]);
		}
  }
  return cnt==n;
}

int main() {
  memset(head,255,sizeof(head));
  int n;
  scanf("%d",&n);
  vs=0;vt=2*n;
  for(int i=1;i<n;i++) {
  	int x;
  	scanf("%d",&x);
  	addEdge(vs,n+i,1);
  	for(int j=1;j<=x;j++) {
  		int y;
  		scanf("%d",&y);
  		addEdge(n+i,y,1);
  		bel[y].push_back(i);
	  }
  }
  for(int i=1;i<=n;i++) addEdge(i,vt,1);
  if (Flow::maxflow()<n-1) {
  	puts("-1");
  	return 0;
  }
  if (!solve(n)) {
  	puts("-1");
  	return 0;
  }
  for(int i=1;i<n;i++) printf("%d %d\n",id[i],nxt[i]);
  return 0;
}

Measured memory_bytes: 23084
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>

ll n,cnt,a[ohara],b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
ll cou[ohara];
V ans;

//-------------------------↓↓↓↓↓↓------------------------

//------ 自分を天才だと信じる ------

std::vector<ll> enum_div(ll n)//nの約数を列挙
{
	std::vector<ll> ret;
	for(ll i=1 ; i*i<=n ; ++i)
	{
		if(n%i == 0)
		{
			ret.push_back(i);
			if(i!=1 && i*i!=n)
			{
				ret.push_back(n/i);
			}
		}
	}
	return ret;
}

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

    cin>>n;
    rep(i,n)cin>>a[i];
    rrrep(i,n,1){
        if(cou[i]%2==a[i-1]%2)continue;
        std::vector<ll> r = enum_div(i);
	    for(auto j : r){
            cou[j]++;
        }  
        ans.push_back(i);
    }
    sort(all(ans));
    Cout(Size(ans));
    rep(i,Size(ans))Cout(ans[i]);
    return 0;
}


Measured memory_bytes: 7028
#include <stdio.h>
 
int main(void) {
  
  int K, N, i;
  int max=0;
  int kyori;
  
  scanf("%d",&K);
  scanf("%d",&N);
  
  int A[N];
  int B[N];
  
  for(i=0; i<N; i++){
    scanf("%d", &A[i]);
  }
  
  for(i=0; i<N-1; i++){
    B[i] = A[i+1] - A[i];
  }
  
  B[N-1] = A[0] - A[N-1] + K;
  
  for(i=0;i<N;i++){
    if(max<B[i])
      max=B[i];
  }
  
  kyori = K - max;
  
  printf("%d\n", kyori);
  
  return 0;
}

Measured memory_bytes: 1664
N, K = map(int, input().split())
H = [0] + [int(a) for a in input().split()]
X = [[1<<100] * (N-K+1) for _ in range(N+1)]
X[0][0] = 0
for i in range(1, N+1):
    for j in range(1, min(i+1, N-K+1)):
        X[i][j] = min([X[ii][j-1] + max(H[i] - H[ii], 0) for ii in range(i)])

print(min([x[-1] for x in X]))

Measured memory_bytes: 46428
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,D;
  cin >> N >> D;
  int n=N/(2*D+1);
  int c=0;
  if (N%(2*D+1)==0){
    c=n;
  }
  else{
    c=n+1;
  }
  cout << c << endl;
}


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

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

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;
	N++;

	lint sum = 0;
	for (int i = 1; i < N; i++) {
		for (int j = 1; j < N; j++) {
			for (int k = 1; k < N; k++) {
				sum += gcd(gcd(i, j), k);
			}
		}
	}

	cout << sum << "\n";

	return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<deque>
#include<cstdio>
#include<cstdio>
#include<time.h>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define pd(a,n) for(int i=0;i<n;i++)cout<<a[i]<<((i==n-1)?"\n":" ")
#define pdd(a,n,m)for(int i=0;i<m;i++)pd(a,m)
#define mp make_pair
#define pb push_back
#define ll __int64
#define __int64 long long
#define P pair<int,int>
#define PP pair<P,int>

int n;
int h[111111];
int dp[111111];
const int INF=1111111111;

int main(){
  cin>>n;
  rep(i,n)cin>>h[i];
  rep(i,n)dp[i]=INF;
  dp[0]=0;
  rep(i,n){
    for(int k=1;k<=2;k++)
      dp[i+k]=min(dp[i+k],dp[i]+abs(h[i+k]-h[i]));
  }
  cout<<dp[n-1]<<endl;

  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using ll = long long;
using P = pair<ll,ll>;
using vec = vector<ll>;
using vecp = vector<P>;
using mat = vector<vec>;
using matp = vector<vecp>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define all(v) v.begin(), v.end()


int main(){
  ll N;
  cin >> N;
  cout << (N+1)/2 << endl;
}

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

using namespace std;
#define REPP(i,a,b,c) for(int i=a; i<=b; i+=c)
#define REP(i,a,b) REPP(i,a,b,1)
#define REVV(i,a,b,c) for(int i=a; i>=b; i-=c)
#define REV(i,a,b) REVV(i,a,b,1)
#define FOR(i,a) REP(i,0,(int)a-1)
#define FORD(i,a) REV(i,(int)a-1,0)
#define PB push_back
#define POB pop_back
#define FI first
#define SE second
#define MP make_pair
typedef long long ll;
typedef unsigned long long ull;
typedef pair < int , int > pii;
typedef vector < int > vi;
typedef vector < pii > vii;
typedef vector < ll > vl;
typedef pair < ll , ll > pll;

const double PI = acos(-1);
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;
const int INF = 1e9;
	

ll addMod(ll a, ll b){
	if(a + b >= MOD) return a + b - MOD;
	return a + b;
}

ll mulMod(ll a, ll b){
	return (a*b)%MOD;
}

ll fast(ll a, ll b){
	if(b == 0) return 1;
	ll tmp = fast(a,b/2);
	tmp = mulMod(tmp,tmp);
	if(b%2 == 1) tmp = mulMod(tmp,a);
	return tmp;
}

ll GCD(ll a, ll b){
	if(a > b) return GCD(b,a);
	if(a == 0) return b;
	return GCD(b%a,a);
}

#define getc getchar
template<typename T>
T getnum(){
	int sign = 1;
	T ret = 0;
	char c;

	do{
		c = getc();
	}while(c == ' ' || c == '\n');
	if(c == '-')sign = -1;
	else ret = c-'0';
	while(1){
		c = getc();
		if(c < '0' || c > '9')break;
		ret = 10*ret + c-'0';
	}
	return sign * ret;
}

inline void ini(int& x){
	x = getnum<int>();
}

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

int n;
int d[55];

int main(){
	ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	FOR(i,n) cin >> d[i];
	int ans = 0;
	FOR(i,n){
		REP(j,i+1,n-1){
			ans += d[i] * d[j];
		}
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(a) (a).begin(),(a).end()
#define PI 3.141592653589793238
#define INF 1050000000
#define INFL (long long)(4e18)

using vi = vector<int>;


int main() {


	int N, M;

	cin >> N >> M;

	cout << ((N==M) ? "Yes" : "No") << endl;
	return 0;
}

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

public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		int K = scan.nextInt();
		
		List<Integer> list = new ArrayList<>();
		for (int i = 1; i <= A; i++) {
			if ((A % i == 0) && (B % i == 0)) {
				list.add(i);
			}
		}
		
		System.out.println(list.get(list.size() - K));
		
		scan.close();
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
 
using namespace std;
 
int main() {
    int N;
    cin >> N;
    float avg=0;
    vector<int> a;
    for(int i=0;i<N;i++) {
        int t;
        cin >> t;
        avg+=t;
        a.push_back(t);
    }
    int ans=*max_element(a.begin(),a.end());
    for(int i=1;i<N;i++) {
        int aa=0,bb=0;
        for(int j=0;j<i;j++) {
            aa+=a[j];
        }
        for(int j=i;j<N;j++) {
            bb+=a[j];
        }
        ans = min(max(aa,bb)-min(aa,bb), ans);
    }
    
    cout << ans;
}


Measured memory_bytes: 256
N = int ( input().strip() ) ;
L = list (map ( int , input().strip().split(" " ) ) ) ;
L = list( filter (lambda x:x%2==0 ,  L )) ;

if all ( map( lambda x:x%3==0 or x%5==0  , L ) ) :
	print ( "APPROVED" ) ; 
else :
	print ("DENIED") ;

Measured memory_bytes: 3060
// template version 1.2
using namespace std;
#include <iostream>
#include <bits/stdc++.h>

#define infile "../test/sample-1.in"
#define int long long
// #define INF 2147483647
#define INF 1000000000000000000LL
#define MOD 1000000007LL

// {{{ define basic macro
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)

#define foreach(x,a) for(auto& (x) : (a) )
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)

#define all(x) (x).begin(),(x).end()
#define sum(v) accumulate(all(v), 0LL)
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ten(n) ((int)1e##n)

template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }

template<typename A, size_t N, typename T> // n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

template <class T = int>
T in() {T x; cin>>x; return (x);}

struct Fast {
  Fast(){
    std::cin.tie(0);
    ios::sync_with_stdio(false);
  }
} fast;
// }}}
//{{{ dump macro
#ifdef PCM
  #include "dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}
//{{{ others
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;
template<typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;

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


int solve(){
  string s;cin>>s;
  int n = sz(s);
  int cnt[26] = {};
  rep(i, n){
    cnt[s[i]-'a']++;
  }

  int fnullidx = -1;
  rep(i, 26){
    if (cnt[i]==0) {
      fnullidx = i;
      break;
    }
  }
  dump(fnullidx);

  if (sz(s)<=25) {
    s += (char)(fnullidx + 'a');
    cout << s << endl;
  }
  else{
    if (s=="zyxwvutsrqponmlkjihgfedcba"){
      cout << -1 << endl;
    }
    else{
      int pre = s[n-1];
      int idx = n-1;
      rrep(i, n-1){
        if (s[i]>pre) {
          pre = s[i];
        }
        else{
          idx = i;
          break;
        }
      }
      dump(idx);
      int min = INF;
      rep(i, idx+1, n){
        if (s[idx] < s[i]){
          dump("hello");
          chmin(min, (ll)(s[i]-'a'));
        }
      }
      dump(min);
      cout << s.substr(0, idx) + (char)(min+'a') << endl;
    }
  }

  return 0;
}

int test(){ //{{{
  return 0;
}
//}}}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
#ifdef PCM
  test();
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Apolloliu
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

using namespace std;

#define MEM(a,b)    memset(a, b, sizeof(a))
#define UN(a)       sort(all(a)), a.erase(unique(all(a)), a.end())
#define REV(a)      reverse(all(a))
#define MP(a, b)    make_pair(a, b)
#define PAIR(a, b)  pair<int, int>(a, b)

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

const int MOD = 1e9 + 7;
const int maxn = 1;
const double EPS = 1e-8;

class BKThCommonDivisor {
public:
	void solve(std::istream& in, std::ostream& out) {
		int a, b, k;
		in>>a>>b>>k;
		vector<int>v;
		v.clear();
		for(int i = 1; i <= 100; ++i)if(a % i == 0 && b % i == 0)v.push_back(i);
		sort(v.begin(), v.end(), greater<int>());
		out<<v[k-1]<<endl;
	}
};


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	BKThCommonDivisor solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const ll mod = 1e9 +7;
const ll MAXN = 1e6 + 5;


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a[3];
	cin>>a[0]>>a[1]>>a[2];
	sort(a,a+3);
	bool flag=0;
	if(a[1]==a[0] && a[0]!=a[2]){
		flag=1;
	}
	if(a[1]==a[2] && a[0]!=a[2]){
		flag=1;
	}
	if(flag) cout<<"Yes";
	else cout<<"No";
	return 0;
}


Measured memory_bytes: 256
//AUTHOR - NAVEEN KUMAR(@naveen19991124)
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#inlcude<boost/multiprecision/cpp_dec_float.hpp>
#define ll long long
#define pb push_back
#define f(a) for(ll i = 0;i<a;i++)
#define rep(i,a,b) for(ll i = a;i<b;i++)
#define rrep(i,a,b) for(ll i = a;i>b;i--)
#define v vector<ll>
#define mp make_pair
#define fir first
#define sec second
#define _fast_ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
//using boost :: multiprecision :: cpp_int;
//using boost :: multiprecision :: cpp_dec_float_50;
//using boost :: multiprecision :: cpp_dec_float_100;
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}

ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1;
a *= a; a %= mod;} return p % mod;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
int main()
{
    _fast_
    ll t = 1;
  //  cin>>t;
    while(t--){
    ll n,k;
    cin>>n>>k;
    ll arr[k];
    f(k)
    {
        cin>>arr[i];
    }
    ll dis = 0;
    for(ll i = 1;i<k;i++)
    {
        dis += arr[i]-arr[i-1];
    }
    dis += n-arr[k-1]+arr[0];
    ll diff = INT_MIN;
    rep(i,1,k){
        ll val = arr[i]-arr[i-1];
        diff = max(diff,val);
    }
    ll val = arr[0]+n-arr[k-1];
    diff = max(diff,val);
    cout<<dis-diff<<"\n";

    }
    return 0;
}

Measured memory_bytes: 1792
import std.algorithm, std.conv, std.range, std.stdio, std.string;

void readV(T...)(ref T t){auto r=readln.splitter;foreach(ref v;t){v=r.front.to!(typeof(v));r.popFront;}}
void readA(T)(size_t n,ref T t){t=new T(n);auto r=readln.splitter;foreach(ref v;t){v=r.front.to!(ElementType!T);r.popFront;}}
void readM(T...)(size_t n,ref T t){foreach(ref v;t)v=new typeof(v)(n);foreach(i;0..n){auto r=readln.splitter;foreach(ref v;t){v[i]=r.front.to!(ElementType!(typeof(v)));r.popFront;}}}
void readS(T)(size_t n,ref T t){t=new T(n);foreach(ref v;t){auto r=readln.splitter;foreach(ref j;v.tupleof){j=r.front.to!(typeof(j));r.popFront;}}}

void main()
{
  int a, b; readV(a, b);
  writeln((a+b+1)/2);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define forn(i,b) for(int i=0 ; i< b ;i++)
#define for1(i,b) for(int i=1 ; i<=b ;i++)
#define reps(i,a,b) for(int i=a ; i< b.length() ;i++)
typedef long long ll;
#define MOD 1000000007

using namespace std;




int main()
{
  //Compute lcm of two numbers
  ll a,b,lcm,max;
  cin>>a>>b;
  lcm=(a*b)/(__gcd(a,b));
cout<<lcm;
  return 0 ;
}


Measured memory_bytes: 256
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 2
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}

	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	m := getNextInt(scanner)
	k := getNextInt(scanner)
	cm := Com{}
	cm.init(n + 1)

	sep := make([]int64, n+1)
	sep[0] = int64(m)
	for i := 1; i < n+1; i++ {
		sep[i] = mod(sep[i-1] * int64(m-1))
	}

	var ans int64
	for i := 0; i < k+1; i++ {
		ans = mod(ans + mod(cm.calc(n-1, n-1-i)*sep[n-1-i]))
	}
	fmt.Fprintln(writer, ans)
}

func mod(x int64) int64 {
	m := int64(998244353)

	return (x%m + m) % m
}

// Com ...
type Com struct {
	facs, invs []int64
	mod        int64
}

func (cm *Com) init(n int) {
	cm.facs = make([]int64, n+1)
	cm.invs = make([]int64, n+1)

	cm.facs[0] = 1
	cm.mod = int64(998244353)
	for i := 1; i <= n; i++ {
		cm.facs[i] = (cm.facs[i-1] * int64(i)) % cm.mod
	}
	cm.invs[n] = cm.inv(cm.facs[n])
	for i := n - 1; i >= 0; i-- {
		cm.invs[i] = cm.invs[i+1] * int64(i+1) % cm.mod
	}
}

func (cm *Com) inv(n int64) int64 {
	var ii [32]int64
	ii[0] = n
	for i := 1; i < 31; i++ {
		ii[i] = (ii[i-1] * ii[i-1]) % cm.mod
	}
	var ans int64
	ans = 1
	m := cm.mod - 2
	for i := 30; i >= 0; i-- {
		for m >= 1<<uint(i) {
			ans = (ans * ii[i]) % cm.mod
			m -= 1 << uint(i)
		}
	}

	return ans
}

func (cm *Com) calc(n, k int) int64 {
	ans := cm.facs[n] * cm.invs[k]
	ans %= cm.mod
	ans = ans * cm.invs[n-k]
	ans %= cm.mod
	return ans
}


Measured memory_bytes: 6720
using System;
using System.Linq;

public class Program
{
	public static void Main(string[] args)
	{
		int n = int.Parse(Console.ReadLine());
		int [] xArray = Console.ReadLine().Trim().Split(' ').Select(x => int.Parse(x)).ToArray();
		int[] yArray = Console.ReadLine().Trim().Split(' ').Select(x => int.Parse(x)).ToArray();

		double p1 = 0.0;
		double p2 = 0.0;
		double p3 = 0.0;
		double infinity = 0.0;
		for (int i = 0; i < n; i++)
		{
			p1 += Math.Abs(xArray[i] - yArray[i]);
		}
		Console.WriteLine(p1);
		for (int i = 0; i <n; i++)
		{
			p2 += Math.Pow(Math.Abs(xArray[i] - yArray[i]),2);
		}
		Console.WriteLine(Math.Sqrt(p2));
		for (int i = 0; i < n; i++)
		{
			p3 += Math.Pow(Math.Abs(xArray[i] - yArray[i]), 3);
		}
		Console.WriteLine(Math.Pow(p3,1.0 / 3.0));
		for (int i = 0; i < n; i++)
		{
			if (Math.Abs(xArray[i] - yArray[i]) > infinity)
			{
				infinity = Math.Abs(xArray[i] - yArray[i]);
			}
		}
		Console.WriteLine(infinity);
		//var ss = new StreamScanner();
		//---------------------------------
		//????????????int, double, string?????????????????£????????????


		//int x = ss.Next<int>();
		//double d = ss.Next<double>();
		//string s = ss.Next<string>();

		//?????°???????????????????????¨?????????????????????????????????????????????????´???????
		//int[] array = ss.Next<int>(10);
		//---------------------------------

	}
}
public class StreamScanner
{
	private readonly char[] _c = { ' ' };
	private int _index = -1;
	private string[] _input = new string[0];
	private readonly System.IO.StreamReader _sr = new System.IO.StreamReader(Console.OpenStandardInput());

	public T Next<T>()
	{
		if (_index == _input.Length - 1)
		{
			_index = -1;
			while (true)
			{
				string rl = _sr.ReadLine();
				if (rl == null)
				{
					if (typeof(T).IsClass) return default(T);
					return (T)typeof(T).GetField("MinValue").GetValue(null);
				}
				if (rl != "")
				{
					_input = rl.Split(_c, StringSplitOptions.RemoveEmptyEntries);
					break;
				}
			}
		}
		return (T)Convert.ChangeType(_input[++_index], typeof(T), System.Globalization.CultureInfo.InvariantCulture);
	}

	public T[] Next<T>(int x)
	{
		var ret = new T[x];
		for (var i = 0; i < x; ++i) ret[i] = Next<T>();
		return ret;
	}

	public T[][] Next<T>(int x, int y)
	{
		var ret = new T[y][];
		for (var i = 0; i < y; ++i) ret[i] = Next<T>(x);
		return ret;
	}
}

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

int main(){
  string a,b,c;
  cin >> a >> b >> c;
  if(a[a.length()-1]==b[0]&&b[b.length()-1]==c[0]) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
from itertools import combinations
input = sys.stdin.readline

def main():
    n,m,x = map(int,input().split())
    c = [list(map(int,input().split())) for _ in range(n)]
    ans = float('inf')
    for num in range(1,n+1):
        for e in combinations(range(n),num):
            cost = 0
            under = [0 for _ in range(m)]
            for f in e:
                cost += c[f][0]
                for i in range(m):
                    under[i] += c[f][i+1]
            if min(under) >= x:
                ans = min(ans,cost)
    if ans == float('inf'):
        print(-1)
    else:
        print(ans)
 
    
if __name__ == "__main__":
    main()


Measured memory_bytes: 9240
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef pair<int, int>P;
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
typedef vector<vector<ll>> mat;
typedef vector<int> vec;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
const ll mod = 1000000007;
const ll INF = mod * mod;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll qp(ll a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };

void solve() {
    ll a,b,c,n;
    string s, t;
    ll ans;
    string text;

    cin  >> a >> s;

    text = a>=3200 ? s : "red";




    cout << text << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    //cout << fixed << setprecision(10);
    solve();
    // stop
        return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr long long MOD = 1000000007;
constexpr long long INF = 1LL << 60;
const long double PI = acosl(-1.0);
constexpr long double EPS = 1e-11;
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
int main(){
    string s;
    cin >> s;
    ll n = s.size();
    vector<ll> ans(n, 0);
    ll tmp = 1;
    for (ll i = 1; i < n;i++){
        if (s[i] == 'R') tmp++;
		else{
            ans[i] += tmp / 2;
            ans[i - 1] += (tmp + 1) / 2;
            tmp = 0;
        }
    }
    tmp = 1;
    for (ll i = n - 2; i >= 0; i--){
        if (s[i] == 'L') tmp++;
		else{
            ans[i] += tmp / 2;
            ans[i + 1] += (tmp + 1) / 2;
            tmp = 0;
        }
    }
    for (ll i = 0; i < n;i++){
        cout << ans[i] << " \n"[i == n - 1];
    }
}

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

int main() {
  int n;
  stack<int> s;
  while (cin >> n) {
    if (n == 0) {
      cout << s.top() << endl;
      s.pop();
    } else {
      s.push(n);
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main(){
    int n, k, x, y, ans;
    cin >> n >> k >> x >> y;
    if(n-k>0){
        ans = k * x + (n-k) * y;
    }else{
        ans = n * x;
    }
    cout << ans << endl;
}


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

int main(){
	int n,res=0;
  	cin >> n;
  	for(int i=1;i<=n;i++){
    	string a=to_string(i);
      	if(a.size() % 2 !=0) res++;
    }
  	cout << res << endl;
}

Measured memory_bytes: 3736
import * as fs from "fs";

function strArr2numArr(strArr: string[]): number[] {
    let numArr: number[] = [];
    strArr.map((item) => {
        numArr.push(+item);
    });
    return numArr;
}

const MOD: number = 1e9 + 7;

const input = fs.readFileSync("/dev/stdin", "utf8").split("\n");

let s: string = input[0];
let t: string = input[1];

let ans: number = 0;

for (let i = 0; i < s.length; i++) {
    if (s[i] !== t[i]) ans++;
}

console.log(ans);


Measured memory_bytes: 32880
#include <bits/stdc++.h>
using namespace std;
int a,b,c,d;
int main (){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin>>a>>b>>c;
d=a+b+c;
if(d>21){
	 cout<<"bust";
}
else{
	 cout<<"win";
}
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define lli long long int
#define tc int t;cin>>t;while(t--)
#define all(x) x.begin(),x.end()
#define f first
#define s second
#define pb push_back
#define vi vector<int>
#define vll vector<lli>
#define maxn 505


lli mpow(lli a,lli x,int mod)
{
    if(x==0)
        return 1;

    lli a1=mpow(a,x/2,mod);
    a1=(a1*a1)%mod;
    if(x&1)
        a1=(a1*a)%mod;
    return a1;
}

int main(){
    fastio;
    int n;
    cin>>n;
    string s;
    cin>>s;
    int on=0;
    for(int i=0;i<n;i++)
    {
        if(s[i]=='1') on++;
    }
    lli sm1=0,sm2=0;
    for(int i=0;i<n;i++)
    {
        if(s[i]=='1') 
        {
            if(on!=1)
            sm1+=mpow(2,n-1-i,on-1),sm1%=(on-1);
            sm2+=mpow(2,n-1-i,on+1),sm2%=(on+1);
        }
    }
    for(int i=0;i<n;i++)
    {
        int cur=0;
        if(s[i]=='0')
        {
            cur=sm2;
            cur+=mpow(2,n-1-i,on+1),cur%=(on+1);
        }
        else{
            if(on!=1){
            cur=sm1;
            cur-=mpow(2,n-i-1,on-1),cur+=(on-1),cur%=(on-1);}
        }
        int an=1;
        if(on==1 and s[i]=='1') an=0;
        while(cur){
                  int x=__builtin_popcount(cur);
                  cur=(cur%x);
                  an++;
        }
        cout<<an<<"\n";
    }
    return 0;
}

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

struct Data{
  int used;
  int credit;
};

int n,U,c,k,r;
int credit[20],required[20];

int bitcount(int n){return n?(n&1)+bitcount(n>>1):0;}
int BFS(){
  bool visited[1<<20]={0};
  queue<Data>q;
  Data now={0,0};
  q.push(now);
  while(!q.empty()){
    now=q.front();
    q.pop();
    if(visited[now.used])continue;
    visited[now.used]=true;
    if(now.credit>=U)return bitcount(now.used);
    for(int i=0;i<n;i++){
      if(now.used & (1<<i) || (now.used & required[i]) != required[i])continue;
      Data next=now;
      next.used^=(1<<i);
      next.credit+=credit[i];
      q.push(next);
    }
  }
  return -1;
}

int main()
{
  while(cin>>n>>U,n|U){
    for(int i=0;i<n;i++){
      cin>>c>>k;
      credit[i]=c;
      required[i]=0;
      for(int j=0;j<k;j++){
        cin>>r;
        required[i]^=(1<<r);
      }
    }
    cout<<BFS()<<endl;
  }
}

Measured memory_bytes: 18500
#include<bits/stdc++.h>
using namespace std;
int gcd(int x,int y){
    if(x>y)swap(x,y);
    for(int i=x; i >= 1; i--){
        if(i == 1)return 1;
        else if( x % i  == 0 && y % i == 0)return i;
        //最大公約数、lcm = x*y/gcd 僕のVSCではgcd関数が使えませんでした(泣)だれか教えてください。
    }}
int main(){
	string s;
	cin >>s;
	string a,b,c;
	a = s.substr(0,5);
	b = s.substr(6,7);
	c = s.substr(14,5);
	cout << a << " " << b << " " << c << endl;
}




Measured memory_bytes: 256
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <functional>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
#define ll long long
#define INFTY 1 << 21

int main() {
  int N, L;
  cin >> N >> L;
  int eat;
  if (L >= 0)
    eat = L;
  else if (L + N - 1 < 0 && L < 0)
    eat = L + N - 1;
  else if (L < 0 && L + N - 1 >= 0)
    eat = 0;

  int ans = 0;
  for (int i = 0; i < N; i++) {
    ans += L + i;
  }

  cout << ans - eat << endl;
}


Measured memory_bytes: 256
MOD = 10**9 + 7

n,m = (int(num) for num in input().split())
s = [int(num) for num in input().split()]
t = [int(num) for num in input().split()]

dp = [[1]*(m+1) for _ in range(n+1)]

for i in range(1,n+1):
    for j in range(1,m+1):
        dp[i][j] = dp[i-1][j] + dp[i][j-1] - dp[i-1][j-1]
        if s[i-1] == t[j-1]:
            dp[i][j] += dp[i-1][j-1]
        dp[i][j] = dp[i][j] % MOD
        
        
print(dp[n][m])

Measured memory_bytes: 73052
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <inttypes.h>

//int compare_int(const void *a, const void *b){//qsort 整数比較<
//	return *(int*)a - *(int*)b;
//}
//int compare_int2(const void *a, const void *b){//qsort 整数比較>
//	return *(int*)b - *(int*)a;
//}
//
int main(void){
	int x;

	scanf("%d",&x);
	if(x==0){
		printf("1");
	}else{
		printf("0");
	}

	return 0;
}


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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;
    S[K-1] = 'a' + (S[K-1] - 'A');
    cout << S << endl;

    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define int LL
#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;
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;
}
struct point
{
	int num;
	int x;
	int y;
	point(){}
	point(int _x,int _y,int _num)
	{
		x=_x;
		y=_y;
		num=_num;
	}
};
bool compx(point A,point B)
{
	return A.x<B.x || A.x==B.x && A.y<B.y;
}
bool compy(point A,point B)
{
	return A.y<B.y || A.y==B.y && A.x<B.x;
}
const int MAX_N=100005;
vector <point> a;
int n;
vector <pair<int,pii> > g;
void build(int i,int j)
{
	int cost=min(abs(a[i].x-a[j].x),abs(a[i].y-a[j].y));
	g.pb(mp(cost,mp(a[i].num,a[j].num)));
}
int fa[MAX_N];
int find(int x)
{
	return fa[x]==x?x:fa[x]=find(fa[x]);
}
void unite(int x,int y)
{
	fa[find(x)]=find(y);
}
bool same(int x,int y)
{
	return find(x)==find(y);
}
signed main()
{
	cin>>n;
	a.resize(n);
	rep(i,0,n)
	{
		int x=read(),y=read();
		a[i]=point(x,y,i);
	}
	sort(all(a),compx);
	rep(i,1,a.size())
	{
		build(i,i-1);
	}
	sort(all(a),compy);
	rep(i,1,a.size())
	{
		build(i,i-1);
	}
	sort(all(g));
	rep(i,0,n)fa[i]=i;
	int ans=0;
	rep(i,0,g.size())
	{
		int u=g[i].se.fi,v=g[i].se.se;
		if(!same(u,v))
		{
			unite(u,v);
			ans+=g[i].fi;
		}
	}
	cout<<ans<<endl;
	return 0;
}




Measured memory_bytes: 10736
#include<bits/stdc++.h>
using namespace std;
#define mem(a,b) memset(a,b,sizeof a) ;
#define vi vector<int>
#define ull unsigned long long
#define ll long long 
#define db double 
#define ldb long double
#define fl float
#define rep(i,a,b) for(int i=a;i<b;i++)
#define lrep(i,a,b) for(ll i=a;i<b;i++)
#define mod 1000000007
#define mpr make_pair
#define pb push_back
#define fr first
#define sn second
#define bpp(x) __builtin_popcountll(x)
const int INF = 1e9;
const ldb PI = 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899863;
bool ok(string &s ,int l ,int r)
{
while(s[l]==s[r]) l++,r--;
return l>=r; 
}
ll cnk(ll n, int k)
{
    ll res = 1;
    if(k==0)
    return 0;
    for(int i = 0 ; (i) < (k) ; ++i) res = (res * (n - i)) / (i + 1);
    return res;
}
void solve()
{
	string s; cin>>s;
	int n=s.length();
	if(ok(s,0,n-1)&&(ok(s,0,(n-1)/2 - 1))&&ok(s,(n+1)/2,n-1))
	cout<<"Yes";
	else
	cout<<"No";
}
int main()
{
ios_base::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	// cin >> t;
	while(t--){
	solve();
	}
	return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var a, b int
	fmt.Scanf("%d %d", &a, &b)

	if a > b {
		tmp := a
		a = b
		b = tmp
	}

	if (b-a)%2 == 0 {
		fmt.Println(a + (b-a)/2)
	} else {
		fmt.Println("IMPOSSIBLE")
	}
}


Measured memory_bytes: 512
N, K = map(int, input().split())
MOD = 10**9 + 7
 
D = [[0]*(K+1) for i in range(N+1)]
D[0][0] = 1
for n in range(1, N+1):
    D0 = D[n-1]
    for k in range(1, K+1):
        D[n][k] = (D0[k-1] + k * D0[k]) % MOD
print(D[N][K])


Measured memory_bytes: 29212
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<ll> A(N);
  map<ll, int> mp;
  rep(i, N) {
    cin >> A[i];
    mp[A[i]]++;
  }
  vector<ll> avail, avail2;
  for(auto ele: mp) {
    if(ele.second >= 4) {
      avail.push_back(ele.first);
      avail2.push_back(ele.first);
    } else if(ele.second >= 2) {
      avail.push_back(ele.first);
    }
  }
  ll ans = 0;
  if(avail2.size() >= 1) ans = max(*avail2.rbegin() * *avail2.rbegin(), ans);
  if(avail.size() >= 2) ans = max(*avail.rbegin() * *(++avail.rbegin()), ans);
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 10292
#include<bits/stdc++.h>
using namespace std;
inline int read () {
	int num = 0;
	char c = ' ';
	bool flag = true;
	for (;c > '9' || c < '0';c = getchar())
		if (c == '-')
			flag = false;
	for (;c >= '0' && c <= '9';num = (num << 1) + (num << 3) + c - 48, c = getchar());
	return flag ? num : -num;
}
const int maxn = 100200;
int n;
char s[maxn];
void init () {
	scanf ("%s",s + 1);
	n = strlen (s + 1);
}
void work () {
	int bj = 1;
	for (int i = 1;i < n;i ++) {
		printf ("%d %d\n",bj,i + 1);
		if (s[i] == '1')
			bj = i + 1;
	}
}
bool check () {
	if (s[1] != '1' || s[n] != '0') return false;
	int l = 1, r = n - 1;
	while (l < r)
		if (s[l ++] != s[r --]) return false;
	return true;
}
int main () {
	init ();
	if (check ()) 
		work ();
	else printf ("-1\n");
	return 0;
}

Measured memory_bytes: 1536
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>
#include <numeric>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define MOD 1000000007 //10^9+7
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using PLL = pair<ll, ll>;
const int INF = numeric_limits<int>::max();

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

//greatest common divisor
long long gcd(ll a, ll b) 
{
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

//least common multiple
long long lcm(ll a, ll b)
{
    return a / gcd(a, b) * b ;
}

ll factorial(ll n) {
    ll res = 1;
    for (ll i = 1; i <= n; i++) {
        res *= i;
    }
    return res;
}

int main()
{
    int n, m; cin >> n >> m;
    vector<PLL> a(n);
    rep(i,n) {
        int A, B; cin >> A >> B;
        a[i] = make_pair(A, B);
    }
    sort(a.begin(), a.end());
    ll ans = 0;
    int i = 0;
    while (m > 0) {
        if (a[i].second <= m) {
            m -= a[i].second;
            ans += a[i].first * a[i].second;
        } else {
            ans += a[i].first * m;
            break;
        }
        i++;
    }

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 1792