akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
const int INF = 1000000000;
const int MOD = 1000000007;
int main(){
	int n,k;
	cin >> n >> k;
	vector<int> v(n);
	for(int i = 0;i < n;i++)cin >> v[i];

	ll ans = 0;

	for(int i = 0;i <= n;i++){
		for(int j = 0;j <= n;j++){
			if(i + j > n || i + j > k)continue;
			ll now = 0;

			priority_queue<int,vector<int>,greater<int>> q;
			for(int l = 0;l < i;l++){
				now += v[l];
				q.push(v[l]);
			}
			for(int l = 0;l < j;l++){
				now += v[n-1-l];
				q.push(v[n-1-l]);
			}

			int cnt = k - (i + j);
			while(q.size() && q.top() < 0 && cnt > 0){
				cnt--;
				now -= q.top();
				q.pop();
			}

			ans = max(now,ans);
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define AB_BHI_NI_DEGI                \
	ios_base::sync_with_stdio(false); \
	cin.tie(NULL);                    \
	cout.tie(NULL);
#define int long long
#define pb push_back
#define N 100009
#define inf 1e18
const double PI = 3.141592653589793238462643383279;
int mod = 1e9 + 7;
//int mod = 998244353;
#define P pair<int, int>
#define F first
#define S second
#define ll long long
#define all(v) v.begin(), v.end()
#define vi vector<int>
#define ld long double

#define ordered_set tree<P, null_type, less<P>, rb_tree_tag, tree_order_statistics_node_update>

void end(int n = -1)
{
	cout << n << "\n";
	exit(0);
}
int n;
ld dp[305][305][305];
ld fun(int one, int two, int three)
{
	if (one < 0 or two < 0 or three < 0)
		return 0;
	if (one == 0 and two == 0 and three == 0)
		return 0;
	if (dp[one][two][three])
		return dp[one][two][three];
	int rem = one + two + three;
	ld v = n + one * fun(one - 1, two, three) +
		   two * fun(one + 1, two - 1, three) +
		   three * fun(one, two + 1, three - 1);
	return dp[one][two][three] = v / rem;
}
int32_t main()
{
	AB_BHI_NI_DEGI
	cin >> n;
	int one = 0, two = 0, three = 0;
	for (int i = 0; i < n; i++)
	{
		int x;
		cin >> x;
		if (x == 1)
			one++;
		else if (x == 2)
			two++;
		else if (x == 3)
			three++;
	}

	cout.precision(20);
	cout << fixed;
	cout << fun(one, two, three) << "\n";

	return 0;
}

Measured memory_bytes: 430464
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = [INT() for _ in range(N)]
ans = 0
tmp = A[0]
for i, a in enumerate(A):
	if a > i or a >= tmp+2:
		print(-1)
		break
	if a != tmp+1:
		ans += tmp
	tmp = a

else:
	ans += tmp
	print(ans)


Measured memory_bytes: 13148
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>

//エイリアス
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    template<typename T>
    vector<T> read_vec(size_t n){
        vector<T> tmp(n);
        for(size_t i = 0; i < n; i++){
            cin >> tmp[i];
        }
        return tmp;
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};


int main(){
    Stream io;

    ll N;
    io.read(N);
    auto A = io.read_vec<ll>(N);

    sort(A.begin(), A.end(), greater<ll>());

    ll ans = 0;
    priority_queue<ll> q;
    q.push(A[0]);
    for(int i = 1; i < N; i++){
        ans += q.top(); q.pop();
        q.push(A[i]);
        q.push(A[i]);
    }

    cout << ans;
    return 0;
}


Measured memory_bytes: 6912
#include<bits/stdc++.h>
using namespace std;
#define fast_io ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define forp(i,a,b) for (int i = a; i <b; i++)
#define forn(i,a,b) for (int i = a; i >b; i--)
#define mod 1000000007
#define multiple_testcases_t int t;cin>>t;while(t--){solve();}
#define single_testcase_t solve();
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;


ll fact(ll n)
{
  if(n==0 || n==1)
  return 1;
  else
  return (n*fact(n-1)%mod)%mod;
}

int prime(ll n)
{
  for(int i=2;i<=sqrt(n);i++)
  {
    if(n%i==0)
    {
      return 0;
    }
  }
  return 1;
}

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

ll lcm(ll a,ll b)
{
    return (a*b)/gcd(a,b);
}

int check_palin(string s)
{
  string str=s;
  reverse(str.begin(),str.end());
  if(str==s)
  return 1;
  else
  return 0;
}

vector<ll> divisors(ll n)
{
  vector<ll> v;
  for(int i=2;i<=sqrt(n);i++)
  {
    if(n%i==0)
    {
      if(i==n/i)
      v.PB(i);
      else
      v.PB(i),v.PB(n/i);
    }
  }
return v;
}

ll bin_expo(int x,int n)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return bin_expo(x*x,n/2);
    else                             //n is odd
        return x*bin_expo(x*x,(n-1)/2);
}

ll modular_expo(int x,int n,int M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return modular_expo((x*x)%M,n/2,M);
    else                             //n is odd
        return (x*modular_expo((x*x)%M,(n-1)/2,M))%M;
}

ll kadane_algo(int a[],int n)
{
   ll max_so_far=0,max_ending_here=0;
   forp(i,0,n)
   {
     max_ending_here+=a[i];
     if(max_ending_here<0)
     max_ending_here=0;

     if(max_ending_here>max_so_far)
     max_so_far=max_ending_here;
   }

   return max_so_far;
}

// <----- Actual solve() function to print output -----> //
void solve()
{
   int n,z=0,k,x,y;
cin>>n;
int a[n];
set<int> s;
map<int,int> mp;
forp(i,0,n)
{
    cin>>a[i];
    s.insert(a[i]);
    mp[a[i]]++;
}
set<int> :: iterator it;
for(it=s.begin();it!=s.end();it++)
    a[z++]=*it;
x=0;
forp(i,0,z)
{
    //cout<<a[i]<<mp[a[i]]<<" ";
    forp(j,i+1,z)
    {
        forp(k,j+1,z)
        {
            if((a[i]+a[j])>a[k] && (a[i]+a[k])>a[j] && (a[k]+a[j])>a[i])
            {

                x=x+mp[a[i]]*mp[a[j]]*mp[a[k]];

            }
        }
    }
}
cout<<x;
   //cout<<"\n";      //if t>1 uncomment this
}


// MAIN function --------------------------------------------------------------------------//
int main()
{
    fast_io
    single_testcase_t   //Uncomment this if only single testcase & single answer to print
   //multiple_testcases_t  //Uncomment this if t>1(t is given in question)(multiple testcases)
return 0;
}





Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main(){
  int x,n;
  cin>>x>>n;
  set<int> p;
  for(int i=0;i<n;i++){
    int a;
    cin>>a;
    p.insert(a);
  }
  int m=0;
  for(int i=0;i<=101;i++)
    m=(abs(x-i)<abs(x-m)&&!p.count(i)?i:m);
  cout<<m<<endl;
}

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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define ll long long
#define all(x) x.begin(), x.end()
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define pdd pair< double, double >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 2010
#define inf 1e14
#define MOD 1000000007

int main()

{

    ll n;
    cin >> n;
    if(n==0)
    {

        cout << 0;
        return 0;
    }
    vector<ll> v;
    while(1)
    {

        if(n==0) break;
        v.pb(abs(n%2));
        if(n < 0)
        {

            ll x=abs(n)/2;
            if(abs(n)%2 != 0) x++;
            n=x;
        }
        else
        {

            n/=-2;
        }
    }
    reverse(v.begin(), v.end());
    for(ll i = 0; i < v.size(); i++) cout << v[i];
}


Measured memory_bytes: 256
import java.util.*;
public class Main
{
	public static void main(String[] args) {
	    Main m=new Main();
	    Scanner sc=new Scanner(System.in);
	    long n=sc.nextLong();
	    String value="";
	    String val="";
	    while(n>0){
	     long rem=n % 26;
	     if(rem==0){
	     val="Z";
	     value=val+value;    
	     }
	     else{
	     value=m.getCharForNumber(rem)+value;
	     }
	     n=n-1;
	     n=n/26;
	     }
	    System.out.println(value.toLowerCase()); 
	}                                       
   	private String getCharForNumber(long i) {
    return i > 0 && i < 27 ? String.valueOf((char)(i + 64)) : "";
   } 
}


Measured memory_bytes: 39136
#include "bits/stdc++.h"
using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REP1(i, n) for(ll i = 1;i < n;i++)
#define REPR(i, n) for(ll i = n-1;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)

#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())

#define ll long long
#define ALL(a)  (a).begin(),(a).end()

#define pb(a) push_back(a)

int n,k;


int main(){
  double ans=0.0;
  cin >> n >> k;
  k--;
  REP(i,n){
    int ii=i+1;
    if (ii<=k){//コイン
      int flg=0;
      REP(j,31){
        if ((ii<<(j+1))>k){
          flg=1<<(j+1);
          break;
        }
      }
      ans+=1.0/flg;
      
    }else{
      ans+=1.0;
    }
  }
  ans/=n;



  cout<<setprecision(25)<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

class Main{
        static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        public static void main(String[] args) throws IOException{
                Stack<Integer> s1 = new Stack<>();
                Stack<int[]> s2 = new Stack<>();
                String line = br.readLine();
                int amount = 0;
                for(int i=0; i<line.length(); i++){
                        char c = line.charAt(i);
                        if(c=='\\')
                                s1.push(i);
                        else if(c=='/' && !s1.empty()){
                                int f = s1.pop();
                                int len = i-f;
                                amount += len;
                                while(!s2.empty() && s2.peek()[0] > f){
                                        len += s2.peek()[1];
                                        s2.pop();
                                }
                                s2.push(new int[] {f, len});
                        }
                }
                System.out.println(amount);
                System.out.print(s2.size());
                if(s2.size()>0)
                        System.out.print(" ");
                Object[] o = s2.toArray();
                for(int i=0; i<o.length; i++){
                        System.out.print(((int[])o[i])[1]);
                        if(i!=o.length-1)
                                System.out.print(" ");
                }
                System.out.println();
        }
}

Measured memory_bytes: 26320
#include <stdio.h>

int main(){
   int l,r,i,j,m;
    
   scanf("%d %d",&l,&r);
   i=l/2019;
   if (l==0 || l%2019==0 || r>=(i+1)*2019)
      puts("0");
   else {
      m=2019;
      for (i=l;i<r;i++)
         for (j=i+1;j<=r;j++)
            if (((i%2019)*(j%2019))%2019<m) m=((i%2019)*(j%2019))%2019;
      printf("%d\n",m);
   }
   return 0;
}


Measured memory_bytes: 128
T = ["dream", "dreamer", "erase", "eraser"]
S = input()

while len(S) >= 5:
    S_len = len(S)
    key1 = S[S_len-5:]
    key2 = S[S_len-6:]
    key3 = S[S_len-7:]

    if key1 == T[0] or key1 == T[2]:
        S = S[:S_len-5]
    elif key2 == T[3]:
        S = S[:S_len-6]
    elif key3 == T[1]:
        S = S[:S_len-7]
    else:
        break

if S == '':print("YES")
else:print("NO")

Measured memory_bytes: 3188
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        int p = 0;
        int m = 0;
        String a = "+";

        for(int i=0; i<4; i++){
            if(s.charAt(i)==a.charAt(0)){
                p += 1;
            }
        }
        m = 4 - p;

        System.out.println(p - m);
    }
}

Measured memory_bytes: 21716
#include <iostream>
#include <typeinfo>
#include <cstdlib>
#include <queue>
#include <string>
#define NMAX 101
#define MMAX 101
#define INF 100000000
using namespace std;
typedef pair<int, int> P;

char maze[NMAX][MMAX];
int h, w, sx, sy, gx, gy;
int d[NMAX][MMAX];
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int bfs(void) {
    queue<P> que;
    for(int i=0; i<h; i++) {
        for(int j=0; j<w; j++)
            d[i][j] = INF;
    }
    
    que.push(P(sx, sy));
    d[sx][sy] = 0;
    
    while(que.size()) {
        P p = que.front();
        que.pop();
        
        if(p.first==gx && p.second==gy) break;
        
        for(int i=0; i<4; i++) {
            int nx = p.first + dx[i], ny = p.second + dy[i];
            if(0<=nx && nx<h && 0<=ny && ny<w && maze[nx][ny] != '#' && d[nx][ny]==INF) {
                que.push(P(nx, ny));
                d[nx][ny] = d[p.first][p.second] + 1;
            }
        }
    }
    return d[gx][gy];
}


int main(void) {
    cin >> h >> w;
    sx=0;
    sy=0;
    gx=h-1;
    gy=w-1;
    for(int i=0; i<h; i++)
        scanf("%s", maze[i]);
    
    int cnt=0;
    for(int i=0; i<h; i++) {
        for(int j=0; j<w; j++) {
            if(maze[i][j]=='#')
                cnt++;
        }
    }
    if(bfs()==INF)
        cout << -1 << endl;
    else
        cout << h*w-bfs()-cnt-1 << endl;
}


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

int main(void)
{
    int h, w;

    cin >> h >> w;

    string str[h+1];

    for(int i = 1; i <= h; i++)
    {
        cin >> str[i];
    }

    for(int i = 0; i <= h+1; i++)
    {
        for(int j = 0; j <= w+1; j++)
        {
            if(i == 0 or i == h+1 or j == 0 or j == w+1)
            {
                cout << '#';
                if(j == w+1) cout << endl;
            }
            else
            {
                cout << str[i][j-1];
            }
            
        }
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>
using namespace std ;

int main(){
    string s,t;
    cin >> s;
    int n = s.size();
    int count = 0;
    int count2 = 0;
    int ans = 0;

    for(int i = 0; i < n; i++){
        if(i%2 == 0){
            if(s[i] == '0'){
                count = count+1;
            }
        }else{
            if(s[i] == '1'){
                count = count+1;
            }
        }
    }   
    for(int i = 0; i < n; i++){
        if(i%2 == 0){
            if(s[i] == '1'){
                count2 = count2+1;
            }
        }else{
                if(s[i] == '0'){
                count2 = count2+1;
            }
        }
    }
    if(count < count2){
        ans = count;
    }else{
        ans = count2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <iomanip> //! for setprecision(10)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>

using namespace std;

typedef long long LL;

#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define rep(i,n) for (int i = 0; i < (n); ++i)

const int MOD = 1000000007;

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

    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    vector<LL> h(N+1);
    rep(i, N) h[A[i]]++;
    LL tot = 0;
    rep(i, N+1) {
        if (1 < h[i]) {
            tot += h[i] * (h[i]-1) / 2;
        }
    }
    rep(i, N) {
        LL ans = tot;
        LL x = h[A[i]];
        if (1 < x) {
            ans -= x*(x-1)/2;
            ans += (x-1)*(x-2)/2;
        }
        cout << ans << '\n';
    }
    cout << endl;

    return 0;
}


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

using namespace std;
#define ll long long
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> TUP;
#define a first
#define b second
#define bg begin()
#define ed end()
#define sz size()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;

int main(){
	ll N; cin>>N;
	string s,t; cin>>s>>t;
	bool f=true;
	//i文字かぶっているかどうか
	for(int i=N;i>=1;i--){
		rep1(j,i){
			if(s[N-i-1+j]!=t[j-1]) f=false;
		}
		if(f){
			cout<<2*N-i;
			return 0;
		}
		f=true;
	}
	cout<<2*N;
}

Measured memory_bytes: 256
def get_num(s, t):
    cnt = len(s)
    for i in range(len(s)):
        if s[i] == t[i]:
            cnt -= 1
    return cnt


def main():

    s = input()
    t = input()
    len_s, len_t = len(s), len(t)
    ans = len_t
    for i in range(len_s - len_t + 1):
        new_s = s[i:len(t) + i]
        tmp = get_num(new_s, t)
        ans = min(ans, tmp)

    print(ans)


if __name__ == '__main__':
    main()

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

using namespace std;

void __start__() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifdef MY
    freopen("/home/ainur/CLionProjects/wow/input.txt", "r", stdin);
    freopen("/home/ainur/CLionProjects/wow/output.txt", "w", stdout);
#else
#define endl '\n'
    //freopen("search.in", "r", stdin);
    //freopen("search.out", "w", stdout);
#endif
}

#define sz(x) (int)x.size()
#define yes cout<<"Yes\n"
#define  no cout << "No\n"
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define ft first
#define sd second
#define read(a) for(auto &qwqw:a)cin >> qwqw;
#define print(a) for(auto qwqw:a)cout<<qwqw<<' ';
#define print_plus(a) for(auto qwqw:a)cout<<qwqw+1<<' ';
//#define FOR(i, b, n) for(int i=b;i<n;i++) #define FOR(i, n) FOR(i, 0, n) #define FOR(n) FOR(i, 0, n)
mt19937_64 rnd(time(0));
#define int long long
using ll = long long;
using vi = vector<int>;
using ld = long double;
using vb = vector<bool>;
using pii = pair<int, int>;
using vd = vector<long double>;


int log2(int q) {
    int c = 0;
    while (q) {
        q >>= 1;
        c++;
    }
    return c;
}


void test_case() {
    int k, x;
    cin >> k >> x;
    cout << (k*500>= x? "Yes\n":"No\n");
}

signed main() {
    __start__();
    int Q = 1;
    //cin >> Q;
    while (Q--) {
        test_case();
    }
}




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

using namespace std;
typedef long long int ll;
typedef pair<int,string> is;
int main()
{   
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n, m;
    cin>>n;
    cin>>m;
    ll q[m],p[m], pos[n];
    for(ll i=0;i<n;i++)
        pos[i]=1000000;
    string r[m];
    set<int> s;
    for(ll i=0; i<m;i++)
    {
        ll x;
        string y;
        cin>>x; q[i]=x;
        cin>>y; r[i]=y;
    }
    for(ll i=0; i<m;i++)
    {
        if(r[i][0]=='A')
        {
            s.insert(q[i]);
            pos[q[i]-1]=min(i,pos[q[i]-1]);
        }
        else
            p[i]=1;
    }
    ll sum=0;
    for(ll i=0;i<m;i++)
    {
        if(s.find(q[i])!=s.end())
        {
            if(i<pos[q[i]-1])
            sum+=p[i];
        }
    }
    cout<<s.size()<<" "<<sum;
    return 0;
}

Measured memory_bytes: 12800
fun main(args: Array<String>) {
    val (X,Y) = readIntList()
    val mod = 1000000007
    val a = (2*X - Y)/3
    val b = (2*Y - X)/3
    
    if ((2*X - Y)%3 != 0 || a < 0 || b < 0){
        println(0)
        return
    }


    var comb = Comb(a+b, mod)

    val fact = (comb.fac[a+b]*comb.finv[a]%mod)*comb.finv[b]
    println(fact%mod)
}

fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)

fun Int.pow(n:Int) = Math.pow(this.toDouble(), n.toDouble())

class Comb(max:Int, mod:Int) {
    val fac  = LongArray(max+1).apply { this[0] = 1L; this[1] = 1L }
    val finv = LongArray(max+1).apply { this[0] = 1L; this[1] = 1L }
    val inv  = LongArray(max+1).apply { this[1] = 1L }

    init {
        for (i in 2 .. max) {
            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: 54284
list_S = list(input())
k = int(input())
set_ANS = set()
list_Alph = list(set(list_S))
cnt = 0
list_Alph.sort()

for c in list_Alph:
    q = [i for i, x in enumerate(list_S) if x == c]
    list_M = []
    for i in q:
        l = "".join(list_S[i:])
        list_M.append(l)
    list_M.sort()
    for s in list_M:
        m = list(s)
        for j in range(1,len(m)+1):
            b = "".join(m[:j])
            if b not in set_ANS:
                set_ANS.add(b)
                cnt += 1
                if cnt == k:
                    print(b)
                    exit()



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

int comp(const void *a,const void *b)
{
    return *(int *)a - *(int *)b;
}

int main()
{
    int i,N,ans=0,count=1;
    scanf("%d",&N);
    int a[N];
    for(i=0;i<N;i++){
        scanf("%d",&a[i]);
    }

    qsort(a,N,sizeof(int),comp);

    for(i=1;i<N;i++){
        if( a[i-1] == a[i] ){
            count++;
        }else{
            if( count >= a[i-1] ){
                ans += count - a[i-1];
                count = 1;
            }else{
                ans += count;
                count = 1;
            }
        }
    }

    if( count >= a[N-1] ){
        ans += count - a[N-1];
        count = 1;
    }else{
        ans += count;
    }

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

    return 0;

}

Measured memory_bytes: 892
#include <stdio.h>
#define N 8
int A[N][N]={-1};
int b[N]={-1};
int c[N]={-1};
int d[15]={-1};
int e[15]={-1};
void putQueen(int i){
  int j;
  if(i==N){
    printBoard();
    return;
  }
  for(j=0;j<N;j++){
    if(c[j]==1||d[i+j]==1||e[i-j+N-1]==1) continue;
    b[i] = j;
    c[j] = d[i+j] = e[i-j+N-1] = 1;
    putQueen(i+1);
    b[i] = c[j] = d[i+j] = e[i-j+N-1] = -1;
  }
}
void printBoard(){
  int i,j;
  for(i=0;i<N;i++) {
    for(j=0;j<N;j++) {
      if(A[i][j]==1) {
	if(b[i]!=j) return;
      }
    }
  }
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(b[i]==j) printf("Q");
      else printf(".");
    }
    printf("\n");
  }
}

int main(){
  int i,j,n,m;
  scanf("%d",&n);
  for(m=0;m<n;m++){
    scanf("%d%d",&i,&j);
    A[i][j] = 1;
  }
  putQueen(0);
  return 0;
}

Measured memory_bytes: 572
import math
from decimal import Decimal
pi = Decimal("3.141592653589793238462643383279502884")
A, B, H, M =  map(int, input().split())
time = H * 60 + M
H_rad = (2* pi / (60*12)) * time 
M_rad = (2* pi / 60) * time
rad = abs(H_rad-M_rad) % (2 * pi)
C = math.sqrt(A**2 + B**2 - 2 * A * B * math.cos(rad))
print(f'{C:.10f}')

Measured memory_bytes: 10252
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#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 revrep(i, s) for (int i = s-1; i > 0; i--)
#define revrrep(i, s) for (int i = s-1; i >= 0; i--)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    int A, B; cin >> A >> B;
    if (A+B >= 24) cout << abs(24-(A+B)) << endl;
    else cout << A+B << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i < (int)(n); i++)
#define fo(i,s,e) for (int i=(s); i < (e); i++)
#define all(obj) (obj).begin(), (obj).end()
#define int long long
signed main () {
  int n;cin >> n;
  int ans=n;
  for(int i=1;i*i<=n;i++) ans =(n%i!=0 ? ans : min(ans,i+n/i-2));
  cout << ans << endl;
}

Measured memory_bytes: 3624
import math
N = int(input())
X = N / 1.08
X_m = math.floor(X)
X_p = math.ceil(X)
if math.floor(X_m * 1.08) == N:
  print(X_m)
elif math.floor(X_p * 1.08) == N:
  print(X_p)
else:
  print(":(")

Measured memory_bytes: 3060
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int prev = 0;
		int count = 0;
		int ans = 0;
		
		for (int i=0; i<N; i++) {
			int tmp = sc.nextInt();
			if (prev >= tmp) {
				count++;
				ans = Math.max(ans, count);
			} else {
				count = 0;
			}
			prev = tmp;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 48660
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

constexpr int MOD = 1000000007;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> PLL;

int N;
int p[20000];

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

    cin >> N;
    for (int j = 0; j < N; ++j) {
        cin >> p[j];
        --p[j];
    }

    vector<P> v(N);
    for (int j = 0; j < N; ++j) {
        v[p[j]].first =  20001*p[j] + (j+1);
        v[p[j]].second = ((N+1)*20001- 20001*p[j]) + (j+1);
    }

    for (int j = 0; j < N; ++j) {
        if (j > 0) {
            cout << ' ';
        }
        cout << v[j].first;
    }
    cout << endl;

    for (int j = 0; j < N; ++j) {
        if (j > 0) {
            cout << ' ';
        }
        cout << v[j].second;
    }
    cout << endl;


    return 0;
}


Measured memory_bytes: 896
import java.util.*;

public class Main
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();

        int v = sc.nextInt();
        if (a <= 5)
            v = 0;
        else if (a < 13)
            v /= 2;

        System.out.println(v);
    }
}


