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

//#define int long long

typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
template<class T,class U>void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>void chmax(T &t,U f){if(t<f)t=f;}

namespace SA{
    const int MAX=1000000;
    int N,K;
    int tmp[MAX+1],rank[MAX+1];
    bool compare_sa(int i,int j){
        if(rank[i]!=rank[j])return rank[i]<rank[j];
        else{
            int ri=(i+K<=N)?rank[i+K]:-1;
            int rj=(j+K<=N)?rank[j+K]:-1;
            return ri<rj;
        }
    }

    vector<int> construct_sa(string S){
        N=S.size();
        vector<int>sa(N+1);
        for(int i=0;i<=N;i++)sa[i]=i;
        for(int i=0;i<=N;i++){
            rank[i]=i==N?-1:S[i];
        }

        for(K=1;K<=N;K*=2){
            sort(sa.begin(),sa.end(),compare_sa);
            tmp[sa[0]]=0;
            for(int i=1;i<=N;i++){
                tmp[sa[i]]=tmp[sa[i-1]]+(compare_sa(sa[i-1],sa[i])?1:0);
            }
            for(int i=0;i<=N;i++)rank[i]=tmp[i];
        }
        return sa;
    }

    bool contain(string &S,vector<int>&sa,string &T){
        int a=0,b=S.size();
        while(b-a>1){
            int c=(a+b)/2;
            if(S.compare(sa[c],T.size(),T)<0)a=c;
            else b=c;
        }
        return S.compare(sa[b],T.size(),T)==0;
    }
}

signed main(){
    string S;
    vint sa;
    int Q;
    cin>>S;
    sa=SA::construct_sa(S);
    cin>>Q;
    while(Q--){
        string T;
        cin>>T;
        if(SA::contain(S,sa,T))cout<<1<<endl;
        else cout<<0<<endl;
    }
    return 0;
}

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

using namespace std;
using ll = long long;


int main()
{
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; i++)cin >> a[i];
	int cnt = 0;
	ll ans = 0;
	for(int i = 0; i < n; i++) {
		if(a[i] < 0) {
			cnt++;
			a[i] *= -1;
		}
		ans += a[i];
	}
	cerr << ans << endl;

	if(cnt&1) {
		cout << ans - *min_element(a.begin(), a.end()) * 2 << endl;
	}else {
		cout << ans << endl;
	}

}

Measured memory_bytes: 640
#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 <numeric>
//#include <function>
using namespace std;
typedef long long unsigned int ll;

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

#define REP(i, n) for(int i = 0; i < (int)(n); i++)


int main() {

  string a = "ACGT";
  string b = "TGCA";
  char s;
  cin >> s;

  REP(i, 4){
    if (s == a[i]) {
      cout << b[i] << endl;
      break;
    }
  }
  return 0;
}


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

