akhauriyash/Code-Regression huggingface dataset:
import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
import sys
from collections import deque, defaultdict, Counter; from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect import bisect_left, bisect_right, insort_left, insort_right
from operator import itemgetter as ig
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20; INF = float("INF"); ans = 0; tmp = 0; ansli = []; tmpli = []; candili = []
eps = 1.0 / 10 ** 10; mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]; ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]; ddn9 = ddn + [(0, 0)]
"""for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:"""
def wi(): return list(map(int, sys.stdin.readline().split()))
def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]#WideIntPoint
def ws(): return sys.stdin.readline().split()
def i(): return int(sys.stdin.readline())
def s(): return input()
def hi(n): return [i() for _ in range(n)]
def hs(n): return [s() for _ in range(n)]#HeightString
def mi(n): return [wi() for _ in range(n)]#MatrixInt
def mip(n): return [wip() for _ in range(n)]
def ms(n): return [ws() for _ in range(n)]

k = i()
lunlun_list = [1, 2, 3, 4, 5, 6, 7, 8, 9]
tmp_list = lunlun_list
tmp_tmp_list = []
cnt = 9
def lunlun(y):
    x = y[-1]
    if x == "0":
        tmp_tmp_list.append(y + "0")
        tmp_tmp_list.append(y + "1")
        return 2
    elif x == "9":
        tmp_tmp_list.append(y + "8")
        tmp_tmp_list.append(y + "9")
        return 2
    else:
        x = int(x)
        tmp_tmp_list.append(y + str(x - 1))
        tmp_tmp_list.append(y + str(x))
        tmp_tmp_list.append(y + str(x + 1))
        return 3

while len(lunlun_list) < k:
    for tmp in tmp_list:
        cnt += lunlun(str(tmp))
        if cnt >= k:
            break
    tmp_list = tmp_tmp_list
    lunlun_list += tmp_list
    tmp_tmp_list = []

lunlun_list = [int(i) for i in lunlun_list]
lunlun_list.sort()

print(lunlun_list[k - 1])

Measured memory_bytes: 17340
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.List;
import java.util.Scanner;
class Main{

    private static int bitcount(long n){
        int res = 0;
        while(n>0){
            if((n & 1) == 1)++res;
            n/=2;
        }
        return res;
    }

    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        long N = scan.nextLong();

        int maxbit = -1;
        long n = N;
        while(n>0){
            n/=2;
            ++maxbit;
        }

        Deque<Integer> first = new ArrayDeque<>();
        List<Integer> second= new ArrayList<>();
        for(int i=maxbit;i>0;--i){
            first.addLast(i);
            second.add(i);
        }
        //N = 2^maxbit + 2^(maxbit-k) + ...
        //(maxbit, maxbit-1, ..., 1)

        Deque<Integer> useNumber = new ArrayDeque<>();
        for(int i = bitcount(N)-1;i>0;--i){
            useNumber.addLast(maxbit + i);
            first.addFirst(maxbit + i);
        }
        //useNumber = {maxbit + k, maxbit+(k-1), ..., maxbit + 1 }
        //first = {maxbit+1, maxbit+2,..., maxbit+k, maxbit, maxbit-1, ..., 1 }

        for(int i = maxbit-1;i>=0;--i){
            if(((N>>i)&1) == 1){
                int inn = useNumber.removeFirst();
                second.add(second.indexOf(i+1)+1, inn);
            }
        }
        List<Integer> ans = new ArrayList<>();
        ans.add(100);
        while(!first.isEmpty()){
            ans.add(first.removeFirst());
        }
        for(int i : second)ans.add(i);
        ans.add(100);

        System.out.println(ans.size());
        for(int i : ans)System.out.print(i + " ");
        System.out.println();

    }
}

Measured memory_bytes: 23764
#include<cstdio>
#include<cstring>
#include<algorithm>
#define MAXN 200006
using namespace std;
char s[MAXN];
int n;
int main()
{
	scanf("%s",s);
	n=strlen(s);
	for(int i=n;i>=1;i--)
	{
		s[i]=s[i-1];
		if(s[i+1]==s[i])
		{
			printf("%d %d",i,i+1);
			return 0;
		}
	}
	for(int i=1;i<=n-2;i++)
		if(s[i]==s[i+2])
		{
			printf("%d %d",i,i+2);
			return 0;
		}
	printf("-1 -1");
}

Measured memory_bytes: 384
import sys
n,m=map(int,input().split())
a=[]
for i in range(m):
  a.append(int(input()))
a.sort()
for i in range(m-1):
  if a[i+1]-a[i]==1:
    print(0)
    sys.exit()
p=10**9+7  
dp=[0]*(n+1)
dp[0]=1
if 1 not in a:
  dp[1]=1
lst=set(list(range(1,n+1)))
A=set(a)
Lst=lst-A
Lst=list(Lst)
if 1 in Lst:
  Lst.remove(1)
for i in Lst:
  dp[i]=dp[i-1]+dp[i-2]
  if p<=dp[i]:
    dp[i]=dp[i]%p
print(dp[n]%p)


Measured memory_bytes: 59864
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
#define pb push_back
#define fr(i,n) for(int i=0;i<n;i++)
#define Fr(i,n) for(int i=0;i++<n;)
#define ifr(i,n) for(int i=n-1;i>=0;i--)
#define iFr(i,n) for(int i=n;i>0;i--)

