akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
#define int long long
int cnt[9] = {};

string dlt(string s, int p){
	s[p] = NULL;
	s[p + 1] = NULL;
	for (int i = p + 2; i < s.length(); i++){
		s[i - 2] = s[i];
		s[i] = NULL;
	}
	return s;
}

string goriosi(string s){
	for (int i = 0; i < s.length(); i++){
		if (s[i] == '('&&s[i + 1] == ')'){
			s = dlt(s, i);
			i -= 1;
		}
	}
	return s;
}
signed main(){
	int N;
	string s;
	string stmp;
	cin >> N >> s;
	stmp = s;
	s = goriosi(s);
	s = goriosi(s);
	s = goriosi(s);
	s = goriosi(s);
	s = goriosi(s);
	s = goriosi(s);
	s = goriosi(s);
	s = goriosi(s);
	s = goriosi(s);
	s = goriosi(s);
	s = goriosi(s);
	s = goriosi(s);
	s = goriosi(s);

	
	for (int i = 0; i < s.length(); i++){
		if (s[i] == '(') stmp = stmp + ')';
		if (s[i] == ')') stmp = '(' + stmp;
	}
	cout << stmp << endl;
}



Measured memory_bytes: 256
use std::io::{stdin, Read};
use std::str::FromStr;

// https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[allow(dead_code)]
fn main() {
    let a = read::<usize>();
    let b = read::<usize>();
    let c = read::<usize>();

    let mut v = vec![a, b, c];
    v.sort();
    let mut a = v[0];
    let mut b = v[1];
    let c = v[2];

    let mut ans = 0;
    ans += (c - a) / 2;
    ans += (c - b) / 2;
    a += ((c - a) / 2) * 2;
    b += ((c - b) / 2) * 2;

    let mut v = vec![a, b, c];
    v.sort();

    let mut a = v[0];
    let mut b = v[1];
    let mut c = v[2];

    c -= a;
    b -= a;
    a -= a;

    match (a, b, c) {
        (0, 0, 0) => println!("{}", ans),
        (0, 0, 1) => println!("{}", ans + 1),
        (0, 1, 1) => println!("{}", ans + 2),
        _ => panic!("{} {} {}", a, b, c),
    }
}


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

int main()
{
    int a, b, c, ans;
    cin >> a >> b >> c;
    if (a == b)
    {
        ans = c;
    }
    else if (b == c)
    {
        ans = a;
    }
    else if (c == a)
    {
        ans = b;
    }
    cout << ans << "\n";
    return 0;
}


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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
ll MOD = 1e9+7;
ll INF = 1e18;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }

int main(){
  ll i, j;
  // ll a, b;
  ll n;
  cin >> n;
  string s; cin >> s;
  ll result = 0;
  bool judge = true;
  vector<ll> a(30);
  vector<ll> b(30);
  ll count;
  for(i = 0; i < n;i++){
    for(j = 0; j < 30; j++){
      a[j] = 0; b[j] = 0;
    }
    for(j = 0; j < i; j++){
      a[s[j]-'a']=1;
    }
    for(j = i, count = 0; j < n; j++){
      b[s[j]-'a']=1;
    }
    for(j = 0; j < 30; j++){
      if(a[j] == 1 && b[j] == 1){
      count++;
      }
    }
    //cout << count spa i << endl;
    chmax(result, count);
  }
  cout << result << endl;

  /*
  vector<ll> a(n);
  for(i = 0; i < n; i++)
    cin >> a[i];
  //for(i = 0; i < n; i++)
  */
  
  /*
  if(judge)
    //cout << "Yes" << endl;
    //cout << "YES" << endl;
    //cout << "Yay!" << endl;
  else
    //cout << "No" << endl;
    //cout << "NO" << endl;
    //cout << ":(" << endl;
  */
  
  //cout << result << endl;

  return 0;
}

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

#define for_(i,a,b) for(int i=a;i<b;++i)
#define ALL(a) a.begin(),a.end()
#define INIT(a,b) memset(a,b,sizeof(a))
using lint = long long int;

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

    vector<int> a(N);
    for_(i,0,N) cin >> a[i];

    int A = 0;
    for_(i,0,N) A ^= a[i];

    for_(i,0,N) cout << (A ^ a[i]) << (i < N-1 ? " " : "\n");
}

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

using namespace std;

#define DUMP(x) std::cout << (#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 puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")

using ll = std::int64_t;
using vint = std::vector<std::int32_t>;
using vll = std::vector<ll>;
using vstr = std::vector<std::string>;
using pint = std::pair<std::int32_t, std::int32_t>;
using usetint = std::unordered_set<std::int32_t>;
using usetstr = std::unordered_set<std::string>;

constexpr std::int32_t INF = 1001001001;

struct s {
    int a, b, c, d;
};

