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

using namespace std;
using ll = long long;
constexpr int mo = 1e9+7;
constexpr int  mod = mo;
constexpr int inf = 1<<30;
constexpr int mo2 = 998244353;
int main(){
    int n;
    cin>>n;
    cout << fixed;
    cout << setprecision(10);
    if(n%2 == 0)cout << 0.5 << endl;
    else cout << (n/2+1.0)/n << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std ;
int main()
{
    int a,b,c,d,e,k,x1,x2,x3,x4,x5,x6,x7,x8,x9,x0,x;
    cin >> a >> b >> c >> d >> e >> k ;
    x1 = e - d ;
    x2 = e - c ;
    x3 = e - b ;
    x4 = e - a ;
    x5 = d - c ;
    x6 = d - b ;
    x7 = d - a ;
    x8 = c - b ;
    x9 = c - a ;
    x0 = b - a ;
    //x = min({x1,x2,x3,x4,x5,x6,x7,x8,x9,x0}) ;
    if(x1<=k&&x2<=k&&x3<=k&&x4<=k&&x5<=k&&x6<=k&&x7<=k&&x8<=k&&x9<=k&&x0<=k)
        cout << "Yay!" ;
    else
        cout << ":(" ;
    return 0 ;
}


Measured memory_bytes: 256
class Dice():
    def __init__(self, l):
        self.value = l
    def roll(self,s):
        new_list = [0]*6
        if s == "W":
            new_list[0] = self.value[2]
            new_list[1] = self.value[1]
            new_list[2] = self.value[5]
            new_list[3] = self.value[0]
            new_list[4] = self.value[4]
            new_list[5] = self.value[3]
        if s == "E":
            new_list[0] = self.value[3]
            new_list[1] = self.value[1]
            new_list[2] = self.value[0]
            new_list[3] = self.value[5]
            new_list[4] = self.value[4]
            new_list[5] = self.value[2]
        if s == "N":
            new_list[0] = self.value[1]
            new_list[1] = self.value[5]
            new_list[2] = self.value[2]
            new_list[3] = self.value[3]
            new_list[4] = self.value[0]
            new_list[5] = self.value[4]
        if s == "S":
            new_list[0] = self.value[4]
            new_list[1] = self.value[0]
            new_list[2] = self.value[2]
            new_list[3] = self.value[3]
            new_list[4] = self.value[5]
            new_list[5] = self.value[1]
        self.value = new_list

l = list(map(int,input().split()))
Dice1 = Dice(l)
n = int(input())

for i in range(n):
    one,two = map(int,input().split())
    one_index = Dice1.value.index(one)
    two_index = Dice1.value.index(two)
    if (one_index == 0 and two_index == 1) or (one_index == 1 and two_index == 5) or (one_index == 5 and two_index == 4) or (one_index == 4 and two_index == 0):
        print(Dice1.value[2])
    if (one_index == 1 and two_index == 0) or (one_index == 5 and two_index == 1) or (one_index == 4 and two_index == 5) or (one_index == 0 and two_index == 4):
        print(Dice1.value[3])
    if (one_index == 0 and two_index == 2) or (one_index == 2 and two_index == 5) or (one_index == 5 and two_index == 3) or (one_index == 3 and two_index == 0):
        print(Dice1.value[4])
    if (one_index == 2 and two_index == 0) or (one_index == 5 and two_index == 2) or (one_index == 3 and two_index == 5) or (one_index == 0 and two_index == 3):
        print(Dice1.value[1])
    if (one_index == 1 and two_index == 2) or (one_index == 2 and two_index == 4) or (one_index == 4 and two_index == 3) or (one_index == 3 and two_index == 1):
        print(Dice1.value[0])
    if (one_index == 2 and two_index == 1) or (one_index == 4 and two_index == 2) or (one_index == 3 and two_index == 4) or (one_index == 1 and two_index == 3):
        print(Dice1.value[5])


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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll a,b,c,ans=0;
    cin >> a >> b >> c;
    ans = b + min(a+b+1,c);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 764
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jaynil
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int c = in.nextInt();
            if (a + b + c >= 22) out.println("bust");
            else out.println("win");
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



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

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  if(c>=a && c<=b){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
N, M=input().split()
A=list(map(int,input().strip().split()))
ls=[]
for Ai in A:
    if int(Ai)>=(1/(4*int(M)))*sum(A):
        ls.append(Ai)
if len(ls)>=int(M):
    print('Yes')
else:
    print('No')





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

int main(void)
{
    int A[3][3];
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> A[i][j];
        }
    }

    int N;
    cin >> N;

    int b[N];
    for (int i = 0; i < N; i++) {
        cin >> b[i];
        for (int j = 0; j < 3; j++) {
            for (int k = 0; k < 3; k++) {
                if (A[j][k] == b[i]) {
                    A[j][k] = 0;
                }
            }
        }
    }

    for (int i = 0; i < 3; i++) {
        if (A[i][0] == 0 && A[i][1] == 0 && A[i][2] == 0) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    for (int i = 0; i < 3; i++) {
        if (A[0][i] == 0 && A[1][i] == 0 && A[2][i] == 0) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    if (A[0][0] == 0 && A[1][1] == 0 && A[2][2] == 0) {
            cout << "Yes" << endl;
            return 0;
    }

    if (A[0][2] == 0 && A[1][1] == 0 && A[2][0] == 0) {
            cout << "Yes" << endl;
            return 0;
    }

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

Measured memory_bytes: 256
#[allow(unused)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
#[allow(unused)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
#[allow(unused)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        a: u64,
        b: u64,
    }
    let c: u64;
    c = a * b;
    println!("{}", c);
}


Measured memory_bytes: 2164
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>
 
using namespace std;
using ll = long long;
// constexpr int MOD = 1e9+7;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
ll gcd(ll a, ll b){ return (b == 0) ? a : gcd(b, a % b); }
ll lcm(ll a, ll b){ return a/gcd(a, b)*b; };

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Unique(a) a.erase(unique(Range(a)), a.end());
#define Reverse(c) reverse(Range(c))
#define Vec2(T, n, m, xs) vector<vector<T>> xs(n, vector<T>(m))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, n, xs, sxs) vector<T> sxs(n+1); For(i, n) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")

using Umap = unordered_map<int, ll>;

int main(void){
    Cin(int, n, k);
    Cins(int, k, d);
    For(i, 10){
        if(Contains(d, i)) d.erase(d.begin() + Search(d.begin(), d.end(), i));
        else d.push_back(i);
    }
    Sort(d);

    vector<int> b;
    for(int d1 : d){
        b.push_back(d1*1);
        for(int d2 : d){
            b.push_back(d2*10 + d1*1);
            for(int d3 : d){
                b.push_back(d3*100 + d2*10 + d1*1);
                for(int d4 : d){
                    b.push_back(d4*1000 + d3*100 + d2*10 + d1*1);
                    for(int d5 : d){
                        b.push_back(d5*10000 + d4*1000 + d3*100 + d2*10 + d1*1);
                    }
                }
            }
        }
    }
    Sort(b);
    Cout(*lower_bound(Range(b), n));
}


Measured memory_bytes: 892
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef pair<int, P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i, x) for (int i = 0; i < x; i++)
#define rep1(i, x) for (int i = 1; i <= x; i++)
#define rrep(i, x) for (int i = x - 1; i >= 0; i--)
#define rrep1(i, x) for (int i = x; i > 0; i--)
#define sor(v) sort(v.begin(), v.end())
#define rev(s) reverse(s.begin(), s.end())
#define lb(vec, a) lower_bound(vec.begin(), vec.end(), a)
#define ub(vec, a) upper_bound(vec.begin(), vec.end(), a)
#define uniq(vec) vec.erase(unique(vec.begin(), vec.end()), vec.end())
#define mp1(a, b, c) P1(a, P(b, c))