int main() {
  int ans=0;
  int a[5];
  int b[5];
  fr(i,5){
    cin >> a[i];
    b[i] = a[i]%10;
    a[i] = (a[i]+9)/10;
    a[i]*=10;
    ans+=a[i];
  }
  int c=10;
  fr(i,5){
    if(c>b[i] && b[i]!=0) c=b[i];
  }
  cout << ans-10+c << endl;
}

Measured memory_bytes: 256
#include <iostream>

int main(int argc, char *argv[])
{
  int n, k;
  std::string s;
  int i;

  std::cin >> n >> k;
  std::cin >> s;

  decltype(s)::iterator it;
  for (it=s.begin(), i=0; it<s.end(); ++it, ++i) {
    if (i == (k-1)) {
      std::cout << (char)std::tolower(*it);
    } else {
      std::cout << *it;
    }
  }
  std::cout << std::endl;
  
  return 0;
}


Measured memory_bytes: 504
#include <stdio.h>
int main(void){
    /* 変数宣言，ちゃんと初期化しよう */
    int A = 0; /*N*/
    int ans = 0;
    /* 変数宣言終わり */
   
    /* 入力を受け付ける部分*/
    
    // %dはdecimalの略．つまり，入力を10進数として扱うよという意味．
    scanf("%d", &A);
    
    /* 入力を受け付ける部分終わり*/
    
    
    /* 何か処理*/

    
    if(A <= (A/100)*100+(A/100)*10+(A/100)){
      /* 真の場合の処理 */
     ans = (A/100)*100+(A/100)*10+(A/100);
    }else{
      /* 偽の場合の処理 */
     ans = (((A/100)+1)*100)+(((A/100)+1)*10)+((A/100)+1);
    }
    
    for(int i = 0; i < 10; i++){ 
      // i = 0,1,2,3,4,5,6,7,8,9のとき処理される
      
    }
    
    /* 何か処理終わり*/
    
    
    /* 出力する部分*/
    
    printf("%d", ans); // %dの部分にansの値が表示される
    
    /* 出力する部分*/
    
    
    
    return 0;
}






Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<bitset>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
typedef long long ll;
typedef long double ld;
#define str string
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct E {//辺の情報を入れる変数
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
ll ari(ll a, ll b, ll c) {
	return (a + b)*c / 2;
}//等差数列の和
ll fact(ll x, ll k, ll p) {//最大値、個数、あまり
	ll sum = 1;
	for (int i = 0; i < k; i++) {
		sum *= (x--);
		sum %= p;
	}
	return sum;
}//階乗(正）
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res*x%p;
		x = x*x%p;
		n >>= 1;
	}
	return res;
}//x^n%p
short ctos(char a) {
	return (int)(a - '0');
}
#define int long long
const long long Inf = 4523372036854775807;
const int inf = 15000000000;
//----------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++
int n, m;
string a[100], b[100];
signed main() {
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	cin >> m;
	for (int i = 0; i < m; i++)
		cin >> b[i];
	int ans = 0;
	for (int i = 0; i < n; i++) {
		int sum = 0;
		for (int j = 0; j < n; j++) {
			if (a[i] == a[j]) sum++;
		}
		for (int j = 0; j < m; j++) {
			if (a[i] == b[j]) sum--;
		}
		ans = max(ans, sum);
	}
	cout << ans << endl;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////


int main(){
    string s;
    cin >> s;
    if(s[0] == 'A'){
	
	map<char,int> c;
       
	rep(i,2,sz(s)-1)c[s[i]]++;
	if(c['C'] == 1){
	    int f = 0;
	    c[s[1]]++;
	    c[s[sz(s)-1]]++;
	    for(auto i: c){
		if(i.ft != 'C'&& (i.ft < 'a' || 'z' < i.ft)){
		   
		    f = 1;
		    break;
		}
	    }
	    if(f == 0){
		if('a' <= s[1] && s[1] <= 'z' && 'a' <= s[sz(s)-1] && s[sz(s)-1] <= 'z'){
		    P("AC");
		    ret 0;
		}
	    }
	}
    }
    P("WA");
    return  0;
}


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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF = 1e9;
typedef pair<int, int> PII;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

int main()
{
    int N; cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    

    int ans = INF;
    for (int j=-100; j<=100; j++) {
        int tmp = 0;
        rep(i, N) {
            tmp += (A[i] - j) * (A[i] - j);
        }
        ans = min(ans, tmp);
    }

    cout << ans << endl;
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
const int mod = 1e9 + 7;
long long power(long long a, long long b)
{
	return b ? power(a * a % mod, b / 2) * (b % 2 ? a : 1) % mod : 1;
}
int K;
string S;
long long fac[2 << 20], inv[2 << 20];
int comb(int X, int Y)
{
	return fac[X] * inv[Y] % mod * inv[X - Y] % mod;
}
int main()
{
	cin >> K >> S;
	int T = K + S.size();
	fac[0] = 1;
	for (int i = 1; i <= T; i++)
		fac[i] = fac[i - 1] * i % mod;
	inv[T] = power(fac[T], mod - 2);
	for (int i = T; i--;)
		inv[i] = inv[i + 1] * (i + 1) % mod;
	long long ans = 0;
	for (int i = S.size(); i <= K + S.size(); i++)
		ans += comb(T, i) * power(25, T - i) % mod;
	cout << ans % mod << endl;
	return 0;
}

Measured memory_bytes: 35536
#include<iostream>
#include<vector>
#include<string>

using ll = long long;

int main(){
    ll n;
    std::cin >> n;
    std::vector<ll> a(n);
    for(int i = 0; i < n; i++){
        std::cin >> a[i];
    }

    ll ans = 0;
    ll m = a[0];
    for(int i = 1; i < n; i++){
        if(m > a[i]){
            ans += m - a[i];
        }else{
            m = std::max(m, a[i]);
        }
    }

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


Measured memory_bytes: 4832
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <deque>

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

using namespace std;

int main() {

	int n;
	cin >> n;
	vector<int>a(n + 1);
	rep(i, n)
		cin >> a[i + 1];

	vector<int>ans;

	vector<int>box(n + 1);

	for (int i = n; i >= n / 2 + 1; i--)
		if (a[i] == 1) {
			ans.push_back(i);
			box[i] = 1;
		}

	for (int i = n / 2; i >= 1; i--) {
		int now = i;
		int count = 0;
		for (int j = 2; n >= now * j; j++)
			count += box[now * j];

		if (count % 2 != a[i]) {
			ans.push_back(i);
			box[i]++;
		}
	}

	cout << ans.size() << endl;
	rep(i, ans.size())
		cout << ans[i] << endl;

	return 0;
}


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int N,M;
    while (cin >> N >> M, N) {
        vector<vector<int>> Q(M);
        for (int i=0;i<N;i++) {
            int d,v;
            cin >> d >> v;
            Q[d-1].push_back(v);
        }
        int ans = 0;
        for (int i=0;i<M;i++) {
            sort(Q[i].begin(),Q[i].end(),greater<int>());
            ans += Q[i][0];
        }
        cout << ans << endl;
    }
}



Measured memory_bytes: 3128
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <stdio.h>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <tuple>
#include <math.h>
#include <set>
#include <map>
using namespace std ;
using ll = long long ;
using ld = long double ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
using vc = vector<char> ;
using vvc = vector<vc> ;
using vb = vector<bool> ;
using vvb = vector<vb> ;
using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end() 
const ll INF = 1e18 ;
const ll mod = 1e9+7 ;
const double pie = acos(-1); 
vll dx4 = {-1,0,1,0} ;
vll dy4 = {0,-1,0,1} ;
vll dx8 = {-1,0,1,1,1,0,-1,-1} ;
vll dy8 = {-1,-1,-1,0,1,1,1,0} ; 

void fix_cout(){cout << fixed << setprecision(20) ; }
ll gcd(ll a,ll b){if(b==0) return a ; return gcd(b,a%b) ; }
ll lcm(ll a,ll b){return a/gcd(a,b)*b ; }
template<class T> void chmax(T &a,T b){if(a<b) a = b ; }
template<class T> void chmin(T &a,T b){if(a>b) a = b ; }

void solve(){
	cin.tie(nullptr) ;
	ios::sync_with_stdio(false) ;
	fix_cout() ;
	
	ll n ; cin >> n ;
	vll x(n),y(n) ;
	for(int i=0;i<n;i++) cin >> x.at(i) >> y.at(i) ;
	auto cul = [&](ld px,ld py){
		ld r = 0.0 ;
		for(int i=0;i<n;i++){
			chmax(r,(ld)sqrt((x.at(i)-px)*(x.at(i)-px)+(y.at(i)-py)*(y.at(i)-py))) ;
		}
		return r ;
	} ;
	auto cul2 = [&](ld px){
		ld ly,ry,m1y,m2y ;
		ll cnt = 100 ;
		ly = 0.0 ;
		ry = 10000.0 ;
		while(cnt--){
			m1y = (ly+ly+ry)/3 ;
			m2y = (ly+ry+ry)/3 ;
			if(cul(px,m1y)<cul(px,m2y)) ry = m2y ;
			else ly = m1y ;
		}
		return cul(px,ly) ;
	} ;
	ld lx,rx,m1x,m2x ;
	ll cnt = 100 ;
	lx = 0.0 ;
	rx = 10000.0 ;
	while(cnt--){
		m1x = (lx+lx+rx)/3 ;
		m2x = (lx+rx+rx)/3 ;
		if(cul2(m1x)<cul2(m2x)) rx = m2x ;
		else lx = m1x ;
	}
	cout << cul2(lx) << endl ;
}

int main(){
	solve() ;
}

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

public class PrimeFactorize
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        
        var primes = new List<int>();
        Do(primes, n, 2);
//        primes = CalcPrimes(n, 2).ToList();
        
        Console.WriteLine(string.Format("{0}: {1}", n, string.Join(" ", primes.Select(x => x.ToString()).ToArray())));
    }
    
    
    private static void Do(List<int> primes, int input, int denom)
    {
        if (denom * denom > input)
        {
            primes.Add(input);
        }
        else if (input % denom == 0)
        {
            primes.Add(denom);
            Do(primes, input / denom, denom);
        }
        else
        {
            if (denom == 2)
                Do(primes, input, denom + 1);
            else
                Do(primes, input, denom + 2);
        }
    }
    
//    private static IEnumerable<int> CalcPrimes(int input, int denom)
//    {
//        while (input > denom)
//        {
//            yield return Calc(ref input, ref denom);
//            denom++;
//        }
//    }
//    
//    private static int Calc(ref int input, ref int denom)
//    {
//        if (input == denom)
//        {
//            return denom;
//        }
//        else if (input % denom == 0)
//        {
//            return denom;
//        }
//        else
//        {
//            input /= denom;
//            return Calc(ref input, ref ++denom);
//        }
//    }
}
// Define other methods and classes here

