akhauriyash/Code-Regression huggingface dataset:
H, W = map(int, input().split())
A = [[1 if a == "#" else 0 for a in input()] for _ in range(H)]
X = [[[-2] * (H + 2) for _ in range(W + 2)] for _ in range(H + 2)]
Y = [[[-2] * (W + 2) for _ in range(W + 2)] for _ in range(H + 2)]

for i in range(H):
    Xi = X[i]
    Yi = Y[i]
    for j in range(W):
        Xi[j][i] = j
        Yi[j][j] = i
for i in range(H):
    Xi = X[i]
    Ai = A[i]
    for j in range(W-1)[::-1]:
        if Ai[j] == Ai[j+1]:
            Xi[j][i] = Xi[j+1][i]
for i in range(H-1)[::-1]:
    Yi = Y[i]
    Yi1 = Y[i+1]
    Ai = A[i]
    Ai1 = A[i+1]
    for j in range(W):
        if Ai[j] == Ai1[j]:
            Yi[j][j] = Yi1[j][j]

for i in range(H):
    Xi = X[i]
    Ai = A[i]
    for j in range(W):
        Xij = Xi[j]
        for ii in range(i+1, H):
            if A[ii][j] != Ai[j]:
                break
            Xij[ii] = min(Xij[ii-1], X[ii][j][ii])
for i in range(H):
    Yi = Y[i]
    Ai = A[i]
    for j in range(W):
        Yij = Yi[j]
        for jj in range(j+1, W):
            if Ai[jj] != Ai[j]:
                break
            Yij[jj] = min(Yij[jj-1], Yi[jj][jj])

for k in range(16):
    if X[0][0][H-1] == W-1:
        print(k)
        break
    elif k == 15:
        print(16)
        break
    for i in range(H):
        Xi = X[i]
        Yi = Y[i]
        for j in range(W):
            Xij = Xi[j]
            Yij = Yi[j]
            for ii in range(i, H):
                Xijii = Xij[ii]
                if Xijii >= 0 and X[i][Xijii + 1][ii] >= 0:
                    Xij[ii] = X[i][Xijii + 1][ii]
            for jj in range(j, W):
                Yijjj = Yij[jj]
                if Yijjj >= 0 and Y[Yijjj + 1][j][jj] >= 0:
                    Yij[jj] = Y[Yijjj + 1][j][jj]
            
            jj = W - 1
            for ii in range(i, H):
                while jj >= j and Yij[jj] < ii:
                    jj -= 1
                if j <= jj > Xij[ii]:
                    Xij[ii] = jj
            
            ii = H - 1
            for jj in range(j, W):
                while ii >= i and Xij[ii] < jj:
                    ii -= 1
                if i <= ii > Yij[jj]:
                    Yij[jj] = ii

Measured memory_bytes: 185868
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;
const int mod = 1e9 + 7;
const int MX = 910000;
ll inv[MX], f[MX], invf[MX], pw[MX];
void calc(){
	pw[0] = 1;
	rep(i, MX - 1) pw[i + 1] = pw[i] * 3 % mod;
	inv[0] = inv[1] = f[0] = f[1] = invf[0] = invf[1] = 1;
	for (int i = 2; i < MX; i++){
		inv[i] = mod - mod / i * inv[mod % i] % mod;
		f[i] = f[i - 1] * i % mod;
		invf[i] = invf[i - 1] * inv[i] % mod;
	}
}
inline ll C(ll n, ll k){
	if(k < 0 || k > n) return 0;
	assert(n < MX && k < MX);
	return f[n] * invf[k] % mod * invf[n - k] % mod;
}
int main(){
	calc();
	int a, b, c; cin >> a >> b >> c;
	ll ans = 0;
	ll sum = 1; int L = 0, R = 0;
	rep(i, b + c + 1){
		/*
		ll s = 0;
		for(int j = max(0, i - c); j <= min(b, i); j++) s += C(i, j);
		*/
		if(i) sum *= 2;
		int l = max(0, i - c), r = min(b, i);
		sum += C(i - 1, L - 1);
		sum += mod - C(i - 1, R);
		
		if(l > L) sum += mod - C(i, L);
		if(r > R) sum += C(i, r);
		
		assert(l == L || L + 1 == l); assert(r == R || R + 1 == r);
		//dbg(l, r, L, R, sum, s); assert(s % mod == sum % mod);
		
		L = l; R = r;
		sum %= mod;
		ans += sum * C(i + a - 1, i) % mod * pw[b + c - i] % mod;
	}
	cout << ans % mod << endl;
	
	return 0;
}

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

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
ll LCM(ll a, ll b) { return a / GCD(a, b)* b; }

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

inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  int a,b,c; cin>>a>>b>>c;
  bool d=false;
  if(a==b&&a!=c) d=true;
  else if(a==c&&a!=b) d=true;
  else if(c==b&&a!=b) d=true;
  if(d)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

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

class union_find {
	vector<int> par;
	int find(int a) {
		return par[a] < 0 ? a : par[a] = find(par[a]);
	}
public:
	union_find(int n) : par(n, -1) {}
	bool same(int a, int b) {
		return find(a) == find(b);
	}
	void unite(int a, int b) {
		a = find(a);
		b = find(b);
		if (a == b) return;
		if (par[a] < par[b]) {
			par[a] += par[b];
			par[b] = a;
		}
		else {
			par[b] += par[a];
			par[a] = b;
		}
	}
};

struct edge {
	int from, to;
	int cost;
	bool operator<(const edge& e) const {
		return cost < e.cost;
	}
};