const int INF = 100000000;
const int M = 100000000;
const int dir_4[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
const int dir_8[8][2] = {{1, 0}, {1, 1}, {0, 1}, {-1, 1}, {-1, 0}, {-1, -1}, {0, -1}, {1, -1}};

/* ------------------------------------- */

ll f(ll a) {
    if (a <= 0)
        return 0;
    if (a % 2 == 0) {
        ll a_ = a / 2;
        if (a_ % 2 == 0) {
            return a;
        } else {
            return a + 1;
        }
    } else {
        ll a_ = (a + 1) / 2;
        if (a_ % 2 == 0) {
            return 0;
        } else {
            return 1;
        }
    }
}

int main() {
    ll a, b;
    scanf("%lld %lld", &a, &b);
    printf("%lld", f(a - 1) ^ f(b));

    /* --------------------------------- */
    printf("\n");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define dump(x) cout << #x << " = " << (x) << endl;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

#define int long long

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, A, B;
  cin >> N >> A >> B;
  if(A > B) {
    cout << 0 << endl;
  } else if(N == 1) {
    if(A == B) {
      cout << 1 << endl;
    } else {
      cout << 0 << endl;
    }
  } else {
    int X = A * (N - 1) + B;
    int Y = A + B * (N - 1);
    cout << Y - X + 1 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

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

    string S, T;
    int q;
    cin >> S >> T >> q;

    int s[S.size()], t[T.size()];
    for (int i = 0; i < S.size(); i++) {
        s[i] = S[i] == 'A' ? 1 : 2;
        if (i > 0) s[i] += s[i-1];
    }
    for (int i = 0; i < T.size(); i++) {
        t[i] = T[i] == 'A' ? 1 : 2;
        if (i > 0) t[i] += t[i-1];
    }

    for (int i = 0; i < q; i++) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        a--; b--; c--; d--;

        int c1 = s[b];
        if (a > 0) c1 -= s[a-1];

        int c2 = t[d];
        if (c > 0) c2 -= t[c-1];

        if ((c1 - c2) % 3 == 0) {
            cout << "YES\n";
        } else {
            cout << "NO\n";
        }
    }

    return 0;
}

Measured memory_bytes: 1664
#include <iostream>
using namespace std;
#include<string.h>
#include<set>
#include<stdio.h>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include <cstdio>
#include <cstdlib>
#include<stack>
#include<vector>
int main()
{
    long long n,m;
    cin>>n>>m;
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=n;j++)
        {
            int t=n-i-j;
            if(t<0)
                continue;
            if(i*10000+j*5000+t*1000==m)
            {
                cout<<i<<" "<<j<<" "<<t<<endl;
                return 0;
            }
        }
    }
    cout<<"-1 -1 -1"<<endl;
    return 0;
}


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