void Main() {
    int h, w;
    cin >> h >> w;
    vector<vector<int>> a(h, vint(w));
    rep(i, h)rep(j, w)cin >> a[i][j];

    vector
 ans;

    rep(i, h) {
        rep(j, w) {
            if (a[i][j] % 2 == 1) {
                if (j == w - 1) {
                    // 右端
                    if (i != h - 1) {
                        ++a[i + 1][j];
                        ans.push_back({ i, j , i + 1, j });
                        continue;
                    }
                }
                else {
                    ++a[i][j + 1];
                    ans.push_back({ i, j, i, j + 1 });
                    continue;
                }
            }
        }
    }

    cout << ans.size() << endl;
    for (const auto& x : ans) {
        cout << x.a + 1 << " " << x.b + 1 << " " << x.c + 1 << " " << x.d + 1 << "\n";
    }
}

int 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: 5236
#include <bits/stdc++.h>
using namespace std;

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)+1):((m)-(n)+1)),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

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

int main() {

more:
  int a,b,c; cin >> a >> b >> c;
  if (!a && !b && !c) return 0;

  int A = a * a;
  int B = b * b;
  int C = c * c;
  int CHOCKEY2 = min(A+B, min(A+C, B+C));

  int n; cin >> n;
  rep(_, n) {
    int r; cin >> r;
    if (4 * r * r > CHOCKEY2) {
      cout << "OK" << endl;
    } else {
      cout << "NA" << endl;
    }
  }

  goto more;
}

Measured memory_bytes: 1148
//Author : Ayush Jain

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define mod 1000000007

int main()
{
	ios_base::sync_with_stdio(false);
	int n,i,k,foo,gcd,mx=-1;
	cin>>n>>k;
	for(i=0;i<n;i++){
		cin>>foo;
		mx=max(mx,foo);
		if(i==0) gcd=foo;
		else gcd=__gcd(gcd,foo);
	}
	if(k%gcd==0 && k<=mx) cout<<"POSSIBLE\n";
	else cout<<"IMPOSSIBLE\n";	


	return 0;
}

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

