akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstring>
#define INF 1<<28
using namespace std;

int p[1111111];
int memo[1111111];
int memo2[1111111];

int solve(int n){
  
  if(!n) return 0;
  if(~memo[n]) return memo[n];

  int ans = INF;
  for(int i=199;i>0;i--) if(n-p[i] >= 0) ans = min(ans, solve(n-p[i])+1);
  
  return memo[n] = ans;
}

int solve2(int n){
  
  if(!n) return 0;
  if(~memo2[n]) return memo2[n];

  int ans = INF;
  for(int i=199;i>0;i--) if(n-p[i] >= 0 && p[i]&1) ans = min(ans, solve2(n-p[i])+1);

  return memo2[n] = ans;
}

int main(){
  
  int n;
  
  memset(memo, -1, sizeof(memo));
  memset(memo2, -1, sizeof(memo2));

  for(int i=0;i<200;i++) p[i] = i*(i+1)*(i+2)/6;
  while(cin >> n, n) cout << solve(n) << " " << solve2(n) << endl;

}

Measured memory_bytes: 11400
import collections

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

if len(set(A)) == 1:
    print(n//2)
    
else:
    k = []
    g = []
    for i in range(n):
        if i%2 == 0:
            k.append(A[i])
        else:
            g.append(A[i])
    
    ck = collections.Counter(k) 
    ckk, ckv = zip(*ck.most_common())
    cg = collections.Counter(g) 
    cgk, cgv = zip(*cg.most_common())
    if ckk[0] == cgk[0]:
            print(min((n - ckv[0] - cgv[1]), (n - ckv[1] - cgv[0])))
    else:
        print(n - ckv[0] - cgv[0])

Measured memory_bytes: 24864
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
#define REP(i, n) for (int i = 0; (i64)(i) < (i64)(n); ++i)

#ifdef ENABLE_DEBUG
template <typename T>
void debug(T value) {
  cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  cerr << value << ", ";
  debug(args...);
}
#define DEBUG(...)                              \
  do {                                          \
    cerr << " \033[33m (L" << __LINE__ << ") "; \
    cerr << #__VA_ARGS__ << ":\033[0m ";        \
    debug(__VA_ARGS__);                         \
    cerr << endl;                               \
  } while (0)
#else
#define debug(...)
#define DEBUG(...)
#endif

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, ga, gb, gc;
  cin >> n >> ga >> gb >> gc;
  vector<int> lens(n);
  REP(i, n) cin >> lens[i];

  i64 minmp = ga + gb + gc;
  vector<int> tmp(n, -1);

  auto calc = [&](auto rec, int i, int ta, int tb, int tc, i64 mp) -> void {
    // if (mp > minmp) return;
    if (i == n) {
      vector<int> t = {ta, tb, tc};
      sort(t.begin(), t.end());
      if (t[0] == 0) return;
      mp += abs(t[2] - ga) + abs(t[1] - gb) + abs(t[0] - gc);
      // DEBUG(mp, ta, tb, tc);
      // REP(j, n) cerr << tmp[j];
      // cerr << endl;
      if (minmp > mp) {
        minmp = mp;
      }
      return;
    }
    int x = lens[i];
    tmp[i] = 0;
    rec(rec, i + 1, ta, tb, tc, mp);
    if (ta < ga) {
      tmp[i] = 1;
      rec(rec, i + 1, ta + x, tb, tc, ta > 0 ? (mp + 10) : mp);
    }
    if (tb < gb) {
      tmp[i] = 2;
      rec(rec, i + 1, ta, tb + x, tc, tb > 0 ? (mp + 10) : mp);
    }
    if (tc < gc) {
      tmp[i] = 3;
      rec(rec, i + 1, ta, tb, tc + x, tc > 0 ? (mp + 10) : mp);
    }
  };
  calc(calc, 0, 0, 0, 0, 0);
  cout << minmp << endl;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#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 INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
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 abs(int x){return x>0?x:-x;}
 
//const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main()
{
	int n;
	cin >> n;
	string s[n];
	int a[26];
	REP(i, 26) a[i] = 1000;
	REP(i, n){
		int b[26] = {};
		cin >> s[i];
		REP(j, (int)s[i].size()) b[(int)(s[i][j] - 'a')]++;
		REP(k, 26){
			a[k] = min(a[k], b[k]);
		}
	}

	REP(i, 26){
		if (a[i] != 1000){
			while (a[i]){
				cout << (char)(i + 'a');
				a[i]--;
			}
		}
	}
	
	cout << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

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

	vector<long long> l, r = {0};
	rep(i,n){
		long long a;
		cin >> a;
		if(a > 0) r.emplace_back(a);
		else l.emplace_back(-a);
	}
	l.emplace_back(0);
	reverse(all(l));

	long long ans = LLONG_MAX;
	rep(i,k + 1){
		int j = k - i;
		if(l.size() <= i or r.size() <= j) continue;

		long long llen = l[i];
		long long rlen = r[j];
		//cout << i << ' ' << j << endl;
		//cout << llen << ' ' << rlen << endl;
		ans = min({ans, llen * 2 + rlen, llen + rlen * 2});
	}
	cout << ans << endl;
}


Measured memory_bytes: 1656
#include <iostream>
#include <set>
using namespace std;
int main () {
	int x, n;
	cin >> x >> n;
	set<int> a;
	int inp;
	for (int i=0; i<n; i++) {
		cin >> inp;
		a.insert(inp);
	}
	for (int d=0; d<10000; d++) {
		if (a.find(x-d) == a.end()) {
			cout << x-d << endl;
			break;
		}
		if (a.find(x+d) == a.end()) {
			cout << x+d << endl;
			break;
		}
	}
}

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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 29)
#define MOD 1000000007
//int dx[4] = {1,0,0,-1};
//int dy[4] = {0,1,-1,0};


