akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define PP pair<int,P>
#define F first
#define S second
#define f(i,n) for(int i=0;i<(n);i++)
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define mod (int)(1000000007)
#define pie 3.141592653589793238462643383279
#define Bpri priority_queue
#define Spri priority_queue<P,vector<P>,greater<P>>
using namespace std;
signed main(){
	int n,ans=0;
	cin>>n;
	string s;
	cin>>s;
	f(i,s.size()){
		if(s[i]=='R') ans++;
	}
	if(ans*2>n) puts("Yes");
	else puts("No");
    return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
 
public class Main {
	static Scanner sc = new Scanner(System.in);
	static PrintWriter out = new PrintWriter(System.out);
 
	public static void main(String[] args) throws Exception {
		int n = sc.nextInt();
		long arr[] = new long[n], xor = 0;
		
		for(int i = 0; i < n; i++) {
			arr[i] = sc.nextLong();
			xor ^= i < 2 ? 0 : arr[i];
		}
		
		long sum = arr[0] + arr[1];
		long and = (sum - xor) >> 1;
		long a = 0, b = 0;
		
		for(int i = 60; i >= 0; i--) {
			boolean xi = (xor & (1L << i)) > 0;
			boolean ai = (and & (1L << i)) > 0;
			
			if(!xi && ai) {
				a |= 1L << i;
				b |= 1L << i;
			}
		}
		
		
		for(int i = 60; i >= 0; i--) {
			boolean xi = (xor & (1L << i)) > 0;
			boolean ai = (and & (1L << i)) > 0;
			
			if(xi && !ai) {
				if((a | 1L << i) <= arr[0]) {
					a |= 1L << i;
				}else {
					b |= 1L << i;
				}
			}
		}
		
		boolean flag = (a + b) == sum && (a ^ b) == xor;
		flag &= a >= 1 && a <= arr[0] && b >= arr[1];
		
		out.println(flag ? arr[0] - a : -1);
		out.close();
	}
 
}
 
class Scanner {
	StringTokenizer st;
	BufferedReader br;
 
	public Scanner(InputStream system) {
		br = new BufferedReader(new InputStreamReader(system));
	}
 
	public Scanner(String file) throws Exception {
		br = new BufferedReader(new FileReader(file));
	}
 
	public String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}
 
	public String nextLine() throws IOException {
		return br.readLine();
	}
 
	public int nextInt() throws IOException {
		return Integer.parseInt(next());
	}
 
	public double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}
 
	public Long nextLong() throws IOException {
		return Long.parseLong(next());
	}
}

Measured memory_bytes: 32988
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <cmath>
#include <climits>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

int main(int argc, char const* argv[])
{
  ll a[2];
  cin >> a[0] >> a[1];
  int k;
  cin >> k;
  for(int i = 0; i < k; i++){
    a[i % 2] = (a[i % 2] / 2) * 2;
    a[1 - i % 2] += a[i % 2] / 2;
    a[i % 2] -= a[i % 2] / 2;
  }
  cout << a[0] << " " << a[1] << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
//#include <stdlib.h>
//#include <string.h>
//#include <stdbool.h>
//#include <limits.h>
//#include <math.h>

#define MOD 1000000007
#define N 200005 //size of array

long fac[N], inv[N], finv[N];

void com_init()
{
  fac[0] = 1;
  fac[1] = 1;
  finv[0] = 1;
  finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < N; 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;
  }
}

int main() {
  int n, a, b;
  scanf("%d%d%d", &n, &a, &b);
  int k = n;
  long ans = 1, com;
  com_init();
  while (k>10) {
    ans *= 1024;
    ans %= MOD;
    k -= 10;
  }
  while (k>0) {
    ans *= 2;
    ans %= MOD;
    k--;
  }
  ans--;
  com = finv[a];
  for (int i=0; i<a; i++) {
    com *= n-i;
    com %= MOD;
  }
  ans -= com;
  com = finv[b];
  for (int i=0; i<b; i++) {
    com *= n-i;
    com %= MOD;
  }
  ans -= com;
  ans %= MOD;
  if (ans < 0)
    ans += MOD;
  printf("%ld\n", ans);
  return 0;
}


Measured memory_bytes: 4864
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    H,W,N=map(int,input().split())
    s=set()
    for i in range(N):
        s.add(tuple(map(int1,input().split())))
    ans=[0]*10
    used=set()
    for y,x in s:
        for dy in range(-1,2):
            for dx in range(-1,2):
                if 0>y+dy-1 or y+dy+1>=H or 0>x+dx-1 or x+dx+1>=W or (y+dy,x+dx) in used:
                    continue
                tmp=0
                used.add((y+dy,x+dx))
                for ddy in range(-1,2):
                    for ddx in range(-1,2):
                        if (y+dy+ddy,x+dx+ddx) in s:
                            tmp+=1
                ans[tmp]+=1
    ans[0]=(H-2)*(W-2)-sum(ans[1:])
    for row in ans:
        print(row)
    
    

if __name__ == '__main__':
    main()


Measured memory_bytes: 127220
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;

