akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }
//Write From this Line

int dist[15][15];
const int inf = 1e6;
ll dp[(1<<15)][15];

int main()
{
	int v, e;
	cin >> v >> e;
	rep(i,v) rep(j,v) dist[i][j] = inf;
	rep(i,v) dist[i][i] = 0;
	rep(i,e){
		// 辺を受け取る
		int a, b, c;
		cin >> a >> b >> c;
		dist[a][b] = c;
	}

	rep(i,(1<<v)){
		rep(j,v){
			dp[i][j] = inf;
		}
	}
	dp[1][0] = 0; // 今いるのが0で,０のみ訪問済みのときの最小コストは0
	for(int i = 0; i < (1<<v); i++){
		for(int j = 0; j < v; j++){
			// 次訪問するところを全部見る
			if(dp[i][j] == inf) continue;
			rep(k,v){
				// kが既に訪れた町であれば次へ
				if((i>>k)%2) continue;
				// 次の集合に、今の集合からk bit目を立てる
				int nexti = i | (1<<k);
				// 距離はdist[j][k]
				if(dist[j][k] == inf) continue;
				ll nextd = dp[i][j] + dist[j][k];
				dp[nexti][k] = min(dp[nexti][k], nextd);
			}
		}
	}
	ll ans = 1e9;
	For(i,1,v){
		chmin(ans, dp[(1<<v)-1][i] + dist[i][0]);
	}
	if(ans >= inf){
		cout << -1 << endl;
		return 0;
	}
	cout << ans << endl;

}



Measured memory_bytes: 6956
N=int(input())
H=[int(i) for i in input().split()]
W=[0]*N
num=0
i=0
while i<N:
    if W[i]==H[i]:
        i+=1
        continue
    for j in range(i,N):
        if W[j]==H[j]:
            break
        W[j]+=1
    num+=1
print(num)



Measured memory_bytes: 3060
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <bitset>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> P;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(x) cout << (x) << endl;
const int INF = 1e+8+7;
ll n,m;
string s,t;
int d[100],dp1[500][500],dp2[500][500];
vi vec;

int main(){
  cin >> n;
  pel(i,sqrt(n),1){
    if(i*i <= n){
      print(i*i);
      return 0;
    }
  }
  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)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
#define Yes "Yes"
#define No "No"
#define YES "YES"
#define NO "NO"
typedef long long ll;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

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

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = (ll)1e9+7;
const double PI = acos(-1.0);
/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    vector<int> a(4);
    rep(i,4)cin >> a[i];
    vector<int> v = {0,1,2,3};
    /*
    昇順にソート済みのvector（またはstring）を入れると
    辞書順で次の並びのvectorに置き換えてくれる
    辞書順最後になったら -1 を返し止まる
    */
    ll ans = INF;
    sort(all(v));
    do{
        ll tmp = abs(a[v[0]] + a[v[1]] - a[v[2]] - a[v[3]]);
        chmin(ans, tmp);
    }while(next_permutation(all(v)));


    cout << ans << endl;
}


Measured memory_bytes: 3220
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = 1LL << 60;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(10);

}

signed main() {
	string s;

	cin >> s;

	vector<string> v;
	v.push_back("AKIHABARA");
	v.push_back("KIHABARA");
	v.push_back("AKIHBARA");
	v.push_back("AKIHABRA");
	v.push_back("AKIHABAR");
	v.push_back("KIHBARA");
	v.push_back("KIHABRA");
	v.push_back("KIHABAR");
	v.push_back("AKIHBRA");
	v.push_back("AKIHBAR");
	v.push_back("AKIHABR");
	v.push_back("KIHBRA");
	v.push_back("KIHBAR");
	v.push_back("KIHABR");
	v.push_back("AKIHBR");
	v.push_back("KIHBR");

	REP(i, v.size()) {
		if (s == v[i]) {
			cout << "YES" << endl;
			return 0;
		}
	}

	cout << "NO" << endl;
}

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

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;

int main(){
    cin.tie( 0 ); ios::sync_with_stdio( false );
    vector<vector<int>> a(3,vector<int>(3,0));
    rep(i,3){
        rep(j,3){
            cin >> a[i][j];
        }
    }
    int n;
    cin >> n;
    vector<int> b(n);
    rep(i,n) cin >> b[i];
    
    rep(i,n){
        rep(j,3){
            rep(k,3){
                if(a[j][k]==b[i]){
                    a[j][k]=0;
                }
            }
        }
    }

    string ans="No";
    if(a[0][0]==0&&a[0][1]==0&&a[0][2]==0) ans="Yes";
    if(a[1][0]==0&&a[1][1]==0&&a[1][2]==0) ans="Yes";
    if(a[2][0]==0&&a[2][1]==0&&a[2][2]==0) ans="Yes";
    if(a[0][0]==0&&a[1][0]==0&&a[2][0]==0) ans="Yes";
    if(a[0][1]==0&&a[1][1]==0&&a[2][1]==0) ans="Yes";
    if(a[0][2]==0&&a[1][2]==0&&a[2][2]==0) ans="Yes";
    if(a[0][0]==0&&a[1][1]==0&&a[2][2]==0) ans="Yes";
    if(a[0][2]==0&&a[1][1]==0&&a[2][0]==0) ans="Yes";
    
    cout << ans;
    return 0;
}

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

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

  vector<int> A(N);
  for (int i = 1; i < N; i++) cin >> A.at(i);

  vector<int> cnt(N);
  for (int i = 0; i < N; i++) {
    cnt.at(A.at(i))++;
  }

  for (int i = 1; i < N; i++) {
    cout << cnt.at(i) << endl;
  }
  cout << 0 << endl;
}

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

string s, t;
vector<vector<long long int>> chars(26, vector<long long int>(0));

