akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  int n;
  string s;
  cin >> n >> s;
  int x = 0, ans = 0;
  REP(i, n){
    if(s[i] == 'I') x++;
    else x--;
    chmax(ans, x);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,d,x,a;
	int s=0;
	cin>>n;
	cin>>d>>x;
	for(int i=0;i<n;i++)
	{
		cin>>a;
		int c=0;
		for(int j=1;j<=d;j+=a)
		{
			c++;
		}
		s+=c;

	}
	cout<<s+x;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize "03"
#include "bits/stdc++.h"
using namespace std;
 
#define ll long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
 
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;

map<char, int> m;
 
signed main() {
    IOS;
    #ifdef LOCAL
        freopen("input.txt","r", stdin);
        freopen("output.txt","w",stdout);
    #endif
    int n, k;
    cin >> n >> k;
    string s;  
    cin >> s;
    int ans = 0, c = 0;
    for(int i = 0; i < (int)s.length(); i++){
        if(i > 0 && s[i] == s[i-1])
            ans++;
        if(i > 0 && s[i] != s[i-1])
            c++;
    }   
    if(c == 0)
        return cout << ans, 0;
    if(s[0] == s[s.length()-1]){
        c = c/2;
        cout << ans + 2*min(c, k);
    }
    else{
        c = (c + 1)/2;
        c--;
        if(c >= k)
            cout << ans + 2*k;
        else
            cout << ans + 2*c + 1;
    }
    return 0;
}

Measured memory_bytes: 512
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < w + 2; i++) {
			sb.append("#");
		}
		ArrayList<String> ar = new ArrayList<>();
		ar.add(sb.toString());
		for(int i = 0; i < h; i++) {
			String str = "#";
			str += sc.next();
			str += "#";
			ar.add(str);
		}
		ar.add(sb.toString());
		for(String s : ar) {
			System.out.println(s);
		}
	}
}

Measured memory_bytes: 21972
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    int N;
    cin >> N;
    if (N == 7 || N == 5 || N == 3) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
typedef __int128_t Int;
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

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

  int N;
  cin >> N;
  int l = 0, r = N - 1;
  vector<string> s(N);
  string res;
  cout << 0 << endl;
  cin >> s[0];

  if (s[0] == "Vacant") {
    return 0;
  }

  loop(19) {
    if (abs(l - r) <= 1) {
      cout << l << endl;
      cin >> res;
      if (res == "Vacant") {
        return 0;
      }
      cout << r << endl;
      cin >> res;
      if (res == "Vacant") {
        return 0;
      }
    }

    dump(l, r);
    int m = (l + r) / 2;

    cout << m << endl;
    cin >> res;
    s[m]=res;
    if (res == "Vacant") {
      return 0;
    }

    if (abs(l - m) % 2 == 0) {
      if (s[l] == res) {
        l = m;
      } else {
        r = m+1;
      }
    } else {
      if (s[l] == res) {
        r = m+1;
      } else {
        l = m;
      }
    }
  }

  return 0;
}


Measured memory_bytes: 1620
import java.util.*;
public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int X = sc.nextInt();
        int T = sc.nextInt();
        int root;
        if(N%X != 0){
            root = N/X + 1;
        }else{
            root = N/X;
        }
        System.out.println(root*T);
    }
}


Measured memory_bytes: 35600
let lower_bound (a : int array) first last v =
  let rec doit len first =
    if len = 0 then first
    else
      let half = len / 2 in
      let mid = first + half in
      if a.(mid) < v then doit (len - half - 1) (mid + 1)
      else doit half first in
  doit (last - first + 1) first

let () =
  let n = read_int () in
  let t = Array.make (n + 1) max_int in
  let rec doit i =
    if i = n then lower_bound t 0 n max_int
    else begin
      let a = read_int () in
      t.(lower_bound t 0 n a) <- a;
      doit (i + 1)
    end in
  Printf.printf "%d\n" (doit 0)

Measured memory_bytes: 5236
using System.Linq;
using System.Collections.Generic;
using System;

public class P
{
    public int r { get; set; }
    public int b { get; set; }
}

public class Hello
{
    const int MOD = 998244353;

    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var FMAX = n + 10;
        var fac = new long[FMAX];
        var finv = new long[FMAX];
        var inv = new long[FMAX];
        COMinit(fac, finv, inv ,FMAX);
        var a = long.Parse(line[1]);
        var b = long.Parse(line[2]);
        var k = long.Parse(line[3]);
        var ps = new List<P>();
        var rmax = k / a;
        var bmax = k / b;
        for (long i = 1; i <= rmax; i++)
        {
            var w = k - a * i;
            if (w % b == 0 && w / b >= 1 && w / b <= bmax)
                ps.Add(new P { r = (int)i, b = (int)(w / b) });
        }
        if (ps.Count() == 0) { Console.WriteLine(1); goto end; }
        var ret = 0L;
        foreach (var x in ps)
        {
            var w1 = (COM(fac, finv, inv, n, x.r) * COM(fac, finv, inv, n, x.b)) % MOD;
            ret += w1;
            ret %= MOD;
        }
        Console.WriteLine(ret);
        end:;
    }
    public static long COM(long[] fac, long[] finv, long[] inv, int n, int k)
    {
        if (n < k) return 0;
        if (n < 0 | k < 0) return 0;
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
    }
    public static void COMinit(long[] fac, long[] finv, long[] inv , int FMAX)
    {
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i < FMAX; i++)
        {
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        }
    }
}


