akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/
 
#define pll              pair <long long,long long>
#define pb               push_back
#define ll               long long
#define ff               first
#define ss               second
#define D(x)             cerr<<#x " = "<<(x)<<endl
#define vll              vector <ll>
#define IOS              ios_base::sync_with_stdio(0); cin.tie(NULL);
#define endl             '\n'   
using namespace std;
int main()
{
    IOS
 	// freopen("input.txt","r",stdin);
 	// freopen("output.txt","w",stdout);
 	// freopen("error.txt","w",stderr);
 	ll a,b,k;
 	cin>>k>>a>>b;
 	ll cnt=0;
 	for(ll i=a;i<=b;i++)
 	{
 		if(i%k==0)
 			++cnt;
 	} 
 	if(cnt>0)
 	{
 		cout<<"OK"<<endl;
 	}
 	else
 	{
 		cout<<"NG"<<endl;
 	}
    return 0;
}

Measured memory_bytes: 3652
import java.io.*; 
class Main {
   public static void main(String[] args){
     try{
     BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
     String buf = br.readLine();
     int x = Integer.parseInt(buf);
     System.out.println(x * x * x);}
     catch(Exception e){}
  }
}


Measured memory_bytes: 24176
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <bitset>

using namespace std;
typedef long long ll;

int main() {
	int N; cin >> N;
	int c = 1;
	for (int i = 0; i < N; i++) {
		int a; cin >> a;
		if (a == c) { c++; }
	}
	if (c == 1) { cout << -1 << endl; return 0; }
	cout << N - c + 1 << endl;
	return 0;
}


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

int main() {
    char s[17];
    cin >> s;
    char truth[17] = "CODEFESTIVAL2016";
    int ans = 0;
    for (int i = 0; i < 16; i++)
        if (s[i] != truth[i]) ans++;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<vector<int>> a(n, vector<int>(3));
  vector<vector<int>> dp(n, vector<int>(3, 0));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> a[i][j];
    }
  }
  dp[0][0] = a[0][0];
  dp[0][1] = a[0][1];
  dp[0][2] = a[0][2];
  for (int i = 0; i < n - 1; i++) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < 3; k++) {
        if (j == k) {
          continue;
        }
        if (dp[i][j] + a[i + 1][k] > dp[i + 1][k]) {
          dp[i + 1][k] = dp[i][j] + a[i + 1][k];
        }
      }
    }
  } /*
   for (int i = 0; i <= n;i++){
     for (int j = 0; j < 3; j++){
       printf("%d ", dp[i][j]);
     }
     cout << endl;
   }*/
  cout << max(max(dp[n - 1][0], dp[n - 1][1]), dp[n - 1][2]) << endl;
  return 0;
}

Measured memory_bytes: 14024
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <set>
#include <iostream>

using namespace std;
typedef long long ll;

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

void calc(int h,int w,int n){
    int in[1000][1000],dp[1001][1001]={0},x=0,y=0;
    
    for(int i=0;i<h;i++)
        for(int j=0;j<w;j++)
            scanf("%d",&in[i][j]);
    
    dp[0][0]=n-1;
    
    for(int i=0;i<h;i++)
        for(int j=0;j<w;j++){
            dp[i+1][j]+=(dp[i][j]+1-in[i][j])/2;
            dp[i][j+1]+=(dp[i][j]+in[i][j])/2;
        }
    
    while(x<w && y<h){
        if((dp[y][x]+in[y][x])%2)
            x++;
        else
            y++;
    }
    
    printf("%d %d\n",y+1,x+1);
    
}

int main(){
    int h,w,n;
    
    while(1){
        scanf("%d%d%d",&h,&w,&n);
        
        if(h==0) break;
        
        calc(h,w,n);
    }
}

Measured memory_bytes: 9012
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int Max = 2e3 + 5, Mod = 1e9 + 7;
ll n, k, a[Max];
ll ans = 0;
int main()
{
	cin >> n >> k;
	for (int i = 0; i<n; i++)
		cin >> a[i];
	for (int i = 0; i < n; i++)
	{
		ll s1 = 0, s2 = 0;
		for(int j=0;j<n;j++)
			if (a[i] > a[j])
			{
				s1++;
				if (j > i)
					s2++;
			}
		ans = (ans + k * s2 + k * (k - 1)/2%Mod * s1) % Mod;
	}
	cout << ans << endl;
	return 0;
}

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

const int mod = 998244353;

ll calc(ll a, ll b, ll p)
{
	if (b == 0) return 1;
	if (b % 2 == 0)
	{
		ll d = calc(a, b / 2, p);
		return (d * d) % p;
	}
	else
		return (a * calc(a, b - 1, p)) % p;
}
ll fac[MAX];
void COMinit(void)
{
	fac[0] = fac[1] = 1;
	for(int i = 2; i <= MAX; i++)
	{
		fac[i] = fac[i - 1] * i;
		fac[i] %= mod;
	}
}

ll nCr(ll n, ll r)
{
	ll denom = fac[r] * fac[n - r] % mod;
	return fac[n] * calc(denom, mod - 2, mod) % mod;
}