int main()
{
    int n, a, col[10] = {0};
    scanf("%d", &n);
    for(int i = 0; i < n; ++i)
    {
        scanf("%d", &a);
        if(a >= 1 && a <= 399)
        {
            col[0] = 1;
        }
        else if(a <= 799)
        {
            col[1] = 1;
        }
        else if(a <= 1199)
        {
            col[2] = 1;
        }
        else if(a <= 1599)
        {
            col[3] = 1;
        }
        else if(a <= 1999)
        {
            col[4] = 1;
        }
        else if(a <= 2399)
        {
            col[5] = 1;
        }
        else if(a <= 2799)
        {
            col[6] = 1;
        }
        else if(a <= 3199)
        {
            col[7] = 1;
        }
        else
        {
            ++col[8];
        }
    }
    int sum = 0;
    for(int i = 0; i <= 7; ++i)
    {
        sum += col[i];
    }
    int flag = 0;
    if(sum == 0)
    {
        sum = 1;
        flag = 1;
    }
    cout << sum << ' ';
    sum += col[8] - flag;
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
input = lambda: sys.stdin.readline().rstrip()
import heapq  
def calc(A):
    n = len(A)
    c = 0
    h = []
    ret = 0
    for i, aa in enumerate(A):
        for a in aa:
            ret += a
            heapq.heappush(h, a)
            if len(h) > i + 1:
                ret -= heapq.heappop(h)
    return ret

T = int(input())
for _ in range(T):
    N = int(input())
    L = [[] for _ in range(N)]
    R = [[] for _ in range(N)]
    ans = 0
    for _ in range(N):
        k, l, r = map(int, input().split())
        if k == N:
            ans += l
        elif l == r:
            ans += l
        elif l < r:
            ans += l
            R[N-1-k].append(r - l)
        else:
            ans += r
            L[k-1].append(l - r)
    ans += calc(L) + calc(R)
    print(ans)

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

using namespace std;

enum size{
    A,B,C,D,E,F,X
};
typedef long long ll;
ll solve(int n){
    ll some = 0;
    for(int i=0;i<n;i++){
        int x,y,h,w;
        size sis = X;
        size siw = X;
        cin >> x >> y >> h >> w;
        int s = x+y+h;
        if(s <= 160) sis = F;
        if(s <= 140) sis = E;
        if(s <= 120) sis = D;
        if(s <= 100) sis = C;
        if(s <= 80) sis = B;
        if(s <= 60) sis = A;

        if(w <= 25) siw = F;
        if(w <= 20) siw = E;
        if(w <= 15) siw = D;
        if(w <= 10) siw = C;
        if(w <= 5) siw = B;
        if(w <= 2) siw = A;

        size sss = max(siw,sis);
        switch(sss){
        case X:
            break;
        case F:
            some += 1600;
            break;
        case E:
            some += 1400;
            break;
        case D:
            some += 1200;
            break;
        case C:
            some += 1000;
            break;
        case B:
            some += 800;
            break;
        case A:
            some += 600;
            break;
        }
    }
    return some;
}

int main(){
    int n;
    while(cin >> n && n != 0) cout << solve(n) << endl;
}

Measured memory_bytes: 0
#coding:utf-8
import sys,os
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    XLMIIS = lambda x: [LMIIS() for _ in range(x)]
    YN = lambda c : print('Yes') if c else print('No')
    MOD = 10**9+7

    N = II()
    F = XLMIIS(N)
    P = XLMIIS(N)
    T = 10
    ans = - 10**7*N
    for bit in range(1,2**T):
        c = [0] * N
        for i in range(T):
            if bit & (1<<i):
                for j in range(N):
                    c[j] += F[j][i]
        benefit = 0
        for i in range(N):
            benefit += P[i][c[i]]
        ans = max(ans,benefit)
    print(ans)


if __name__ == '__main__':
    main()

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

int main(){
    int H, W;
    cin >> H >> W;

    vector<vector<char>> g(H, vector<char>(W));
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            cin >> g[i][j];
        }
    }
    for(int i = 0; i < H; i++){
        bool flag1 = false;

        for(int j = 0; j < W; j++){
            if (g[i][j] == '#') flag1 = true;
        }
        if(flag1){
            for(int k = 0; k < W; k++){
                bool flag2 = false;
                for(int l = 0; l < H; l++){
                    if(g[l][k] == '#') flag2 = true;
                }
                if(flag2) cout << g[i][k];
            }
            cout << endl;
        }
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<limits.h>
#include<vector>
#include<tuple>
using namespace std;
typedef long long ll;

const int MAX = 10000000;
int queue1[MAX];
int queue2[MAX];
int tail = 0, head = 0;
void init() {
	head = 0; tail = 0;
}

bool isEmpty() {
	return (head == tail);
}
bool isFull() {
	return (head==(tail+1)%MAX);
}
void enqueue(int v1, int v2) {
	if (isFull()) {
		return;
	}
	
	queue1[tail] = v1;
	queue2[tail] = v2;
	tail++;
	if (tail == MAX)tail = 0;
}
tuple<int ,int> dequeue() {
	if (isEmpty()) {
		return forward_as_tuple(-1,-1);
	}
	int res1 = queue1[head];
	int res2 = queue2[head];
	head++;
	if (head == MAX)head = 0;
	return forward_as_tuple(res1,res2);
}
int main() {
	int H, W;
	cin >> H >> W;
	vector<vector<bool>> black(H, vector<bool>(W, false));
	vector<vector<int>> repeat(H, vector<int>(W, INT_MAX));
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			char c;
			cin >> c;

			if (c == '#') {
				black[i][j] = true;
				repeat[i][j] = 0;
				enqueue(i, j);
			}
		}
	}
	int ans = 0;
	while (!isEmpty()) {
		int a, b;
		tie(a, b) = dequeue();
		//cout << a << "," << b << endl;
		if (a - 1 >= 0 && !black[a - 1][b]) {
			enqueue(a - 1, b);
			black[a - 1][b] = true;
			repeat[a - 1][b] = repeat[a][b] + 1;
		}
		if (a + 1 < H && !black[a + 1][b]) {
			enqueue(a + 1, b);
			black[a + 1][b] = true;
			repeat[a + 1][b] = repeat[a][b] + 1;
		}
		if (b - 1 >= 0 && !black[a][b - 1]) {
			enqueue(a, b - 1);
			black[a][b - 1] = true;
			repeat[a][b - 1] = repeat[a][b] + 1;
		}
		if (b + 1 < W && !black[a][b + 1]) {
			enqueue(a, b + 1);
			black[a][b + 1] = true;
			repeat[a][b + 1] = repeat[a][b] + 1;
		}
		ans = repeat[a][b];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 12544
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))
#define MOD (1000000007)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vector<ll> a(n);
    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    //累積和
    vector<ll> rui(n + 1, 0);
    for (ll i = 0; i < n; i++)
    {
        rui[i + 1] = rui[i] + a[i];
    }

    ll left = 0, right = 2;
    ll ans = INF;
    for (ll mid = 1; mid < n - 1; mid++)
    {
        //左側をしゃくとり
        ll sum1 = llabs(rui[mid] - 2 * rui[left]);
        while (left + 1 < mid && sum1 > llabs(rui[mid] - 2 * rui[left + 1]))
        {
            left++;
            sum1 = llabs(rui[mid] - 2 * rui[left]);
        }
        //右側をしゃくとり
        ll sum2 = llabs((rui[right] - rui[mid]) - (rui[n] - rui[right]));
        while (right + 1 < n && sum2 > llabs((rui[right + 1] - rui[mid]) - (rui[n] - rui[right + 1])))
        {
            right++;
            sum2 = llabs((rui[right] - rui[mid]) - (rui[n] - rui[right]));
        }
        ll mn = INF, mx = -INF;
        chmax(mx, rui[left]);
        chmax(mx, rui[mid] - rui[left]);
        chmax(mx, rui[right] - rui[mid]);
        chmax(mx, rui[n] - rui[right]);
        chmin(mn, rui[left]);
        chmin(mn, rui[mid] - rui[left]);
        chmin(mn, rui[right] - rui[mid]);
        chmin(mn, rui[n] - rui[right]);

        chmin(ans, mx - mn);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3456
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static StreamReader sr;

        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static long Mod = (long)998244353;
        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var HWN = Sarray();
            var H = HWN[0];
            var W = HWN[1];
            var N = HWN[2];
            var src = Sarray();
            var sr = src[0];
            var sc = src[1];
            var S = ReadLine();
            var T = ReadLine();
            var left = 0L;
            var right = W + 1;
            var up = 0L;
            var down = H + 1;
            var flg = true;
            for (var i = S.Length - 1; 0 <= i; --i)
            {
                var s = S[i];
                if (s == 'R') right = Min(right - 1, W);
                if (s == 'L') left = Max(left + 1, 1);
                if (s == 'D') down = Min(down - 1, H);
                if (s == 'U') up = Max(up + 1, 1);
                if (right == 1 || left == W || up == H || down == 1) flg = false;
                if (1 <= i)
                {
                    var t = T[i - 1];
                    if (t == 'L') ++right;
                    if (t == 'R') --left;
                    if (t == 'U') ++down;
                    if (t == 'D') --up;
                }
            }
            if (right <= sc || sc <= left || down <= sr || sr <= up)
                flg = false;
            if (flg)
                WriteLine("YES");
            else
                WriteLine("NO");
            //Out.Flush();
        }
    }
}