Measured memory_bytes: 48548
r1 = []
r2 = []
r3 = []
r4 = []
for i in range(3):
    a,b = map(int,input().split())
    if a == 1:
        r1.append(b)
    elif a == 2:
        r2.append(b)
    elif a == 3:
        r3.append(b)
    else:
        r4.append(b)

    if b == 1:
        r1.append(a)
    elif b == 2:
        r2.append(a)
    elif b == 3:
        r3.append(a)
    else:
        r4.append(a)
if len(r1) <= 2 and len(r2) <= 2 and len(r3) <= 2 and len(r4) <= 2:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int a, b;

char solve() {
    if (a + b == 15) return '+';
    if (a * b == 15) return '*';
    return 'x';
}

void input() {
    cin >> a >> b;
}

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

    input();
    cout << solve() << endl;
}


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

#define CIN2(a,b) long long a,b;cin >> a >> b;
#define CIN3(a,b,c) long long a,b,c;cin >> a >> b >> c;
#define rep(i,n) for(int i=0,i##_len=(n); i<i##_len; ++i)

int main(){
    int n;cin >> n;
    vector<int> v(n+1);
    v[0] = 0;
    rep(i,n) cin >> v[i+1];
    long long ans = 0;

    rep(i,n){
        ans += max(0,v[i+1]-v[i]);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;

import static java.lang.Integer.parseInt;

/**
 * Nearest Two Points
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] words;

		int n = parseInt(br.readLine());
		long[][] a = new long[n][2];

		for (int i = 0; i < n; i++) {
			line = br.readLine();
			a[i][0] = parseInt(line.substring(0, line.indexOf(' ')));
			a[i][1] = parseInt(line.substring(line.indexOf(' ') + 1));
		}

		Arrays.sort(a, new Comparator<long[]>() {
			@Override
			public int compare(long[] o1, long[] o2) {
				return Long.compare(o1[0], o2[0]);
			}
		});

		double L = Long.MAX_VALUE;
		long SQ = Long.MAX_VALUE;

		for (int i = 0; i < n; i++) {
			for (int j = i - 1; j >= 0; j--) {
				if (a[i][0] - a[j][0] >= L) break;
				long sq = (a[i][0] - a[j][0]) * (a[i][0] - a[j][0]) + (a[i][1] - a[j][1]) * (a[i][1] - a[j][1]);
				if (sq < SQ) {
					SQ = sq;
					L = Math.sqrt(SQ);
				}
			}
		}

		System.out.println(SQ);
	}
}

Measured memory_bytes: 88008
def countInRangeUtil(pos, cnt, tight, num): 
  
    # Last position 
    if pos == len(num): 
  
        # If count of non zero digits 
        # is less than or equal to K 
        if cnt <= K: 
            return 1
        return 0
  
    # If this result is already computed 
    # simply return it 
    if dp[pos][cnt][tight] != -1: 
        return dp[pos][cnt][tight] 
  
    ans = 0
  
    # Maximum limit upto which we can place 
    # digit. If tight is 1, means number has 
    # already become smaller so we can place 
    # any digit, otherwise num[pos] 
    limit = 9 if tight else num[pos] 
  
    for dig in range(limit + 1): 
        currCnt = cnt 
  
        # If the current digit is nonzero 
        # increment currCnt 
        if dig != 0: 
            currCnt += 1
  
        currTight = tight 
  
        # At this position, number becomes 
        # smaller 
        if dig < num[pos]: 
            currTight = 1
  
        # Next recursive call 
        ans += countInRangeUtil(pos + 1, currCnt, currTight, num) 
  
    dp[pos][cnt][tight] = ans 
    return dp[pos][cnt][tight] 
  
# This function converts a number into its 
# digit vector and uses above function to compute 
# the answer 
def countInRange(x): 
    global dp, K, M 
  
    num = [] 
    while x: 
        num.append(x % 10) 
        x //= 10
  
    num.reverse() 
  
    # Initialize dp 
    dp = [[[-1, -1] for i in range(M)] for j in range(M)] 
    return countInRangeUtil(0, 0, 0, num) 
  

a = int(input())
b = int(input())
dp = [] 

M = 100
R = a
K = b
m = countInRange(R)

dp = [] 
M = 100
R = a
K = b - 1
n = countInRange(R)

print(m - n)

Measured memory_bytes: 54364
using System;
using System.IO;
using System.Linq;

class Program
{
    static void Main()
    {
        string line;
        while((line = Console.ReadLine()) != null)
        {
            double[] a = line.Split(' ').Select(double.Parse).ToArray();
            double[,] m = new double[2, 2] { { a[0], a[1] }, { a[3], a[4] } };
            double[] v = new double[2] { a[2], a[5] };

            double d = m[0, 0] * m[1, 1] - m[0, 1] * m[1, 0];

            m[0, 0] /= d; m[0, 1] /= -d; m[1, 0] /= -d; m[1, 1] /= d;
            swap(ref m[0, 0], ref m[1, 1]);

            double x = m[0, 0] * v[0] + m[0, 1] * v[1];
            double y = m[1, 0] * v[0] + m[1, 1] * v[1];

            Console.WriteLine(string.Format("{0:f3} {1:f3}", x, y));
        }
    }

    static void swap(ref double a, ref double b)
    {
        double temp = a;
        a = b;
        b = temp;
    }
}

Measured memory_bytes: 9604
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

//long mod = 10^^9 + 7;
long mod = 998_244_353;
//long mod = 1_000_003;
void moda(T)(ref T x, T y) { x = (x + y) % mod; }
void mods(T)(ref T x, T y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(T)(ref T x, T y) { x = (x * y) % mod; }
void modpow(T)(ref T x, T y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(T)(ref T x, T y) { y.modpow(mod - 2); x.modm(y); }

void main()
{
	auto H1 = RD;
	auto M1 = RD;
	auto H2 = RD;
	auto M2 = RD;
	auto K = RD;

	auto H = H2 - H1;
	auto M = M2 - M1;
	auto ans = H*60 + M - K;

	writeln(ans);
	stdout.flush;
	debug readln;
}

Measured memory_bytes: 2752
a, b, c = map(int, input().split())
# a + 2√ab + b < c , 2√ab < c - a - b, 4ab < (c - a - b)^2
if c - a - b < 0:
    print("No")
else:
    print("Yes" if 4 * a * b < (c - a - b)**2 else "No")


Measured memory_bytes: 9160
#include <stdio.h>

int main(void)
{
	char s[11];
	int i = 0, cnt = 0, max = 0;
	
	scanf("%s", s);
	
	while (s[i]) {
		if (s[i] == 'A' || s[i] == 'T' || s[i] == 'C' || s[i] == 'G')
			cnt++;
		else {
			if (cnt > max)
				max = cnt;
			cnt = 0;
		}
		i++;
	}
		
	if (cnt > max)
		max = cnt;
	
	printf("%d", max);
		
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ld long double
#define ll long long
#define ull unsigned ll
#define pll pair<ll, ll>
#define itr(a) begin(a), end(a)
#define pb push_back
#define x first
#define y second
#define endl '\n'
#define FAST cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
#define FILES(namein, nameout) freopen(namein, "r", stdin); freopen(nameout, "w", stdout);
#define M 1000000007
#define N 200000
#define INF 101111111111111
using namespace std;
ll a[N], n;
ll greater_or_equal(ll what){
	ll l = 0, r = n-1;
	while(r-l>1){
		ll m  = (l+r)>>1;
		if(a[m] < what) l = m;
		else r = m;
	}
	for(ll i = l;i<=r;i++) if(a[i]>=what) return i;
}
main(){
	FAST;
	cin >> n;
	for(ll i = 0;i<n;i++){
		cin >> a[i];
	}
	sort(a, a+n);
	ll res = 0;
	for(ll i = 2;i<n;i++){
		for(ll j = 0;j<i;j++){
			ll x = greater_or_equal(a[i]-a[j]+1);
			if(x >= j) continue;
			res += j-x;
		}
	}
	cout << res << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
#include<queue>
using namespace std;
typedef long long ll;

const ll MOD = 1e9 + 7; 

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF_INT (1<<30)
#define INF_LL (1ll<<62)

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

ll dp[1010][10100],H,N;

ll min(ll a, ll b){
    if(a>b) return b;
    else return a;
}

int main(){
    cin>>H>>N;
    ll A[N],B[N];
    rep(i,N){
        cin>>A[i]>>B[i];
    }
    rep(i,N)rep(j,10010)if(j)dp[i][j]=10000000;
    repi(j,1,H+1){
        if(j<A[0])dp[0][j]=B[0];
        else dp[0][j] = dp[0][j-A[0]]+B[0];
    }
    repi(i,1,N){
        rep(j,H+1){
            if(j<A[i])dp[i][j]=min(dp[i-1][j],B[i]);
            else dp[i][j] = min(min(dp[i-1][j],dp[i-1][j-A[i]]+B[i]),dp[i][j-A[i]]+B[i]);
        }
    }
    out(dp[N-1][H]);
}

Measured memory_bytes: 79232
#include <iostream>
#include <functional>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <iomanip>
#include <complex>
#include <random>
#include <bitset>
#include <list>
// #include <prettyprint.hpp>
using namespace std;
#define repi(i,n) for(int i=0;i<n;++i)
#define rep(i,n) for(ll i=0;i<n;++i)
#define repinvi(i,n) for(int i=n-1;i>=0;--i)
#define sll(n) scanf("%lld", &n);
#define sii(n) scanf("%d", &n);
#define slf(n) scanf("%lf", &n);
#define pll pair<ll,ll>
#define pii pair<int,int>
#define psi pair<si,si>
typedef long long ll;
typedef double lf;
typedef short int si;

static const int max_l = 300010;

// bool compare_this(pll &p1, pll &p2){
//     // p1 = (w, index) or (h, index)
    
// }



void Main(){
    map<ll,ll> row, col;
    ll H, W, M, h, w;
    cin >> H >> W >> M;
    // vector<pll> hvs(M);
    // vector<pll> wvs(M);
    // set<pll, vector<pll>, greater<pll>()> hvs;
    // set<pll, vector<pll>, greater<pll>()> wvs;
    set<pll> pairs;
    // ll hs[M], ws[M];
    ll max_hv = 0;
    ll max_wv = 0;
    rep(i, M){
        cin >> h >> w;
        ++ row[h];
        ++ col[w];
        max_hv = max(max_hv, row[h]);
        max_wv = max(max_wv, col[w]);
        // hs[i] = h;
        // ws[i] = w;
        pairs.insert(make_pair(h, w));
    }

    vector<ll> h_max_s;
    vector<ll> w_max_s;
    for(auto r:row){
        if(r.second==max_hv){
            h_max_s.emplace_back(r.first);
        }
    }

    for(auto c:col){
        if(c.second == max_wv){
            w_max_s.emplace_back(c.first);
        }
    }

    ll ans = max_hv + max_wv - 1;

    for(auto h:h_max_s){
        for(auto w:w_max_s){
            if(pairs.find(make_pair(h, w)) == pairs.end()){
                ans ++;
                cout << ans << endl;
                return;
            }
        }
    }

    cout << ans << endl;
    return ;


    // cout << ans <<endl;




}

int main(){
    Main();
}

Measured memory_bytes: 67340
#include <stdio.h>

int main(void){
	int change[] = {500, 100, 50, 10, 5, 1};
	int mon, ch, cnt;
	while(1){
		scanf("%d", &mon);
		if(mon == 0)	break;
		ch = 1000 - mon;
		cnt = 0;
		if(ch/change[0] != 0)	cnt += ch / change[0]; ch = ch % change[0];
		if(ch/change[1] != 0)	cnt += ch / change[1]; ch = ch % change[1];
		if(ch/change[2] != 0)	cnt += ch / change[2]; ch = ch % change[2];
		if(ch/change[3] != 0)	cnt += ch / change[3]; ch = ch % change[3];
		if(ch/change[4] != 0)	cnt += ch / change[4]; ch = ch % change[4];
		if(ch/change[5] != 0)	cnt += ch / change[5]; ch = ch % change[5];
		printf("%d\n", cnt);
	}

	return 0;
}

Measured memory_bytes: 600
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();
            var ans = new int[S.Length];
            for(var i=0;i<2;i++)
            {
                var cnt = 0;
                for(var k=0;k<S.Length;k++)
                {
                    if(S[k]=='R')
                    {
                        cnt++;
                    }
                    else
                    {
                        ans[k] += cnt / 2;
                        ans[k-1] += (cnt+1) / 2;
                        cnt = 0;
                    }
                }
                S = string.Join("", S.Replace('R','_').Replace('L','R').Reverse());
                ans = ans.Reverse().ToArray();
            }
            Console.WriteLine(string.Join(" ",ans));
        }
    }
}

Measured memory_bytes: 23516
#include <iostream>
using namespace std;
typedef long long  ll;

#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

ll getLen(const char *s)
{
	ll i = 0;
	while (*s++) {
		i++;
	}
	return i;
}

int main()
{
	char s[201]; cin >> s;
	ll len = getLen(s);

	len--;
	while (1) {
		if (len % 2 == 0) {
			ll second = len / 2;
			bool ok = true;
			for (int i = 0; i < second; i++) {
				if (s[i] != s[second + i])
				{
					ok = false;
					break;
				}
			}
			if (ok) {
				cout << len << endl;
				return 0;
			}
		}
		len--;
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<algorithm>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

int main() {
  std::cout << std::setprecision(10) << std::fixed;
  double A, B, H, M; std::cin >> A >> B >> H >> M;
  double const PI = std::acos(-1);
  double r1 = (H/12.0 + M/(12.0*60.0))*2*PI;
  double r2 = M/60.0 * 2*PI;
  double dx = A*std::cos(r1) - B*std::cos(r2);
  double dy = A*std::sin(r1) - B*std::sin(r2);
  double ans = std::sqrt(dx*dx + dy*dy);
  fin(ans);
  return 0;
}


Measured memory_bytes: 4128
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()

int main() {
  string s;
  cin >> s;
  if (s[0] != 'A') {
    puts("WA");
    return 0;
  }
  int cnt = 0;
  for (int i = 2; i <= s.size() - 2; i++) {
    if (s[i] == 'C') cnt++;
  }
  if (cnt != 1) {
    puts("WA");
    return 0;
  }
  rep(i, s.size()) {
    if (s[i] == 'A' || s[i] == 'C') continue;
    if (!('a' <= s[i] && s[i] <= 'z')) {
      puts("WA");
      return 0;
    }
  }
  puts("AC");
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define r(i,n) for(int i = 0; i<n; i++)
using namespace std;
 
int main() {
  int a, b;
  char c;
  cin >> a >> c >> b;
  if(c=='+') cout << a+b<< endl;
  else cout << a-b<< endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Math;
using static System.Array;
using static AtCoder.Tool;
namespace AtCoder
{
    class AC
    {
        const int mod = 1000000007;
        const int INF = int.MaxValue / 2;
        const long SINF = long.MaxValue / 2;
        static readonly int[] dx = { 0, 1, 0, -1 };
        static readonly int[] dy = { 1, 0, -1, 0 };
        

        static void Main(string[] args)
        {
            //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            //Console.SetOut(sw);
            var cin = new Scanner();

            int N = int.Parse(Console.ReadLine());
            List<Tuple<int, int>> ab = new List<Tuple<int, int>>();
            List<Tuple<int, int>> cd = new List<Tuple<int, int>>();
            

            for(var i = 0; i < 2 * N; i++)
            {
                var p = cin.SplitRead();
                if (i < N)
                {
                    ab.Add(new Tuple<int, int>(p[0], p[1]));
                }
                else
                {
                    cd.Add(new Tuple<int, int>(p[0], p[1]));
                }
            }



            cd.Sort((x, y) => (x.Item1 - y.Item1));
            long ans = 0;

            
            List<Tuple<int, int>> xless = new List<Tuple<int, int>>();
            for(var i = 0; i < N; i++)
            {
                for(var j = 0; j < ab.Count(); j++)
                {
                    if (cd[i].Item1 > ab[j].Item1)
                    {
                        xless.Add(ab[j]);
                        ab.RemoveAt(j);
                    }
                }
                xless.Sort((x, y) => (y.Item2 - x.Item2));
               
                for(var j = 0; j < xless.Count(); j++)
                {
                    if (xless[j].Item2 < cd[i].Item2)
                    {
                        ans++;
                        xless.RemoveAt(j);
                        break;
                    }

                }
            }
            Console.WriteLine(ans);



            //Console.Out.Flush();
        }
        
        
        
    }
    public class Scanner
    {
        public int[] SplitRead()
        {
            int[] array = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return array;
        }
        public long[] SplitReadL()
        {
            long[] array = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return array;
        }
    }

    public static class Tool
    {
        static public void Initialize<T>(ref T[] array, T initialvalue)
        {
            for (var i = 0; i < array.Length; i++)
            {
                array[i] = initialvalue;
            }
        }
    }
}


Measured memory_bytes: 13396
from sys import exit

N = int(input())

R = []

for i in range(1, N + 1):
    s, p = input().split()

    x = (s, int(p))
    R.append((x, i))

R = sorted(R, key=lambda x: -x[0][1])
R = sorted(R, key=lambda x: x[0][0])

for r in R:
    print(r[1])


Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;


template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)


int main() {
	ll N, M;
	std::cin >> N >> M;

	priority_queue<pair<ll, ll>> pq;
	rep(i, 0, N) {
		ll A, B;
		std::cin >> A >> B;
		pq.push({ B,M - A });
	}

	ll ans = 0;
	vll workday(M + 1);
	rep(i, 0, M + 1) {
		workday[i] = i;
	}
	while (!pq.empty()) {
		ll idx = pq.top().second;
		while (idx >= 0 && workday[idx]!=idx) {
			idx = workday[idx];
		}
		if (idx >= 0) {
			workday[idx]--;
			workday[pq.top().second] = workday[idx];
			ans += pq.top().first;
		}
		pq.pop();
	}

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


Measured memory_bytes: 2544
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <functional>
#include <sstream>
#include <complex>
#include <climits>
using namespace std;

#define REP(i,a,n) for(int i=(a);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define EPS 1e-8

int main(){
	map<string,int> msi;
	string in,lstr,mstr;
	int sz = 0;
	while(cin>>in){
		if( sz<in.size() ){
			lstr = in;
			sz = in.size();
		}
		msi[in]++;
	}
	map<string,int>::iterator it;
	int k = 0;
	for(it=msi.begin(); it!=msi.end(); it++){
		if( k < it->second ){
			k = it->second;
			mstr = it->first;
		}
	}
	cout << mstr << " " << lstr << endl;
	
	return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int sum = 0;
    int inputA = scanner.nextInt();
    int inputB = scanner.nextInt();
    if(inputA >= 3 && inputB <= 20){
      if(inputB >= 3 && inputB <= 20){
        if(inputA > inputB + 1){
          sum = inputA + inputA - 1;
        }else if(inputB > inputA + 1){
          sum = inputB + inputB - 1;
        }else if(inputA == inputB + 1 || inputB == inputA + 1){
          sum = inputA + inputB;
        }else{
          sum = inputA + inputB;
        }
      }else{
        System.exit(1);
      }
    }else{
      System.exit(1);
    }
    System.out.println(sum);
    scanner.close();
  }
}


Measured memory_bytes: 20948
import java.util.*;

public class Main {
	  public static void main(String args[]){
      	Scanner scan = new Scanner(System.in);
            
        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();
        
        String cnt;
        
        if( b-a == c-b )cnt = "YES";
        else cnt = "NO";
            
        System.out.println(cnt);
	  }
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
#define ll long long
#define st first
#define sc second
#define pb push_back

using namespace std;

const int maxn = 5e5 + 69;

int a[maxn][10];

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

    int n;
    cin >> n;
    for(int i = 1; i <= n; i ++){
        cin >> a[i][0] >> a[i][1];
    }
    for(int i = 1; i <= n - 2; i ++){
        if(a[i][0] == a[i][1] && a[i + 1][0] == a[i + 1][1] && a[i + 2][0] == a[i + 2][1]){
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";


}


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

  priority_queue <int> a;
  int tmp1;
  char tmp2[10];

  while(scanf("%s",tmp2),tmp2[2]!='d'){
    if(tmp2[0]=='i'){
      scanf("%d",&tmp1);
      a.push(tmp1);
    }
    else{
      printf("%d\n",a.top());
      a.pop();
    }
  }
  return 0;

}



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

using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, __VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

#define MOD 1000000007
#define INF 1000000000
#define MAX_N 100010

string S;
string noX;
vector<int> Pos;

// 回文なら true
bool isKai(string str) {
    int r, l;
    if(str.length() % 2 == 0) {
        r = str.length() / 2;
        l = r - 1;
    } else {
        r = str.length() / 2 + 1;
        l = str.length() / 2 - 1;
    }
    while(r < str.length() && l >= 0) {
        if(str[l] != str[r]) { return false; }
        r++;
        l--;
    }
    return true;
}

int main()
{
    cin >> S;
    bool isX = false;
    REP(i, S.length()) {
        if(S[i] == 'x') { isX = true; }
        else {
            noX += S[i];
            Pos.push_back(i);
        }
    }
    if(!isX) {
        if(isKai(S)) { printf("0\n"); }
        else { printf("-1\n"); }
        return 0;
    }
    if(isX && noX.length() == 0) {
        printf("0\n");
        return 0;
    }
    if(!isKai(noX)) {
        printf("-1\n");
        return 0;
    }
    int r, l, ans = 0;
    if(noX.length() % 2 == 0) {
        r = noX.length() / 2;
        l = Pos[r - 1];
        r = Pos[r];
    } else {
        r = Pos[noX.length() / 2] + 1;
        l = Pos[noX.length() / 2] - 1;
    }
    //DBG("r: %d l:%d\n", r, l);
    while(r < S.length() || l >= 0) {
        if(S[r] == 'x' && S[l] != 'x') {
            ans++;
            r++;
        }
        else if(S[r] != 'x' && S[l] == 'x') {
            ans++;
            l--;
        }
        else if(r >= S.length() && l >= 0) {
            ans++;
            l--;
        }
        else if(r < S.length() && l < 0) {
            ans++;
            r++;
        }
        else {
            r++;
            l--;
        }
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 1148
#include <stdio.h>
#include <string.h>
#define MAX 101

void initialize(void);
void push(int);
int pop(void);
int isEmpty(void);
int isFull(void);

int stack[MAX];
int top;

main(){
  char s[MAX]; 
  int x, y;
  
  initialize();

  
  while( scanf("%s", s) != EOF ) {
    
    if(s[0] == '+') {
      x = pop();
      y = pop();
      x = y + x;
    }
    
    else if( s[0] == '-' ){
      x = pop();
      y = pop();
      x = y - x;
    }
    
    else if( s[0] == '*' ){
      x = pop();
      y = pop();
      x = y * x;
    }

    else x = atoi(s);

    push(x);
    
  }

  printf("%d\n", stack[top]);
  
  return 0;

}

void initialize(void){
  top = 0;
}

void push(int x){
  if( isFull() == 1 ){
    printf("オーバーフロー");
  }
  else{
    top++;
    stack[top] = x;
  }
}

int pop(void){
  if( isEmpty() == 1 ){
    printf("アンダーフロー");
  }
  else{
    top--;
    return stack[top+1];
  }
}

int isEmpty(){
  if( top == 0 ) return 1;
  else return 0;
}

int isFull(){
  if( top >= MAX-1 ) return 1;
  else return 0;
}

Measured memory_bytes: 548
n,m,x=list(map(int,input().split()))
a=[[] for _ in range(n)]
c=[]
ans =10000000
for i in range(n):
	tmp=input().split()
	c.append(int(tmp[0]))
	a[i]=list(map(int,tmp[1:]))
money_req=[0 for _ in range(1<<n)]
subs_know=[[0 for i in range(m)] for _ in range(1<<n)]	
for  i in range(1<<n):
	for j in range(n):
		if(not((1<<j)&i)):
			money_req[(1<<j)|i]=money_req[i] + c[j]
			flag=0
			for k in range(m):
				subs_know[i|1<<j][k]=subs_know[i][k] + a[j][k]
				if(subs_know[i|1<<j][k]<x): flag=1
			if not flag:ans=min(money_req[1<<j|i],ans);	
if ans==10000000: print(-1)
else: print(ans)






Measured memory_bytes: 69852
d, g = map(int, input().split())
a = []
min_cnt = 1000
for i in range(1, d + 1):
    p, c = map(int, input().split())
    a.append([p, i * p * 100 + c])
for i in range(0, 2 ** d):
    b = bin(i)[2:].zfill(d)
    score = sum(int(b[i]) * a[i][1] for i in range(d))
    cnt = sum(int(b[i]) * a[i][0] for i in range(d))
    if score >= g:
        min_cnt = min(min_cnt, cnt)
    else:
        for j in range(d-1, -1, -1):
            if b[j] == '0':
                break
        tmp_cnt = (g - score - 1) // (100 * (j + 1)) + 1
        if a[j][0] >= tmp_cnt:
            min_cnt = min(min_cnt, cnt+tmp_cnt)
print(min_cnt)


Measured memory_bytes: 42096
#include<bits/stdc++.h>
using namespace std;
int n;
double dp[3005][3005],p[3005];
int main(){
	cin>>n;
	for(int i=0;i<n;i++) cin>>p[i];
	dp[0][1]=p[0];
	dp[0][0]=1-p[0];
	for(int i=1;i<n;i++)
		for(int j=0;j<=i+1;j++)
			dp[i][j]=(j==0?0:dp[i-1][j-1]*p[i])+(1-p[i])*dp[i-1][j];
	double ans=0;
	/*
	 *for(int i=n/2+1;i<=n;i++)
	 *    ans+=dp[n-1][i];
	 */
	for(int i=0;i<=n;i++){
		int tails=n-i;
		if(i>tails) ans+=dp[n-1][i];
	}
	cout<<setprecision(9)<<fixed<<ans<<"\n";
		return 0;
}

Measured memory_bytes: 68992
n = int(input())
s = list(input())
white = s.count(".")
black = s.count("#")

color_dict = [{"w": 0, "b": 0} for x in range(n)]
for index in range(n):
    if s[index] == ".":
        color_dict[index]["w"] += 1 if index == 0 else color_dict[index-1]["w"] + 1
        color_dict[index]["b"] = color_dict[index-1]["b"]
    else:
        color_dict[index]["b"] += 1 if index == 0 else color_dict[index-1]["b"] + 1
        color_dict[index]["w"] = color_dict[index-1]["w"]

res = float("inf")
for colors in color_dict:
    w = colors["w"]
    b = colors["b"]
    res = min(res, b+(white-w))
print(min(white, black, res))


Measured memory_bytes: 72484
#include <stdio.h>

int min( int a, int b ) {

	if ( a > b ) { return b; }
	else { return a; }

}

struct dppair {

	int distance;
	int probability;

};

int main( void ) {

	int n, m, i, j, temp, ans, guarded;
	struct dppair dp[10000];
	
	while ( scanf( "%d %d", &n, &m ) && ( n != 0 || m != 0 ) ) {
	
		ans = 0;
	
		for ( i = 0; i < n; i++ ) {
		
			scanf( "%d %d", &dp[i].distance, &dp[i].probability );
		
		}
	
		//for ( i = 0; i < n; i++ ) { printf( "%d\t%d\n", dp[i].distance, dp[i].probability ); }
		
		for ( i = 0; i < n; i++ ) {
		
			for ( j = 0; j < n - 1; j++ ) { 
			
				if ( dp[j].probability < dp[j+1].probability ) {
				
					temp = dp[j].probability;
					dp[j].probability = dp[j+1].probability;
					dp[j+1].probability = temp;
				
					temp = dp[j].distance;
					dp[j].distance = dp[j+1].distance;
					dp[j+1].distance = temp;
				
				}
			
			}
			
		}
	
		//or ( i = 0; i < n; i++ ) { printf( "%d\t%d\n", dp[i].distance, dp[i].probability ); }
		
		for ( i = 0; i < n; i++ ) { ans += dp[i].probability * dp[i].distance; }
		
		for ( i = 0; i < n && m > 0; i++ ) {
		
			guarded = min( m, dp[i].distance );
			ans -= dp[i].probability * guarded;
			m -= guarded;
			
		}
		
		printf( "%d\n", ans );
	
	}

	return 0;

}

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

int rec(int n,int N,int *A,int *glo)
{
if(n==N-3)
{
int temp=abs(A[N-2]-A[N-3])+abs(A[N-1]-A[N-2]);
if(abs(A[N-1]-A[N-3])<temp){temp=abs(A[N-1]-A[N-3]);}
//cout<<"1Returning "<<temp<<endl;
return temp;
}

if(n==N-2)
{
int temp=(abs(A[N-1]-A[N-2]));
//cout<<"2Returning "<<temp<<endl;
return temp;
}

int t1;
if(glo[n+1]==-1){t1=rec(n+1,N,A,glo);glo[n+1]=t1;}
else{t1=glo[n+1];}
t1+=abs(A[n]-A[n+1]);

int t2;
if(glo[n+2]==-1){t2=rec(n+2,N,A,glo);glo[n+2]=t2;}
else{t2=glo[n+2];}
t2+=abs(A[n]-A[n+2]);


int res=t1;
if(t2<t1){res=t2;}


//cout<<"3Returning "<<res<<endl;
return res;
}

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

int glo[N];
for(int i=0;i<N;i++)
{
glo[i]=-1;
}

int min=rec(0,N,A,glo);

cout<<min;

return 0;
}

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