Measured memory_bytes: 20248
import itertools
import math
n = int(input())
xys = []
for i in range(n):
  xy = input().split()
  xys.append(xy)
total = 0
xys_list = list(itertools.permutations(xys, len(xys)))
for j in range(len(xys_list)):
  r = 0
  for k in range(n-1):
    xk = int(xys_list[j][k][0])
    yk = int(xys_list[j][k][1])
    xk2 = int(xys_list[j][k+1][0])
    yk2 = int(xys_list[j][k+1][1])
    r = math.sqrt(((xk - xk2)**2) + ((yk - yk2)**2))
    total += r
fac = math.factorial(n)
print(total / fac)

Measured memory_bytes: 7972
n, k = list(map(int, input().split()))
list_h = sorted(list(map(int, input().split())), reverse=True)

ans = 0
for n, i in enumerate(list_h):
    if k > 0:
        k = k - 1
        list_h[n] = 0
    else:
        break

ans = ans + sum(list_h)
print(ans)

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

// Shrotening
#define fst first
#define snd second
#define pb push_back
#define mp std::make_pair

// Loop
#define FOR(i,a,b) for(auto i=(a);i<(b);++i)
#define RFOR(i,a,b) for(auto i=(a);i>=(b);--i)

#define REP(i,a) for(long i=0;i<(a);++i)
#define RREP(i,a) for(long i=(a);i>=0;--i)

