akhauriyash/Code-Regression huggingface dataset:
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 1e6 + 10;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n, k;
	cin >> n >> k;
	LL ans = 0;
	for (int i = k + 1; i <= n; i++)
	{
		ans += 1LL * n / i * (i - k) + max(0, n % i - k + 1);
	}
	if (k == 0) ans = 1LL * n * n;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define ld long double
#define pb 	push_back
#define endl '\n'
#define all(x) (x).begin(),(x).end()
#define mod 1000000007LL
#define F first
#define S second
#define speed ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0)
main()
{
	int a,b,c;
	cin>>a>>b>>c;
	cout<<max(0LL,b+c-a);
}

Measured memory_bytes: 256
import fractions

n = int(input())
a = list(map(int, input().split()))
gcd_0 = fractions.gcd(a[0],a[1])
gcd_1 = min(a[0], a[1])
for i in range(2,n):
    gcd_1 = max(gcd_0, fractions.gcd(gcd_1, a[i]))
    gcd_0 = fractions.gcd(gcd_0, a[i])

gcd_0 = fractions.gcd(a[0],a[1])
gcd_2 = max(a[0], a[1])
for i in range(2,n):
    gcd_2 = max(gcd_0, fractions.gcd(gcd_2, a[i]))
    gcd_0 = fractions.gcd(gcd_0, a[i])
    