int main() {
  vector <int> v(5);
  for (int i = 0; i < 5; i++) cin >> v[i];
  int K;
  cin >> K;

  for (int i = 0; i < 5; i++) {
    for (int j = i + 1; j < 5; j++) {
      if (K < v[j] - v[i]) {
        cout << ":(" << endl;
        return 0;
      }
    }
  }
  cout << "Yay!" << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

main(){
  int h, i;
  int *A;

  scanf("%d", &h);
  A = malloc(sizeof(int) * (h+1));
  for(i=1; i<=h; i++) scanf("%d", A+i);

  for(i=1; i<=h; i++){
    printf("node %d: key = %d, ", i, A[i]);
    if(i!=1) printf("parent key = %d, ", A[(i)/2]);
    if(i*2 <= h) printf("left key = %d, ", A[i*2]);
    if(i*2 < h) printf("right key = %d, ", A[i*2+1]);
    printf("\n");
  }

  free(A);
  return 0;
}

Measured memory_bytes: 600
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict

con = 10 ** 9 + 7
#入力受け取り
def getlist():
	return list(map(int, input().split()))

class Combination(object):
	def __init__(self, N, con):
		self.fac = [0] * (N + 1)
		self.inv = [0] * (N + 1)
		self.finv = [0] * (N + 1)
		self.fac[0], self.fac[1] = 1, 1
		self.inv[1] = 1
		self.finv[0], self.finv[1] = 1, 1

		# 前計算
		for i in range(2, N + 1):
			self.fac[i] = self.fac[i - 1] * i % con
			self.inv[i] = self.inv[con % i] * (con - (con // i)) % con
			self.finv[i] = self.finv[i - 1] * self.inv[i] % con

	def com(self, N, k):
		return (self.fac[N] * self.finv[k] * self.finv[N - k]) % con

#処理内容
def main():
	N = int(input())
	A = getlist()
	x = 0
	y = 0
	D = defaultdict(lambda: -1)
	for i in range(N + 1):
		if D[A[i]] == -1:
			D[A[i]] = i
		else:
			x = D[A[i]]
			y = i
			break
	n = y - x
	if N - n == 0:
		C1 = Combination(N + 1, con)
		print(C1.com(N + 1, i) - 1)
		for i in range(2, N + 2):
			print(C1.com(N + 1, i))
	else:
		C1 = Combination(N + 1, con)
		C2 = Combination(N - n, con)
		for i in range(1, N - n + 2):
			print((C1.com(N + 1, i) - C2.com(N - n, i - 1)) % con)
		for i in range(N - n + 2, N + 2):
			print(C1.com(N + 1, i))

if __name__ == '__main__':
	main()

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

int main() {
	int N;
	cin >> N;
  vector<int> h(N);
  rep(i,N) cin >> h[i];
  int ans = 0;

  while(1){
    int start = N;
    int end = 0;

    rep(i,N){
      if(start != N && h[i] == 0) break;
      if(h[i] != 0){
        start = min(start,i);
        end = max(end,i);
      }
    }

    if(start>end) break;

    for(int i = start;i<=end;i++){
      h[i]--;
    }
    ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())
#define endl "\n"

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b=mod-2,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
    oreno_initializer() {
        cin.tie(0);
        ios::sync_with_stdio(0);
    }
} oreno_initializer;



int n, k, a[55], res = 0;

signed main() {
    cin >> n >> k;
    rep(i,n) cin >> a[i];
    rep(t,k+1) if (t<=n) rep(l,t+1) {
        int r = t-l, d = min(k-t, t);
        vector<int> b;
        rep(i,l) b.push_back(a[i]);
        rep(i,r) b.push_back(a[n-i-1]);
        sort(b.rbegin(), b.rend());
        while (d--) {
            if (b.back()<0) b.pop_back();
            else break;
        }
        chmax(res, accumulate(all(b), 0));
    }
    cout << res << endl;
}

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

template <class T>
inline void read(T &x) {
    x = 0;
    char c = getchar();
    bool f = 0;
    for (; !isdigit(c); c = getchar()) f ^= c == '-';
    for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
    x = f ? -x : x;
}

template <class T>
inline void write(T x) {
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    T y = 1;
    int len = 1;
    for (; y <= x / 10; y *= 10) ++len;
    for (; len; --len, x %= y, y /= 10) putchar(x / y + 48);
}

const int MAXN = 1e5;
int n, maxn, a[MAXN + 5];

int main() {
	read(n);
	for (int i = 1; i <= n; ++i) {
		read(a[i]);
		if (maxn - a[i] > 1) {
			puts("No");
			return 0;
		}
		maxn = max(maxn, a[i]);
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep3(i, l, n) for (int i = l; i < n; ++i)
#define chmax(a, b) a = (a >= b ? a : b)
#define chmin(a, b) a = (a <= b ? a : b)
#define out(a) cout << a << endl
#define outa(a, n) rep(_, n) cout << a[_] << " "; cout << endl
#define SZ(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
#define FIX(a) fixed << setprecision(a)

int main() {
    int n;
    cin >> n;
    vector<int> v(2 * n);
    rep(i, 2 * n) cin >> v[i];
    sort(all(v), greater<int>());
    int ans = 0;
    for (int i = 0; i < 2 * n; i += 2) {
        ans += v[i + 1];
    }
    out(ans);
}


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

using namespace std;

typedef unsigned long long ll;
typedef pair<int,int> ii;
typedef vector<pair<int,int> > vii;
typedef vector<vii> vvii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;

int INF = std::numeric_limits<int>::max();
int NINF = std::numeric_limits<int>::min();
int MOD = 1e9+7;

int col[] = {0,-1,0,1,1,1,-1,-1};
int row[] = {-1,0,1,0,1,-1,1,-1};

//knight moves
int cc[] = {1,2,2,1,-1,-1,-2,-2};
int rr[] = {-2,-1,1,2,-2,2,1,-1};

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

    int n;
    cin >> n;

    vvll points(n,vll(3,0));
    ///if the path was needed, just remove the comments
    //vvc path(n,vc(3));

    //char maxAB, maxBC, maxAC;
    //path[0][0] = 'a', path[0][1] = 'b', path[0][2] = 'c';

    for(int i = 0 ; i < n ; ++i)
    {
        cin >> points[i][0] >> points[i][1] >> points[i][2];

        //maxAB = points[i][0] > points[i][1]? 'a' : 'b';
        //maxBC = points[i][1] > points[i][2]? 'b' : 'c';
        //maxAC = points[i][0] > points[i][2]? 'a' : 'c';

        if(i > 0)
        {
            points[i][0] += max(points[i-1][1],points[i-1][2]);
            //path[i][0] = maxBC;

            points[i][1] += max(points[i-1][0],points[i-1][2]);
            //path[i][1] = maxAC;

            points[i][2] += max(points[i-1][1],points[i-1][0]);
            //path[i][2] = maxAB;
        }
    }

    ll maxPath = 0, maxI;
    for(int i = 0 ; i < 3 ; ++i)
        if(points[n-1][i] > maxPath)
        maxI = i, maxPath = points[n-1][i];

    cout << points[n-1][maxI] << endl;

    //for(int i = 0 ; i < n ; ++i)
        //cout << path[i][maxI] << " ";

    return 0;
}


Measured memory_bytes: 8720
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  int n;
  cin >> n;
  bool y = false;
  rep(i, n) {
    char c;
    cin >> c;
    if(c == 'Y') y = true;
  }
  cout << (y ? "Four" : "Three") << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		long[] a=new long[n];
		long[] b=new long[n];
		for(int i=0; i<n; i++){
			a[i]=sc.nextLong();
		}
		for(int i=0; i<n; i++){
			b[i]=sc.nextLong();
		}
		long[] fig=new long[29];
		long ans=0;
		for(int i=0; i<30; i++){
			long t=1<<i;
			long count=0;
			long[] aa=new long[n];
			long[] bb=new long[n];
			for(int j=0; j<n; j++){
				aa[j]=a[j]%(2*t);
				bb[j]=b[j]%(2*t);
			}
			Arrays.sort(bb);
			for(int k=0; k<n; k++){
				count+=lowerBounds(bb,2*t-aa[k])-lowerBounds(bb,t-aa[k]);
				count+=n-lowerBounds(bb,3*t-aa[k]);
			}
			ans|=(count & 1)<<i;
		}
		System.out.println(ans);
	}
	public static int lowerBounds(long[] arr,long value){
	int low=0;
	int high=arr.length;
	int mid;
	while(high-low>0){
		mid=(high+low)/2;
		if(arr[mid]<value){
			low=mid+1;
		}else{
			high=mid;
		}
	}
	return low;
}
}


Measured memory_bytes: 157008
#include <stdio.h>
int main(void){
  int x,y,work,zan;
  scanf("%d %d",&x,&y);

  if(x<y){
    work=x;
    x=y;
    y=work;
  }

  zan=x%y;

  while(zan!=0){
    x=y;
    y=zan;
    zan=x%y;
  }

  printf("%d\n",y);
  return 0;
}

Measured memory_bytes: 592
#include<stdio.h>
#include<stdio.h>

int queue[2000001];
int H=0;

void swap(int *a, int *b){
	int tmp;
	tmp=*a;
	*a=*b;
	*b=tmp;
}

void downMaxHeapify(int A[],int i){
	int largest=i;
	int l=2*i;
	int r=2*i+1;
	if(l<=H && A[l]>A[largest]){
		largest=l;
	}
	if(r<=H && A[r]>A[largest]){
		largest=r;
	}
	if(largest!=i){
		swap(&(A[i]),&(A[largest]));
		downMaxHeapify(A,largest);
	}
}

void upMaxHeapify(int A[],int i){
	if(i!=1){
		int largest=i;
		int parent=i/2;
		int pair=i%2==0?i+1:i-1;
		if(A[parent]>A[largest]){
			largest=parent;
		}
		if(pair<=H && A[pair]>A[largest]){
			largest=pair;
		}
		if(largest!=parent){
			swap(&(A[parent]),&(A[largest]));
			upMaxHeapify(A,parent);
		}
	}
}

void insert(int S[],int k){
	S[H+1]=k;H++;
	upMaxHeapify(S,H);
}

int extractMax(int S[]){
	int tmp=S[1];
	S[1]=S[H--];
	downMaxHeapify(S,1);
	return tmp;
}

int main(void){
	char command[10];
	int data;
	int i;
	scanf("%s" ,command);
	while(strcmp(command,"end")!=0){
		if(strcmp(command,"insert")==0){
			scanf("%d",&data);
			insert(queue,data);
		}
		if(strcmp(command,"extract")==0){
			printf("%d\n",extractMax(queue));
		}
		if(strcmp(command,"d")==0){
			for(i=1;i<=H;i++){
				printf("%d ",queue[i]);
			}printf("\n");
		}
		scanf("%s",command);
	}
	return 0;
}
	

Measured memory_bytes: 4692
#if _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;

#ifndef ONLINE_JUDGE 
const bool DEBUG = true;
#else
const bool DEBUG = false;
#endif

// Reads a 1D vector
template <class T>
void read1d(vector<T> & arg) {
	const int l = arg.size();
	for (int i = 0; i < l; ++i) cin >> arg[i];
}

void read() {}
// Reads arbitrary values
template <class T1, class... T2>
void read(T1& var1, T2&... var2) { cin >> var1; read(var2...); }



void pln() { cout << (DEBUG ? "]\n" : "\n"); }
template <class T1, class... T2>
void pln(const T1& var1, const T2& ... var2) { cout << var1 << " "; pln(var2...); }

// Prints arbitrary values and goes to next line
template <class T1, class... T2>
constexpr void print(const T1& var1, const T2& ... var2) { cout << (DEBUG ? " [ " : ""); pln(var1, var2...); }

// Prints arbitrary values and goes to next line ONLY IF IN DEBUG MODE
template <class T1, class... T2>
constexpr void debug(const T1& var1, const T2& ... var2) { if (!DEBUG) return;  cout << " debug : [ "; pln(var1, var2...); }





using ll = long long;
using ull = unsigned long long;


#define all(x) begin(x), end(x)

const bool MULTIPLE_TEST_CASES = 0;


void exec() 
{
	string s;
	cin >> s;
	if (s.back() == 's') cout << s << "es";
	else cout << s << "s";
}

















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

	if (!MULTIPLE_TEST_CASES)
		exec();
	else {
		int n;
		cin >> n;

		while (n--)
			exec();
	}

    return 0;
}

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

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
#define u_b upper_bound
#define l_b lower_bound


signed main() {
    int N;
    int P[50];
    cin >> N;
    int cnt = 0;
    rep(i, N) {
        cin >> P[i];
        if (P[i] != i + 1)cnt++;
    }
    if (cnt == 0 || cnt == 2) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}


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

int main()
{
	int x, y;
	cin>>x>>y;
	cout << x / y << ' ' << x % y << ' ';
	double d_x = x;
	double d_y = y;
	cout << fixed << setprecision(6) << d_x / d_y << endl;
	return 0;

}


Measured memory_bytes: 3292
#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
using lint=long long;
using ld=long double;
int main(){
    std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
    std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
    lint n;std::cin>>n;
    std::vector<std::pair<lint,lint>>a(n);
    for(auto&&p:a)std::cin>>p.first>>p.second;
    ld ans=0;
    for(lint i=0;i<n;i++){
        for(lint j=i+1;j<n;j++){
            ans+=std::hypot(a.at(i).first-a.at(j).first,a.at(i).second-a.at(j).second);
        }
    }
    std::cout<<ans*2/n<<'\n';
}

Measured memory_bytes: 256
def main():
    A, B, K = list(map(int, input().split()))
    if K <= A:
        A = A - K
    else:
        B = B - (K - A)
        A = 0

    if A < 0:
        A = 0
    if B < 0:
        B = 0
    return(A, B)

if __name__ == '__main__':
    A, B = main()
    print(A, B)

Measured memory_bytes: 3060
nm = input()
n, m = map(int, nm.split())

a = []

for _ in range(n):
    ai = list(map(int, input().split()))
    a.append(ai)
b = []
for _ in range(m):
    bi = int(input())
    b.append(bi)

c = []
for i in range(n):
    d = 0
    for j in range(m):
        d += a[i][j] * b[j]
    c.append(d)
for j in c:
    print(j)


Measured memory_bytes: 6012
import java.util.Scanner;
import java.util.ArrayList;
import java.util.List;

public class Main {
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        System.out.println((a + b) % 24);
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formax=(b);i>=i##formax;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define bitComb(a,n,k) for(int a##x,a##y,a=(1<<k)-1;a<(1<<n);a##x=a&-a,a##y=a+a##x,a=(((a&~a##y)/a##x)>>1)|a##y)
#define uniq(v) sort(all(v));v.erase(unique(all(v)), v.end())
#define bit(n) (1LL<<(n))
#define randInt(l,r) (uniform_int_distribution<ll>(l,r)(rnd))
#define randDouble(l,r) (uniform_real_distribution<double>(l,r)(rnd))
#define dout(d) printf("%.12f\n",d)

typedef long long ll;
typedef __int128_t lll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>ostream& operator<<(ostream& o,const pair<T,Y>& p){return o<<"("<<p.fi<<", "<<p.se<<")";}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return (x%m+m)%m;}
ll modPow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const double PI = acos(-1);
const double EPS = 1e-10;
static random_device rd;
static mt19937 rnd(rd());

const int N = 1e5;
int a, b;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> a >> b;
  cout << --a*--b << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int ll
#define pb push_back
#define setbits(x)          __builtin_popcountll(x)
#define endl "\n"
typedef long long ll;
void solve()
{
 int n;
 cin>>n;
 string str;
 cin>>str;
      int r=0;
      int w=0;
      for(int i=0;i<n;i++)
      {
          if(str[i]=='R')
            r++;
          else
            w++;
      }
      int ans=0;
      for(int i=0;i<r;i++)
      {
          if(str[i]=='W')
            ans++;
      }
      cout<<ans<<endl;

}
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
solve();
    return 0;
}


