akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  int a=0;
  int ans[8]={};
  cin>>n;
  for(int i=0;i<n;i++){
    int aa;
    cin>>aa;
    if(aa<3200)
      ans[aa/400]=1;
    else
      a++;
  }
  int anss=0;
  for(int i=0;i<8;i++)
    if(ans[i])
      anss++;

  if(anss==0){
    cout<<1<<" "<<a<<endl;
  }else{
    int s=a+anss;

    cout<<anss<<" "<<s<<endl;
  }
  return 0;
}


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

int main(){
    string w;
    cin >> w;
    string T;
    string s;
    while(1){
        getline(cin,T);
        if(T=="END_OF_TEXT")break;
        s+=T+" ";
    }
    int sum=0;
    rep(i,s.length())s[i]=tolower(s[i]);
    rep(i,s.length()){
        if(s[i]==w[0]){
            int count=0;
            rep(j,w.length()){
                if(s[i+j]==w[j])count++;
            }
            if(count==w.length()&&s[i+(w.length())]==' '&&s[i-1]==' ')sum++;
        }
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 3132
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(unsigned x){
  int s=0;
  char f[10];
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(long long x){
  int s=0;
  int m=0;
  char f[20];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(unsigned long long x){
  int s=0;
  char f[21];
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(double x){
  printf("%.15f",x);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    putchar_unlocked(c[i]);
  }
}
inline void wt_L(string &x){
  int i=0;
  for(i=0;x[i]!='\0';i++){
    putchar_unlocked(x[i]);
  }
}
template<class S, class T> inline S divup_L(S a, T b){
  return (a+b-1)/b;
}
int main(){
  int H;
  int A;
  rd(H);
  rd(A);
  wt_L(divup_L(H,A));
  wt_L('\n');
  return 0;
}
// cLay varsion 20200119-1

// --- original code ---
// {
//   int H, A;
//   rd(H,A);
//   wt(H/+A);
// }


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sanyes ios_base::sync_with_stdio(0), cout.tie(0); cin.tie(0);
#define llong long long int
#define pb push_back
#define bpc __builtin_popcount
#define f first
#define s second

const llong mxn = 1e5 + 7;
const llong mod = 1e9 + 7;
const llong inf = 1e18 + 9;

using namespace std;

llong n, k, a[mxn], dp[mxn][2], cnt[2];

int main(){
    cin >> n >> k;
    for (int i = 1; i <= n; i ++){
        cin >> a[i];
    }dp[0][0] = 1;
    for (int i = 1; i <= n; i ++){
        for (int j = 0; j <= 1; j ++){
            llong x = j - (a[i] % 2);
            if(x < 0){
                x += 2;
            }dp[i][j] = dp[i - 1][j];
            dp[i][j] += dp[i - 1][x];
        }
    }cout << dp[n][k];
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define ll long long
#define PI 3.141592653589
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define EPS 1e-7
#define f first
#define s second
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;
const ll MOD = 1e9+7;
const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int random_int(int l,int r){return uniform_int_distribution<int>(l,r)(rng);}
ll fast_power(ll x, ll p){
    ll res = 1;
    while(p > 0){
        if(p & 1){
            res = (res * x);
        }
        p = p >> 1;
        x = (x*x);
    }
    return res;
}

int n;
vector<vector<int>> a;
ll dp[21][(1 << 21)];

int solve(int index, int mask) {
    if (index == n) {
        if (mask == (1 << n) - 1)
            return 1;
        else
            return 0;
    }
    if (dp[index][mask] != -1)
        return dp[index][mask];
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (a[index][i] == 1) {
            if (mask & (1 << i)) continue;
            ans = (ans + solve(index + 1, mask | (1 << i)))%MOD;
        }
    }
    return dp[index][mask] = ans;
}

int main() {
    IO;
    cin >> n;
    a.resize(n);
    for (int i = 0; i < n; i++) {
        a[i].resize(n);
        for (int j = 0; j < n; j++) {
            cin >> a[i][j];
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < (1 << 21); j++)
            dp[i][j] = -1;
    }
    cout << solve(0,0);
    return 0;
}


Measured memory_bytes: 344320
N = int(input())
P = [int(input()) for _ in range(N)]
P.sort()
S = sum(P)
if S % 10 == 0:
    for i in range(N):
        if P[i] % 10 != 0:
            print(S-P[i])
            exit()
    print(0)
else:
    print(S)


Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
using namespace std;

int main (void) {
  int N,K;
  int ans=0;
  cin >> N >>K;
  int l[55]={0};
  for (int i=0; i<=N-1; i++) {
    cin >> l[i];
  }
  sort(l,l+N, greater<int>());
  for (int j=0; j<=K-1; j++){
    ans=ans+l[j];
    if (j==K-1){
      cout << ans;
    }
  }
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) RFOR(i, n, 0)
#define MFOR(i, m) for(auto i=(m).begin();i!=(m).end();i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())

typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll << 50;

template<typename T>
void printv(vector<T> const& s) {
  REP(i, SZ(s)) {
    cout << s[i] << " ";
  }
  cout << endl;
}


int main () {
  cin.tie(0);
  cout << setprecision(10);

  ll n, m; cin >> n >> m;
  vi d(n, 0);
  if(m == 0) {
    cout << "Yes" << endl;
    return 0;
  }
  vector<vector<P>> g(n);
  REP(i, m) {
    int l, r, c; cin >> l >> r >> c;
    l--; r--;
    g[l].pb(P(r, c));
    g[r].pb(P(l, -c));
  }

  vector<bool> sel(n,false);
  vector<bool> stsel(n, false);
  bool ok = true;
  while(count(ALL(sel), false) && ok) {
    stack<int> st;
    int start = find(ALL(sel), false) - sel.begin();
    st.push(start);
    sel[start] = true;
    stsel[start] = true;
    while(!st.empty() && ok) {
      int now = st.top(); st.pop();
      REP(i, SZ(g[now])) {
        int next = g[now][i].fi, cost = g[now][i].se;
        if(sel[next] && d[now] + cost != d[next]) {
          ok = false;
          break;
        } else {
          d[next] = d[now] + cost;
        }
        sel[next] = true;
        if(!stsel[next]) st.push(next);
        stsel[next] = true;
      }
    }
  }

  cout << (ok ? "Yes" : "No") << endl;
  

  

}


Measured memory_bytes: 9344
from math import gcd
import sys

def lcm(x,y):
    return x*y//gcd(x,y)

def count(x):
    res=0
    while True:
        if x%2==0:
            res+=1
            x//=2
        else:
            break
    return res

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

A.sort(reverse=True)

temp=A[0]
for i in range(1,n):
    if count(A[i])!=count(temp):
        print(0)
        sys.exit()
    else:
        temp=lcm(temp,A[i])

ans=m//(temp//2)-m//temp
print(ans)


Measured memory_bytes: 20720
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

int main(){
    ll x;
    cin >> x;
    set<ll> se;
    map<ll,ll> mp;
    rp(i,1000){
        se.insert(i*i*i*i*i);
        mp[i*i*i*i*i]=i;
    }
    P ans;
    for(ll i=-1000; i<=1000; i++){
        ll can=x+i*i*i*i*i;
        auto ite=se.find(can);
        if(ite!=se.end()){
            ans.first=mp[can];
            ans.second=i;
            break;
        }
    }
    cout << ans.first << " " << ans.second << endl;
    return 0;
}

Measured memory_bytes: 3740
#include <cstdio>
#include <algorithm>
using std::min;
using std::max;
int n, k;
long long ans;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= n; j += i) {
      int st = max(j + k, 1), ed = min(j + i - 1, n);
      if (st <= ed) ans += ed - st + 1;
    }
  }
  printf("%lld", ans);
}


Measured memory_bytes: 128
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

string sed(string s, string a, string b)
{
    int n = s.size();
    int m = a.size();
    string ret;

    for(int i=0; i<n; ++i){
        if(i + m <= n && s.substr(i, m) == a){
            ret += b;
            i += m-1;
        }else{
            ret += s[i];
        }
    }

    return ret;
}

int main()
{
    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

        vector<string> a(n), b(n);
        for(int i=0; i<n; ++i)
            cin >> a[i] >> b[i];

        string s, t;
        cin >> s >> t;

        int ret = 0;
        set<string> curr;
        curr.insert(s);
        bool ng = true;
        while(!curr.empty()){
            set<string> next;
            set<string>::iterator it;
            for(it=curr.begin(); it!=curr.end(); ++it){
                if(*it == t){
                    next.clear();
                    ng = false;
                    cout << ret << endl;
                    break;
                }
                for(int i=0; i<n; ++i){
                    string x = sed(*it, a[i], b[i]);
                    if(x != *it && x.size() <= t.size())
                        next.insert(x);
                }
            }
            curr.swap(next);
            ++ ret;
        }

        if(ng)
            cout << -1 << endl;
    }
}

