akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <cstring>
#include <stdio.h>
#define INF 0x3f3f3f3f

using namespace std;

const int N = 40010;

struct node
{
    int from,to,d,cost;
}mp[N];

int n,m,flag,ans[10010];

int bellman()
{
    int d[10010],cost[10010];
    memset(cost, 0, sizeof cost);
    for(int i = 1; i <= n; i++)
        d[i] = INF;
    d[1] = 0;

    while(1)
    {
        bool update = false;
        for(int i = 1; i <= 2*m; i++)
        {
            if(d[mp[i].to] > d[mp[i].from] + mp[i].d && d[mp[i].from] != INF)
            {
                d[mp[i].to] = d[mp[i].from] + mp[i].d;
                cost[mp[i].to] = mp[i].cost;
                update = true;
            }
            else if(d[mp[i].to] == d[mp[i].from] + mp[i].d && cost[mp[i].to] > mp[i].cost)
            {
                cost[mp[i].to] = mp[i].cost;
                update =true;
            }
        }
        if(!update)
            break ;
    }
    int sum = 0;
    for(int i = 1; i <= n; i++)
        sum += cost[i];
    return sum;
}

int main()
{
    while(cin>>n>>m && n+m)
    {
        for(int i = 1; i <= m; i++)
        {
            scanf("%d%d%d%d",&mp[i].from, &mp[i].to, &mp[i].d, &mp[i].cost);
            mp[i+m] = mp[i];
            swap(mp[i+m].from,mp[i+m].to);
        }

        cout<<bellman()<<endl;
    }
}



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

using namespace std;
const int N = 2e5 +10;
typedef long long ll;

ll a[N];

int main()
{
    int n;cin >> n;
    int ans = 0;
    for(int i = 0;i < n;i++)
    {
        scanf("%lld",&a[i]);
        ans = ans ^ a[i];
    }
    for(int i = 0;i < n;i++)
    {
        printf("%lld",ans ^ a[i]);
        if(i != n - 1)printf(" ");
    }


    return 0;
}

Measured memory_bytes: 5372
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()
 