int main()
{
	int n, m;
	while (cin >> n >> m, n | m) {
		vector<edge> es;
		for (int i = 0; i < m; i++) {
			int s, t, c;
			cin >> s >> t >> c; --s, --t;
			es.push_back((edge) { s, t, c });
		}
		sort(es.begin(), es.end());
		vector<int> v;
		union_find uf(n);
		for (int i = 0; i < m; i++) {
			if (!uf.same(es[i].from, es[i].to)) {
				uf.unite(es[i].from, es[i].to);
				v.push_back(es[i].cost);
			}
		}
		cout << v[n / 2 - 1] << endl;
	}
	return 0;
}



Measured memory_bytes: 3316
N = int(input())
A = list(map(lambda a: int(a), input().split(" ")))
B = list(map(lambda b: int(b), input().split(" ")))
C = list(map(lambda c: int(c), input().split(" ")))
 
satis = 0
 
for i in range(len(A)):
  satis += B[A[i] - 1]
  if i >= 1 and A[i] - A[i-1] == 1:
    satis += C[A[i - 1] - 1]
 
print(satis)

Measured memory_bytes: 9072
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define FORR(I,A,B) for(ll I = ((B)-1); I >= (A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;
#define pri(a) cout << (a) << endl

template <typename T>
struct Knap_Big_Weight{
	T W;
	int N,max_v;
	vector<int> v;
	vector<T> w;
	vector< vector<T> > dp;
	Knap_Big_Weight(int N_, T W_ ,int max_v_){
		W = W_;
		N = N_;
		max_v = max_v_;
		v.resize(N);
		w.resize(N);
		dp = vector< vector<T> >(2,vector<T>(max_v*N+1,W+1));
	}
	int calc(){
		dp[0][0] = dp[1][0] = 0;
		for(int i=1;i<=N;i++){
			for(int j=0;j<=N*max_v;j++){
				int k = i%2;
				int l = 1-k;
				if(j<v[i-1]){
					dp[k][j] = dp[l][j];
				}else{
					dp[k][j] = min(dp[l][j],dp[l][j-v[i-1]]+w[i-1]);
				}
			}
		}
		int k = N%2;
		for(int i=N*max_v;i>=0;i--){
			if(dp[k][i] < W+1){
				return i;
			}
		}
	}
};







int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll N,W;
	cin >> N >> W;
	Knap_Big_Weight<ll> kbw(N,W,100);
	FOR(i,0,N){
		cin >> kbw.v[i] >> kbw.w[i];
	}
	cout << kbw.calc() << endl;
}


Measured memory_bytes: 3484
#include<iostream>
using namespace std;
int main(){
  int n;
  int i,j,k;
  int a[4][3][10]={{{}}};
  cin >> n;
  int b,f,r,v;
  for(i=0;i<n;i++){
    cin >> b >> f >> r >> v;
    a[b-1][f-1][r-1]+=v;
  }
  for(i=0;i<4;i++){
    for(j=0;j<3;j++){
      for(k=0;k<10;k++){
	cout << " ";
	cout << a[i][j][k];
      }
      cout << endl;
    }
    if(i<3)cout << "####################" << endl;
  }
  return 0;
}



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

using namespace std;

#define MAX 100002
typedef pair<int,int> P;

int main(){
  int N,L,in,dp[MAX]={0};
  priority_queue<P> Q;

  cin >> N >> L;
  for(int i = 1 ; i <= N ; i++){
    cin >> in;
    Q.push(P(in,i));
  }
  while(!Q.empty()){
    P p = Q.top(); Q.pop();
    dp[p.second] = max(dp[p.second-1],dp[p.second+1]) + (L-p.first);
  }
  int ans = 0;
  for(int i = 1 ; i <= N ; i++){
    ans = max(ans,dp[i]);
  }
  cout << ans << endl;

  return 0;
}

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

#define ll long long
#define endl "\n"

ll n, m;
vector <ll> vis(200006,0);
vector <ll> ad[200006];

void add(ll x, ll y){
    ad[x].push_back(y);
    ad[y].push_back(x);
}

void dfs(ll node){
    vis[node]=1;
    for(ll x:ad[node]){
        if(!vis[x])
            dfs(x);
    }
}

void solve(){
    ll d, s, t;
    cin >> d >> t >> s;
    if(d<=t*s){
        cout << "Yes" << endl;
        return;
    }
    cout << "No" << endl;
    
}

int main(){
    ll t;
   // cin >> t;
    t=1;
    while(t--)
        solve();
    return 0;
}

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

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

    cin >> N >> S >> K;

    for (int i = 0; i < N; i++)
    {
        if (S[i] != S[K - 1]){
            S[i] = '*';
        }
    }

    cout << S << endl;

    return 0;
}

Measured memory_bytes: 256
import itertools

N = int(input())
XY = [list(map(int, input().split())) for _ in range(N)]

ans = 0
for trans in itertools.permutations(range(N)):
	distance = 0
	for i in range(1,N):
		ind_2, ind_1 = trans[i], trans[i-1]
		x2,y2 = XY[ind_2]
		x1,y1 = XY[ind_1]
		distance += ((x2-x1)**2 + (y2-y1)**2)**(1/2)

	ans += distance

for i in range(1,N+1):
	ans /= i

print(ans)



Measured memory_bytes: 3064
#include<stdio.h>

int main()
{
    int n,k,q,i,j;
    scanf("%d%d%d",&n,&k,&q);
    int a[n],b[q];
    for(i=0;i<q;i++){
        scanf("%d",&b[i]);
    }
     for(i=0;i<n;i++){
        a[i]=k-q;
    }
    for(j=0;j<q;j++){
     a[b[j]-1]++;
    }
    for(i=0;i<n;i++){
        a[i]>0? printf("Yes\n"):printf("No\n");
    }
    return 0;
}


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