int main(){
  int i,R,n,min,max=-(pow(10,9));

  scanf("%d",&n);
  //R=(int *)malloc(sizeof(int)*n);

  scanf("%d",&min);
  max=max-min;
  for(i=1;i<n;i++){
    scanf("%d",&R);
    if(max<R-min) max=R-min;
    if(min>R){
      min=R;
      // printf("min:%d\n",min);
    }
  }
  printf("%d\n",max);
  return 0;
}
  

Measured memory_bytes: 596
#include <iostream>
using namespace std;
const long long int mod = 1000000007;
long long int N,K;

long long int S(long long int x){
 return (N+1)*x*(x+1)/2-(x*(x+1)*(2*x+1))/6+x; 
  
}
int main()
{
  
    cin>>N>>K;
    
  
    cout<<(S(N+1)-S(K-1))%mod<<endl;
}    


Measured memory_bytes: 3636
#include <stdio.h>
int main(void)
{
    long long int root=0;
    long long int r2=0;
    long long int n;
    scanf("%lld",&n);
    while(r2<=n)
    {
        root++;
        r2=root*root;
    }
    root--;
    printf("%lld",root*root);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, ll> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 100010;
const int MAXM = 100010;
const int MAXK = 510;
const int MAXQ = 200010;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
  string s;
  cin >> s;
  int res = 0;
  FOR(i,0,2)
  	if (s[i] == '1') res++;
  cout << res;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

int main(){
    int n,a,cnt=0;cin>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        if(a%2==1)cnt++;
    }
    if(cnt%2==0)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}


Measured memory_bytes: 3596
N=input()
M=input()
N=list(str(N))
M=list(str(M))
ans=[]
if len(N)>len(M):
  for i in range(len(N)-1):
    ans.append(N[i])
    ans.append(M[i])
  ans.append(N[-1])
else:
  for i in range(len(N)):
    ans.append(N[i])
    ans.append(M[i])
print("".join(ans))

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

int n;
double* prr;
double** dp;

double ProbOfXHeads(int cur, int headsRequired){
    int coinsLeft = n-cur;
    if(headsRequired<=0)return 1;
    if(coinsLeft<=0)return 0;//if we multiply, multiply it with 1, so answer remains same, if we add, 0
    if(headsRequired>coinsLeft)return 0;
    if(dp[cur][headsRequired]>=-0.5f)return dp[cur][headsRequired];
    double ans;
    {
        ans =  ( prr[cur] * ProbOfXHeads(cur+1, headsRequired-1) ) + ( (1-prr[cur])* ProbOfXHeads(cur+1, headsRequired) ) ;
    }
    dp[cur][headsRequired] = ans;
    return ans;
}