long long int solve(){
  int n = s.size(), m = t.size();
  s += s; //発想は番兵と同じ
  rep(i, n * 2){
    chars.at(s.at(i) - 'a').push_back(i);
  }
  /*
  rep(i, 26){
    for(int x : chars.at(i)){
      cerr << x <<" ";
    }
    cerr << endl;
  }
  */
  long long int ret = 0;
  int pos = -1;
  rep(i, m){
    int c = t.at(i) - 'a';
    //tに含まれておりsに含まれない文字が存在する場合-1を返す
    //配列外参照の回避も兼ねる
    if(chars.at(c).size() == 0){
      ret = -1LL;
      return ret;
    }
    //posの更新
    pos = *upper_bound(chars.at(c).begin(), chars.at(c).end(), pos);
    //cerr << pos << endl;
    if(pos >= n){
      ret += (long)n;
      pos -= n;
    }
  }
  ret += (long)pos + 1LL;
  return ret;
}

int main(){
  cin >> s >> t;
  cout << solve() << endl;
  return 0;
}


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

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;

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

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n,m;
int g[25][21];

int subedge[1<<15][15];
int tsp[1<<15][15];

int dp[1<<15][15];

int main(){
  scanf("%d%d",&n,&m);
  REP(i,n)REP(j,n)g[i][j]=-1025830252;
  REP(i,m){
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    --a;--b;
    g[a][b] = g[b][a] = c;
  }
  // calc subset edge sum
  REP(i,1<<n){
    REP(j,n)if((i>>j)&1)REP(k,j)if((i>>k)&1){
      if(g[j][k]>=0)subedge[i][0] += g[j][k];
    }
    FOR(j,1,n)subedge[i][j] = subedge[i][0];
    REP(j,n){
      REP(k,n)if((i>>k)&1){
        subedge[i][j] += max(0,g[j][k]);
      }
    }
  }
  // calc max sum path
  REP(i,1<<n)REP(j,n)tsp[i][j] = -1025830252;
  tsp[1][0] = 0;
  REP(i,1<<n)REP(j,n)if(tsp[i][j]>=0){
    REP(to,n)if(((i>>to)&1)==0){
      CHMAX(tsp[i|(1<<to)][to],tsp[i][j]+g[j][to]);
    }
  }
  // calc answer
  int ans = 0;
  REP(i,1<<n)REP(j,n)dp[i][j] = -1025830252;
  REP(mask,1<<n)if(tsp[mask][n-1]>=0){
    mask = mask | 1 | (1<<(n-1));
    dp[0][0] = tsp[mask][n-1];
    int negmsk = (~mask)&((1<<n)-1);
    REP(j,n)for(int i=negmsk;;i=(i-1)&negmsk){
      if(dp[i][j]>=0){
        // step
        CHMAX(dp[i][j+1],dp[i][j]);
        // add
        if((mask>>j)&1){
          int neg = (~i)&(negmsk);
          for(int k=neg;;k=(k-1)&neg){
            CHMAX(dp[i|k][j+1],dp[i][j]+subedge[k][j]);
            if(k==0)break;
          }
        }
      }
      if(i==0)break;
    }
    // DEBUG(dp[negmsk][n]);
    CHMAX(ans,dp[negmsk][n]);
    REP(j,n)for(int i=negmsk;;i=(i-1)&negmsk){
      dp[i][j] = -1025830252;
      if(i==0)break;
    }
  }

  int total = 0;
  REP(i,n)REP(j,i)total+=max(0,g[i][j]);
  printf("%d\n",total-ans);
  return 0;
}


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

using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds; 

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
*/
#define pfi(a) printf("%d",a);
#define pfl(a) printf("%lld",a);
#define pfin(a) printf("%d\n",a);
#define pfln(a) printf("%lld\n",a);
#define sfi(a) scanf("%d",&a);
#define sfl(a) scanf("%lld",&a);
#define pb push_back
#define f(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define inf INT_MAX
#define llinf LONG_LONG_MAX

const int N=50+3;
const int M=998244353;


int main(){

	ll a,b;
	sfl(a) sfl(b)

	cout<<a*b<<endl;

	return 0;
}

Measured memory_bytes: 3688
#include<iostream>
int main(){
    int a,b,c;
    std::cin>>a>>b>>c;
    
    int cnt=1,sum=0;
    while(1){
        sum=sum+a;
        if(cnt%7==0){
            sum=sum+b;
        }
        
        if(sum>=c){
            break;
        }
        cnt++;
    }
    std::cout<<cnt<<"\n";
    return 0;
}



Measured memory_bytes: 3092
card={'S':'','H':'','C':'','D':''}
for i in card.keys():
	card[i]=list(range(1,14))
num=int(input())
for c in range(num):
	key,val=input().split()
	card[key].remove(int(val))

for c in list(['S','H','C','D']):
	for i in range(len(card[c])):
		print('%s %d'%(c,card[c][i]))


Measured memory_bytes: 5600
#include <iostream>
#define rep(i, n) for(int i=0; i<n; i++)

using namespace std;

int main(void){
  int N;
  string S;
  cin >> N >> S;
  //入力終了

  int x = 0, max = 0;
  rep(i, N){
    //条件に従って+か-かする
    if(S[i] == 'I')
      x++;
    else
      x--;
    //最大値の更新
    if(x > max)
      max = x;
  }

  //解答
  cout << max << endl;
  
  return 0;
}


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

const int N = 10;
map<vector<int>, int> memo;

vector<vector<int>> listup(int start, int sum, vector<int> list) {
    vector<vector<int>> result;
    if(sum == 0) {
        result.push_back(list);
        return result;
    }
    for(int i = start; i < N; ++i) {
        if(sum < i) continue;
        list.push_back(i);
        vector<vector<int>> add = listup(i, sum - i, list);
        result.insert(result.begin(), add.begin(), add.end());
        list.pop_back();
    }
    return result;
}

int dfs(const vector<vector<int>>& list, vector<int> count, int start) {
    if(memo.count(count)) return memo[count];
    int result = 0;
    for(int i = start; i < list.size(); ++i) {
        bool ok = true;
        for(const auto& v: list[i]) ok &= 0 <= --count[v];
        if(ok) result = max(result, 1 + dfs(list, count, i));
        for(const auto& v: list[i]) ++count[v];
    }
    return memo[count] = result;
}