#define EACH(i,a) for(auto (i)=(a).begin(),_END=(a).end();i!=_END;++i)
#define REACH(i,a) for(auto (i)=(a).rbegin(),_END=(a).rend();i!=_END;++i)

//Algorithm
#define ALL(a) (a).begin(), a.end()
#define RALL(a) (a).rbegin(), a.rend()
#define EXIST(a,x) ((a).find(x)!=(a).end())
#define SORT(a) std::sort((a).begin(), (a).end())
#define UNIQUE(a) std::sort((a).begin(), a.end()), a.erase(std::unique((a).begin(), a.end()), a.end());
#define SUM(a) std::accumulate((a).begin(), (a).end(), 0);

//Setting
#define OPT std::cin.tie(0);std::ios::sync_with_stdio(false);

//debug message
bool debug = true;
#define MSG(s)   if(debug){std::cout << s << std::endl;}
#define DEBUG(x) if(debug){std::cout << "debug(" << #x << "): " << x << std::endl;}

//alias
typedef long long LL;
typedef std::vector<char> VC;
typedef std::vector<int>  VI;
typedef std::vector<long> VL;
typedef std::vector<long long> VLL;

typedef std::vector< VC > VC2;
typedef std::vector< VI > VI2;
typedef std::vector< VL > VL2;
typedef std::vector< VLL > VLL2;

typedef std::pair<int,int> PII;
typedef std::vector<PII> VPII;

int n;
VPII v;
int main() {
    int h, m, s;
    while(std::cin >> n, n != 0) {
        v.clear();
        REP(i, n) {
            scanf("%d:%d:%d", &h, &m, &s);
            v.pb(mp(h*3600+m*60+s, 1));
            scanf("%d:%d:%d", &h, &m, &s);
            v.pb(mp(h*3600+m*60+s, -1));
        }
        SORT(v);

        int res = 0, ans = 0;
        for(auto t: v) {
            res += t.snd;
            ans = std::max(ans, res);
        }
        std::cout << ans << std::endl;
    }
}


Measured memory_bytes: 3376
//
//  akjbef.cpp
//  
//
//  Created by Takuto on 15/6/3.
//
//

#include <cstdio>

int main(){
    char in[3];
    int a=0,b=0,ab=0,o=0;
    
    while(EOF!=scanf("%*d,%s",in)){
        
        if(in[1]!='\0')
            ab++;
        else if(in[0]=='A')
            a++;
        else if(in[0]=='B')
            b++;
        else
            o++;
    }
    
    printf("%d\n%d\n%d\n%d\n",a,b,ab,o);
    
    return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		sc.close();
		long mod = 1000000007;
		long k = 1;
		for(long i = 1; i <= N; i++) {
			k *= i;
			k %= mod;
		}
		System.out.println(k);
	}
}

Measured memory_bytes: 21588
import sys
input = sys.stdin.readline

n, k, q = map(int, input().split())
t = k - q
a = [0 for _ in range(n)]

for i in range(q):
    a[int(input())-1] += 1

for i in range(n):
    pnt = a[i] + t
    if pnt > 0:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 4680