int main(){
	int n,t;
  	cin >> n >> t;
  	long ans=1e9+7;
  	for(int i=0;i<n;i++){
    	long a,b;
      	cin >> a >> b;
      	if(b<=t)ans=min(ans,a);
    }
  	if(ans==1e9+7)cout << "TLE";
  	else cout << ans;
}


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

int main(){
    int N;
    cin >> N;
    vector<int> X(N), Y(N);
    for(int i=0;i<N;i++){
        cin >> X.at(i);
        Y.at(i) = X.at(i);
    }
    sort(X.begin(),X.end());
    int m1, m2;
    m1 = X.at(N/2-1);
    m2 = X.at(N/2);
    
    for(int i=0;i<N;i++){
        if(Y.at(i) <= m1)   cout << m2 << endl;
        else if(Y.at(i) >= m2)  cout << m1 << endl;
    }

    return 0;
}


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

int main(){
    int N, A, B, total, temp, sum;
    cin >> N >> A >> B;
    total = 0;
  
    for(int i=1; i<=N; i++){
        temp = i;
        sum = 0;
        while(temp != 0){
            sum += (temp % 10);
            temp /= 10;
        }
        if(A <= sum && sum <= B){
            total += i;
        }
    }
  	cout << total << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#define PI 3.14159265358979323846264338327950L
int main(void) {
  int a,b,h,m;
  scanf("%d%d%d%d", &a, &b, &h, &m);
  long double rad= PI* 2 * ((long double)h/ 12.0 + ((long double)m/ 60.0) / 12.0 - (long double)m/ 60.0);
  long double rsq= (long double)(a*a+b*b) - (long double)(2 *a*b) *cosl(rad);
  printf("%20.20Lf\n",sqrtl(rsq));
}

Measured memory_bytes: 2576
import sys
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

N = INT()
H = LIST()

counter = []

memo = [False]*(N-1)
count = 0
for i in range(1,N):
    if H[i]>H[i-1]:
        counter.append(count)
        count = 0
    else:
        count +=1

counter.append(count)

    
print(max(counter))

Measured memory_bytes: 14480
use proconio::{input, fastout};
use proconio::marker::Chars;

#[fastout]
fn main() {
    input!{
        s: Chars,
    }
    for (i, c) in s.iter().enumerate() {
        if i & 1 == 1 {
            if *c == 'R' {
                println!("No");
                return;
            }
        } else {
            if *c == 'L' {
                println!("No");
                return;
            }
        }
    }
    println!("Yes");
}


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

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

ll dp[201000]={};

int main(){
   int n; cin>>n;
   vector<int> a(n); rep(i,0,n)cin>>a[i];
   vector<ll> sum(n); rep(i,0,n)sum[i]=a[i]+(i?sum[i-2]:0);
   rep(i,1,n){
      if(i&1)dp[i]=max(dp[i-2]+a[i],sum[i-1]);
      else dp[i]=max(dp[i-2]+a[i],dp[i-1]);
   } printf("%lld\n",dp[n-1]);
   return 0;
}


Measured memory_bytes: 7228
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define fore(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);++i)
#define rep(i,n) fore(i,0,(n)-1)
#define rfore(i,a,b) for(ll i=(ll)(b);i>=(ll)(a);--i)
#define rrep(i,n) rfore(i,0,(n)-1)
#define all(x) (x).begin(),(x).end()
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
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;}