Measured memory_bytes: 3772
#include<iostream>
#include<algorithm>
#include<string>

using namespace std;

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 2100100100;
// const int MOD = 1e9 + 7;

int main() {
    int N, M;
    cin >> N >> M;
    vector<ll> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
    }
    ll sum = accumulate(ALL(A), 0LL);

    int cnt = 0;
    for (int i = 0; i < N; i++) {
        if (sum <= A[i] * 4 * M) cnt++;
    }
    if (cnt >= M) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
}


Measured memory_bytes: 256
using System;
using System.Text;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
using System.IO;

class Solve
{
	const int mod = 1000000007;
	static void Main(string[] args)
	{
		var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
		Console.SetOut(sw);

		var p = Console.ReadLine().Split().Select(int.Parse).ToArray();
		Console.WriteLine(Math.Min(p[2], p[0] * p[1]));

		Console.Out.Flush();
	}
}

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

using namespace std;
typedef long long ll;
ll t , n ,k, x , y , z , a , b , cntr , sum ;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n ;
    int arr[n];
    for(int i = 0 ; i < n ; i++)
    {
        cin >> arr[i];
    }
    ll l =0, r=0;
    ll ans=0;
    while(r<n-1)
    {
        if(arr[r+1]<=arr[r])
        {
            r++;
            ans=max(ans , r-l);
        }
        else
        {
            l=r+1;
            r=r+1;
        }
    }
    ans=max(ans,r-l);
    cout << ans;
    return 0;
}