int main()
{
    int a;
    cin >> a;
    int ans;
    ans = a + pow(a, 2) + pow(a, 3);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4004
/*input
1
17
17
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}
int a[maxn],b[maxn];
int fix[maxn];

int main()
{
	IOS;
	int n;
	cin>>n;
	REP(i,n) fix[i]=-1;
	REP(i,n) cin>>a[i];
	REP(i,n) cin>>b[i];
	REP(i,n){
		if(i==0||a[i]!=a[i-1]) {
			if(fix[i]!=-1&&fix[i]!=a[i]){
				cout<<"0\n";
				return 0;
			}
			fix[i]=a[i];
		}
	}
	for(int i=n-1;i>=0;i--){
		if(i==n-1||b[i]!=b[i+1]){
			if(fix[i]!=-1&&fix[i]!=b[i]){
				cout<<"0\n";
				return 0;
			}
			fix[i]=b[i];
		}
	}
	ll ans=1;
	REP(i,n){
		if(fix[i]==-1){
			int mx=min(a[i],b[i]);
			ans=ans*mx%MOD;
		}
		else{
			if(fix[i]>min(a[i],b[i])){
				cout<<"0\n";
				return 0;
			}
		}
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {
    int n, m, d;
    cin >> n >> m >> d;
    cout << setprecision(20);
    if (d == 0) {
        cout << 1.0 * (n - d) * (m - 1) / n / n << endl;
    } else {
        cout << 2.0 * (n - d) * (m - 1) / n / n << endl;
    
    }
}


Measured memory_bytes: 3736
import itertools
import math
n=int(input())
xy=[list(map(int,input().split())) for i in range(n)]
ans=0
for i in itertools.permutations(xy,n):
  sum=0
  for t in range(n-1):
    sum+=((i[t][0]-i[t+1][0])**2+(i[t][1]-i[t+1][1])**2)**(1/2)
  ans+=sum
print(ans/math.factorial(n))
  

Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <iomanip>

using namespace std;

int main() {
	int h, w; cin >> h >> w;
	vector<vector<char>> vec(h + 2, vector<char>(w + 2, '#'));

	for (int i = 0; i < h + 2; i++) {
		for (int j = 0; j < w + 2; j++) {
			if (i == 0 || j == 0 || i == h + 1 || j == w + 1) {
				continue;
			}
			cin >> vec.at(i).at(j);
		}
	}

	for (int i = 0; i < h + 2; i++) {
		for (int j = 0; j < w + 2; j++) {
			cout << vec.at(i).at(j);
			if (j == w + 1) cout << endl;
		}
	}

}




Measured memory_bytes: 256
#include <stdio.h>
 
int main(void) {
  int N,K,X,Y;
  scanf("%d\n%d\n%d\n%d\n",&N,&K,&X,&Y);
  if(N>=K){
    printf("%d",K*X+(N-K)*Y);
  }
  else{
    printf("%d",N*X);
  }
 
  return 0;
}

Measured memory_bytes: 1736
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
struct edge{ll to,cost;};
const int inf = 1<<27;
const ll INF = 1LL<<60;
const int COMBMAX = 1001001;
const ll MOD = 1000000007;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define eachdo(v, e) for(const auto& e : (v))
#define all(v) (v).begin(), (v).end()
#define lower_index(v, e) (ll)distance((v).begin(), lower_bound((v).begin(), (v).end(), e))
#define upper_index(v, e) (ll)distance((v).begin(), upper_bound((v).begin(), (v).end(), e))
ll mpow(ll a, ll n, ll mod = MOD){ll res = 1; while(n > 0){if(n & 1)res = res * a % mod; a = a * a % mod; n >>= 1;} return res;}
void YesNo(bool j){cout << (j ? "Yes" : "No") << endl; return;}
void yesno(bool j){cout << (j ? "yes" : "no") << endl; return;}
template<class Head> void pt(Head&& head){cout << head << endl; return;}
template<class Head, class... Tail> void pt(Head&& head, Tail&&... tail){cout << head << " "; pt(forward<Tail>(tail)...);}
template<class T> void debug(T v){rep(i, v.size()) cout << v[i] << " " ; cout << endl;}
template<class T> void debug2(T v){rep(i, v.size()){rep(j, v[i].size()) cout << v[i][j] << " " ; cout << endl;}}
template<class T1, class T2> ll bcount(T1 v, T2 a){return upper_index(v, a) - lower_index(v, a);} 
template<class T1, class T2> inline bool chmin(T1 &a, T2 b){if(a > b){a = b; return true;} return false;}
template<class T1, class T2> inline bool chmax(T1 &a, T2 b){if(a < b){a = b; return true;} return false;}
template<class T1, class T2> void sortTwoVecter(vector<T1> &f, vector<T2> &s, bool isReverse = false){
    vector<pair<T1, T2>> p;
    rep(i, f.size()) p.emplace_back(make_pair(f[i], s[i]));
    if (!isReverse) sort(p.begin(), p.end());
    else sort(p.rbegin(), p.rend());
    rep(i, f.size()) tie(f[i], s[i]) = p[i];
    return;
}

int main(){
    ll N, K; cin>> N >> K;
    pt(min(N % K, K - (N % K)));
    return 0;
}

Measured memory_bytes: 256
from collections import deque
N = int(input())
D = [[] for _ in range(N)]
for _ in range(N-1):
    a, b, c = map(int, input().split())
    a, b = a-1, b-1
    D[a].append((b, c))
    D[b].append((a, c))

cnt, K = map(int, input().split())
K -= 1
Q = deque([(K, 0)])
Dist = [0]*N
check = [0]*N
while Q:
    n, d = Q.popleft()
    check[n] = 1
    Dist[n] = d
    for v, e in D[n]:
        if check[v]:
            continue
        else:
            Q.append((v, d+e))

for _ in range(cnt):
    x, y = map(int, input().split())
    x, y = x-1, y-1
    print(Dist[x]+Dist[y])

Measured memory_bytes: 84128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i=0;i < (int)(n);i++)
const ll mod = 1e9+7;

int main(){
     int n;
     cin >> n;
     vector<ll> v(n);
     rep(i,n) cin >> v[i];
     ll ans=0;
     for (ll bit = 0; bit <= 60; bit++){
          ll one=0,zero=0;
          rep(i,n){
               if (v[i] & 1LL << bit) one++;
               else zero++;
          }
          ans+=((one*zero)%mod)*((1LL << bit)%mod);
          ans%=mod;
          //printf("(one,zero) = (%lld,%lld),ans = %lld %lld\n",one,zero,ans,1LL << bit);
     }
     cout << ans << endl;
     
     
    
     
     return 0;
}


Measured memory_bytes: 2560
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n";
int main()
{
    IOS;
    long long a,b,c,d,e,h,l,n,t,f,m,x,y,z,f1=0,flag=0,flag1=0,co=0,co1=0,co2=0,sum=0,sum1=0,ma=0,ma1=0,mi=1000000000000000001;
    long long g,co3=0,co4=0,co5=0,co6=0,co7=0,co8=0,mul=1,sum2=0,sum3=0,mu=1,mu1=1;
    double pi=2 * acos (0.0), dou;
    char ch,ch1,ch2;
    string str,str1,str2;
    cin>>a>>b>>c;
    if((b*c)>=a)
    {
        cout<<"Yes"<<endl;
    }
    else 
    {
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3648
#include <cmath>
#include <cstdio>

#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <numeric>
#include <string>
#include <array>

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

using namespace std;
using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  ll n, w_max;
  cin >> n >>w_max;
  vector<ll> w(n), v(n);
  rep(i, n) cin >> w.at(i) >> v.at(i);
  ll w0 = w.at(0), sumw=0;

  vector<vector<ll>> vv(4);
  rep(i, n){
    w.at(i) -= w0;
    vv.at(w.at(i)).push_back(v.at(i));
  }
  rep(i, 4)
    sort(vv.at(i).rbegin(), vv.at(i).rend());
  ll ans=0;
  rep(i0, vv.at(0).size()+1) rep(i1, vv.at(1).size()+1) rep(i2, vv.at(2).size()+1) rep(i3, vv.at(3).size()+1){
    ll v_sum =0;
    if(w0*i0 + (w0+1)*i1 + (w0+2)*i2 + (w0+3)*i3 <= w_max){
      rep(i,i0) v_sum += vv.at(0).at(i);
      rep(i,i1) v_sum += vv.at(1).at(i);
      rep(i,i2) v_sum += vv.at(2).at(i);
      rep(i,i3) v_sum += vv.at(3).at(i);
      ans = max(v_sum, ans);
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
using System;
class Project2
{
    public static void Main(string[] args)
    {
        int a = int.Parse(Console.ReadLine());
        string s = Console.ReadLine();
        if(s.Length <= a)
        {
            Console.WriteLine(s);
        }
        else if(s.Length > a)
        {
            for (int i = 0; i < a; i++)
            {
                Console.Write(s[i]);
            }
            Console.WriteLine("...");
        }
    }
}

Measured memory_bytes: 17660
import java.io.*;
import java.util.*;


class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        String s=sc.next();
        int l=s.length();
        for(int i=0;i<(l+1)/2;++i){
            char c=s.charAt(i);
            char d=c=='b'?'d':c=='d'?'b':c=='p'?'q':'p';
            if(d!=s.charAt(l-1-i)){
                out.println("No");
                out.close();
                return;
            }
        }
        out.println("Yes");
        out.close();
    }
    // http://codeforces.com/blog/entry/7018
    //-----------PrintWriter for faster output---------------------------------
    public static PrintWriter out;
    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;
        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        String nextLine(){
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


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

#define FOR(i,a,b)    for (int i=(a)  ;i<(b) ;i++)
#define RFOR(i,a,b)   for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)      for (int i=0    ;i<(n) ;i++)
#define RREP(i,n)     for (int i=(n)-1;i>=0  ;i--)
#define EACH(i,a,b)   for (int i=(a)  ;i<=(b);i++)
#define REACH(i,a,b)  for (int i=(b)  ;i>=(a);i--)
#define ALL(a)        (a).begin(),  (a).end()
#define RALL(a)       (a).rbegin(), (a).rend()
#define YES()         printf("YES\n")
#define NO()          printf("NO\n")
#define Yes()         printf("Yes\n")
#define No()          printf("No\n")
#define in(a,x,b)     ((a) <= (x) && (x) < (b))

const int MOD = 1e9 + 7;
const int INF = 1 << 29;
const double EPS = 1e-10;

using ll = long long;
using P = pair<int,int>;
using V = vector<int>;
using Vll = vector<ll>;
using Vstr = vector<string>;

template<class T> bool inline chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool inline chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T = int> T inline input() { T x; cin >> x; return (x); }
template<class T> void inline print(T& x) { cout << x << '\n'; }
#define debug(x) cerr << #x << ": " << x << endl;

const int dxs[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
const int dys[] = { 0, -1, 0, 1, 1, -1, -1, 1 };
const int perm[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };

bool isOK(V v, int index, int key) {
  if (v[index] >= key) return true;
  else return false;
}

int binary_search(V v, int key) {
  int left = -1;
  int right = (int)v.size();

  while (right - left > 1) {
    int mid = left + (right - left) / 2;

    if (isOK(v, mid, key)) right = mid;
    else left = mid;
  }

  return right;
}

/*
int prime[1001001];
bool is_prime[1001001];

int sieve(int n) {
  int p = 0;
  for (int i = 0; i < n; i++) is_prime[i] = true;
  is_prime[0] = is_prime[1] = false;
  for (int i = 2; i < n; i++){
    if (is_prime[i]){
      prime[p++] = i;
      for (int j = 2*i; j < n; j+=i) is_prime[j] = false;
    }
  }
  return p;
}
*/

int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(16);

  ll N;
  int X,M;
  cin >> N >> X >> M;

  V nextA(M);
  REP(i,M) {
    nextA[i] = (ll)i * i % M;
  }

  V trace(M, 0);
  trace[X] = 1;
  ll ans = X;
  int prev = ans;
  int ai;
  Vll traceans(M+1, 0);
  traceans[1] = ans;

  EACH(i,2,N) {
    ai = nextA[prev];
    if (trace[ai] == 0) {
      trace[ai] = i;
    } else {
      int loop_start = trace[ai];
      int loop_end = i;
      int loop_length = loop_end - loop_start;
      ll loop_sum = (traceans[loop_end-1] - traceans[loop_start-1]);
      ll loop_count = (N - i + 1) / loop_length;
      ll loop_amari = N - (loop_end + loop_length * loop_count);
      ans += ai;
      ans += loop_count * loop_sum;
      ans += traceans[loop_start + loop_amari] - traceans[loop_start];
      debug(ans);
      break;
    }
    ans += ai;
    traceans[i] = ans;
    prev = ai;
  }

  print(ans);
}