int main() {
    vector<vector<int>> list = listup(1, N, vector<int>());

    int n;
    while(cin >> n, n) {
        vector<int> manju(n);
        for(auto& v: manju) cin >> v;

        vector<int> count(11);
        for(const auto& v: manju) ++count[v];

        int answer = 0;

        for(int i = 1; i < 5; ++i) while(count[i] && count[10 - i]) {
            --count[i];
            --count[10 - i];
            ++answer;
        }
        while(count[5] > 2) {
            count[5] -= 2;
            ++answer;
        }

        memo.clear();

        cout << answer + dfs(list, count, 0) << endl;
    }
}

Measured memory_bytes: 9072
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
typedef long double ld;
#define loopi(n) for(i=0;i<n;i++) 
#define loopj(n) for(j=0;j<n;j++)
#define loopnode(v) for(ll i : v)
#define mod7 1000000007
#define mod9 1000000009
#define mod8 100000000
#define modl 998244353
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef std::vector<ll> vecl;
typedef std::vector<bool> vecb;
typedef std::vector<long double> vecd;
typedef std::vector<string> vecstr;
typedef std::vector<char> vecch;
typedef std::vector< pair<ll,ll> >  vecpair;
typedef unordered_map<ll,ll> umap;
typedef unordered_map<long double,int> umapd;
typedef unordered_map<string,ll> umapstr;
typedef unordered_map<char,ll> umapc;
typedef set< ll,greater<ll>  > st;
typedef priority_queue<ll> q_max;
typedef priority_queue<ll,vector<ll>,greater<ll> > q_min;
ll j=0,i=0;//ll maxm = INT_MIN;

//vecl node[300001];vecl color(300001,-1);umap u;vecl res(300001,0);//ll flag = 1;
//vecb visited(300000+1,false);

int main(int argc, char const *argv[])
{

	ll x,y;cin>>x>>y;ll flag=0;
	for(i=0;i<=x;i++)
    {
      if(4*i + 2*(x-i) == y)
      {
        flag=1;break;
      }
    }
  	
  	if(flag==0) cout<<"No";
  	else cout<<"Yes";

	return 0;

	
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define repr(i,n) for(int i=(n)-1;0<=i;--i)
#define each(e,v) for(auto&& e:(v))
#define all(v) begin(v),end(v)
#define dump(x) cerr<<#x<<": "<<(x)<<endl
#define INF 100000000
#define IINF 9999999999999;
using vint = std::vector<int>;
using ll = long long;
using vll = std::vector<ll>;
template <class T> void chmin(T& a, const T& b) { a = std::min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = std::max(a, b); }

double d, n, m;

int main() {
    cin >> d >> n >> m;
    if(m != 0) cout << setprecision(12) << ((2 / pow(d, 2)) * (d - m)) * (n - 1) << endl;
    else cout << setprecision(12) << (1 / d) * (n - 1) << endl;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <cstdlib>

int main()
{
    long long X;
    std::cin >> X;
    
    long long B = 0;
    for(;;) {
        long long A = 0;
        for(;;) {
            long long A5 = A * A * A * A * A;
            long long B5 = B * B * B * B * B;
            if (A5 - B5 == X) {
                std::cout << A << " " << B <<std::endl;
                return 0;
            }
            if (A5 + B5 == X) {
                std::cout << A << " -" << B <<std::endl;
                return 0;
            }
            if (A5 > B5 + X) {
                break;
            }
            A++;
        }
        B++;
    }
    
}


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

int main(){
  int x[3];
  cin >> x[0] >> x[1] >> x[2];
  int y = x[0] + x[1] + x[2],max=x[0];
  for(int i=1;i<3;i++){
    if(max < x[i])
      max = x[i];
  }
  cout << y - max << "\n";
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define _USE_MATH_DEFINES
#include <math.h>
 
using namespace std;
 
using LL = long long;
using VLL = std::vector<LL>;
using VVLL = std::vector<VLL>;
using VVVLL = std::vector<VVLL>;
using LD = long double;
using VLD = std::vector<LD>;
using VVLD = std::vector<VLD>;
using VVVLD = std::vector<VVLD>;
 
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; }

//template<class T=LL> inline vector<T> cinv(LL N){ vector<T> v(N); REP(i, N)cin>>v[i]; return move(v);}
//template<class T=LL> inline vector<T> cinv(LL N){ vector<T> v(N); REP(i, N)cin>>v[i]; return move(v);}
#define REP(i,n) for(LL (i)=0;(i)<(n);(i)++)
#define ALL(v) v.begin(), v.end()
#define PRINTLN(v) {LL i=0; for(auto (a): v ){   cerr <<i << " : "<<  a << endl; i++;}}
#define PRINTSP(v) for(auto (a): v ) {cerr << a << " ";} cerr << endl
#define cmax(a,b) {if(a<b){a=b;}}
#define cmin(a,b) {if(a>b){a=b;}}
#define EACH(a,A) for(auto a: A)
//#define cmax(a,b) a = (a>b ? a:b)
//#define cmin(a,b) a = (a<b ? a:b) 
//cin,cout高速化のおまじない＋桁数指定
inline VLL cinvll(LL N){
  VLL A(N);
  REP(i,N){
    cin >> A[i];
  }
  return move(A);
}
struct Fast{
	Fast(){
		cin.tie(0);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(std::numeric_limits<double>::max_digits10);
	}
} fast;



void func(){
  LL N;
  cin >> N;
  VVVLD Z(N);

  REP(i,N){
    LL A;
    cin >> A;
    Z[i].resize(A);
    REP(j,A){
      LL x,y;
      cin >>x>>y;
      x--;
      Z[i][j].push_back(x);
      Z[i][j].push_back(y);
    }
  }

/*
  REP(i,N){
    LL A = Z[i].size();
    //cerr << A << endl;
    REP(j,A){
      //cerr << Z[i][j][0] << " " << Z[i][j][1]<< endl;
    }
  }
*/
  LL num_max=0;
  for (LL bit = 0; bit < (1 << N); ++bit) {
    VLL M(N,0);
  for (LL i = 0; i < N; ++i) {
      if (bit & (1 << i)) {
        M[i]=1;
      }
      else{
      }
    }
    bool mujun=false;
    for (LL i = 0; i < N; ++i) {
      if(M[i]==1){
        auto ZZ=Z[i];
        for(auto z : ZZ){
          LL x=z[0];
          LL y=z[1];
          if(M[x]!=y){
            mujun=true;
          }
        }
      }
    }


    if(mujun==true){
      continue;
    }

    LL num=0;
    for (LL i = 0; i < N; ++i) {
      if (bit & (1 << i)) {
        num++;
      }
    }
    //cerr <<  " : "<<num<<endl;
    //cerr << std::bitset<15>(bit);
    //cerr <<  " : "<<num<<endl;
    chmax(num_max,num);
  }

  cout << num_max;
} 
int main()
{
  func();
  return 0;
}
 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#define cerr if (false) cerr
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& x) {
	return os << "(" << x.first << "," << x.second << ")";
}
typedef long long ll;
typedef long double ld;
int done[100005];
vector<pair<int, int>> E[100005];
int num[8];
int has;
set<pair<int, int>> edges;
void go(int x, int p) {
	if (done[x] & (1 << p)) return;
	--num[done[x]];
	has |= 1 << p;
	done[x] |= 1 << p;
	++num[done[x]];
	for (auto& e : E[x]) {
		int y = e.first, d = e.second;
		if (d == 1) edges.insert({x, y});
		else edges.insert({y, x});
		go(y, (p + d) % 3);
	}
}
int main() {
	int n, m;
	scanf("%d%d", &n, &m);
	for (int i = 0; i < m; ++i) {
		int a, b;
		scanf("%d%d", &a, &b);
		E[a].push_back({b, 1});
		E[b].push_back({a, 2});
	}
	ll ans = 0;
	for (int i = 1; i <= n; ++i) {
		if (done[i]) continue;
		memset(num, 0, sizeof(num));
		has = 0;
		edges.clear();
		go(i, 0);
		if (has != 7) {
			ans += edges.size();
			continue;
		}
		for (int j = 0; j < 8; ++j)
			for (int k = 0; k < 8; ++k) {
				if (((j & 1) && (k & 2)) || ((j & 2) && (k & 4)) || ((j & 4) && (k & 1))) {
					ans += (ll)num[j] * num[k];
				}
			}
	}
	printf("%lld\n", ans);
}


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

int n;
string s;
int fr[3];

main() {
    cin >> s;
    int n = s.size();
    if (n == 1) {
        puts("YES");
        return 0;
    }
    for (int i = 0; i < n; i++) {
        fr[s[i] - 'a']++;
    }
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            if (abs(fr[i] - fr[j]) > 1) {
                puts("NO");
                return 0;
            }
        }
    }
    puts("YES");
 }


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

