akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();
		char[] map = S.toCharArray();
		int ans = 0;
		char pre = map[0];
		for(int i = 1; i < map.length; i++) {
			if (pre != map[i]) {
				ans++;
				pre = map[i];
			}
		}
		
		System.out.println(ans);
	}

}

Measured memory_bytes: 26316
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100000000;

const int MAX = 510000;
const int MOD = 1000000007;

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

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}




int main()
{
   COMinit();
   int h,w,a,b;
   cin >> h >> w >> a >> b;
   ll ans = 0;

   
   int x=b,y=h-a-1;
   while(1)
   {
      ans += (COM(x+y,x)*COM(w-1-x+(h-1-y),w-1-x))%MOD;
      ans%=MOD;
      x++;
      y--;
      ans %=MOD;
      if(x==w||y==-1)break;
   }
   cout<<ans<<endl;
   return 0;
}

Measured memory_bytes: 12160
N = int(input())
T, A = map(int, input().split())
H = [int(i) for i in input().split()]
best = [0, 10 ** 9]
for i in range(len(H)):
  if abs(T - H[i] * 0.006 -A) < best[1]:
    best[0] = i + 1
    best[1] = abs(T - H[i] * 0.006 -A)
print(best[0])

Measured memory_bytes: 3060
const input = require("fs").readFileSync("/dev/stdin", "utf8")

;(input => {

    const lines = input.split('\n')
    const N = lines[0] - 0

    const f = (x, y, z) => {
        return  x * x + y * y + z * z + x * y + y * z + x * z
    }

    const map = Array(N + 1).fill(0)
    for (let i = 1; i <= N; i++) {
        for (let j = 1; j <= N; j++) {
            for (let k = 1; k <= N; k++) {
                const n = f(i, j, k)
                if (n <= N)  {
                    map[n] ++
                } else {
                    break
                }
            }
        }
    }

    map.shift()
    map.forEach(n => {
        console.log(n)
    })

})(input)


Measured memory_bytes: 36796
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

#define rep(i, n) for(int i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

int main(int argc, char** argv) {
  ll N;
  cin >> N;
  vector<int> a(N);
  rep(i, N) {
    int x;
    cin >> x;
    ++a[x-1];
  }
  sort(all(a)); // a: frequencies in increasing order.

  vector<int> s(N+1); // s[i]: sum of [0, i).
  rep(i, N) {
    s[i+1] = s[i] + a[i];
  }

  for (int k = 1; k <= N; ++k) {
    int l = 0, r = N/k + 1; // [l, r). l:ok r: ng. We want to find the boundary of ok, ng.
    while (l+1 < r) {
      int c = (l+r)/2;
      bool ok = [&](int c) {
        int i = lower_bound(all(a), c) - a.begin();
        int sum = c*(N-i) + s[i];
        return sum >= c*k;
      }(c);
      if (ok) {
        l = c;
      } else {
        r = c;
      }
    }
    cout << l << endl;
  }
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
     
using namespace std;
#define ll long long 
#define ld long double

int main()
{   int n;
    cin>>n;
    ll arr[n][3];
    ll dp[n+2][3]={};
    for (int i=0;i<n;i++){
        cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
    }
    for (int i=0;i<n;i++){
        for (int j=0;j<3;j++){
            for (int k=0;k<3;k++){
                if (k!=j){
                    dp[i+1][k]=max(dp[i+1][k],dp[i][j]+arr[i][k]);
                }
            }
        }
    }
    cout<<max(dp[n][0],max(dp[n][2],dp[n][1]))<<endl;
    
    
    return 0;
}


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

int main()
{
	int k,a,b;
	cin>>k>>a>>b;
	
	for(int i=a;i<=b;i++)
		if(i%k==0)
		{
			cout<<"OK"<<endl;
			return 0;
		}
	cout<<"NG"<<endl;
	return 0;
}

Measured memory_bytes: 3584
import java.util.Scanner;
import java.util.Arrays;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int[] ax = new int[a];
    int[] bx = new int[b];
    int ay = 0;
    int by = 0;
    int az = a;
    int bz = b;
    for(int i = 2;i <=a;i++){
      if(az % i == 0){
   //     System.out.println(i);
 //       System.out.println(a);        
        az = az / i;
        ax[ay] = i;
        i--;
        ay++;
      }
    }
    for(int j = 2;j <= b;j++){
      if(bz % j == 0){
    //    System.out.println(bz);
  //      System.out.println(j);        
        bz = bz / j;
        bx[by] = j;
        j--;
        by++;
      }      
    }
// System.out.println(Arrays.toString(ax));
//  System.out.println(Arrays.toString(bx));    
    for(int c = 0;c < ay;c++){
      for(int d = 0;d < by;d++){
        if(ax[c] == bx[d] && bx[d] != 1){
          bx[d] = 1;
          break;
        }
      }
    }
    long ans = 1;
    for(int e = 0;e < ay;e++){
      ans *= ax[e];
    }
    for(int f = 0;f < by;f++){
      ans *= bx[f];      
    }
    System.out.println(ans);
   // System.out.println(Arrays.toString(ax));
 //   System.out.println(Arrays.toString(bx)); 
//    System.out.println(by);
  }
}


Measured memory_bytes: 21844
import qualified Data.ByteString.Char8 as BS
import Data.Maybe
import Data.Array

main :: IO ()
main = do
  [n, x] <- map read . words <$> getLine
  a <- listArray (0, n-1) . map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine
  let
    b pre k = if k == n-1
      then sum pre + k * x
      else let
          next = array (0, n-1) $ map (\(i, e) -> (i, min e (a ! ((i-k-1)`mod`n)))) $ assocs pre
        in min (sum pre + k * x) $ b next (k+1)
  print $ b a 0


Measured memory_bytes: 2428
import java.util.Scanner;

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

		if(a < 10 && b < 10){
			ans = a * b;
		}

		System.out.println(ans);
		sc.close();
	}
}