Measured memory_bytes: 640
//R<3S
#include <bits/stdc++.h>
#define hell 1000000007
#define PI 3.14159265358979323844
#define mp make_pair
#define pb push_back
#define fi first 
#define se second
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))  
#define REVERSE(v) reverse(ALL(v))
#define endl "\n"
#define vecmax(v) max_element(all(v))
#define vecmin(v) min_element(all(v))
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(x) for(auto i : x)
#define sz(a) (int)a.size()
#define sl(a) (int)a.length()
#define int long long
#define ld long double 
#define pii std::pair<int, int> 
#define pll std::pair<ll, ll>  
#define vi vector<int>  
#define vl vector<ll>
#define vvi vector<vi > 
#define vii vector<pii >
#define mii map<int,int>
#define mll map<ll,ll>


using namespace std;

void solve()
  {
	int n,w;
	cin>>n>>w;
	int wt[n],val[n];
	rep(i,n)cin>>wt[i]>>val[i];
	int dp[w+1];
	memset(dp,0,sizeof dp);
	
	rep(i,n)
	{
		repD(j,w,wt[i])
		{
			dp[j]=max(dp[j],dp[j-wt[i]]+val[i]);
			// cout<<"dp "<<j<<" : "<<dp[j]<<endl;
		}
	}
	// long long best = 0;
	// for(int i = 0;i<=w;i++) best = max(best,dp[i]);
	cout << dp[w] << endl;
	
	


  }