int main(void){
	int m,k;
	cin>>m>>k;
	if(m == 1){
		if(k == 0){
			cout<<"0 0 1 1"<<endl;
		}else{
			cout<<-1<<endl;
		}
		return 0;
	}
	if(pow(2,m)<=k){
		cout<<-1<<endl;
		return 0;
	}
	cout<<k<<" ";
	rep(i,pow(2,m)){
		if(i==k) continue;
		cout<<i<<" ";
	}
	cout<<k<<" ";
	REP(i,pow(2,m)){
		if(i==k) continue;
		cout<<i<<" ";
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define int long long

int T,N;
int solve(vector< pair<int,int> > segs){
	vector<int> tot;
	
	for(int i = 0 ; i < segs.size() ; i++){
		int v = segs[i].second - segs[i].first;
		tot.push_back((tot.size()?tot.back():0)+v);
	}
	int ans = 0;
	for(int i = 0 ; i < segs.size() ; i++){
		int minus = i?tot[i-1]:0;
		int s = segs[i].first;
		int t = segs[i].first + T;
		// [             ]
		// [  ][    ][          ]
		// [  ][  ]    [  X  ]    [
		int end = lower_bound(segs.begin(),segs.end(),pair<int,int>{t,-1}) - segs.begin() - 1;
		int sum = -minus;
		if( end > 0 ){
			sum += tot[end-1];
		}
		sum += min(segs[end].second,t) - segs[end].first;
		ans = max(ans,sum);
	}
	return ans;
}

signed main(){
	cin >> T >> N;
	
	vector< pair<int,int> > segs;
	vector< pair<int,int> > segs2;
	
	for(int i = 0 ; i < N ; i++){
		int s,t;
		cin >> s >> t;
		segs.push_back({s,t});
		segs2.push_back({-t,-s});
	}
	reverse(segs2.begin(),segs2.end());
	//cout << solve(segs2)<< endl;
	cout << max(solve(segs2),solve(segs)) << endl;
	
	
	
	
}

Measured memory_bytes: 10924
package main

import "fmt"

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

	if n == 1 {
		fmt.Println(1)
		return
	}
	l := []uint64{2, 1}
	for i := 2; i <= n; i++ {
		l = append(l, l[i - 2] + l[i - 1])
	}

	fmt.Println(l[n])
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define ll long long
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
 
int main()
{
    int n, m;

    cin >> n >> m;

    int s[m], c[m], ans[n];

    ans[0] = -2;

    for (int i = 1; i < n; i++)
    {
    	ans[i] = 0;
    }

    for (int i = 0 ; i < m ; i++)
    {
    	cin >> s[i] >> c[i];
    }
    
    if (n > 1)
    {
	    for (int i = 0; i < m; i++)
	    {
	    	if (s[i] > 1){
	    	    if (ans[s[i] - 1] == c[i] || ans[s[i] - 1] == 0)
	    	    {
	    		    ans[s[i] - 1] = c[i];
	    	    }
	    	    if (ans[s[i] - 1] != c[i] && ans[s[i] - 1] != 0){
	    		    cout << -1;
	    		    exit(0);
	    	    }
	        }
	    	if (s[i] == 1 && c[i] == 0)
	    	{
	    		cout << -1;
	    		exit(0);
	    	}
	    	if (s[i] == 1 && c[i] != 0)
	    	{
	    		if (ans[0] == c[i] || ans[0] == -2){
	    			ans[0] = c[i];
	    		}
	    		else {
	    			cout << -1;
	    			exit(0);
	    		}
	    	}
	    }
    }
    else if (n == 1)
    {
        for (int i = 0; i < m; i++)
	    {
	    	if (s[i] > 1){
	    	    if (ans[s[i] - 1] == c[i] || ans[s[i] - 1] == 0)
	    	    {
	    		    ans[s[i] - 1] = c[i];
	    	    }
	    	    if (ans[s[i] - 1] != c[i] && ans[s[i] - 1] != 0){
	    		    cout << -1;
	    		    exit(0);
	    	    }
	        }
	    	
	    	if (s[i] == 1)
	    	{
	    		if (ans[0] == c[i] || ans[0] == -2){
	    			ans[0] = c[i];
	    		}
	    		else {
	    			cout << -1;
	    			exit(0);
	    		}
	    	}
	    }
    }
    
    if (ans[0] == -2 && n == 1)
    {
    	ans[0] = 0;
    }

    if (ans[0] == -2 && n>1)
    {
    	ans[0] = 1;
    }

    if (n == 1)
    {
    	cout << ans[0];
    }
    else{
    	for (int i = 0; i < n; i++)
    	{
    		cout << ans[i];
    	}
    }



	return 0;
}

Measured memory_bytes: 256
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define Endl endl

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class T,size_t n> ostream& operator<<(ostream &os, const array<T,n> &t) {
	os<<"{"; rep(i,n) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class S, class T,class U> ostream& operator<<(ostream &os, const tuple<S,T,U> &t) { return os<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class S, class T,class U,class V> ostream& operator<<(ostream &os, const tuple<S,T,U,V> &t) { return os<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<","<<get<3>(t)<<")";}
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
//#undef NUIP
#ifdef NUIP
#define out(args...){vector<string> a_r_g_s=s_p_l_i_t(#args, ','); e_r_r(a_r_g_s.begin(), args); }
vector<string> s_p_l_i_t(const string &s, char c){vector<string> v;int d=0,f=0;string t;for(char c:s){if(!d&&c==',')v.pb(t),t="";else t+=c;if(c=='\"'||c=='\'')f^=1;if(!f&&c=='(')++d;if(!f&&c==')')--d;}v.pb(t);return move(v);}
void e_r_r(vector<string>::iterator it) {}
template<typename T, typename... Args> void e_r_r(vector<string>::iterator it, T a, Args... args){ if(*it==" 1"||*it=="1") cerr<<endl; else cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", "; e_r_r(++it, args...);}
#else
#define out
#endif
#ifdef __cpp_init_captures
template<typename T>vector<T> table(int n, T v){ return vector<T>(n, v);}
template <class... Args> auto table(int n, Args... args){auto val = table(args...); return vector<decltype(val)>(n, move(val));}
#endif
const ll MOD=1e9+7;

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
	string s;
	cin>>s;
	sort(all(s));
	cout<<(s=="abc"?"Yes":"No")<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int k,x=0;
	cin>>k;
	for(int i=1;i<=1000005;i++){
		x=x*10+7;
		if(x%k==0){
			cout<<i; return 0;
		}
		x%=k;
	}
	cout<<"-1";
	return 0;
}

Measured memory_bytes: 3592
# -*- coding: utf-8 -*-
S = input()

can_use = [True for n in range(ord('a'), ord('z') + 1)]
for s in S:
    i = ord(s) - ord('a')
    can_use[i] = False

if any(can_use):
    for n, use in enumerate(can_use):
        if use:
            S += chr(ord('a') + n)
            print(S)
            exit()
else:
    # 全て使われている
    for i in range(len(S)-1, 0, -1):
        if ord(S[i-1]) < ord(S[i]):
            c = sorted([c for c in S[i-1:] if c > S[i-1]])[0]
            ans = S[:i-1] + c
            print(ans)
            exit()

    print(-1)

Measured memory_bytes: 38484
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  int N;
  cin >> N;
  vl A(N);
  rep(i,N) {
    cin >> A[i];
  }
  vl sum(N+1,0);
  rep(i,N) {
    sum[i+1] = sum[i] + A[i];
  }
  v(vl) dp(N,vl(N+1,LINF));
  rep(i,N) {
    dp[i][i+1] = 0;
  }
  srep(l,2,N+1) {
    rep(i,N-l+1) {
      ll s = sum[i+l]-sum[i];
      srep(k,i+1,i+l) {
        dp[i][i+l] = min(dp[i][i+l],dp[i][k]+dp[k][i+l]+s);
      }
    }
  }
  cout << dp[0][N] << endl;
  return 0;
}

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

#define REP(i,n) for(int i=0; i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VC vector<char>
#define FOREACH(x,a) for(auto& (x) : (a) )
using namespace std;

int main() {
	int n, m, x;
	cin >> n >> m >> x;
	VI v(m);
	REP(i, m) {
		cin >> v[i];
	}
	int a = 0, b = 0;
	REP(i, m) {
		if (v[i] > x) {
			a++;
		}
		else {
			b++;
		}
	}
	cout << min(a, b) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,m;
  int a[105][105],b[100],c[100];
  cin>>n>>m;
  for(int i=0;i<n;i++)
  {
    for(int j=0;j<m;j++)
    {
      cin>>a[i][j];
    }
  }
  for(int i=0;i<m;i++)
  {
    cin>>b[i];
  }
  for(int i=0;i<n;i++)
  {
    for(int j=0;j<m;j++)
    {
      c[i]+=a[i][j]*b[j];
    }
  }
  for(int i=0;i<n;i++)
  {
    cout<<c[i]<<endl;
  }
}



Measured memory_bytes: 3148
n,a=int(input()),sorted(list(map(int,input().split())))
m=a[-1]+1
s=[0]*m
for i in a:s[i]+=1
for i in set(a):
	if s[i]:
		for j in range(i*2,m,i):s[j]=0
print(s.count(1))

Measured memory_bytes: 40096
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <set>
#include <numeric>

#include <map>
#include <math.h>
#include <iomanip>
#include <stack>
#include <queue>
#include <bitset>
#include <math.h>

#define INF 100100100

typedef long long int llint;

using namespace std;

typedef pair<int, int>Pii;

#define pi 3.141592653589793
#define mod 1000000007

int main() {
	int h, w;
	cin >> h >> w;
	vector<string>a(h);
	for (int i = 0; i < h; i++)cin >> a[i];
	for (int i = 0; i <= w + 1;i++)cout << "#";
	cout << endl;
	for (int i = 0; i < a.size(); i++) {
		cout << "#" << a[i] << "#" << endl;
	}
	for (int i = 0; i <= w + 1; i++)cout << "#";
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
import sys

h, w = map(int, sys.stdin.readline().rstrip().split())
n = int(sys.stdin.readline().rstrip())
a = list(map(int, sys.stdin.readline().rstrip().split()))
ans = []
i = 1
for ai in a:
    for j in range(ai):
        ans.append(i)
    i += 1

for i in range(h):
    if i % 2:
        print(' '.join(map(str, reversed(ans[w * i: w * (i + 1)]))))
    else:
        print(' '.join(map(str, ans[w * i: w * (i + 1)])))

Measured memory_bytes: 3572
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<int>
#define pi pair<int,int>
#define endl '\n'
#define flsh cout << endl; cout.flush();
#define _ << ' '
#define min3(a, b, c) min(a, min(b, c))
#define min4(a, b, c, d) min(min(a, d), min(b, c))

using namespace std;
const ll mod = (ll)1e9+7;
const ll INF = (ll)1e9+1;

ll n, a, b;
vi adj[100001];

pi dfs(ll cur, ll p) //return (number of ways for current vertex can be white, number of ways for current vertex can be black)
{ //current vertex can be black if all children are white, it can be white no matter what
    ll w=1, b=0;
    for(auto nxt : adj[cur])
    {
        if(nxt==p) continue;
        pi nxtp = dfs(nxt, cur);
        b = ((w * nxtp.S % mod) + (b *(nxtp.F + nxtp.S))) % mod;
        w = nxtp.F * w % mod;
    }
    return make_pair((w+b)%mod, w);
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    #ifndef ONLINE_JUDGE
    //freopen("B.txt", "r", stdin);
    #endif
    cin >> n;
    for(int i=0; i<n-1; i++)
    {
        cin >> a >> b;
        adj[a].pb(b);
        adj[b].pb(a);
    }
    pi p = dfs(1, 0);
    cout << (p.F + p.S) % mod;
}


Measured memory_bytes: 12672
#include <iostream>
#include <vector>
#include <string>
#include <string.h>
#include <algorithm>
#include <queue>
#include <math.h>
using namespace std;
typedef long long ll;

int main()
{
	ll N, M, K, ans = 0;
	cin >> N >> M >> K;
	vector<ll>pSum1(N + 1, 0), pSum2(M + 1, 0);

	for (int i = 0; i < N; i++) {
		ll tmp;
		cin >> tmp;
		if (i == 0)pSum1[i] = tmp;
		else pSum1[i] = pSum1[i - 1] + tmp;
	}
	for (int i = 0; i < M; i++) {
		ll tmp;
		cin >> tmp;
		if (i == 0)pSum2[i] = tmp;
		else pSum2[i] = pSum2[i - 1] + tmp;
	}

	for (int i = 0; i < N; i++) {
		if (pSum1[i] > K)continue;
		int left = 0, right = M - 1, idx = -1;
		while (left <= right) {
			int mid = (left + right) / 2;
			if (pSum1[i] + pSum2[mid] <= K) {
				idx = mid;
				left = mid + 1;
			}
			else right = mid - 1;
		}
		ans = max(ans,(ll) i + idx + 2);
	}
	for (int i = 0; i < M; i++) {
		if (pSum2[i] > K)continue;
		int left = 0, right = N - 1, idx = -1;
		while (left <= right) {
			int mid = (left + right) / 2;
			if (pSum2[i] + pSum1[mid] <= K) {
				idx = mid;
				left = mid + 1;
			}
			else right = mid - 1;
		}
		ans = max(ans, (ll)i + idx + 2);
	}
	cout << ans;

}

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

int main() {
    int k;
    string s;
    cin>>k>>s;
    if(s.size()<=k){
        cout << s;
    }else{
        rep(i,k)cout << s[i];
        cout << "..." <<endl;
    }
    printf("\n");
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define long long long 
#define PI 3.141592653589793238

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#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

typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update> pref_trie;
typedef tree<long int,null_type,less<long int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef cc_hash_table<long int,long int, hash<long int>, equal_to<long int>, direct_mask_range_hashing<long int>, 
hash_standard_resize_policy<hash_exponential_size_policy<>, hash_load_check_resize_trigger<true>, true>> ht;
typedef gp_hash_table<long int,long int> HashTable;


vector<long int> v;
long int n;

int main(){
   IOS;
 /*    #ifndef ONLINE_JUDGE
         freopen("in.txt",  "r",  stdin);
         freopen("out.txt", "w", stdout);
     #endif */
   
   cin>>n;
   v.resize(n);

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

  long int money = 1000;

  for(long int i = 0; i < n; i++){
 		while(i + 1 < n && v[i] >= v[i + 1])
 			i++;

 		if(i + 1 < n){
 			long int diff = v[i + 1] - v[i];
 			long int units = money / v[i];
 			money += diff * units;
 		} 	
  }

  cout<<money;
  return 0;
}

Measured memory_bytes: 3636
import java.util.*;
 
// ABC 19-C
// http://abc019.contest.atcoder.jp/tasks/abc019_3
 
public class Main {

	public static void main (String[] args) throws java.lang.Exception {
		Scanner in = new Scanner(System.in);

		int n = in.nextInt();
		int[][] freq = new int[n][26];
		int[] answer = new int[26];
		
		for (int i = 0; i < n; i++) {
			char[] c = in.next().toCharArray();
			for (int j = 0; j < c.length; j++) {
				freq[i][c[j] - 'a']++;
				if (i == 0) {
					answer[c[j] - 'a'] = freq[i][c[j] - 'a'];
				}
			}
		}
		
		for (int i = 1; i < n; i++) {
			for (int j = 0; j < 26; j++) {
				answer[j] = Math.min(answer[j], freq[i][j]);
			}
		}
		
		for (int i = 0; i < 26; i++) {
			if (answer[i] > 0) {
				for (int j = 0; j < answer[i]; j++) {
					System.out.printf("%c", i + 'a');
				}
			}
		}
		System.out.println();
		
//		int t = in.nextInt();
//		int num = 1;
//		while (t-- > 0) {
//			int n = in.nextInt();
//			
//			while (!isTidy(n)) {
//				n--;
//			}
//			System.out.printf("Case #%d: %d\n", num, n);
//			num++;
//		}
	}	
	
	public static boolean isTidy(int n) {
		if (n < 10) {
			return true;
		}
		int pre = n % 10;
		n /= 10;
		int curr = n % 10;
		
		while (n > 0) {
			if (pre < curr) {
				return false;
			}
			pre = curr;
			n /= 10;
			curr = n % 10;
		}
		return true;
	}
}


Measured memory_bytes: 20820
N = int(input())
T, A = map(int, input().split())
H = [int(i) for i in input().split()]

min_d = 1000
ans = 0
for i in range(N):
    t = T - H[i] * 0.006
    d = abs(t - A)
    if d < min_d:
        min_d = d
        ans = i+1
print(ans)

Measured memory_bytes: 3064
N = int(input())
X = list(map(int,input().split()))
#ans = 10000
ls = []
for i in range(1,100):
    sum = 0
    for j in range(N):
        sum += (X[j]-i)**2
    ls.append(sum)
    #print(ls)
    #ans = min(ans,sum)
print(min(ls))


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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define BiSearchRangeNum(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y)turn idx;
#define deg_to_rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad_to_deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)

template<class T>
inline bool chmax(T &a, T b) {
  if(a < b) {
    a = b;
    return true;
  }
  return false;
};

template<class T>
inline bool chmin(T &a, T b) {
  if(a > b) {
    a = b;
    return true;
  }
  return false;
};

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

// a^n mod を計算する
long long modpow(long long a, long long n, long long m) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % m;
        a = a * a % m;
        n >>= 1;
    }
    return res;
};

long long fact[100005], inv[100005], factinv[100005];
// initし忘れるな!!!
void init(int m) {
  fact[0] = 1;
  for(int i = 1; i < 100005; i++) {
    fact[i] = (1ll * fact[i - 1] * i) % m;
  }
  for(int i = 0; i < 100005; i++) {
    inv[i] = modinv(i, m);
    factinv[i] = modinv(fact[i], m);
  }
};

// nCrを計算する
long long comb(long long n, long long r) {
    return fact[n] * factinv[r] * factinv[n - r];
};

// nCr mod を計算する
long long modcomb(long long n, long long r, long long m) {
    return (fact[n] * factinv[r] % m) * factinv[n - r] % m;
};

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

  sort(All(A));

  ll ans = 0;

  ll mod = (ll) 1e9+7;

  if (K == 1ll) {
    cout << 0 << endl;
    return 0;
  }

  init((int)1e9+7);

  ll max_s = 0ll, min_s = 0ll;

  rep(i, 0, N) {
    ll a = A[i];
    a = (a+mod) % mod;
    if (i+1 >= K) {
      max_s += (a * modcomb(i, K-1, mod));
      max_s %= mod;
    }
    if (N-i >= K) {
      min_s += (a * modcomb(N-i-1, K-1, mod));
      min_s %= mod;
    }
  }
  ans = (max_s - min_s + mod) % mod;
  cout << ans << endl;
};


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


const int MOD = 1e9 + 7;

int main(){
    int n, m, a;
    cin >> n >> m;
    bool bl[n+1];
    int ans[n+1];
    for(int i = 0; i <= n; i++) ans[i] = bl[i] = 0;
    for(int i = 0; i < m; i++){
        cin >> a;
        bl[a] = 1;
    }
    
    ans[n] = 1;
    ans[n-1] = bl[n-1] ? 0 : ans[n];
    for(int i = n-2; i >= 0; i--){
        if(bl[i]) ans[i] = 0;
        else ans[i] = (ans[i+1] + ans[i+2]) % MOD;
    }
    cout << ans[0] << '\n';
}

Measured memory_bytes: 768
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for(int i = 0; i < N; i++) cin >> a[i];
  sort(a.begin(), a.end(), greater<int>());
  
  int alice = 0, bob = 0;
  for(int i = 0; i < N; i++) {
    if(i % 2) bob += a[i];
    else alice += a[i];
  }
  cout << (alice - bob) << endl;
  
  return 0;
}