Measured memory_bytes: 23252
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
template<class L, class R>
istream &operator>>(istream &in, pair<L, R> &arr){
    return in >> arr.first >> arr.second;
}
template<class T>
istream &operator>>(istream &in, vector<T> &arr){
	for(auto &x: arr) in >> x; return in;
}
template<class T>
istream &operator>>(istream &in, deque<T> &arr){
	for(auto &x: arr) in >> x; return in;
}
template<class L, class R>
ostream &operator<<(ostream &out, const pair<L, R> &arr){
    return out << "(" << arr.first << ", " << arr.second << ")";
}
template<class T>
ostream &operator<<(ostream &out, const vector<T> &arr){
	for(auto &x: arr) out << x << " "; return out << "\n";
}
template<class T>
ostream &operator<<(ostream &out, const deque<T> &arr){
	for(auto &x: arr) out << x << " "; return out << "\n";
}
template<class T>
ostream &operator<<(ostream &out, const set<T> &arr){
	for(auto &x: arr) out << x << " "; return out << "\n";
}
template<class L, class R>
ostream &operator<<(ostream &out, const map<L, R> &arr){
	for(auto &x: arr) out << x << " "; return out << "\n";
}
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rndll(chrono::steady_clock::now().time_since_epoch().count());
#define all(a) a.begin(), a.end()
#define sz(a) (int)a.size()
typedef long long ll;
typedef vector<int> vi; typedef vector<ll> vl; typedef vector<double> vd; typedef vector<string> vs;
typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<int, ll> pil; typedef pair<ll, int> pli;
typedef vector<pii> vpii; typedef vector<pil> vpil; typedef vector<pli> vpli; typedef vector<pll> vpll;
template<class T>
using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef tuple<int, int, int> tpl; typedef vector<tpl> vtpl;



int main(){
	cin.tie(0)->sync_with_stdio(0);
	int n;
	cin >> n;
	vector<pair<string, int>> a(n);
	cin >> a;
	string s;
	cin >> s;
	for(int i = 0; i < n; ++ i){
		if(a[i].first == s){
			ll res = 0;
			for(int j = i + 1; j < n; ++ j){
				res += a[j].second;
			}
			cout << res;
			return 0;
		}
	}
	return 0;
}

/*

*/

////////////////////////////////////////////////////////////////////////////////////////
//                                                                                    //
//                                   Coded by Aeren                                   //
//                                                                                    //
////////////////////////////////////////////////////////////////////////////////////////

Measured memory_bytes: 892
#include<cmath>
#include<cstdio>

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

using namespace std;

template<class T>
struct point3{ T x,y,z; };

template<class T>
double dist(const point3<T> &a,const point3<T> &b){
	return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)+(a.z-b.z)*(a.z-b.z));
}

int main(){
	int q; scanf("%d",&q);
	while(q--){
		double a,b,c;
		int n; scanf("%lf%lf%lf%d",&a,&b,&c,&n);
		point3<double> P[30];
		rep(i,n) scanf("%lf%lf%lf",&P[i].x,&P[i].y,&P[i].z);

		rep(i,n) rep(j,n) rep(k,n) if(i!=j && i!=k && j!=k) {
			double aa=dist(P[j],P[k]),bb=dist(P[k],P[i]),cc=dist(P[i],P[j]);
			if(abs(b/a-bb/aa)<1e-4 && abs(c/a-cc/aa)<1e-4) printf("%d %d %d\n",i+1,j+1,k+1);
		}
	}

	return 0;
}

Measured memory_bytes: 0
import numpy as np
import math

N = int(input())

X=[]
for i in range(N):
    X.append(list(map(int, input().split())))
X = np.array(X)

gokei = 0
for i in range(N):
    for j in range(i+1, N):
        gokei += np.linalg.norm(X[i]-X[j])

print(gokei*math.factorial(N-1)*2/math.factorial(N)) 

Measured memory_bytes: 13544
// Problem : B - ... (Triple Dots)
// Contest : AtCoder - AtCoder Beginner Contest 168
// URL : https://atcoder.jp/contests/abc168/tasks/abc168_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// Author : Ritbik Bharti

#include<bits/stdc++.h>
using namespace std;

#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long int
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<vl> vvl;

#define clr(a,x) memset(a,x,sizeof(a));
#define print1d(mat,n){for(int i=0;i<(int)(n);i++)cout<<mat[i]<<" ";cout<<endl;}
#define print2d(mat,n,m){for(int i=0;i<(int)(n);i++){for(int j=0;j<(m);j++){cout<<mat[i][j]<<" ";}cout<< endl;}}
#define print(v) for(const auto itr:v){ cout << itr << ' ';} cout << endl;
#define pb push_back
#define ff first
#define ss second
#define endl '\n'
#define mod 1e9

double EPS = 1e-9; 
int INF = 1000000005; 
long long INFF = 1000000000000000005LL; 
double PI = acos(-1);


int main(){
    fastIO

    int k;
    cin>>k;
    string s,s1;
    cin>>s;
    if(s.length()<=k) cout<<s<<endl;
    else{
    	for(int i=0;i<k;i++){
    		s1.pb(s[i]);
    	}
    	cout<<s1<<"..."<<endl;
    }

    return 0;
}

Measured memory_bytes: 3620
import sys
input = sys.stdin.readline
import collections

def main():
    N, M = list(map(int, input().split()))

    L = [0] * M
    R = [0] * M
    for i in range(M):
        L[i], R[i] = list(map(int, input().split()))

    ans = (int(min(R)) - int(max(L)) + 1)
    if ans < 0:
        print('0')
    else:
        print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 42476
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const int INF=100000000;