signed main()
{
   std::ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
   int t;
   t=1;
   //cin>>t;
   while(t--)
    {
        solve();
    }


   return 0;
}


Measured memory_bytes: 4428
#include <iostream>
#include <string>

using namespace std;

int main(void) {
    string a, b;
    cin >> a >> b;

    if (a>b) {
        cout << ">" << endl;
    } else if (a<b) {
        cout << "<" << endl;
    } else {
        cout << "=" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
N = int(input())
S = input()

result = 0

S1 = S[:N]
S2 = S[N:][::-1]

def calc(s, x):
    s1 = ""
    s2 = ""
    for c in s:
        if x & 1:
            s1 += c
        else:
            s2 += c
        x >>= 1
    return s1, s2

from collections import defaultdict

kv = defaultdict(int)

for i in range(2**N):
    kv[calc(S2, i)] += 1

for i in range(2**N):
    result += kv[calc(S1, i)]

print(result)



Measured memory_bytes: 166776
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif


using namespace std;
using ll = long long;

const ll MOD = 1000000007;
const ll INF = 1e18;
const double pi = acos(-1);
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1,1,0,-1,-1,-1,0,1};
const int dy8[8] = {0,1,1,1,0,-1,-1,-1};


#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()


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




void solve(){
    
    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n; cin >> n;
    double m; cin >> m;
    vector<double> A(n); rep(i,n) cin >> A[i];
    
    double allVote = 0;
    rep(i,n){
        allVote += A[i];
    }
    sort(A.begin(), A.end(), greater<int>());
    int countGoodV = 0;
    for (int i = 0; i < n; i++) {
        double RATIO = 1/(4*m);
        if(A[i]/allVote >= RATIO){
            countGoodV++;
        }
    }
    if(countGoodV>=m) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    
}



signed main() {
    solve();
    return 0;
}



Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <string>
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>

using namespace std;

void SolveC()
{
	vector<vector<int>> c;
	c.resize(3);
	for (int i = 0; i < 3; i++)
	{
		c[i].resize(3);
	}
	for (int i = 0; i < 3; i++)
	{
		scanf("%d %d %d", &c[i][0], &c[i][1], &c[i][2]);
	}

	vector<int> x;
	vector<int> y;
	x.resize(3, 0);
	y.resize(3, 0);

	for (int i = 0; i < 3; i++)
	{
		y[i] = c[0][i] - x[0];
	}
	for (int i = 0; i < 3; i++)
	{
		x[i] = c[i][0] - y[0];
	}

	bool flag = true;
	for (int i = 0; i < 3; i++)
	{
		for (int j = 0; j < 3; j++)
		{
			if (x[i] + y[j] != c[i][j])
			{
				flag = false;
			}
		}
	}

	if (flag)
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
}

int main()
{
	SolveC();
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main()
{
	int n, inf = 1000000000;
	scanf("%d", &n);
	vector<int> a(n, inf);
	for(int i = 0, j; i < n; ++i)
	{
		scanf("%d", &j);
		*lower_bound(a.begin(), a.end(), j) = j;
	}
	printf("%ld\n", distance(a.begin(), lower_bound(a.begin(), a.end(), inf)));
}



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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

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

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

int main(){
    string s;
    cin >> s;
    vi a(4);
    rep(i, 4) a[i] = s[i] - '0';
    rep(i, 8) {
        int sum = a[0];
        string f = { s[0] };
        rep(j, 3) {
            if (i&(1<<j)) {
                sum += a[j+1];
                f += '+';
            }
            else {
                sum -= a[j+1];
                f += '-';
            }
            f += s[j+1];
        }
        f += "=7";
        if (sum == 7) {
            cout << f << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

const int mod = 1e9+7;
const int A = 26;
int ct[A];

int main(){
    int n;
    string s,t;
    cin >>n >>s >>t;

    int dp = 1;
    ct[s[0]-'a']++;

    for(int i=1; i<n; ++i){
        dp = ct[t[i]-'a'];
        (ct[s[i]-'a'] += dp) %= mod;
    }

    cout << dp << endl;
    return 0;
}



Measured memory_bytes: 3324
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var N = F;
		var p = new List<int>();
		for (var i = 0; i < N; i++) p.Add(F);
		WriteLine(p.Sum() - p.Max() / 2);
	}
}


Measured memory_bytes: 11220
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
 
#define  rep(i, n) for(int i = 0; i < (int)(n);    i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i>=0; i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

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; }
typedef long long ll;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }


int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  int N; std::cin >> N;
  std::vector<ll> H(N); rep(i,N) std::cin >> H[i];

  int ans = -1;
  int cnt = 0;
  rep(i,N){
    if ( i == 0 ) cnt = 0;
    else {
      if ( H[i] <= H[i-1] ) cnt++;
      else {
        ans = std::max(ans, cnt);
        cnt = 0;
      }
    }
    if ( i == N-1 ) {
      ans = std::max(ans,cnt);
    }
  }
  std::cout << ans << std::endl;
  return 0;
}


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