/// Code By t_bone_289 (Tushar Singh)
/// An Immature Programmer.... I'm still developing !!
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pll pair<ll,ll>
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define endl '\n'
#define M 1000000007
#define error(x) cout << #x << " = " << x << endl;
#define pi 3.14159265358979323846
typedef long long ll;
typedef long double ld;
template <typename T>
void ContainerError(T &v){cout<<"{";for(auto &x:v){cout<<x<<',';}cout<<"}"<<endl;return;}
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
ll powmod(ll base,ll exp,ll MOD){ll res=1;while(exp>0){if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return (res%MOD);}
ll mpow(ll base,ll exp){ll res=1;while(exp>0){if(exp%2==1) res=(res*base);base=(base*base);exp/=2;}return (res);}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin>>n;
    ll k;
    cin>>k;
    vector<vector<ll> > G(n,vector<ll>(n,0));
    for(ll i=1;i<n;i++)
    {
        G[0][i]=1;
        G[i][0]=1;
    }
    ll mv = (n-1)*(n-2)/2;
    if(k > mv)
    {
        cout<<-1;
        return 0;
    }
    vector<pll> v;
    for(ll i=0;i<n;i++)
    {
        for(ll j=i+1;j<n;j++)
        {
            if(G[i][j]==0)
            {
                v.pb(mp(i,j));
            }
        }
    }
    ll N = v.size();
    ll sz = 0;
    while(mv != k)
    {
        pll p = v[sz];
        G[p.fi][p.se]=1;
        G[p.se][p.fi]=1;
        mv--;
        sz++;
    }
    vector<pll> ans;
    for(ll i=0;i<n;i++)
    {
        for(ll j=i+1;j<n;j++)
        {
            if(G[i][j])
            {
                ans.pb(mp(i,j));
            }
        }
    }
    cout<<ans.size()<<endl;
    for(auto x:ans)
    {
        cout<<x.fi+1<<' '<<x.se+1<<endl;
    }
    return 0;
}



Measured memory_bytes: 640
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <array>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, a, n) for (int i = a; i < (n); i++)
#define all(in) in.begin(), in.end()
const int INF = 1e9;
const int MOD = 1e9 + 7;
int main() {
    int N, A, B;
    cin >> N >> A >> B;
    int p[N];
    int one = 0, two = 0, three = 0;
    rep(i, N) {
        cin >> p[i];
        if (p[i] <= A) one++;
        if (A < p[i] && p[i] <= B) two++;
        if (B < p[i]) three++;
    }
    cout << min(one, min(two, three)) << endl;
    return 0;
}

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


int main() {
    int n;
    ostringstream oss;

    cin >> n;
    oss << n;
    if (oss.str().find("7") != std::string::npos) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define f(hh,ss,tt) for(int hh=ss;hh<=tt;hh++)
#define fd(hh,ss,tt) for(int hh=ss;hh>=tt;hh--)
#define mem(ar,val) memset(ar,val,sizeof(ar))
using namespace std;

inline int read(){
	int ch=getchar(),v=0,f=1;
	while(ch>'9'||ch<'0'){if(ch=='-') f=-1; ch=getchar();}
	while(ch>='0'&&ch<='9') v=v*10+ch-'0',ch=getchar();
	return v*f;
}

inline int chk(int a,int b,int re=0){
	while(a) re+=a%10,a/=10;
	while(b) re+=b%10,b/=10;
	return re;
}

int n,ans=0x1f1f1f1f;

int main(){
	//freopen(".in","r",stdin);
	n=read();
	f(i,1,n>>1) ans=min(ans,chk(i,n-i));
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) for(ll i=0;i<(n);++i)
#define _rep3(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2)(__VA_ARGS__)
#define _repe2(i,n) for(ll i=0;i<=(n);++i)
#define _repe3(i,a,b) for(ll i=(a);i<=(b);++i)
#define repe(...) _overload3(__VA_ARGS__,_repe3,_repe2)(__VA_ARGS__)
#define _rrep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define _rrep3(i,a,b) for(ll i=(b)-1;i>=(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
template<class T>
using pq=priority_queue<T,vector<T>,greater<T>>;

ll N,L,Q;
vl x,a,b,pos,ans;
vvl g,q;

void solve();

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin >> N;
    x=vl(N);
    for(int i = 0; i < N; ++i){
        cin >> x[i];
    }
    cin >> L;
    cin >> Q;
    a=vl(Q);
    b=vl(Q);
    for(int i = 0; i < Q; ++i){
        cin >> a[i];
        cin >> b[i];
    }
    solve();
}

void dfs(ll i){
    pos.push_back(-x[i]);
    for(ll id:q[i]){
        ans[id]=pos.end()-upper_bound(all(pos),-x[max(a[id],b[id])]);
    }
    for(ll to:g[i])dfs(to);
    pos.pop_back();
}
void solve(){
    g=vvl(N);
    rep(i,N-1){
        ll idx=upper_bound(all(x),x[i]+L)-x.begin()-1;
        g[idx].push_back(i);
    }
    q=vvl(N);
    rep(i,Q){
        --a[i],--b[i];
        q[min(a[i],b[i])].push_back(i);
    }
    ans=vl(Q);
    dfs(N-1);

    rep(i,Q)cout<<ans[i]<<endl;
}



Measured memory_bytes: 24052
#include <stdio.h>
#include <stdbool.h>

void harshed_num(int n){
  int harsh = n%10;
  for(int buf=n;buf>0;buf /= 10)
    harsh += (buf/10)%10;
  if(n%harsh == 0) printf("Yes");
  else printf("No");
}

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


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

int main(){
    int a, b, c;
    cin >> a >> b >> c;

    if(a != b && b != c && a != c){
        cout << 3 << endl;
    }
    else if(a == b && b == c && a == c){
        cout << 1 << endl;
    }
    else{
        cout << 2 << endl;
    }
}

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

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