int main(){
    cin>>n;
    prr = new double[n];
    for(int i=0;i<n;i++){
        cin>>prr[i];
    }
    dp = new double*[n];
    for(int i=0;i<n;i++){
        dp[i] = new double[(n+1)/2+1];
        for(int j=0;j<(n+1)/2+1;j++){
            dp[i][j]=-1;
        }
    }

    double ans = ProbOfXHeads(0, (n+1)/2);

    // for(int i=0;i<n;i++){
    //     for(int j=0;j<(n+1)/2+1;j++){
    //         cout << dp[i][j] << " ";
    //     }
    //     cout << endl;
    // }

    cout << setprecision(14) << ans;

    return 0;
}

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

bool isPrimeNum( int x ) {
	for( int i = 3; i < x; i+=2 ) {
		if( x % i == 0 ) {
			return false;
		}
	}
	return true;
}

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

	if ( x <= 2 ) {
		x = 2;
		cout << x << endl;
		return 0;
	}
	
	if ( x%2 == 0 ) x+=1;

	bool flag = false;
	int limit = 20000000;
	while( !flag ) {

		if ( x > limit ) break;

		flag = isPrimeNum(x);
		if( flag ) break;

		x += 2;
	}

	cout << x << endl;
	return 0;

}


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

// Returns value of Binomial Coefficient C(n, k)
int binomialCoeff(int n, int k)
{
    // Base Cases
    if (k == 0 || k == n)
        return 1;

    // Recur
    return binomialCoeff(n - 1, k - 1) +
                binomialCoeff(n - 1, k);
}