int main(){

  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if(abs(a - c) <= d || (abs(a - b) <= d && abs(b - c) <= d))cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define N 200000

int main(void){
    int n;
    int a[N+1];
    int result[N+1] = {};
    int i,j,tmp,ans;
    int count = 0;
    
    scanf("%d", &n);
    
    for(i = 1; i <= n; i++){
        scanf("%d", &a[i]);
    }
    
    for(i = n; i >= 1; i--){
        tmp = 0;
        for(j = i + i; j <= n; j += i){
            tmp += result[j];
        }
        
        if((tmp & 1)^(a[i] & 1)){
            result[i] = 1;
            count++;
        }else{
            result[i] = 0;
        }
    }
    
    if(count){
        printf("%d\n", count);
        for(i = 0; i <= n; i++){
            if(result[i]){
                printf("%d\n", i);
            }
        }
    }else{
        puts("0");
    }
    
    return 0;
}

Measured memory_bytes: 2432
#include <iostream>
#include <vector>
#include <stdio.h>
using namespace std;



int main(void) {
	int N = 0;
	cin >> N;

	vector<int> vH;

	for (int i = 0; i != N; i++) {
		int in = 0;
		cin >> in;
		vH.push_back(in);
	}

	int ans = true;

	for (int i = N-1; i != 0; i--) {
		if (vH[i-1] == vH[i] + 1) {
			vH[i-1] = vH[i-1] - 1;
		}
		else if (vH[i-1] > vH[i] + 1) {
			ans = false;
		}
	}

	if (ans) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}



Measured memory_bytes: 892
def gs() gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def desc(ar) ar.sort!{|x,y|y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end

s = gs
k = gi

d = 5*10**15
s.length.times do |i|
  n = s[i].to_i
  if k<=n**d
    puts n
    exit
  else
    k-=n**d
  end

end


Measured memory_bytes: 14616
#include <iostream>
#include <string>
using namespace std;
 
int main(){
    string n;
    cin>>n;
    long sum = 0;

    for(char a : n){
        sum += int(a - '0');
    }

    if(sum%9 == 0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

    return 0;
}

Measured memory_bytes: 3752
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <iomanip>
using namespace std;

typedef long long ll;

int main() {
	int n; cin >> n;
	vector<int> dp(n + 4, 1e9);
	dp[0] = 0;
	for (int i = 1; i <= n; i++) {
		dp[i] = i;
		int w = 1;
		while (6*w <= i) {
			w *= 6;
			dp[i] = min(dp[i], dp[i - w] + 1);
		}
		w = 1;
		while (9 * w <= i) {
			w *= 9;
			dp[i] = min(dp[i], dp[i - w] + 1);
		}
	}
	cout << dp[n] << endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<n;++i)
#define mrep(i,n) for(ll i=n;i>=0;--i)
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define inf 1001001001001000
#define mod 1000000007
#define pi 3.1415926535
using namespace std;

int main(void){
    double d;
    cin>>d;
    cout<<fixed<<setprecision(10)<<2*d*pi<<endl;
}


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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

int main()
{
int N;
	cin >> N;
	vec(A); vec(B);
	fx(N) {
		vecp(A);
	}
	fx(N) {
		vecp(B);
	}

	ll sum = 0;
	fx(N) {
		if (A[x]>B[x]) {
			sum += B[x] - A[x];
		}
		else if (A[x]<B[x]) {
			if ((B[x]-A[x])%2==0) {
				sum += (B[x] - A[x]) / 2;
			}
			else {
				sum += (B[x] - 1 - A[x]) / 2;
			}
		}
		//ce(sum)
	}
	if (sum>=0) {
		cey;
	}
	else {
		cen;
	}

    return 0;
}



Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


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

	int n, m;
	cin >> n >> m;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	vector<bool> ok(n, true);
	rep(i, m) {
		int x, y;
		cin >> x >> y;
		x--; y--;
		if (a[x] <= a[y]) ok[x] = false;
		if (a[x] >= a[y]) ok[y] = false;
	}
	int ans = 0;
	rep(i, n) ans += ok[i];
	cout << ans << '\n';
}

Measured memory_bytes: 3728
function fizzbuzz(n)
    divisable3 = n % 3 == 0
    divisable5 = n % 5 == 0
    if divisable3 || divisable5
        0
    else
        n
    end
end

function main()
    str = readline()
    n = parse(Int, str)

    s = 0
    for i = 1:n
        s += fizzbuzz(i)
    end

    println(s)
end

main()


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

int a[6];
string s;
void C(int i, int j, int k, int l){
    int t;t=a[i];a[i]=a[j];a[j]=a[k];a[k]=a[l];a[l]=t;
}

int main(){
    for(int i=0; i<6; i++) cin >> a[i];
    cin >> s;
    for(int i=0; i<s.size(); i++){
        if(s[i]=='E')for(int j=0; j<3; j++)C(0,2,5,3);
        if(s[i]=='W')C(0,2,5,3);
        if(s[i]=='S')for(int j=0; j<3; j++)C(0,1,5,4);
        if(s[i]=='N')C(0,1,5,4);
    }
    cout << a[0] << endl;
}


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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
//typedef pair<ll, ll> P;
const double INF = 1e10;
//const ll INF = LONG_LONG_MAX / 10;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef pair<double, double> P;

void print_line(vector<int> &line) {
    if (line.size() == 0ll) {
        cout << endl;
        return;
    }
    for (ll i = 0; i < line.size(); i++) {
        cout << line[i];
        if (i == line.size() - 1) cout << endl;
        else cout << ' ';
    }
}


typedef priority_queue<long long, vector<long long>, greater<long long>> PQ_ASK;
const int mod = 1000000007;

struct Q {
    int to, depth;
};

void bfs(int from, vector<vector<int>> &tos, set<int> &used, vector<int> &ans) {
    queue<Q> q;
    q.push({from, 0});

    while (!q.empty()) {
        Q top = q.front();
        q.pop();
        if (!contain(used, top.to)) {
            continue;
        }

        used.erase(top.to);
        ans[top.to] = top.depth;

        for (int to : tos[top.to]) {
            q.push({to, top.depth + 1});
        }
    }

}

int main() {
    int n;
    cin >> n;
    vector<vector<int>> tos(n);
    rep(i, n) {
        int j, k;
        cin >> j >> k;
        j--;
        rep(l, k) {
            int m;
            cin >> m;
            m--;
            tos[j].push_back(m);
        }
    }

    vector<int> ans(n, -1);
    rep(i, n) sort(tos[i].begin(), tos[i].end());
    set<int> used;
    rep(i, n) used.insert(i);
    bfs(0, tos, used, ans);

    rep(i, n) cout << (i + 1) << ' ' << ans[i] << endl;
}




Measured memory_bytes: 3180
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define VPII vector<pair<int,int> >
#define F first
#define S second
#define RF(x) freopen(x,"r",stdin)
#define WF(x) freopen(x,"w",stdout)
typedef long long LL;
using namespace std;
typedef pair<LL,LL> PLL;
typedef pair<int,int> PII;
LL MOD = 1e9+7;
const int SIZE = 1e6+5;
const LL INF = 1<<30;
const double eps = 1e-13;

int h[100009];

int main(){
	DRIII(n,a,b);
	REP(i,n)RI(h[i]);
	int st=1,en=1e9;
	while(st<en){
		LL mi=(st+en)/2;
		LL need=0;
		REP(i,n){
			LL x=h[i]-(LL)b*mi;
			need+=max(0LL,(x+(a-b)-1)/(a-b));
		}
		if(need<=mi)en=mi;
		else st=mi+1;
	}
	printf("%d",st);
}


Measured memory_bytes: 640
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for ( int i=1; i<=int(n); i++ )  
#define MP make_pair
#define PB push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()
#define X first
#define Y second
template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

typedef long long LL;
typedef pair<int, int> pii;
typedef long double LD;
const int INF = 0x3f3f3f3f;

template <class T>  
inline bool RD(T &ret) {  
        char c; int sgn;  
        if (c = getchar(), c == EOF) return 0;  
        while (c != '-' && (c<'0' || c>'9')) c = getchar();  
        sgn = (c == '-') ? -1 : 1 , ret = (c == '-') ? 0 : (c - '0');  
        while (c = getchar(), c >= '0'&&c <= '9') ret = ret * 10 + (c - '0');  
        ret *= sgn;  
        return 1;  
}  
template <class T>  
inline void PT(T x) {  
        if (x < 0) putchar('-') ,x = -x;  
        if (x > 9) PT(x / 10);  
        putchar(x % 10 + '0');  
}


const int N = 1e5 + 100;

vector<int> G[N];
int dp[N];
int res = 0;
int first = -1;
bool DP(int u, int fa) {
    dp[u] = u;
    int all = 0, sel = 0;
    for(int v : G[u]) {
        if(v == fa) continue;
        all ++;
        int c = DP(v, u);
        sel += c;
        if(c == 0) dp[u] = dp[v]; 
    }
    

    if(all > sel + 1) {
        res += all - (sel + 1);
        if(first == -1) first = dp[u];
        return true;
    } else {
        if(sel) return true;
        else return false;
    }
}

int main() {
    int n;
    cin >> n;
    for(int i = 1; i < n; i ++) {
        int u, v;
        scanf("%d %d", &u, &v);
        u ++, v ++;
        G[u].push_back(v);
        G[v].push_back(u);
    }

    DP(1, 1);
    int ans = res;
    res = 0;
    if(first != -1) {
        DP(first, first);
        ans = min(ans, res);
    }
    cout << ans + 1 << endl;
}


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

int main() {
  // ここにプログラムを追記
  int a,b,c,d;
  cin >> a ;
  b=a%10;
  c=(a-b)%100;
  d=(a-b-c)%1000;
  cout << b+c/10+d/100 <<endl;
  
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

const mod = 1000000007

func main() {
	var n int
	fmt.Scan(&n)

	ans := (powmod(10, n) - 2*powmod(9, n)%mod + powmod(8, n) + mod) % mod
	fmt.Println(ans)
}

func powmod(x, n int) int {
	res := 1
	for i := 0; i < n; i++ {
		res *= x
		res %= mod
	}
	return res
}


Measured memory_bytes: 1788
#include<bits/stdc++.h>
// unbounded knapsack..
using namespace std;
using ll=long long ;
int main(){
    ll n,k;
    cin>>n>>k;
    vector<ll>st(n);
    for(int i=0;i<n;i++) cin>>st[i];
    vector<int>dp(k+1,0);
    //for(auto x:st) cout<<x<<" ";
    for(int i=0;i<=k;i++){
        for(int x:st){
            if(i>=x && dp[i-x]==0) dp[i]=1;
        }
        // for(auto x:dp) cout<<x<<" ";
        // cout<<endl;
    }
    cout<<(dp[k]>0 ? "First" : "Second");
    return 0;

}

Measured memory_bytes: 640
using namespace std;
#include <bits/stdc++.h>
#define rep(i, s) for (int i = 0; i < s; ++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(v) (v.begin(), v.end())
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define EPS (1e-7)
#define INF (1e10)
#define PI (acos(-1))
const ll mod = 1000000007;
 
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll N;
  cin>>N;
  ll ans=1;
  while(N>=ans*ans){
    if(N==ans*ans){
      cout<<ans*ans<<endl;
      return 0;
    }
    else
      ans++;
  }
  cout<<(ans-1)*(ans-1)<<endl;
}
  







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

int N,C[501],S[501],F[501];
int main(void){
    cin >> N ;
    for(int i=1;i<N;i++)cin >> C[i] >> S[i] >> F[i];
    int T,pos;
    S[N] = 0;
    for(int st=1;st<=N;st++){
        T = 0;//stの出発時間
        for(int i=st;i<N;i++){//iは出発駅
            if(T < S[i])T = S[i];
            else if(T%F[i]!=0)T += (F[i] - T%F[i]);
            T += C[i];//次の駅に到着
        }
        cout << T << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std ;
#define int                 long long
#define ull                 unsigned long long int
#define ld                  long double
#define vi                  vector<int>
#define vii                 vector<pair<int,int>>
#define vvi                 vector<vector<int>>
#define pii                 pair<int,int>
#define pqb             	priority_queue<int>
#define pqs             	priority_queue<int,vi,greater<int> >
#define prec(x)             fixed<<setprecision(15)<<x
#define all(x)              x.begin(),x.end()
#define rall(x)             x.rbegin(),x.rend()
#define rev(x)              reverse(x.begin(),x.end())
#define mset(a,b)           memset(a,b,sizeof(a))
#define mcpy(a,b)           memcpy(a,b,sizeof(a))
#define fo0(i,n)            for(int i=0,i##end=n;i<i##end;i++)
#define fo1(i,n)            for(int i=1,i##end=n;i<=i##end;i++)
#define fo(i,a,b)           for(int i=a,i##end=b;i<=i##end;i++)
#define foe(i,x)            for(__typeof((x).end())i=(x).begin();i!=(x).end();++i)
#define fre(i,x)            for(__typeof((x).rend())i=(x).rbegin();i!=(x).rend();++i)
#define mk(arr,n,type)  	type *arr=new type[n];
#define dbg(x) cerr << #x << " is " << x << endl;
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0)
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
clock_t beg = clock();
const int inf=1e18;const int mod=1e9+7;const int N=2e5+9;
void FILE_IO(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}

void JH(){
    int d=0,e=0,f=0,g=0,p=0,w=0,flag=0,ans=0,res=0,cnt=0,sum=0;double f1=0.0,f2=0.0,f3=0.0;
    int n;cin>>n;
    d=n%10;
    if(d==2 or d==4 or d==5 or d==7 or d==9){
    	cout<<"hon";
    }
    else if(d==0 or d==1 or d==6 or d==8){
    	cout<<"pon";
    }
    else{
    	cout<<"bon";
    }
}

int32_t main()
{
    FILE_IO();FAST_IO;int t=1;
    // cin>>t;
    while(t--){JH();}cerr<<"Execution time: "<<(double)(clock()-beg)/1000<<"s ";
}

Measured memory_bytes: 3780
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <cstdio>
#define INF 1000000000000
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef long double ld;
using namespace std;

int main(){
  string s;
  cin >> s;
  int a[3] = { };
  REP(i, s.size())a[s[i]-'a']++;
  sort(a, a+3);
  if((a[1]-a[0]) < 2 && (a[2]-a[0]) < 2 && (a[2]-a[1]) < 2) cout << "YES" << endl;
  else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair

ll n,k,arr[100005],dp[100005];

int main()
{
    cin>>n>>k;
    for(ll i=0;i<100005;i++) dp[i] = LONG_LONG_MAX;
    for(ll i=0;i<n;i++) cin>>arr[i];
    dp[0] = 0;
    dp[1] = abs(arr[1]-arr[0]);
    for(ll i=2;i<n;i++)
    {
        for(ll j=1;j<=k;j++)
        {
            if(i-j>=0)
                dp[i] = min(abs(arr[i]-arr[i-j])+dp[i-j],dp[i]);
        }
    }
    cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> PII;

// chmax, chmin
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;
}

template <typename T>
function<T(T, T)> op_max = [](T a, T b) -> T { return max(a, b); };
template <typename T>
function<T(T, T)> op_min = [](T a, T b) -> T { return min(a, b); };

template <typename T>
function<T(T, T)> op_sum = [](T a, T b) -> T { return a + b; };

namespace detail {
template <typename T, std::size_t NDIMS>
struct vector_builder {
  using type = std::vector<typename vector_builder<T, NDIMS - 1>::type>;

  static type make(std::vector<std::size_t> dims, const T& v = {}) {
    const auto vec = std::vector<T>(dims.empty() ? 0 : dims.back(), v);
    if (!dims.empty()) dims.pop_back();
    return vector_builder<std::vector<T>, NDIMS - 1>::make(dims, vec);
  }
};

template <typename T>
struct vector_builder<T, 1> {
  using type = std::vector<T>;

  static type make(std::vector<std::size_t> dims, const T& v = {}) {
    return type(dims.empty() ? 0 : dims.back(), v);
  }
};
}  // namespace detail

template <typename T, typename... SIZE_T>
auto exvector(const T& v, SIZE_T... dims) {
  static_assert(sizeof...(dims) != 0, "invalid dimension");
  std::vector<std::size_t> vec_dims{dims...};
  return detail::vector_builder<T, sizeof...(dims)>::make(vec_dims, v);
}

using namespace std;
//********************  dumps ************************//

template <typename T>
void dump(const T& data, vector<int>& iter) {
  cout << data << " ";
}
template <typename T>
void dump(const vector<T>& data, vector<int>& iter) {
  for (auto elem : data) dump(elem, iter);
  cout << endl;
}

template <typename T>
void dump(const vector<vector<T>>& data, vector<int>& iter) {
  for (auto elem : iter) {
    cout << "[" << elem << "]";
  }
  cout << endl;
  for (int i = 0; i < data.size(); i++) {
    iter.push_back(i);
    dump(data[i], iter);
    iter.pop_back();
  }
  cout << endl;
}

template <typename T>
void dump(const vector<T>& data, int dummy) {
  for (int i = 0; i < data.size(); i++) {
    cout << "[" << i << "] " << data[i] << endl;
  }
}
template <typename T>
void dump(const T& data) {  // T : data, U = base type val.
  vector<int> iter;
  dump(data, iter);
}
///////////////////////////////////////////////

LL calc(LL A) {
  if (A == 0) return 0;
  if (A == 1) return 1;
  if (A == 2) return 3;
  if (A == 3) return 0;

  LL base = 1;
  while (base <= A) base *= 2;
  base /= 2;
  LL ans = 0;
  if ((A - base) % 2 == 0) ans += base;
  return ans + calc(A - base);
}

void solve(long long A, long long B) {
  if (A == 0) A++;
  cout << (calc(B) ^ calc(A - 1)) << endl;
}

int main() {
  cout << setprecision(10);
  long long A;
  scanf("%lld", &A);
  long long B;
  scanf("%lld", &B);
  solve(A, B);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

typedef long long ll;

ll dp[100005];

int main(int argc, char *argv[])
{
	int N, W;
	int w[105], v[105];
	ll inf = 1e13;

	cin >> N >> W;

	for (int i = 0; i < N; i++) {
		cin >> w[i] >> v[i];
	}
	for (int i = 0; i <= 100000; i++) {
		dp[i] = inf;
	}
	dp[0] = 0;
	for (int i = 1; i <= N; i++) {
		for (int j = 100000; j >= 0; j--) {
			if  (j - v[i - 1] >= 0) {
				dp[j] = min(dp[j], dp[j - v[i - 1]] + w[i - 1]);
			}
		}
	}
	ll ans = 0;
	for (int i = 0; i <= 100000; i++) {
		if (dp[i] <= W) {
			ans = max(ans, (ll) i);
		}
	}

	cout << ans << endl;

	return 0;
}

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

public class Hello{
    public static void Main(){
        var n = Console.ReadLine();
        var input = Console.ReadLine().Split(' ').Select(x => Int64.Parse(x));
        long ret = 1;
        foreach(var i in input)
            if(i == 0) {
                Console.WriteLine("0");
                return;
            }
        
        foreach(var i in input) {
            if(1000000000000000000 / ret < i) {
                Console.WriteLine("-1");
                return;
            }
            ret *= i;
        }
        System.Console.WriteLine(ret);
    }
}


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

using namespace std;

int n, ans;

int main() {
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n;
	for(int i = 1; i <= n; i++)
		ans += (n - 1) / i;
	return cout << ans << endl, 0;
}

Measured memory_bytes: 3644
//Relive your past life.
//Face your demons.
//The past is never dead,it is not even past.
//The memories are not only the key to the past but...also to the future.
//coded in Rusty Lake
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define ll   long long
#define pb   push_back
#define mp   make_pair
#define orz  1000000007
using namespace std;
int n,a[100005],ans,s;
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;++i)scanf("%d",a+i);
    sort(a+1,a+n+1);
    for(int i=1;i<n;++i){
        s+=a[i];
        if(s>orz)s=orz;
        if(s*2<a[i+1])ans=i;
    }
    printf("%d\n",n-ans);
    //system("pause");
    return 0;
}


Measured memory_bytes: 640
///not today

#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
typedef pair<int, int> pii;
typedef pair<int, pair<int, int> > pipii;
typedef pair<long long, long long> pll;

#define SZ(x) (int)(x).size()
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define xmax(x, y) (x) = max((x), (y))
#define xmin(x, y) (x) = min((x), (y))
#define F first
#define S second
#define int long long
#define accept_sho ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#define lc (v << 1)
#define rc ((v << 1)| 1)
#define mid ((R + L) >> 1)

const int maxn = 3e2 + 2;
int dp[maxn][maxn][maxn];

int32_t main(){
      string s;
      int K, n;
      cin >>s >>K;
      n = SZ(s);
      for(int k = 0; k <= K; k ++){
      for(int j = 0; j < n; j ++){
      for(int i = 0; i + j < n; i ++){
                        dp[k][j][i] = 1;
                        if(j == 0)
                              continue;
                        if(s[i] == s[i + j]){
                              if(j > 1){
                                    dp[k][j][i] = dp[k][j - 2][i + 1] + 2;
                              }
                              else{
                                    dp[k][j][i] = 2;
                              }
                        }
                        else{
                              xmax(dp[k][j][i], dp[k][j - 1][i]);
                              xmax(dp[k][j][i], dp[k][j - 1][i + 1]);
                              if(k){
                                    if(j > 1){
                                          xmax(dp[k][j][i], dp[k - 1][j - 2][i + 1] + 2);
                                    }
                                    else{
                                          dp[k][j][i] = 2;
                                    }
                              }
                        }
      }
      }
      }
      cout <<dp[K][n - 1][0] <<endl;
}


Measured memory_bytes: 216920
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define ll long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
static const ll MAX = 1000000000000000;
static const int NIL = -1;
using namespace std;
const long double EPS = 0.0000000001;
const long double PI = (acos(-1));
const int MOD = 1000000007;

int main() {
  ll n, i, j, k, cnt = 0;
  cin >> n;
  vector<ll> L(n);
  for (i = 0; i < n; i++) cin >> L[i];
  sort(L.begin(), L.end());  // vector
  for (i = 0; i < n - 2; i++) {
    for (j = i + 1; j < n - 1; j++) {
      if (L[i] == L[j]) continue;
      for (k = j + 1; k < n; k++) {
        if (L[j] == L[k]) continue;
        if (llabs(L[i] - L[j]) < L[k] && llabs(L[i] + L[j]) > L[k]) cnt++;
      }
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 3680
j,o,i,m;main(c){for(;c=~getchar();c&1?o|i?o=i=0,j=1:++j:c+74?i?j=o=0:0,++o:++i)o<=j&o<=i&m<o?m=o:0;m=!printf("%d\n",m);}

Measured memory_bytes: 0
#include "bits/stdc++.h"
using namespace std;

int main()
{
	int N;
	cin >> N;
	int ans = 0;
	int flg = 0;

	for (;;)
	{
		if (N - 3 < 3)
		{
			break;
		}
		else
		{
			if (flg == 0)
			{
				flg = 1;
				ans++;
			}
			N -= 3;
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
n, q = map(int, input().split())
s = input()
ac = [0] * n
for i in range(n - 1):
  ac[i + 1] = ac[i] + int(s[i:i + 2] == "AC")
for i in range(q):
  l, r = [int(lr) - 1 for lr in input().split()]
  print(ac[r] - ac[l])

Measured memory_bytes: 9412
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define ss(x) (int) x.size()
#define sz(x) (int) x.size()
#define fi first
#define se second
#define cat(x) cerr << #x << " = " << x << endl
#define rep(i, j, n) for (int i = j; i <= n; ++i)
#define per(i, j, n) for (int i = n; j <= i; --i)
#define all(x) x.begin(), x.end()

using namespace std;

int n, x;
int used[300005];
int ans[300005];

void put(int pos, int x) {
	used[x] = 1;
	ans[pos] = x;
}

int main() {
	scanf ("%d%d", &n, &x);
	if (x == 1 || x == 2 * n - 1) return printf ("No\n"), 0;
	printf ("Yes\n");
	if (n == 2) 
		return printf ("1 2 3\n"), 0;
	if (x < 2 * n - 2) {
		put(n, 1);
		put(n + 1, x);
		put(n + 2, x + 1);
		put(n - 1, x + 2);
	}
	else {
		put(n, 2 * n - 1);
		put(n + 1, x);
		put(n + 2, x - 1);
		put(n - 1, x - 2);
	}
	int j = 1;
	rep(i, 1, 2 * n - 1) {
		if (ans[i]) {
			printf ("%d\n", ans[i]);
		}
		else {
			while (used[j]) j++;
			printf ("%d\n", j);
			j++;
		}
	}
		
		
	
		
	
    return 0;
}



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

typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1e9+7;
#define rep(i,N) for(ll i=0; i<(N); i++)

char c[2][3];

int main(){

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

rep(i,2){
	rep(j,3){
		cin>>c[i][j];
	}
}

if(c[0][0]==c[1][2]){
	if(c[0][1]==c[1][1]){
		if(c[0][2]==c[1][0]){
			cout<<"YES"<<endl;
			return 0;
		}
	}
}

cout<<"NO"<<endl;

}
	


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Text;

namespace codeTester.contest190818
{
    class ProblemA
    {
        static long a = 0;
        static string s = "";
        static string answer = "";

        public static void Main(string[] args)
        {
            Input();
            Logic();
            Output();
        }

        static void Input()
        {
            a = long.Parse(Console.ReadLine());
            s = Console.ReadLine();
        }

        public static List<long> ReadSpaceSeparatedValues()
        {
            List<long> values = new List<long>();
            string[] inputs = Console.ReadLine().Split(' ');
            foreach (string input in inputs)
            {
                values.Add(long.Parse(input));
            }

            return values;
        }

        static void Logic()
        {
            if (a < 3200)
            {
                answer = "red";
            }
            else
            {
                answer = s;
            }
        }

        static void Output()
        {
            Console.WriteLine(answer);
        }
    }
}


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

int main(){

    int n,k;
    cin >> n >> k;

    if(n%k==0){
        cout << 0 << endl;
    }else{
        cout << 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#define Inf 1000000000
#define nmax_def 1100000
#define mod 1000000007
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;

vector<bool> p_(nmax_def, true);
void p_ini() {
	p_[0] = false;
	p_[1] = false;
	ll i = 2;
	while (1) {
		ll j = i * 2;
		while (1) {
			if (j >= nmax_def)
				break;
			p_[j] = 0;
			j += i;
		}
		i++;
		if (i >= nmax_def)
			break;
	}
	return;
}

vector<vl> pow_;
ll Atmp;
void pow_ini() {
	ll ptmp = Atmp;
	vl powtmp;
	powtmp.push_back(ptmp);
	rep(j, 62) {
		ll nxt = powtmp[j] * powtmp[j];
		nxt %= mod;
		powtmp.push_back(nxt);
	}
	pow_.push_back(powtmp);
	return;
}

ll pow1(ll i, ll b) {
	ll ans = 1;
	rep(n, 62) {
		if ((b >> n) % 2 == 1) {
			ans *= pow_[i][n];
			ans %= mod;
		}
	}
	return ans;
}

int main() {
	vi plist(nmax_def, 0);
	p_ini();
	int N;
	cin >> N;
	vi A(N);
	rep(i, N)
		cin >> A[i];
	rep(n, N) {
		int x = A[n];
		rep(i, 1100) {
			if (!p_[i])
				continue;
			if (x % i == 0) {
				int count = 0;
				while (1) {
					x /= i;
					count++;
					if (x % i != 0)
						break;
				}
				plist[i] = max(plist[i], count);
				// x /= i^count
			}
		}
		if (x > 1) {
			plist[x] = max(plist[x], 1);
		}
	}
	ll lcm = 1;
	rep(i, nmax_def) {
		rep(j, plist[i]) {
			lcm *= (ll)i;
			lcm %= mod;
		}
	}
	ll ans = 0;
	rep(i, N) {
		Atmp = A[i];
		pow_ini();
		ll anstmp = lcm * pow1(i, mod - 2);
		anstmp %= mod;
		ans += anstmp;
		ans %= mod;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 9916
#include<iostream>
#include<vector>
#include<utility>

using confession = std::pair<int, int>;

int main(){
    int N;
    std::cin >> N;
    std::vector<std::vector<confession>> A(N);
    for(int i = 0; i < N; i++){
        int num;
        std::cin >> num;
        std::vector<confession> conf(num);
        for(int j = 0; j < num; j++){
             std::cin >> conf[j].first >> conf[j].second;
             conf[j].first--; // to 0 origin
        }
        A[i] = conf;
    }

    // bit exhaustive search
    int maxHonestNum = 0;
    for(int bit = 0; bit < (1 << N); bit++){
        // 現在の正直者
        int honestNum = 0;
        std::vector<bool> isHonest(N, false);
        for(int i = 0; i < N; i++){
            if(bit & (1 << i)){
                // i番目の人は正直者とする
                honestNum++;
                isHonest[i] = true;
            }
        }

        // 正直者の証言について論理が通っていることを確認する
        bool isResonable = true;
        for(int i = 0; i < N; i++){
            if(!isHonest[i]) continue;
            for(int j = 0; j < A[i].size(); j++){
                if(isHonest[A[i][j].first] != A[i][j].second){
                    isResonable = false;
                    break;
                }
            }
            if(isResonable == false){
                break;
            }
        }

        // 論理が通っていれば数える
        if(isResonable){
            maxHonestNum = std::max(honestNum, maxHonestNum);
        }
    }

    std::cout << maxHonestNum << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> Pii;

int N;

int main() {
    cin >> N;

    ll sum = 0;
    for (int i = 1; i <= N; i++) {
        if (i % 3 != 0 && i % 5 != 0) {
            sum += i;
        }
    }

    cout << sum << endl;
    
    return 0;
}

Measured memory_bytes: 3620
d_the = [ [-14, 3],[12, -23],[12, 3] ] # the
d_this_that = [
    [-14, -1, -10], [-14, -1, 16], [-14, 25, -10], [12, -1, -10], # this
    [-14, 7, 7], [12, -19, 7], [12, 7, -19], # that
]

$dlist = d_the + d_this_that
$dlist.sort!

ALPHA = ("a".."z").to_a

def rotX(str, r)
    str.tr(ALPHA.join , ALPHA.rotate(r).join)
end

# s = "tha is it.that"
# (0..26).each do |r|
#     p rotX(s, r)
# end

def df(str)
    d = [str[0].ord - str[1].ord, str[1].ord - str[2].ord]
    if str.size == 4
        d.push str[2].ord - str[3].ord
    end
    d
end

def find_the_this_that(line)
    line.split(/[. \n]+/).each do |word|
        if(word.size == 3 or word.size == 4)
            ds = df(word)
            if($dlist.include?(ds))
                return 't'.ord - word[0].ord
            end
        end
    end
    0
end

STDIN.each_line {|line| 
    d = find_the_this_that(line)
    print rotX(line, d)
}

Measured memory_bytes: 8648
#include<iostream>
#include<math.h>
using namespace std;

int main() {
    int N; cin >> N;
    int ans = 0;
    for (int i = 0; i <= 7; i++) {
        int num = pow(2, i);
        if (num <= N) {
            ans = num;
        } else {
            break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3944
#include <bits/stdc++.h>
using namespace std;
/* * * *   * * *   	* * * */
#define ll long long
#define ld long double
#define ms(a,v) memset(a,v,sizeof a)
#define pii pair<int, int>
/* * * *   * * *   	* * * */
/* *
 *
 * Author: Hamkor
 *
 * */
int main(){
	int n, d;  cin>>n>>d;
	double c[n][d];
	for(int i=0; i<n; ++i) for(int j=0; j<d; ++j) cin>>c[i][j];
	int ans=0;
	for(int i=0; i<n; ++i) for (int j=i+1; j<n; ++j){
		double sq = 0;
		for(int k=0; k<d; ++k) sq+= abs(c[i][k] - c[j][k])*abs(c[i][k] - c[j][k]);
	    sq = sqrt(sq);
	    if(sq == (double)floor(sq)) ans++;
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
MOD = 10**9+7
n = int(input())
la = list(map(int,input().split()))
L = [-1]*(n+1)
l = 0
for i in range(n+1):
  a = la[i]
  if L[a] == -1:
    L[a] = i
  else:
    l = i - L[a] - 1
    break

MAX = n
factorial = [1, 1]
inverse = [0, 1]
inverse_factorial = [1, 1]
for i in range(2,MAX+1):
  factorial.append( (factorial[-1]*i)%MOD )
  inverse.append( (-inverse[MOD%i]*(MOD//i))%MOD )
  inverse_factorial.append( (inverse_factorial[-1]*inverse[-1])%MOD )

def C_MOD(n, k):
  if k < 0 or k > n:
    return 0
  k = min(k,n-k)
  return factorial[n] * inverse_factorial[k] * inverse_factorial[n-k] % MOD

print(n)
#print((2*C_MOD(n-1,1)-C_MOD(n-1-l,1)+C_MOD(n-1,2)+1)%MOD)
for i in range(2,n+1):
  if n > l+1:
    print((2*C_MOD(n-1,i-1)-C_MOD(n-1-l,i-1)+C_MOD(n-1,i)+C_MOD(n-1,i-2))%MOD)
  else:
    print((2*C_MOD(n-1,i-1)+C_MOD(n-1,i)+C_MOD(n-1,i-2))%MOD)
print(1)

Measured memory_bytes: 24048
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	long long n, i, j, k, ans, x;
	cin >> n;
	vector<long long> a(n + 1), b(n);
	for (i = 0; i <= n; i++) cin >> a[i];
	ans = 0;
	for (i = 0; i < n; i++) {
		cin >> b[i];
		x = min(b[i], a[i]);
		ans += x;
		b[i] -= x;
		x = min(b[i], a[i + 1]);
		a[i + 1] -= x;
		b[i] -= x;
		ans += x;
	}

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>
int main(void){
	int money;
	int count = 0;
	while(scanf("%d",&money)){
		if(money == 0){
			break;
		}
	money = 1000 - money;
	while(1){
		money -= 500;
		if(money < 0){
			money += 500;
			break;
		}
		else{
			count++;
			break;
		}
	}
	while(1){
		money -= 100;
		if(money < 0){
			money += 100;
			break;
		}
		else{
			count++;
		}
	}
	while(1){
		money -= 50;
		if(money < 0){
			money += 50;
			break;
		}
		else{
			count++;
		}
	}
	while(1){
		money -= 10;
		if(money < 0){
			money += 10;
			break;
		}
		else{
			count++;
		}
	}
	while(1){
		money -= 5;
		if(money < 0){
			money += 5;
			break;
		}
		else{
			count++;
		}
	}
	while(1){
		money -= 1;
		if(money < 0){
			money += 1;
			break;
		}
		else{
			count++;
		}
	}
	printf("%d\n",count);
		count = 0;
	}
	return 0;
}

Measured memory_bytes: 600
N = int(input())
A = input().split()
for i in range (N) :
    A[i] = int(A[i])

A = sorted(A)
fl = True

for i in range (1 , N) :
    if (A[i - 1] == A[i]) :
        fl = False
        break

print ('YES' if fl else 'NO')

Measured memory_bytes: 20796
#include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
using namespace std;
#define __int64 long long
__int64 dp[110][21];
int ta[110],t;
const int INF=0;
int main(){
int n;
cin>>n;
for(int i=1;i<n;i++)cin>>ta[i];
cin>>t;
for(int i=0;i<110;i++)for(int j=0;j<21;j++)dp[i][j]=INF;
dp[1][ta[1]]=1;
for(int i=2;i<=n-1;i++){
	for(int j=0;j<=20;j++){
	if(j-ta[i]>=0&&dp[i-1][j-ta[i]]!=INF)dp[i][j]+=dp[i-1][j-ta[i]];
	if(j+ta[i]<=20&&dp[i-1][j+ta[i]]!=INF)dp[i][j]+=dp[i-1][j+ta[i]];
	}
}
cout<<dp[n-1][t]<<endl;
return 0;
}

Measured memory_bytes: 1172
N,M=map(int,input().split())
A=list(map(int,input().split()))
XY=[list(map(int,input().split())) for i in range(M)]
class UnionFind:
    def __init__(self,N):
        self.Parent=[-1]*N
    def unite(self,m,n):
        rm=self.root(m)
        rn=self.root(n)
        if rm==rn:
            return False
        else:
            if self.size(rm)<self.size(rn):
                rm,rn=rn,rm
            self.Parent[rm]+=self.Parent[rn]
            self.Parent[rn]=rm
            return True
    def root(self,n):
        if self.Parent[n]<0:
            return n
        else:
            self.Parent[n]=self.root(self.Parent[n])
            return self.Parent[n]
    def size(self,n):
        return -self.Parent[self.root(n)]
u=UnionFind(N)
for x,y in XY:
    u.unite(x,y)
if u.size(0)==N:
    print(0);exit()
d={}
x=[]
for i,a in enumerate(A):
    r=u.root(i)
    if r not in d:
        d[r]=a
    elif a<d[r]:
        x.append(d[r])
        d[r]=a
    else:
        x.append(a)
rem=2*(N-1-M)-len(d)
print(sum([v for v in d.values()])+sum(sorted(x)[:rem]) if len(x)>=rem else "Impossible")

Measured memory_bytes: 34196
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();
		
		// 計算
		//int result = 0;
		for(int i = 0; i < s.length(); i++){
		    System.out.print("x");
		}
		
		// 出力
		//System.out.println(result);
	}
}



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


int main() {
    int A,B,C,D;

    cin >> A>>B>>C>>D;

    int T,S;

    T=C/B;

    if(C%B!=0){
        T++;
    }

    S=A/D;

    if(A%D!=0){
        S++;
    }

    if(T<=S){
        cout <<"Yes" <<endl;
    }else{
        cout <<"No" <<endl;
    }
}

Measured memory_bytes: 3596