int main() {
    string  a,b;
int k=0;
    cin>>a>>b;
a=a+b;
k=stoi(a);
    int flag=0;
    for(int i=1;i<100000;i++){
        if(k==i*i)
            flag=1;
    }
    if(flag==1){
        cout<<"Yes"<<'\n';
    }
    else{
        cout<<"No"<<'\n';
    }
	return 0;
}

Measured memory_bytes: 256
/*
Author:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%   ANMOL GUPTA      %%%%%%%% 
%%%%%%%%   NIT HAMIRPUR     %%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#define pb push_back
#define debug(x)  cout<<'>'<<#x<<" : "<<x<<endl;
#define mp make_pair
#define ff first
#define ss second
#define allunique(v) 	v.erase(unique(v.begin(),v.end()),v.end());
#define MOD 1000000007
#define MOD9 1000000009
#define th(n) cout<<n<<endl
#define gc getchar_unlocked
#define ms(s, n) memset(s, n, sizeof(s))
#define prec(n) fixed<<setprecision(n)
#define eps 0.000001
#define bolt ios::sync_with_stdio(0)
#define forr(i,n) for(ll i=0;i<n;i++)
#define eof (scanf("%d" ,&n))!=EOF
#define PI acos(-1.0) 
#define all(v) v.begin(),v.end() 
#define endl "\n"
typedef long long ll;
typedef double db;
typedef long long ll;
typedef pair< ll, ll > pll;
typedef vector< ll > vll;
typedef map< ll, ll > mll;
typedef set< ll > sll;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	//printf("%I64d", n)
	ll n,m,temp,k,ans;
	cin>>n>>m;
	ans = 0;
	ll arr[m+1] = {0};
	for(int i = 0;i<n;i++)
	{
		cin>>k;
		for(int j = 0;j<k;j++)
		{
			cin>>temp;
			arr[temp]++;
		}
	}
	for(int i = 1;i<=m;i++)
	{
		if(arr[i] == n)
			ans++;
	}
	cout<<ans;
}


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

int main() {
  int N;
  cin >> N ;
  
  string C;
  bool F = false;
  for(int i = 0; i<N; i++){
    cin >> C;
    if(C == "Y"){
      F = 1;
      break;
    }
  }
  if(F){
    cout << "Four" << endl;
  }
  else{
    cout << "Three" << endl;
  }
}

Measured memory_bytes: 3628
# https://atcoder.jp/contests/yahoo-procon2019-qual/tasks/yahoo_procon2019_qual_c
# ビスケットを1枚増やす:1回
# ビスケットをA→B枚にする:2回

# 最適戦略
# 手持ち<AのときAまで増やさないと交換できない
# B-A>2のときに限って、交換し続けるのが得にな


import sys


def exit(*argv, **kwarg):
    print(*argv, **kwarg)
    sys.exit()


K, A, B = map(int, input().split())
if A - 1 >= K:  # コーナーケース、A枚になる前にK回に達する
    exit(K + 1)

if B - A > 2:
    # A枚まで増やす
    K -= (A - 1)
    # 可能な限りA→Bに変換する
    times, r = divmod(K, 2)
    print(r + times * (B - A) + A)
else:
    print(K + 1)


Measured memory_bytes: 61832
from collections import Counter

n = int(input())
s = input()
counter = Counter(s)
ans = 1

for char, count in counter.items():
    if count != 1:
        ans = ans * (count + 1) % (10 ** 9 + 7)
    else:
        ans = ans * 2 % (10 ** 9 + 7)
print(ans - 1)


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

int main() {
  int a,b,c;
  cin >> a >> b >>c;
  if(a==1&&b==2)cout<<3<<endl;
  else if(a==2&&b==1)cout<<3<<endl;
  else if(a==2&&b==3)cout<<1<<endl;
  else if(a==3&&b==2)cout<<1<<endl;
  else if(a==3&&b==1)cout<<2<<endl;
  else if(a==1&&b==3)cout<<2<<endl;
}


Measured memory_bytes: 256
n = int(input())
s = str(input())
apple = "ZABCDEFGHIJKLMNOPQRSTUVWXY"
orange = dict()
cat = dict()
snow = []
for i, j in zip(range(26), apple):
    orange[i] = j
    cat[j] = i

for i in s:
    num = cat[i]
    dog = (num + n) % 26
    snow.append(orange[dog])
print("".join(snow))

Measured memory_bytes: 3188
n, k = map(int, input().split())
a = list(map(int, input().split()))

a = sorted(list(set(a)))

if a[-1] < k:
    print("IMPOSSIBLE")
    exit()

n = len(a)

if n > 1:
    m = 10**9
    for i in range(n-1):
        if a[i] != a[i+1]:
            m = min(m, abs(a[i+1]-a[i]))
    for i in range(n):
        if abs(a[i]-k) % m == 0:
            print("POSSIBLE")
            exit()
else:
    if a[0] == k:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")


Measured memory_bytes: 14484
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x,y,num;
    while(cin>>x>>y,x&&y){
        if(x<y)swap(x,y);
        for(int i=1;;i++){
            num=x%y;
            x=y;
            y=num;
            if(!num){
                cout<<x<<" "<<i<<endl;
                break;
            }
        }
    }
}

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

#define FASTIO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
using ll = long long;
#define double ll

int main() {
	FASTIO
	ll n, k;
	cin >> n >> k;
	vector<ll> a(n);
	for (auto &i : a) {
		cin >> i;
	}

	auto f = [&](double m) -> bool {
		if(m == 0){
			ll u = 0;
			for(int i = 0 ; i < 1 ; i++){
				double x = a[i];
				ll r = 1;
				ll e = 0;
				while(x >= 1){
//					clog << x << ' ' << e << ' ' << r << endl;
					e += r;
//					clog << x << ' ' << e << ' ' << r << endl;
					r <<= 1;
					x /= 2;
				}
				u += e;
			}
			return u <= k;
		}
		ll u = 0;
		for (int i = 0; i < n; i++) {
			u += ((a[i] - 1) / m) ;

		}
		return u <= k;
	};
	double lo = 1, hi = 1e9;
	for (auto _ = 0; _ < 100; _++) {
		double mid = lo + (hi - lo) / 2;
		if (f(mid)) {
			hi = mid;
		} else {
			lo = mid;
		}
	}
	cout << hi << endl;
}

Measured memory_bytes: 4656
# AOJ 1042: Yes, I have a number
# Python3 2018.7.6 bal4u

while True:
	s = input()
	if s == "END OF INPUT": break
	ans, i, ls = '', 0, len(s)
	while i < ls:
		w = 0
		while i < ls and s[i] == ' ':
			w, i = w+1, i+1
		if w > 1: ans += '0'*(w-1)
		w = 0
		while i < ls and s[i].isalpha():
			w, i = w+1, i+1
		if w > 0: ans += str(w)
	print(ans)


Measured memory_bytes: 5560
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	D := nextInt()
	c := nextInts(26)
	s := make([][]int, D)
	for i := range s {
		s[i] = nextInts(26)
	}

	v := 0
	last := make([]int, 26)
	for i := 1; i <= D; i++ {
		t := 0
		add := -(1 << 60)
		for j := 0; j < 26; j++ {
			old := last[j]
			last[j] = i
			diff := s[i-1][j]
			for k := range c {
				diff += c[k] * (i - last[k])
			}
			if diff > add {
				t = j
				add = diff
			}
			last[j] = old
		}
		puts(t + 1)
		last[t] = i
		v += add
	}
}


Measured memory_bytes: 2004
import itertools
import heapq
N, M, R = map(int, input().split())
Visit = [int(i) for i in input().split()]
for i in range(R):
    Visit[i] -= 1
P = [[] for i in range(N)]
for i in range(M):
    a, b, c = map(int, input().split())
    P[a-1].append((c, b-1))
    P[b-1].append((c, a-1))

def Dijk(i):
    Fin = [False for i in range(N)]
    Cost = [float("inf") for i in range(N)]
    Cost[i] = 0
    Q = [(0, i)]
    heapq.heapify(Q)
    while Q:
        cost, node = heapq.heappop(Q)
        if Fin[node] == False:
            Fin[node] = True
            for next in P[node]:
                if Fin[next[1]] == False:
                    if next[0] + cost < Cost[next[1]]:
                        Cost[next[1]] = next[0] + cost
                        heapq.heappush(Q, (Cost[next[1]], next[1]))
    return Cost

E = []
for i in range(N):
    E.append(Dijk(i))

ans = float("inf")
for Order in itertools.permutations(Visit):
    temp = 0
    for i in range(R-1):
        temp += E[Order[i]][Order[i+1]]
    if temp < ans:
        ans = temp
print(ans)


Measured memory_bytes: 8356
#問題文
#高橋君は3 桁のパスワードを設定しようとしています。
#使える文字が1 以上 N 以下の数字のみであるとき、設定できるパスワードが全部で何種類であるかを答えてください。

#制約
#1≤N≤9N は整数である。

print(int(input())**3)


Measured memory_bytes: 2940
#include<iostream>
using namespace std;
int main()
{
  int a, b, c, d;
  
  scanf("%d %d %d %d", &a, &b, &c, &d);
    
  while(a > 0 && c > 0) {
    c -= b;
    if(c <= 0) break;
    a -= d;
    // printf("%d %d", c, a);
  }
  
  if(a <= 0) {
    printf("No");
  } else if(c <= 0) {
    printf("Yes");
  } else {
    printf("error") ;
  }
  
   return 0;
}

Measured memory_bytes: 3220
//============================================================================
// Name        : i
// Date        : Wed Feb 20 14:56:10 CST 2019
// Author      : landcold7
// Description : Actions speak louder more than words
//============================================================================
#include "bits/stdc++.h"
using namespace std;

#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define mst(x, y) memset(x, y, sizeof(x))
#define pvar(x) cout << #x << ": "
#define fora(e, c) for (auto &e : c)
#define fori(i, a, b) for (int i = a; i < b; ++i)
#define ford(i, a, b) for (int i = a; i > b; --i)
#define output(v) cout << (v) << '\n'
#define prt(x, a, n) { cout << x[a]; if (a < n - 1) cout << " "; }
#define pvi(x, v) if(v) pvar(x); fora(a, x) cout << a << " "; cout << "\n"
#define par(x, s, n, v) if(v) pvar(x); fori(y, s, n) prt(x, y, n) cout << "\n"

#ifndef __has_trace
#define trace(...)
#endif
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

void solve() {
    int n; cin >> n;
    // dp[i]: the probability of having i heads so far.
    vector<double> dp(n + 1, 0);
    dp[0] = 1;
    fori (i, 0, n) {
        double p; cin >> p;
        ford (j, i + 1, -1) {
            dp[j] = (j == 0 ? 0 : dp[j - 1] * p) + dp[j] * (1 - p);
        }
    }

    double ret = 0;
    fori (i, 0, n + 1) {
        if (i > n - i) {
            ret += dp[i];
        }
    }
    output(ret);
}

int main() {
    ios_base::sync_with_stdio(0);
    cout << setprecision(10) << fixed;
    cin.tie(0);
    solve();
    return 0;
}



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

#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,lessl<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define int long long
#define double long double

#define all(a)      (a).begin(),(a).end()
#define sz(x)       (int)x.size()

#define ff first
#define ss second
#define mp make_pair

#define pb push_back
#define endl "\n"

#define f(i,l,r) for(int i=l;i<=r;i++)
#define rf(i,r,l) for(int i=r;i>=l;i--)

#define bp __builtin_popcountll
#define inf 1e18

const int N=1e5+5;
const int M=998244353;
void solve()
{
     int n, k;
   cin >> n >> k;

   int a[k][2];
   for(int i=0 ; i<k ; i++)   cin >> a[i][0] >> a[i][1];

   vector<int> dp(n+5, 0);
   vector<int> p(n+5, 0);

   int pref = 0;
   dp[1] = 1;

   for(int i=1 ; i<=n ; i++){
      int cur = (pref + dp[i])%M;   
      for(int j=0 ; j<k ; j++){
         int l = i + a[j][0];
         int r = i + a[j][1];
         if(l <= n){
            dp[l] = (dp [l] + cur)%M;
         }
         if(r + 1 <= n){
            dp[r + 1] = (dp[r + 1] - cur)%M;
            dp[r + 1] = (dp[r + 1] + M)%M;
         }
      }
      pref = (pref + dp[i])%M;
   }

   cout << dp[n] << endl;

}

signed main()
{
    FAST
    
    #ifndef ONLINE_JUDGE
    freopen("input_sublime.txt", "r", stdin);
    freopen("output_sublime.txt", "w", stdout);
    #endif
    
    int t=1;
    // cin>>t;
    for(int tc=1;tc<=t;tc++)
    {
        // cout<<"Case #"<<tc<<": ";
        solve();
    }
    
    #ifndef ONLINE_JUDGE
    cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
    #endif
}


Measured memory_bytes: 6312
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n;
    cin >> n;
    int a;
    vector<int> v(n, INF);
    REP(i, n) {
        cin >> a;
        auto p = lower_bound(ALL(v), a);
        *p = a;
    }
    REP(i, n) {
        if (v[i] == INF) {
            cout << i << endl;
            return;
        }
    }
    cout << n << endl;
}



Measured memory_bytes: 3364
#define DEBUG 0

/**
 * File    : E.cpp
 * Author  : Kazune Takahashi
 * Created : 6/9/2019, 9:16:59 PM
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <random>
#include <chrono>
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

typedef long long ll;

/*
void Yes()
{
  cout << "Yes" << endl;
  exit(0);
}

void No()
{
  cout << "No" << endl;
  exit(0);
}
*/

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