Measured memory_bytes: 4780
N, M = map(int, input().split())
A = list(map(int, input().split()))
sumA = sum(A[i] for i in range(N))

s = sum(A[i] / sumA >= 1 / (4 * M) for i in range(N))

if s >= M:
  print('Yes')
else:
  print('No')

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

#include <ext/pb_ds/assoc_container.hpp> //required
#include <ext/pb_ds/tree_policy.hpp> //required

using namespace __gnu_pbds; 
using namespace std;

template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 
typedef long long  ll;
typedef vector<ll> VL;
typedef vector<int> VI;
typedef pair<ll,ll> PLL;
typedef pair<int,int> PII;
#define pb push_back

#define F first
#define S second
#define SZ(a) int((a).size())
#define ALL(a) a.begin(),a.end()
#define fr(i,x,y) for(int i=x;i<y;i++)
#define frr(i,x,y) for(int i=x-1;i>=y;i--)
#define inf 1e18+1
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int mod=1000000007;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll power(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;}a=a*a;b>>=1;}return ans;}
ll powerm(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;ans%=mod;}a=a*a;a%=mod;b>>=1;}return ans%mod;}
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

void solve()
{
    string str;
    cin>>str;
    ll ans=inf;
    fr(i,0,SZ(str))
    {
        string tmp=str;
        ll ct=0;
        while(1)
        {
            ll fg=0,no=1;
            //cout<<tmp<<endl;
            fr(j,0,SZ(tmp))
            {
                if(tmp[j]==str[i])
                    fg=1;
                else
                    no=0;
            }
            if(fg==0)
                break;
            if(no==1)
            {
                ans=min(ans,ct);
                break;
            }
            string pav="";
            fr(j,0,SZ(tmp)-1)
            {
                if(tmp[j]==str[i]||tmp[j+1]==str[i])
                {
                    pav.pb(str[i]);
                }
                else
                {
                    pav.pb(tmp[j]);
                }
            }
            tmp=pav;
            ct++;
        }
    }
    cout<<ans<<endl;
    return;
}
int main()
{
    IOS;
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}
/* stuff you should look for
        * int overflow, array bounds
        * special cases (n=1?)
        * do smth instead of nothing and stay organized
        * WRITE STUFF DOWN
*/
// BITMASK:
// 1)When some constrall is of the order of 15-20, think of bitmask DP.
// 2)When some constrall is around 40, try out meet in the middle
// 3) See Strings,palindromes,prefix,suffix etc -> KMP,Z algorithm