int main(){
  int N;
  cin >> N;
  
  vector<int> number(N);
  
  for(int i = 0; i < N; i++){
    cin >> number.at(i);
  }

  sort(number.begin(), number.end());
  reverse(number.begin(), number.end());

  int Alice = 0;
  int Bob = 0;
  
  for(int i = 0; i < N; i += 2){
    Alice += number.at(i);
  }

  for(int i = 1; i < N; i += 2){
    Bob += number.at(i);
  }

  cout << Alice - Bob << endl;
}

Measured memory_bytes: 3592
#include <iostream>
#include <assert.h>
#include <vector>
#include <unordered_map>
#include <queue>
#include <climits>
#include <cmath>
#include <algorithm>
#include <unordered_set>
using namespace std;
constexpr int64_t MOD = 1e9 + 7;

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

  int32_t N, K;
  cin >> N >> K;
  vector<int64_t> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    if (i >= K) {
      if (A[i] > A[i-K]) {
        cout << "Yes" << endl;
      } else {
        cout << "No" << endl;
      }
    }
  }
  
  return 0;
}


Measured memory_bytes: 4780
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <iomanip>
#include <cmath>
#include <queue>
#include <bitset>
#include <numeric>
#include <array>
#include <cstring>
#include <random>
#include <chrono>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int main() {

  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

  int n = 0, k = 0;

  cin >> n >> k;

  ll cur = 1, pr = 1;

  vector<ll> x(n);

  for(int i = 0; i < k; i++) {
    cin >> x[i];
    cur += x[i];
  }

  pr = cur;

  for(int i = k; i < n; i++) {
    cur -= x[i - k];
    cin >> x[i];
    cur += x[i];
    cout << (cur > pr ? "Yes\n" : "No\n");
    pr = cur;
  }

  return 0;
}
/*

*/


Measured memory_bytes: 4808
use std::io::*;
use std::str::FromStr;
 
/* 
The read function reads a string according to each one. 
*/
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


//main function
fn main() {
    let a:i64 = read();
    let b:i64 = read();
    let x:i64 = read();
    if a > x {
	println!("NO");
    }else if x-a < b {
	println!("YES");
    }else {
	println!("NO");
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0); cin.sync_with_stdio(false);
  string s;
  cin >> s;
  int n = s.length();
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'x') cnt++;
  }
  cout << (cnt >= 8 ? "NO" : "YES") << endl;
  return 0;
}

Measured memory_bytes: 764
from itertools import accumulate

n,m,q = map(int,input().split())
li = [[0 for i in range(n+1)]for j in range(n+1)]
lin = []

for i in range(m):
    l,r = map(int,input().split())
    li[l][r] += 1

for i in range(n+1):
    lin += [list(accumulate(li[i]))]

for i in range(q):
    l,r = map(int,input().split())
    point = 0
    for i in range(l,r+1):
        point += lin[i][r]-lin[i][l-1]
    print(point)

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

#define ll long long
#define REP(i,n) for(int i = 0; i < n; i++)
#define PI 3.141592653589
#define MOD 1000000007

using namespace std;

template<typename T> T gcd(T a, T b){return (a % b)? gcd(b, a % b) : b;}
template<typename T> T lcm(T a, T b){return a * b / gcd(a, b);}

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

    if(a >= 30){
        cout << "Yes" << endl;
    } else cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
 string A,B;
  int C=0;
  cin>>A>>B;
  
  int i=0;
 for(i=0;i<3;i++)
 { if(A.at(i)==B.at(i)){C++;}}
   cout<<C<<endl;
  
}

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

using namespace std;

#define LIMIT 100
typedef int64_t ll;
typedef pair<ll, ll> ii;
int gcd(ll a, ll b) { return (b==0)?a:gcd(b, a%b); }
int lcm(ll a, ll b) { ll i=(a/gcd(a,b))*b; assert(i>0); return i; }

//  ***** MAIN *****
int main(){

  //ios::sync_with_stdio(false);
  cin.tie(NULL);
  int a, b;
  cin >> a >> b;

  int c = ((int)pow(10,((int)log10(b)+1)))*a + b;
  if(sqrt(c) == floor(sqrt(c))){
    std::cout << "Yes" << std::endl;
  }
  else {
    std::cout << "No" << std::endl;
  }

  return 0;
}



Measured memory_bytes: 256
# coding: utf-8
# Your code here!
X,Y = map(int, input().split())

i=0
while i<=X:
    KAME=X-i
    TURU=i
    if (KAME*4)+(TURU*2)==Y:
        print("Yes")
        quit()
    i+=1
    
print("No")

Measured memory_bytes: 9172
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <functional>

using namespace std;
using ll = long long;

#define FOR(i, m, n) for(int i = (m);i < (n);i++)
#define REP(i,n) for(int i = 0; i < int(n); i++)
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VL vector<ll>
#define PAIR pair<int,int>
#define MP make_pair
#define VP vector<pair<int,int>>
#define VS vector<string>
#define PQUE priority_queue<int> //5,5,4,3,3,2,...
#define REPQUE priority_queue<int, vector<int>, greater<int>> //1,1,2,3,4,4,5,...
#define SUM(obj) accumulate((obj).begin(), (obj).end(), 0)
#define SORT(obj) sort((obj).begin(), (obj).end()) // 1,2,3,4,5...
#define RESORT(obj) sort((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1...
#define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n
#define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n

const ll MOD = (ll)1e9 + 7;


int main() {
	int N;
	cin >> N;
	bool flag = false;
	if (N % 10 == 9)flag = true;
	N /= 10;
	if (N % 10 == 9)flag = true;
	string S = (flag) ? "Yes" : "No";
	cout << S << endl;
	
	return 0;
}

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

int main()
{
    ll t;
    cin>>t;
    string s[t];
    map<string,ll> m;
    for(ll i=0;i<t;i++)
    {
        cin>>s[i];
        m[s[i]]++;
    }
    cout<<"AC x "<<m["AC"]<<endl;
    cout<<"WA x "<<m["WA"]<<endl;
    cout<<"TLE x "<<m["TLE"]<<endl;
    cout<<"RE x "<<m["RE"]<<endl;
} 