print(max(gcd_2,gcd_1))

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORR(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUG_VEC(v)                               \
  cerr << #v << ": ";                              \
  REP(__i, (v).size()) cerr << ((v)[__i]) << ", "; \
  cerr << endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(), x.end()
#define MM << " " <<
int main() {
    int N;
    cin >> N;
    // A,B,Cは自然数
    // A = N/B - C/B N/B > N/C x
    // N-1以下のABの解の個数
    int ans = 0;
    int a,b = 1;

    for (int a=1;a<=N;a++){
        for(int b=1;b<=N/a;b++){
            if(a*b<N) ans++;
        }
    }
    

    cout << ans << endl;
}


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

using namespace std;

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

int main(){
    int cnt = 0;
    string w;
    cin >> w;
    while(1){
        string s;
        cin >> s;
        if(s == "END_OF_TEXT")break;
    
        rep(i,s.size())if(s[i] >= 'A' && s[i] <= 'Z')s[i] += 32;
        if(s == w)cnt++;
    }
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 3204
#include <iostream>
#include <string>

using namespace std;

int main(){
    int a,b;
    string op;
    while(a>=0){
        cin>>a>>op>>b;
        if(op=="?")break;
        if(op=="+")cout<<a+b<<endl;
        if(op=="-")cout<<a-b<<endl;
        if(op=="*")cout<<a*b<<endl;
        if(op=="/")cout<<a/b<<endl;
    }
    return 0;
}


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

using namespace std;

struct UnionFind {
    vector<int> par;
    
    UnionFind(int size) : par(size+1, -1) {
        for(int i=1; i<=size; i++) {
            par[i]=i;
        }
    }
    
    int root(int x) {
        if(par[x]==x) return x;
        return par[x]=root(par[x]);
    }
    
    bool is_same_group(int x, int y) {
        int rx=root(x);
        int ry=root(y);
        
        return rx==ry;
    }
    
    void unite(int x, int y) {
        int rx=root(x);
        int ry=root(y);
        
        if(rx==ry) return ;
        par[rx] = ry;
    }

    int group_num() {
        int ret=0;
        for(int i=1; i<par.size(); i++) {
            if(par[i]==i) ret++;
        }
        return ret;
    }
};

int main() {
    int N, M;
    cin >> N >> M;
    
    vector<pair<int, int> > E(M);
    for(int m=0; m<M; m++) {
        int a, b;
        cin >> a >> b;
        E[m] = make_pair(a, b);
    }
    
    int cnt=0;
    for(int m=0; m<M; m++) {
        UnionFind tree(N);
        
        for(int n=0; n<M; n++) {
            if(m==n) continue;
            tree.unite(E[n].first, E[n].second);
        }
        
        if(tree.group_num()>=2) cnt++;
    }
    
    cout << cnt << endl;


    return 0;
    
}

Measured memory_bytes: 256
// AOJ NTL_1_A
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=NTL_1_A

#include <iostream>
#include <map>

namespace cplib {
    template <typename T>
    std::map<T, int> factorize(T n) {
        T n0 = n, div = 2;
        std::map<T, int> res;
        while (n > 1 && div * div <= n0) {
            if (n % div == 0) {
                res[div]++;
                n /= div;
            } else {
                div++;
            }
        }
        if (n > 1) {
            res[n]++;
        }
        return res;
    }
}

int main() {
    int64_t n;
    std::cin >> n;

    auto fact = cplib::factorize(n);

    std::cout << n << ":";
    for (auto p: fact) {
        for (int i = 0; i < p.second; i++) {
            std::cout << " " << p.first;
        }
    }
    std::cout << std::endl;

    return 0;
}



Measured memory_bytes: 3116
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>

template <typename QvQ> inline QvQ Min(QvQ a,QvQ b){if(a<b) return a;return b;}
template <typename QvQ> inline QvQ Max(QvQ a,QvQ b){if(a>b) return a;return b;}

#define inf 0x7f7f7f7f
#define dinf 0x3f3f3f3f

#define ll long long
#define rei register int
#define inv inline void

#define bl putchar(' ')
#define ed putchar('\n')

#define read2(a,b) read(a),read(b)
#define write2(a,b) write(a),bl,write(b)
#define read3(a,b,c) read(a),read(b),read(c)
#define write3(a,b,c) write(a),bl,write(b),bl,write(c)

template <typename QvQ>inv read(QvQ &x)
{
	x=0;int f=1;
	char c=getchar();
	for(;c<'0'||c>'9';c=getchar()) if(c=='-') f=-1;
	for(;c>='0'&&c<='9';c=getchar()) x=(x<<1)+(x<<3)+(c^48);
	x=x*f;
}
template <typename QvQ>inv write(QvQ x)
{
	if(x<0) x=-x,putchar('-');
	if(x>9) write(x/10);
	putchar(x%10+48);
}
using namespace std;
int n;
string a;
int main()
{
	read(n);
	cin>>a;
	if(n<3200) puts("red");
	else cout<<a;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <deque>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <random>
#include <fstream>
#include <sstream>
#include <time.h>
// #define int long long
#define debug(x) cerr << #x << " = " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,n) for(int i = (n); i > -1; i--)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int MOD = 1e9+7;
const ll LINF = 1e18;
const double EPS = 1e-9;


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

  // int a,b;
  // cin>>a>>b;
  // int ans;
  // if(a >= 13) {
  //   ans = b;
  // } else if(a >= 6) {
  //   ans = b / 2;
  // } else {
  //   ans = 0;
  // } 
  // cout << ans << endl;
  ll r,d;
  ll x[100];
  rep(i,100) {
    x[i] = 0;
  }
  cin>>r>>d>>x[0];
  rep(i,10) {
    x[i+1] = x[i] * r - d;
    cout << x[i+1] << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

class Graph
{
private:
    int m_nodeNum;
    vector<vector<int>> m_adList;

    vector<vector<int>> m_connectedComponents;
    vector<int> m_connectedCompunentIndex;
    
public:
    Graph(const int N) : m_nodeNum(N)
    {
        m_adList = vector<vector<int>>(N);
        m_connectedCompunentIndex = vector<int>(N, -1);
    }

    void Connect(const int v, const int u)
    {
        m_adList[v].push_back(u);
        m_adList[u].push_back(v);
    }

    void ComputeConnectedComponents()
    {
        vector<bool> hasNotVisited(m_nodeNum, true);
        stack<int> stack;
        int ccIndex = 0;
        vector<int> cc;
        for (int v = 0; v < m_nodeNum; ++v)
        {
            if (hasNotVisited[v])
            {
                stack.push(v);
                cc.clear();
                while (!stack.empty())
                {
                    int u = stack.top();
                    stack.pop();
                    hasNotVisited[u] = false;
                    m_connectedCompunentIndex[u] = ccIndex;
                    cc.push_back(u);
                    for (const int n : m_adList[u])
                    {
                        if (hasNotVisited[n])
                        {
                            hasNotVisited[n] = false;
                            stack.push(n);
                        }
                    }
                }
                m_connectedComponents.push_back(cc);
                ++ccIndex;
            }
        }
    }

    const int GetConnectedComponentSize(const int v)
    {
        int index = m_connectedCompunentIndex[v];
        return static_cast<int>(m_connectedComponents[index].size());
    }

    const int GetConnectedComponentIndex(const int v)
    {
        return m_connectedCompunentIndex[v];
    }

};

int main()
{
    int N, M, K; cin >> N >> M >> K;
    vector<vector<int>> fAd(N), bAd(N); // 友達関係，ブロック関係の隣接行列
    Graph g(N);
    for (int i = 0; i < M; ++i)
    {
        int Ai, Bi; cin >> Ai >> Bi;
        fAd[Ai - 1].push_back(Bi - 1);
        fAd[Bi - 1].push_back(Ai - 1);
        g.Connect(Ai - 1, Bi - 1);
    }
    for (int i = 0; i < K; ++i)
    {
        int Ci, Di; cin >> Ci >> Di;
        bAd[Ci - 1].push_back(Di - 1);
        bAd[Di - 1].push_back(Ci - 1);
    }
    g.ComputeConnectedComponents();
    for (int v = 0; v < N; ++v)
    {
        const int ccSize = g.GetConnectedComponentSize(v);
        const int ccIndex = g.GetConnectedComponentIndex(v);
        const int fNum = fAd[v].size();
        int bNum = 0;
        for (const int b : bAd[v])
        {
            if (g.GetConnectedComponentIndex(b) == ccIndex) ++bNum;
        }
        cout << ccSize - 1 - fNum - bNum << ' ';
    }
    cout << endl;
}


Measured memory_bytes: 18836
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
void chmax(LL& a, LL b) {
	a = max(a, b);
}
//////////////

void solve() {
	string S;
	cin >> S;
	int N = S.size();
	int cnt = 0;
	string ter = "ACGT";
	LL ans = 0;
	for (int i = 0; i < N; ++i) {
		bool flag = false;
		for (int k = 0; k < 4; ++k) {
			if (S[i] == ter[k]) {
				flag = true;
			}
		}
		if (flag) {
			++cnt;
			chmax(ans, cnt);
		}
		else {
			cnt = 0;
		}
	}
	cout << ans << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
const int INFint = 1e9+1;
const ll INFll = (ll)1e18+1;
ll MOD=1e9+7;

int main(){
  int N;
  cin>>N;
  vector<ll> A(N),R(N);
  for(int i(0);i<N;i++){
    cin>>A[i];
  }
  sort(A.rbegin(),A.rend());
  ll l = 0,r = N;
  while(l+1<r){
    ll x = (l+r)/2;
    bool ok = [&]{
      ll now = A[x];
      for(int i(N-1);i>=0;i--){
        if(i==x) continue;
        if(now*2 < A[i]) return false;
        now += A[i];
      }
      return true;
    }();
    if (ok) l = x;
    else r = x;
  }
  cout << l+1 << endl;
  return 0;
}


Measured memory_bytes: 4824
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_10_A

#include <iostream>
#include <iomanip>

#include <vector>
#include <string>
#include <iterator>
#include <algorithm>

typedef long long ll;
const long double PI = (acos(-1));
const long long MOD = 1000000007;
#define rep(i,n) REP(i,0,n)
#define REP(i,x,n) for(int i=x;i<n;++i)

using namespace std;

// change min/max
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; }

template<class T> void output(std::vector<T> & A) {
    const int n = A.size();
    for (int i = 0; i < n - 1; ++i) {
        std::cout << A[i] << " ";
    }
    std::cout << A[n - 1] << std::endl;
}


int fib(const int n, vector<int>& dp) {
    if (n == 0) return 1;
    if (n == 1) return 1;
    if (dp[n] != -1) return dp[n];
    dp[n] = fib(n - 1, dp) + fib(n - 2,dp);
    return dp[n];
}

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

    const long maxn = 45;
    vector<int> dp(maxn, -1);
    dp[0] = dp[1] = 1;

    int n; cin >> n;
    const int ret = fib(n, dp);
    cout << ret << endl;

    return 0;
}



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

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

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define int ll

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

  int N;
  cin>>N;
  vector<string>s(N);
  for(int i=0;i<N;i++)cin>>s[i];
  for(int i=0;i<N;i++)sort(rng(s[i]));
  sort(rng(s));
  int ans=0;
  for(int i=0;i<N;i++){
    int now=i;
    while(i+1<N&&s[i]==s[i+1]){
      ans+=i-now+1;
      i++;
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
struct edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<int>>;
using dou =long double;
string Yes="Yes";
string YES="YES";
string NO="NO";
string No="No";
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define res resize
#define as assign
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0)
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
 
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 922337203685477580ll;
const int mod = 1000000007ll;
const ll  MOD = 1000000007LL;
const double pi=3.1415926535897932384626;
int main(){
    int n,k,q;
    std::cin >> n>>k>> q;
    std::vector<int> a(n);
    rep(i,q){
        int d;
        std::cin >> d;
        d--;
        a[d]++;
    }
    rep(i,n){
        a[i]=k-(q-a[i]);
    }
    rep(i,n){
        if(a[i]<=0)std::cout << No << std::endl;
        else std::cout << Yes << std::endl;
    }
}

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

using namespace std;

struct Point
{
	int x;
	int y;
};
int dotProduct(Point a, Point b)
{
	return a.x*b.x+a.y*b.y;
}
int lengthSquared(Point a)
{
	return pow(a.x,2)+pow(a.y,2); 
}
int main()
{ 
	int q; 
	int p1x,p1y,p2x,p2y;
	int q1x,q1y;
	cin>>p1x>>p1y>>p2x>>p2y;
	cin>>q;
	struct Point p = {p2x-p1x, p2y-p1y};

	for(int i=0;i<q;i++)
	{
		cin>>q1x>>q1y;
		struct Point q = {q1x-p1x, q1y-p1y};
		double val;
		if(lengthSquared(p)==0) val = 0.0f;
		else val = double(dotProduct(p,q))/double(lengthSquared(p));
		double x = val*p.x;
		double y = val*p.y;
		if(x==0) x=0.0f;
		if(y==0) y=0.0f;
		double x2 = -1*(q.x-x), y2 = -1*(q.y-y);
		cout<<fixed<<setprecision(10)<<x2+x+p1x<<" "<<y2+y+p1y<<endl;

		
	}
}



Measured memory_bytes: 3288
/*
How to lambda
  ex) sort(ALL(cont),[](dat a,dat b){return a.l<b.l;});
lower_bound/upper_bound
  1 2 2 2 3 3 
    ^lb   ^ub */
#include <bits/stdc++.h>
#define BR "\n"
#define REP(i,n) for(int (i)=0;(i)<(n);++(i))
#define ALL(cont) begin(cont),end(cont)
#define AS_MOD(a,b) ((((a) % (b) ) + (b)) % (b))
#define FEACH(it,cont) for(auto (it) = begin(cont); it!=end(cont);++it)
#define FEACHR(it,cont) for(auto (it) = rbegin(cont); it!=rend(cont);++it)
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define getll() ([](){ll s;scanf("%lld", &s);return s;})()
#define getld() ([](){ld s;scanf("%Lf", &s);return s;})()
#define prl(P) printf("%lld", P)
#define prd(P) printf("%.10Lf", P)
#define pr(P) printf(P)
#define assign_if_greater(V, T) V=max(V,T)
using namespace std;
typedef long long ll;
typedef long double ld;
int A,B,Q;
vector<ll> As,Bs,Qs;
ll INF=(ll)1000*1000*1000*1000;
int main() {
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  cin >> A >> B >> Q;
  As.resize(A);Bs.resize(B);Qs.resize(Q);
  REP(i,A)
    cin >> As[i];
  REP(i,B)
    cin >> Bs[i];
  REP(i,Q) {
    ll x;
    cin >> x;
    auto ita=lower_bound(ALL(As),x);
    auto itb=lower_bound(ALL(Bs),x);
    // only go left
    ll ans=INF;
    vector<ll> alis,blis;
    if (ita!=As.end()) {
      alis.pb(*ita);
    }
    if (itb!=Bs.end()) {
      blis.pb(*itb);
    }
    if (ita!=As.begin()) {
      ita--;
      alis.pb(*ita);
    }
    if (itb!=Bs.begin()) {
      itb--;
      blis.pb(*itb);
    }
    for(ll a:alis)
      for(ll b:blis) {
        ans = min(ans,abs(a-x)+abs(b-a));
        ans = min(ans,abs(b-x)+abs(b-a));
      }
    cout << ans << endl;
  }


  return 0;
}


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

using namespace std;
#define all(x) (x).begin(), (x).end()
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<vector<bool>> vvb;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long>> vvl;
typedef pair<int,int> pii;
typedef long long ll;
void debugF(ostream &os) {os << endl;}
template <typename Head, typename... Tail>
void debugF(ostream &os, Head H, Tail... T) { os << " " << H; debugF(os, T...); }
#define debug(...) cout << "[" << #__VA_ARGS__ << "]:", debugF(cout, __VA_ARGS__)
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); os << (i>0 ? " ":"") << v[i++]); return os;}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    n %= 10;
    vi v1 = {2,4,5,7,9};
    vi v2 = {0,1,6,8};
    if(count(all(v1), n)){
        cout << "hon\n";
    }else if(count(all(v2), n)){
        cout << "pon\n";
    }else{
        cout << "bon\n";
    }
    
    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
typedef long long ll;
#define MODSIZE 1000000007
priority_queue<int, vector<int>, greater<int> > PQ; // 昇順PQ
// priority_queue<int> PQ;

int main(){
  int a[6];
  int i;

  for(i = 1;i <= 5;i++) scanf("%d", &a[i]);

  for(i = 1;i <= 5;i++){
    if(a[i] == 0){
      printf("%d\n", i);
      break;
    }
  }

  return 0;
}


Measured memory_bytes: 3724
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
  int N;
  cin >> N;
  ll a[N];
  ll S[N+1];
  S[0] = 0;
  for(int i=0; i<N; i++) cin >> a[i];
  for(int i=0; i<N; i++) S[i+1] = S[i] + a[i];
  ll ans = 1e15;
  for(int i=1; i<N; i++) ans = min(ans, abs(S[N] - 2*S[i]));

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3328
// ABC066A - 

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

typedef unsigned long long int ull;
typedef long long int ll;

int main() {
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a + 3);

	cout << a[0] + a[1] << endl;

	return 0;
}