Measured memory_bytes: 3668
#include <iostream>
#include <vector>
#include <cmath>
#include <numeric>
#include <algorithm>
using namespace std;
int main()
{
    long long int a,b;
    vector<long long int> cd;
    cin >> a >> b;
    while(a % b != 0)
    {
        long long int r;
        r = a % b;
        a = b;
        b = r;    
    }
    for(int i = 1;i <= sqrt(b);i++)
    {
        if(b % i == 0)
        {
            cd.push_back(i);
            if(i != b /i)
            {
                cd.push_back(b / i);
            }
        }
    }
    sort(cd.begin(),cd.end());
    int count = 0;
    for(int i = 0;i < cd.size();i++)
    {
        for(int j = 0;j < i;j++)
        {
            if(cd.at(j) != 1 && cd.at(i) % cd.at(j) == 0)
            {
                count++;
                break;
            }
        }
    }
    cout << cd.size() - count;
 
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){

    int n;
    cin >> n;
    for (int i=1; i<=n; i++){
        int x = i;
        if (x % 3 == 0){
            cout << " " << i;
            continue;
        }
        
        while (x){
        if (x % 10 == 3){
            cout << " " << i;
            break;
        }
            x /=10;
        }
    }
    cout << endl;
}



Measured memory_bytes: 3088
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

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

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

ll N;

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

  std::string S;

  ll cnt = 0;

  while( N > 0 ){
    S += char('a'+((N-1)%26));
    N -= (N-1)%26+1;
    N /= 26;
    ++cnt;
  }

  repd( i, S.size() )
    std::cout << S[i];

  std::cout << std::endl;

  return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef long long ll;

int main()
{
	int N;
	scanf("%d", &N);
	long h[N];
	int i = 0;
	while (i < N)
	{
		scanf("%ld", &h[i]);
		// printf("%ld ", h[i]);
		i++;
	}
	i = 0;
	int pre = -1;
	int max = 0;
	int maxi = 0;
	int j;
	while (i < N)
	{
		if (pre <= h[i] - 1)
		{
			pre = h[i] - 1;
		}
		else if (pre <= h[i])
		{
			pre = h[i];
		}
		else
		{
			puts("No");
			return 0;
		}
		// j = i + 1;
		// while (j < N)
		// {
		// 	if (h[i] - h[j] >= 2)
		// 	{
		// 		printf("No\n");
		// 		return 0;
		// 	}
		// 	j++;
		// }
		i++;
	}
	printf("Yes\n");
	return (0);
}

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