/* Driver code*/
int main()
{
    int n,m;
    cin>>n>>m;
    int x ;
    if((n==0||n==1)&&(m==0||m==1) ) x=0;
    else if(n==0||n==1) x=binomialCoeff(m, 2);
    else if(m==0||m==1) x=binomialCoeff(n, 2);
    else x=binomialCoeff(n, 2)+binomialCoeff(m, 2);
    cout << x<<endl ;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<math.h>
#include<iomanip>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define PI acos(-1);
typedef long long ll;
using namespace std;
#define MOD 1000000007
//scanf("%d", &a) '\n'

int main() {
	string s;
	cin >> s;
	int ans = 0;
	rep(i, s.size() / 2) {
		if (s[i] != s[s.size() - 1 - i]) ++ans;
	}
	cout << ans;
}
	

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lli long long int
using namespace std;
int main()
{
	lli a,b,n;
	cin>>a>>b>>n;
	lli ans,temp=n;
	//if(a>b)
	//{
		while(temp>=b&&temp>=0)
		{
			temp--;
		}
		ans = (a*temp)/b;
	//}
	// else
	// {
	// 	ans= floor((a*temp)/b)- a*(floor(temp/b));
	// }
	//cout<<floor((a*temp)/b)<<endl;
	cout<<ans;
}

Measured memory_bytes: 3636
#include <iostream>//cout<<right で右揃え
#include <iomanip>//cout<<setw(数字) で空白による桁揃え
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <cstdlib>//abs()で整数絶対値
#include <cmath>//abs()かfabs()で少数絶対値
#include <functional>//sort第三引数greater<型名>()で降順
#include <map>

using namespace std;
using ll = long long int;

int main(){
    map<int,int> m;
    int N;cin>>N;
    if(N<3){
        cout << 0 << endl;
        return 0;
    }
    for(int i=0;i<N;i++){
        int l;cin>>l;
        m[l]++;
    }
    vector<int> L;
    for(auto i=m.begin();i!=m.end();++i){
        if(i->second) L.push_back(i->first);
    }
    sort(L.begin(),L.end());
    int ans = 0;
    for(int i=0;i<L.size();i++){
        for(int j=i+1;j<L.size();j++){
            for(int k=j+1;k<L.size();k++){
                if(L[i]+L[j]>L[k]) ans += m[L[i]]*m[L[j]]*m[L[k]];
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    string a , b ;
    cin >> a >> b ;
    string c = a + b ;
    stringstream ss ;
    ss << c ;
    int x ;
    ss >> x ;
    double z = sqrt(x);

    double fraction = z - (int) z ;

    if ( fraction < 1e-6 ){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;

    return 0 ;
}


Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val a = sc.nextInt()
    val b = sc.nextInt()
    println(problem106a(a, b))
}

fun problem106a(a: Int, b: Int): Int {
    return (a - 1) * (b - 1)
}

Measured memory_bytes: 29468
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

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

int main(){
  ll n;
  ll ans;

  cin >> n;

  for(int i = 0;i<INF;i++){
    if(i * i > n){
      break;
    }else{
      ans = i * i;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
struct Node{
	int key;
	Node *right,*left,*parent;
};
Node *root,*NIL;
void insert(int k){
	Node *x=root;
	Node *y =NULL;
	Node *z=(Node *)malloc(sizeof(Node));
	z->key=k;z->left=NULL;z->right=NULL;
	while(x!=NULL){
		y=x;
		if(x->key>z->key){
			x=x->left;
		}
		else x=x->right;
	}
	z->parent=y;
	if(y==NULL)root=z;
	else {
		if(y->key>z->key){
			y->left=z;
		}
		else y->right=z;
	} 
	
}
Node * find(Node *u,int k){
	while(u!=NULL&&u->key!=k){
		if(u->key>k)u=u->left;
		else u=u->right; 
	}
	return u; 
}
void inorder(Node *u){
	if(u==NIL)return ;
	inorder(u->left);
	printf(" %d",u->key);
	inorder(u->right);
} 

void preorder(Node *u){
	if(u==NIL)return ;
	printf(" %d",u->key);
	preorder(u->left);
	preorder(u->right);
}
int main(){
	int n,i,x,k;
	string com;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		cin>>com;
		if(com=="insert"){
			scanf("%d",&x);
			insert(x); 
		}else if(com=="print"){
			inorder(root);
			printf("\n");
			preorder(root);
			printf("\n");
		}
		else if(com=="find"){
			scanf("%d",&k);
			if(find(root,k)!=NULL)printf("yes\n");
			else printf("no\n");
		}
			} 
} 


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

using namespace std;

int segMin[1 << 20], segAdd[1 << 20];
int n, q;
char s[300001];

void add(int a, int b, int x, int k = 0, int l = 0, int r = n)
{
    if (r <= a || b <= l) return;
    
    if (a <= l && r <= b){
        segAdd[k] += x;
        while (k){
            k = (k - 1) / 2;
            segMin[k] = min(segMin[k * 2 + 1] + segAdd[k * 2 + 1], segMin[k * 2 + 2] + segAdd[k * 2 + 2]);
        }
        return;
    }
    
    add(a, b, x, k * 2 + 1, l, (l + r) / 2);
    add(a, b, x, k * 2 + 2, (l + r) / 2, r);
}

int getMin(int a, int b, int k = 0, int l = 0, int r = n)
{
    if (r <= a || b <= l) return (INT_MAX);
    
    if (a <= l && r <= b) return (segMin[k] + segAdd[k]);
    
    int left = getMin(a, b, k * 2 + 1, l, (l + r) / 2);
    int right = getMin(a, b, k * 2 + 2, (l + r) / 2, r);
    
    return (min(left, right) + segAdd[k]);
    
}

void fix(set<int> *a, set<int> *b, char before, int x)
{
    a->erase(x);
    b->insert(x);
    
    int base = before == '(' ? -1 : 1;
    s[x] = before == '(' ? ')' : '(';
    
    add(x, n, 2 * base);
    
    int l = 0, r = x;
    int p;
    
    while (l != r){
        int mid = l + r >> 1;
        p = *b->lower_bound(mid);
        if (getMin(p, n) >= 2 * base) r = mid;
        else l = mid + 1;
    }
    
    p = *b->lower_bound(l);
    add(p, n, -2 * base);
    b->erase(p);
    a->insert(p);
    s[p] = before;
    
    printf("%d\n", p + 1);
}

int main()
{
    scanf("%d %d", &n, &q);
    scanf("%s", s);
    
    set<int> lf, rg;
    
    for (int i = 0; s[i]; i++){
        if (s[i] == '('){
            add(i, n, 1);
            lf.insert(i);
        }
        else {
            add(i, n, -1);
            rg.insert(i);
        }
    }
    
    for (int i = 0; i < q; i++){
        int x;
        scanf("%d", &x); x--;
        
        if (s[x] == '(') fix(&lf, &rg, '(', x);
        else fix(&rg, &lf, ')', x);
    }
    
    return (0);
}

Measured memory_bytes: 23440
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
  for(auto i=begin(v); i != end(v); ++i){
    if(i !=begin(v)) os << ' ';
    os << *i;
  }
  return os;
}

set<ll> st;

int main(){
  ll N;
  pair<ll,ll> A[100007];
  cin >> N;
  rep(i,N){
    cin >> A[i].fr;
    A[i].sc=i+1;
  }
  sort(A,A+N);
  reverse(A,A+N);
  st.insert(0);
  st.insert(N+1);
  ll sum = 0;
  rep(i,N){
    st.insert(A[i].sc);
    decltype(st)::iterator it = st.lower_bound(A[i].sc);
    auto a = it;auto b = it;auto c = it;auto d = it;
    b--;c++;
    if(*b==*st.begin() && *c==*st.rbegin()){
    }
    else if(*b==*st.begin()){
      d++;d++;
      sum += (*d-*c)*(*it-*b)*A[i].fr;
    }
    else if(*c==*st.rbegin()){
      a--;a--;
      sum += (*a-*b)*(*it-*c)*A[i].fr;
    }
    else{
      a--;a--;d++;d++;
      sum += (*a-*b)*(*it-*c)*A[i].fr + (*d-*c)*(*it-*b)*A[i].fr;
    }
  }
  cout << sum << endl;
}

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

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

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

    vector<double> l(n);

    rep(i, n)cin >> l.at(i);

    double ans = 0;

    rep(i, n) {
        l.at(i) = (1 / (l.at(i)));
    }
    rep(i, n)ans += l.at(i);

    cout << (1 / ans) << endl;
}


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

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

    int n, m;
    cin >> n >> m;
    vector<int> v(n);
    int sum=0;

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


    sort(v.begin(), v.end(), greater<int>());
    (sum <= v[m-1]*4*m) ? (cout << "Yes"):(cout << "No");

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using ll= long long;
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define ALL(x) x.begin(),x.end()

#define INF (ll)1e9 //10^9:∞
#define LLINF (ll)1e12
#define MOD (ll)(1e9+7) //10^9+7:合同式の法
#define PI 3.141592653589
#define PB push_back
#define F first
#define S second
#define __MAGIC__ ios::sync_with_stdio(false);cin.tie(nullptr);

#define YESNO(T) if(T){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define yesno(T) if(T){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
#define YesNo(T) if(T){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

#define Graph vector<vector<int>>
#define PII pair<int,int>
#define VI vector<int>
#define VVI vector<vector<int>>
#define VPII vector<pair<int,int>>

#define DDD fixed<<setprecision(10)
#define endl "\n"

using namespace std;
/*..................DEFINE GLOBAL VARIABLES...................*/


/*.....................DEFINE FUNCTIONS ......................*/



/*.........................kemkemG0...........................*/
signed main() {
	__MAGIC__


	int N;
	cin>>N;
	VI A(N);
	REP(i,N)cin>>A[i];
	int ans=0;
	FOR(i,1,N-2){
		if( (A[i-1]<A[i] && A[i]<A[i+1]) || (A[i+1]<A[i] && A[i]<A[i-1])) ans++;
	}
	cout<<ans<<endl;

	



	

		return 0;
}


Measured memory_bytes: 3644
from collections import defaultdict
n, m = map(int, input().split())
s = []
for _ in range(n):
    k, *a = map(int, input().split())
    s.append(a)
dd = defaultdict(int)
for l in s:
    for k in l:
        dd[k] += 1

print(sum(1 if v == n else 0 for k, v in dd.items()))


Measured memory_bytes: 3316
package main

import "fmt"

func main() {
	var (
		n int
		s string
	)
	fmt.Scan(&n, &s)

	xm := make(map[rune]int)
	for _, r := range s {
		xm[r]++
	}

	if len(xm) < 3 {
		fmt.Println(0)
		return
	}
	ans := xm['R'] * xm['G'] * xm['B']

	for i := 0; i < n; i++ {
		for j := i + 1; j < n; j++ {
			if s[i] == s[j] {
				continue
			}
			d := j - i
			if k := j + d; k < n && s[i] != s[j] && s[j] != s[k] && s[k] != s[i] {
				ans--
			}
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1884
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <algorithm>

using namespace std;

int main(){
  int N,M;
  cin >> N >> M;
  vector<string> v(2);

  for(int i = 0; i < N ; ++i) v.at(0).push_back(to_string(M).at(0));
  for(int i = 0; i < M ; ++i) v.at(1).push_back(to_string(N).at(0));

  sort(v.begin(),v.end(),less<string>());

  cout << v.at(0) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
using namespace std;
#define pie 3.141592653589793238462643383279
#define int long long
#define mod 10000
#define INF 1145141919364364
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}

int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1)*x%mod;
}

int mod_pow(int x, int y, int mood) {
	int res = 1;
	while (y > 0) {
		if (y & 1)res = res * x%mood;
		x = x * x%mood;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}

int n, m, x, y;
vector<int> a[100010];
int dp[100010];
bool bl[100010];
int ans;

int bfs(int x) {
	if (!bl[x]) {
		bl[x] = true;
		for (int i = 0; i < (int)a[x].size(); i++) {
			dp[x] = max(dp[x], bfs(a[x][i]) + 1);
		}
	}
	return dp[x];
}

signed main() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		cin >> x >> y;
		a[y].push_back(x);
	}
	for (int i = 1; i <= n; i++) {
		ans = max(ans, bfs(i));
	}
	cout << ans << endl;
}

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

int main()
{
    int n;
    cin >> n;
    rep(k, n) {
        string x, y;
        cin >> x >> y;
        vector<vector<int>> dp(x.size(), vector<int>(y.size(), 0));
        int d;
        d = 0;
        for (int i = 0; i < x.size(); i++) {
            if (x[i] == y[0]) d = 1;
            dp[i][0] = d;
        }
        d = 0;
        for (int j = 0; j < y.size(); j++) {
            if (y[j] == x[0]) d = 1;
            dp[0][j] = d;
        }
        for (int i = 1; i < x.size(); i++) {
            for (int j = 1; j < y.size(); j++) {
                if (x[i] == y[j]) {
                    dp[i][j] = dp[i - 1][j - 1] + 1;
                } else {
                    dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
                }
            }
        }
        cout << dp[x.size() - 1][y.size() - 1] << endl;
    }
}


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

using namespace std;

bool bingo(bool A[3][3]) {
    // check rows
    for (int y = 0; y < 3; y++) {
        bool flag = true;
        for (int x = 0; x < 3; x++)
            flag = flag && A[y][x];
        if (flag)
            return true;
    }

    // check collums
    for (int x = 0; x < 3; x++) {
        bool flag = true;
        for (int y = 0; y < 3; y++)
            flag = flag && A[y][x];
        if (flag)
            return true;
    }

    // diagonals
    return (A[0][0] && A[1][1] && A[2][2]) || (A[2][0] && A[1][1] && A[0][2]);
}

int main() {
    map<int, pair<int, int>> positions;
    for (int y = 0; y < 3; y ++) {
        for (int x = 0; x < 3; x++) {
            int a;
            cin >> a;
            positions[a] = {x, y};
        }
    }

    bool A[3][3];
    memset(A, false, sizeof(A));

    int n;
    cin >> n;

    while (n--) {
        int x;
        cin >> x;
        if (positions.count(x) == 0)
            continue;

        auto pos = positions[x];
        A[pos.first][pos.second] = true;
    }

    cout << (bingo(A) ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 256
while True :
    sample = int(input())
    if sample == 0 : break
    result = 1
    for _ in range(2, sample+1) : result *= _
    result = str(result)
    count = 0
    for _ in range(1, len(result)) :
        if result[_*-1] == '0' : count += 1
        else : break
    print(count)

Measured memory_bytes: 7668
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}

const int n_max = 105;
const int k_max = 4;
ll dp[n_max][k_max][2] = { 0};


int main()
{
    string s;
    int nz;
    cin >> s >> nz;
    int n = s.size();
    vector<int> num(n);
    rep(i, n) num[i] = s[i]-'0';

    // dp[i][j][k]: 上位i+1桁目時点で非ゼロの数がj個である場合の数(k=0のとき、上限値と同じ数であることをしめす)


    // rep(k, 2){
    //     cout << "k=" << k << endl << endl;
    //     rep(i, n){
    //         rep(j, nz+1){
    //             cout << dp[i][j][k] << " ";
    //         }
    //         cout << endl;
    //     }
    //     cout << endl;
    // }

    dp[0][0][1] = 1;
    dp[0][1][1] = num[0]-1;
    dp[0][1][0] = 1;

    rep(i, n-1)rep(j, nz+1)rep(k, 2){
        int ni = i+1;
        rep(d, 10){
            int nj = j;int nk = k;        
            if (d != 0) nj++;
            if (nk == 0){
                if (d > num[i+1]) continue;
                if (d < num[i+1]) nk = 1;
            }
            if (nj > nz) continue;
            dp[ni][nj][nk] += dp[i][j][k];
        }
    }

    // rep(k, 2){
    //     cout << "k=" << k << endl << endl;
    //     rep(i, n){
    //         rep(j, nz+1){
    //             cout << dp[i][j][k] << " ";
    //         }
    //         cout << endl;
    //     }
    //     cout << endl;
    // }
    cout << dp[n-1][nz][0] + dp[n-1][nz][1] << endl;
}



Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons;
import std.math, std.numeric;
import core.bitop;

void main() {
    int n; scan(n);
    auto a = iota(n).map!(i => readln.chomp.to!int).array;

    auto on = new bool[](32);
    int xs;
    foreach (i ; 0 .. n) {
        on[bsf(a[i])] = 1;
        xs ^= a[i];
    }
    int ans;
    foreach_reverse (i ; 0 .. 32) {
        if ((xs >> i) & 1) {
            if (on[i]) {
                xs ^= (1<<i) - 1;
                ans++;
            }
            else {
                writeln(-1);
                return;
            }
        }
    }
    writeln(ans);
}


void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


Measured memory_bytes: 3708
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set; 
const ll INF = 1e18 + 10 ; 
int main(){
    fastio
    int n ;
    cin >> n ; 
    vector<int> v(n) ;
    for(int &x : v){
        cin >> x ; 
    }
    int ans = 0 ;
    for(int i = 0; i < n; i++){
        int cnt = 0 ;
        int j = i + 1;
        debug() << imie(v[i]);
        while(j < n && v[j] <= v[j - 1]) j++, cnt++;
        ans = max(ans, cnt) ;
        i = j - 1;
    }
    cout << ans << endl;
    return 0 ;
}

Measured memory_bytes: 640
#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;

// #define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

const int MOD = 1e9 + 7;
const int INF = INT_MAX;

signed main() {
    Fast();

    int a, b;
    cin >> a >> b;
    int x;
    x = max(a, b);

    cout << (x <= 8 ? "Yay!" : ":(") << endl;

    return 0;
}



Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
if n%2 == 0:
    print(sum(a[:n//2])*2 - a[0])
else:
    print(sum(a[:(n+1)//2])*2 - a[0]-a[(n-1)//2])

Measured memory_bytes: 31416
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

template <class M>
struct SegmentTree{
    using T = typename M::T;
    int sz, n, height{};
    vector<T> seg;
    explicit SegmentTree(int n) : n(n) {
        sz = 1; while(sz < n) sz <<= 1, height++;
        seg.assign(2*sz, M::e());
    }

    void set(int k, const T &x){ seg[k + sz] = x; }

    void build(){
        for (int i = sz-1; i > 0; --i) seg[i] = M::f(seg[2*i], seg[2*i+1]);
    }

    void update(int k, const T &x){
        k += sz;
        seg[k] = x;
        while (k >>= 1) seg[k] = M::f(seg[2*k], seg[2*k+1]);
    }

    T query(int a, int b){
        T l = M::e(), r = M::e();
        for(a += sz, b += sz; a < b; a >>=1, b>>=1){
            if(a & 1) l = M::f(l, seg[a++]);
            if(b & 1) r = M::f(seg[--b], r);
        }
        return M::f(l, r);
    }

    template<class F>
    int search_right(int l, F cond){
        if(l == n) return n;
        T val = M::e();
        l += sz;
        do {
            while(!(l&1)) l >>= 1;
            if(!cond(M::f(val, seg[l]))){
                while(l < sz) {
                    l <<= 1;
                    if (cond(M::f(val, seg[l]))){
                        val = M::f(val, seg[l]);
                        l++;
                    }
                }
                return l - sz;
            }
            val = M::f(val, seg[l]);
            l++;
        } while((l & -l) != l);
        return n;
    }

    template<class F>
    int search_left(int r, F cond){
        if(r == 0) return 0;
        T val = M::e();
        r += sz;
        do {
            while(r&1) r >>= 1;
            if(!cond(M::f(seg[r], val))){
                while(r < sz) {
                    r = ((r << 1)|1);
                    if (cond(M::f(seg[r], val))){
                        val = M::f(seg[r], val);
                        r--;
                    }
                }
                return r + 1 - sz;
            }
            val = M::f(seg[r], val);
        } while((r & -r) != r);
        return 0;
    }
    T operator[](const int &k) const { return seg[k + sz]; }
};

struct Monoid{
    using T = int;
    static T f(T a, T b) { return max(a, b); }
    static T e() { return -INF<int>; }
};
int main() {
    int n, q;
    cin >> n >> q;
    SegmentTree<Monoid> seg(n);
    for (int i = 0; i < n; ++i) {
        int x;
        scanf("%d", &x);
        seg.set(i, x);
    }
    seg.build();
    while(q--){
        int t, a, b;
        scanf("%d %d %d", &t, &a, &b);
        if(t == 1){
            seg.update(a-1, b);
        }else if(t == 2){
            printf("%d\n", seg.query(a-1, b));
        }else if(t == 3){
            printf("%d\n", seg.search_right(a-1, [&](int x){ return x < b; })+1);
        }
    }
    return 0;
}

Measured memory_bytes: 5372