bool used[100010];
VI a, b(100010, -1);
VI g[100010];
int n, m, cnt;
VI v(100010), x(100010), y(100010);
void dfs(int num) {
  // cout << num << " " << v[num] << endl;
  a.PB(num);
  b[v[num]] = cnt;
  used[num] = true;
  for(int i: g[num]) {
    if(used[i]) continue;
    dfs(i);
  }
}

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

  cin >> n >> m;
  REP(i, n) cin >> v[i], v[i]--;
  REP(i, m) {
    cin >> x[i] >> y[i], x[i]--, y[i]--;
    g[x[i]].PB(y[i]);
    g[y[i]].PB(x[i]);
  }

  int ret = 0;
  cnt = 0;
  REP(i, n) {
    if(!used[i]) {
      a.clear();
      dfs(i);
      sort(ALL(a));
      // cout << a << endl;
      // cout << b << endl;
      REP(j, a.size()) {
        if(b[a[j]] == cnt) ret++;
      }
      cnt++;
    }
  }

  cout << ret << endl;

  return 0;
}


Measured memory_bytes: 13176
#include <iostream>
#include <algorithm>
#include <unistd.h>
#include <sstream>
#include <cmath>
#include <climits>
#include <vector>
#include <cstring>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <string.h>
#include <iomanip>
using namespace std;
#define int long long
#define ull unsigned long long
#define F first
#define S second
#define nl "\n"
#define ld long double
#define div 1000000007
#define pi 3.14159265358979323846
#define pb push_back

int dp[2001];

int f(int sum,int s)
{
    if(sum==0)
    {
        return dp[sum]=1;
    }
    int ans=0;
    if(dp[sum]!=-1)
        return dp[sum];
    for(int i=3;i<=s;i++)
    {
        if(sum-i>=0)
        {
            ans=(ans+f(sum-i,s))%div;
        }
        else
            return dp[sum]=ans%div;
    }
    return dp[sum]=ans%div;
}

void solve()
{
    memset(dp,-1,sizeof(dp));
    int s;cin>>s;
    cout<<f(s,s);
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);

    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3688
var
	a,b,ans:int64;
function f(x:int64):int64;
begin
	if x mod 2=0 then 
	begin 
		if x div 2 mod 2=0 then exit(x)
		else exit(x xor 1);
	end
	else
	begin 
		if (x+1) div 2 mod 2=0 then exit(0)
		else exit(1);
	end;
end;
begin
	readln(a,b);
	ans:=f(a-1) xor f(b);
	writeln(ans);
end.

Measured memory_bytes: 128
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
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; }

// constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
// constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    LL x,k,d;
    cin >> x >> k >> d;
    if (x < 0) x *= -1;
    LL t = x / d;
    if (t > k) {
        cout << x - k * d << endl;
        return;
    }
    x -= t * d;
    k -= t;
    if (k % 2 == 0) {
        cout << x << endl;
    } else {
        cout << min(x + d, abs(x - d)) << endl;
    }
}

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


Measured memory_bytes: 3588
#include <iostream>
using namespace std;
typedef long long ll;
ll n, a[210000], res, b;
int main(void){
    // Your code here!
    cin >> n;
    for (ll i = 0; i < n; i++) cin >> a[i];
    for (ll i = 0; i < n; i++) {
        if (b == 1 && a[i] > 0) {
            a[i]--;
            res++;
        }
        b = 0;
        res += a[i] / 2;
        b += a[i] % 2;
    }
    cout << res << endl;
}


Measured memory_bytes: 1024
while 1:
	H,W = map(int,raw_input().split())
	if H == 0: break
	M = [raw_input() for i in range(H)]
	if sum([M[h].count(".") for h in range(H)]) == 0:
		print 0
		continue
	A = [[0]*W for i in range(H)]
	B = [[0]*W for i in range(H)]
	ans = 1
	for h in range(H):
		L = 0
		for w in range(W):
			if M[h][w] == ".":
				L += 1
			else:
				L = 0
			A[h][w] = L
			B[h][w] = (B[h-1][w] if h > 0 else 0) + 1 if L > 0 else 0
			if L*B[h][w] > ans:
				a = L
				for hi in range(B[h][w]):
					a = min(a,A[h-hi][w])
					if a*B[h][w] <= ans:
						break
					ans = max(ans,a*(hi+1))
	print ans

Measured memory_bytes: 10324
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
#include<queue>
#include<stack>
#include<list>

using namespace std;
using ll = long long;

