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

using namespace std;

typedef long long int lli;

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

    int n;
    vector<int> a(200000), x(200001, 0);
    vector<lli> s(200001, 0);

    cin >> n;
    for (int i=0; i<n; i++) {
        cin >> a[i];
        s[i+1] = s[i] + a[i];
        x[i+1] = x[i] ^ a[i];
    }

    lli ans = 0;
    for (int i=0; i<n; i++) {
        int ok = i, ng = n;
        while (abs(ok-ng) > 1) {
            int mid = (ok+ng) / 2;
            lli ss = s[mid+1] - s[i], xx = x[mid+1] ^ x[i];

            if (ss == xx)   ok = mid;
            else            ng = mid;
        }
        ans += ok - i + 1;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3456
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<iterator>
#include<complex>
#include<stack>
#include "stdio.h"
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const long long mod_const = 1e9+7;
using MIte = multimap<long, long, greater<long> >::iterator;

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

	int n, m, k[11], s[11][11], p[11];

	cin >> n >> m;
	rep(i, m)
	{
		cin >> k[i];
		rep(j, k[i])
			cin >> s[i][j];
	}
	rep(i, m)
		cin >> p[i];

	int res = 0;

	for (int i = 0; i < (1 << n); i++)
	{
		int sn[11];
		memset(sn, 0, sizeof(sn));
		rep(j, n)
		{
			int tmp = 1 << j;
			bool btmp = i & tmp;
			if (!btmp)
				continue;
			rep(l, m)
			{
				bool has = false;
				rep(o, k[l])
				{
					if (s[l][o] == j + 1)
						has = true;
				}

				sn[l] += has;
			}
		}

		bool ok = true;
		rep(j, m)
		{
			if (sn[j] % 2 != p[j] % 2)
				ok = false;
		}

		res += ok;
	}

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <cmath>
#include <string>
#include <queue>
#include <list>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <iomanip> // std::std::setprecision(X)
#include <limits>  //std::numeric_limits<int>::max(), min()

long long cnt ( std::string s ) {
  long long rtn = 0, acnt = 0;
  for(int i=0; i<s.size(); i++) {
    if ( s[i] == 'A' ) acnt++;
    else if ( s[i] == 'D' ) rtn += acnt;
  }
  return rtn;
}

int main (void) {

  std::string S; std::cin >> S;

  bool flag = true;
  std::vector<std::string> K;
  std::string tmp = "";
  for(int i=0; i<S.size(); i++) {
    if ( flag && (i<(S.size()-1) && S.substr(i,2) == "BC") ) {
      tmp += "D";
      i++;
    }
    else if ( flag && S[i] == 'A' ) tmp += "A";
    else {
      if (flag) {
        K.push_back(tmp);
        flag = false;
        tmp = "";
      }
      if (   (i<(S.size()-1) && S[i+1] == 'A')
          || (i<(S.size()-2) && S.substr(i+1,2) == "BC")  ) {
        flag = true;
      }
    }
  }
  if ( flag && tmp != "" ) K.push_back(tmp);

  long long ans = 0;
  for(int i=0; i<K.size(); i++) {
    ans += cnt ( K[i] );
  }

  std::cout << ans << std::endl;

  return 0;
}

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

int main(){
	int n, m, k; cin>>n>>m>>k;
	int A[n], B[m];
	rep(i, n) cin>>A[i];
	rep(i, m) cin>>B[i];
	int64_t sumb = 0; rep(i, m) sumb += B[i];
	int ans = 0, j = m;
	rep(i, n+1){
		while(j>0 && sumb > k) sumb -= B[--j];
		if(sumb > k) break;
		ans = max(ans, i+j);
		if(i == n) break;
		sumb += A[i];
	}
	cout<< ans <<endl;
}


Measured memory_bytes: 5140
#include<bits/stdc++.h>
#define ll long long
#define MOD 1000000007
#define MAX 1000000007
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define zoom ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;

int main() {


    zoom;
    ll i;
    string S;
    cin>>S;
    vector<ll> A(3, 0);
    for(i = 0; i < S.size(); i += 1)
        A[S[i] - 'a'] += 1;
    sort(A.begin(), A.end());
    if(A[0] == A[1] && A[1] == A[2])
        cout<<"YES";
    else if(A[0] == A[1] && A[1] + 1 == A[2])
        cout<<"YES";
    else if(A[0] + 1 == A[1] && A[1] == A[2])
        cout<<"YES";
    else
        cout<<"NO";
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef long double ld;
const ll mod = 1e9 + 7;

ll solve(void)
{
	ll n, m;
	cin >> n >> m;

	vector<vll> e(n, vll());

	for (ll i = 0; i < m; i++)
	{
		ll x, y, z;
		cin >> x >> y >> z;
		x--; y--;
		e[x].push_back(y);
		e[y].push_back(x);
	}

	ll ans = 0;
	vector<bool> visited(n, false);
	for (ll i = 0; i < n; i++)
	{
		if (visited[i]) { continue; }
		ans ++;
		visited[i] = true;

		queue<ll> q;
		q.push(i);

		while (!q.empty())
		{
			ll f = q.front();
			q.pop();
			visited[f] = true;
			for (auto i : e[f])
			{
				if (visited[i]) { continue; }
				q.push(i);
			}
		}
	}
	
	cout << ans << endl;


	return 0;
}

int main(void)
{
	while(solve()){}

	return 0;
}

Measured memory_bytes: 10424
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vl vector<LL>
#define vii vector<vi>
#define vll vector<vl>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;

int main(){
	int h,w;
    cin>>h>>w;
    vii b(h+1,vi(w+1,1));
    vii dp(h+1,vi(w+1,mod));
    FOR(i,0,h){
        string s;
        cin>>s;
        FOR(j,0,w){
            if(s[j]=='.'){
                b[i][j]=0;
            }
        }
    }
    dp[0][0]=0;
    LL ans=b[0][0]|b[h-1][w-1];
    cerr<<ans<<endl;
    FOR(i,0,h){
        FOR(j,0,w){
            if(b[i][j]!=b[i+1][j]){
                dp[i+1][j]=min(dp[i+1][j],dp[i][j]+1);
            }else{
                dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
            }
            if(b[i][j]!=b[i][j+1]){
                dp[i][j+1]=min(dp[i][j+1],dp[i][j]+1);
            }else{
                dp[i][j+1]=min(dp[i][j+1],dp[i][j]);
            }
        }
    }
    cout<<ans+dp[h-1][w-1]/2<<endl;



}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include<vector>
using namespace std;
#define rep(i, n)        for(int i=0; i<(int)(n); ++i)
int main() {
  int a,b,c=0,d=0;
  cin>>a;
  rep(i,a){
    cin>>b;
    c+=b;
    d=max(d,b);
  }
  c-=d;
  if(c>d)cout<<"Yes";
  else cout<<"No";
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <limits>
#include <numeric>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <stack>

using namespace std;

#define INFint (1<<30)
#define BOUND 27182818284
#define MAT 2

typedef long long ll;
typedef long long int lli;
typedef pair<ll, ll> P;

ll MOD = 1000000007;
const ll INF = (1ll<<60);
#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)

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

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

// gcd
template<typename T>
T gcd(T a, T b) {
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

int findGCD(vector<int> arr) {
    int result = arr[0];
    for (auto a: arr) {
        result = gcd(a, result);
    }
    return result;
}

template<typename T>
T lcm(T m, T n) {
    // 引数に0がある場合は0を返す
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    fill((T *) array, (T *) (array + N), val);
}


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

// v.front() = -BOUND;
// v.back() = BOUND;

//struct edge{
//    int cost, to;
//
//    edge(int in_cost, int in_to){
//        cost=in_cost;
//        to=in_to;
//    }
//    bool operator<(const edge &a) const
//    {
//        return cost > a.cost;
//    }
//};
map<int, int> mp;
int p_fact(int a){
    for(int i=2; i*i<=a; i++){
        int temp=0;
        while(a%i==0){
            temp++;
            a/=i;
        }
        mp[i] = max(mp[i], temp);
    }
    if(a>1){
        mp[a] = max(mp[a], 1);
    }
    return 0;
}

int main() {
    int n; cin >> n;
    vector<int> a(n);

    rep(i,n){
        cin >> a[i];
        p_fact(a[i]);
    }
    int ans=1;
    for(auto m: mp){
        while(m.second>0){
            ans*=m.first;
            m.second--;
        }
    }

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


Measured memory_bytes: 3104
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true) {
			int m =sc.nextInt();
			int f =sc.nextInt();
			int r =sc.nextInt();
			if(m == -1 && f == -1 && r == -1) { break; }
			else if(m == -1 || f == -1) { ret("F"); }
			else if(m + f >= 80) { ret("A"); }
			else if(m + f >= 65) { ret("B"); }
			else if(m + f >= 50 ) { ret("C"); }
			else if(m + f >= 30) { 
				if(r >= 50) { ret("C"); }
				else { ret("D"); }
			} else { ret("F"); }
		}
		sc.close();
	}
	
	static void ret(String s) {
		System.out.println(s);
	}
}



Measured memory_bytes: 26388
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <math.h>
#include <stdlib.h>
#include <map>
#include <deque>
#include <list>
#include <sys/timeb.h>
#include <fstream>
#include <set>
#include <cmath>
#include <iomanip>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;


bool pairCompare(const Pi& firstElof, const Pi& secondElof)
{
	return firstElof.second > secondElof.second;
}

ll gcd(ll a, ll b) {
	ll temp;
	while (a % b != 0)
	{
		temp = b;
		b = a % b;
		a = temp;
	}
	return b;
}

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

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

	int a, b;
	cin >> a >> b;

	if (a >= 13) {
		cout << b << endl;
	}
	else if (a <= 12 && a >= 6) {
		cout << b / 2 << endl;
	}
	else {
		cout << 0 << endl;
	}




	return 0;
}



Measured memory_bytes: 256
#include <cstdio>

int main(int argc, char const *argv[]){
//	freopen("in.txt", "r", stdin);

	int n;
	while(scanf("%d", &n) != EOF){
		if(n > 36){
			printf("0\n");
			continue;
		}
		int count = 0;
		for(int a = 0; a < 10; a ++)
			for(int b = 0; b < 10; b ++)
				for(int c = 0; c < 10; c ++)
					for(int d = 0; d < 10; d ++)
						if(a + b + c + d == n)
							count ++;
		printf("%d\n", count);
	}

	return 0;
}

Measured memory_bytes: 1036
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<string>
#include<bitset>
#include<cfloat>
#include<iomanip>
#include<numeric>

using namespace std;
using ll =  long long;
using pint =  pair<int,int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vpint = vector<pint>;
#define repi(i,start,end) for(int (i)=(start),TemPNuM=(int)(end);(i)<TemPNuM;++(i))
#define rep(i,end) repi((i),0,(end))
#define rfor(x,v) for(auto& (x) : (v))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fsort(v,lambda) sort(all((v)),(lambda))
#define vin(v) rep(i,(v).size())cin >> (v)[i];
#define vpin(v) rep(i,(v).size())cin>>v[i].first>>v[i].second
//#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T>void println(T a){if(cout.precision()!=12)cout<<setprecision(12);cout<<a<<endl;}
//lambda: [](int x, int y){return x<y;}

signed main(void) {
    int h, w; cin >> h >> w;
    vector<string> c(h); vin(c);
    rfor(s, c) {
        cout << s << endl;
        cout << s << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int a,b,ans;
int main()
{
    scanf("%d%d",&a,&b);
    for(int i=a;i<=b;i++)
    {
        int P1=i/10000,L1=i%10;
        if(P1!=L1)continue;
        int P2=i/1000-P1*10,L2=(i%100-L1)/10;
        if(P2!=L2)continue;
        ans++;
    }
    printf("%d",ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <set>
#include <list>
#include <stdio.h>
#include <tuple>

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)

using namespace std;

int i,j,k,l,m,n;
/////////////////////////////////////////////////////
#define MOD 998244353
#define Nmax 2020 
#define tpl tuple<int,int,int>
#define mktp make_tuple

int N,K;
//int bit[20],ex=0;
//vector<tpl> a;
ll C[Nmax][Nmax];
ll sum[Nmax][Nmax];
ll sum2[Nmax];

int main(){
    scanf("%d",&K);
    scanf("%d",&N);
    
    for(k=1;k<=K;k++){
        sum[0][k]=1;
    }
    
    
    for(n=1;n<=N;n++){
        ll s=0;
        for(k=1;k<=K;k++){
            s+=sum[n-1][k];
            s%=MOD;
            sum[n][k]=s;
            //printf("{%d,%d,%lld}",k,n,s);
        }
    }

    for(n=0;n<=K/2+1;n++){
        C[n][0]=1;
    }
    for(m=1;m<=K/2+1;m++){
        for(n=m;n<=K/2+1;n++){
            for(int n2=n;n2>0&&n2>=m;n2--){
                C[n][m]+=C[n2-1][m-1];
                C[n][m]%=MOD;
            }
            
            //printf("%d-%d-%lld,",n,m,C[n][m]);
        }
    }

    for(i=1;i<=(K+1)/2;i++){
        sum2[i]=0;
        for(j=(i*2<N?i:N/2);j>0;j--){
            sum2[i]+=(j%2?1:-1)*sum[N-(j*2)][K]*C[i][j];
            sum2[i]=(sum2[i]+MOD)%MOD;
        }
        //printf("%d-%lld,",i,sum2[i]);
         //printf("\n");
    }
    for(i=2;i<=K*2;i++){
        printf("%lld\n",(sum[N][K]-sum2[(i<K+1?i/2:(K*2+2-i)/2)]+MOD)%MOD);
    }


    return 0;
}

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

constexpr int MAX_N = 2e5;

vector<int> G[MAX_N + 1];

int counter[MAX_N + 1];

void dfs(int prev, int cur)
{
    for (auto &next : G[cur]) {
        if (next == prev) continue;
        counter[next] += counter[cur];
        dfs(cur, next);
    }
}

int main()
{
    int N, Q;
    cin >> N >> Q;
    for (int i{1}; i < N; ++i) {
        int a, b;
        cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    for (int i{}; i < Q; ++i) {
        int p, x;
        cin >> p >> x;
        counter[p] += x;
    }
    dfs(0, 1);

    cout << counter[1];
    for (int i{2}; i <= N; ++i) {
        cout << ' ' << counter[i];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 23424
#include <iostream>
#include <stdio.h>

using namespace std;

int main()
{
	int n;
	int ary[100][100];

while(1)
	{
		cin >> n;

		int sumx = 0;
		int sumy = 0;
		int sumxy = 0;

		if(n == 0)
		{
			break;
		}

		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++)
			{
				cin >> ary[i][j];
			}
		}

			for(int i = 0; i < n; i++){
				sumx = 0;
				for(int j = 0; j < n; j++)
				{
					sumx += ary[i][j];
					sumxy += ary[i][j];

					printf("%5d",ary[i][j] );
					//ary[i][j] << " ";//????????´???
				}
				printf("%5d", sumx);
				cout << endl;
			}

			for(int i = 0; i < n; i++){
				sumy = 0;
				for(int j = 0; j < n; j++)
			{
					sumy += ary[j][i];
				}
				printf("%5d", sumy);
			}
			printf("%5d\n", sumxy);
	}
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define Repr(i, n, a) for (int i = (n); i >= (a); i--)
#define rep(i, n) Rep(i, 0, n)
#define repr(i, n) Repr(i, n, 0)
#define all(a) a.begin(), a.end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    int n, k;
    cin >> n >> k;
    double ans = 0;
    int a[31] = {};
    a[0] = 1;
    rep(i, 30) a[i + 1] = a[i] * 2;
    for (int i = 1; i <= n; i++)
    {
        if (i >= k)
        {
            ans += 1.0 / n;
            continue;
        }
        int l = 0, r = 30;
        while (r - l > 1)
        {
            int mid = (r + l) / 2;
            if (i * a[mid] >= k)
                r = mid;
            else
                l = mid;
        }
        ans += 1.0 / (a[r] * n);
        //cout << ans << endl;
        //cout << l << " " << a[r] * i << endl;
    }
    printf("%.10lf\n", ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using ll = long long;
using namespace std;

int main() {
  string s;
  cin >> s;
  int start = 0;
  for(int i = 0; i < s.length(); i++) {
    if (s[i] == 'A') {
      start = i;
      break;
    }
  }
  int end = s.length()-1;
  for (int i = 0; i < s.length(); i++) {
    if (s[s.length()-i-1] == 'Z'){
      end = s.length() - i -1;
      break;
    }
  }
  cout << end - start + 1 << endl;
}


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


 
int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);
  
  int n,h;
  int mx=0;
  int count=0;
  std::scanf("%d %d",&n,&h);
  //cin >> n >> h;
  for(int i=1;i<n;i++){
    int hh=0;
    std::scanf("%d",&hh);
    //cin >> hh;
  	if(hh<=h){
    	count++;
    }else{
    	mx=max(count,mx);
    	//if(count>mx){mx=count;}
    	count=0;
    }
    h=hh;
  }
  mx=max(count,mx);
  //if(count>mx){mx=count;}
  std::printf("%d",mx);
  //cout << mx;
  
  

}


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

// Loops
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define _rrep(i, n) rrepi(i, n, 0)
#define rrepi(i, a, b) for (int i = int(a) - 1; i >= int(b); --i)

#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(xi, x) for (auto &&xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)

// typedef
template <class T> using vec = vector<T>;
using ll = long long;
using vi = vec<ll>;
using vvi = vec<vi>;
using vvvi = vec<vvi>;
using pii = pair<ll, ll>;

// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define mp make_pair

// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase(unique(all(v)), v.end())
#define perm(c)                                                                \
  sort(all(c));                                                                \
  for (bool c##p = 1; c##p; c##p = next_permutation(all(c)))

template <class T> pair<T, size_t> max(vector<T> &x) {
  auto it = max_element(all(x));
  return mp(*it, it - x.begin());
}
template <class T> pair<T, size_t> min(vector<T> &x) {
  auto it = min_element(all(x));
  return mp(*it, it - x.begin());
}

template <class T> inline bool chmax(T &maxval, const T &newval) {
  if (maxval < newval) {
    maxval = newval;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &minval, const T &newval) {
  if (minval > newval) {
    minval = newval;
    return 1;
  }
  return 0;
}

// Utilities
// Grid world utilities
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
#define inside(H, W, y, x) 0 <= (x) && (x) < (W) && 0 <= (y) && (y) < (H)

// Debug
#ifdef LOCAL
#include "dump.hpp"
#define debug(x) cerr << #x << ": " << x << '\n'
#else
#define dump(...)
#define debug(x)
#endif

// Paste snippets here!!

//

void solve(long long K, long long X) {
  if(500*K>=X) cout << "Yes" << endl;
  else cout << "No" << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false); // Magic for faster cin
  long long K;
  std::cin >> K;
  long long X;
  std::cin >> X;
  solve(K, X);
  return 0;
}


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

using namespace std;

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

    long long res = 0;
    for (long long i = k - 1; i <= n; i++) {
        res += n * (n + 1) / 2 - (n - i - 1) * (n - i) / 2 - i * (i + 1) / 2 + 1;
        res %= 1000000007;
    }

    cout << res << endl;
}


Measured memory_bytes: 3632
def judge(x):
  res = x
  for i in a:
    res = i-res
  else:
    return x-res

def nibutan(n):
  right = n
  left = -1
  while right-left != 1:
    middle = (right+left)//2
    if judge(middle) > 0:
      right = middle
    elif judge(middle) == 0:
      return middle
    else:
      left = middle
  return right

N = int(input())
a = list(map(int,input().split()))
ans = []

tmp = nibutan(a[0])
ans.append(tmp*2)
for i in a:
  tmp = i-tmp
  ans.append(tmp*2)

print(" ".join(map(str,ans[:-1])))

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

int main() {
  string c;
  cin >> c;
  
  if (c == "a" || c == "e" || c == "i" || c == "o" || c == "u" ) {
    cout << "vowel" << endl;
  }
  else {
   cout << "consonant" << endl; 
  }
  
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
int maxn=-1,maxnum,a[100005],cnt[100005],max2n=-1,max2num,cnt2[100005],minn=-1,minnum,min2n=-1,min2num;
int main()
{
	int s;
	cin>>s;
	for(register int i=1;i<=s;++i)
	{
		cin>>a[i];
		if(i%2)
		{
			++cnt[a[i]];
			if(cnt[a[i]]>maxn)
			{
				maxnum=a[i];
				maxn=cnt[a[i]];
			}
		}
		else
			++cnt2[a[i]];
	}
	for(register int i=1;i<=s;i+=2)
		if(a[i]!=maxnum)
			if(max2n<cnt[a[i]])
			{
				max2n=cnt[a[i]];
				max2num=a[i];
			}
	for(register int i=2;i<=s;i+=2)
	{
		if(cnt2[a[i]]>minn)
			{
				minnum=a[i];
				minn=cnt2[a[i]];
			}
	}
	for(register int i=2;i<=s;i+=2)
		if(a[i]!=minnum)
			if(min2n<cnt2[a[i]])
			{
				min2n=cnt2[a[i]];
				min2num=a[i];
			}
	if(maxnum==minnum&&maxn+minn<s)
		cout<<s-max(maxn+min2n,max2n+minn);
	else if(maxnum!=minnum)
		cout<<s-maxn-minn;
	else
		cout<<s/2;
	return 0;
}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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



void solve() {
	int K; cin >> K;
    queue<ll> a;
    rep1(i, 9){
        a.push(i);
    }
	while(1){
		ll x = a.front();
		a.pop();
		K--;
		if(!K){
			cout << x << endl;
			return;
		}
		
		int d = x%10;
		if(d != 0) a.push(x*10 + d -1);
		a.push(x*10 + d);
		if(d != 9) a.push(x*10 + d +1);
	}

}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 5888
x = int(input())
if x < 600:
  print(8)
elif x<800:
  print(7)
elif x<1000:
  print(6)
elif x<1200:
  print(5)
elif x<1400:
  print(4)
elif x<1600:
  print(3)
elif x<1800:
  print(2)
else:
  print(1)

Measured memory_bytes: 9184
//template
import java.util.*;
import java.util.stream.Stream;
import java.io.*;
public class Main{
	static BufferedReader in= new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter out= new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	
	public static void main(String[] args) throws IOException{
		
		int n=Integer.parseInt(in.readLine());
		int[] vec=readInts();
		long ans=0;
		for(int i=0;i<n-1;i++) {
			if(vec[i]>vec[i+1]) {
				ans+=vec[i]-vec[i+1];
				vec[i+1]+=vec[i]-vec[i+1];
			}
		}
		out.append(ans+"");
		
		out.flush();
		in.close();
		out.close();
	}
	public static boolean palindrome(String s) {
		boolean palindrome=true;
		int i=0,j=s.length()-1;
		while(i<j&&palindrome) {
			if(s.charAt(i++)!=s.charAt(j--))
				palindrome=false;
		}
		return palindrome;
	}
	public static long reverse(String s) {
		String aux="";
		for(int i=s.length()-1;i>=0;i--) {
			aux+=s.charAt(i);
		}
		return Long.parseLong(aux);
	}
	private static int modulo(int S, int N) { return ((S) & (N - 1)); } // returns S % N, where N is a power of 2
	private static int isPowerOfTwo(int S) { return (S & (S - 1)) == 0 ? 1 : 0; }
	private static int[] readInts() throws IOException {
		return Stream.of(in.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
	}
	private static int readInt() throws IOException {
		return Integer.parseInt(in.readLine());
	}
	private static long[] readLongs() throws IOException {
		return Stream.of(in.readLine().split(" ")).mapToLong(Long::parseLong).toArray();
	}
	private static long readLong() throws IOException {
		return Long.parseLong(in.readLine());
	}
	 
}

Measured memory_bytes: 64352
#include<bits/stdc++.h>
using namespace std;
int main(){
  
  int M,D;
  int m,d;
  cin >> M >> D;
  cin >> m >> d;
  
  if(m == 1 && d == 1){
    cout << '1' << endl;
  }
  else if(M + 1 == m){
    cout << '1' << endl;
  }
  else{
    cout << '0' << endl;
  }
  
}

Measured memory_bytes: 256
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#if __cplusplus >= 201103L
#include <chrono>
using namespace std::chrono;
#endif
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pb push_back
#define fi first
#define se second
#ifdef LOCAL
#define prln(x) (cout << #x << ' ' << x << endl)
#define pr(x) (cout << #x << ' ' << x << ' ' )
#define prv(x) (cout << x << ' ')
#else
#define prln(x) 
#define pr(x)
#define prv(x)
#endif
#define clr(x) memset((x), 0, sizeof((x)))
#define clr1(x) memset((x), -1, sizeof((x)))
#define endl "\n"
#define pi acos(-1)
#define rep(i, st, ed) for (int i = (st); i <= (ed); ++i)
#define rep0(i, st, ed) for (int i = (st); i < (ed); ++i)
#define per(i, st, ed) for (int i = (st); i >= ed; --i)
template<class T> void _sf(T &x) {cin >> x;}
void _sf(int &x) {scanf("%d", &x);}
void _sf(ll &x) {scanf("%lld", &x);}
void _sf(double &x) {scanf("%lf", &x);}
void _sf(char &x) {scanf(" %c", &x);}
void _sf(char *x) {scanf("%s", x);}
void sf() {}
template <class T, class...U> void sf(T & head, U&... tail) { _sf(head); sf(tail...);}
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;

int read() {
    int x = 0, f = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9') {
        if (ch == '-') f = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9') {
        x = x * 10 + ch - '0';
        ch = getchar();
    }
    return x * f;
}

const int maxn = 2e5 + 5;

struct Node {
    ll t;
    ll end;
    bool operator<(const Node &rhs) const {
        return end == rhs.end ? t > rhs.t : end < rhs.end;
    }
}a[maxn];

int main(){
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
        #if __cplusplus >= 201103L
        auto start = steady_clock::now();
        #endif
    #endif
    int n = read();
    prln(n);
    rep(i, 1, n) {
        // a[i].t = read(), a[i].end = read();
        cin >> a[i].t >> a[i].end;
        // sf(a[i].end);
    }
    sort(a + 1, a + 1 + n);
    ll now = 0;
    int i;
    bool flag = true;
    for (i = 1; i <= n; ++i) {
        if (now + a[i].t <= a[i].end) {
            now += a[i].t;
        }else {
            flag = false;
            break;
        }
    }
    if (flag) puts("Yes");
    else puts("No");

    #ifdef LOCAL
        #if __cplusplus >= 201103L
        auto end = steady_clock::now();
        duration<double> time_span = duration_cast<duration<double>>(end - start);;
        printf("Total time: %.6fs\n", time_span.count());
        #endif
    #endif
    return 0;
}

Measured memory_bytes: 3328
def gcd(n, m):
    # 最大公約数
    a = max(n,m)
    b = min(n,m)
    while b:
        a, b = b, a % b
    return a
ans = 0
K = int(input())
dp = [[1] * 220 for i in range(220)] 
for i in range(1,K+1):
    for j in range(1,K+1):
        dp[i][j] = gcd(i,j)
for i in range(1,K+1):
    for j in range(i,K+1):
        for k in range(j,K+1):
            a = dp[i][j]
            gcd = dp[a][k]
            if i == j == k:
                ans += gcd
            elif i != j != k:
                ans += gcd * 6
            else:
                ans += gcd * 3  
print(ans)


Measured memory_bytes: 9532
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

a, b = map(int, input().split())

c = a * b

def gcd(a, b):
    amari = a % b
    if amari == 0:
        return b
    else:
        return gcd(b, amari)

d = gcd(a, b)

print(int (c / d))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>
//  ba;
signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  ll n;
  cin >> n;
  vector<ll> h(n);
  vector<ll> res(n);
  rep(i, n) { cin >> h[i]; }
  reverse(ALL(h));
  ll bef = h[0];
  res[0] = 0;
  repz(i, 1, n) {
    if (h[i] >= bef) {
      res[i] = res[i - 1] + 1;
      bef = h[i];
    } else {
      res[i] = 0;
      bef = h[i];
    }
  }
  cout << MAX(res) << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <iostream>
#include <unordered_map>
#include <vector>

using namespace std;

int main() {
  cin.tie(0); ios_base::sync_with_stdio(false);
  int N, K;
  unordered_map<int,int> m;

  cin >> N >> K;
  for (int i=0; i<N; ++i) {
    int a; cin >> a;
    ++m[a];
  }

  vector<int> v;
  for (const auto &x : m) {
    v.push_back(x.second);
  }
  sort(v.begin(), v.end());

  int ans=0;
  for (int i=0; i<((int)v.size()-K); ++i) {
    ans += v[i];
  }
  cout << ans << "\n";
  return 0;
}

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

int main(void){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++) cin >> a[i];
  sort(a.begin(),a.end());
  cout << a[n-1]-a[0] << endl;
  return 0;
}


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

#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;

#define boost ios::sync_with_stdio(0); cin.tie(0)

#define fi first
#define se second
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

typedef long long ll;
typedef double ld;
typedef pair<int, int> pii;

const int N = 1e3 + 5;
const int MOD = 1e9 + 7;

/***************************************************************************/

char G[N][N];
int dp[N][N];

int main() {

	boost;
	int h, w; cin>>h>>w;
	for(int i=1; i<=h; i++) {
		for(int j=1; j<=w; j++) {
			cin>>G[i][j];
		}
	}
	for(int i=h; i>=1; i--) {
		for(int j=w; j>=1; j--) {
			if(G[i][j] == '#') {
				dp[i][j] = 0;
			}
			else if(i == h and j == w) {
				dp[i][j] = 1;
			}
			else if(i == h) {
				dp[i][j] = dp[i][j+1];
			}
			else if(j == w) {
				dp[i][j] = dp[i+1][j];
			}
			else {
				dp[i][j] = dp[i][j+1] + dp[i+1][j];
				if(dp[i][j] >= MOD) dp[i][j] -= MOD;
			}
		}
	}
	cout<<dp[1][1]<<"\n";
	return 0;
}

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

using namespace std;
using ll = long long int;

//struct Edge
//{
//    ll u, v, a, b;
//};

struct Edge
{
    ll no;
    ll price;
    ll cost;

    bool operator<(const Edge &edge) const
    {
        return cost > edge.cost;
    }
};

constexpr ll Inf = 1LL << 50;
constexpr int MaxN = 50 + 10;
constexpr int MaxCount = 100 * 50 * 5;
vector<Edge> edges[MaxN][MaxCount + 10];
ll dist[MaxN][MaxCount + 10];
ll s;

ll GetPrice(ll no)
{
    return s - (MaxCount / 2 - no);
}

void Solve()
{
    priority_queue<Edge> q;
    dist[0][MaxCount / 2] = 0;
    q.push({ 0, MaxCount / 2, 0 });

    while (!q.empty())
    {
        Edge top = q.top();
        q.pop();

        if (top.cost > dist[top.no][top.price])
        {
            continue;
        }

        for (auto &e : edges[top.no][top.price])
        {
            ll nextPrice = GetPrice(e.price);
            if (nextPrice >= 0)
            {
                if (dist[e.no][e.price] > top.cost + e.cost)
                {
                    dist[e.no][e.price] = top.cost + e.cost;
                    q.push({ e.no, e.price, top.cost + e.cost });
                }
            }
        }
    }
}

int main()
{
    ll n, m;
    cin >> n >> m >> s;

    for (int i = 0; i < m; i++)
    {
        ll u, v, a, b;
        cin >> u >> v >> a >> b;
        u--; v--;

        for (ll price = a; price <= MaxCount; price++)
        {
            edges[u][price].push_back({ v, price - a, b });
            edges[v][price].push_back({ u, price - a, b });
        }
    }

    for (int i = 0; i < n; i++)
    {
        int c, d;
        cin >> c >> d;

        for (ll price = 0; price <= MaxCount; price++)
        {
            edges[i][price].push_back({ i, min(price + c, (ll)MaxCount), d });
        }
    }

    fill((ll *) dist, (ll *) dist + sizeof(dist) / sizeof(ll), Inf);
    Solve();

    for (int dest = 1; dest < n; dest++)
    {
        ll ans = Inf;
        for (int i = 0; i < MaxCount; i++)
        {
            ans = min(ans, dist[dest][i]);
        }
        //cout << "ANSWER" << endl;
        cout << ans << endl;
    }
}

Measured memory_bytes: 273032
import math
def eratosthenes(limit):
    A = [i for i in range(2, limit+1)]
    P = []
    while True:
        prime = min(A)
        if prime > math.sqrt(limit):
            break
        P.append(prime)
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
    for a in A:
        P.append(a)
    return list(P)

a = eratosthenes(100000)
b = set([2*i-1 for i in a])
a = set(a)
chk = sorted(list(a&b))

from bisect import bisect,bisect_left
import sys
input = sys.stdin.readline

q = int(input())
for i in range(q):
  l,r = map(int,input().split())
  print(bisect(chk,r)-bisect_left(chk,l))

Measured memory_bytes: 8188
require 'set'

def main(str)
  lines = str.split("\n").map { |x| x.split(' ').map(&:to_i) }
  as = lines[1].sort
  dp = Set.new
  as.each.with_index.count do |a, i|
    next if dp.include?(a)
    x = a
    loop do
      break if x > 10 ** 6
      dp << x
      x += a
    end
    as[i + 1] != a
  end
end

unless ENV["TEST"]
  puts(main($stdin.read.chomp))
  exit(0)
end

require 'minitest/autorun'

class TestA < Minitest::Test
  def test_main
#     assert_equal(3, main("5
# 24 11 8 3 16"))
#     assert_equal(0, main("4
# 5 5 5 5"))
#     assert_equal(1, main("1
# 1"))
#     assert_equal(0, main("0
# 1 1"))
#     assert_equal(5, main("10
# 33 18 45 28 8 19 89 86 2 4"))
    assert_equal(1, main("xxx
#{(2 * 10 ** 5).times.map { |i| i + 1 }.join(' ')}"))
  end
end




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

struct line{
	ll a,b;
	ll get(ll x){
		return a*x+b;
	}
};
struct CHT{
	deque<line>que;
	bool check(line a,line b,line c){
		double A[]{a.a,b.a,c.a},B[]{a.b,b.b,c.b};
		return (B[1]-B[2])*(A[1]-A[0])<=(B[0]-B[1])*(A[2]-A[1]);
	}
	void add(line l){
		while(que.size()>1&&check(que[que.size()-2],que.back(),l))que.pop_back();
		que.push_back(l);
	}
	double get(double x){
		if(que.empty())return INFINITY;
		while(que.size()>1&&que[0].get(x)>=que[1].get(x))que.pop_front();
		return que[0].get(x);
	}
};

ll h[300000];
ll a[300000],b[300000];
ll dp[300000];

int main(){
	int n;ll C;cin>>n>>C;
	rep(i,n)scanf("%lld",&h[i]);
	CHT cht;
	dp[0]=0;
	cht.add({-2*h[0],h[0]*h[0]+C});
	for(int i=1;i<n;i++){
		dp[i]=cht.get(h[i])+h[i]*h[i];
		cht.add({-2*h[i],dp[i]+h[i]*h[i]+C});
	}
	cout<<dp[n-1]<<endl;
}

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

int main() {
  long n, k;
  long b;
  long cnt = 0;
  
  cin >> n >> k;
  rep(b, n+1) {
    if (b <= k) continue;
    if (k == 0) {
      cnt = n * n;
      break;
    }
    
    cnt += ((n) / b) * (b - k);
    cnt += max((n % b) - k + 1, 0L);
  }
  cout << cnt;
}


Measured memory_bytes: 256
inf = input().split()
N = int(inf[0])
K = int(inf[1])
line = [int(v) for v in input().split()]

ans = 0
if K<N:
  for k in range(K+1):
    for i in range(k+1):
      item = line[:i]+line[N-k+i:]
      item.sort()
      count = 0
      while count<K-k and item:
        if item[0]>0:
          break
        item = item[1:]
        count += 1
      s = sum(item)
      if s>ans:
        ans = s
else:
  line = [i for i in line if i>0]
  ans = sum(line)

print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

mint dp[55][55][2666];
int main(){
    int n, k;
    cin >> n >> k;
    dp[0][0][0] = 1;
    for (int i=1; i<=n; i++) {
        rep(j, i+1) {
            rep(l, k+1) {
                if (l-2*j>=0) {
                    dp[i][j][l] += dp[i-1][j][l-2*j];
                }
                if (j>0 && k-2*(j-1)>=0) {
                    dp[i][j][l] += dp[i-1][j-1][l-2*(j-1)];
                }
                if (l-2*j>=0) {
                    dp[i][j][l] += dp[i-1][j][l-2*j]*2*j;
                }
                if (l-2*(j+1)>=0) {
                    dp[i][j][l] += dp[i-1][j+1][l-2*(j+1)]*(j+1)*(j+1);
                }
            }
        }
    }
    mint ans = dp[n][0][k];
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 63232
#include <iostream>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <deque>
#include <queue>
using namespace std;

typedef long long ll;
const ll MAX = 1000000;
const ll MOD = 1000000007;

ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
    ll x,y;
    cin >> x >> y;

    COMinit();

    ll ans = 0;

    if((2*x-y)%3 != 0 || 2*x-y < 0 || (-x+2*y)%3 != 0 || -x+2*y < 0) ans = 0;
    else{
        ll n = (2*x-y)/3;
        ll m = (-x+2*y)/3;
        ans = COM(n+m, min(n, m));
    }
    cout << ans << endl;
}



Measured memory_bytes: 23680
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef vector<int> vi;
//----
const int MOD=1e9+7;
template<int SZ> struct Combo {
    ll fac[SZ+1], ifac[SZ+1];
    
    Combo() {
        fac[0] = ifac[0] = 1;
    	rep(i,1,SZ+1) {
    	    fac[i] = i*fac[i-1] % MOD;
    	    ifac[i] = inv(fac[i]);
    	}
    }
    
    ll po (ll b, ll p) { return !p?1:po(b*b%MOD,p/2)*(p&1?b:1)%MOD; }
    ll inv (ll b) { return po(b,MOD-2); }
    
    ll comb(ll a, ll b) {
        if (a < b || b < 0 || a < 0) return 0;
        ll tmp = fac[a]*ifac[b] % MOD;
        tmp = tmp*ifac[a-b] % MOD;
        return tmp;
    }
};
Combo<202020> C;
int h, w, a, b;
int main(){
    cin>>h>>w>>a>>b;
    ll ans=0;
    rep(i, 0, h-a){
        ans+=C.comb(i+b-1, b-1)*C.comb(h-i-2+w-b, w-b-1);
        ans%=MOD;
    }
    printf("%lld\n", ans);
	return 0;
}

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

int main() {
	int n;cin>>n;
	int odd=0;
	int even=0;
	for(int i=1;i<=n;i++){
		if(i%2){
			odd++;
		}else{
			even++;
		}
	}
	cout<<odd*even<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
vector<int > v;
int main (){
int n,k,p,sum=0;
cin >>n >>k;
for(int i=0;i<n;i++){
cin >> p;
v.push_back(p);
}
sort(v.begin(),v.end());
reverse(v.begin(),v.end());
for(int i=0;i<k;i++){
sum=sum+v[i];
}
cout <<sum << endl;

return 0;
}


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

int main() {

	int mo, days,nr=0;
	cin >> mo >> days;
	for (int i = 2;i <= mo;i++) {
		
		for (int j = 2;j <= 9;j++) {
			for (int t = 2;t <= 9;t++) {
				if (j*t == i && j * 10 + t <= days)
					nr++;
   }
		}
	}

	cout << nr;
	return 0;
}

Measured memory_bytes: 256