void solve(){
    double a,b,x;cin>>a>>b>>x;
    x/=a;
    if(x>a*b/2){
        double y=2*(a*b-x)/a;
        double ans=atan2(y,a)*180/M_PI;
        printf("%.8f\n",ans);
    }else{
        double y=2*x/b;
        double ans=atan2(b,y)*180/M_PI;
        printf("%.8f\n",ans);
    }
}

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


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

#define dump(n) cout<<"# "<<#n<<'='<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;

const int INF=1e9;
const int MOD=1e9+7;
const double EPS=1e-9;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
	os<<'[';
	rep(i,a.size()) os<<(i?" ":"")<<a[i];
	return os<<']';
}

// n以上の2の冪乗
int Need(int n)
{
	n--;
	for(int i=1;i<32;i<<=1) n|=n>>i;
	return n+1;
}

struct SegmentTree{
	int I(){return numeric_limits<int>::max();}
	int F(int a,int b){return min(a,b);}
	
	int size;
	vi data;
	SegmentTree(int s):size(Need(s)),data(size*2,I()){
		Build();
	}
	SegmentTree(const vi& a):size(Need(a.size())),data(2*size,I()){
		copy(all(a),begin(data)+size);
		Build();
	}
	void Build(){
		peri(i,1,size){
			int u=i*2,v=i*2+1;
			if(v<size) u=data[u],v=data[v];
			data[i]=data[u]==F(data[u],data[v])?u:v;
		}
	}
	int Get(int i){
		return data[size+i];
	}
	void Update(int i,int x){
		data[i+=size]=x;
		while(i/=2){
			int u=i*2,v=i*2+1;
			if(v<size) u=data[u],v=data[v];
			data[i]=data[u]==F(data[u],data[v])?u:v;
		}
	}
	int QueryIndex(int a,int b,int i,int l,int r){
		if(b<=l || r<=a) return 0;
		if(a<=l && r<=b) return i<size?data[i]:i;
		int u=QueryIndex(a,b,i*2,l,(l+r)/2),v=QueryIndex(a,b,i*2+1,(l+r)/2,r);
		return data[u]==F(data[u],data[v])?u:v;
	}
	int QueryIndex(int a,int b){
		int res=QueryIndex(a,b,1,0,size);
		return res==0?-1:res-size;
	}
	int Query(int a,int b){
		return data[QueryIndex(a,b,1,0,size)];
	}
};