Measured memory_bytes: 21844
n = gets.chomp.to_i
labits = gets.chomp.split(" ")
count = 0
n.times{ |k|
  labits[k] = labits[k].to_i
}
n.times{ |k|
  if labits[k] == 0
    
  elsif labits[labits[k] - 1] == (k + 1)
    labits[labits[k] - 1] = 0
    labits[k] = 0
    count += 1
  end
}
puts count

Measured memory_bytes: 7948
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define se second
#define fi first
#define mp make_pair
#define pb push_back
#define all(_v) _v.begin(), _v.end()
const int mod = (int)1e9 + 7;
const int INF = (int)1e9;
const ll LINF = (ll)1e18;
const int N = (int)1e5 + 100;
const int MAXA = (int)3e6;
int n,k;
int d[N];
vector<int> g[N];
pair<int, int> quer[N];
int bfsvert(int s){
    queue<int> q;
    q.push(s);
    for(int i = 1;i <= n;i++)d[i] = INF;
    d[s] = 0;
    while(!q.empty()){
        int v = q.front();
        q.pop();
        for(int to: g[v]){
            if(d[to] > d[v] + 1){
                d[to] = d[v] + 1;
                q.push(to);
            }
        }
    }
    int cnt = 0;
    for(int i = 1;i <= n;i++)if(d[i] > (k / 2))cnt++;
    return cnt;
}