int main(){
    int n;
    cin >> n;
    vector<int> h(n+1);
    int hmax = 0;

    for(int i = 0; i < n; i++){
        cin >> h[i];
        hmax = max(hmax,h[i]);
    }
    h[n] = 0;

    int ans = 0;
    for(int i = 1; i <= hmax; i++){
        int suc = 0;
        bool ok = false;
        for(int j=0;j<=n;j++){
            if(h[j] >= i){
                ok = true;
            }
            else if(ok == true){
                suc++;
                ok = false;
            }
        }
        ans += suc;
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<math.h>
#include <cstdio>
#include<iomanip>
#include <stdio.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,m,n) for(int i=m;i<(int)(n);i++)
const int inf = 10e9 + 7;
using namespace std;
int  a[200005];
signed main() {
	int n;
	cin >> n;
	rep(i, n)cin >> a[i];
	int ans = 0;
	rep(i, n) {
		if (a[i] + 2 <= a[i + 1] || a[0] != 0) { cout << -1 << endl; return 0; }
		if (a[i] + 1 == a[i+1])continue;
		ans += a[i];
	}
	cout << ans << endl;
}

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

int main(){
  int N,M;
  cin >> N >> M;
  vector<int>count(N,0);
  vector<int>ai(M);
  vector<int>bi(M);

  for(int i=0; i<M;i++){

    cin >> ai.at(i);
    for(int j=1;j<=N;j++){
      if(ai.at(i)==j){
        count.at(j-1)++;
      }
    }

    cin >> bi.at(i);
    for(int j=1;j<=N;j++){
      if(bi.at(i)==j){
        count.at(j-1)++;
      }
    }

  }

  for(int i=0;i<N;i++){
    cout << count.at(i) << endl;
  }
}


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

int main(){
    int n,x,y;
    int a=0;
    int b=0;
    string taro,hanako;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>taro>>hanako;
        if(taro==hanako){
            a+=1;
            b+=1;
        }else if(taro<hanako){
            b+=3;
        }else if(taro>hanako){
            a+=3;
        }
    }
    cout<<a<<" "<<b<<endl;
}


Measured memory_bytes: 3212
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define vcout(v) rep(i,v.size()) cout << v[i] << " "; cout << endl
#define mcout(m) rep(j,m.size()){vcout(m[j]);}
const ll MOD = 1e9 + 7;

void mainsolve(){

	ll n,a,b;
	cin >> n >> a >> b;

	ll res = 0;
	ll m = n/(a+b);
	res += m*a;

	res += min(a, n%(a+b) );

	cout << res << endl; 

	return;
}

int main(){
	
	//ll TC;cin>>TC;rep(I,TC){cout<<"case:"<<I+1<<"---"<<endl; // comment out!
		mainsolve();
	//} // comment out!
	return 0;
}


Measured memory_bytes: 256
K, N = map(int, input().split())
A = list(map(int, input().split()))

distance = []
for i in range(N - 1):
    val = A[i + 1] - A[i]
    distance.append(val)
distance.append(A[0] + K - A[N - 1])

distance.sort()
longest = distance.pop()

print(K - longest)


Measured memory_bytes: 86692
import Text.Printf
main = getContents >>= mapM_ (fout . simultaneous_equation . fin) . lines
fin = map (read::String->Double) . words
fout (x,y) = printf "%.3f %.3f\n" x y
 
simultaneous_equation [a,b,c,d,e,f] = (x,y)
 where x = (c - b*y) / a
       y = (c*d - a*f) / (b*d - a*e)

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

template<typename T>
void rin(T &t)
{
	t=0;int k=1;char c=getchar();
	while(!isdigit(c)){if(c=='-')k=-1;c=getchar();}
	while(isdigit(c)){t=t*10+c-'0';c=getchar();}
	t*=k;
}
const int maxn=1e5+5;
int a[maxn],f[maxn];
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	int ans=0;
	for(int i=n-1;i;i--)
	{
		if(a[i]>=a[i+1])f[i]=f[i+1]+1;
		ans=max(ans,f[i]);
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
// const int dy[] = {1, 1, 0, -1, -1, -1, 0, 1},
//           dx[] = {0, -1, -1, -1, 0, 1, 1, 1};

struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    cerr << fixed << setprecision(10);
  }
} iosetup;
/*-------------------------------------------------*/
int main() {
  vector<bool> ans(4, true);
  int a, b; cin >> a >> b;
  ans[a] = ans[b] = false;
  FOR(i, 1, 4) {
    if (ans[i]) {
      cout << i << '\n';
      return 0;
    }
  }
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<cmath>
#include<cstring>
#include<set>
#include<climits>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define all(a) a.begin(),a.end()
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define size(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*pi*/const double pi=acos(-1);
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
/*Fibonacci数列*/ll fib(ll x){ll i,fibo[x+10];fibo[0]=1;fibo[1]=1;fibo[2]=1;rep(i,3,x+1)fibo[i]=fibo[i-1]+fibo[i-2];return fibo[x];}
/*桁数*/ll dig(ll n){ll d=0,i=0;while(n/10>0){i++;d++;}return d;}
/*迷路移動*/const int dx[4]={1,0,-1,0};const int dy[4]={0,1,0,-1};
llfor;//ll ans=0;////////////////////////////////////////////////////////////
int main(){
 string s;
 cin>>s;
 ll k;
 cin>>k;
  
 ll n=s.length();
 ll cnt=k;
 rep(i,0,n){
  if(cnt==0)break;
  if(s[i]=='a')continue;
  if('z'-s[i]+1<=cnt){
   cnt-='z'-s[i]+1;
   s[i]='a';
  }
 }
 if(cnt!=0){
  cnt%=26;
  rep(i,0,cnt){
   if(s[n-1]=='z')s[n-1]='a';
   else s[n-1]++;
  }
 }
 pr(s);
 return 0;}

Measured memory_bytes: 3728
import java.util.*;

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

		for(int i=0;i<n;i++)
			a[i] = sc.nextInt();

		// 家間の距離の内、最大を求める
		int dist = a[0]+(k-a[n-1]);
		for(int i=1;i<n;i++) {
			if(a[i]-a[i-1] > dist)
				dist = a[i]-a[i-1];
		}

		System.out.println(k-dist);
	}
}