Measured memory_bytes: 256
// copied by Nurstan Duisengaliev
// skatal
#include <bits/stdc++.h>
 
#define ll long long
#define all(x) x.begin(), x.end()
#define in insert
#define mp make_pair
#define F first
#define S second
#define ppf pop_front
#define pb push_back
#define ppb pop_back
#define pf push_front
#define pii pair <int, int>
#define boost() ios_base::sync_with_stdio(0), cin.tie(0)
#define sz(x) (int)x.size()
 
using namespace std;
 
const int N = (int)2e5 + 123;
const int mod = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;

void solve () {
	int sum, n;
	cin >> sum >> n;
	for (int i = 1; i <= n; i ++) {
		int x;
		cin >> x;
		sum -= x;
	}	
	if (sum <= 0) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
}
 
main () {
//	freopen (".in", "r", stdin);
//	freopen (".out", "w", stdout);
	boost ();
	int TT = 1;
//  cin >> TT;
	while (TT --) {
		solve ();
	}
	return 0;	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define fi first
#define se second
#define si set <int>
#define sll set <ll>
#define spii set <pii>
#define vs vector <string>
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define forn(i, n) for (int i = 0; i < (n); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define for1(i, n) for (int i = 1; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()


using namespace std;
const ll INFLL = 1e18;
const int MAXN = 1e6+100;
const ll INF = 1e9;
const ll mod1=1e9+7;
const ll mod2=2e9+11;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifdef LOCAL
    freopen("a.in","r",stdin);
#endif
    ll k,x;
    cin>>k>>x;
    k*=500;
    if (k>=x)
        cout<<"Yes";
    else
        cout<<"No";




}

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

struct node
{
    int x,y,id;
};
struct edge
{
    int u,v;
    double cost;
    edge() {}
    edge(int x,int y,double z)
    {
        u=x;
        v=y;
        cost=z;
    }
    bool operator <(const edge& a) const
    {
        return cost>a.cost;
    }
};

edge es[50010];
int par[10010];
node p[10010];
int n,m;
void init()
{
    for(int i=1;i<=n;i++) par[i]=i;
}

int find(int x)
{
    return x==par[x]?x:par[x]=find(par[x]);
}

void unite(int x,int y)
{
    x=find(x);
    y=find(y);
    if(x!=y) par[x]=y;
}

double dis(int a,int b)
{
    return sqrt(1.0*(p[a].x-p[b].x)*(p[a].x-p[b].x)+1.0*(p[a].y-p[b].y)*(p[a].y-p[b].y));
}

double kruskal()
{
    sort(es,es+m);
    //for(int i=0;i<m;i++) printf("%d %d %lf\n",es[i].u,es[i].v,es[i].cost);
    double s=0;
    for(int i=0;i<m;i++)
    {
        edge e=es[i];
        if(find(e.u)!=find(e.v))
        {
            unite(e.u,e.v);
            s+=e.cost;
        }
    }
    return s;
}
int main()
{
    //freopen("a.txt","r",stdin);
    int a,b;
    double c,sum;
    while(~scanf("%d%d",&n,&m))
    {
        init();
        sum=0;
        for(int i=1;i<=n;i++)
        {
            scanf("%d%d",&p[i].x,&p[i].y);
        }
        for(int i=0;i<m;i++)
        {
            scanf("%d%d",&a,&b);
            c=dis(a,b);
            sum+=c;
            es[i]=edge(a,b,c);
        }
        printf("%.3lf\n",sum-kruskal());
    }
    return 0;
}

Measured memory_bytes: 1672
#include "bits/stdc++.h"
using namespace std;
#define PB push_back
#define MP make_pair
#define REP(i,n) for(int i=0;i<(n);i++)

int main(){
    int n;
    long long a[100100];
    long long ans1=0,ans2=0;
    long long sum1=0,sum2=0;
    cin>>n;
    for(int i=0;i<n;i++){
    //     cout<<"-------------"<<endl;
    //     cout<<sum1<<" "<<sum2<<endl;
    //     cout<<ans1<<" "<<ans2<<endl;
        cin>>a[i];
        sum1+=a[i];
        sum2+=a[i];
        if(sum1>=0){
            ans1+=(sum1+1);
            sum1=-1;
        }
        if(sum2<=0){
            ans2-=(sum2-1);
            sum2=1;
        }
        swap(sum1,sum2);
        swap(ans1,ans2);
    }
    cout<<min(ans1,ans2)<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#pragma GCC optimize ("Ofast", "unroll-loops")
using namespace std;
#define ll long long
#define int ll
#define FOR(i,a,b) for (int i = (a); i<(b); i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n+1)
#define RREP(i,n) for (int i=(n)-1; i>=0; i--)
#define f first
#define s second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define SZ(x) (int)(x.size())
#define SQ(x) (x)*(x)
#define pii pair<int, int>
#define endl '\n'
//#define TOAD
#ifdef TOAD
#define bug(x) cerr<<__LINE__<<": "<<#x<<" is "<<x<<endl
#define IOS()
#else
#define bug(...)
#define IOS() ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#endif
const ll inf = 1ll<<60;
const int iinf=2147483647;
const ll mod = 998244353;
const ll maxn=1e3+5;
ll pw(ll x, ll p){
    ll ret=1;
    while (p>0){
        if (p&1){
            ret*=x;
            ret%=mod;
        }
        x*=x;
        x%=mod;
        p>>=1;
    }
    return ret;
}
ll inv(ll x){
    return pw(x, mod-2);
}
int cosst(pii x, pii y, pii z){
    return x.f*y.s*z.s;
}
signed main(){
    IOS();
    int n; cin>>n;
    vector<pii> vc(n);
    REP(i,n) cin>>vc[i].f>>vc[i].s;
    vector<int> dp[n+2];
    REP(i,n+2){
        dp[i].resize(n+2);
    }
    //cout<<endl;
    for (int i=n;i>=1;i--){
        FOR(j,i+1,n+1){
            dp[i][j]=inf;
            FOR(k,i,j){
                dp[i][j]=min(dp[i][j], dp[i][k]+dp[k+1][j]+cosst(vc[i-1], vc[k-1], vc[j-1]));
            }
            //cout<<i<<' '<<j<<endl;
            //cout<<dp[i][j]<<endl;
        }
    }
    /*REP1(i,n){
        REP1(j,n){
            cout<<i<<' '<<j<<endl;
            cout<<dp[i][j]<<endl;
        }
    }
    */
    cout<<dp[1][n]<<endl;

}



Measured memory_bytes: 3220
#include <iostream>
#include <vector>
#include <cstdio>
#include <fstream>
#include <limits.h>
#include <algorithm>
using namespace std;
#define MAX_VAL 1000000007
typedef long long ll;

int main()
{
    //freopen("input.in", "r", stdin);
    ll n, m;
    cin>>n>>m;
    vector<ll> xx(n, 0);
    vector<ll> yy(m, 0);
    ll num, tmp;
    for(ll i=0;i<n;i++){
        cin>>xx[i];
    }
    for(ll i=0;i<m;i++){
        cin>>yy[i];
    }
    ll ans=0, s1=0, s2=0;
    for(ll i=0;i<n;i++){
        s1=s1+i*xx[i];
        s1=s1-(n-i-1)*xx[i];
        s1=(s1+MAX_VAL)%MAX_VAL;
    }
    for(ll j=0;j<m;j++){
        s2=s2+j*yy[j];
        s2=s2-(m-j-1)*yy[j];
        s2=(s2+MAX_VAL)%MAX_VAL;
    }
    ans=(s1*s2)%MAX_VAL;
    cout<<ans<<endl;
    return 0;

}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define SIZE 300005
#define MOD 1000000007LL
#define EPS 1e-10
#define INF 1<<29
#define LLINF 1LL<<60
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
typedef long long ll;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
typedef complex<double> dcomplex;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cerr<<a[i]<<((i==a.size()-1)?"\n":" ");}}
ll gcd(ll a,ll b){int c=max(a,b);int d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}
ll modpow(ll a, ll n){ll b=1;while (n>0){if(n&1)b=b*a%MOD;a=a*a%MOD;n>>=1;}return b;}

ll N;
ll fact[100010];
ll ifact[100010];

ll modcomb(ll n, ll k){
    if(k < 0 || k > n) return 0;
    ll ans = fact[n];
    ans = ans * ifact[k] % MOD;
    ans = ans * ifact[n-k] % MOD;
    return ans;
}

int main() {
    scanf("%llu", &N);
    vector<ll> cnt(N+1, -1);
    ll a, d1, d2;
    REP(i, N) {
        scanf("%llu", &a);
        if(cnt[a] != -1) {
            d1 = min(cnt[a], ll(i));
            d2 = max(cnt[a], ll(i));
            break;
        }
        cnt[a] = i;
    }
    fact[0] = 1;
    ifact[0] = 1;
    FOR(i, 1, N+2) {
        fact[i] = fact[i-1] * i % MOD;
        ifact[i] = modpow(fact[i], MOD-2);
    }
    ll ans;
    printf("%lld\n", N);
    FOR(k, 2, N) {
        ans = modcomb(N+1, k);
        ans = (ans - modcomb(N-(d2-d1), k-1) + MOD) % MOD;
        printf("%llu\n", ans);
    }
    printf("1\n");
 	return 0;
}


Measured memory_bytes: 3584
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys
import string

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")


S = sys.stdin.readline().rstrip()
print(S[::2])


Measured memory_bytes: 13640
def main():
    INF = 10**20
    N, K = map(int, input().split())
    h = list(map(int, input().split()))
    dp = [INF] * N
    dp[0] = 0
    for i in range(1, N):
        for j in range(1, K+1):
            if i >= j:
                dp[i] = min(dp[i], dp[i-j] + abs(h[i]-h[i-j]))
            else:
                continue
    print(dp[-1])


if __name__ == '__main__':
    main()


Measured memory_bytes: 53728
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  ll n; cin >> n;
  ll ga, sa, ba, gb, sb, bb; cin >> ga >> sa >> ba >> gb >> sb >> bb;
  vvll dp1(4, vll(n+1, -1));
  vll v1 = {ga, sa, ba}, w1 = {gb - ga, sb - sa, bb - ba};
  dp1[0][0] = n;
  for(ll i=0;i<3;++i) {
    for(ll j=0;j<n+1;++j) {
      if(dp1[i][j] != -1) dp1[i+1][j] = dp1[i][j];
      if(j - v1[i] >= 0) {
        if(dp1[i+1][j-v1[i]] != -1) dp1[i+1][j] = max(dp1[i+1][j], dp1[i+1][j-v1[i]] + w1[i]);
      }
    }
  }
  ll m = 0;
  for(int i=0;i<n+1;++i) {
    if(dp1[3][i] != -1) m = max(m, dp1[3][i]);
  }
  vll v2 = {gb, sb, bb}, w2 = {ga - gb, sa - sb, ba - bb};
  vvll dp2(4, vll(m+1, -1));
  dp2[0][0] = m;
  for(int i=0;i<3;++i) {
    for(int j=0;j<m+1;++j) {
      if(dp2[i][j] != -1) dp2[i+1][j] = dp2[i][j];
      if(j - v2[i] >= 0) {
        if(dp2[i+1][j-v2[i]] != -1) dp2[i+1][j] = max(dp2[i+1][j], dp2[i+1][j-v2[i]] + w2[i]);
      }
    }
  }
  ll ma = 0;
  for(int i=0;i<m+1;++i) {
    if(dp2[3][i] != -1) ma = max(ma, dp2[3][i]);
  }
  cout << ma << endl;
}