Measured memory_bytes: 1036
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) x.begin(),x.end()
#define pll  pair <long long,long long>
#define ss second
#define ff first
#define inf 9223372036854775807
#define maa 1000000007
#define ld long double
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define bug(x) cout << #x <<": " << x << '\n';
const ll N=8001 ;
int main()
{
   fast ;
   ll n,m,x ; cin>>n>>m>>x ;
   ll c[n][m] ;
   ll cost[n] ;
   for(ll i=0;i<n;i++)
   {
       cin>>cost[i] ;
       for(ll j=0;j<m;j++) cin>>c[i][j] ;
   }
   ll ans=inf ;

   for(ll mask=0;mask<(1<<n);mask++)
   {
       ll cnt=0 ;
       vector<ll>skill(m,0) ;
       for(ll j=0;j<n;j++)
       {
           ll bit=mask&(1<<j) ;
           if(bit!=0)
           {
               cnt+=cost[j] ;
               for(ll k=0;k<m;k++)
               {
                   skill[k]+=c[j][k] ;
               }
           }
       }
       ll f=1 ;
       for(ll j=0;j<m;j++)
       {
           if(skill[j]<x) f=0 ;
       }
       if(f) ans=min(ans,cnt) ;
   }

   if(ans!=inf)
   cout<<ans ;
   else cout<<"-1" ;


}




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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
	int n;cin>>n;
	vl a(n),sum(n+1);
	sum[0]=0;
	map<ll,ll>b;
	rep(i,n){
        cin>>a[i];
		sum[i+1]=sum[i]+a[i];
		b[sum[i+1]]++;
	}
	sort(all(sum));
	sum.erase(unique(all(sum)),sum.end());
	ll ans=0;
    int m=sum.size();
    ans+=b[0];
	rep(i,m){
		ans+=b[sum[i]]*(b[sum[i]]-1)/2;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 15872
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1000000007
#define INF 1e9
#define PIE 3.14159265358979323

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>
T GCD(T a, T b) {
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}
template <class T>
inline T LCM(T a, T b) {
    return (a * b) / GCD(a, b);
}

#define int long long

signed main() {
    int n, weight;
    cin >> n >> weight;
    vector<int> w(n);
    vector<int> v(n);
    rep(i, n) cin >> w[i] >> v[i];
    vector<vector<int>> dp(n + 1, vector<int>(100101, MOD));
    dp[0][0] = 0;
    for (int i = 1; i <= n; i++) {
        for (int sum_v = 0; sum_v <= 100100; sum_v++) {
            if (sum_v - v[i - 1] >= 0)
                chmin(dp[i][sum_v], dp[i - 1][sum_v - v[i - 1]] + w[i - 1]);
            chmin(dp[i][sum_v], dp[i - 1][sum_v]);
        }
    }
    int ans = 0;
    for (int i = 0; i <= 100100; i++) {
        if (dp[n][i] <= weight)
            chmax(ans, i);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 80256
#include <iostream>

#include <sstream>
#include <string>

#include <vector>
#include <array>

#include <list>
#include <queue>

#include <map>
#include <set>

#include <algorithm>
#include <memory>

#define PI 3.141592653589793238462643383279
#define For(v,i) for (int v = 0;v < (i);v++)

using namespace std;

int main() {

	int n;

	cin >> n;

	vector<int> t(n);
	vector<int> a(n);

	For(i, n)
	{
		cin >> t[i];
	}
	For(i, n)
	{
		cin >> a[i];
	}

	if (t.back() != a[0])
	{
		cout << 0 << endl;
		return 0;
	}

	int num = 0;
	set<int> change;
	change.insert(0);
	change.insert(n - 1);

	for (int i = 0; i < n; i++)
	{
		if (i - 1 > 0)
		{
			if (t[i] < t[i - 1])
			{
				cout << 0 << endl;
				return 0;
			}
		}
		if (t[i] != num)
		{
			num = t[i];
			change.insert(i);
		}
	}
	for (int i = n - 1; i >= 0; i--)
	{
		if (i + 1 < n)
		{
			if (a[i] < a[i + 1])
			{
				cout << 0 << endl;
				return 0;
			}
		}
		if (a[i] != num)
		{
			num = a[i];
			change.insert(i);
		}
	}

	vector<int> minNumber(n);
	bool equal = false;
	For(i, n)
	{
		minNumber[i] = min(t[i], a[i]);
		if (t[i] == a[i] && t[i] == t.back())
			equal = true;
	}

	if (!equal)
	{
		cout << 0 << endl;
		return 0;
	}

	unsigned long long int patt = 1;
	For(i, n)
	{
		if (change.find(i) == change.end())
		{
			patt = (patt*minNumber[i]) % 1000000007;
		}
	}

	cout << patt << endl;

	return 0;
}


Measured memory_bytes: 6144
#include <bits/stdc++.h>
    using namespace std;
    #define ll long long int
    #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int32_t main()
    {
        ll i,j,k,l,n,m,q,t,five=0,seven=0,a,b,c;
        cin>>a>>b>>c;
      if(a==5)
      {
      five++;
      }
      if(c==5)
      {
      five++;
      }
      if(b==5)
      {
      five++;
      }
       seven=3-five;
      if(five==2&&seven==1){
      cout<<"YES";
      }
      else
      {
      cout<< "NO";
      }

       return 0;
    }






Measured memory_bytes: 256
import std.stdio;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;
import std.ascii;

void main() {
    while(true) {
        int W, H;
        readf("%d %d\n", &W, &H);
        if (W==0 && H==0) break;
        
        int N = readln.chomp.to!int;
        bool[][] flag = new bool[][](W, H);
        foreach(i; 0..N) {
            int[] input = readln.split.to!(int[]).map!"a-1".array;
            flag[input[0]][input[1]] = true;
        }
        
        long[][] dp = new long[][](W, H);
        dp[0][0] = 1;
        foreach(x; 0..W) foreach(y; 0..H) {
            if (flag[x][y]) continue;
            if (x>0) dp[x][y] += dp[x-1][y];
            if (y>0) dp[x][y] += dp[x][y-1];
        }
        dp.back.back.writeln;
    }
}

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

int main() {
  int n;
  cin >> n;
  long long ans = 0;
  vector<long> a(n+1),b(n);
  for(int i=0;i<n+1;i++){
    cin >> a.at(i);
  }
  for(int i=0;i<n;i++){
    cin >> b.at(i);
  }
  
  for(int i=0;i<n;i++){
    if(a.at(i) + a.at(i+1) <= b.at(i)){
      ans += a.at(i) + a.at(i+1);
      a.at(i+1) = 0;
    }
    else if( a.at(i) <= b.at(i) && b.at(i) < a.at(i) + a.at(i+1)){
      ans += b.at(i);
      a.at(i+1) = a.at(i+1) + a.at(i) - b.at(i);
    }
    else if(b.at(i) <= a.at(i)){
      ans += b.at(i);
    }
  }
  
  cout << ans << endl;
  
  
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1e18

using namespace std;

int main(void){
  ll n;
  cin >> n;
  
  ll a = n % 10;
  if (a == 2 || a == 4 || a == 5 || a == 7 || a == 9)
    cout << "hon" << endl;
  else if (a == 3)
    cout << "bon" << endl;
  else
    cout << "pon" << endl;

  return 0;
}


Measured memory_bytes: 3632
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const long long inf = 1ll<<61;
typedef pair<int, int> P;
typedef pair<P, int> PP;
typedef pair<int, PP> PPP;
struct edge { int to; int to2; int cost; };

signed main() {
	int a, b; cin >> a >> b;
	int k; cin >> k;
	int cnt = 0;
	for (int i = min(a, b); i >= 1; i--) {
		if (a%i == 0 && b%i == 0)cnt++;
		if (cnt == k) {
			cout << i << endl; return 0;
		}
	}
}

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

long long int a[100005]={0};

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

    long long int ans = 0;
    for(int i=1;i<n;++i){
        ans += a[i] / 2;
        a[i] %= 2;
        if(a[i] && a[i+1]){
            a[i]--;
            a[i+1]--;
            ans++;
        }
    }
    ans += a[n] / 2;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
#include <numeric> //lcm
#include <iomanip> //double精度 setprecision

#include <atcoder/all>

using namespace std;
using namespace atcoder;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = n-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define rrep1(i,n) for(int i = (n); i >= 1; --i)
#define REP(i,n,m) for(int i = (n); i < (m); ++i)
#define all(vec) (vec).begin(),(vec).end()

#define debug(vec) for(auto v : vec) cerr << v << " "; cerr << endl;
#define debug2D(vec2D, w) for(auto vec : vec2D) { for (auto v : vec) cerr << setw(w) << v << " "; cerr << endl; } 
#define debugP(vec) for(auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl;
#define debug2DP(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl; } 

const char en = '\n';

typedef long long ll;

constexpr ll INF = 1000000000; //10^10
//const ll MOD = 998244353;
constexpr ll MOD = 1000000007;

typedef vector<vector<int>> Graph;
void add_edge(Graph& g, int from, int to, bool isDirected) {
	g[from].push_back(to);
	if (!isDirected) g[to].push_back(from);
}

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

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

	ll t; cin >> t;
  
	rep(i, t) {
		ll n,m,a,b; cin >> n >> m >> a >> b;
		cout << floor_sum(n,m,a,b) << endl;
	}
}



Measured memory_bytes: 3620
import sys
def coloring2(color,p):
    global K
    dcolor = 1
    for c in Data[p]:
        if dcolor == color:
            dcolor += 1
        s = str(p)+'_'+str(c)
        Edge[s] = dcolor 
        coloring2(dcolor,c)
        dcolor += 1
    K = max(K,dcolor-1)

sys.setrecursionlimit(10 ** 9)
N = int(input())
Data = [ [] for _ in range(N+1) ]
Edge = {} 
Edge2 = []
for _ in range(N-1):
    a,b = map(int,input().split())
    Data[a].append(b)
    s = str(a)+'_'+str(b)
    Edge[s] = 0
    Edge2.append([a,b])

K = 0
coloring2(0,1)
print(K)
for [a,b] in Edge2:
    s = str(a)+'_'+str(b)
    print(Edge[s])

Measured memory_bytes: 81824
n = int(input())
a = list(map(int, input().split()))
data1 = [0 for _ in range(n)]
data2 = [0 for _ in range(n)]
for i,x in enumerate(a):
    if i+x <= n-1:
        data1[i+x] += 1
    if i-x >= 0:
        data2[i-x] += 1

ans = 0
for i in range(n):
    ans += data1[i]*data2[i]
print(ans)

Measured memory_bytes: 109696
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int a,b,c,x;
  cin>>a>>b>>c>>x;
  int count=0;
  rep(i,a+1){
    rep(j,b+1){
      rep(k,c+1){
        if(i*500+j*100+k*50==x){
          count++;
        }
      }
    }
  }
  cout<<count<<'\n';
  return(0);
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
  int H,W;
  cin>>H>>W;
  vector<string> a(H);
  for(int i=0;i<H;++i){
    cin>>a[i];
  }

  vector<bool> row(H,false);
  vector<bool> col(W,false);
  for(int i=0;i<H;++i){
    for(int j=0;j<W;++j){
      if(a[i][j]=='#'){
        row[i] = true;
        col[j] = true;
      }
    }
  }

  for(int i=0;i<H;++i){
    if(row[i]){
      for(int j=0;j<W;++j){
        if(col[j]){
          cout<<a[i][j];
        }
      }
      cout<<endl;
    }
  }
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
void partialSum(int& c, int i, int k, int n, int s, int sum)
{
	if (k == n && s == sum){
		++c;
		return;
	}
	if (i > 9 || k > n || sum > s)
		return;

	partialSum(c, i + 1, k, n, s, sum);
	partialSum(c, i + 1, k + 1, n, s, sum + i);
}
int main()
{
	int n, s, c, i, k, sum;
	while (cin >> n >> s){
		if (0 == s && 0 == n) break;
		c = i = k = sum = 0;
		partialSum(c, i, k, n, s, sum);
		cout << c << "\n";
	}
	return 0;
}

Measured memory_bytes: 1160
N = int(input())
A = tuple(map(int, input().split()))

MOD = 10 ** 9 + 7
MAX = 10 ** 5 + 10
modinv = lambda a, mod=MOD: pow(a, mod - 2, mod)
fac, inv = [1] * MAX, [1] * MAX
for i in range(1, MAX):
    fac[i] = fac[i - 1] * i % MOD
    inv[i] = modinv(fac[i])


def comb(n, k, error=0):
    if not 0 <= k <= n:
        return error
    return fac[n] * inv[k] * inv[n - k] % MOD


d_tmp = {}
for i, a in enumerate(A):
    if a in d_tmp:
        double = a
        lr_sections_len = d_tmp[a] + N - i
        break
    else:
        d_tmp[a] = i

for k in range(1, N + 2):
    print((comb(N + 1, k) - comb(lr_sections_len, k - 1)) % MOD)


Measured memory_bytes: 27660
N,K=gets.split()
sunuke=Array.new(N.to_i(),false)
k=K.to_i()
for i in 0..k-1 do
  d=gets.to_i()
  s=gets.split(' ')
  for j in 0..d-1 do
    sunuke[s[j].to_i()-1]=true
  end
end

puts(sunuke.count(false))


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

const ll INF = 1LL << 62;
const double PI = acos(-1);
const double eps = 1e-10;

int main() {
  ll n, ans = 0;
  cin >> n;
  vector<int> l(n);
  rep(i, n) cin >> l[i];

  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      for (int k = j + 1; k < n; k++) {
        if (l[i] != l[j] && l[j] != l[k] && l[k] != l[i] &&
            l[i] + l[j] > l[k] && l[j] + l[k] > l[i] && l[k] + l[i] > l[j])
          ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3624
#include <cstdlib>
#include <iostream>
#include <string>

using namespace std;

int approx(int d) {
  int acc = 0;
  for (int x = 0; x < 600; x += d) {
    acc += x * x * d;
  }
  return acc;
}

int main() {
  string line;
  while (getline(cin, line)) {
    int d = atoi(line.c_str());
    cout << approx(d) << endl;
  }

  return 0;
}

Measured memory_bytes: 1184
q = int(input())
a = [[int(i) for i in input().split()] for i in range(q)]
prime = [True]*100000
prime[0],prime[1] = False,False
for i in range(2, 317):
	if not prime[i]: continue
	for j in range(i*2,100000,i): prime[j] = False
y = [0]
for i in range(3,10**5,2):
	if prime[i] and prime[(i+1)//2]: y.append(y[-1]+1)
	else: y.append(y[-1])
for i in a:
	print(y[(i[1]-1)//2]-y[max((i[0]-3)//2,0)])

Measured memory_bytes: 23184
#include <bits/stdc++.h>
#define int long long

using namespace std;

signed main()
{
    int n,m;
    cin>>n>>m;

    int z=pow(2,12);
    int dp[z+100000];

    fill_n(dp,z+100000,1e17);

    int power[15]={0};
    power[0]=1;
    for (int i = 1; i <=14 ; ++i) {
        power[i]=power[i-1]*2;
    }

    dp[0]=0;
    int a,b;
    for (int i = 0; i < m; ++i) {
        cin>>a>>b;
        int temp[13]={0};
        int x;
        for (int j = 0; j < b; ++j) {
            cin>>x;
            temp[x]=1;
        }

        int num=0;
        for (int j = 1; j <=12 ; ++j) {
            num=(num+temp[j]*power[j-1]);
        }

        for (int j = 0; j <=z ; ++j) {
            dp[(num|j)]=min(dp[(num|j)],dp[j]+a);
        }
    }

    int res=pow(2,n);
    res--;

    if(dp[res]==1e17)
        cout<<-1;
    else
        cout<<dp[res];
}

Measured memory_bytes: 1152
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iterator>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
	string s;
	cin >> s;
	cout << s[0] << s.length() - 2 << s[s.length() - 1];

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
constexpr ll mod = ll(1e9 + 7);
#define endl '\n'

vector<int> smallest_factor;
vector<bool> prime;
vector<int> primes;
constexpr ll MAXN = 1e6;
void sieve(int maximum) {
  maximum = max(maximum, 2);
  smallest_factor.assign(maximum + 1, 0);
  prime.assign(maximum + 1, true);
  prime[0] = prime[1] = false;
  primes = {};
 
  for (int p = 2; p <= maximum; p++)
    if (prime[p]) {
      smallest_factor[p] = p;
      primes.push_back(p);
 
      for (int64_t i = int64_t(p) * p; i <= maximum; i += p)
        if (prime[i]) {
          prime[i] = false;
          smallest_factor[i] = p;
        }
    }
}    

// Prime factorizes n in worst case O(sqrt n / log n). Requires having run `sieve` up to at least sqrt(n).
// If we've run `sieve` up to at least n, takes O(log n) time.
vector<pair<int64_t, int>> prime_factorize(int64_t n) {
  int64_t sieve_max = int64_t(smallest_factor.size()) - 1;
  assert(1 <= n && n <= sieve_max * sieve_max);
  vector<pair<int64_t, int>> result;
 
  if (n <= sieve_max) {
    while (n != 1) {
      int64_t p = smallest_factor[n];
      int exponent = 0;
 
      do {
        n /= p;
        exponent++;
      } while (n % p == 0);
 
      result.emplace_back(p, exponent);
    }
 
    return result;
  }
 
  for (int64_t p : primes) {
    if (p * p > n)
      break;
 
    if (n % p == 0) {
      result.emplace_back(p, 0);
 
      do {
        n /= p;
        result.back().second++;
      } while (n % p == 0);
    }
  }
 
  if (n > 1)
    result.emplace_back(n, 1);
 
  return result;
}

 
void Get(ll n, ll& ans) {
}

int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  sieve(MAXN);
  ll n;
  cin >> n;
  auto pf = prime_factorize(n);
  ll ans = 0;
  for (auto& [k,e] : pf) {
    for (int v = 1; e >= v; ++v) {
      e -= v;
      ++ans;
    }
  }
  cout << ans << endl;
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define F first
#define S second
#define PB push_back
#define MK make_pair
#define REP(i, a, b) for (int i=a; i < b; i++)


bool sort_by(pi c, pi d){
	return c.S < d.S;
}

int main() {
	string s, t;
	cin >> s >> t;
	int ss = (int)s.size();
	int st = (int)t.size();
	int a[ss];
	int b[st];
	REP(i, 0, ss) a[i] = s[i]-'a';
	REP(i, 0, st) b[i] = t[i]-'a';
	
	sort(a, a+ss);
	sort(b, b+st, greater<int>());
	
	string ans = (st > ss?"Yes":"No");
	REP(i, 0, min(ss,st)){
		if(a[i] < b[i]){
			ans = "Yes";
			break;
		}
		else if(a[i] > b[i]){
			ans = "No";
			break;
		}
	}
	cout << ans;
	


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

using ll = long long;
template <ll MOD = 1000000007>
struct Mint{
    ll x;

    Mint() : x(0) {}
    Mint(ll t){
        x = t % MOD;
        if(x < 0) x += MOD;
    }
    
    Mint pow(ll n){
        Mint res(1), t(x);
        while(n > 0){
            if(n & 1) res *= t;
            t *= t;
            n >>= 1;
        }
        return res;
    }

    Mint inv() const {
        ll a = x, b = MOD, u = 1, v = 0, t;
        while(b > 0){
            t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        return Mint(u);
    }

    Mint & operator += (Mint a){
        x += a.x;
        if(x >= MOD) x -= MOD;
        return *this;
    }
    Mint & operator -= (Mint a){
        x += MOD - a.x;
        if(x >= MOD) x -= MOD;
        return *this;
    }
    Mint & operator *= (Mint a){
        x = 1LL * x * a.x % MOD;
        return *this;
    }
    Mint & operator /= (Mint a){
        return (*this) *= a.inv();
    }

    Mint operator + (Mint a) const { return Mint(x) += a; }
    Mint operator - (Mint a) const { return Mint(x) -= a; }
    Mint operator * (Mint a) const { return Mint(x) *= a; }
    Mint operator / (Mint a) const { return Mint(x) /= a; }

    Mint operator - () const{ return Mint(-x); }

    bool operator == (const Mint a){ return x == a.x; }
    bool operator != (const Mint a){ return x != a.x; }
    bool operator < (const Mint a){ return x < a.x; }

    friend ostream & operator << (ostream & os, const Mint &a){
        return os << a.x;
    }

    friend istream & operator >> (istream & is, Mint &a){
        ll t;
        is >> t;
        a = Mint<MOD>(t);
        return (is);
    }
};

signed main(){
    int n,m;
    cin >> n >> m;
    int a[n],b[m];
    REP(i,n){
        cin >> a[i];
    }
    REP(i,m){
        cin >> b[i];
    }
    bool use_a[n * m + 1] = {}, use_b[n * m + 1] = {};
    int sum_a[n * m + 1] = {}, sum_b[n * m + 1] = {};
    REP(i,n){
        if(use_a[a[i]]){
            cout << 0 << endl;
            return 0;
        }
        use_a[a[i]] = true;
        sum_a[a[i]] = 1;
    }
    REP(i,m){
        if(use_b[b[i]]){
            cout << 0 << endl;
            return 0;
        }
        use_b[b[i]] = true;
        sum_b[b[i]] = 1;
    }
    for(int i = n * m; i > 0; i--){
        sum_a[i - 1] += sum_a[i];
        sum_b[i - 1] += sum_b[i];
    }
    Mint<> ans = 1;
    for(int i = n * m; i > 0; i--){
        if(use_a[i] && use_b[i]) continue;
        if(use_a[i]){
            ans *= sum_b[i];
        }else if(use_b[i]){
            ans *= sum_a[i];
        }else{
            ans *= sum_a[i] * sum_b[i] - (n * m - i);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9984
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define ll long long
ll int ar[10000001];

void seiveCalc()
{
    for (int i = 0; i < 10000001; i++) ar[i] = 0;
    for (int i = 1; i < 10000001; i++)
    {
        ar[i]++;
        int mul = 2;
        while (i * mul < 10000001)
        {
            ar[i * mul]++;
            mul++;
        }
    }
    //cout << ar[1] << " " << ar[2] << " " << ar[3];
}
void findAns()
{
    int n;
    cin >> n;

    ll int ans = 0;

    for (int i = 1; i <= n; i++)
    {
        ans = ans + i * ar[i];
    }
    cout << ans;
}
int main()
{
// #ifndef ONLINE_JUDGE
//     freopen("in.txt", "r", stdin);
//     freopen("o1.txt", "w", stdout);
//     cout << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s" << "\n";
// #endif

    fastio;
    seiveCalc();

    // ll int t;
    // cin >> t;,
    findAns();
}


Measured memory_bytes: 81772
#include <bits/stdc++.h>
#define int long long
#define double long double
#define INF 1e18
using namespace std;
#define MAX 300000
signed main() {
  vector<int> prime;

  int a[MAX]; for(int i=0;i<MAX;i++)a[i]=-1;
  for (int i = 2; i < MAX; i++) {
    if (a[i] != 0 && (i%7==1 || i%7 == 6)) {
      prime.push_back(i);
      a[i] = 1;
      for (int j = i*2; j < MAX; j+=i) {
        a[j] = 0;
      }
    }
  }
  
  int N;
  while (cin >> N, N != 1) {
    vector<int> ans;
    for (int i = 0; i < prime.size(); i++) {
      if (N % prime[i] == 0) {
        ans.push_back(prime[i]);
      }
    }
    sort(ans.begin(),ans.end());
    cout << N << ":";
    for (int i = 0; i < ans.size(); i++) {
      cout << " " << ans[i];
    }
    cout << endl;
  }
}



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

using namespace std;

// AtCoderを信じる！

using int64 = long long;

int main() {
  int64 A, B, C, K;
  cin >> A >> B >> C >> K;
  cout << (A - B) * (K % 2 == 0 ? 1 : -1) << endl;
}

Measured memory_bytes: 256
#include <iostream>

int main() {
    int N, Y;
    std::cin >> N >> Y;

    for (int i = N; i >= 0; --i) {
        if (i == N && 10000 * N == Y) {
            std::cout << i << " 0 0" << std::endl;
            return 0;
        } else {
            for (int j = N - i; j >= 0; --j) {
                if (i + j == N) {
                    if (10000 * i + 5000 * j == Y) {
                        std::cout << i << " " << j << " 0" << std::endl;
                        return 0;
                    }
                } else {
                    auto k = N - i - j;
                    if (10000 * i + 5000 * j + 1000 * k == Y) {
                        std::cout << i << " " << j << " " << k << std::endl;
                        return 0;
                    }
                }
            }
        }
    }

    std::cout << "-1 -1 -1" << std::endl;
    return 0;
}

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

typedef long long int ll;
typedef string str;

int main ()
{
	// ios::sync_with_stdio(0);
 //    cin.tie(0);
 //    cout.tie(0);
	ll t,n,m,k,i,a,b,j;
	str s,u,r;
	cin >> n;
	n%=10;
	if(n==2 || n==4 || n==5 || n==7 || n==9)
		cout << "hon\n";
	else if(n==3)
		cout << "bon\n";
	else
		cout << "pon\n";
	return 0;
}

Measured memory_bytes: 3596
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a=scan.nextInt();
		int b=scan.nextInt();
		if(a==b) {
		System.out.println("Draw");
	}else {
		if(a==1) {
			System.out.println("Alice");
		}
		else if(b==1) {
			System.out.println("Bob");
		}
		else {
			if(a>b) {
				System.out.println("Alice");
			}
			else {
				System.out.println("Bob");
			}
		}
	}
		}
}

Measured memory_bytes: 23636
n,m = (int(i) for i in input().split())
move = [[int(i) for i in input().split()] for i in range(m)]

box = [1 for i in range(n)]
red = [0 if i != 0 else 1 for i in range(n)]

for xy in move:
    x,y = xy

    box[x-1] -= 1
    box[y-1] += 1

    if red[x-1] is 1: red[y-1] = 1
    if box[x-1] is 0: red[x-1] = 0

print(sum(red))


Measured memory_bytes: 22856
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.Arrays;
import java.util.Random;
public class Main 
{
    public static void main(String[] args) 
    {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(2, in, out);
        out.close();
    }

    static class TaskC 
    {
        static boolean prime(int n)
        {
            for(int i=2;i<=Math.sqrt(n);i++)
            {
                if(n%i==0)
                {
                    return false;
                }
            }
            return true;
        }

        static void reverse(long[] a,long start,long end)
        {
            long temp = 0;
            while(start<end)
            {
                temp = a[(int)start];
                a[(int)start] = a[(int)end];
                a[(int)end] = temp;
                start++;
                end--;
            }
        }


   
        
        public void solve(int testNumber, Scanner in, PrintWriter out) 
        {
            char[] c = in.next().toCharArray();
            long ans = 0;
            for(int i=0;i<c.length-1;i++)
            {
                if(c[i]!=c[i+1])
                {
                    continue;
                }
                else
                {
                    if(c[i]==c[i+1] && c[i]=='0')
                    {
                        
                        c[i+1] = '1';
                        ans++;
                    }
                    else if(c[i]==c[i+1] &&c[i]=='1')
                    {
                        
                        c[i+1] = '0';
                        ans++;
                    }
                }
            }

            System.out.println(ans);
        }


      
        
        
        static long maxdiff(long[] arr,long size)
        {
            long max = arr[1]-arr[0];
            long min = arr[0];
            for(int i=1;i<(int)size;i++)
            {
                if(arr[i]-min>max)
                {
                    max = arr[i]-min;
                }
                if(arr[i]<min)
                {
                    min = arr[i];
                }

            }
            return max;
        }

                
    }

}

Measured memory_bytes: 28884
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

int lef[30030][11];
int rig[30030][11];

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

  for(int i=0;i<N;i++){
    lef[i+1][S[i]-'0']++;
    rig[i+1][S[i]-'0']++;
  }

  for(int i=1;i<=N;i++){
    for(int k=0;k<=9;k++){
      lef[i][k]+=lef[i-1][k];
    }
  }
  for(int i=N;i>=0;i--){
    for(int k=0;k<=9;k++){
      rig[i][k]+=rig[i+1][k];
    }
  }

  ll ans=0;
  for(int i=0;i<=9;i++){
    for(int j=0;j<=9;j++){
      for(int k=0;k<=9;k++){
        bool ok=false;
        for(int l=1;l<=N;l++){
          if(S[l-1]-'0'!=j) continue;
          if(lef[l-1][i]>0&&rig[l+1][k]>0){
            ok=true;
            break;
          }
        }
        if(ok) ans++;
      }
    }
  }

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 2944
#define _CRT_SECURE_NO_WARNINGS
        #include<iostream>
        #include<string>
        #include<sstream>
        #include<algorithm>
        #include<cmath>
        #include<vector>
        #include <map>
        #include <set>
        #include <list>
        #include<fstream>
        #include<stdio.h>
        #include<iomanip>
        #include<climits>
        #include<list>
        #include <functional>
        #include <utility>
        #include <numeric>
        #define all(v) ((v).begin()),((v).end())
        #define sz(v) ((int)(v).size())
        #define PI 3.14159265
        typedef long long ll;
        typedef unsigned long long ull;
        using namespace std;
        int  main()
        {
        	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
        	//freopen("input.txt", "r", stdin);
        	//freopen("out.txt", "w", stdout);
        	///////////////////////////////////////////

        	string s;
        	cin >> s;
   map<char,ll>mp;ll ans=0;
   for(int i=0;i<sz(s);i++)
   {
     mp[s[i]]++;

   }
 ans=sz(s);
 ans=(ans*(ans-1))/2;
// cout<<mp['a']<<endl;
 for(char i='a';i<='z';i++){

     if(mp[i]>1)
        ans-=(mp[i]*(mp[i]-1)/2);
 }
 cout<<ans+1<<endl;
}


Measured memory_bytes: 832
#H,W=map(int,input().split())
N=int(input())
coin=list(map(float,input().split()))
p=10**9+7
ma=[]
dp=[[0]*(N+3) for i in range(N+3)]
dp[1][1]=coin[0]
dp[1][0]=1-coin[0]
for i in range(1,N):
     for j in range(0,N):
         if j==0:
             dp[i+1][0]=dp[i][0]*(1-coin[i])
         dp[i+1][j+1]=dp[i][j+1]*(1-coin[i])+dp[i][j]*coin[i]

print(sum(dp[N][N//2+1:N+1]))


Measured memory_bytes: 259848
#include <bits/stdc++.h>
using namespace std;
template<typename T> inline bool chmax(T& a,T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> inline bool chmin(T& a,T b) { if (a > b) { a = b; return true; } return false; }

int main() {
    string s, t;
    cin >> s >> t;
    
    sort(s.begin(), s.end());
    sort(t.rbegin(), t.rend());
    
    if (s < t) {
        cout << "Yes" << '\n';
    } else {
        cout << "No" << '\n';
    }
    
    return 0;
}

Measured memory_bytes: 256
i,x,y,z;main(a){for(;i++<=9;){scanf("%d",&a);if(x<a)z=y,y=x,x=a;else if(y<a)z=y,y=a;else if(z<a)z=a;}printf("%d\n%d\n%d\n",x,y,z);exit(0);}

Measured memory_bytes: 0
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<string>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<iostream>
#include<algorithm>
#include<unordered_map>
#include<unordered_set>
#define PI acos(-1)
#define pb push_back
#define all(x) x.begin(),x.end()
#define INF 0x3f3f3f3f
#define dd(x) cout<<#x<<" = "<<x<<","
#define de(x) cout<<#x<<" = "<<x<<"\n"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
int main()
{
	int n;
	scanf("%d",&n);
	printf("%.10lf",2.0*PI*n); 
}


Measured memory_bytes: 3816
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main()
{
    int n;
    char c;
    vector<string> w;
	string s;
    cin >> n >> s;
	w.push_back(s);
    c = w[0][w[0].size() - 1];
    for(int i = 1; i < n; i++){
        cin >> s;
		w.push_back(s);
        for(unsigned int j = 0; j < w.size() - 1; j++){
            if(w[i] == w[j]){
                cout << "No" << endl;
                return 0;
            }
        }
        if(c != w[i][0]){
            cout << "No" << endl;
            return 0;
        }
        c = w[i][w[i].size() - 1];
    }
    cout << "Yes" << endl;
    return 0;
}

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

int main()
{
	int M, N, * A,X=0;
	std::cin >> N >> M;
	A = new int[N];
	for (int i = 0; i < N; i++)
	{
		std::cin >> A[i];
		X += A[i];
	}
	std::sort(A, A + N);
	if (A[N - M]<1.0*X/4/M) {
		std::cout << "No";
	}
	else {
		std::cout << "Yes";
	}
	delete[] A;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int num[5];
char op[4];
int getAns(int i,int j,int k){
    int ans = 0;
    if(i == 1)
        ans = num[0] + num[1];
    else{
        ans = num[0] - num[1];
    }
    if(j == 1){
        ans = ans + num[2];
    }
    else{
        ans = ans - num[2];
    }
    if(k == 1){
        ans = ans + num[3];
    }
    else{
        ans = ans - num[3];
    }
    return ans;
}
void Output(int i,int j,int k){
    cout << num[0];
    if(i == 1)cout << "+";
    else cout << "-";
    cout << num[1];
    if(j == 1)cout << "+";
    else cout << "-";
    cout << num[2];
    if(k == 1)cout << "+";
    else cout << "-";
    cout << num[3];
    cout << "=7" << endl;
}
int main(){
    int i,j,k;
    string s;
    cin >> s;
    for(i = 0; i < s.length(); i++){
        num[i] = s[i]-'0';
    }
    for(i = 1; i <= 2; i++){
        for(j = 1; j <= 2; j++){
            for(k = 1; k <= 2; k++){
                if(7 == getAns(i,j,k)){
                    Output(i,j,k);
                    return 0;
                }
            }
        }
    }
    return 0;
}


Measured memory_bytes: 256