Measured memory_bytes: 256
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush,heapify
import math
from copy import deepcopy
import queue
#import sympy as syp(素因数分解とか)
Mod = 1000000007
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

def main():  #startline-------------------------------------------
    a, b, n = map(int, input().split())
    if b == 1:
        print(0)
    elif b > n:
        print(a * n // b - a * (n  // b))
    else:
        x = (b - 1) * (n // (b - 1))
        print(a*x // b - a*(x//b))
if __name__ == "__main__":
    main() #endline===============================================

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

using namespace std;
typedef long long ll;

int a[5050];
ll dp[5005][5005];

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

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

    for(int i = n - 1; i ; i--){
        for(int j =i + 1; j <= n;j++){
            dp[i][j] =   max( a[i] - dp[i+1][j] , a[j] - dp[i][j-1] );
        }
    }

    cout << dp[1][n];


    return 0;
}


Measured memory_bytes: 118400
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <functional>
#include <queue>
#include <map>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;

int main(){
   string S;
	cin >> S;
	S[3] = '8';
	cout << S << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
typedef pair<ll, ll>P;
#define PI 3.14159265359
#define MOD 1000000007
const int MAX = 510000;

int main(){
  int N;cin>>N;
  vector<ll>a(N);
  vector<ll>b(N);
  rep(i,N){
  	cin >> a[i];
    b[i]=a[i];  
  }
  ll count=0;
  rep(i,N){
  	while(true){
    	if(b[i]%2ll==0){count++;b[i]/=2;}
      	else{break;}
    }
  }
  cout<<count;
  
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define MAXN 100009
#define MAXM 30001
#define MOD 1000000007
#define INF 1000000009
#define EPS 1e-7
#define FOR(x,n) for(int x=0; x<n; x++)
#define FOR1e(x,n) for(int x=1; x<=n; x++)
#define pb push_back
#define all(x) x.begin(), x.end()
typedef pair<int, int> ii;
typedef long long ll;

int main() {
	int a, b, c, x, y;
	cin >> a >> b >> c >> x >> y;

	ll ans = 0;
	if (2*c < a+b) {
		int bought = 2*(min(x,y));
		ans += 1LL*bought*c;
		x -= bought/2; y -= bought/2;
	}
	if (2*c < a) {
		int bought = 2*x;
		ans += 1LL*bought*c;
		x -= bought/2;	
	}
	if (2*c < b) {
		int bought = 2*y;
		ans += 1LL*bought*c;
		y -= bought/2;
	}
	ans += 1LL*x*a;
	ans += 1LL*y*b;
	cout <<ans << endl;
}

Measured memory_bytes: 256
s = input()
t = input()
n = len(s)


def rotate(s, k):
    n = len(s)
    t = s[k:n]
    t += s[0:k]
    return t


ans = "No"

for i in range(n):
    if rotate(s, i) == t:
        ans = "Yes"

print(ans)


Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main(){
    int x,y;
    while(1){
        cin>>x>>y;
        if(x==0&&y==0)break;
        if(x<y)cout<<x<<' '<<y<<endl;
        else cout<<y<<' '<<x<<endl;
    }
    return 0;
}


Measured memory_bytes: 2992
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>

using namespace std;

int digit_count(long long v)
{
	int result = 0;
	while (v > 0)
	{
		v /= 10;
		result++;
	}
	return result;
}

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

	long long N;
	cin >> N;

	int result = digit_count(N);
	for (long long A = 1; A * A <= N; A++)
	{
		if (N % A != 0) continue;

		long long B = N / A;

		int digitA = digit_count(A);
		int digitB = digit_count(B);

		result = min(result, max(digitA, digitB));
	}

	cout << result;

	return 0;
}


Measured memory_bytes: 256
n=gets.to_i
kiarray=[]
quearray=[]
n.times{ quearray.push([])}

(n-1).times{
    p,q,w=gets.split.map(&:to_i)
    quearray[p-1].push([q,w%2])
    quearray[q-1].push([p,w%2])
}

root=1
ansarray=Array.new(n,0)
ansarray[root-1]=1
list=[root]

while list.length>0

    now=list.shift
    quearray[now-1].map{|i|
 
        if ansarray[i[0]-1]==0 && i[1]==0
            ansarray[i[0]-1]=ansarray[now-1]
            list.push(i[0])
        elsif ansarray[i[0]-1]==0 && i[1]==1
                ansarray[i[0]-1]=ansarray[now-1]*(-1)
                list.push(i[0])
        end
    }
end

ansarray.map{|i|
    if i==-1
        puts 0
    else
        puts 1
    end
}

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

int a[100010],c[100010],n,m,cnt;
vector<int> v[100010];
bool vis[100010]; 

void dfs(int u)
{
	for(int i=0;i<v[u].size();i++) if(!vis[v[u][i]]){
		vis[v[u][i]]=true;
		a[v[u][i]]=cnt;
		dfs(v[u][i]); 
	}
}

int main()
{
    cin>>n>>m;
    for(int i=1;i<=n;i++) scanf("%d",&c[i]);
    for(int i=1;i<=m;i++){
    	int x,y;
    	scanf("%d%d",&x,&y);
    	v[x].push_back(y);
    	v[y].push_back(x);
	}
	for(int i=1;i<=n;i++) if(!vis[i]){
		cnt++;
		a[i]=cnt;
		dfs(i);
	}
	int sum=0;
	for(int i=1;i<=n;i++) if(a[i]==a[c[i]]) sum++;
	cout<<sum<<endl;
	return 0;
}

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

int H,N;

int main()
{
    cin>>H>>N;
    int attack=0;
    for (int i=0; i<N; i++) {
        int temp;
        cin>>temp;
        attack+=temp;
    }
    if (attack>=H) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


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

int main() {
  // read inputs
  int N;
  scanf("%d", &N);

  // the list of primes <= 100
  int primes[25] = {2,  3,  5,  7,  11, 13, 17, 19, 23, 29, 31, 37, 41,
                    43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97};
  int counts[25] = {};
  for (int i = 2; i <= N; i++) {
    int t = i;
    for (int j = 0; j < 25; j++) {
      const int p = primes[j];
      int cnt = 0;
      while (t % p == 0) {
        cnt++;
        t /= p;
      }
      counts[j] += cnt;
    }
  }

  // count factors that appear many times
  int num_2 = 0, num_4 = 0, num_14 = 0, num_24 = 0, num_74 = 0;
  for (int i = 0; i < 25; i++) {
    const int cnt = counts[i];
    if (cnt >= 2) {
      num_2++;
    }
    if (cnt >= 4) {
      num_4++;
    }
    if (cnt >= 14) {
      num_14++;
    }
    if (cnt >= 24) {
      num_24++;
    }
    if (cnt >= 74) {
      num_74++;
    }
  }

  printf("%d\n", num_4 * (num_4 - 1) / 2 * (num_2 - 2) + num_14 * (num_4 - 1) +
                     num_24 * (num_2 - 1) + num_74);
}

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

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

const int MOD = 1000000007;
const int MAX = 200000;

int main() {
  long double a;
  long double b;
  cin >> a >> b;
  long double ans = a * b;
  ll res = (ll)floorl(ans);
  cout << res << endl;
}


Measured memory_bytes: 3756
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n; cin >> n;
  string s;
  map<string, int> m;
  while(n--)
  {
    cin >> s; m[s]++;
  }
  cout << "AC x " << m["AC"] << endl;
   cout << "WA x " << m["WA"] << endl;
   cout << "TLE x " << m["TLE"] << endl;
   cout << "RE x " << m["RE"] << endl;
  
  return 0;
}

Measured memory_bytes: 3616
#include <iostream>

using namespace std;

int main()
{
   
  string a;
   cin>>a;
   if (a=="Sunny")
    {
        cout<<"Cloudy";
    }
    else if(a=="Cloudy")
    {
        cout<<"Rainy";
    }
    else if (a=="Rainy")
    {
        cout<<"Sunny";
    }

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define ff first
#define ss second
#define ll long long
#define vi vector<int>
#define vii vector<vi>
#define vs vector<string>
#define vss vector<vs>
#define pii pair<int, int>
#define all(x) x.begin(), x.end()
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define repr(i, a, n) for (int i = (n); i >= (a); --i)
using namespace std;
const int INF(1 << 30);
const ll LLINF(1LL << 55LL);
const int pi = 3.1415926536;
const int MOD = 1000000007;
const int MAX = 510000;

void Main() {
  string s;
  cin >> s;
  int n=s.size();
  string ans;
  for (int i = 0; i < n; i += 2) {
    ans += s[i];
  }
  cout<<ans<<endl;
}

int main() {
  std::cin.tie(nullptr);                  // 標準入出力高速化
  std::ios_base::sync_with_stdio(false);  // SとS++の入出力出力を非同期
  std::cout << std::fixed << std::setprecision(15);  // 小数を10進数表示
  Main();
}

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

bool isInteger(double x)
{
    return floor(x) == x;
}
int main(void)
{
    int n, d;
    int x[10][10];
    cin >> n >> d;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < d; j++)
        {
            cin >> x[i][j];
        }
    }
    int sum = 0;
    int count = 0;
    for (int i = 0; i < n; i++)
    {
        for (int j = i+1; j < n; j++)
        {
            sum = 0;
            for (int k = 0; k < d; k++)
            {
                sum += pow(abs(x[i][k] - x[j][k]), 2.0);
            }
            if (isInteger(sqrt((double)sum)))
                count++;
        }
    }
    cout << count << endl;
}

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

int main() {
    int n,ans(0),max;

    cin >> n;
    int h[n];

    for(int i=0;i<n;i++)
        cin >> h[i];

    max = h[0];
    for(int i=0;i<n;i++){
        if(max<h[i])
            ans++;
        if(max==h[i]){
            ans++;
            max = h[i];
        } 
        if(max<h[i])
            max = h[i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef vector <int> vi;
typedef vector <vi> vvi;
typedef pair <int,int> pr;
#define fr(i, n) for(int i = 0; i < n; i++)
#define sz(a) int((a).size())
#define pb push_back
#define all(c)(c).begin(), (c).end()
#define tr(c, i) for (typeof ((c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c, x)((c).find(x) != (c).end())
#define cpresent(c, x)(find(all(c), x) != (c).end())
// for mod power a^b%m use power<lli> (a,b,m)
template < class mytype >
mytype power(mytype a, mytype b, mytype m){if (b == 1) return a % m;if (b == 0) return 1;
mytype root = power < lli > (a, b / 2, m);mytype ans = (root * root) % m;if (b % 2) ans = (ans * a) % m;
return ans;
}
// for gcd use gcd<int> (a,b)
template < class type >type gcd(type a, type b){if (a == 0) return b;else return gcd(b % a, a);}
template < class type >type mod_inv(type a, type p) {return power(a, p - 2, p);}
const lli MOD = 1e9 + 7;

int main()
{
   int n;
   cin >> n;
   vector<int> v(n);
   for(int i = 0 ; i < n ; i++){
    cin >> v[i];
   }
   lli dp[n][n];
   dp[0][0] = 0;
   for(int len = 0 ; len < n ; len++){
    for(int j = 0 ; j+len < n ; j++){
        if(len == 0) dp[len][j] = v[j];
        else{
            dp[len][j] = max(v[j] - dp[len-1][j+1] , v[j+len] - dp[len-1][j]);
        }
    }
   }
   cout << dp[n-1][0];
    return 0;
}











Measured memory_bytes: 70528
#include <cstdio>
#include <algorithm>
using namespace std;
int a[200005], dis[200005];
int main()
{
    int n, k;
    scanf("%d%d", &k, &n);
    for (int i = 0; i < n; i++)
        scanf("%d", a + i);
    a[n] = a[0] + k;
    for (int i = 1; i <= n; i++)
        dis[i] = a[i] - a[i - 1];
    sort(dis + 1, dis + n + 1);
    printf("%d\n", k - dis[n]);
    return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define divceil(A, B) ((A + (B - 1)) / B)
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()
#define CERR if(false) cerr

using namespace std;

int main(){

    int n,m;
    int state[10][10] = {};
    vector<int> p;

    cin >> n >> m;

    rep(i,m){
        int k;
        cin >> k;

        rep(j,k){
            int tmp;
            cin >> tmp;

            state[i][tmp - 1] = 1;
        }
    }

    rep(i,m){
        int tmp;
        cin >> tmp;

        p.pback(tmp);
    }

    int ans = 0;

    for(int bit = 0; bit < (1<<n); bit++){
        int light_count = 0;

        rep(i,m){
            int on_count = 0;

            rep(j,n){
                if(state[i][j] == 0) continue;
                if(bit & (1 << j)) on_count++;
            }

            if(on_count % 2 == p[i]) light_count++;
        }

        if(light_count == m) ans++;
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
N,M=map(int,input().split())
A=[]
B=[]
for i in range(N):
  a,b=map(int,input().split())
  A += [a]
  B += [b]
C=[]
D=[]
for i in range(M):
  c,d=map(int,input().split())
  C +=[c]
  D +=[d]
P=[]
for i in range(N):
  d=float('inf')
  p=-1
  for j in range(M):
    if abs(A[i]-C[j])+abs(B[i]-D[j])<d:
      d=abs(A[i]-C[j])+abs(B[i]-D[j])
      p=j+1
  P+=[p]
for i in range(N):
  print(P[i])

Measured memory_bytes: 3064
#include <stdio.h>

int main(void)
{
	char fes[16] = "CODEFESTIVAL2016" ;
	char s[16] ;
	int i,n=0 ;
	
	scanf("%s",&s) ;
	
	for(i=0 ; i<16 ; i++){
		if(fes[i]!=s[i]) n++ ;
	}
	
	printf("%d\n",n) ;
	
	return 0 ;
}

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

typedef pair<int,int> P;
#define FOR(i,a,b) for(int i=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
#define ZERO(a) memset(a,0,sizeof(a))
#define pb push_back
#define mp make_pair
#define F first
#define S second

const int M = 1e6 + 10;
bool px[M], py[M];
vector<P> tg, stars; // (x,y)

void init(void) {
    ZERO(px); ZERO(py); tg.clear(); stars.clear();
}

bool OK(int dx, int dy) {
    for(auto& t : tg) {
	if(t.F+dx > 1e6 or t.S+dy > 1e6) return false;
        if(!px[t.F + dx] or !py[t.S + dy]) return false;
    }
    return true;
}

int main() {
    int m, n;
    while(cin>>m && m) {
        init();
        rep(i,m) {
            int x,y; scanf("%d%d",&x,&y);
            tg.pb(mp(x,y));
        }
        cin >> n;
        rep(i,n) {
            int x,y; scanf("%d%d",&x,&y);
            stars.pb(mp(x,y));
            px[x] = py[y] = true;
        }

        for(auto& star : stars) {
            int diffx = star.F - tg[0].F;
            int diffy = star.S - tg[0].S;

            if(OK(diffx, diffy)) {
                printf("%d %d\n", diffx, diffy);
                goto out;
            }
        }
out:
        m += 0;
    }

    return 0;
}

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

int main() {
	string R,C[100],A;
	int N,S=0,J;
	cin >> R >> N;
	for(int i=0;i<N;i++){
		cin >> C[i];
		C[i]=C[i]+C[i];
		for(int j=1;j<18;j++){
			A=C[i].substr(j,R.size());
			if(R==A){
				J=j;
				S++;
				break;
			}
		}	
	}
	cout << S << endl;
	return 0;
}

Measured memory_bytes: 3180
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define pdi pair<db,int>
#define mp make_pair
#define pb push_back
#define enter putchar('\n')
#define space putchar(' ')
#define eps 1e-8
#define mo 974711
#define MAXN 100005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;char c = getchar();T f = 1;
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 + c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
char s[MAXN];
int cnt[4];
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    scanf("%s",s + 1);
    int N = strlen(s + 1);
    for(int i = 1 ; i <= N ; ++i) {
	cnt[s[i] - 'a']++;
    }
    int minn = min(min(cnt[0],cnt[1]),cnt[2]);
    int mmax = max(max(cnt[0],cnt[1]),cnt[2]);
    if(mmax - minn <= 1) puts("YES");
    else puts("NO");
    return 0;
}


Measured memory_bytes: 384
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define REP(i, b, n) for (Int i = b; i < Int(n); i++)
#define rep(i, n) REP(i, 0, n)
using namespace std;
using Int = long long;
Int inf = 1000000000000000001LL;
using vi = vector<Int>;
using vvi = vector<vi>;
using mapis = unordered_map<Int,string>;
using mapii = unordered_map<Int,Int>;
using pii = pair<Int,Int>;

Int GCD(Int a, Int b){
    if(b==0) return a;
    if(a < b) return GCD(b, a);
    unsigned r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}
Int printX(Int r, Int D, Int X, int count){
    if(count == 10){
        return 0;
    }
    Int nextX = r*X - D;
    cout<< nextX <<endl;
    printX(r,D,nextX,count+1);

}

int myPow(int x, int p) {
    if (p == 0) return 1;
    if (p == 1) return x;
    return x * myPow(x, p-1);
}

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

    vi p = vi(N);

    rep(i,N){
        cin>>p[i];
    }

    vi sorted = p;

    sort(sorted.begin(),sorted.end());

    Int wrong = 0;
    rep(i,N){
        if(sorted[i] != p[i]){
            wrong++;
        }
    }

    if (wrong <3){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }


    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

import math

N=int(input())

def keta(x):
    a = 0
    while x>0:
        x//=10
        a+=1
    return a

N_keta = keta(N)

ans=0
for i in range(3**N_keta):
    s=""
    tmp=i
    f0=False
    f1=False
    f2=False
    for j in range(N_keta):
        r=tmp%3
        if r==0:
            f0=True
            s+="7"
        elif r==1:
            f1=True
            s+="5"
        else:
            f2=True
            s+="3"
        tmp//=3
    if f0 and f1 and f2 and N >= int(s):
        ans+=1

for i in range(3,N_keta):
    for j in range(3**i):
        s=""
        tmp=j
        f0=False
        f1=False
        f2=False
        for k in range(i):
            r=tmp%3
            if r==0:
                f0=True
                s+="7"
            elif r==1:
                f1=True
                s+="5"
            else:
                f2=True
                s+="3"
            tmp//=3
        if f0 and f1 and f2:
            ans+=1
print(ans)



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

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

	string s;
	cin >> s;

	int next_white = 0;
	while (next_white < s.size() && s[next_white] == 'W')
		++next_white;

	if (next_white == s.size()) {
		cout << "0\n";
		return 0;
	}

	long long count = 0;
	for (int i = next_white; i < s.size(); ++i) {
		if (s[i] == 'W') {
			count += i - next_white;
			swap(s[next_white], s[i]);
			++next_white;
		}
	}

	cout << count << "\n";

	return 0;
}

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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

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

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; }

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

// ------------------------------------------------------------------------------------------

const ll INF = 1001001001001001LL;

ll p[20], c[20];
ll dp[20][150010];

int main() {
   // 初期化:
   ll D, G; cin >> D >> G;
   G /= 100;
   fill(dp[0], dp[20], INF);

   dp[0][0] = 0;
   rep (i, D) {
      cin >> p[i] >> c[i];
      c[i] /= 100;

   }

   rep (i, D) {
      for (ll k = 0; k <= p[i]; k++) {
         ll is_comp = (k == p[i] ? c[i] : 0);

         ll point = k*(i+1) + is_comp;
         for (ll j = 0; j <= G; j++) {
            ll nj = min(G, j + point);
            chmin(dp[i+1][nj], dp[i][j]+k);
         }
      }
   }

   cout << dp[D][G] << endl;

   return 0;
}

Measured memory_bytes: 23680
using System;
using System.Collections.Generic;
using System.Globalization;

class Program
 {



    static void Main(string[] args)
    {
        string nyuryoku;
        var card = new List<string>();
        var position = new List<int>();
        int count = 0;
        while (true)
        {
            nyuryoku = Console.ReadLine();
            if(nyuryoku == "-")
                break;
            card.Add(nyuryoku);
            nyuryoku = Console.ReadLine();
            position.Add(0);
            int loop = int.Parse(nyuryoku);
            for (int i = 0; i < loop; i++)
            {
                nyuryoku = Console.ReadLine();
                position[count] = position[count] + int.Parse(nyuryoku);
            }
            count++;
        }
        for (int i = 0; i < position.Count; i++)
        {
            position[i] = position[i] % card[i].Length;
            for (int j = position[i]; j < card[i].Length; j++)
                Console.Write(card[i][j]);
            for (int j = 0; j < position[i]; j++)
                Console.Write(card[i][j]);
            Console.Write("\n");

        }
    
    
    }
 }



Measured memory_bytes: 17996
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx,tune=native")
#pragma comment(linker, "/stack:200000000"]
 
#include <iostream>
#include <vector>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <bitset>
#include <stack>
#include <random>
#include <fstream>
#include <sstream>
 
#define fr first
#define se second
#define pb push_back
#define ll long long
#define ld long double
#define hm unordered_map 
#define pii pair<int, int>
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define cinv(v) for (auto& x: v) cin >> x
#define forn(i, n) for (int i = 0; i < n; ++i)
#define forln(i, l, n) for (int i = l; i < n; ++i)

#define LOCAL

using namespace std;

#ifdef LOCAL
	#define dbg(x) cerr << #x << " : " << x << '\n';
#else 
	#define dbg(x)
#endif

//tg: @galebickosikasa
 
const int maxn = (int) 3e5;
const ll inf = (ll) 2e9;
const ld pi = 3.14159265358979323846264;
const ld eps = 1e-8;
const ll mod = (ll)1e9 + 7;
const ll ns = 97;

random_device rd;
mt19937 SuperRandom(rd());



int main () {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int n;
	cin >> n;
	vector<string> goo (n);
	cinv (goo);
	hm<string, int> cnt;
	for (auto& x: goo) ++cnt[x];
	int mx = 0;
	for (auto& x: cnt) mx = max (mx, x.se);
	vector<string> ans;
	for (auto& x: cnt) if (x.se == mx) ans.pb (x.fr);
	sort (all (ans));
	for (auto& x: ans) cout << x << '\n';




}

Measured memory_bytes: 26948