Measured memory_bytes: 977024
n = int(input())
s='zabcdefghijklmnopqrstuvwxy'

answer = []
i = 1
while n > 0:
  x = n % 26
  if x >0:
  	n = n // 26
  else:
    n = n // 26 -1
  answer.append(s[x])
print(''.join(answer[::-1]))

Measured memory_bytes: 9188
n=int(input())
w=[input() for i in range(n)]
if len(w)!=len(set(w)):
    print("No")
else:
    for i in range(n-1):
        if w[i][len(w[i])-1]!=w[i+1][0]:
            print("No")
            break
    else:
        print("Yes")

Measured memory_bytes: 9184
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define shosu(X) fixed << setprecision(X)
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;}
 
int main(){
  ll int l,r;
  cin >> l >> r;
  bool hasall = false;
  if(r - l >= 2019) hasall = true;
  if(hasall){
    cout << 0 << endl;
    return 0  ;
  }

  int lmod, rmod;
  lmod = l % 2019;
  rmod = r % 2019;
  if(rmod < lmod) rmod += 2019;
  int ans = 9999;


  for(int i = lmod; i <= rmod; i++){
    for(int j = i + 1; j <= rmod; j++){
      ans = min(ans, (i * j) % 2019);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int main(){
	double r1, r2, r3, rinf;
	int a[1000], b[1000], c[1000];
	int n;
	r1 = 0;
	r2 = 0;
	r3 = 0;
	rinf = 0;
	cin >>n ;

	for(int i = 0 ; i < n; i++){
		cin >>  a[i];
	}
	for (int i = 0 ; i < n ;i++){
		cin >> b[i];
	}
	for(int i = 0; i < n ; i++){
		c[i] = a[i]-b[i];
		r1 += abs(c[i]);
		r2 += c[i]*c[i];
		r3 += abs(c[i]*c[i]*c[i]);
		if(rinf<abs(c[i])){
			rinf = abs(c[i]);
		}
	}
	r2 = sqrt(r2);
	r3 = pow(r3,(double)1/(double)3);
	printf("%.8f\n%.8f\n%.8f\n%.8f\n",r1,r2,r3,rinf);

	return 0;
}



Measured memory_bytes: 3340
#include <stdio.h>

int main (){
  int a[3],i,j,tem;

  for(i=0;i<3;i++) scanf("%d",&a[i]);
  for(i=0;i<2;i++) for(j=i;j<3;j++) if(a[i]>a[j]){
	tem = a[i];
	a[i] = a[j];
	a[j] = tem;
  }
  printf("%d %d %d\n",a[0],a[1],a[2]);

  return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<int, pair<int, int> > piii;
#define pb push_back
#define debug(x) cout << x << endl
#define fastio ios_base::sync_with_stdio(0), cin.tie(0)
#define PI acos(-1)
#define all(c) c.begin(), c.end()
#define SET(x, y) memset((x), y, sizeof(x))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const LL INF64 = 1e18;

const int N = 1e5 + 5;

int H[N];
int dp[N];

int main() {
	int n;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
		scanf("%d", H + i);
	dp[1] = 0;
	dp[2] = abs(H[1] - H[2]);
	for (int i = 3; i <= n; i++) {
		dp[i] = min(dp[i - 1] + abs(H[i] - H[i - 1]), dp[i - 2] + abs(H[i] - H[i - 2]));
	}
	printf("%d\n", dp[n]);
	return 0;
}
		

Measured memory_bytes: 1024
#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <map>
#include <functional>

using namespace std;
typedef long long ll;
typedef vector<int> VI;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)

int min(int i, int j) {
	if (i < j)
		return i;
	else
		return j;

}

int max(int i, int j) {

	if (i > j)
		return i;
	else
		return j;
}


//グラフの隣接リスト
VI g[100010];
//頂点の入次数を管理
vector<int> H;
signed main(void)
{
	int N;
	cin >> N;
	H.resize(N);
	REP(i, N)
		cin >> H[i];

	int ans = 0, r = 0;
	REP(i, N-1) {

		if (H[i] >= H[i + 1])
			r++;
		else {
			ans = max(r, ans);
			r = 0;
		}
	}
	ans = max(r, ans);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main(){
    int n;cin >> n;
    unordered_map<char,ll> map;
    for(int i=0;i<n;i++){
        string s;cin >> s;
        map[s.at(0)]++;
    }
    ll ans;
    ans+=map['M']*map['A']*map['R'];
    ans+=map['M']*map['A']*map['C'];
    ans+=map['M']*map['A']*map['H'];
    ans+=map['M']*map['R']*map['C'];
    ans+=map['M']*map['R']*map['H'];
    ans+=map['M']*map['C']*map['H'];
    ans+=map['A']*map['R']*map['C'];
    ans+=map['A']*map['R']*map['H'];
    ans+=map['A']*map['C']*map['H'];
    ans+=map['R']*map['C']*map['H'];
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,ThxDem=b;i<ThxDem;++i)
#define pb push_back
#define ALL(s) s.begin(),s.end()
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define SZ(s) int(s.size())
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;

ll INF=1000000000000000000;

ll mul(ll a, ll b){
	if(!a||!b)return 0;
	if(min(a,b)<0)return -1;
	if(a>INF/b) return -1;
	return a*b;
}

int main(){FIN;
	ll ans=1;
	ll n; cin>>n;
	fore(i,0,n){
		ll x; cin>>x;
		ans=mul(ans,x);
	}
	if(ans>1000000000000000000)ans=-1;
	cout<<ans<<"\n";
}

Measured memory_bytes: 3636
#include <stdio.h>

int main() {

    int a , b ;
    
	scanf("%d %d", &a, &b );
	if (a < b)
		printf("a < b\n");
	else if (a > b)
		printf("a > b\n");
	else if (a == b)
		printf("a == b\n");
	return 0;
}


Measured memory_bytes: 2088
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s[3];
  cin >> s[0] >> s[1] >> s[2];
  
  int i = 0;
  while(1){
    if(s[i].size() == 0){
      cout << (char)(i + 'A');
      return 0;
    }
    char c = s[i].at(0);
    s[i] = s[i].substr(1,s[i].size()); 
    i = c - 'a';
  }
}
    

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sz(arr) (int)arr.size()
#define all(arr) arr.begin(), arr.end()

using namespace std;

void _cin() {}
template <class Head, class... Tail>
void _cin(Head&& head, Tail&&... tail) {
  cin >> head;
  _cin(forward<Tail>(tail)...);
}

#define Cin(T, ...) \
  T __VA_ARGS__;    \
  _cin(__VA_ARGS__)

int main() {
  Cin(int, n, k);

  cout << n - k + 1 << endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

        int N = scanner.nextInt();
        int M = scanner.nextInt();
        int[] num = new int[N + 1];

        for (int i = 0 ; i < M ; i++) {
            int si = scanner.nextInt();
            int ci = scanner.nextInt();

            if (N > 1 && si == 1 && ci == 0) {
                System.out.println(-1);
                return;
            }
            if (num[si] != 0 && num[si] != ci) {
                System.out.println(-1);
                return;
            }
            num[si] = ci;
        }
        if (N > 1 && num[1] == 0) num[1] = 1;

        int ans = 0;
        int digit = 1;
        for (int i = N ; i > 0 ; i--) {
            ans += num[i] * digit;
            digit *= 10;
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 23636
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  rep(i,N) cin >> A[i];
  vector<int> P(N+1);
  rep(i,N){
    P[A[i]] = i+1;
  }
  rep(i,N+1){
    if(i==0) continue;
    if(i!=1) cout << " ";
    cout << P[i];
  }
  cout << endl;

  return 0;
}


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

//ライブラリ始まり

//定数

//円周率
const double PI = 3.1415926535897932384;

//天井
const int INF = 1000000000; // = 10^9
const ll LINF = 1000000000000000; // = 10^15

//ABC文字列
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZABC";
const string abc = "abcdefghijklmnopqrstuvwxyzabc";

//よくあるmodくん
const ll MOD = 1000000007; // = 10^9 + 7

//データ構造

//Union_Find木
struct UnionFind {
  vector<int> par; // par.at(i) : iの親の番号
  UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
    for(int i = 0; i < N; i++) {
      par.at(i) = i;
    }
  }
  int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
    if (par.at(x) == x) {
      return x;
    }
    return par.at(x) = root(par.at(x));
  }
  void unite(int x, int y) { // xとyの木を併合
    int rx = root(x); //xの根をrx
    int ry = root(y); //yの根をry
    if (rx == ry) {
      return; //xとyの根が同じ(=同じ木にある)時はそのまま
    }
    par.at(rx) = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
  }
  bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};

//関数

//ctoi
int ctoi(char c){
  if (c == '0') {
    return 0;
  }
  if (c == '1') {
    return 1;
  } 
  if (c == '2') {
    return 2;
  } 
  if (c == '3') {
    return 3;
  }
  if (c == '4') {
    return 4;
  } 
  if (c == '5') {
    return 5;
  } 
  if (c == '6') {
    return 6;
  }
  if (c == '7') {
    return 7;
  } 
  if (c == '8') {
    return 8;
  } 
  if (c == '9') {
    return 9;
  }
  return -1;  
}

//素数判定
bool PN(int x) {
  if (x <= 1) {
    return false; // 1は素数ではない
  }
  if (x == 2) {
    return true; // √2 + 1 > 2 なので下でやると 2 ％ 2 = 0 となり判定できない
  }
  for (int i = 2; i < sqrt(x) + 1; i++) {
    if (x % i == 0) {
      return false; // 割れたら素数じゃない
    }
  }
  return true;
}

//ライブラリ終わり

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> P(N);
  for (int i = 0; i < N; i++) {
    cin >> P.at(i);
  }
  UnionFind memo(N);
  for (int i = 0; i < M; i++) {
    int X, Y;
    cin >> X >> Y;
    memo.unite(X - 1, Y - 1);
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (memo.same(i, P.at(i) - 1)) {
      ans++;
    }
  }
  cout << ans << endl;
}

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

const int kN = 2e5 + 5;

int n, a[kN];
bool Check(int mid) {
	for(int i = 0; i < n - 1; ++i) {
		if((a[n + i] > mid) == (a[n + i + 1] > mid)) return (a[n + i] > mid);
		if((a[n - i] > mid) == (a[n - i - 1] > mid)) return (a[n - i] > mid);
	}
	return a[1] > mid;
}

int main() {
	scanf("%d", &n);
	for(int i = 1; i < 2 * n; ++i) scanf("%d", a + i);
	int l = 1, r = 2 * n - 1;
	while(l < r) {
		int mid = (l + r) >> 1;
		if(Check(mid)) l = mid + 1;
		else r = mid;
	}
	printf("%d", l);
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define TRACE(x) x
#define WATCH(x) TRACE( cout << #x" = " << x << endl)
#define PRINT(x) TRACE(printf(x))
#define WATCHR(a, b) TRACE( for(auto c = a; c != b;) cout << *(c++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end()); } )
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define mp make_pair
#define st first
#define nd second

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using ld = long double;
using pll = pair<ll, ll>;
using vll = vector<ll>;
using pll = pair<ll, ll>;

void buff() { ios::sync_with_stdio( false ); cin.tie( nullptr ); }

constexpr ll MOD = 1e9 + 7;

inline ll pow_mod( ll a, ll b, ll mod = MOD) {
    ll res = 1; a %= mod; assert(b >= 0);
    for(;b;b>>=1) {
        if(b&1) res = (res * a) % mod;
        a = (a * a) % mod;
    }
    return res;
}
// End of template code!
int main() 
{
    buff();
    int n;
    cin >> n;
    int cur = 1;
    int brk = n;
    for(int i = 0; i < n; ++i)
    {
        int x;
        cin >> x;
        if(x == cur) {
            brk--;
            ++cur;
        }
    }
    if(brk == n) cout << -1 << '\n';
    else cout << brk << '\n';
    return 0;
}



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

using namespace std;

queue<vector<int>> que;

void solve(vector<int> vec){

}


int main(void)
{
    int N,K,tmp;
    long long ans;
    cin>>N>>K;

    ans=K*pow(K-1,N-1);


    cout<<ans<<endl;



 
	return 0;
}


Measured memory_bytes: 4000
function main(input){
  const lines = input.split('\n');
  const N = parseInt(lines.shift());
  const H = lines.shift().split(' ').map(x => parseInt(x));

  const DP = Array(N).fill(Infinity);
  DP[0]=0;
  DP[1]=Math.abs(H[0]-H[1]);

  for(var i=2;i<N;i++){
    var one_hop = DP[i-1] + Math.abs(H[i-1]-H[i]);
    var two_hop = DP[i-2]+ Math.abs(H[i-2]-H[i]);

    DP[i]=Math.min(one_hop, two_hop);
  }
  //console.log(DP);
  console.log(DP[N-1]);

}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));



Measured memory_bytes: 27684
using System;

namespace atcoderA
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int N = input[0];
            int A = input[1];
            int B = input[2];
            Console.WriteLine(Math.Min(A * N, B));
        }
    }
}

Measured memory_bytes: 11092