int main()
{
	int n , k;
	cin >> n >> k;
	int *a = new int[n];
	for(int i=0;i<n;i++)
		cin >> a[i];
	int *b = new int[n];
	b[0]=0;
	for(int i=1;i<n;i++)
	{
		int ans= INT_MAX;
		for(int j=1;j<=k;j++)
		{
			if(i-j < 0)
			break;
			ans= min(ans, b[i-j] + abs(a[i]-a[i-j]));
		}
		b[i]=ans;
	}
	cout << b[n-1];
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <sstream>
#include <algorithm>
using namespace std;
#define pb push_back
#define mp make_pair
#define ms(a, b)  memset((a), (b), sizeof(a))
//#define LOCAL
typedef long long LL;
const int inf = 0x3f3f3f3f;
const int maxn = 15+10;
const int mod = 1e9+7;
LL a[maxn];
LL cnt (LL n) {
    LL num = 0;
    while(n>0) {
        num++;
        n &=(n-1);
    }
    return num;
}
int main() {
#ifdef LOCAL
    freopen("input.txt" , "r", stdin);
#endif // LOCAL
    LL n, k, i;
    scanf("%lld%lld", &n, &k);
    for(i=0;i<n;i++)   scanf("%lld", &a[i]);
    LL ans = 1000000000000LL;
    for(i=1;i<=(1<<n);i++){
        if(cnt(i)<k)    continue;
        LL now = 0;
        LL base = a[0];
        for(LL j=1;j<n;j++){
            LL x = a[j];
            if(i & (1<<j)){
                if( x <= base ){
                    now += base+1-x;
                    x = base +1;
                }
            }
            base = max(base, x);
        }
        if( now < ans )      ans = now;
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <utility>
#include <string.h>
#include <map>
#include <stack>
#include <iomanip>
#include <chrono>
#include <random>
#include <bitset>
#include <math.h>
#include <time.h>
#include <assert.h>
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long
#define pb push_back 
#define mp make_pair
#define ff first
#define ss second
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define all(x) x.begin(),x.end() 
#define PII pair <ll,pair<int, int>>
#define N 100005
#define MOD 1000000007
#define INF 1000000000000000000
using namespace std;

int main()
{
	string s;
	cin >> s;
	int cnt = 0;
	int n = (int) s.size();
	for (int i = 0; i < n; ++i)
	{
		if(s[i] == 'o')
			cnt++;
	}
	if(cnt + 15 - n >= 8)
		cout << "YES\n";
	else
		cout << "NO\n";
}

Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
const int N=10e5+5;
int arr[N];
int main()
{

int n;
cin>>n;
for(int i=0;i<n;i++)cin>>arr[i];
int mini=arr[0];
int counter=1;
for(int i=1;i<n;i++){
    if(arr[i]<=mini )counter++;


    mini=min(mini,arr[i]);

}
cout<<counter;


    return 0;
}


Measured memory_bytes: 1024
import sys
from collections import deque

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_s = lambda: readline().rstrip().decode('utf-8')
in_nl = lambda: list(map(int, readline().split()))
in_nl2 = lambda H: [in_nl() for _ in range(H)]
in_map = lambda: [s == ord('.') for s in readline() if s != ord('\n')]
in_map2 = lambda H: [in_map() for _ in range(H)]
in_all = lambda: map(int, read().split())


def bfs(N, v0, edge, C):

    search = [0] * N
    C = deque(C)
    search[v0] = C.popleft()
    q = deque()
    q.append(v0)

    while q:
        v = q.popleft()
        for nv in edge[v]:
            if search[nv] == 0:
                q.append(nv)
                search[nv] = C.popleft()

    return search


def main():

    N = in_n()
    ab = in_nl2(N - 1)
    edge = [[] for _ in range(N)]

    for i in range(N - 1):
        a, b = ab[i]
        a, b = a - 1, b - 1
        edge[a].append(b)
        edge[b].append(a)

    C = sorted(in_nl(), reverse=True)
    V = bfs(N, 0, edge, C)

    score = 0
    for i in range(N - 1):
        a, b = ab[i]
        a, b = a - 1, b - 1
        score += min(V[a], V[b])

    print(score)
    print(' '.join(map(str, V)))


if __name__ == '__main__':
    main()


Measured memory_bytes: 14180
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		sc.close();

		if (a == 0) {
			System.out.println(f(b));
		} else {
			System.out.println(f(b) ^ f(a - 1));
		}
	}

	static long f(long x) {
		long start = x / 4 * 4;
		long ret = 0;
		for (long i = start; i <= x; i++) {
			ret ^= i;
		}
		return ret;
	}
}


Measured memory_bytes: 21844
while(1):
    N = int(input())
    if N==0: break
    sums = []
    nums = []
    s = 0
    for i in range(N):
        n = int(input())
        nums.append(n)
        s += n
        if s<0: s=0
        sums.append(s)
    if max(nums) >= 0:
        print(max(sums))
    else:
        print(max(nums))



Measured memory_bytes: 5712
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author silviase
 */
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);
        CTypicalStairs solver = new CTypicalStairs();
        solver.solve(1, in, out);
        out.close();
    }

    static class CTypicalStairs {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            ModInt[] res = new ModInt[n + 1];
            HashSet<Integer> hs = new HashSet<>();
            for (int i = 0; i < m; i++) {
                hs.add(in.nextInt());
            }

            res[0] = new ModInt(1);
            for (int i = 1; i <= n; i++) {
                if (hs.contains(i)) {
                    // broken
                    res[i] = new ModInt(0);
                } else {
                    res[i] = new ModInt(0);
                    try {
                        res[i] = res[i].add(res[i - 1]);
                    } catch (ArrayIndexOutOfBoundsException ignored) {
                    }
                    try {
                        res[i] = res[i].add(res[i - 2]);
                    } catch (ArrayIndexOutOfBoundsException ignored) {
                    }
                }
            }

            out.println(res[n].getVal());

        }

    }

    static class ModInt {
        public long val;
        final int MOD = (int) 1e9 + 7;

        public ModInt(long i) {
            this.val = (i + MOD) % MOD;
        }

        public ModInt add(ModInt m) {
            return new ModInt(this.val + m.val);
        }

        public long getVal() {
            return val;
        }

        public String toString() {
            return Long.toString(val);
        }

    }
}



Measured memory_bytes: 64640
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long march[] = new long[5];
        
        for(int i = 0; i < N; i++) {
            String S = sc.next();
            char x = S.charAt(0);
            
            switch(x){
                case 'M':
                    march[0]++;
                    break;
                case 'A':
                    march[1]++;
                    break;
                case 'R':
                    march[2]++;
                    break;
                case 'C':
                    march[3]++;
                    break;
                case 'H':
                    march[4]++;
                    break;
            }
        }
        
        long sum = 0;
        for(int a = 0; a < 3; a++) {
            for(int b = a + 1; b < 4; b++) {
                for(int c = b + 1; c < 5; c++){
                    sum += march[a] * march[b] * march[c];
                }
            }
        }
        
        System.out.println(sum);
        
    }
}