int bfsedge(int i){
    queue<int> q;
    q.push(quer[i].fi);
    q.push(quer[i].se);
    for(int i = 1;i <= n;i++)d[i] = INF;
    d[quer[i].fi] = 1;
    d[quer[i].se] = 1;
    while(!q.empty()){
        int v = q.front();
        q.pop();
        for(int to: g[v]){
            if(d[to] > d[v] + 1){
                d[to] = d[v] + 1;
                q.push(to);
            }
        }
    }
    int cnt = 0;
    for(int i = 1;i <= n;i++)if(d[i] > ((k + 1) / 2))cnt++;
    return cnt;
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
    // ifstream cin("input.txt");
    // ofstream cout("output.txt");
    cin >> n >> k;
    for(int i = 1;i <= n - 1;i++){
        int u,v;
        cin >> u >> v;
        quer[i] = {u, v};
        g[u].pb(v);
        g[v].pb(u);
    }
    int ans = INT_MAX;
    for(int i = 1;i <= n;i++){
        ans = min(bfsvert(i), ans);
    }
    for(int i = 1;i <= n - 1;i++){
        ans = min(bfsedge(i), ans);
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 6112
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 

using namespace std;
using namespace __gnu_pbds; 

#define     mod             (int)1e9+7
#define     MOD             998244353
#define     ll              long long
#define     mp              make_pair
#define     F               first
#define     S               second
#define     t()             int test;cin>>test;while(test--)
#define     ii              pair<int,int>
#define     que_max         priority_queue <int>
#define     que_min         priority_queue <int, vector<int> , greater<int> >
#define     IOS             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define     endl            "\n"
typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif


bool compare(ii a, ii b)
{
    if(a.F > b.F) return true;
    if(a.F == b.F)
    {
        if(a.S > b.S) return true;

        return false;
    }
    return false;
}



int32_t main()
 
{  
    #ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    #endif

    IOS;
     
   int n;
   cin >> n;


   std::vector<int> v(n);
   for(auto &i : v)cin >>i;

    

    ll balance = 1000;

    ll stock = 0;

    int i =0;
    while(1)
    {
        

        while(i+1 < n && v[i] >= v[i+1])
        {
            i++;
        }
        if(i == n - 1)break;

        stock = balance / v[i];
        balance -= stock*v[i];

        while(i+1 < n && v[i] <= v[i+1])
        {
            i++;
        }
        
        balance += stock * v[i];
        stock = 0;

    }

    cout << balance << endl;
        

}
            

    
    



Measured memory_bytes: 3536
#include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;
typedef long long ll;

const double eps=1e-7;

int main(){
	ll in;
	cin>>in;
	double tmp,ue,sita;
	bool check=false;
	loop(i,1,3501){
		loop(j,1,3501){
			ue=in*i*j;
			sita=4*i*j-in*i-in*j;
			tmp=ue/sita;
			if(tmp-(int)tmp<eps&&tmp>=1&&tmp<=3500){
				cout<<i<<" "<<j<<" "<<(int)tmp<<endl;
				check=true;
				break;
			}
		}
		if(check)break;
	}
	return 0;
}

Measured memory_bytes: 3644
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 n = read::<usize>();
    let mut a:f64 = 0.0;
    let mut ans:f64 = 0.0;
    for i in 0..n {
        a = read::<f64>();
        ans += 1.0/a;
    }

    println!("{}" ,1.0/ans)
}

Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
typedef long long int ll;
using namespace std;

int main(int argc, char const *argv[]) {
  ll N, INF = 1000000000000000000;
  cin >> N;
  vector<ll> A(N), S(N);
  for(int i=0;i<N;i++) std::cin >> A[i];
  ll dp[N][N];
  for(int i=0;i<N;i++) {
    dp[i][i] = A[i];
    S[i] = (i==0?0:S[i-1]) + A[i];
  }
  for(int w=1;w<N;w++){
    for(int l=0;l+w<N;l++){
      dp[l][l+w] = INF;
      for(int s=0;s<w;s++){
        dp[l][l+w] = min(dp[l][l+w],S[l+w]-(l==0?0:S[l-1]) + dp[l][l+s]+dp[l+s+1][l+w]);
      }
    }
  }
  /*
  for(int w=0;w<N;w++){
    for(int l=0;l+w<N;l++) {
      std::cout << "now" << " " << l << " " << l+w << '\n';
      std::cout << dp[l][l+w] << '\n';
    }
  }*/
  std::cout << dp[0][N-1] - S[N-1]<< '\n';
  return 0;
}


Measured memory_bytes: 1536
n=int(input())
s=[]
for i in range(n):
    s.append(int(input()))
s.sort()

if sum(s)%10==0:
    for i in range(n):
        if s[i]%10!=0:
            print(sum(s)-s[i])
            exit()
    print(0)
    exit()
print(sum(s))


Measured memory_bytes: 9104
#include <bits/stdc++.h>
using namespace std;
#define ref(i,x,y)for(int i=x;i<=y;++i)
#define def(i,x,y)for(int i=x;i>=y;--i)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define SZ(x) ((int)x.size())
typedef long long LL;
typedef pair<int,int> PII;
int read(){
	char c=getchar();int d=0,f=1;
	for(;c<'0'||c>'9';c=getchar())if(c=='-')f=-1;
	for(;c>='0'&&c<='9';d=d*10+c-48,c=getchar());
	return d*f;
}
const int N=310;
const int mod=998244353;
int n,a[N],dp[N][N*N];
void inc(int&a,int b){a+=b;if(a>=mod)a-=mod;}
int main(){
	cin>>n;int sum=0;
	ref(i,1,n)cin>>a[i],sum+=a[i];
	dp[0][0]=1;
	ref(i,1,n)ref(j,0,90000)if(dp[i-1][j]){
		inc(dp[i][j+a[i]],dp[i-1][j]);
		inc(dp[i][j],dp[i-1][j]*2%mod);
	}
	int ans=0;
	ref(i,(sum+1)/2,sum)inc(ans,(LL)dp[n][i]*3%mod);
	if(sum%2==0){
		memset(dp,0,sizeof dp);
		dp[0][0]=1;
		ref(i,1,n)ref(j,0,90000)if(dp[i-1][j]){
			inc(dp[i][j+a[i]],dp[i-1][j]);
			inc(dp[i][j],dp[i-1][j]);
		}
		inc(ans,mod-(LL)dp[n][sum/2]*3%mod);
	}
	int anss=1;
	ref(i,1,n)anss=(LL)anss*3%mod;
	ans=(anss+mod-ans)%mod;
	cout<<ans<<endl;
}

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

using namespace std;
#define ll long long

const int N = 200000;
ll ans;
ll h[N];

int main() {
  int n,k;
  scanf("%d", &n);
  scanf("%d", &k);
  for(int i=0; i<n; ++i){
    scanf("%lld", h + i);
  }

  sort(h, h + n);
  ll ans = 0;
  for(int i = 0; i < n - k; ++i){
    ans += h[i];
  }

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

	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define NewNode (ListNode *)malloc(sizeof(ListNode))
#define Mem(a,b) memset(a,b,sizeof(a))
const int N = 4e5 + 5;
const int INF = 0x3f3f3f3f;
const double EPS = 1e-10;
const unsigned long long mod = 998244353;
const double II = 3.1415926535;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> piil;
int main()
{
    std::ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    string s;
    cin >> s;
    s == "ARC" ? cout << "ABC" << endl : cout << "ARC" << endl;
}


Measured memory_bytes: 3652
import java.util.*;

public class Main {
    static int INF = 1001001009;
    
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        int k = sc.nextInt();
        
        int sx = sc.nextInt() - 1;
        int sy = sc.nextInt() - 1;
        int gx = sc.nextInt() - 1;
        int gy = sc.nextInt() - 1;
        
        // board[i][j]: 迷路
        char[][] board = new char[h][w];
        for (int i = 0; i < h; i++) {
            String str = sc.next();
            for (int j = 0; j < w; j++) {
                board[i][j] = str.charAt(j);
            }
        }
        
        int[][] dist = new int[h][w];
        for (int[] d : dist) {
            Arrays.fill(d, INF);
        }
        
        // visited[i][j]: 当該マスを既に通ったか否か
        boolean[][] visited = new boolean[h][w];
        
        // 上下左右
        int[] dx = new int[]{1, 0, -1, 0};
        int[] dy = new int[]{0, 1, 0, -1};
        
        // ans = BFS((sx, sy)→(gx, gy)までの最短経路の深さ)
        int steps = -1;
        Queue<int[]> que = new ArrayDeque<int[]>();
        que.add(new int[]{sx, sy, 0});
        visited[sx][sy] = true;
        while (!que.isEmpty()) {
            int[] cur = que.poll();
            int x = cur[0];
            int y = cur[1];
            int depth = cur[2];
            
            if (x == gx && y == gy) {
                steps = depth;
                break;
            }
            
            // 移動可能ならそのマスに深さ+1を配ってキューに入れる
            for (int i = 0; i < 4; i++) {
                for (int j = 1; j <= k; j++) {
                    int nx = x + dx[i] * j;
                    int ny = y + dy[i] * j;
                    int ndepth = depth + 1;
                    
                    // System.out.println(nx + " " + ny + " " + ndepth);
                    
                    if (!(0 <= nx && nx < h && 0 <= ny && ny < w)) break;
                    if (board[nx][ny] != '.') break;
                    if (dist[nx][ny] < ndepth) break;
                    
                    if (!visited[nx][ny]) {
                        que.add(new int[]{nx, ny, ndepth});
                        dist[nx][ny] = ndepth;
                        visited[nx][ny] = true;
                    }
                }
            }
        }
        System.out.println(steps);
    }
}

Measured memory_bytes: 63980
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#define ll long long
const int M = 200050 ;
using namespace std ;
inline ll read() {
	char c = getchar() ; ll x = 0 , w = 1 ;
	while(c>'9'||c<'0') { if(c=='-') w = -1 ; c = getchar() ; }
	while(c>='0'&&c<='9') { x = x*10+c-'0' ; c = getchar() ; }
	return x*w ;
}
ll n;
ll m=M;
struct BIT {
	ll a[M];
	void clear() {
		memset(a,0,sizeof(a));
	}
	ll lowbit(ll x) {
		return x&(-x);
	}
	void add(ll x,ll val) {
		for(; x<=m; x+=lowbit(x)) a[x]+=val;
	}
	ll sum(ll x) {
		ll re=0;
		for(; x>0; x-=lowbit(x)) re+=a[x];
		return re;
	}
}T ;
struct ele {
	ll val,num;
} a[100010];
ll w[100010];
bool cmp1(ele l,ele r) {
	return l.val<r.val;
}
bool cmp2(ele l,ele r) {
	return l.num<r.num;
}
ll x[100010];
ll lim;
bool check(ll val) {
	ll i;
	ll sum=0,re=0;
	T.clear();
	for(i=1; i<=n; i++) {
		if(a[i].val<val) x[i]=-1;
		else x[i]=1;
	}
	T.add(100000,1);
	for(i=1; i<=n; i++) {
		sum+=x[i];
		re += T.sum(sum+100000);
		T.add(sum+100000,1);
	}
	return re>=(lim/2+lim%2);
}
int main() {
	ll i;
	n=read();
	lim=n*(n+1)/2;
	for(i=1; i<=n; i++) a[i].val=read(),a[i].num=i;
	sort(a+1,a+n+1,cmp1);
	for(i=1; i<=n; i++) w[i]=a[i].val;
	sort(a+1,a+n+1,cmp2);
	ll l=1,r=n,mid;
	while(l < r) {
		mid=(l+r)>>1 ;
		mid++ ;
		if(check(w[mid])) l = mid ;
		else r = mid - 1 ;
	}
	printf("%lld\n",w[l]);
	return 0 ;
}

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

int main(){
    int N;
    cin >> N;
    string s[N];
    int p[N],ind[N];
    for(int i=0;i<N;i++){
      cin >> s[i] >> p[i];
      ind[i] = i + 1;
    }

    for(int i=0;i<N;i++){
      for(int j=0;j<N-1;j++){
        if(s[j] == s[j+1]){
          if(p[j] < p[j + 1]){
            string tmp;
            int t;
            tmp = s[j];
            s[j] = s[j+1];
            s[j+1] = tmp;
            t = p[j];
            p[j] = p[j + 1];
            p[j + 1] = t;
            t = ind[j];
            ind[j] = ind[j + 1];
            ind[j+1] = t;
          }
        }
        else if(s[j] > s[j+1]){
          string tmp;
          int t;
          tmp = s[j];
          s[j] = s[j+1];
          s[j+1] = tmp;
          t = p[j];
          p[j] = p[j + 1];
          p[j + 1] = t;
          t = ind[j];
          ind[j] = ind[j + 1];
          ind[j+1] = t;
        }
      }
    }

    for(int i=0;i<N;i++){
      cout << ind[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	int A1, A2, A3;
	cin >> A1 >> A2 >> A3;
	if (A1 + A2 + A3 > 21)
	{
		cout << "bust" << endl;
	}
	else
	{
		cout << "win" << endl;
	}
}

Measured memory_bytes: 256
#include<stdio.h>
#include<cstdlib>
#include<fstream>
#include<iostream>
#include<math.h>
#include<string>
#include<sstream>

using namespace std;

int main(){
    int N;
    cin >> N;
    int H[N];
    for (int i = 0; i < N; i++){
        cin >> H[i];
    }
    int max=0;
    int tri=0;
    for(int i = 0; i < N-1; i++){
        if(H[i] >= H[i+1]){
            tri++;
            if(tri > max){
                max =tri;
            }
        }
        else{
            if(tri > max){
                max =tri;
            }
            tri=0;
        }
    }
    cout << max <<endl;

    return 0;
}

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

int main()
{
    int a,b,t,i;
    scanf("%d%d",&a,&b);
    if(a>b){
        t=a;
        a=b;
        b=t;
    }
    for(i=a;i>0;i--){
        if(b%i==0&&a%i==0){
            break;
        }
    }
    printf("%.f",1.0*a*b/i);
    return 0;
}


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

#define ll long long
#define INF 99999999
#define rep(i,n) for(int i=0,temp=(int)(n);i<temp;++i) //vec.size()がnの時等の高速化
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define vint vector<int>
#define vvint vector<vector<int>>

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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

ll n,cnt=0;
void dfs(ll num,int flag){
  if(num>n) return;

  if(flag==7) cnt++;

  dfs(num*10+3,flag|1);
  dfs(num*10+5,flag|2);
  dfs(num*10+7,flag|4);

}


int main(){
  cin >> n;
  dfs(0,0);
  cout << cnt << endl;
  return 0;
}


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

bool in_range(int a, int b){
  return a >= 0 && a < b;
}

int main(){
  int n, m, d;
  cin >> n >> m >> d;
  vector<string> S(n);
  for(int i = 0; i < n; ++i)
    cin >> S[i];
  int dx[] = {1,0,-1,0}, dy[] = {0,1,0,-1};
  int ans = 0;
  for(int i = 0; i < n; ++i){
    for(int j = 0; j < m; ++j){
      if(S[i][j] == '#') continue;
      for(int k = 0; k < 4; ++k){
        int c = 1;
        int x = i, y = j;
        while(in_range(x+=dx[k],n) and in_range(y+=dy[k],m) and S[x][y] != '#'){
          ++c;
          if(c >= d) break;
        }
        ans += (c >= d);
      }
    }
  }
  ans /= 2;
  cout << ans << endl;
}



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


int main(void){
    int a, b, c;
    cin >> a >> b >> c;
    int Max, ans;
    if(a == max({a, b, c})){
        Max = a;
        ans = a*10+b+c;
    }else if(b == max({a, b, c})){
        Max = b;
        ans = b*10+a+c;
    }else if(c == max({a, b, c})){
        Max = c;
        ans = c*10+a+b;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <queue>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(x) (x).begin(), (x).end()

int main() {
    int n,m,l;
    cin>>n>>m>>l;
    if(n+m+l>21)cout<<"bust";
    else cout<<"win";
    
	return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include<vector>
#include<math.h>
using namespace std;
typedef long long ll;

int main() {
	ll n;
	cin >> n;
	vector<ll> A;
	for (int i = 0; i < 14; i++) {
		ll k = (ll)pow(26, 13 - i);
		if (n >= k) {
			A.emplace_back(n / k);
			n = n % k;
		}
		else if (A.size() != 0) {
			A.emplace_back(0);
		}
	}
	for (int i = 0; i < A.size()-1; i++) {
		if (A[A.size() - 1 - i] == 0) {
			A[A.size() - 2 - i]--;
		}
		else if (A[A.size() - 1 - i] == -1) {
			A[A.size() - 1 - i] = 25;
			A[A.size() - 2 - i]--;
		}
	}
	
	if (A[0] != 0) {
		for (int i = 0; i < A.size(); i++) {
			if (A[i] == 0)cout << "z";
			else if (A[i] == 1)cout << "a";
			else if (A[i] == 2)cout << "b";
			else if (A[i] == 3)cout << "c";
			else if (A[i] == 4)cout << "d";
			else if (A[i] == 5)cout << "e";
			else if (A[i] == 6)cout << "f";
			else if (A[i] == 7)cout << "g";
			else if (A[i] == 8)cout << "h";
			else if (A[i] == 9)cout << "i";
			else if (A[i] == 10)cout << "j";
			else if (A[i] == 11)cout << "k";
			else if (A[i] == 12)cout << "l";
			else if (A[i] == 13)cout << "m";
			else if (A[i] == 14)cout << "n";
			else if (A[i] == 15)cout << "o";
			else if (A[i] == 16)cout << "p";
			else if (A[i] == 17)cout << "q";
			else if (A[i] == 18)cout << "r";
			else if (A[i] == 19)cout << "s";
			else if (A[i] == 20)cout << "t";
			else if (A[i] == 21)cout << "u";
			else if (A[i] == 22)cout << "v";
			else if (A[i] == 23)cout << "w";
			else if (A[i] == 24)cout << "x";
			else if (A[i] == 25)cout << "y";
		}
	}
	else{
		for (int i = 1; i < A.size(); i++) {
			if (A[i] == 0)cout << "z";
			else if (A[i] == 1)cout << "a";
			else if (A[i] == 2)cout << "b";
			else if (A[i] == 3)cout << "c";
			else if (A[i] == 4)cout << "d";
			else if (A[i] == 5)cout << "e";
			else if (A[i] == 6)cout << "f";
			else if (A[i] == 7)cout << "g";
			else if (A[i] == 8)cout << "h";
			else if (A[i] == 9)cout << "i";
			else if (A[i] == 10)cout << "j";
			else if (A[i] == 11)cout << "k";
			else if (A[i] == 12)cout << "l";
			else if (A[i] == 13)cout << "m";
			else if (A[i] == 14)cout << "n";
			else if (A[i] == 15)cout << "o";
			else if (A[i] == 16)cout << "p";
			else if (A[i] == 17)cout << "q";
			else if (A[i] == 18)cout << "r";
			else if (A[i] == 19)cout << "s";
			else if (A[i] == 20)cout << "t";
			else if (A[i] == 21)cout << "u";
			else if (A[i] == 22)cout << "v";
			else if (A[i] == 23)cout << "w";
			else if (A[i] == 24)cout << "x";
			else if (A[i] == 25)cout << "y";
		}
	}

	
	return 0;
}

Measured memory_bytes: 4012
import java.util.*;

public class Main {
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
        int n = stdIn.nextInt();
        boolean flag = false;
        
        for(int i = 1; i <= 9; i++){
            for(int j = 1; j <= 9; j++){
                if(i * j == n){
                    flag = true;
                }
            }
        }
        
        if(flag){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 23636