Measured memory_bytes: 87812
#! /usr/bin/env python3
import itertools

def main():
    N, K = input().split()
    l = list(set(list('0123456789')) - set(input().split()))
    t = int(N)
    m = 100000
    for i in itertools.product(l, repeat=len(N)):
        if int(''.join(i)) >= t:
            m = min(m, int(''.join(i)))
    for i in itertools.product(l, repeat=len(N)+1):
        if int(''.join(i)) >= t:
            m = min(m, int(''.join(i)))
    print(m)
if __name__ == '__main__':
    main()

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

set<int> a;

int main(){
  rep(i, 3){
    int b;
    cin >> b;
    a.insert(b);
  }
  cout << a.size() <<endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
	    // write your code here
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        PriorityQueue<Integer> queue = new PriorityQueue<>();
        for(int i = 0; i < n; i++) {
            queue.add(sc.nextInt());
        }
        int sum = 0;
        for(int i = 0; i < n - 1; i++) {
            sum += queue.poll();
        }

        // 出力
        System.out.println(queue.poll() < sum ? "Yes" : "No");
    }
}


Measured memory_bytes: 23892
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
#include<math.h>
using namespace std;
typedef long long int llint;
typedef vector<int> vint;
typedef vector<llint> vllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;

bool check(int a, int b) {
	return a > b;
}

int main() {
	int a, b;
	cin >> a >> b;
	if (a <= 0 && 0 <= b) {
		cout << "Zero" << endl;
	}
	else {
		if (0 < a) {
			cout << "Positive" << endl;
		}
		else {
			if ((b - (a - 1)) % 2 == 0) {
				cout << "Positive" << endl;
			}
			else {
				cout << "Negative" << endl;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s[100001] ={};
  int cnt =0,cnt2 = 1;
  int k;
  string a;
  cin >> a>>k;
  while(cnt2 <6)
    {
    for(int j=0;j<a.size();j++)
      {
	s[cnt] = a.substr(j,cnt2);
	cnt++;
      }
    cnt2++;
    }
  sort(s,s+100000);
  unique(s,s+100000);
 
  cout << s[k] << endl;
}


Measured memory_bytes: 2176
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        sc.close();

        // 主処理
        long result = 0;
        for (int i = 1; i <= n; i++) {
            if (i % 3 != 0 && i % 5 != 0) {
                result += i;
            }
        }

        // 出力
        System.out.println(result);
    }
}


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

using lint = long long;

template <int MOD_>  struct modnum {
private:
	using lint = long long;
	lint v;
	static int modinv(int a, int m) {
		a %= m;
		assert(a);
		return a == 1 ? 1 : int(m - lint(modinv(m, a)) * lint(m) / a);
	}
public:
	static constexpr int MOD = MOD_;
	modnum() : v(0) {}
	modnum(lint v_) : v(int(v_ % MOD)) { if (v < 0) v += MOD; }
	explicit operator int() const { return v; }
	friend std::ostream &operator<<(std::ostream& out, const modnum& n) { return out << int(n); }
	friend std::istream &operator>>(std::istream& in, modnum& n) { lint v_; in >> v_; n = modnum(v_); return in; }
	friend bool operator==(const modnum& a, const modnum& b) { return a.v == b.v; }
	friend bool operator!=(const modnum& a, const modnum& b) { return a.v != b.v; }
	modnum inv() const {
		modnum res;
		res.v = modinv(v, MOD);
		return res;
	}
	modnum neg() const {
		modnum res;
		res.v = v ? MOD-v : 0;
		return res;
	}
	modnum operator-() const { return neg(); }
	modnum operator+() const { return modnum(*this); }
	modnum& operator+=(const modnum& o) {
		v += o.v;
		if (v >= MOD) v -= MOD;
		return *this;
	}
	modnum& operator-=(const modnum& o) {
		v -= o.v;
		if (v < 0) v += MOD;
		return *this;
	}
	modnum& operator*=(const modnum& o) {
		v = int(lint(v) * lint(o.v) % MOD);
		return *this;
	}
	modnum& operator/=(const modnum& o) { return *this *= o.inv(); }
	friend modnum operator+(const modnum& a, const modnum& b) { return modnum(a) += b; }
	friend modnum operator-(const modnum& a, const modnum& b) { return modnum(a) -= b; }
	friend modnum operator*(const modnum& a, const modnum& b) { return modnum(a) *= b; }
	friend modnum operator/(const modnum& a, const modnum& b) { return modnum(a) /= b; }
};
template <typename T> T pow(T a, lint b) {
	assert(b >= 0);
	T r = 1; while (b) { if (b & 1) r *= a; b >>= 1; a *= a; } return r;
}
using num = modnum<int(1e9)+7>;

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n, k;
    cin >> n >> k;
    const int lim = int(1e5)+5;
    vector<int> phi(lim+1);
    for (int i = 0; i < lim; ++i) 
    	phi[i] = i&1 ? i : i/2;
	for (int i = 3; i < lim; i += 2) if (phi[i] == i)
		for (int j = i; j < lim; j += i) 
			phi[j] -= phi[j]/i;
    num res = 0;
    for (int i = 1; i <= k; ++i) {
    	res += pow(num(k/i), n) * phi[i];
    }
    cout << res << '\n';
}

Measured memory_bytes: 3728