int main()
{
	for(int n,q;cin>>n>>q && n|q;){
		SegmentTree st(n);
		//SegmentTree st(vi(n,numeric_limits<int>::max()));
		rep(_,q){
			int t; cin>>t;
			if(t==0){
				int i,x; cin>>i>>x;
				st.Update(i,x);
			}
			else{
				int a,b; cin>>a>>b; b++;
				cout<<st.Query(a,b)<<endl;
			}
		}
	}
}

Measured memory_bytes: 2052
# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>

# include <stdio.h>
# include <bits/stdc++.h>


#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

using namespace __gnu_pbds;
using namespace std;
 
typedef
tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag, tree_order_statistics_node_update> ordered_set;

inline bool isvowel (char c) {
	c = tolower(c);
    if (c == 'a' || c == 'e' || c == 'i' || c == 'y' || c == 'o' || c == 'u') return 1;
    return 0;
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int n, m, k;
int cnt[N];
string s;
int a[N];
vector < int > g[N];
int u[N];
int ans, res;
int cur;

int main () {
	SpeedForce;

	cin >> s;	
	ll ans = 0;
	for (int i = sz(s) - 1; i >= 0; i --) {  	
		if (s[i] == 'B') {
			cur = 0;
			continue;
		}
		if (s[i] == 'A') {
			ans += cur;
			continue;
		}
		if (s[i] == 'C') {
			if (i > 0 && s[i - 1] == 'B') {
				cur ++;
				i --;
				continue;
			}
			cur = 0;
		}
	}
	cout << ans;

	return Accepted;
}

// B...a

Measured memory_bytes: 19152