Measured memory_bytes: 14688
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

int main() {
 string s,t;
  cin>>s>>t;
  int n=s.size();
  int ans=0;
  rep(i,0,n){
    if(s[i]!=t[i])ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3864
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
  #define debug(...) printf(__VA_ARGS__)
#else
  #define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;

const int MAX = 100 + 10;

char in[MAX][MAX];
int dp[MAX][MAX][2];

int f(int x, int y, int t) {
  if (dp[x][y][t] >= 0)
    return dp[x][y][t];
  int &res = dp[x][y][t];
  res = MAX * MAX;
  if (x > 0) {
    res = min(res, f(x - 1, y, in[x - 1][y] == '#') + (in[x][y] == '.' && in[x - 1][y] == '#'));
  }
  if (y > 0) {
    res = min(res, f(x, y - 1, in[x][y - 1] == '#') + (in[x][y] == '.' && in[x][y - 1] == '#'));
  }
  debug("(%d %d %d) = %d\n", x, y, t, res);
  return res;
}

int main() {
  memset(dp, -1, sizeof(dp));
  int N, M;
  scanf("%d%d", &N, &M);
  for (int i = 0; i < N; i++)
    scanf("%s", in[i]);
  dp[0][0][0] = 0;
  dp[0][0][1] = 0;
  printf("%d\n", f(N - 1, M - 1, in[N - 1][M - 1] == '#') + (in[N - 1][M - 1] == '#'));
  return 0;
}


Measured memory_bytes: 384
import collections
n = int(input())
a = list(map(int,input().split()))
new_a = collections.Counter(a)

total = 0
for key, val in new_a.items():
    if val > 1:
        total += (val * (val - 1) // 2)


for i in a:
    ans = total
    ans -= new_a[i]-1
    print(ans)

Measured memory_bytes: 26780
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define rep(i, s, N) for(ll i{s}; i < N; i++)
#define rem(i, N, s) for(ll i{N}; i > s; i--)
using namespace std;using ll = long long int;using ld = long double;using P = pair<ll,ll>;const int MOD = (int)1e9+7;const string rt = "\n";const string sp = " ";/* 最大公約数 */template<typename T> T gcd(T a, T b){return b != 0 ? gcd(b, a % b) : a;}/* UnionFind */template<typename T> struct UnionFind{vector<T> par;UnionFind(T n) : par(n, -1){}void init(T n){par.assign(n, -1);}T root(T x){if (par[x] < 0) return x;else return par[x] = root(par[x]);}bool issame(T x, T y){return root(x) == root(y);}bool merge(T x, T y){x = root(x); y = root(y);if(x == y) return false;if(par[x] > par[y]) swap(x, y);par[x] += par[y];par[y] = x;return true;}int size(int x) {return -par[root(x)];}};/* コンビネーション */template<typename T> ll combpm(T N_, T C_) {const int NUM_=400001;static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];if (fact[0]==0) {inv[1]=fact[0]=factr[0]=1;for (int i=2;i<=NUM_;++i) inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%MOD, factr[i]=factr[i-1]*inv[i]%MOD;}if(C_<0 || C_>N_) return 0;return factr[C_]*fact[N_]%MOD*factr[N_-C_]%MOD;}/* 多次元ベクター */template<class T>vector<T> mvec(size_t a){return vector<T>(a);}template<class T, class... Ts>auto mvec(size_t a, Ts... ts){return vector<decltype(mvec<T>(ts...))>(a, mvec<T>(ts...));}/* テスト関数 */void test(ll n){cout << "test" << n << endl;}/* 小数点以下 */void fixsp(ll n){cout << fixed << setprecision(n);}void defsp(ll n){cout << defaultfloat << setprecision(n);}/* 重み付きUnionFind */struct WUnionFind {vector<int> par;vector<int> rank;WUnionFind(int n = 1) {init(n);}void init(int n = 1) {par.resize(n); rank.resize(n);for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0;}int root(int x) {if (par[x] == x) {return x;}else {int r = root(par[x]);return par[x] = r;}}bool issame(int x, int y) {return root(x) == root(y);}bool merge(int x, int y) {x = root(x); y = root(y);if (x == y) return false;if (rank[x] < rank[y]) swap(x, y);if (rank[x] == rank[y]) ++rank[x];par[y] = x;return true;}};/* IO高速化 */void fastio(){ios::sync_with_stdio(false);cin.tie(NULL);}
/* ここからコード開始 */

int main(){
  fastio;
  ll r;
  cin >> r;
  cout << r * r * 3 << rt;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */
vector<long long> KnapsackProblem(vector<long long> &v, vector<long long> &w, long long W) {
  size_t n = v.size();
  vector<vector<long long>> dp(n + 1, vector<long long> (W + 1, INF));
  dp[0][0] = 0;
  for(size_t i = 0; i < n; i++) {
    for(size_t j = 0; j <= W; j++) {
      if(j < w[i]) {
        dp[i + 1][j] = dp[i][j];
      } else {
        dp[i + 1][j] = min(dp[i][j], dp[i + 1][j - w[i]] + v[i]);
      }
    }
  }
  return dp[n];
}

int main() {
  
  lint h, n; cin >> h >> n;
  vector<lint> v(n);
  vector<lint> w(n);
  for(int i = 0; i < n; i++) cin >> v[i] >> w[i];
  auto dp = KnapsackProblem(w, v, h + 10000);
  lint ans = INF;
  for(int i = h; i <= h + 10000; i++) ans = min(ans, dp[i]);
  cout << ans << endl;
  return 0;
}


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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  int W, N, v, w, count = 1;
  char c;
  while (true) {
    cin >> W;
    if (W == 0) return 0;
    cin >> N;

    ll dp[N + 1][W + 1];
    for (int i = 0; i <= N; i++)
      for (int j = 0; j <= W; j++)
        dp[i][j] = 0;

    for (int i = 0; i < N; i++) {
      cin >> v >> c >> w;
      for (int j = W; j >= 0; j--) {
        // 入れないパターン
        dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
        // 入れるパターン
        if (j - w >= 0) dp[i + 1][j - w] = max(dp[i + 1][j - w], dp[i][j] + v);
      }
    }

    int res = 0, pos = 0;
    for (int j = W; j >= 0; j--) {
      if (res < dp[N][j]) {
        res = dp[N][j];
        pos = j;
      }
    }
    cout << "Case " << count << ":" << endl;
    cout << res << endl;
    cout << W - pos << endl;
    count++;
  }
}



Measured memory_bytes: 10872
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
#define LL long long
// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> non10;
    int sum = 0;
    rep(i, n)
    {
        cin >> a[i];
        sum += a[i];
        if (a[i] % 10 != 0)
        {
            non10.push_back(a[i]);
        }
    }
    SORT(a);
    if (sum % 10 != 0)
        cout << sum << endl;
    else if (non10.size() == 0)
        cout << 0 << endl;
    else
    {
        SORT(non10);
        cout << sum - non10[0] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define For(i,m,n) for(int i=m;i<n;i++)
#define FOR(i,n) for(int i=0;i<n;i++)
#define ll long long
#define ull unsigned long long
#define lli long long int
#define pb push_back
# define M_PI           3.14159265358979323846  /* pi */
ll mob=1000000007;
using namespace std;
int main()
{ 

int r;cin>>r;
cout<<fixed<<setprecision(20);
cout<<(double)2*M_PI*r;


return 0;
}











Measured memory_bytes: 3788
#include <iostream>
using namespace std;
int main()
{
	int a;
  	cin>>a;
  	for(int i=1;i<10;i++)
    {
    	for(int f=1;f<10;f++)
        {
        	if (a==i*f)
            {
            	cout<<"Yes";
              	return 0;
            }
          
        }
    }
  	cout<<"No";
  	
  	
}

Measured memory_bytes: 256
# A, B = [int(i) for i in input().split(" ")]
# A = int(input())
# As = [int(i) for i in input().split(" ")]
# Ss = ["".join(sorted(input())) for _ in range(N)]
# from math import factorial
# def nCr(n, r):
#   return factorial(n) // factorial(r) // factorial(n - r)

import heapq
N, M = [int(i) for i in input().split(" ")]
ABs = []
for _ in range(N):
   A, B = [int(i) for i in input().split(" ")]
   ABs.append([A, B])
ABs.sort(key=lambda ab: (ab[0], -ab[1]))
ans = 0
day = 1
k = 0
pq = []
while day <= M:
  while True:
    if k < len(ABs) and ABs[k][0] <= day:
      heapq.heappush(pq, -ABs[k][1])
      k += 1
    else:
      break
  if pq:
    v = heapq.heappop(pq)
    ans += -v
  day += 1
print(ans)



Measured memory_bytes: 30744
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; (i) < (n); (i)++)
using namespace std;
using Graph = vector<vector<int>>;
using P = pair<int, pair<int, int>>;

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

// a^{-1} mod を計算する
long modinv(long a, long mod) {
    return modpow(a, mod - 2, mod);
}

struct compare1 { 
    bool operator()(const pair<long, long>& value,  
                                const long& key) 
    { 
        return (value.first < key); 
    } 
    bool operator()(const long& key,  
                    const pair<long, long>& value) 
    { 
        return (key < value.first); 
    } 
};

struct UnionFind {
    vector<int> par;
    vector<int> rank;

    UnionFind(int n = 1){
        init(n);
    }

    void init(int n = 1){
        par.resize(n);
        rank.resize(n);
        REP(i, n) par[i] = i, rank[i] = 0; 
    }

    int root(int x){
        if(par[x] == x) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y){
        return root(x) == root(y);
    }

    bool merge(int x, int y){
        x = root(x); y = root(y);
        if(x == y) return false;
        if(rank[x] < rank[y]) swap(x, y);
        if(rank[x] == rank[y]) rank[x]++;
        par[y] = x;
        return true;
    }
};

template<class Abel> struct weightedUnionFind{
    vector<int> par;
    vector<int> rank;
    vector<Abel> diff_weight;

    weightedUnionFind(int n = 1, Abel SUM_UNITY = 0){
        init(n, SUM_UNITY);
    }

    void init(int n = 1, Abel SUM_UNITY = 0){
        par.resize(n); rank.resize(n); diff_weight.resize(n);
        REP(i, n) par[i] = i, rank[i] = 0, diff_weight[i] = SUM_UNITY; 
    }

    int root(int x){
        if(par[x] == x) return x;
        else{
            int r = root(par[x]);
            diff_weight[x] += diff_weight[par[x]];
            return par[x] = r;
        }
    }

    Abel weight(int x){
        root(x);
        return diff_weight[x];
    }

    bool issame(int x, int y){
        return root(x) == root(y);
    }

    bool merge(int x, int y, Abel w){
        w += weight(x); w -= weight(y);
        x = root(x); y = root(y);
        if(x == y) return false;
        if(rank[x] < rank[y]) swap(x, y), w = -w;
        if(rank[x] == rank[y]) rank[x]++;
        par[y] = x;
        diff_weight[y] = w;
        return true;
    }

    Abel diff(int x, int y){
        return weight(y) - weight(x);
    }
};

int main()
{
    int N, M; cin >> N >> M;
    weightedUnionFind<int> wuf(N);
    REP(i, M){
        int l, r, d; cin >> l >> r >> d;
        l--, r--;
        if(wuf.issame(l, r)){
            int diff = wuf.diff(l, r);
            if(diff != d){
                cout << "No" << endl;
                return 0;
            }
        }else{
            wuf.merge(l, r, d);
        }
    }
    cout << "Yes" << endl;
    return 0;
}



Measured memory_bytes: 1408
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		String inputData = scn.nextLine();
		String searchData = scn.nextLine();
		inputData =inputData + inputData;
		if (inputData.contains(searchData)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}



Measured memory_bytes: 26244
n,t = gets.chomp.split(" ").map { |n| n.to_i }
ibanme = gets.chomp.split(" ").map { |n| n.to_i }
result = 0
keizoku = 0
#p result
for i in 1..n-1
	if ibanme[i] >= ibanme[i-1] + t
		if keizoku != 0
			result += (t + keizoku)
			keizoku = 0
		else
			result += t
		end
#		p result
	else
		if keizoku == 0
			keizoku = ibanme[i] - ibanme[i-1]			
		else
			keizoku += ibanme[i] - ibanme[i-1] 
		end
#		p keizoku
	end
end
if keizoku != 0
	result += keizoku
end
result += t
puts result


Measured memory_bytes: 17932
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <queue> //priority_queue
#include <map>
#include <set> //multiset set<int,greater<int>>大到小
#include <vector>// ::iterator it;
#include <stack>
#include <cmath> // auto &Name : STLName  Name.
#include <utility>
#include <sstream>
#include <string>//__builtin_popcount(ans);//获取某个数二进制位1的个数
#define mod 1000000007
#define mod9 998244353
typedef unsigned long long ull;
typedef long long ll;
typedef double db;
typedef long double ld;
const db eps=1e-10;
const int INF = 0x3f3f3f3f;
const ll inf=0x3f3f3f3f3f3f3f3f;
const int N=1e5+7;
using namespace std;

int t,n,m,k,ans=0,cnt=0,sum=0;
int main(){
    scanf("%d%d",&n,&m);
    printf("%d\n",n*n-m);
    return 0;
}

Measured memory_bytes: 256
// "static void main" must be defined in a public class.
import java.util.*;
public class Main {
    
    static String dp(int arr[], int n) 
{ 
        boolean dp[] = new boolean[n+1];
     
        
        for(int i =1 ; i<=n;i++) {
            boolean temp = false;
            for (int j =0; j<arr.length ;j++) {
                if(i<arr[j]) {
                    break;
                }
                if(!dp[i-arr[j]]) {
                    dp[i] = true;
                    break;
                }
            }
            
            
        }
        if(dp[n]) {
            return "First";
        }
        else {
            return "Second";
        }
  
}
    public static void main(String[] args) {
        Scanner s= new Scanner(System.in);
      
           int n = s.nextInt();
            int arr[] = new int[n];
            int k = s.nextInt();
            for (int i = 0 ; i< n  ; i++) {
                arr[i] = s.nextInt();
            }
            
            
        
            
            System.out.println(dp(arr,k));
        
    }
}

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

int main(void){
    string S;
    cin >> S;

    if(S[2] == S[3] && S[4] == S[5]) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

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

using namespace std;

int main()
{
    int n, ans = 0;
    cin >> n;
    //vector<pair<int, int>> v(n);
  	vector<int> a(n), b(n);
  	for(int i = 0; i < n; i++) cin >> a[i] >> b[i];  
  	//for(auto& x : v) cin >> x.first >> x.second;
    sort(a.begin(), a.end());
  	sort(b.begin(), b.end());
    if(n & 1) {
        ans = b[n/2] - a[n/2] + 1;
    }
    else {
        //cout << v[n/2].second << ' ' << v[n/2].first << ' ' << v[n/2 - 1].second << ' ' << v[n/2 - 1].first << endl;
        ans = b[n/2] - a[n/2] + 1 + b[n/2 - 1] - a[n/2 - 1];
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 4840
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
# INF =  float("inf")
INF = 10**18
import bisect
import statistics
mod = 10**9+7
# mod = 998244353

N = int(input())
B = list(map(int, input().split()))

ans = B[0]
for i in range(1,N-1):
    ans += min(B[i-1],B[i])
ans += B[N-2]

print(ans)

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

int d[5],x,y;
int main()
{
	for (int i=1;i<=3;i++) scanf("%d%d",&x,&y),d[x]++,d[y]++;
	for (int i=1;i<=4;i++) if (d[i]==3) return puts("NO"),0;
	puts("YES");
	return 0;
}

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

/* ????§???¢?????????????????????????´?????????????????§??????? */
typedef struct{
	int a;
	int b;
	int c;
}SIDE;

/* ????????????????????£?¨? */
void swap(int* x, int* y);

/* main??¢??° */
int main(void){
	SIDE* side = NULL;
	int n, temp, i;

	scanf("%d", &n);
	side = (SIDE*)malloc(sizeof(SIDE)*n);
	if(side == NULL)exit(1);
	for(i = 0;i < n;i++)
		scanf("%d %d %d", &side[i].a, &side[i].b, &side[i].c);

	for(i = 0;i < n;i++){
		if(side[i].a < side[i].b)
			swap(&side[i].a, &side[i].b);
		if(side[i].a < side[i].c)
			swap(&side[i].a, &side[i].c);

		if(side[i].a*side[i].a == side[i].b*side[i].b + side[i].c*side[i].c){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}

	free(side);

	return 0;
}

/* ?????°x??¨?????°y???????????\??????????????¢??° */
void swap(int* x, int* y){
	int temp;

	temp = *x;
	*x = *y;
	*y = temp;
}

Measured memory_bytes: 1780
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long
using namespace std;
int main()
{
    int k,x;
    cin >> k >> x;
    int ans = k * 500;
    if(ans>=x){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define MAX 1000005
using namespace std;
ll n, m, i ,j ,k ,l, ans, tmp, res, tmp2;
ll arr[MAX], brr[MAX];
vector<ll> v;
string s;
map<ll,ll> mp;
int main()
{
	
		cin>>n>>m;
		m/=1000;
		for(i=0;i<=2000;i++)
		{
			 tmp = m - n - 9*i;
			 if(tmp%4)continue;
			 tmp/=4;
			 tmp2 = n - tmp - i;
			if(tmp>=0 && tmp2>=0)break;
		}
		if(i==2001)
		{
			cout<<"-1 -1 -1";
			return 0;
		}
		cout<<i<<" "<<tmp<<" "<<tmp2;


return 0;
}
 

Measured memory_bytes: 256
/* *Your Love Makes me STRONG,
   You'r Hate Makes Me UNSTOPABBLE.*
 
  *HOPE is a good thing,Maybe The BEST of Things.
   And No Good Things Ever Dies.*
  
  *Keep calm,Be patient And Chase Your DREAM*

*/


#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define MN7 ios::sync_with_stdio(0);cin.tie(nullptr);
using namespace std;
ll t,n,i,j,k,a,b,c,d,p,q,r,x,y,z,m,cnt,flag,ans;
string s;
void nahid()
{
 cin>>a>>b>>c>>d;
 x=a*c;y=a*d;z=b*c;p=b*d;
 q=max(x,y);
 r=max(z,p);
 ans=max(q,r);
cout<<ans<<endl;


}
int main()
{ MN7// cin>>t;while(t--)
  nahid();
}


Measured memory_bytes: 3620
#include<algorithm>
#include<iostream>
#include<functional>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
  int n,num[110000],ans=0;
  cin>>n;
  for(int i=0;i<n+2;i++){
    if(i==0 or i==n+1){
      num[i]=0;
      if(i==n+1)
        ans+=abs(num[n]);
    }
    else{
      cin>>num[i];
      ans+=abs(num[i]-num[i-1]);
    }
  }
  for(int j=1;j<n+1;j++){
    cout<<ans-(abs(num[j]-num[j-1])+abs(num[j+1]-num[j]))+abs(num[j-1]-num[j+1])<<endl;
  }
}


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

int main() {
  int n, k;
  cin >> n >> k;
  set<int> s;
  for (int i = 0; i < k; i++) {
    int d;
    cin >> d;  
    for (int j = 0; j < d; j++) {
      int a;
      cin >> a;
      s.insert(a);
    }
  }
  
  cout << n - s.size() << endl;    
  
  return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>

using namespace std;

typedef long long ll;

double dis[1002][1002];
double px[1002], py[1002], r[1002];
double cost[1002];
bool used[1002];

double euclid(int i, int j){
    double square = (px[i] - px[j])*(px[i] - px[j]) + (py[i] - py[j])*(py[i] - py[j]);
    return sqrt(square);
}

void dijkstra(int s, int N){
    cost[s] = 0.0;

    while(true){
        int v = -1;
        for(int u = 0; u < N+2; u++){
            if(!used[u] && (v == -1 || cost[u] < cost[v]))  v = u;
        }
        if(v == -1) break;
        used[v] = true;

        for(int u = 0; u < N+2; u++){
            cost[u] = min(cost[u], cost[v]+dis[v][u]);
        }
    }
}

int main(){
    double xs, ys, xt, yt;
    cin >> xs >> ys >> xt >> yt;
    int N; cin >> N;
    px[0] = xs; py[0] = ys; r[0] = 0.0;
    px[N+1] = xt; py[N+1] = yt; r[N+1] = 0.0;

    for(int i = 1; i <= N; i++){
        double x, y, rr; cin >> x >> y >> rr;
        px[i] = x; py[i] = y; r[i] = rr;
    }

    for(int i = 0; i < N+2; i++){
        for(int j = 0; j < N+2; j++){
            dis[i][j] = max(euclid(i, j) - r[i] - r[j], 0.0);
        }
        used[i] = false;
        cost[i] = 1e9 * 5;
    }

    dijkstra(0, N);
    printf("%.10f", cost[N+1]);

    return 0;
}

Measured memory_bytes: 8064
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int mod=998244353;
int dp[3001][3001];
signed main(){
    int n,s,a[3000];
    cin>>n>>s;
    for(int i=0;i<n;i++)
        cin>>a[i];
    int ans=0;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=s;j++){
            if(j!=s)
                dp[i][j]=dp[i-1][j];
            if(a[i-1]==j)
                (dp[i][j]+=i)%=mod;
            if(a[i-1]<j)
                (dp[i][j]+=dp[i-1][j-a[i-1]])%=mod;
            if(j==s)
                (ans+=dp[i][j]*(n-i+1))%=mod;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 70656
#include<iostream>
#include<vector>
#include<bitset>
#include<string>
#include<cmath>
#include<algorithm>
#include<stack>
#include<list>
#include<queue>
#include<map>
using namespace std;
#define rep(i,x) for(int i=0;i<x;i++)
int INF=1e9;
const long long mod=1e9+7;

int main(){
  int N;
  cin>>N;
  vector<int>a(N);
  rep(i,N){
    cin>>a[i];
  }
  int sum=0;
  rep(i,N){
    sum+=(a[i]-1);
  }
  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 256
N = int(input())
a = [i for i in map(int,input().split())]
b = [i for i in map(int,input().split())]
diff = [a[i] - b[i] for i in range(N)]
diff_origin = [a[i] - b[i] for i in range(N)]
if sum(a) < sum(b):
  print("-1")
else:
  diff.sort()
  diff_origin.sort()
  ans = 0
  upper = len(diff)-1
  lower = 0
  while True:
    if diff[lower] >= 0:
      break
    if abs(diff[upper]) == abs(diff[lower]):
      diff[upper] = 0
      diff[lower] = 0
      upper -= 1
      lower += 1
    elif abs(diff[upper]) < abs(diff[lower]):
      diff[lower] += diff[upper]
      diff[upper] = 0
      upper -= 1
    else:
      diff[upper] += diff[lower]
      diff[lower] = 0
      lower += 1
  for i in range(len(diff)):
    if diff[i] != diff_origin[i]:
      ans += 1
  print(ans)

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

#define MAX 40
#define INF (INT32_MAX/2)

int N, Ma, Mb;
int A[MAX];
int B[MAX];
int C[MAX];

int memo[MAX + 1][10 * MAX +1][10 * MAX +1];

int dfs( int i, int a, int b )
{
	if( a * Mb == b * Ma && a && b ) {
		return 0;
	}
	if( i >= N ) {
		return INF;
	}
	if( memo[i][a][b] >= 0 ) {
		return memo[i][a][b];
	}
	int res1 = dfs( i + 1, a, b );
	int res2 = dfs( i + 1, a + A[i], b + B[i] ) + C[i];
	int res = min( res1, res2 );
	memo[i][a][b] = res;
	return res;
}

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

	memset( memo, -1, sizeof( memo ) );
	int ans = dfs( 0, 0, 0 );

	if( ans >= INF ) {
		cout << -1 << endl;
	}
	else {
		cout << ans << endl;
	}

	return 0;
}


Measured memory_bytes: 25984
#include <iostream>
#include <cfenv>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <limits>

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

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

    vector<int> p(n,0);
    rep(i,n){
        cin >> p[i];
    }

    int count = 0;
    int max = 2 * pow(10, 5);

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

    cout << count << endl;
}

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

int cmpnum(const void * n1, const void * n2)
{
	if (*(int *)n1 > *(int *)n2)
	{
		return -1;
	}
	else if (*(int *)n1 < *(int *)n2)
	{
		return 1;
	}
	else
	{
		return 0;
	}
}


int main(void) {

  int n;
  scanf("%d", &n);
  int l[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &l[i]);
  }
  qsort(l, n, sizeof(int), cmpnum);
  int start,end,center;
  long count = 0;
  for (int i = 0; i < n-2; i++) {
    for (int j = i+1; j < n-1; j++) {
      start = j;
      end = n;
      while (1) {
        if (start+1 == end) {
          break;
        }
        center = (start+end)/2;
        if (l[center]+l[j] > l[i]) {
          start = center;
        } else {
          end = center;
        }
      }
      count += start-j;
    }
  }
  printf("%ld\n", count);

  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using ll = long long int;
using namespace std;
ll mod=1e9+7;


int main() {
  int n;
  cin >> n;
  int a[n];
  rep(i,n){cin >> a[i];}
  int ans=0;
  int q=0;

  rep(i,n-1){
      if(a[i]>=a[i+1]){q++;}else{q=0;}
      ans=max(ans,q);
      }
  cout << ans << endl;
}

Measured memory_bytes: 640
use std::io::*;
use std::str::FromStr;

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

fn main() {
    let nk = (read::<i64>(), read::<i64>());

    let mut count :i64 = 0;
    let mut count2 :i64 = 0;
    for i in 0..nk.0 {
        if nk.1 % 2 == 0 {
            if (i+1) % nk.1 == nk.1/2 {
                count2 += 1;
            }
        }
        if (i+1) % nk.1 == 0 {
            count += 1;
        }
    }
    println!("{}", count2.pow(3u32) + count.pow(3u32));
}


Measured memory_bytes: 4352
fn read_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim_right().to_owned()
}

fn main() {
    let nums: Vec<u64> = read_line().split_whitespace().map(|x| x.parse().unwrap()).collect();
    let a = nums[0];
    println!("{}", 3 * a * a);
}


Measured memory_bytes: 4352
use std::io;

fn read_line () -> u32{
    let mut buf = String::new();
    io::stdin().read_line(&mut buf);
    buf.trim().parse().unwrap()
}
enum Contest {
    ABC,
    ARC
}

// let's try something
impl ToString for Contest {
    fn to_string(&self) -> String {
        match *self {
            Contest::ABC => "ABC",
            Contest::ARC => "ARC"
        }.to_string()
    }
}

fn decide_contest(n:u32) -> Contest {
    if n < 1200 {
        Contest::ABC
    } else {
        Contest::ARC
    }
}

fn main (){
    let n = read_line();
    println!("{}", decide_contest(n).to_string());
}


Measured memory_bytes: 380
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
  long long int n;
  cin>>n;
  long long int ans=n;
  for(long long int i=sqrt(n); i>0; i--){
    if(n%i==0){
      ans=i;
      break;
    }
  }
  long long int pre=n/ans;
  long long int high=max(to_string(ans).size(),to_string(pre).size());
  cout<<high<<endl;
}

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


int main()
{
	int x, y;
	cin >> x >> y;
	if (2*x <= y && (y-2*x)%2 < 1 && y <= 4*x && (4*x-y)%2 < 1)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}



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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

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

int main()
{
    ll i,j;
    ll k;
    cin >> k;
    ll spare = 0;
    for(i = 0;i <= k;++i){
        spare += 7*pow_mod(10, i, k);
        if(spare%k == 0){
            cout << i+1 << endl;
            return 0;
        }
    }
    cout << -1 << endl;

    return 0;
}

Measured memory_bytes: 3624
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 1> { using type = vector<T>; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
/* clang-format on */

int main() {
  ll N;
  while (cin >> N) {
    if (N == 0) {
      cout << "0" << endl;
      continue;
    }
    string res = "";
    while (N != 0) {
      ll rem = N % -2;
      N = N / -2;
      if (rem < 0) {
        rem += 2;
        N += 1;
      }
      res = res + char(rem + '0');
    }
    reverse(res.begin(), res.end());
    cout << res << endl;
  }
  return 0;
}


Measured memory_bytes: 256
using System;

public class Program
{
    private int N;
    private int[] V;
    public void Solve()
    {
        var sc = new Scanner();
        N = sc.NextInt();
        V = sc.IntArray();
        Array.Sort(V);
        double ans = V[0];
        foreach (int i in V)
        {
            ans = (ans + i) / 2;
        }
        Console.WriteLine(ans);
    }

    public static void Main(string[] args)
    {
        new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _pos = 0;
        _line = new string[0];
    }

    const char Separator = ' ';
    private int _pos;
    private string[] _line;

    #region スペース区切りで取得

    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = Console.ReadLine().Split(Separator);
            _pos = 0;
        }

        return _line[_pos++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }

    #endregion

    #region 型変換

    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }

    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }

    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }

    #endregion

    #region 配列取得

    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = Console.ReadLine().Split(Separator);

        _pos = _line.Length;
        return _line;
    }

    public int[] IntArray()
    {
        return ToIntArray(Array());
    }

    public long[] LongArray()
    {
        return ToLongArray(Array());
    }

    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }

    #endregion
}

Measured memory_bytes: 11220
#include<bits/stdc++.h>
using namespace std;
int main ()
{
    int i,j,c=0;
    string s,t;
    cin>>s;
    cin>>t;
    for(i=0;i<s.size();i++)
    {
        if(s[i]!=t[i])
        {c++;}
    }
    cout<<c;
    return 0;
}

Measured memory_bytes: 3916