const ll MOD = 1000000007;

string L;
ll dp[100010][2];

int main()
{
  cin >> L;
  int N = L.size();
  dp[0][0] = 1;
  for (auto i = 0; i < N; i++)
  {
    dp[i + 1][1] += (3 * dp[i][1]) % MOD;
    dp[i + 1][1] %= MOD;
    if (L[i] == '0')
    {
      dp[i + 1][0] += dp[i][0];
      dp[i + 1][0] %= MOD;
    }
    else
    {
      dp[i + 1][1] += dp[i][0];
      dp[i + 1][1] %= MOD;
      dp[i + 1][0] += (2 * dp[i][0]) % MOD;
      dp[i + 1][0] %= MOD;
    }
#if DEBUG == 1
    cerr << "dp[" << i + 1 << "][" << 0 << "] = " << dp[i + 1][0] << endl;
    cerr << "dp[" << i + 1 << "][" << 1 << "] = " << dp[i + 1][1] << endl;
#endif
  }
  cout << (dp[N][0] + dp[N][1]) % MOD << endl;
}

Measured memory_bytes: 2048
import java.util.Scanner;
public class Main {
public static final String YES = "YES";
public static final String NO = "NO";
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int x = sc.nextInt();
String result = YES;
if (a > x) result = NO;
if (a + b < x) result = NO;
System.out.println(result);
}
}