#define pb push_back
#define mp make_pair

#define fi first
#define se second

using namespace std;

typedef long long ll;

const int N = 2e5 + 10;

int n;
int arr[N], brr[N];
int ta[N], tb[N];

int main(){
  scanf("%d", &n);

  for(int i = 0; i < n; i++)
    scanf("%d", &arr[i]);
  for(int i = 0; i < n; i++)
    scanf("%d", &brr[i]);

  int ans = 0;

  for(int i = 0; i < 29; i++){
    int t = (1 << i);
    int t2 = 2 * t;
    int t3 = 3 * t;

    for(int j = 0; j < n; j++)
      ta[j] = arr[j] % t2;
    for(int j = 0; j < n; j++)
      tb[j] = brr[j] % t2;

    sort(ta, ta + n);
    sort(tb, tb + n);

    ll cnt = 0;
    for(int j = 0; j < n; j++){
      int a = ta[j];
      int pos = lower_bound(tb, tb + n, t3 - a) - tb;
      cnt += (ll)(n - pos);

      if(a >= t){
        pos = upper_bound(tb, tb + n, t2 - a - 1) - tb;
        cnt += (ll)pos;
      }

      else{
        int poc = lower_bound(tb, tb + n, t - a) - tb;
        pos = upper_bound(tb, tb + n, t2 - a - 1) - tb;
        cnt += max(0ll, (ll)(pos - poc));
      }
    }

    if(cnt % 2 == 1) ans |= (1 << i);
  }

  printf("%d\n", ans);

  return 0;
}


Measured memory_bytes: 3328
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
  
#include <iostream>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <assert.h>
#include <memory.h>
#include <time.h>
#include <bitset>

#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = (l); i < (r); i++)
#define repb(i, r, l) for (int i = (r); i > (l); i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)
#define rank qwertyuio
#define next dfghjk
#define prev fhsgfhjf
#define plus fsghsf
#define minus ytryr
  
using namespace std;
  