Measured memory_bytes: 58008
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
typedef long long int lint;
using namespace std;

// a^n mod pを計算　O(log n)
long long int pow_mod(long long int a, long long int n, long long int p) {
    if (n == 0) return 1;
    long long int temp = pow_mod(a, n / 2, p);
    return n & 1 ? (((temp * temp) % p) * a) % p : (temp * temp) % p;
}

// Z_pでのaの逆元を計算 O(log p)
// depend:pow_mod
long long int inv_mod(long long int a, long long int p) {
    return pow_mod(a, p - 2, p);
}

// 階乗テーブルを作ってコンビネーションをキビキビ計算する
// depend:inv_mod
struct combination_mod {
    using lint = long long int;
    int sz;
    vector<lint> data;
    lint mod;
    combination_mod(int _sz, lint _mod) : sz(_sz), mod(_mod) {
        data.assign(sz + 1, 1);
        for (int i = 1; i <= sz; i++) data[i] = (data[i - 1] * i) % mod;
    }
    // nCrを計算 O(log mod)
    lint query(int n, int r) {
        lint res = 1;
        res = (res * data[n]) % mod;
        res = (res * inv_mod(data[r], mod)) % mod;
        res = (res * inv_mod(data[n - r], mod)) % mod;
        return res;
    }
};

int main() {
    lint mod = 998244353;
    lint n, a, b, k;
    cin >> n >> a >> b >> k;
    combination_mod cm(n, mod);
    lint ans = 0;
    // Aでi箇所塗る
    for (int i = 0; i <= n; i++) {
        // m:Bの数
        lint rem = k - a * i;
        lint m = rem / b;
        if (rem < 0 || rem % b != 0 || m > n) continue;
        lint temp = cm.query(n, i) * cm.query(n, m);
        temp %= mod;
        ans += temp;
        ans %= mod;
    }
    cout << ans << endl;
}

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

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<long long> a(N);
    for(int i = 0; i < N; i++){
        cin >> a[i];
    }

    long long ans = __LONG_LONG_MAX__;
    long long v;
    for(long long X = -100; X <= 100; X++){
        v = 0;
        for(int i = 0;i < N; i++){
            v += (a[i]-X) * (a[i] - X);
        }
        ans = min(ans, v);
    }


    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 256
N = int(input())
L = list(map(int, input().split()))
L = sorted(L)
lengthnum = [0 for _ in range(max(L) + 1)]
m = len(lengthnum)

for l in L:
	lengthnum[l] += 1

for i in range(m - 1):
	lengthnum[i + 1] += lengthnum[i]
	
ret = 0
# print(L)
for s in range(N - 1):
	for b in range(s + 1, N):
		# print(L[s], L[b], lengthnum[min(L[-1], L[b] + L[s] - 1)] - lengthnum[L[b] - L[s]] - 1)
		ret += lengthnum[min(L[-1], L[b] + L[s] - 1)] - lengthnum[L[b] - L[s]] - 1
		if L[b] - L[s] < L[s]:
			ret -= 1
print(int(ret / 3))

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

int main(){
	vector<int> ttr;
	int n = 1;
	while(1){
		int tr = n*(n+1)*(n+2) / 6;
		if(tr > 1000000) break;
		ttr.push_back(tr);
		n++;
	}

	vector<int> dp(1000010,1000000);
	vector<int> dp_odd(1000010,1000000);
	dp[0] = dp_odd[0] = 0;

	for( int i = 0; i < ttr.size(); i++ ){
		for( int j = 0; j < 1000000-ttr[i]+1; j++ ){
			dp[j+ttr[i]] = min(dp[j+ttr[i]], dp[j]+1);
			if(ttr[i] % 2) dp_odd[j+ttr[i]] = min(dp_odd[j+ttr[i]], dp_odd[j]+1);
		}
	}

	while(cin >> n, n){
		cout << dp[n] << ' ' << dp_odd[n] << endl;
	}
}

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

#define faster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define fill(a,v)  memset(a, v, sizeof (a))
#define mp make_pair
#define pb push_back
#define ff first
#define ss second

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

const int N=501000;
const int MOD = 1e9 + 7;
const int INF = INT_MAX;
const ll LINF = LLONG_MAX;
ll powmod(ll a,ll b) {ll res=1;a%=MOD; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%MOD;a=a*a%MOD;}return res;}

int main()
{
	faster;

	int n;

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

	dp[1] = abs(h[1]-h[0]);
	for(int i = 2; i < n; ++i){
		dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
	}
	cout << dp[n-1];

	return 0;
}

// READ
// THINK
// CODE
// DEBUG
// AC


Measured memory_bytes: 1024
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;

#define all(a) (a).begin(), (a).end()

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

vector<bool> visited(100010, false);
deque<int> ans;
bool valid = false;

void dfs(int cv, vector<vector<int>> &G){
    ans.emplace_back(cv);
    visited[cv] = true;
    for(auto nv : G[cv]){
        if(visited[nv]) continue;
        if(valid) continue;

        dfs(nv, G);
    }

    valid = true;
    return ;
}