Measured memory_bytes: 23124
//by xxj
#include<bits/stdc++.h>
using namespace std;
#define fst first
#define snd second
#define mp make_pair
#define ll long long
#define pii pair<int,int>
#define lowbit(x) x&-x
const int inf=1e9+7;
const double eps=1e-10;
const ll linf=1e18+7;
const ll hh=523;
//const int mod=;
ll cf[200007];
ll cfcf[200007];
int a[100007];
ll ans[200007];
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int n,m;
	scanf("%d%d",&n,&m);
	for (int i=0;i<n;i++){
		scanf("%d",a+i);
	}
	ll sum=0;
	for (int i=1;i<n;i++){
		int x=a[i-1],y=a[i];
		if (y<x){
			y+=m;
		}
		sum+=y-x;
		cfcf[x+2]+=1;
		cfcf[y+1]-=(y-x);
		cfcf[y+2]+=(y-x-1);
	}
	cf[0]=0;
	int cnt=0;
	for (int k=1;k<=2*m;k++){
		cf[k]=cf[k-1]+cfcf[k];
	}
	ans[0]=0;
	cnt=0;
	for (int i=1;i<=2*m;i++){
		ans[i]=ans[i-1]+cf[i];
	}
	ll mn=linf;
	for (int i=1;i<=m;i++){
		ans[i]+=ans[i+m];
		mn=min(sum-ans[i],mn);
	}
	printf("%lld\n",mn);
	return 0;
}
/*
input:
4 6
1 5 1 4
*/