inline bool setmin(int &x, int y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(int &x, int y) { return (y > x) ? x = y, 1 : 0; }
inline bool setmin(ll &x, ll y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(ll &x, ll y) { return (y > x) ? x = y, 1 : 0; }
  
const int N = 100000;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int P = 239;
const int P1 = 31;
const int P2 = 57;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const int MOD2 = 998244353;
const ld eps = 1e-9;
const double pi = atan2(0, -1);
const int ABC = 26;

ll gcd(ll x, ll y) {
    while (x) {
        y %= x;
        swap(x, y);
    }
    return y;
}

pair<int, int> comp(ll x) {
    int v1 = 0, v2 = 0;
    while (x % 2 == 0) {
        v1++;
        x /= 2;
    }
    while (x % 5 == 0) {
        v2++;
        x /= 5;
    }
    return mp(v1, v2);
}

int main()
{
    //freopen("circus.in", "r", stdin);
    //freopen("circus.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(20);
    cout << fixed;
    //ll TL = 10.95 * CLOCKS_PER_SEC;
    //clock_t time = clock();
    int n;
    cin >> n;
    map<pair<int, int>, int> mapa;
    rep(i, 0, n) {
        string s;
        cin >> s;
        ll A = 0, B = 1;
        bool has_dot = false;
        rep(i, 0, sz(s)) {
            if (s[i] == '.') {
                has_dot = true;
            } else {
                if (has_dot) {
                    B *= 10;
                }
                A = A * 10 + (s[i] - '0');
            }
        }
        ll g = gcd(A, B);
        A /= g;
        B /= g;
        auto p1 = comp(A), p2 = comp(B);
        mapa[mp(p1.fi - p2.fi, p1.se - p2.se)]++;
    }
    ll ans = 0;
    for (auto it : mapa) {
        for (auto it1 : mapa) {
            auto p = it.fi;
            auto p1 = it1.fi;
            if (p == p1 && p.fi >= 0 && p.se >= 0) {
                ans -= it.se;
            }
            if (p.fi + p1.fi >= 0 && p.se + p1.se >= 0) {
                ans += 1LL * it.se * it1.se;
            }
        }
    }
    cout << ans / 2 << "\n";
    return 0;
}



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

using namespace std;

typedef long long ll;

ll pow_mod(ll x,int k) {
  ll ans=1;
  while (k) {
  	if (k&1) ans=ans*x%MOD;
  	x=x*x%MOD;
  	k>>=1;
  }
  return ans;
} 

vector <int> son[105];
int len[105],size[105];

int f[105],g[105];

void dfs(int x) {
  int ans=1,s=size[x];
  f[x]=1;g[x]=0;
  for(int i=0;i<son[x].size();i++) {
  	int u=son[x][i];
  	dfs(u);
  	g[x]=((ll)g[x]*(f[u]+g[u])+(ll)f[x]*g[u])%MOD;
  	f[x]=(ll)f[x]*f[u]%MOD;
  	s-=size[u];
  }
  g[x]=((ll)g[x]*pow_mod(2LL,s)%MOD+(ll)f[x]*(pow_mod(2LL,s)-1+MOD))%MOD;
  f[x]=(ll)f[x]*pow_mod(2LL,len[x])%MOD;
} 

int num[105];

int st[105],id[105];

int solve(int l,int r) {
  int cnt=0,top=0;
  st[0]=l-1;
  for(int i=l;i<=r;i++) {
  	while (top&&num[st[top]]>=num[i])
  	  if (num[i]==num[st[top]]) {
  	  	  st[top]=i;
  	  	  break;
		}
	  else if (num[i]>num[st[top-1]]) {
	  	int v=++cnt;
	  	son[v].clear();
	  	son[v].push_back(id[top]);
	  	len[id[top]]=num[st[top]]-num[i];
	  	size[id[top]]=i-st[top-1]-2;
	  	st[top]=i;id[top]=v;
	  	break;
	  }
	  else {
	  	len[id[top]]=num[st[top]]-num[st[top-1]];
	  	size[id[top]]=i-st[top-1]-2;
	  	son[id[top-1]].push_back(id[top]);
	  	top--;
	  }
	if (st[top]!=i) {
		int v=++cnt;
		st[++top]=i;id[top]=v;
		son[v].clear();
	}
  }
  while (top) {
  	len[id[top]]=num[st[top]]-num[st[top-1]];
  	size[id[top]]=r-st[top-1]-1;
  	if (top>1) son[id[top-1]].push_back(id[top]);
  	top--;
  }
  dfs(id[1]);
  return (f[id[1]]+g[id[1]])%MOD;
}

int main() {
  int n;
  scanf("%d",&n);
  for(int i=1;i<=n;i++) {
  	scanf("%d",&num[i]);
  	num[i]--;
  }
  int ans=1;
  for(int i=1;i<=n;i++) {
    if (!num[i]||!num[i-1]) ans=ans*2LL%MOD;
    if (num[i]&&!num[i+1]) {
    	int l=i;
    	while (num[l-1]) l--;
		ans=ans*solve(l,i)%MOD; 
	}
  }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main() {
	for(;;){
		int m, f, r;
		cin >> m >> f >> r;

		if(m == -1 && f == -1 && r == -1) break;

		if(m == -1 || f == -1) cout << "F";
		else if(m + f >= 80) cout << "A";
		else if(m + f >= 65) cout << "B";
		else if(m + f >= 50 || r >= 50) cout << "C";
		else if(m + f >= 30) cout << "D";
		else cout << "F";

		cout << endl;

	}
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
int main()
{
    int k,a,b;
    cin>>k>>a>>b;

    if(a%k==0||b%k==0)
        cout<<"OK\n";
    else if((a/k)<(b/k))
        cout<<"OK\n";
    else
        cout<<"NG\n";

    return 0;
}


Measured memory_bytes: 3632
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
# from collections import Counter,defaultdict,deque
# from itertools import permutations, combinations
# from heapq import heappop, heappush
# # input = sys.stdin.readline
# sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n = inp()
al = inpl()
bl = inpl()
ans = 0
rem = 0
for i in range(0, n):
    if(al[i] <= bl[i] + rem):
        tmp = al[i] - rem
        if(tmp <= 0):
            tmp = 0
        rem = bl[i] - tmp
        ans += al[i]
    else:
        ans += bl[i] + rem
        rem = 0
if(al[n] >= rem):
    ans += rem
else:
    ans += al[n]
print(ans)
    


Measured memory_bytes: 101412