void rdfs(int cv, vector<vector<int>> &G){
    ans.emplace_front(cv);
    visited[cv] = true;
    for(auto nv : G[cv]){
        if(visited[nv]) continue;
        if(valid) continue;

        rdfs(nv, G);
    }

    valid = true;
    return ;
}

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

    int n, m; cin>>n>>m;
    vector<vector<int>> G(n);
    for(int i=0; i<m; i++){
        int a, b; cin>>a>>b;
        a--, b--;
        G[a].emplace_back(b);
        G[b].emplace_back(a);
    }

    dfs(0, G);
    ans.pop_front();
    valid = false;
    rdfs(0, G);

    cout << ans.size() << endl;
    for(auto i : ans){
        if(i == ans.back()) cout << i + 1 << endl;
        else cout << i + 1 << " ";
    }

    return 0;
}

Measured memory_bytes: 12416
#include<bits/stdc++.h>
using namespace std;
//#define int long long
typedef pair<int,int> P;
typedef long long ll;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define FOR(i,n) for(int i=0;i<n;i++)
/*
char c[10]={'a','b','c','d','e','f','g','h','i','j'};
void dfs(string s,int n){
    if(s.size() < n){
        rep(i,0,s.size()+1){
            dfs(s+c[i],n);
        }
    }
    else if(s[0]!='a'){return;}
    else if(s.size()==n){
        bool f=true;
        int M1=0,M2=0;
        int b=0;
        rep(i,0,n){
        if((int)(s[i]-c[i])>0){f=false;}
        if(s[i]-'a'>M1){M2=M1;M1=s[i]-'a';}
        if(i<n-1&&(s[i+1]-s[i])>=2){f=false;}
        }
        if(f&&(M1-M2<=1)){cout<<s<<endl;}
    }
}*/

int n;
void dfs2(string s,char mx){
    if(s.size()==n){
        cout<<s<<endl;
    }
    else{
        for(char c='a';c<=mx;c++){
            dfs2(s+c,((c==mx)?(char)(mx+1):mx));
        }
    }
}

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin>>n;
    dfs2("",'a');
}

Measured memory_bytes: 1536
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right

# https://atcoder.jp/contests/https://atcoder.jp/contests/abc060/tasks/abc060_b

A, B, C = read_ints()

# x %B==Cとしたい。そのときxはAの倍数か？
# y*B+CはAの倍数となるときがあるか？と言い換えられる
# もしくは x-C=0(modB)となるようなAの倍数xは存在するか？となる

# わからんとりあえず1000倍ぐらいしておけばどうにかなるっしょ
for i in range(1000):
    if (i * B + C) % A == 0:
        print('YES')
        exit()
print('NO')


Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;cin>>n>>m;
  vector<int> a(m);
  for(int i=0;i<m;i++)cin>>a[i];
  int co[10]={0,2,5,5,4,5,6,3,7,6};
  sort(a.begin(),a.end(),greater<int>());
  int dp[n+1];
  fill(dp,dp+n+1,-100);
  dp[0]=0;
  int keta=0;
  for(int i=1;i<=n;i++){
    int mi=-10000;
    for(int j=0;j<m;j++){
      if(i-co[a[j]]<0)continue;
      if(dp[i-co[a[j]]]<0)continue;
      mi=max(mi,dp[i-co[a[j]]]+1);
    }
    if(mi<0)continue;
    dp[i]=mi;
  }
  //for(int i=0;i<=n;i++)cout<<dp[i]<<" ";
  //return 0;
  vector<int> ans;
  int now=n;
  for(;;){
    for(int i=0;i<m;i++){
      int u=co[a[i]];
      if(now-u<0)continue;
      if(dp[now]==dp[now-u]+1){
        ans.push_back(a[i]);
        now-=u;
        break;
      }
    }
    if(now==0)break;
    //cout<<now<<" ";
  }
  for(int i=0;i<ans.size();i++){
    cout<<ans[i];
  }
  cout<<endl;
}



Measured memory_bytes: 384
N = int(input())
H = list(map(int, input().split()))
result = 0
count = 0
for i in range(N - 1):
    if H[i] >= H[i + 1]:
        count += 1
    else:
        if count > result:
            result = count
        count = 0
if count > result:
    result = count
print(result)


Measured memory_bytes: 14252
#include<stdio.h>
int main()
{
  long long int a,b,c,des;
  scanf("%lld %lld",&a,&b);
  if(b>a)
    des=b-a;
  else
    des=a-b;
  if(des%2==1)
    printf("IMPOSSIBLE\n");
  else
  {
    if(b>a)
    	c=a+des/2;
    else
      	c=b+des/2;
    printf("%d\n",c);
  }
  return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;


public class Main {


	public static void main(String[] args) {

//		long ans = 0;
//		double ans = 0.0;
		int ans = 0;
//		String ans = "";

		Scanner sc = new Scanner(System.in);
//		double waru = 1000000007;


//		long n = sc.nextLong();
//		long m = sc.nextLong();
//		long k = sc.nextLong();

		int n = sc.nextInt();
		int m = sc.nextInt();
		int k = sc.nextInt();
//		int v = sc.nextInt();
//		String s = sc.next();


//		String string = sc.next();
//		StringBuilder s = new StringBuilder(string);

		boolean f = false;

//		String[] s = new String[n];

//		int[] a = new int[n];
//		long[] a = new long[n];
//
//		int[][] a = new int[n][m];



//		for (int i = 0; i < h; i++) {
//			for(int j = 0; j < w; j++) {
//				a[i][j] = sc.nextInt();
//			}
//		}

//		for (int i = 0; i < n; i++) {
//			s[i] = sc.next();
//			a[i] = sc.nextLong();
//		}


		int tmp = k;
		int tatecount = 0;
		int yokocount = 0;

		while(!f) {
			ans++;
			if(n - yokocount > m - tatecount) {
				tmp = tmp - (n - yokocount);
				tatecount++;
			} else {
				tmp = tmp - (m - tatecount);
				yokocount++;
			}

			if(tmp <= 0) {
				f = true;
				break;

			}
		}





		System.out.println(ans);

		sc.close();
	}


}

Measured memory_bytes: 23124
#include<iostream>
#include<iomanip>
#include<algorithm>

using namespace std;

int main(){
    int N,D,X;

    cin >> N >> D >> X;

    int A;

    for(int i=0;i<N;++i){
        cin >> A;
        X += (D-1)/A+1;
    }

    cout << X;


}

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

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}