Measured memory_bytes: 5376
n = gets.to_i
h = gets.split(" ").map(&:to_i)

list = []
n.times do |i|
  next list.push(0) if i == 0
  if h[n - i - 1] >= h[n - i]
    list.push(list.last + 1)
  else
    list.push(0)
  end
end
puts list.max

Measured memory_bytes: 9476
use proconio::fastout;
use whiteread::parse_line;

#[fastout]
fn main() {
    let mut s: Vec<usize> = parse_line().unwrap();
    s.sort();
    if s[0] == 5 && s[1] == 5 && s[2] == 7 {
        println!("YES");
    } else {
        println!("NO");
    }
}


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

int main(){
  int n, m; cin >> n >> m;
  priority_queue<int> pque;
  for (int i = 0; i < n; i++){
    int a; cin >> a;
    pque.push(a);
  }
  for (int i = 0; i < m; i++){
    int p = pque.top(); pque.pop();
    pque.push(p / 2);
  }
  int64_t ans = 0;
  for (int i = 0; i < n; i++){
    int p = pque.top(); pque.pop();
    ans += p;
  }
  cout << ans << endl;
}

Measured memory_bytes: 892
N=int(input())
p,q=0,0
import numpy as np
s=list(map(int,input().split()))
s=np.array(s)-np.array(range(N))
s=sorted(s)
t=[N//2,(N-1)//2]
s1=s-np.ones((N))*s[t[0]]
s2=s-np.ones((N))*s[t[0]]
for i in s1:
    p+=abs(i)
for i in s2:
    q+=abs(i)
print(int(min(p,q)))    
    




Measured memory_bytes: 34244
def dfs(graph: list,
        v: int,
        _from: int,
        low: list,
        pre: list,
        ret: list,
        count: list)->int:
    pre[v] = count[0]
    low[v] = count[0]

    count[0] += 1

    for to in graph[v]:
        if pre[to] >= 0:
            # already visited
            if _from != to:
                low[v] = min(low[v], low[to])
        else:
            low[v] = min(low[v], dfs(graph, to, v, low, pre, ret, count))
            if low[to] == pre[to]:
                ret.append((v, to))

    return low[v]


def bridge(N: int, M: int, edges: list)->int:
    graph = [[] for _ in range(N)]
    for u, v in edges:
        graph[u-1].append(v-1)
        graph[v-1].append(u-1)

    low, pre = [-1] * N, [-1] * N
    ret = []
    dfs(graph, 0, -1, low, pre, ret, [0])

    return len(ret)


if __name__ == "__main__":
    M = 0
    N, M = map(int, input().split())
    edges = [tuple(int(s) for s in input().split()) for _ in range(M)]
    ans = bridge(N, M, edges)
    print(ans)


Measured memory_bytes: 3192
#include<iostream>
#include<vector>

using namespace std;

int main(void){
	
  int N,T;
  cin>>N>>T;
  
  vector<int> t(N);
  int ans=0;
  for(int i=0;i<N;i++){
  	cin>>t[i];
    if(i==0) continue;
    if( t[i]-t[i-1]>T ) ans+=T;
    else ans+=t[i]-t[i-1];
  }
  ans+=T;
  
  cout << ans << endl;
  
	return 0;
}

Measured memory_bytes: 1024
/* 実行時間1s制限の場合
  10^6 1,000,000   : 余裕をもって間に合う
  10^7 10,000,000  : おそらく間に合う
  10^8 100,000,000 : 非常にシンプルな処理でないと厳しい
 */
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#include <bits/stdc++.h>
using namespace std;

typedef long long ll; // long longはデータモデル(LLP64, LP64, ...)によらず64bit.
ll gcd(ll a, ll b) {return b ? gcd(b, a%b) : a;}  // Greatest Common Divisor ユークリッドの互除法（aが長辺）
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}          // Least Commont Multiple オーバーフローしないように先に割る

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