Measured memory_bytes: 6756
N, P = map(int, input().split())
A = list(map(int, input().split()))
A = [i % 2 for i in A]

def cmb(n, r):
    p, q = 1, 1
    for i in range(r):
        p = p * (n - i)
        q = q * (i + 1)
    return p // q


even = A.count(0)
odd = A.count(1)

if odd == 0:
    if P == 0:
        print(2 ** N)
    else:
        print(0)
else:
    if P == 0 and even == 0 and odd == 1:
        print(0)
    elif P == 0:
        n = 2
        cnt = 1
        while n <= odd:
            cnt += cmb(odd, n)
            n += 2
        print(2 ** even * cnt)
    else:
        n = 1
        cnt = 0
        while n <= odd:
            cnt += cmb(odd, n)
            n += 2
        print(2 ** even * cnt)

Measured memory_bytes: 3064
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <bitset>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin>>n>>m;
    V vec(n);
    ll sum=0;
    rep(i,n){
        cin>>vec[i];
        sum+=vec[i];
    }
    sort(all(vec),greater<ll>());
   // cout<<sum<<endl;
   ll limit;
   if(sum%(4*m)==0){
       limit=sum/(4*m);
   }else{
       limit=sum/(4*m)+1;
   }
    rep(i,m){
        if(vec[i]<limit){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
}


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

int main(){
    string S,T;
    cin>>S>>T;
    
    int ans=1e9;
    for(int i=0; i<=S.size()-T.size(); ++i){
        int tmp=0;
        for(int j=0; j<T.size(); ++j){
            if(S[i+j]!=T[j]) ++tmp;
        }
        ans = min(ans, tmp);
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 3460
#include<bits/stdc++.h>
using namespace std;
 
#define MOD 1000000007
 
typedef long long ll;
typedef pair<int,int> P;
 
int main(){
	int n;
	cin>>n;
	map<int,int>mp;
	vector<int>a(n);
	for(int i=0;i<n;i++){
		cin>>a[i];
		mp[a[i]]++;
	}
	bool ok=true;
	if(n%2==1&&mp[0]!=1)ok=false;
	int start=1;
	if(n%2==1)start=2;
	for(int i=start;i<n;i+=2)if(mp[i]!=2)ok=false;
	if(!ok)cout<<0<<endl;
	else{
		ll res=1;
		for(int i=0;i<n/2;i++){
			res*=2;
			res%=MOD;
		}
		cout<<res<<endl;
	}
	return 0;
}


Measured memory_bytes: 4480
#include <stdio.h>
#include <string.h>

int is_taisyou_internal(char a,char b) {
	if(a=='i' && b=='i')return 1;
	if(a=='w' && b=='w')return 1;
	if(a=='(' && b==')')return 1;
	if(a==')' && b=='(')return 1;
	if(a=='{' && b=='}')return 1;
	if(a=='}' && b=='{')return 1;
	if(a=='[' && b==']')return 1;
	if(a==']' && b=='[')return 1;
	return 0;
}

int is_taisyou(const char* input) {
	int i,length,length2;
	length=strlen(input);
	length2=(length+1)/2;
	for(i=0;i<length2;i++) {
		if(!is_taisyou_internal(input[i],input[length-i-1]))return 0;
	}
	return 1;
}

int main(void) {
	char input[16];
	char now[16];
	int tansaku,input_length,t_max;
	int length;
	int result;
	int i;
	scanf("%s",input);
	input_length=strlen(input);
	t_max=1<<input_length;
	result=0;
	for(tansaku=1;tansaku<t_max;tansaku++) {
		length=0;
		for(i=0;i<input_length;i++) {
			if(tansaku & (1<<i))now[length++]=input[i];
		}
		now[length]=0;
		if(is_taisyou(now) && strstr(now,"iwi") && length>result) {
			result=length;
		}
	}
	printf("%d\n",result);
	return 0;
}

Measured memory_bytes: 0
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <bitset>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()

#pragma region UnionFind
struct UnionFind
{
	vector<int> par;

	UnionFind(int n) : par(n, -1) {}
	void init(int n) { par.assign(n, -1); }

	int root(int x)
	{
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool issame(int x, int y)
	{
		return root(x) == root(y);
	}

	bool merge(int x, int y)
	{
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x)
	{
		return -par[root(x)];
	}
};
#pragma endregion
#pragma region GCD
ll gcd(ll a, ll b)
{
	if (b == 0)return a;
	return gcd(b, a%b);
}
#pragma endregion
#pragma region LCM
ll lcm(ll a, ll b)
{
	return a / gcd(a, b) * b;
}
#pragma endregion
#pragma region chmin
template<class T> inline bool chmin(T& a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma region chmax
template<class T> inline bool chmax(T& a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma endregion


int main()
{
	int n, m, s; cin >> n >> m >> s;
	vector<vector<tuple<int,ll,ll>>> v(n);
	rep(i, m)
	{
		int x, y;
		ll a, b; cin >> x >> y >> a >> b;
		--x, --y;
		v[x].push_back({ y,a,b });
		v[y].push_back({ x,a,b });
	}
	vector<ll> c(n), d(n);
	rep(i, n)cin >> c[i] >> d[i];
	queue<pair<int, int>> q;
	q.push(make_pair(0, min(s, 2550)));
	ll INF = 1e18;
	vector<vector<ll>> dp(n, vector<ll>(2551, INF));
	dp[0][min(s, 2550)] = 0;
	while (!q.empty())
	{
		int curPos, curMoney;
		tie(curPos, curMoney) = q.front();
		q.pop();
		if (chmin(dp[curPos][min(curMoney + c[curPos], 2550LL)], dp[curPos][curMoney] + d[curPos]))
		{
			q.push(make_pair(curPos, min(curMoney + c[curPos], 2550LL)));
		}
		for (auto p : v[curPos])
		{
			int nextPos;
			ll a, b;
			std::tie(nextPos, a, b) = p;
			if (curMoney < a)continue;
			if (chmin(dp[nextPos][curMoney - a], dp[curPos][curMoney] + b))
			{
				q.push(make_pair(nextPos, curMoney - a));
			}
		}
	}
	for (int i = 1; i < n; ++i)
	{
		ll res = INF;
		rep(j, 2551)chmin(res, dp[i][j]);
		cout << res << endl;
	}
}

Measured memory_bytes: 4912
N = int(input())

ans = [0]*(N+1)

root = int(N**0.5)

for x in range(1, root+1):
    for y in range(1, root+1):
        for z in range(1, root+1):
            F = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if F <= N:
                ans[F] += 1
            else:
                continue

for i in range(1, N+1):
    print(ans[i])

Measured memory_bytes: 9524
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
const int N = 1e5 + 10;
 
int main() {
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  multiset<int> ms;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    ms.insert(x);
  }
  while (!ms.empty() and m > 0) {
    int x = *ms.rbegin();
    ms.erase(ms.find(x));
    m--;
    ms.insert(x / 2);
  }
  ll ans = 0;
  for (auto it : ms) {
    ans += it;
  }
  cout << ans << endl;
  return 0;
}

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

ans = "APPROVED"

for n in range(N):
  if A[n] %2 == 0:
    if A[n] % 3 != 0 and A[n] % 5 != 0:
      ans = "DENIED"
      break
print(ans)

Measured memory_bytes: 9008
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; ++i)
#define all(a) (a).begin(), (a).end()

int H, W, A, B;

int main() {
  cin >> H >> W >> A >> B;

  rep(i, H) {
    rep(j, W) cout << !((i < B) ^ (j < A));
    cout << endl;
  }
  return 0;
}


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

#define int long long

const int inf = LONG_MAX;

signed main() {
    int n, m;
    cin >> n >> m;
    int a[2000], b[2000], c[2000];
    for(int i=0; i<m; ++i) {
        cin >> a[i] >> b[i] >> c[i];
        c[i] = -c[i];
    }

    int dist[1000];
    for(int i=0; i<n; ++i) dist[i] = inf;
    dist[0] = 0;
    for(int j=0; j<n-1; ++j) {
        for(int i=0; i<m; ++i) {
            if(dist[a[i]-1] == inf) continue;
            if(dist[b[i]-1] > dist[a[i]-1] + c[i]) dist[b[i]-1] = dist[a[i]-1] + c[i];
        }
    }
    int ans = dist[n-1];

    bool negative[1000];
    for(int i=0; i<n; ++i) negative[i] = false;
    for(int j=0; j<n; ++j) {
        for(int i=0; i<m; ++i) {
            if(dist[a[i]-1] == inf) continue;
            if(dist[b[i]-1] > dist[a[i]-1] + c[i]) {
                dist[b[i]-1] = dist[a[i]-1] + c[i];
                negative[b[i]-1] = true;
            }
            if(negative[a[i]-1] == true) negative[b[i]-1] = true;
        }
    }

    if(negative[n-1]) cout << "inf" << endl;
    else cout << -ans << endl;
    return 0;
}



Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6) #再帰関数の上限
import math
from copy import copy, deepcopy
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque 
#deque(l), pop(), append(x), popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうので注意
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
#import fractions#古いatcoderコンテストの場合GCDなどはここからimportする


def input(): return sys.stdin.readline()[:-1]
def printl(li): print(*li, sep="\n")
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N=len(v)
    size=len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def main():
    mod = 10**9+7
    #w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

    #N = int(input())
    R,G,B,N = map(int, input().split())
    #A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列

    l1=[0]*(N+1)
    for r in range(N//R+1):
        for g in range(N//G+1):
            count=R*r+g*G
            if count>N:
                break
            l1[count]+=1
    ans=0
    #print(l1)
    for b in range(N//B+1):
        ret=N-b*B
        ans+=l1[ret]
    print(ans)



if __name__ == "__main__":
    main()

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

using namespace std;

int main(void){
	int N; int A[1010101]; int B[101010]; int s; int t;
	scanf("%d", &N);
	A[0] = 0;
	for(int i = 1;i <= N;++i){
		scanf("%d", A + i);
		s += abs(A[i-1] - A[i]);

		if(i >= 2){
			B[i] = abs(A[i-2] - A[i]);
		}
	}
	s += abs(A[N]);
	A[N+1] = 0;
	B[N+1] = abs(A[N-1]);
	for(int i = 1;i <= N;++i){
		int h = s - abs(A[i-1] - A[i]) - abs(A[i+1] - A[i]) + B[i+1];
		printf("%d\n", h);
	}
	return 0;
}

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

using namespace std;

#define pb push_back
#define fo(i, n) for(int i = 1; i <= n; ++i)

typedef long long ll;
typedef long double ld;

const int N = 500200;
const int mod = 1e9 + 7;

ll n, m, a[N], b[N], u, v;
vector<int> g[N];
ll s;
ll dp[N];
inline bool cmp(int i, int j) {
    return a[i] - b[i] < a[j] - b[j];
}

int tmr, used[N];

inline ll calc(ll root) {
    if(dp[root] != -1) return dp[root];
    ++tmr;
    ll val = max(0ll, a[root] - b[root]);
    set<pair<ll, ll> > q;
    used[root] = tmr;
    q.insert({val, root});
    while(!q.empty()) {
        int v = q.begin()->second;
        q.erase(q.begin());
        if(a[v] - b[v] <= val) {
            val += b[v];
        } else {
            val = a[v];
        }
        for(int to : g[v]) {
            if(used[to] != tmr) {
                used[to] = tmr;
                q.insert({a[to] - b[to], to});
            }
        }
    }
    return dp[root] = val;
}


int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    memset(dp, -1 , sizeof dp);
    cin >> n >> m;
    fo(i, n) cin >> a[i] >> b[i], s += b[i];
    fo(i, m) {
        cin >> u >> v;
        g[u].pb(v);
        g[v].pb(u);
    }
    vector<int> roots;
    fo(i, n) roots.pb(i);
    sort(roots.begin(), roots.end(), &cmp);
    ll ans = 1e18;
    for(int s : roots) {
        ll cur = calc(s);
        ans = min(ans, cur);
        if(clock() * 1.0 > 1.0 * CLOCKS_PER_SEC) break;
    }
    random_shuffle(roots.begin(), roots.end());

    for(int s : roots) {
        ll cur = calc(s);
        ans = min(ans, cur);
        if(clock() * 1.0 > 1.7 * CLOCKS_PER_SEC) break;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 25976
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    int a[3];
    REP(i,3)cin >> a[i];
    sort(a,a+3);
    cout << a[0]+a[1] << endl;
    return 0;
}

Measured memory_bytes: 256
h, w = map(int, input().split())
m = [["."]*(w+2)]
for _ in range(h):
    m.append(["."]+list(input())+["."])
m.append(["."]*(w+2))


def canAchive(m):
    for i in range(h):
        for j in range(w):
            around = [m[i-1][j],
                      m[i+1][j],
                      m[i][j-1],
                      m[i][j+1]]
            if m[i][j] == '#' and all(s != "#" for s in around):
                return False
    return True


print('Yes' if canAchive(m) else 'No')


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<int>>;
const int INT_INF = 1001001001;

int kaisu(int n,int p){//pで何回割れるかをカウントする
    int cnt = 0;
    while(n>0){
        if(n%p==0){
            n /= p;
            cnt++;
        }else{
            break;
        }
    }
    return cnt;
}

int main(){
    int n;
    cin >> n;
    int ans = 0;
    int c = 0;
    for(int i=1;i<=n;i++){
        c = max(c,kaisu(i,2));
        if(c==kaisu(i,2)){
            ans = i;
        }
    }
    cout << ans << endl;
}

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

using namespace std;
using ll = long long;
using pii = pair<int, int>;

struct P {
  int n, t, w, d;
  P() {}
  P(int n, int t, int w, int d) : n(n), t(t), w(w), d(d) {}
};

int search(vector<P>& v, int p) {
  for (int i = 0; i < v.size(); i++) {
    if (v[i].n == p) return i;
  }
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  
  int n, w, d;
  while (cin >> n >> w >> d, w) {
    vector<P> v;
    v.emplace_back(0, -1, w, d);
    for (int i = 0; i < n; i++) {
      int p, s;
      cin >> p >> s;

      int id = search(v, --p);
      s %= (v[id].w + v[id].d) * 2;

      if (s < v[id].w) {
        int mx = max(s, v[id].w - s);
        v.emplace_back(v.size(), i, mx, v[id].d);
        v[id].t = i; v[id].w = v[id].w - mx;
      } else if (s < v[id].w + v[id].d) {
        s -= v[id].w;
        int mx = max(s, v[id].d - s);
        v.emplace_back(v.size(), i, v[id].w, mx);
        v[id].t = i; v[id].d = v[id].d - mx;
      } else if (s < v[id].w * 2 + v[id].d) {
        s -= v[id].w + v[id].d;
        int mx = max(s, v[id].w - s);
        v.emplace_back(v.size(), i, mx, v[id].d);
        v[id].t = i; v[id].w = v[id].w - mx;
      } else {
        s -= v[id].w * 2 + v[id].d;
        int mx = max(s, v[id].d - s);
        v.emplace_back(v.size(), i, v[id].w, mx);
        v[id].t = i; v[id].d = v[id].d - mx;
      }

      sort(v.begin(), v.end(), [&](P a, P b) { return a.t != b.t ? a.t < b.t : a.w * a.d < b.w * b.d; });
      int m = 0;
      for (auto& j : v) j.n = m++;
    }

    sort(v.begin(), v.end(), [&](P a, P b) { return a.w * a.d < b.w * b.d; });
    for (int i = 0; i < v.size(); i++) {
      cout << v[i].w * v[i].d << " \n"[i + 1 == v.size()];
    }
  }

  return 0;
}


Measured memory_bytes: 3140
use proconio::input;
use proconio::marker::{Chars, Usize1};
use std::iter::Iterator;
use std::collections::HashSet;
use std::cmp::*;
use itertools::Itertools;

#[allow(unused_macros)]
macro_rules! max {
    ($x:expr) => {
      $x
    };
    ($x:expr, $($xs:tt)+) => {
      max($x,max!($($xs)+))
    };
  }
  
  #[allow(unused_macros)]
  macro_rules! min {
    ($x:expr) => {
      $x
    };
    ($x:expr, $($xs:tt)+) => {
      min($x,min!($($xs)+))
    };
  }

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    input! {
    x: i32,
    y: i32,
    }

    for i in 0..=x {
      if  (x - i)*2 + i * 4 == y {
        println!("Yes");
        return;
      } 
    }
    println!("No");
}


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

int main(){
    string a, b, c;
    cin >> a >> b >> c;
    string ans = "";
    ans += (a[0] - 'a' + 'A');
    ans += (b[0] - 'a' + 'A');
    ans += (c[0] - 'a' + 'A');
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>

using namespace std;

int main() {

    int A, B;

    cin >> A >> B;

    if(A == 1) A = 14;
    if(B == 1) B = 14;

    if(A == B) {
        cout << "Draw" << endl;
    } else if(A > B){
        cout << "Alice" << endl;
    } else if(A < B){
        cout << "Bob" << endl;
    }

    
    return 0;
}

Measured memory_bytes: 256
//#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <unordered_map>

using namespace std;

//ifstream cin("tema.in");
//ofstream cout("tema.out");

const int MAXN = 100000;

vector<int> g[1 + MAXN];
int dp[1 + MAXN];

bool Compare(const int &a, const int &b) {
    return dp[a] > dp[b];
}

void DFS(int node, int father) {
    for (auto &son : g[node])
        if (son != father)
            DFS(son, node);
    sort(g[node].begin(), g[node].end(), Compare);
    for (int i = 0; i < g[node].size(); i++)
        dp[node] = max(dp[node], dp[g[node][i]] + i + 1);
}

int main() {
    int n;
    cin >> n;
    for (int i = 2; i <= n; i++) {
        int x;
        cin >> x;
        g[x].push_back(i);
    }
    DFS(1, 0);
    cout << dp[1] << "\n";
    return 0;
}


Measured memory_bytes: 15488
l=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k=int(input())
print(l[k-1])

Measured memory_bytes: 2940
l = input().split()
W = int(l[0])
H = int(l[1])
x = int(l[2])
y = int(l[3])
r = int(l[4])
if 0<=x-r and 0<=y-r and x+r<=W and y+r<=H:
    print("Yes")
else :
    print("No")


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

int main(){

  double n;

  while(1){
    cin >> n;
    if(n < 0) break;
    double m = 128,t = 0.5;
    string s;

    for(int i=0;i<8;i++){
      if(n >= m){
	n -= m;
	s += "1";
      }
      else s += "0";

      m /= 2;
    }

    s += ".";

    for(int i=0;i<4;i++){
      if(n >= t){
	n -= t;
	s += "1";
      }

      else s += "0";

      t /= 2;
    }

    if(n == 0) cout << s;
    else cout << "NA";
    cout << endl;

  }
}

Measured memory_bytes: 1220
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll                long long int
#define ld                long double
#define pb                push_back
#define mk                make_pair
#define in(i,a,n)         for(ll i=0;i<n;++i) cin>>a[i];
#define out(i,a,n)        for(ll i=0;i<n;++i) cout<<a[i]<<" ";
#define sz                size()
#define all(c)            c.begin(), c.end()
#define rall(c)           c.rbegin(), c.rend()
#define loop(i,a,b)       for(ll i=a;i<b;i++)
#define rloop(i,a,b)      for(ll i=a;i>b;i--)
#define F                 first
#define S                 second
#define deb(x) cout << #x << " " << x << endl
#define inf INT_MAX
const ll N = 100010;
const ll MOD = 1e9+7;
ll mod(ll n) {
    return (n % MOD + MOD) % MOD;
}


void solve(){
    int N;
    cin >> N;
    vector<int> v(N);
    for(int i=0;i<N;i++){
        cin >> v[i];
    }
    sort(all(v));
    int ans = 0;
    vector<int> P(pow(10, 6), 0);
    for(int i=0;i<N;i++){
        if(P[v[i]] == 0){
            for(int j=0;j<=pow(10, 6)/v[i];j++){
                P[j * v[i]] = 1;
            }
            if(i == N-1 || v[i] != v[i+1])
                ans++;
        }
    }
    cout << ans;
}

int main(){
    fast
    int T=1;
    //cin >> T;
    for(int i=0;i<T;i++) solve();
}

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

int main() {
  int n, x, t;
  cin >> n >> x >> t;
  int a, b, c;
  a = n / x;
  b = n % x;
  c = a * t;
  if (0 < b) {
    c = c + t;
  }
  cout << c << endl;
}

Measured memory_bytes: 3632
#define _USE_MATH_DEFINES // M_PI
#include<cmath>
#include<bits/stdc++.h>
using namespace std;
using 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,a,n) for(int (i)=(n)-1; (i)>=(a);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 2147483647;
constexpr ll mod = 1000000007;

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;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

inline int binary_search(int a, ll key, const vector<pair<ll, ll>>& vec) {
	int left = a;
	int right = vec.size();
	while (right - left > 1) {
		int mid = left + (right - left) / 2;
		if (vec[mid].first > key)right = mid;
		else left = mid;
	}
	return left;
}

int main() {
	init();

	int N; cin >> N;
	int D, A; cin >> D >> A;
	vector<pair<ll, ll>>vec(N);
	rep(i, N) {
		ll a, b;cin >> a >> b;
		vec[i] = make_pair(a, b);
	}
	sort(all(vec));
	vector<ll>num(N + 1, 0);
	ll ans = 0;
	rep(i, N) {
		ll hp = vec[i].second;
		if (num[i] < hp) {
			ll cnt = (hp - num[i] + A - 1) / A;
			ans += cnt;
			num[i] += A * cnt;
			int index = binary_search(i, vec[i].first + 2LL * D, vec);
			if (index != vec.size()) {
				num[index + 1] -= A * cnt;
			}
		}
		num[i + 1] += num[i];
	}
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <set>
#include <cmath>
using namespace std;

vector<bool>dec(int i, int n){
  vector<bool>ret(i+1);
  for(int j=1; j<=n; j++){
    ret[j]=i%2;
    i/=2;
  }
  return ret;
}

int main(){
  int n, m, ret=0;
  cin >> n >> m;
  vector<set<int>>s(m);
  vector<int>p(m);
  for(int i=0; i<m; i++){
    int k;
    cin >> k;
    for(int j=0; j<k; j++){
      int sij;
      cin >> sij;
      s[i].insert(sij);
    }
  }
  for(int i=0; i<m; i++)cin >> p[i];
  for(int i=0; i<pow(2, n); i++){
    int c=0;
    vector<bool>sw=dec(i, n);
    cerr << "sw";
    for(int j=1; j<=n; j++)cerr << sw[j];
    cerr << endl;
    vector<int>cnt(m, 0);
    for(int j=1; j<=n; j++){
      if(!sw[j])continue;
      for(int k=0; k<m; k++){
        if(s[k].count(j))cnt[k]++;
      }
    }
    for(int j=0; j<m; j++)cerr << cnt[j] << ' ';
    cerr << endl;
    for(int j=0; j<m; j++){
      cerr << "cp";
      cerr << j << ' ' << cnt[j] << ' ' << p[j] << endl;
      if((cnt[j]%2)==p[j])c++;
    }
    cerr << c << endl;
    if(c==m)ret++;
  }
  cout << ret;
  return 0;
}

Measured memory_bytes: 888
require "prime"
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size,n=1,init=nil) #nに配列の次元数、sizeに配列の大きさ、initに初期値を投げることでその配列を返す
  if n==1
    return Array.new(size){init}
  else
    return Array.new(n).map{Array.new(size){init}}
  end
end

q=gets.to_i

table=array(10**5,1,0)

for i in 1..10**5
  if (i%2).zero?
    table[i]=table[i-1]
  else
    table[i]=table[i-1]
    table[i]+=(Prime.prime?(i) and Prime.prime?((i+1)/2)) ? 1 : 0
  end
end

q.times do|i|
  l,r=get_i
  puts table[r]-table[l-1]
end

Measured memory_bytes: 3452
#include <bits/stdc++.h>
#define rep(i,n) for ((i)=1;(i)<=(n);(i)++)
#define per(i,n) for ((i)=n;(i)>=(1);(i)--)
using namespace std;
int n,m,k,i,j,ans;
char mp[805][805];
int dis[805][805],sx,sy;
queue<int> qx,qy;
int main(){
	scanf("%d%d%d",&n,&m,&k);
	memset(dis,0x12,sizeof(dis));
	rep(i,n){
		scanf(" ");
		rep(j,m){
			scanf("%c",&mp[i][j]);
			if(mp[i][j]=='S'){
				sx=i;
				sy=j;
				if(i==1||i==n||j==1||j==m){
					puts("0");
					return 0;
				}
				dis[i][j]=0;
			}
		}
	}
	qx.push(sx);qy.push(sy);
	while(!qx.empty()){
		int x=qx.front(),y=qy.front();qx.pop();qy.pop();
		if(dis[x][y]>=k) continue;
		for(int nx=x-1;nx<=x+1;nx++)for(int ny=y-1;ny<=y+1;ny++){
			if(nx<1||nx>n||ny<1||ny>m) continue;
			if(abs(nx-x)+abs(ny-y)!=1) continue;
			if(mp[nx][ny]=='#') continue;
			if(dis[nx][ny]<=dis[x][y]+1) continue;
			dis[nx][ny]=dis[x][y]+1;
			qx.push(nx);qy.push(ny);
		}
	}
	ans=0x12121212;
	rep(i,n)rep(j,m) if(dis[i][j]<=k) ans=min(ans,1+(min(min(i-1,n-i),min(j-1,m-j))+k-1)/k);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3584
// C++ code to find number of distinct numbers
// in a subarray
#include<bits/stdc++.h>
using namespace std;

const int MAX = 1000001;

// structure to store queries
struct Query
{
	int l, r, idx;
};

// cmp function to sort queries according to r
bool cmp(Query x, Query y)
{
	return x.r < y.r;
}

// updating the bit array
void update(int idx, int val, int bit[], int n)
{
	for (; idx <= n; idx += idx&-idx)
		bit[idx] += val;
}

// querying the bit array
int query(int idx, int bit[], int n)
{
	int sum = 0;
	for (; idx>0; idx-=idx&-idx)
		sum += bit[idx];
	return sum;
}

void answeringQueries(int arr[], int n, Query queries[], int q)
{
	// initialising bit array
	int bit[n+1];
	memset(bit, 0, sizeof(bit));

	// holds the rightmost index of any number
	// as numbers of a[i] are less than or equal to 10^6
	int last_visit[MAX];
	memset(last_visit, -1, sizeof(last_visit));

	// answer for each query
	int ans[q];
	int query_counter = 0;
	for (int i=0; i<n; i++)
	{
		// If last visit is not -1 update -1 at the
		// idx equal to last_visit[arr[i]]
		if (last_visit[arr[i]] !=-1)
			update (last_visit[arr[i]] + 1, -1, bit, n);

		// Setting last_visit[arr[i]] as i and updating
		// the bit array accordingly
		last_visit[arr[i]] = i;
		update(i + 1, 1, bit, n);

		// If i is equal to r of any query store answer
		// for that query in ans[]
		while (query_counter < q && queries[query_counter].r == i)
		{
			ans[queries[query_counter].idx] =
					query(queries[query_counter].r + 1, bit, n)-
					query(queries[query_counter].l, bit, n);
			query_counter++;
		}
	}

	// print answer for each query
	for (int i=0; i<q; i++)
		cout << ans[i] << endl;
}

// driver code
int main()
{
	int n,t;
	cin>>n>>t;
	int a[n];
	for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
	Query queries[t];
	int ll,rr;
	for(int i=0;i<t;i++)
    {
        cin>>ll>>rr;
        ll--;
        rr--;
        queries[i].l = ll;
        queries[i].r = rr;
        queries[i].idx = i;
    }

	int q = sizeof(queries)/sizeof(queries[0]);
	sort(queries, queries+q, cmp);
	answeringQueries(a, n, queries, q);
	return 0;
}


Measured memory_bytes: 19404