signed main() {
	int n;
	cin >> n;
	int a[100005];
	rep(i, n) {
		cin >> a[i];
	}
	sort(a, a + n);
	int ans, mi = -1;
	for (int i = 0; i < n - 1; i++) {
		if (mi < min(a[i], a[n - 1] - a[i])) {
			mi = min(a[i], a[n - 1] - a[i]);
			ans = a[i];
		}
	}
	cout << a[n - 1] << " " << ans << endl;

	return 0;
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)	

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

	int n;
	cin >> n;

	map<string, int> ms;

	string s;
	rep(i, n) {
		cin >> s;
		auto itr = ms.find(s);
		if (itr == ms.end()) {
			ms.insert(make_pair(s, 1));
		}
	}

	cout << ms.size() << endl;

	return 0;
}

Measured memory_bytes: 19276
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>
#include <queue>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define P_B push_back
#define PO_B pop_back
#define E_B emplace_back
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << endl

using namespace std;
using ll = long long;
using Pii = pair<int,int>;
using Pll = pair<ll,ll>;
using VI = vector<int>;
using VL = vector<ll>;
using VVI = vector<vector<int> >;
using VVL = vector<vector<ll> >;
//int dx[4] = {1, 0, -1, 0};
//int dy[4] = {0, 1, 0, -1};
//const ll LINF = (ll)1e18 - 1;
//const int INF = 1e9 - 1;

// index が条件を満たすかどうか
bool isOK(vector<Pii> &A, int index, int key) {
    if (A[index].fi >= key) return true;
    else return false;
}

// 汎用的な二分探索のテンプレ
int L_B(vector<Pii> &A, int key) {
    int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
    int right = (int)A.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()

    /* どんな二分探索でもここの書き方を変えずにできる！ */
    while (right - left > 1) {
        int mid = left + (right - left) / 2;

        cout << left << " ~ " << right << " : " << mid << " ||| " << isOK(A, mid, key) << endl;

        if(isOK(A, mid, key)) right = mid;
        else left = mid;
    }

    /* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
    return right;
}



void Main(){
  ll N, M, ans=0;
  cin >> N >> M;
  vector<Pii> A(M);
  rep(i, M){
    //seにA[i],fiにB[i]を格納
    cin >> A[i].se >> A[i].fi;
  }

  sort(all(A));

  ll now = A[0].fi, count = 1;
  bool done = true;
  rep(i, M){
    if(A[i+1].fi == A[i].fi && done) continue;
    if(A[i+1].fi > A[i].fi) done = false;
    if(now <= A[i+1].se){
      count++;
      now = A[i+1].fi;
      done = true;
    }
  }

  cout << count << endl;



}

int main()
{
	cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();

  return 0;
}


Measured memory_bytes: 1024
# -*- coding: utf-8 -*-
import math

S = input()
result = [0 for i in range(len(S))]

next_s = 'L'
old_idx = 0
for i in range(len(S)):
    if S[i] == next_s:
        d = i - old_idx
        if next_s == 'L':
            if d % 2 == 0:
                result[i-1] += int(d/2)
                result[i] += int(d/2)
            else:
                result[i-1] += int(d/2) + 1
                result[i] += int(d/2)
            next_s = 'R'
        else:
            if d % 2 == 0:
                result[old_idx-1] += int(d/2)
                result[old_idx] += int(d/2)
            else:
                result[old_idx-1] += int(d/2)
                result[old_idx] += int(d/2) + 1
            next_s = 'L'

        old_idx = i

d = len(S) - old_idx
if d % 2 == 0:
    result[old_idx-1] += int(d/2)
    result[old_idx] += int(d/2)
else:
    result[old_idx-1] += int(d/2)
    result[old_idx] += int(d/2) + 1

for i in result:
    print('{} '.format(i), end='')


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

using namespace std;

int main()
{
	int n,ans=0;
	cin>>n;
	for(int i=1;i<=n;i++)
		if((i>=1 && i<10) || (i>=100 && i<1000) || (i>=10000 && i<100000))
			ans++;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define eps LDBL_EPSILON
#define moder 1000000007
#define int long long
#define ll long long
#define INF ((ll)1<<31)-1
#define P std::pair<int,int>
#define prique priority_queue<int,vector<int>,greater<int>>
using namespace std;
int gcd(int a,int b){
	if(!a)return b;
	return gcd(b%a,a);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
signed main(){
	int n,a;
	int ans=0;
	cin>>n;
	rep(i,n){
		cin>>a;
		if(a%2==0)ans++;
	}
	cout<<ans<<endl;
    return 0;
}




Measured memory_bytes: 3092