int main()
{
#ifdef LOCAL
    // 以降 cin の入力元が 'xxx.txt' になる
    std::ifstream in("c.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    int n;
    cin >> n;

    vector<pair<int ,int>> p(n);

    rep(i, n) {
        cin >> p[i].first;
        p[i].second = i+1;
    }

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

    rep(i, n) {
        cout << p[i].second << " ";
    }

    return 0;
}

/*
  - 1e9 : 10^9
  - container一般
    - 合計
      accumulate(a.begin(), a.end(), 0LL)  0LLはオーバーフロー用
  - vector
    vector<int> A(N, 0); // 0で初期化(省略可)
    - loop
      for  (int i = 0; i < A.size(); i++) {}
      for  (int elem : A) {}
    - sort
      std::sort(v.begin(), v.end());  // 昇順
      std::sort(v.begin(), v.end(), std::greater<int>()); //降順
      - vector<vector<int>> cnt(h, vector<int>(w))
    - sort(struct)
        struct st_t {
            string name;
            int p;
            bool operator<(const st_t& another) const {
                if (name == another.name)
                {
                    return p > another.p;
                }
                return name < another.name;
            }
        };
        vector<st_t> st(n);
        sort(st.begin(), st.end());
  - pair
    - pairのソートの定義 : firstが優先的に比較。同じだったらsecond。
    - pair<pair<string,int>,int> p[110];
      std::sort(p,p+a);
        こうすると、first.first -> first.second -> secondの順にソートされる
  - map
    - for (auto x : map) {}  // x.first:key  x.second:value.
  - priority_queue<int> q;
    - q.top()に最大値が入っている
  - string
    - loop
      for (char& c : s) {}
 */



Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
long long ng,r,g,b;
 
int main(){
	int N; string S; cin>>N>>S;
	for(int i=0; i<N; i++){
		S[i]=='R'? r++: S[i]=='G'? g++: b++;
		for(int j=i+1,k=i+2; k<N; k+=2,j++)
			if((S[i]^S[j]^S[k]) == ('R'^'G'^'B')) ng++;
	}
	cout<< r*g*b - ng <<endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define deb(x) cout<<x<<"\n";
#define deB(x,y) cout<<x<<" "<<y<<"\n";
#define Deb(x,y,z) cout<<x<<" "<<y<<" "<<z<<"\n";
#define YES cout<<"YES\n";
#define Yes cout<<"Yes\n";
#define NO cout<<"NO\n";
#define No cout<<"No\n";
#define clt(x) 63-__builtin_clzll(x)
#define bct(x) __builtin_popcountll(x)
#define all(v) (v).begin(),(v).end()
#define pi pair<ll,ll>
#define vi vector<ll>
#define vpi vector<pair<ll,ll>>
#define maxq priority_queue<ll>
#define minq priority_queue<ll,vector<ll>, greater<ll>>
#define cont continue;
#define reto return 0;
#define sz size()
#define spmod 1116295198451
#define mod 1000000007
#define md 998244353 
#define N 2e5+10
//typedef tree<int,null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> //pbds;


int main()
{
  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  string s;
  cin>>s;
  ll ans=0,mx,i=0;
  while(i<s.size())
  {
    if(s[i]=='R')
    {
      mx=0;
      while(i<s.size()&&s[i]=='R')
      {
        i++;
        mx++;
      }
      ans=max(ans,mx);
    }
    else
      i++;
  }
  deb(ans)
}

Measured memory_bytes: 3604
#include<cstdio>
#include<algorithm>
#include<string>
#include<cstring>
#include<vector>
#include<iostream>
#include<queue>
#include<cmath>
using namespace std;
typedef long long ll;
int main() {
	int n, m, k, s = 0, a, b;
	while(~scanf("%d %d %d", &n, &m, &k)) {
	for(int i = 1; i <= n; i++) {
		scanf("%d %d", &a, &b);
		if(a >= m && b >= k) s++;
	}
	printf("%d\n", s);
	s = 0;
	}
	return 0;
}


Measured memory_bytes: 256
# Aizu Problem 0027: What day is today?
#
import sys, math, os, datetime

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


DAY = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
while True:
    m, d = [int(_) for _ in input().split()]
    if m == d == 0:
        break
    print(DAY[datetime.date(2004, m, d).weekday()])

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

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

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

/**
 * @brief 多次元 vector の作成
 * @author えびちゃん
 */
namespace detail {
    template<typename T, int N>
    auto make_vec(vector<int>& sizes, T const& x) {
        if constexpr (N == 1) {
            return vector(sizes[0], x);
        } else {
            int size = sizes[N-1];
            sizes.pop_back();
            return vector(size, make_vec<T, N-1>(sizes, x));
        }
    }
}
template<typename T, int N>
auto make_vec(int const(&sizes)[N], T const& x = T()) {
    vector<int> s(N);
    for (int i = 0; i < N; ++i) s[i] = sizes[N-i-1];
    return detail::make_vec<T, N>(s, x);
}

__attribute__((constructor))
void fast_io() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

int main() {
    int x;
    cin >> x;
    int ans = 1;
    for (int b = 2; b*b <= x; ++b) {
        int now = b;
        while (true) {
            now *= b;
            if (now > x) break;
            chmax(ans, now);
        }
    }
    cout << ans << '\n';
}


Measured memory_bytes: 3652
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  int a, b;
  cin >> a >> b;
  int outlet = 1;
  for (int i = 0; ;i++) {
    if (outlet >= b) {
      cout << i << endl;
      return 0;
    }
    outlet = outlet - 1 + a;
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      int x = sc.nextInt();
      int n = sc.nextInt();

      Set<Integer> set = new HashSet<>();
      for(int i = 0; i < n; i++)
      	set.add(sc.nextInt());
	  
	  int left = x;
	  int right = x;      
	  while(true) {
	  	if(!set.contains(left) || !set.contains(right)) {
	  		if(!set.contains(left) && !set.contains(right)) {
	  			System.out.println(left);
	  		} else if(!set.contains(left)) {
	  			System.out.println(left);
	  		} else
	  			System.out.println(right);
	  		return;
	  	}
	  	left--;
	  	right++;
	  }
      
      
  }
}

Measured memory_bytes: 27232