int main(){
	ll d,n,ans=0,count=0;
	cin>>d>>n;
	if(d==0){
		for(int i=1;;i++){
			if(i%100!=0){
				count++;
			}
			if(count==n){
				ans=i;
				break;
			}
		}
	}
	else if(d==1){
		for(int i=1;;i++){
			ll k=i,count2=0;
			while(k%100==0){
				k/=100;
				count2++;
			}
			if(count2==1)count++;
			if(count==n){
				ans=i;
				break;
			}
		}
	}
	else{
		for(int i=1;;i++){
			ll k=i,count2=0;
			while(k%100==0){
				k/=100;
				count2++;
			}
			if(count2==2)count++;
			if(count==n){
				ans=i;
				break;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
typedef long long ll;
using namespace std;
int main()
{
  int a, b, c, d;
  cin >> a >> b >> c >>d;
  cout << min(a,b ) + min(c , d)<< endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define fi first
#define se second
#define INF 1000000009
#define LLINF 1000000000000000009LL
using ll = long long;

int main(){
  int n;
  cin>>n;
  ll ans=0;
  for(int i=1;i<=n;i++){
    if(i%3!=0&&i%5!=0)ans+=i;
  }
  cout<<ans<<endl;
  return(0);
}


Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <unordered_set>
#include <unordered_map>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
static const int INF = 1000010000;
static const int MOD = 1000000007;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define pb push_back
#define mp make_pair
#define np next_permutation
#define pq priority_queue

//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};

struct edge {
	int u, v;
	ll cost;
};

bool comp(const edge& e1, const edge& e2) {
	return e1.cost < e2.cost;
}

#define N 100010

int par[N];
int urank[N];

void init(int n) {
	REP(i, n) {
		par[i] = i;
		urank[i] = 0;
	}
}

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

void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y) return;

	if (urank[x] < urank[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (urank[x] == urank[y]) urank[x]++;
	}
}

bool same(int x, int y) {
	return find(x) == find(y);
}

edge es[N];

bool used[N];
int V, E;

ll kruskal() {
	sort(es, es + E, comp);
	init(V);
	ll res = 0;
	REP(i, E) {
		edge e = es[i];
		if (!same(e.u, e.v) && !used[e.u] && !used[e.v]) {
			unite(e.u, e.v);
			res += e.cost;
			used[e.u] = used[e.v] = true;
		}
	}
	return res;
}

int main() {
	string s;
	cin >> s;
	cout << "ABC" + s << endl;
}


Measured memory_bytes: 256
N = gets.to_i
as = []
bs = []
N.times {
  a,b = gets.split.map &:to_i
  as << a; bs << b
}
cs = (0...N).to_a.sort_by{ |i| as[i] + bs[i] }.reverse
aa = 0
bb = 0
(0...N).each{ |i|
  if i%2 == 0
    aa += as[cs[i]]
  else
    bb += bs[cs[i]]
  end
}
p aa - bb


Measured memory_bytes: 7432
macro_rules !input {(source =$s :expr ,$($r :tt ) *) =>{let mut iter =$s .split_whitespace () ;let mut next =||{iter .next () .unwrap () } ;input_inner !{next ,$($r ) *} } ;($($r :tt ) *) =>{let stdin =std ::io ::stdin () ;let mut bytes =std ::io ::Read ::bytes (std ::io ::BufReader ::new (stdin .lock () ) ) ;let mut next =move ||->String {bytes .by_ref () .map (|r |r .unwrap () as char ) .skip_while (|c |c .is_whitespace () ) .take_while (|c |!c .is_whitespace () ) .collect () } ;input_inner !{next ,$($r ) *} } ;}
macro_rules !input_inner {($next :expr ) =>{} ;($next :expr ,) =>{} ;($next :expr ,$var :ident :$t :tt $($r :tt ) *) =>{let $var =read_value !($next ,$t ) ;input_inner !{$next $($r ) *} } ;}
macro_rules !read_value {($next :expr ,($($t :tt ) ,*) ) =>{($(read_value !($next ,$t ) ) ,*) } ;($next :expr ,[$t :tt ;$len :expr ] ) =>{(0 ..$len ) .map (|_ |read_value !($next ,$t ) ) .collect ::<Vec <_ >>() } ;($next :expr ,chars ) =>{read_value !($next ,String ) .chars () .collect ::<Vec <char >>() } ;($next :expr ,usize1 ) =>{read_value !($next ,usize ) -1 } ;($next :expr ,$t :ty ) =>{$next () .parse ::<$t >() .expect ("Parse error" ) } ;}

const INF: i64 = 1001001001001;

fn main() {
   input! {
      n: usize,
      h: [i64; n]
   }
   let mut dp = vec![INF; n];
   dp[0] = 0;
   dp[1] = (h[1] - h[0]).abs();
   for i in 2..n {
      let c1 = (h[i] - h[i - 1]).abs();
      let c2 = (h[i] - h[i - 2]).abs();
      dp[i] = std::cmp::min(dp[i - 1] + c1, dp[i - 2] + c2);
   }
   println!("{}", dp[n - 1]);
}


Measured memory_bytes: 6396
#include<stdio.h>

int main()
{
int a,b;

scanf("%d %d",&a,&b);
  
  if(b%2==1)
  {
  printf("No");
  }
  
  else 
  {
    if(b>=2*a && b<=4*a) printf("Yes");
    else printf("No");
  }
return 0;
}

Measured memory_bytes: 1732
/*
 *  Author :: Kattu37
 */

#include<bits/stdc++.h>
using namespace std;

#define mod 1000000007
#define PI 3.14159265358979

typedef long long ll;


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

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

	cout << a*b << "\n";



	return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
vector<int> v;
int main(){
	int t,a;
	cin>>t;
	while(cin>>t){
		if(t==0){
			cin>>a;
			v.push_back(a);
		}else if(t==1){
			cin>>a;
			cout<<v[a]<<endl;
		}else{
			v.pop_back();
		}
	}
	return 0;
}


Measured memory_bytes: 3876
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>

using namespace std;

double distance(vector<double> p1, vector<double> p2)
{
    double ret = 0;
    for (int i = 0; i < 2; i++)
    {
        ret += (p1[i] - p2[i]) * (p1[i] - p2[i]);
    }
    return sqrt(ret);
}

int main(int argc, char const *argv[])
{
    int n;
    cin >> n;
    vector<vector<double>> points(n);

    for (int i = 0; i < n; i++)
    {
        vector<double> point(2);
        cin >> point[0];
        cin >> point[1];

        points[i] = point;
    }

    double avg = 0.0;
    int num_route = 0;
    vector<int> v(n);
    iota(v.begin(), v.end(), 0);
    do
    {
        double total_dist = 0;

        for (int i = 0; i < n - 1; i++)
        {
            total_dist += distance(points[v[i]], points[v[i + 1]]);
        }

        num_route++;
        avg+= total_dist;
    } while (next_permutation(v.begin(), v.end()));

    avg = avg / (double)num_route;

    printf("%.15lf\n",avg);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
typedef long long ll;
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n,ans=0,ansn=0;
  ll h,hp=0;
  cin>>n;
  rep(i,n){
    cin>>h;
    if(hp<h){
      if(ans<ansn){
        ans=ansn;
      }
      ansn=0;
      hp=h;
    }
    else{
      ansn++;
      hp=h;
    }
  }
  if(ans<ansn){
    ans=ansn;
  }
  cout<<ans<<endl;
  return 0;
}


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

const int MAXN = 200005;

int t, n, ki, li, ri;

int main(){
	scanf("%d", &t);
	while(t--){
		scanf("%d", &n);
		
		long long res = 0;
		int m = 0;
		
		vector < pair <int, int> > vx, vy;
		
		for(int i = 0; i < n; i++){
			scanf("%d %d %d", &ki, &li, &ri);
			
			if(li == ri)res += li;
			else if(li > ri){
				m++;
				res += ri;
				vx.push_back(make_pair(ki - 1, li - ri));
			}else{
				res += li;
				vy.push_back(make_pair(ki, ri - li));
			}
		}
		sort(vx.rbegin(), vx.rend());
		sort(vy.begin(), vy.end());
		
		multiset <int> s;
		for(int i = m - 1, j = 0; i >= 0; i--){
			while(j < (int)vx.size() && vx[j].first >= i){
				s.insert(vx[j].second);
				j++;
			}
			
			if(!s.empty()){
				res += *prev(s.end());
				s.erase(prev(s.end()));
			}
		}
		
		s.clear();
		for(int i = m, j = 0; i < n; i++){
			while(j < (int)vy.size() && vy[j].first <= i){
				s.insert(vy[j].second);
				j++;
			}
			
			if(!s.empty()){
				res += *prev(s.end());
				s.erase(prev(s.end()));
			}
		}
		printf("%lld\n", res);
	}
	return 0;
}


Measured memory_bytes: 9212
n = int(input())
s = list(input())
alp = list('ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ')

for i in range(len(s)):
    for j in range(26):
        if s[i] == alp[j]:
            s[i] = alp[j+n]
            break

print(''.join(s))

Measured memory_bytes: 9152
#include <stdio.h>
#include <string.h>
#define LEN 100005
#define min(a,b) (((a) < (b)) ? (a) : (b))

typedef struct pp{
  char name[100];
  int t;
}p;

p Q[LEN];
int head, tail, n;

void enqueue(p);
p dequeue();

int main(){
  int elaps = 0, c;
  int i, q;
  p u;
  scanf("%d %d", &n, &q);
  for(i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }
  head = 1; tail = n + 1;

  while(head != tail){
    u = dequeue();
    c = min(q, u.t);
    u.t -= c;
    elaps += c;
    if(u.t > 0){
      enqueue(u);
    }
    else{
      printf("%s %d\n", u.name, elaps);
    }
  }
  
  
  return 0;
}

void enqueue(p x){
  Q[tail] = x;
  tail = (tail + 1) % LEN;
}

p dequeue(){
  p x = Q[head];
  head = (head + 1) % LEN;
  return x;
}



Measured memory_bytes: 11852
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

ll div_a(ll a){
    if(a % 2 == 1){
        return 0;
    }else{
        return (div_a(a / 2)) + 1;
    }
}

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

    ll a[n];
    ll ans = 0;

    for(int i = 0; i < n; i++){
        cin >> a[i];
        if(a[i] % 2 == 0){
            ans += div_a(a[i]);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 384
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    int n = Integer.parseInt(sc.next());
    pw.println(n <= 999 ? "ABC" : "ABD");
  }
}


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

#include <math.h>
#include <stdlib.h>


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

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

//INT_MAX	2,147,483,647 = 2*1.0e9

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    ll X, Y;
    cin >> X >> Y;

    int ans = 1;
    ll num = X;
    while(num*2 <= Y){
        num*=2;
        ans++;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        int h = scan.nextInt();
        int n = scan.nextInt();
        int[] a = new int[n];
        int b = 0;
        for(int i = 0; i < n; i++){
            a[i] = scan.nextInt();
            b = b + a[i];
        }
        if(h > b){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }
    }
}

Measured memory_bytes: 48512
# https://atcoder.jp/contests/abc135/tasks/abc135_c

N = int(input())
A_list = list(map(int, input().split()))
B_list = list(map(int, input().split()))

count_defeat = 0

for i, b in enumerate(B_list):
    if A_list[i] >= b:
        count_defeat += b

    else:
        count_defeat += A_list[i]
        remain_b = (b - A_list[i])

        if remain_b > A_list[i + 1]:
            count_defeat += A_list[i + 1]
            A_list[i + 1] = 0

        else:
            count_defeat += remain_b
            A_list[i + 1] -= remain_b

print(count_defeat)


Measured memory_bytes: 18476
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl
using P = pair<int, int>;

int main() {
   int n, m; cin >> n >> m;
   vector<ll> h(n);
   rep(i, n){
      cin >> h.at(i);
   }

   vector<vector<int>> g(n);
   rep(i, m){
      int x, y;
      cin >> x >> y;
      x--; y--;
      g.at(x).push_back(y);
      g.at(y).push_back(x);
   }

   int cnt = 0;
   rep(i, n){
      bool ok = true;
      for(auto a:g.at(i)){
         if(h.at(i)>h.at(a)) continue;
         else{
            ok = false;
            break;
         }
      }
      if(ok){
         cnt++;
      }
   }

   cout << cnt << endl;
   return 0;
}


Measured memory_bytes: 9068
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define bit(k) (1LL<<(k))
typedef long long ll;

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

const int INF = 1e9;
const ll INFLL = 1e18;
const ll MOD = 1e9+7;
const double PI = acos(-1.0);

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

/*------------------------------------/
for library*/

/*------------------------------------*/
char c[111][111];
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int A,B;
    cin>>A>>B;
    rep(i,50)rep(j,100)c[i][j]    = '.';
    rep(i,50)rep(j,100)c[i+50][j] = '#';
    int cntb = 1;
    rep(i,50)rep(j,100){
        if(cntb == B){
            i = j = INF;
            continue;
        }
        if(i % 2 == 0 && j % 2 == 0){
            c[i][j] = '#';
            cntb++;
        }
    }
    int cntw = 1;
    rep(i,50)rep(j,100){
        if(cntw == A){
            i = j = INF;
            continue;
        }
        if((i+50) % 2 == 1 && j % 2 == 0){
            c[i+50][j] = '.';
            cntw++;
        }
    }
    cout<<100<<" "<<100<<endl;
    rep(i,100){
        rep(j,100){
            cout<<c[i][j];
        }
        cout<<endl;
    }
}

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

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

int main(){
   int i,n,a[200000],l[400000],r[400000],top,bot;
   long ans;
    
   scanf("%d",&n);
   for (i=0;i<n;i++) scanf("%d",&a[i]);
   qsort(a,n,sizeof(int),asc);
   l[0]=r[1]=a[0];
   l[1]=r[0]=a[1];
   top=0;bot=2;
   ans=a[0];
   for (i=2;i<n;i++) {
      if (l[top]<r[top]) ans+=l[top];
      else               ans+=r[top];
      l[bot]=l[top];r[bot]=a[i];
      bot++;
      l[bot]=a[i];r[bot]=r[top];
      bot++;
      top++;
   }
   printf("%ld\n",ans);
   return 0;
}


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

#define pb push_back
#define mp make_pair
#define taskname "A"

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef pair<ll,int> ii;
typedef tree <int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

const int maxn = 1e6 + 5;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    if(fopen(taskname".INP","r")){
		freopen(taskname".INP", "r",stdin);
		freopen(taskname".OUT", "w",stdout);
    }
    int a , b;cin >> a >> b;
    for(int i = 1 ; i < maxn ; ++i){
        int tmp = (ld)0.08 * i;
        int tmp1 = (ld)0.1 * i;
        if(tmp == a && tmp1 == b)return cout << i , 0;
    }
    cout << -1;
}




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

 using namespace std;

 int main() {
   int N;
   cin >> N;
   int Ntmp = N;

   int digit = 1;
   for (int i = 1;; i++) {
     if (Ntmp / 10 == 0) break;
     else {
       Ntmp /= 10;
       digit++;
     }
   }

   int ans;

   if (digit == 1) ans = N;
   else if (digit == 2) ans = 9;
   else if (digit == 3) ans = N -90;
   else if (digit == 4) ans = 909;
   else if (digit == 5) ans = N - 9090;
   else if (digit == 6) ans = 90909;

   cout << ans << endl;
}


Measured memory_bytes: 256
N = gets.to_i
max = { val: 0, cnt: 0 }
arr = []

N.times do
  input = gets.to_i
  arr << input

  if max[:val] == input
    max[:cnt] += 1
  elsif max[:val] < input
    max[:val] = input
    max[:cnt] = 0
    max[:cnt] += 1
  end
end

if max[:cnt] > 1
  puts Array.new(arr.size, max[:val])
else
  arr2 = Array.new(arr.size, max[:val])
  index = arr.index(max[:val])
  arr2[index] = arr.sort[-2]
  puts arr2
end

Measured memory_bytes: 8496
#include <stdio.h>
int a[1000100] , g[1000] , top = 1 , cnt = 0 , n ;
void add(){
    while(g[top] * 3 + 1 < n){
        top++ ;
        g[top] = g[top - 1] * 3 + 1 ;
    }
}
void sort(int a[] , int g){
    int v , i , j ;
    for(i = g + 1 ; i <= n ; i++){
        v = a[i] ;
        j = i - g ;
        while(j >= 1 && a[j] > v){
            a[j + g] = a[j] ;
            j -= g ;
            cnt++ ;
        }
        a[j + g] = v ;
    }
}
int main(void){
    int i ;
    scanf("%d" , &n) ;
    g[1] = 1 ;
    for(i = 1 ; i <= n ; i++){
        scanf("%d" , &a[i]) ;
    }
    add() ;
    for(i = top ; i >= 1 ; i--){
        sort(a , g[i]) ;
    }
    printf("%d\n" , top) ;
    for(i = top ; i >=1 ; i--){
        printf("%d " , g[i]) ;
    }
    printf("\n") ;
    printf("%d\n" , cnt) ;
    for(i = 1 ; i <= n ; i++){
        printf("%d\n" , a[i]) ;
    }
    return 0 ;
    
}


Measured memory_bytes: 5644
#include<iostream>
using namespace std;
int main(){
  int A_val = 0;
  int B_val = 0;
  int AB_val = 0;
  int A_num = 0;
  int B_num = 0;
  cin >> A_val >> B_val >> AB_val >> A_num >> B_num;
  int result = -1;
  int current_A_num = 0;
  int current_B_num = 0;
  int current_AB_num = 0;
  int AB_num = 2*max(A_num, B_num);
  
  for(int i=0; i<=AB_num; i++){
    current_AB_num = i;
    current_A_num = A_num - current_AB_num/2;
    if(current_A_num < 0) current_A_num = 0;
    current_B_num = B_num - current_AB_num/2;
    if(current_B_num < 0) current_B_num = 0;
    if(result < 0) result = current_A_num * A_val + current_B_num * B_val + current_AB_num * AB_val;
    result = min(result, current_A_num * A_val + current_B_num * B_val + current_AB_num * AB_val);    
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func main() {
	r := bufio.NewReader(os.Stdin)
	var n int
	var s string
	fmt.Fscan(r, &n)
	fmt.Fscan(r, &s)

	var ans []string
	opCount := 0
	for i := 0; i < n; i++ {
		if s[i] == '(' {
			ans = append(ans, "(")
			opCount++
		} else {
			if opCount > 0 {
				// 直前の ( に対応する場合
				opCount--
			} else {
				// 直前に対応する ( が存在しない場合、先頭に ( を挿入
				ans = append([]string{"("}, ans...)
			}
			ans = append(ans, ")")
		}
	}

	for opCount > 0 {
		ans = append(ans, ")")
		opCount--
	}

	fmt.Println(strings.Join(ans, ""))
}

// Utility
func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}


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

int main() {
	long long n;
	cin >> n;
	vector<long long> A(n), B(n), C(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++) {
		cin >> C[i];
	}
	sort(A.begin(), A.end());
	sort(B.begin(), B.end());
	sort(C.begin(), C.end());
	long long b[n]; fill(b, b+n, 0);
	long long c[n]; fill(c, c+n, 0);
	for (int i = 0, j = 0; i < n; i++) {
		while (j < n && A[j] < B[i]) j++;
		b[i] = j;
	}
	for (int i = 1; i < n; i++) {
		b[i] += b[i-1];
	}
	for (int i = 0, j = 0; i < n; i++) {
		while (j < n && B[j] < C[i]) j++;
		if (j == 0) {c[i] = 0; continue;}
		c[i] = b[j-1];
	}
	long long ans = 0;
	for (int i = 0; i < n; i++) ans += c[i];
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 7224
#include<bits/stdc++.h>
using namespace std;
int main()
{
    vector<int>v;
    int n;
    cin>>n;
    for(int i=0; i<n; i++)
    {
        int x;
        cin>>x;
        v.push_back(x);
    }
    double sum=0;
    for(int i=0; i<n; i++)
    {
        sum+=1/(double)v[i];
    }
    printf("%.10lf\n",1/sum);
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdio.h>
	int main(void)
{
	int x, y, temp;
	while(1){
		scanf("%d %d", &x, &y);
		if(x > y){
			temp = x;
			x = y;
			y = temp;
		}else if(x == 0 && y == 0){
			break;
		}
		printf("%d %d\n", x, y);
	}
	return 0;
}

Measured memory_bytes: 600
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
int main() {
  int n;
  cin >> n;
  map<int, int> mp;
  int ans = n;
  for(int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    mp[tmp]++;
  }
  int cnt = 0;
  for(auto &p : mp) {
    cnt += p.second - 1;
  }
  if(cnt % 2 != 0) {
    cnt++;
  }
  ans -= cnt;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 8072
import math

x = int(input())
ans = 0

if x == 1 or x == 2 or x == 3:
	print(1)
else:
	for i in range(2, int(math.sqrt(x)) + 1):
		j = 2
		while i ** j <= x:
			if i ** j > ans:
				ans = i ** j
			j += 1

	print(ans)

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

using Pair = System.Collections.Generic.KeyValuePair<int, int>;

class Program
{
	public Program() { }

	static void Main(string[] args)
	{
		new Program().prog();
	}
	Scanner cin;
	const int MOD = 1000000007;
	const int INF = int.MaxValue;
	const double EPS = 1e-7;
	
	void prog()
	{
		cin = new Scanner();

		int a = cin.nextInt();
		int b = cin.nextInt();
		if (a > b) Console.WriteLine("a > b");
		else if (a < b) Console.WriteLine("a < b");
		else Console.WriteLine("a == b");
	}
}

class Scanner
{
	string[] s;
	int i;

	char[] cs = new char[] { ' ' };

	public Scanner()
	{
		s = new string[0];
		i = 0;
	}

	public string next()
	{
		if (i < s.Length) return s[i++];
		string st = Console.ReadLine();
		while (st == "") st = Console.ReadLine();
		s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
		i = 0;
		return next();
	}

	public int nextInt()
	{
		return int.Parse(next());
	}

	public long nextLong()
	{
		return long.Parse(next());
	}

	public double nextDouble()
	{
		return double.Parse(next());
	}
}

Measured memory_bytes: 8932
#include <iostream>
#include <cassert>

int count(const std::string& N, int pos, int k) {
  if (k == 0) {
    return 1;
  }
  int n = N.size() - pos;
  if (n < k) {
    return 0;
  }
  int head = N[pos] - '0';
  if (n == 1) {
    return head;
  }
  int combination1 = 0;
  int combination2 = 0;
  int combination3 = 0;
  if (head > 0) {
    combination1 = head - 1;
    if (k == 2) {
      combination1 *= (n - 1) * 9;
    } else if (k == 3) {
      combination1 *= (n - 1) * (n - 2) / 2 * 9 * 9;
    }
    combination2 = (n - 1) * 9;
    if (k >= 2) {
      combination2 = combination2 * (n - 2) / 2 * 9;
    }
    if (k >= 3) {
      combination2 = combination2 * (n - 3) / 3 * 9;
    }
    combination3 = count(N, pos + 1, k - 1);
  } else {
    combination3 = count(N, pos + 1, k);
  }
  return combination1 + combination2 + combination3;
}

int main() {
  std::string N;
  int k;
  std::cin >> N;
  std::cin >> k;
  std::cout << count(N, 0, k) << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
#define rep(i,a) for(int i=lst[a];i;i=nxt[i])
using namespace std;

int read() {
	char ch;
	for(ch=getchar();ch<'0'||ch>'9';ch=getchar());
	int x=ch-'0';
	for(ch=getchar();ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	return x;
}

const int N=205,M=N*N<<1,inf=0x7fffffff;

int t[M],f[M],nxt[M],lst[N],l;

void add(int x,int y,int z) {
	t[++l]=y;f[l]=z;nxt[l]=lst[x];lst[x]=l;
	t[++l]=x;f[l]=0;nxt[l]=lst[y];lst[y]=l;
}

int n,m,a[N][N],b[N][N],c[N][N];
bool used[N][N];

int P(int x) {return (x-1)/m+1;}

int S,T,dis[N],q[N];

bool bfs() {
	fo(i,S,T) dis[i]=-1;dis[S]=0;
	int i=0,j=1;q[1]=S;
	while (i<j) 
		rep(k,q[++i])
			if (f[k]&&dis[t[k]]==-1) {
				dis[t[k]]=dis[q[i]]+1;
				q[++j]=t[k];
			}
	return dis[T]!=-1;
}

int dinic(int x,int y) {
	if (x==T) return y;
	int now=0;
	rep(i,x)
		if (f[i]&&dis[t[i]]==dis[x]+1) {
			int k=dinic(t[i],min(y,f[i]));
			y-=k;now+=k;f[i]-=k;f[i^1]+=k;
			if (!y) break;
		}
	if (!now) dis[x]=-1;
	return now;
}

int main() {
	n=read();m=read();
	fo(i,1,n) fo(j,1,m) a[i][j]=read();
	S=0;T=n<<1|1;
	fo(w,1,m) {
		l=1;fo(i,S,T) lst[i]=0;
		fo(i,1,n)
			fo(j,1,m)
				if (!used[i][j]) 
					add(i,n+P(a[i][j]),1);
		fo(i,1,n) add(S,i,1);
		fo(i,1,n) add(i+n,T,1);
		while (bfs()) dinic(S,inf);
		int p=2;
		fo(i,1,n)
			fo(j,1,m)
				if (!used[i][j]) {
					if (!f[p]) {
						used[i][j]=1;
						b[i][w]=a[i][j];
					}
					p+=2;
				}
	}
	fo(i,1,n) {
		fo(j,1,m) printf("%d ",b[i][j]);
		puts("");
	}
	fo(j,1,m) fo(i,1,n) c[P(b[i][j])][j]=b[i][j];
	fo(i,1,n) {
		fo(j,1,m) printf("%d ",c[i][j]);
		puts("");
	}
	return 0;
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
int main(){
    while(1){
        string s;
        cin>>s;
        if(s=="-")break;
        int m;
        cin>>m;
        for(int i=0;i<m;i++){
            string tmp=s;
            s="";
            int h;
            cin>>h;
    
            for(int j=h;j<(int)tmp.size();j++){
                s+=tmp[j];
            }   
            for(int j=0;j<h;j++){
                s+=tmp[j];
            }
        }
        cout<<s<<endl;
    }
}


Measured memory_bytes: 3180
#include<iostream>
using namespace std;
const int NMAX=(int) 1e5+1; 

int main(){
    int N;
    cin >> N;
    int A;
    int AN[NMAX]={};
    int even, odd, ans;

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

    even=0;
    odd=0;
    for(int i=0; i<NMAX; i++){
        if( AN[i]>0 && AN[i]%2==0 ){
            even++;
        }else if( AN[i]>0 ){
            odd++;
        }
    }

    if( even%2==1 ){
        ans=even+odd-1;
    }else{
        ans=even+odd;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
template<class T> inline bool chmin(T&a, T b){if(a > b){a = b; return true;}else{return false;}}
template<class T> inline bool chmax(T&a, T b){if(a < b){a = b; return true;}else{return false;}}
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1.0)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int d, score;
vector<int> c(26);
vector<vector<int>> s(400, vector<int>(26)), pos(26);

int get_score(vector<int> t){
    vector<int> cnt(26, 0);
    int ans = 0;
    rep(i, d){
        int l = i + 1 - cnt[t[i]];
        ans -= (l * (l-1) / 2) * c[t[i]];
        ans += s[i][t[i]];
        cnt[t[i]] = i+1;
    }
    rep(i, 26){
        int l = d + 1- cnt[i];
        ans -= (l * (l-1) / 2)* c[i];
    }
    return ans;
}

int main() {
    cin >> d;
    rep(i, 26)cin >> c[i];
    rep(i, d)rep(j, 26)cin >> s[i][j];
    //-----code------// 
    vector<int> t(d, 0);
    rep(i, d){
        int ma = 0;
        rep(j, 26)ma = max(ma, s[i][j]);
        rep(j, 26)if(ma == s[i][j])t[i] = j;
    }
    score = get_score(t);
    clock_t now = clock();
    while(now < 1950000){
        int D = rand() % d, q = rand() % 26;
        int old = t[D], olds = get_score(t);
        t[D] = q;
        if(get_score(t) < olds)t[D] = old;
        now = clock();
    }
    rep(i, d)cout << t[i]+1 << endl;
}


Measured memory_bytes: 3728
import java.util.*;

class Main {
  public static void main (String[] args) {
    Scanner scanner = new Scanner(System.in);
    String out = "";
    while (scanner.hasNext()) {
      String line = scanner.nextLine();
      boolean isAtIn = false;
      int cnt = 0;
      String str = "";
      for (int ii = 0; ii < line.length(); ii++) {
        char c = line.charAt(ii);
        if (c == '@') {
          isAtIn = true;
          continue;
        }
        if (isAtIn) {
          cnt = c - '0';
          isAtIn = false;
          continue;
        }
        str += c;
        if (cnt != 0) {
          cnt--;
          for (int jj = 0; jj < cnt; jj++) {
            str += c;
          }
          cnt = 0;
        }
      }
      out += str + "\n";
    }
    System.out.print(out);
  }
}

Measured memory_bytes: 17152
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7; //1000000007で割った余りを聞かれたら使う
int main()
{
	int n;
	string s;
	cin >> n >> s;
	map<char, ll> m;
	for (auto c : s) m[c]++;
	// for (int i = 0; i < s.size(); i++) { m[s[i]]++; } と一緒
	ll ans = 1;
	for (auto x : m)
	{
		ans *= (x.second + 1);
		ans %= MOD;
	}
	ans--; //空文字列の分の1を引く
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3736
import sys
sys.setrecursionlimit(10**8)
def line_to_int(): return int(sys.stdin.readline())
def line_to_each_int(): return map(int, sys.stdin.readline().split())
def line_to_list(): return list(map(int, sys.stdin.readline().split()))
def line_to_list_in_iteration(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
# def dp(init, i, j): return [[init]*i for i2 in range(j)]
import sys
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
from itertools import accumulate #A = [0]+list(accumulate(A))
import bisect #bisect.bisect_left(B, a), bisect.bisect_right(B,a)
from collections import Counter

n = line_to_int()
s = []
for i in range(n):
    s.append(sys.stdin.readline().strip())
# print(s)
ans = Counter(s)
print('AC x', ans['AC'])
print('WA x', ans['WA'])
print('TLE x', ans['TLE'])
print('RE x', ans['RE'])

Measured memory_bytes: 16416
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<time.h>
#include<math.h>
#include<assert.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384
int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int nHr(int a,int b){return nCr(a+b-1,b);}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;}
int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;}
int sankaku(int x){return ((1+x)*x)/2;}
void swap(int *a,int *b){int c;c=(*a);(*a)=(*b);(*b)=c;}
//小さい順
int compareInt(const void* a, const void* b){int aNum = *(int*)a;int bNum = *(int*)b;return aNum - bNum;}

long long _gcd(long long a,long long b){
    long long c;
    while(b!=0){c=a%b;a=b;b=c;}
    return a;
    
}
long long _lcm(long long a,long long b){long long c=_gcd(a,b);a/=c;return a*b;}

int main(void){
    int a,b;
    scanf("%d%d",&a,&b);
    int max1=0,max2=0,max3=0;
    max1=a+b;max2=a-b;max3=a*b;
    if(max1>max2 && max1>max3){
        printf("%d",max1);
        return 0;
    }else if(max2>max3){
        printf("%d",max2);
        return 0;
    }else{
        printf("%d",max3);
    }
}
    


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

#define ll long long
#define pp pair < ll, ll >
#define x first
#define y second

using namespace std;

string s;

void Input()
{
    ios_base::sync_with_stdio(0);       cin.tie(0);

//    freopen("abc.txt", "r", stdin);
    cin >> s;
}

void Process()
{
    if (s == "SUN") cout << 7;
    if (s == "MON") cout << 6;
    if (s == "TUE") cout << 5;
    if (s == "WED") cout << 4;
    if (s == "THU") cout << 3;
    if (s == "FRI") cout << 2;
    if (s == "SAT") cout << 1;
}

int main()
{
    Input();
    Process();
    return 0;
}


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

int main() {
  string S;
  int K;
  cin >> K >>S;
  
  if((int)(S.size()) <= K)
  {
    cout << S << endl;
  }
  else
  {
    cout << S.substr(0, K) <<"..." <<  endl;
  }

}


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

#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long
static const int MAX = 10000;
static const ll INFTY = 1e18;

struct edge {
    ll to, cost;
};

using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;
// 入力
// int H, W;
vector<vector<char>> field;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

// 深さ優先探索
vector<bool> seen;
vector<int> colors;


vector<double>  w, p;
vector<double>  q;


int main() {

  int N, R;
  cin >> N >> R;

  if(10 > N){
    R = R + (100 * (10 - N));
  }
  cout << R << endl;

}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/

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

int n;
double ans;
double p[3005];
double dp[3005][3005];

int main(){
scanf("%d",&n);
for (int i=1;i<=n;i++){
  scanf("%lf",&p[i]);
}

for (int i=1;i<=n;i++){
  if (i==1){
    dp[i][0]=1-p[i];
    dp[i][1]=p[i];
  } else {
    dp[i][0]=dp[i-1][0]*(1-p[i]);
    dp[i][i]=dp[i-1][i-1]*p[i];
  }
}

for (int j=1;j<=n;j++){
  for (int i=j+1;i<=n;i++){
    dp[i][j]=dp[i-1][j]*(1-p[i])+dp[i-1][j-1]*p[i];
  }
}

ans=0;
for (int i=0;i<=n;i++){
  if (i>n-i){
    ans+=(double) dp[n][i];
  }
}
printf("%.12f",ans);
return 0;
}


Measured memory_bytes: 68992
#include <iostream>
#include  <vector>

using namespace std;
int main(){
    int x1, x2, y1, y2;
    int x3, y3, x4, y4;

    cin >> x1 >> y1 >> x2 >> y2;

    int dx = x2 - x1;
    int dy = y2 - y1;

    x3 = x2 - dy;
    y3 = y2 + dx;
    x4 = x1 - dy;
    y4 = y1 + dx;

    cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
const long long INF=1LL<<60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
int main(){
int n;
  cin>>n;
long long h[100001];
  rep(i,n) cin>>h[i];
long long dp[100010];
  rep(i,100010) dp[i]=INF;
  dp[0]=0;
for(int i=1;i<n;i++){
	chmin(dp[i],dp[i-1]+abs(h[i]-h[i-1]));
	if(i>1) chmin(dp[i],dp[i-2]+abs(h[i]-h[i-2]));
} 
  cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 5084