signed main(void)
{
	int n, m, k;
	ll ans, tmp;

	cin >> n >> m >> k;
	COMinit();
	ans = 0;
	tmp = m; 
	for(int x = n - 1; x >= 0; x--)
	{
		if (x <= k)
		{
			ans +=  tmp * nCr(n - 1, x) % mod;
			ans %= mod;
		}
		tmp *= m - 1;
		tmp %= mod;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 7604
import os

def main():
    num_a,num_b,count = (int(x) for x in input().split())
    if count <= num_a:
        print(num_a - count,num_b)
    else:
        count -= num_a
        if count >= num_b:
            print(0,0)
        else:
            print(0,num_b - count)

if __name__ == "__main__":
    main()



Measured memory_bytes: 2940
import sys
sys.setrecursionlimit(300000)
from collections import defaultdict

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI0(): return map(lambda s: int(s) - 1, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
def LMI0(): return list(map(lambda s: int(s) - 1, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


D = I()
C = LMI()
S = [LMI() for _ in range(D)]
T = [I() - 1 for _ in range(D)]
M = I()

last = [[i + 1] * 26 for i in range(D)]
for d in range(D):
    i = T[d]
    j = 0
    for dd in range(d, D):
        last[dd][i] = j
        j += 1

def eval(d, q):
    i = T[d]
    val = S[d][q] - S[d][i]

    contrib = 0
    if d == 0:
        j = 1
    else:
        j = last[d - 1][i] + 1
    for dd in range(d, D):
        if dd > d and last[dd][i] == 0:
            break
        contrib += j - last[dd][i]
        last[dd][i] = j
        j += 1
    val -= contrib * C[i]

    contrib = 0
    j = 0
    for dd in range(d, D):
        if last[dd][q] == 0:
            break
        contrib += last[dd][q] - j
        last[dd][q] = j
        j += 1
    val += contrib * C[q]

    T[d] = q

    return val


def score0(T):
    last = defaultdict(int)
    ans = 0
    for d in range(D):
        ans += S[d][T[d]]
        last[T[d]] = d + 1
        for i in range(26):
            ans -= C[i] * (d + 1 - last[i])
    return ans


score = score0(T)
for d, q in [tuple(MI0()) for _ in range(M)]:
    val = eval(d, q)
    score += val
    print(score)

Measured memory_bytes: 84864
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

signed main(){
	cout<<fixed<<setprecision(10);
	
	string T;
	
	cin>>T;
	
	for(int i = 0; i < T.size(); i++){
		if(T[i] == '?') {
			cout<<"D";
		} else {
			cout<<T[i];
		}
	}
	cout<<endl;
	
	
	return 0;
}

Measured memory_bytes: 3748
from math import *
f=lambda:[*map(int,input().split())]
n,k=f()
a=f()
def ok(x):
  c=0
  for i in a:
    c+=ceil(i/x)
  return c<=n+k
l,r=0,10**9
while r-l>1:
  m=(l+r)/2
  if ok(m): r=m
  else: l=m
t=ceil(r)
print(t-ok(t-1) if t>1 else t)

Measured memory_bytes: 31076
N = int(input())
X = list(map(int, input().split()))
small = 10000000
temp = 0
p_max = max(X)

for p in range(1, p_max + 1):
  for i in range(N):
    temp += (X[i] - p)**2
    
  if temp < small:
    small = temp
  
  temp = 0
  
print(small)


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

using ll = long long;

int main() {
    int A, B;
    cin >> A >> B;
    if (A <= 9 && B <= 9) cout << A * B << endl;
    else cout << -1 << endl;
}

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

int main() {
  int n,k;
  cin >> n >> k;
  vector<int> p(n);

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

  sort (p.begin(), p.end());
  int ans = 0;

  for (int i = 0; i < k; i++) {
    ans += p[i];
  }

  cout << ans << endl;
  
}


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

using namespace std;
#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 rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

  string s;
  cin >> s;
  ll n;
  n = s.length();

  vector<vector<ll>> a(26);
  
  rep(i, s.length()){

    a[s[i]-'a'].push_back(i);

  }

  vector<ll> cnt(26);
  vector<ll> cntp(26);
  rep(i, 26){
    cntp[i] = 0;
    cnt[i] = a[i].size();
    rep(j, a[i].size()-1){
      if(a[i][j+1] - a[i][j] == 1){
        cntp[i]++;
      }
    }
  }

  ll tans = 0;
  rep(i, 26){
    tans += cnt[i] * (cnt[i]-1) / 2 + cnt[i];
  }

  cout << n * (n+1)/2 - tans + 1 << endl;

  return 0;
}


Measured memory_bytes: 3596
#include<iostream>
#include<vector>
#include<iterator>
using namespace std;
int main()
{
	vector<int >a,b;
	int n,temp;
	vector<int>::iterator it;
	while(scanf("%d",&n)!=EOF)
	{
		a.clear();
		for(int i=0;i<n;i++)
		{
			cin>>temp;
			if((i+n)%2==0)
			a.push_back(temp);
			else a.insert(a.begin(),temp);
		}
		for(it=a.begin();it!=a.end();it++)
		{
			cout<<*it<<' ';
		}
		cout<<endl;
	}
}

Measured memory_bytes: 3060
#include<stdio.h>
main(){
  double n;
  while(scanf("%lf",&n)!=EOF){
    if(n<=48.00)printf("light fly");
    else if(n<=51.00)printf("fly");
    else if(n<=54.00)printf("bantam");
    else if(n<=57.00)printf("feather");
    else if(n<=60.00)printf("light");
    else if(n<=64.00)printf("light welter");
    else if(n<=69.00)printf("welter");
    else if(n<=75.00)printf("light middle");
    else if(n<=81.00)printf("middle");
    else if(n<=91.00)printf("light heavy");
    else printf("heavy");

    printf("\n");
  }
  return 0;
}

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

int main(void){
   int A,B,C,D;
   cin>>A>>B>>C>>D;
   if((A+B)>(C+D)) cout<<"Left"<<endl;
   else if((A+B)<(C+D)) cout<<"Right"<<endl;
   else cout<<"Balanced"<<endl;
   return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
using namespace std;
int main()
{
  int n,m;
  cin >> n >> m;
  vector<int> days(n,0);
  vector<map<int,int> > plan(n);
  for(int i=0; i<m; i++){
    int a,b,c;
    cin >> a >> b >> c;
    plan[a][b] = c;
  }
  set<int> q;
  q.insert(0);
  while(!q.empty()){
    set<int>::iterator pt = q.begin();
    int p = (*pt);
    q.erase(pt);
    map<int,int> nlist = plan[p];
    for(map<int,int>::iterator it = nlist.begin(); it != nlist.end(); it++){
      int d = (*it).first;
      int day = (*it).second;
      days[d] = max(days[d], days[p] + day);
      q.insert(d);
    }
  }
  cout << days[n-1] << endl;
  return 0;
}

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



// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    int N;
    cin >> N;
    bool isAccepted = true;
    for(int i=0;i<N;i++){
        int a;
        cin >> a;
        if(a%2==0){
            if(a%3 != 0&& a%5 !=0){
                isAccepted = false;
            }
        }
    }
    if(isAccepted){
        cout << "APPROVED" << endl;
    }else{
        cout << "DENIED" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Text;
using System.Collections.Generic;
using static System.Math;
using System.Linq;
using static System.Array;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            long N = long.Parse(Console.ReadLine());
            var S = Console.ReadLine();
            var CumWhite = new long[N];
            var CumBlack = new long[N];
          
            for(int i = 0; i < N; i++){
                if(S[i] == '.'){
                    CumWhite[i] = 1;
                }
              if(i > 0){
                CumWhite[i] += CumWhite[i -1];
              }
            }
          
          for (int i = (int)N - 1; i >= 0; i--)
          {
              if(S[i] == '#'){
                CumBlack[i] = 1;
              }
              if(i+1 < N){
                CumBlack[i] += CumBlack[i +1];
              }
          }
          
          var ans = new long[N];
          for(int i = 0; i < N; i++){
            ans[i] = (i+1 - CumWhite[i]) + (N - (i+1)) - CumBlack[i];
          }

            Console.WriteLine(ans.Min());
        }
    }    
}


Measured memory_bytes: 23072
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pi> vpi;
typedef vector<vi> vii;
typedef map<int, int> mp;
typedef multiset<int> mset;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;
typedef vector<int64> vi64;
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define form(i,j,k,l) for(int i=j;i<int(k);i+=l)
#define rform(i,j,k,l) for(int i=int(j);i>int(l);i-=l)
#define rep(i, j) for(int i=0;i<int(j);i++)
#define rrep(i, j) for(int i=int(j);i>=0;i--)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define forc(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define INF (int)1e9
#define INF64 (int64)1e18
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
#define F first
#define S  second
const double pie = acos(-1.0);
template <typename T>
T Max(T x, T y)
{
  return (x > y) ? x : y;
}
template <typename T>
T Min(T x, T y)
{
  return (x > y) ? y : x;
}
int gcd(int n1, int n2)
{
  if (n2 != 0) return gcd(n2, n1 % n2);
  else return n1;
}
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
#else
#define trace(...)
#endif
clock_t time_p = clock();
void rtime() { time_p = clock() - time_p; cerr << "Time Taken : " << (float)1000 * (time_p) / CLOCKS_PER_SEC << "\n";}
int64 binpow(int64 a, int64 b, int64 m) {
  a %= m;
  int64 res = 1;
  while (b > 0) {
    if (b & 1)
      res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
int main()
{ fast;
  int n;
  long long int a, b;
  cin >> n >> a >> b;
  long long int arr[n];
  for (int i = 0; i < n; i++)
    cin >> arr[i];
  long long int ans = 0;
  form(i, 1, n, 1)
  {

    ans = ans + Min((arr[i] - arr[i - 1]) * a, b);
  }
  cout << ans;

}




Measured memory_bytes: 4396
#include <iostream>
#include <string>
int main()
{
    std::string s;
    std::cin >> s;

    if((s[2]==s[3])&&(s[4]==s[5])){
        std::cout << "Yes" << std::endl;
        return 0;
    }

    std::cout << "No" << std::endl;
    return 0;
}

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

using namespace std;

bool is_p[555555];
vector<int> p;
int n;

int main() {
  for (int i = 2; i <= 555555; ++i) {
    bool flag = true;
    for (int j = 2; j * j <= i; ++j) {
      if (i % j == 0) { flag = false; break;}
    }
    if (flag && i <= 55555) { p.push_back(i); }
    is_p[i] = flag; 
  }  
  vector<int> a;
  for (int i = 0; i < p.size(); ++i) {
    if (p[i] % 10 == 1) {
      a.push_back(p[i]);
    }
  }
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) cout << a[i] << (i == n - 1 ? "\n" : " ");
  return 0;
}

Measured memory_bytes: 896
/**
*       Author: K.R.Surrya  26/04/2020 17:36:57 
*
**/
#include<bits/stdc++.h>
#define vi vector<int>
#define vii vector<vector<int> >
#define vpi vector<pair<int,int> >
#define fo(i,a,b)             for(int i=a;i<b;++i)
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define pb push_back
using namespace std; 

void solve() {
    int takaHealth,takaStrength;
    cin >> takaHealth >> takaStrength;

    int aokHealth,aokStrength;
    cin >> aokHealth >> aokStrength;

    while(true) {
        aokHealth-=takaStrength;
        if(aokHealth<=0) {
            cout << "Yes" << endl;
            return ;
        }
        takaHealth-=aokStrength;
        if(takaHealth<=0) {
            cout << "No" << endl;
            return ;
        }
    }
}
int main()
{   
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);


     auto start = chrono::high_resolution_clock::now();

     solve();

     auto end = chrono::high_resolution_clock::now();

     cerr << " Execution time : " << chrono::duration_cast<chrono::milliseconds>(end-start).count()<<"ms"<<endl;

   
    return 0;
}


Measured memory_bytes: 3652
a = int(input())
b = {}
for i in range(a):
    c = int(input())
    if c not in b:
        b[c] = 1
    else:
        b[c] += 1
c = 0
for k, v in b.items():
    if v % 2 != 0:
        c += 1
print(c)


Measured memory_bytes: 15076
#include <iostream>
#include <fstream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main(void){
  int h, w;
  cin >> h >> w;
  VVI a(h, VI(w));
  int s = 0, pi, pj;
  REP(i,h) REP(j,w){
    a[i][j] = in();
    s += a[i][j];
    if (a[i][j] > 0){
      pi = i;
      pj = j;
    }
  }
  if (s % 2){
    a[pi][pj]--;
  }
  VI x1, y1, x2, y2;
  REP(i,h) REP(j,w){
    if (a[i][j] % 2 == 0) continue;
    x1.push_back(i);
    y1.push_back(j);
    if (i<h-1){
      x2.push_back(i+1);
      y2.push_back(j);
    }else{
      x2.push_back(i);
      y2.push_back(j+1);
    }
    a[x2.back()][y2.back()]++;
  }
  cout << x1.size() << endl;
  REP(i,x1.size()){
    printf("%d %d %d %d\n", x1[i]+1, y1[i]+1, x2[i]+1, y2[i]+1);
  }
  return 0;
}


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

int main()
{
    size_t N; cin >> N;
    if (N == 1) {
        cout << 0 << endl;
        return 0;
    }

    vector<int> H(N, 0);
    for (auto &h: H) {
        cin >> h;
    }

    int move = 0;
    int moveMax = 0;
    size_t p = 0;
    while( p <= (N-2) ) {
        if (H[p] >= H[p+1]) {
            ++move;
        }
        else{
            if (move > moveMax) {
                moveMax = move;
            }
            move = 0;
        }
        ++p;
    }
    moveMax = max(move, moveMax);
    cout << moveMax << endl;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
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; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;
ll const MOD = 1e9+7;

ll mod_pow(ll a, ll n, ll p) {
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * mod_pow(a, n-1, p)) % p;
  // return (mod_pow(a, 1, p) * mod_pow(a, n-1, p)) % p;
  ll t = mod_pow(a, n / 2, p);
  return (t * t) % p;
}

ll mod_multi(ll a, ll b, ll p) {
  ll res = 1;
  rep(i, b) {
    res = res * a % p;
    a--;
  }
  return res % p;
}

ll mod_com(ll a, ll b, ll p) {
  b = min(b, a-b);
  ll res = mod_multi(a, b, p);
  ll tmp = mod_multi(b, b, p);
  tmp = mod_pow(tmp, MOD-2, MOD) % MOD;

  res = (res * tmp) % MOD;
  return res;
}

int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  ll ans = 0;

  ans = mod_pow(2, n, MOD) - 1;
  ans %= MOD;
  ans -= mod_com(n, a, MOD);
  ans -= mod_com(n, b, MOD);
  while (ans < 0) ans += MOD;
  ans %= MOD;

  cout << ans <<endl;

  return 0;
}


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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX / 10;
//const ll INF = (1ll << 31) - 1;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;

bool contain(set<P> &s, P a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);


void print_line(vector<ll> &line) {
    if (line.size() == 0ll) {
        cout << endl;
        return;
    }
    for (ll i = 0; i < line.size(); i++) {
        cout << line[i];
        if (i == line.size() - 1) cout << endl;
        else cout << ' ';
    }
}


typedef priority_queue<long long, vector<long long>, greater<long long>> PQ_ASK;
const int mod = 1000000007;

struct Item {
    ll value;
    ll weight;
};

map<ll, ll> conv(vector<Item> &items, ll w) {
    map<ll, ll> ans;
    ans[0] = 0;
    int n = items.size();
    for (int i = 0; i < (1 << n); i++) {
        if (i == 0) continue;
        ll value = 0, weight = 0;
        for (int j = 0; j < n; j++) {
            if ((i >> j) & 1) {
                value += items[j].value;
                weight += items[j].weight;
            }
        }
        if (weight > w) continue;

        auto it = ans.upper_bound(weight);
        it--;
        assert((*it).first <= weight);
        if ((*it).second >= value) {
            continue;
        }
        assert(ans[weight] < value);
        assert((*it).second < value);
        ans[weight] = value;

        set<ll> del_key;
        auto del_it = ans.find(weight);
        del_it++;
        for (; (*del_it).second <= value && del_it != ans.end(); del_it++) {
            del_key.insert((*del_it).first);
        }

        for (ll d : del_key) ans.erase(d);

    };
    return ans;
}


int main() {

    int n;
    ll w;
    cin >> n >> w;

    vector<Item> items(n);
    rep(i, n) {
        cin >> items[i].value >> items[i].weight;
    }

    vector<Item> items1, items2;
    for (int i = 0; i < n; i++) {
        if (i % 2 == 0) items1.push_back(items[i]);
        else items2.push_back(items[i]);
    }

    map<ll, ll> ans1 = conv(items1, w), ans2 = conv(items2, w);

    ll ans = 0;
    for (auto e1 : ans1) {
        ll nokori = w - e1.first;
        auto e2_it = ans2.upper_bound(nokori);
        e2_it--;
        auto e2 = *e2_it;
        ll value = e1.second + e2.second;
        cmax(ans, value);
    }

    cout << ans << endl;

}




Measured memory_bytes: 3168
/*	AtCoder ARC 093 C Traveling Plan
	1st Edition:2018.3.24 Saturday
	Algorithm:Greedy
*/
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <iomanip>
#include <cstdlib>
#include <ctime>
#include <cctype>
using namespace std;

#define is_lower(c) (c>='a' && c<='z')
#define is_upper(c) (c>='A' && c<='Z')
#define is_alpha(c) (is_lower(c) || is_upper(c))
#define is_digit(c) (c>='0' && c<='9')
#define stop system("PAUSE")
#define ForG(i,a,b,c) for(rg int (i)=c.head[a],(b)=c.E[i].v;(i);(i)=c.E[i].nxt,(b)=c.E[i].v)
#define ForR(a,b,c) for(rg int (a)=b;(a)>=(c);--(a))
#define For(a,b,c) for(rg int (a)=(b);(a)<=(c);++a)
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define shl(x,y) ((x)<<(y))
#define shr(x,y) ((x)>>(y))
#define mp make_pair
#define pb push_back
#define rg register
#ifdef ONLINE_JUDGE
#define hash rename_hash
#define next rename_next
#define prev rename_prev
#endif
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef double db;
const ll inf=1000000007LL;
const db EPS=1e-14;
const ll inf_ll=(ll)1e18;
const ll maxn=100005LL;
const ll mod=1000000007LL;

int n;
int a[maxn];
int sum;

int main(){
	scanf("%d",&n);
	For(i,1,n) scanf("%d",a+i),sum+=abs(a[i]-a[i-1]);
	sum+=abs(a[n]);
	For(i,1,n){
		int tmp=abs(a[i]-a[i-1])+abs(a[i+1]-a[i])-abs(a[i+1]-a[i-1]);
		printf("%d\n",sum-tmp);
	}
	return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define pb push_back
#define REP(i, n) for (signed long long i = 0; i < (n); i++)
#define MOD 1000000007
#define INF 98765431219876543
#define bitcnt(a) (ll) __builtin_popcount((a))
#define lb(a, b) lower_bound((a).begin(), (a).end(), (b))
#define ub(a, b) upper_bound((a).begin(), (a).end(), (b))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<string, string> PS;

int main() {
  string s;
  cin>>s;
  ll cnt=0,ans=0;
  REP(i,s.size()){
    if(s[i]=='B')
      cnt++;
    if(s[i]=='W'){
    	ans+=cnt;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 640
import java.util.Scanner;

/**
 *
 * @author k16075kk
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            while (true) {
                int H = sc.nextInt(), W = sc.nextInt();
                if (H == 0 && W == 0) {
                    break;
                }
                for (int i = 0; i < H; i++) {
                    for (int j = 0; j < W; j++) {
                        if (i % 2 == 0 && j % 2 == 0 || i % 2 == 1 && j % 2 == 1) {
                            System.out.print("#");
                        } else {
                            System.out.print(".");
                        }
                    }
                    System.out.println("");
                }
                System.out.println("");
            }
        }
    }

}




Measured memory_bytes: 34724
#include<bits//stdc++.h>
using namespace std;
int n;double W,v[1<<17],w[1<<17];
main()
{
	cin>>n>>W;
	vector<pair<double,double> >a;
	for(int i=0;i<n;i++){
		cin>>v[i]>>w[i];
		a.push_back(make_pair(-v[i]/w[i],w[i]));
	}
	sort(a.begin(),a.end());
	double ans=0;
	for(int i=0;i<n;i++){
		ans-=a[i].first*min(a[i].second,W);
		W-=min(a[i].second,W);
	}
	cout<<fixed<<setprecision(10)<<ans<<endl;
}


Measured memory_bytes: 6244
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    if(a < b) {
        for(int i = 0; i < b; i++) {
            cout << a;
        }
        cout << endl;
    } else {
        for(int i = 0; i < a; i++) {
            cout << b;
        }
        cout << endl;
    }
}

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

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, x, n) for (int i = x; i < (n); ++i)
using namespace std;

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

    bool can = false;
    rep(i, N/4 + 1) {
        rep(j, N/7 + 1) {
            int price = i * 4 + j * 7;
            if (price == N) {
                can = true;
            }
        }
    }

    if (can) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
void tostr(ll x,string& res){while(x)res+=('0'+(x%10)),x/=10; reverse(ALL(res)); return;}
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 end

typedef pair<int,int> P;
typedef pair<int,P> T;
int dx[]={1,-1,0,0},dy[]={0,0,1,-1};

int main(){
   int h,w; scanf("%d%d",&h,&w);
   vector<string> g(h);
   rep(i,0,h)cin>>g[i];
   int ans=0;
   rep(i,0,h)rep(j,0,w)if(g[i][j]=='.'){
      bool used[21][21]={}; used[i][j]=1;
      queue<T> que; que.push({0,{i,j}});
      while(!que.empty()){
         auto t=que.front(); que.pop();
         int x=t.second.first,y=t.second.second;
         chmax(ans,t.first);
         rep(k,0,4){
            int tx=x+dx[k],ty=y+dy[k];
            if(tx<0||tx>=h||ty<0||ty>=w||g[tx][ty]=='#')continue;
            if(used[tx][ty])continue;
            que.push({t.first+1,{tx,ty}}); used[tx][ty]=1;
         }
      }
   }
   printf("%d\n",ans);
   return 0;
}

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

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

bool chp(int x,int y){
  if( x < 0 || y < 0 || x >= 6 || y>= 12 ) return false;
  return true;
}

void fall(){
  bool lp = true;
  while( lp ){
    lp = false;
    for(int y=0;y<11;y++){
      for(int x=0;x<6;x++){
        if( fie[x][y] == '.' && fie[x][y+1] != '.'){
          swap(fie[x][y], fie[x][y+1]);      
          lp = true;
        }
      }
    }
  }

}

int check(int x,int y,char c){
  if( fie[x][y] != c ) return 0;
  int cnt = 1;
  char tmp = fie[x][y];
  fie[x][y] = 'x';
  for(int i=0;i<4;i++){
    int nx = x + dx[i], ny = y + dy[i];
    if( !chp(nx,ny) ) continue;
    cnt += check( nx, ny, c );
  }
  fie[x][y] = tmp;
  return cnt;
}

void ume(int x,int y,char c){
  if( fie[x][y] != c ) return;
  fie[x][y] = 'x';
  for(int i=0;i<4;i++){
    int nx = x + dx[i], ny = y + dy[i];
    if( !chp(nx,ny) ) continue;
    ume( nx, ny, c );
  }
}

bool del(){
  bool f = false;
  for(int y=0;y<12;y++){
    for(int x=0;x<6;x++){
      if( fie[x][y] != 'O' &&
          fie[x][y] != '.' &&
          fie[x][y] != 'x' ) {
        if( check( x,y,fie[x][y] ) >= 4 ){
          ume( x, y, fie[x][y] ); 
          f = true;
        } 
      }
    }
  }
  return f;
}

void ozm(){
  for(int y=0;y<12;y++){
    for(int x=0;x<6;x++){
      for(int i=0;i<4;i++){
        if( fie[x][y] == 'O' ){
          int nx = x+dx[i], ny = y + dy[i];
          if( chp(nx,ny) ){
            if( fie[nx][ny] ==  'x' ) 
              fie[x][y] = '.';            
          }
        }
      }
    }
  }
  for(int y=0;y<12;y++)
    for(int x=0;x<6;x++)
      if( fie[x][y] == 'x' ) fie[x][y] = '.';
}

int main(){
  int T;
  cin >> T;
  while( T-- ){

    for(int i=0;i<12;i++){
      for(int j=0;j<6;j++) cin >> fie[j][11-i];
    }
    int res = 0;
    fall();
    while( del() ){
      res++;
      ozm();
      fall();
    }
    cout << res << endl;
  }

}

Measured memory_bytes: 1160
n,m=map(int,input().split())
mod=10**9+7

def factorial(num):
    x=1
    for i in range(num,0,-1):
        x = x *i % mod

    return x
        
def permutations(num,r):
    x=1
    cnt=0
    for i in range(num,0,-1):
        if cnt>r:
            break

        x = x*i %mod
        cnt+=1

    return x

def solve():
    if abs(m-n)>1:
        print(0)
        return
    
    dog=factorial(n)

    if n==m:
        monkey=permutations(m,m-1)*2 % mod
    else:
        monkey=factorial(m)
    
    ans=dog * monkey % mod
    print(ans)
    
if __name__ == "__main__":
     solve()


Measured memory_bytes: 63556
#include <iostream>
using namespace std;
#include<bits/stdc++.h>
int main() {
	int n;
	cin>>n;
	int arr[n];
	for(int i=0;i<n;i++) cin>>arr[i];
	int last=arr[0];
	int c= 1; int ans=0;
	for(int i=1;i<n;i++)
    {
        if(arr[i]==last) c++;
        else{
         ans+=(c/2);
         c=1; last=arr[i];
        }
    }
    ans+=(c/2);
    cout<<ans;
}


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

using namespace std;

#define MAX_N 21
#define MAX_M 300001
#define INF (1<<29)
typedef long long ll;

double dp[MAX_N][MAX_M];

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

    fill(dp[0], dp[MAX_N], INF);
    dp[0][1] = 0;
    for (int i = 0; i < N; i++) {
        for (int j = MAX_M-1; j >= 0; j--) {
            if (dp[i][j] == INF) continue;
            for (int k = 1; k <= MAX_M; k++) {
                ll nv = (ll)j * k; 
                if (nv >= MAX_M) break;
                dp[i+1][nv] = min(dp[i+1][nv],
                                  max(dp[i][j], abs(v[i]-nv) / v[i]));
            }

        }
    }
    double res = INF;
    for (int i = 0; i < MAX_M; i++) {
        res = min(res, dp[N][i]);
    }
    printf("%.15f\n", res);
    return 0;
}

Measured memory_bytes: 50460
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min

val MOD = 1_000_000_007L

class Solver(stream: InputStream, private val out: java.io.PrintWriter) {
  fun solve() {
    val X = na(5)
    out.println(X.indexOf(0) + 1)
  }













































  private val isDebug = try {
    // なんか本番でエラーでる
    System.getenv("MY_DEBUG") != null
  } catch (t: Throwable) {
    false
  }

  private var tokenizer: StringTokenizer? = null
  private val reader = BufferedReader(InputStreamReader(stream), 32768)
  private fun next(): String {
    while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
      tokenizer = StringTokenizer(reader.readLine())
    }
    return tokenizer!!.nextToken()
  }

  private fun ni() = next().toInt()
  private fun nl() = next().toLong()
  private fun ns() = next()
  private fun na(n: Int, offset: Int = 0): IntArray {
    return map(n) { ni() + offset }
  }
  private fun nal(n: Int, offset: Int = 0): LongArray {
    val res = LongArray(n)
    for (i in 0 until n) {
      res[i] = nl() + offset
    }
    return res
  }

  private fun na2(n: Int, offset: Int = 0): Array<IntArray> {
    val a  = Array(2){IntArray(n)}
    for (i in 0 until n) {
      for (e in a) {
        e[i] = ni() + offset
      }
    }
    return a
  }

  private inline fun map(n: Int, f: (Int) -> Int): IntArray {
    val res = IntArray(n)
    for (i in 0 until n) {
      res[i] = f(i)
    }
    return res
  }

  private inline fun debug(msg: () -> String) {
    if (isDebug) System.err.println(msg())
  }

  private fun debug(a: LongArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: IntArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: BooleanArray) {
    debug { a.map { if (it) 1 else 0 }.joinToString("") }
  }

  private fun debugDim(A: Array<LongArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }
  private fun debugDim(A: Array<IntArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }

  /**
   * 勝手にimport消されるのを防ぎたい
   */
  private fun hoge() {
    min(1, 2)
    max(1, 2)
    abs(-10)
  }
}

fun main() {
  val out = java.io.PrintWriter(System.out)
  Solver(System.`in`, out).solve()
  out.flush()
}

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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define IMP cout << "IMPOSSIBLE" << endl
#define Imp cout << "Impossible" << endl
#define imp cout << "impossible" << endl
#define M1 cout << "-1" << endl
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

template <typename T>
ostream &operator<<(ostream &os, vector<T> &v)
{
    os << "{";
    rep(i, v.size()) os << v[i] << (i == (int)v.size() - 1 ? "" : ", ");
    os << "}";
    return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &p)
{
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}
template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }
struct in
{
    const size_t n = 0;
    in() = default;
    in(size_t n) : n(n){};
    template <typename T>
    operator T()
    {
        T ret;
        cin >> ret;
        return ret;
    }
    template <typename T>
    operator vector<T>()
    {
        assert(n != 0);
        vector<T> ret(n);
        for (auto &x : ret)
            cin >> x;
        return ret;
    }
};

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using vpint = vector<pint>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    ll n = in(), x = in();
    vll a(n + 1, 0);
    rep(i, n) cin >> a[i + 1];

    ll ans = 0;
    rep(i, n)
    {
        ll tmp = a[i] + a[i + 1];
        a[i + 1] -= max(tmp - x, (ll)0);
        ans += max(tmp - x, (ll)0);
    }
    cout << ans << endl;
}

signed main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main() {
	int a, b;

	cin >> a >> b;

	int ans = 0;
	for (int i = b - a - 1; i > 0; i--) {
		ans += i;
	}
	ans -= a;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string n;
  cin >> n;
  if ((n.at(0) == n.at(1) && n.at(1) == n.at(2)) || (n.at(1) == n.at(2) && n.at(2) == n.at(3))) {
  	cout << "Yes\n";
  }else {
  	cout << "No\n";
  }
}

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

using namespace std;

#define Whats(x) cout<<#x<<" is "<<(x)<<endl
#define DivHim() cout<<">>>>>>>>>>>>>>>"<<endl
#define DivHer() cout<<"<<<<<<<<<<<<<<<"<<endl
#define Oops() cout<<"!!!!!!!!!!!!!!!"<<endl

template<typename T> void GetMin(T &a,T b)
{
	a=((a<b)?a:b);
}

template<typename T> void GetMax(T &a,T b)
{
	a=((a>b)?a:b);
}

/*
	 -<Unlimited Blade Works>-
 */

const int N=2e5+10;

int n,m,cnt[N][2];
char s[N];
vector<int> G[N];
bool ban[N];

int main()
{
	scanf("%d%d%s",&n,&m,s+1);
	for(int i=1;i<=n;++i)
		s[i]-='A';
	for(int i=1,u,v;i<=m;++i)
	{
		scanf("%d%d",&u,&v);
		G[u].emplace_back(v);
		G[v].emplace_back(u);
		++cnt[u][s[v]];
		++cnt[v][s[u]];
	}
	queue<int> Q;
	for(int i=1;i<=n;++i)
		if(!cnt[i][0]||!cnt[i][1])
		{
			Q.push(i);
			ban[i]=true;
		}
	while(!Q.empty())
	{
		int u=Q.front();
		Q.pop();
		for(int v:G[u])if(!ban[v]&&!(--cnt[v][s[u]]))
		{
			Q.push(v);
			ban[v]=true;
		}
	}
	for(int i=1;i<=n;++i)if(!ban[i])
		return puts("Yes"),0;
	puts("No");
	return 0;
}


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


using namespace std;

int main()
{
	int n;
	cin>>n;
	int a[n],b[n],c[n];
	int dp[n][3];
	//ADD THIS ********
			for(int i = 0;i < n; i++) // ADDED
				for(int j = 0; j < 3; j++) // ADDED
					dp[i][j] = INT_MIN; // ADDED
	//*****************
	for(int i = 0;i < n ;i++)
		cin>>a[i]>>b[i]>>c[i]; // happiness points available on each day 
	// for(int i = 0;i<n;i++)
	// 	cout<<a[i]<<" "<<b[i]<<" "<<c[i]<<'\n';
	for(int i = 0;i < n;i++)
	{
		for(int j = 0;j < 3;j++)
		{
			if(i == 0)		//base case
			{
				if(j == 0)
					dp[i][j] = a[i];
				else if(j == 1)
					dp[i][j] = b[i];
				else 
					dp[i][j] = c[i];
			}
			else
			{
				for(int k = 0;k < 3;k++)		//k means previous activity and j is present activity
				{
					if(j == k) 
						continue;
					else if(j == 0)
						dp[i][j] = max(dp[i][j] , dp[i-1][k] + a[i]);
					else if(j == 1)
						dp[i][j] = max(dp[i][j] , dp[i-1][k] + b[i]);
					else if(j == 2) 
						dp[i][j] = max(dp[i][j] , dp[i-1][k] + c[i]);
				}
			}
		}
	}
	cout<<max(dp[n-1][0] , max(dp[n-1][1] , dp[n-1][2]))<<'\n';
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
    using namespace std;
    using ll = long long;
    using vi = vector<int>;
    using vi2 = vector<vector<int>>;
    using vb = vector<bool>;
    using vb2 = vector<vector<bool>>;
    using vc = vector<char>;
    using vc2 = vector<vector<char>>;
    using vs = vector<string>;
    using si = set<int>;
    using vs2 = vector<vector<string>>;
    using pii = pair<int, int>;
    using mii = map<int, int>;
    const int INF = 1e9;
    const ll LINF = 1e18;
    #define MP(a,b) make_pair((a),(b))
    #define MT(...) make_tuple(__VA_ARGS__)
    #define sz(x) (int)(x).size()
     
    #define FOR(i,a,b) for(int i=(a);i<(b);++i)
    #define REP(i,x) for(int i=0;i<(int)(x);i++)
    #define REPS(i,x) for(int i=1;i<=(int)(x);i++)
    #define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
    #define RREPS(i,x) for(int i=((int)(x));i>0;i--)
     
    #define ALL(x) (x).begin(),(x).end()
    #define IN(type,a) type a;cin >> a;
    #define VIN(type,a,n) vector<type> a(n);cin >> a;
    #define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
    #define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;
    #define COUT(x) cout << (x) << endl;
    #define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl;
    template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
    {REP(j,sz(v))i>>v[j];return i;}
    template<typename T>
    T gcd(T x, T y){
        if ((x==1)||(y==1)) return 1;
        if (x>y) {
            if (x%y==0) {
                return y;
            }else{
                return gcd(y, x%y);
            }
        }else{
            if (y%x==0) {
                return x;
            }else{
                return gcd(x, y%x);
            }
        }
    }  
    int main() {
        ll a,b,c;
      cin >> a >> b >> c;
      if(a==0){
      	if(b==0){
			COUT(1);
        }else{
          COUT(b/c+1);
        }
      }else {
      COUT(b/c-(a-1)/c);
      }
    }

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

int main(void) {
int X, Y;
cin >> X >> Y;
  
  if(Y%2==0){
	if(Y/2-X>=0){
    	if(2*X-Y/2>=0){
           cout << "Yes" << endl;
        }
        else if(2*X-Y/2<0){
  		cout << "No" << endl;
    	}
    }
    else if(Y/2-X<0){
  	cout << "No" << endl;
  	}
  }
  else{
  cout << "No" << endl;
  }
}

  
  

Measured memory_bytes: 3632
N=int(input())

nums=[]
all=set(['3','5','7'])
def dfs(x):
  if x>N:
    return
  if x>=357:
    if len(all-set(list(str(x))))==0:
      nums.append(x)
  for i in (3,5,7):
    dfs(x*10+i)

dfs(0)
print(len(nums))

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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
ostream &operator<<(ostream &os, pair<ll, ll>&p){
  return os << p.first << " " << p.second;
}  
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll h;cin>>h;
  ll num=1;
  while(h>=1){
    res+=num;
    h/=2;
    num*=2;
  }
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 256
MAX = 300000001

N, K = map(int, input().split())
xn = [int(i) for i in input().split()]


def main():
    if 0 < xn[0]:
        print(xn[K - 1])
        return

    if xn[N - 1] < 0:
        print(abs(xn[N - K]))
        return

    ans = MAX

    for i in range(N - K + 1):
        if xn[i + K - 1] < 0 and i + K <= N - 1 and 0 < xn[i + K]:
            ans = min(ans, abs(xn[i]))

        elif 0 < xn[i]:
            if 0 != i:
                if xn[i - 1] < 0:
                    ans = min(ans, abs(xn[i + K - 1]))
                else:
                    break

        elif 0 <= xn[i + K - 1]:
            ans = min(ans,
                      2 * abs(xn[i]) + abs(xn[i + K - 1]),
                      abs(xn[i]) + 2 * abs(xn[i + K - 1]))

    print(ans)
    return


main()


Measured memory_bytes: 14664
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <new>

using namespace std;

typedef long long ll;

#define rep(i, N) for (ll i = 0; i < (ll)(N); ++i)

const ll inf = 1e18+7;
const ll mod = 1e9+7;

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

	for(ll i=1;i<n;i++){
		if(H[i-1]>=H[i]){
			sum++;
		}else sum=0;
		ans = max(ans,sum);
	}
	cout << ans << endl;
	return 0;

}

Measured memory_bytes: 1024