akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9

typedef long long ll;

using namespace std;

const ll inf = 1e18;
const ll mod = 1e9+7;
const int N = 1e5+5;

int main()

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

    int n, cnt = 0;

    cin >> n;

    for (int i = 1; i <= n; i++) {

        if (i%2) cnt++;
    }

    double ans = (double)cnt/(double)n;

    cout << fixed << setprecision(8) << ans;

    return 0;
}


Measured memory_bytes: 256
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18) + 1;
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
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; }
ll n;
map<int,int>m;
vector<vector<pair<int,int>> >g(100000);
vector<vector<pair<int,int>> >vsp(100000);
void makeg(int k){
    for(int i=0;i<vsp[k].size();i++){
        g[k].push_back(make_pair(vsp[k][i].second,i+1));
        makeg(vsp[k][i].second);
    }
}
int dfs(int k,int count){
    int ans=count;
    for(int i=0;i<g[k].size();i++){
        chmax(ans,dfs(g[k][i].first,count+g[k][i].second));
    }
    return ans;
}
vector<int> dp(100000,-1);
vector<vector<int> > vs(100000);
int dfs1(int k){
    if(dp[k]!=-1)return dp[k];
    if(vs[k].size()==0){
        dp[k]=0;
        return 0;
    }
    vector<int>v;
    for(int i=0;i<vs[k].size();i++){
        v.push_back(dfs1(vs[k][i]));
    }
    sort(ALL(v));
    int ans=0;
    for(int i=0;i<v.size();i++){
        chmax(ans,v[v.size()-1-i]+i);
    }
    dp[k]=ans+1;
    return dp[k];
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    for (int i = 1; i < n; i++)
    {
        int temp;
        cin >> temp;
        temp--;
        vs[temp].push_back(i);//tempにiが倒される
        m[temp]++;
    }
    /*
    for(int i=0;i<n;i++){
        for(int j=0;j<vs[i].size();j++){
            vsp[i].push_back(make_pair(-m[vs[i][j]],vs[i][j]));
        }
    }
    for(int i=0;i<n;i++){
        if(vsp[i].size()!=0)
        sort(ALL(vsp[i]));
    }
    */
    dfs1(0);
    //makeg(0);
    //debug(dp);
    cout << dp[0] << "\n";
}


Measured memory_bytes: 26496
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        int n = sc.nextInt();
        int c = sc.nextInt();
        int[] cl = new int[c];
        int[][] channel = new int[c][100001];
        for(int i = 0; i < n; i++){
            int s = sc.nextInt();
            int t = sc.nextInt();
            int cc = sc.nextInt()-1;
            for(int j = s; j <= t; j++){
                channel[cc][j] = 1;
            }
        }
        int ans = 0;
        for(int i = 0; i < 100001; i++){
            int tmp = 0;
            for(int j = 0; j < c; j++){
                tmp += channel[j][i];
            }
            ans = Math.max(ans,tmp);
        }
        pw.println(ans);
        pw.flush();
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}


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

int main(){

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

cout << ans << endl;


}


Measured memory_bytes: 3872
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}




struct TopologicalSort{
  Int n;
  vector<set<Int> > G;
  vector<bool> used;
  vector<Int> indeg,p;
  
  TopologicalSort(){}
  TopologicalSort(Int sz):n(sz),G(n),used(n),indeg(n),p(0){}

  void add_edge(Int s,Int t){
    G[s].insert(t);
  }
  
  void bfs(Int s){
    queue<Int> q;
    q.push(s);
    used[s]=1;
    while(!q.empty()){
      Int v=q.front();q.pop();
      p.push_back(v);
      for(Int u:G[v]){
        indeg[u]--;
        if(indeg[u]==0&&!used[u]){
          used[u]=1;
          q.push(u);
        }
      }
    }
  }
  
  vector<Int>  build(){
    fill(used.begin(),used.end(),0);
    fill(indeg.begin(),indeg.end(),0);
    
    for(Int i=0;i<n;i++)
      for(Int v:G[i]) indeg[v]++;
    
    for(Int i=0;i<n;i++)
      if(indeg[i]==0&&!used[i]) bfs(i);
    
    return p;
  }
};

//INSERT ABOVE HERE
signed main(){
  Int n,m;
  cin>>n>>m;
  TopologicalSort ts(n);
  for(Int i=0;i<m;i++){
    Int x,y;
    cin>>x>>y;
    x--;y--;
    ts.add_edge(x,y);
  }
  auto p=ts.build();
  reverse(p.begin(),p.end());
  vector<Int> dp(n,0);
  for(Int v:p)
    for(Int u:ts.G[v])
      chmax(dp[v],dp[u]+1);
    
  cout<<*max_element(dp.begin(),dp.end())<<endl;
  return 0;
}


Measured memory_bytes: 12920
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	const decimal eps=(decimal)1e-14;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.Ia;
		if(Abs(Sqrt(s[2])-Sqrt(s[0])-Sqrt(s[1]))<eps){
			Console.WriteLine("No");
			return;
		}
		Console.WriteLine("{0}",Sqrt(s[0])+Sqrt(s[1])<Sqrt(s[2])?"Yes":"No");
	}
	public static decimal Sqrt(decimal x,decimal epsilon=0.0M){
		if(x<0){return 0;}
		decimal current=(decimal)Math.Sqrt((double)x),previous;
		do{
			previous=current;
			if(previous==0.0M)return 0;
			current=(previous+x/previous)/2;
		}
		while(Abs(previous-current)>epsilon);
		return current;
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),double.Parse);}
	public double[] Da3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

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


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


ll divide(ll a, ll b, ll m) {
    a %= m;
    return a * modinv(b, m) % m;
}


int main() {
    const ll mod = 1e9 + 7;
    ll n, k;
    cin >> n >> k;
    ll ans = 0;
    for (ll i = k; i <= n + 1; ++i) {
        ll l = divide((i - 1) * i, 2, mod) % mod;
        ll r = divide((n - i + 1 + n), 2, mod) * i % mod;
        ans += (r - l + 1) % mod;
        ans %= mod;
    }
    ans += mod;
    cout << ans % mod << endl;
}


Measured memory_bytes: 3624
#include <iostream>
#include <string>

int main() {
    std::string str;
    signed char last_letter = -1;

    while (std::cin >> str) {
        if (last_letter != -1) {
            auto first_letter = str.front();
            if (first_letter != last_letter) {
                std::cout << "NO" << std::endl;
                return 0;
            }
        }

        last_letter = str.back();
    }

    std::cout << "YES" << std::endl;
    return 0;
}

Measured memory_bytes: 256
A,B=map(int,input().split())

def f(x):
    if x%2==0:
        if (x//2)%2==0:
            ans=x
        else:
            ans=1^x
    else:
        ans=f(x-1)^x
    return ans

ans=f(A-1)^f(B)
print(ans)

Measured memory_bytes: 9160
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;


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

    int D,N;
    cin >> D >> N;
    int S=1;
    rep(i,D) S*=100;
    if(N==100) {
        N=101;
    }
    cout << N*S << endl;
    

}


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

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
constexpr int MOD = 1000000007;
constexpr int INF = 1e18;

using namespace std;


signed main() {
  int A, B;
  cin >> A >> B;

  int cnt = 1;
  int ans = 0;
  while(cnt < B){
    ans++;
    cnt += A-1;
  }

  cout << ans << endl;

  return 0;
}

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

n,k = map(int,input().split())
h = list(map(int,input().split()))

dp = [10**10] * n
dp[0] = 0

for i in range(n):
    for j in range(1,k+1):
        if i + j < n:
            dp[i+j] = min(dp[i+j], dp[i] + abs(h[i+j] - h[i]))

print(dp[-1])


Measured memory_bytes: 52444
import java.util.Scanner;

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

        String S = sc.next();
        String T = sc.next();
        int countS = sc.nextInt();
        int countT = sc.nextInt();
        String take = sc.next();

        if (take.equals(S)) {
            countS--;
            System.out.printf("%d %d", countS, countT);
        } else if (take.equals(T)) {
            countT--;
            System.out.printf("%d %d", countS, countT);
        } else {
            // 何もしない
        }
    }
}

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

int main()
{
	string s,t;
  	cin>>s>>t;
  	s+=s;
  	if(s.find(t)!=string::npos)
  	cout<<"Yes"<<endl;
  	else
    cout<<"No"<<endl;
  	return 0;
}


Measured memory_bytes: 256
void main() {
	auto N = ri;

	auto A = readAs!(int[]).sort();
	auto B = readAs!(int[]).sort();
	auto C = readAs!(int[]).sort();
	ulong res;

	foreach(b; B) {
		auto a = A.lowerBound(b).length;
		auto c = C.upperBound(b).length;
		res += a * c;
	}
	res.writeln;
}

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

import std.stdio;
import std.string;
import std.functional;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

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

int main()
{
  int h, w;
  std::vector<std::pair<int, int>> list;
  for (;;) {
    std::cin >> h >> w;
    if(h==0&&w==0) break;
    list.push_back(std::make_pair(h, w));
  }

  for(auto e : list) {
    for(int i=0;i<e.first;i++) {
      char init_str;
      if(i%2==0) init_str='#';
      else init_str='.';
      for(int j=0;j<e.second;j++) {
        std::cout << init_str;
        if(init_str == '#') init_str = '.';
        else if(init_str == '.') init_str = '#';
      }
      std::cout << "\n";
    }
    std::cout << "\n";
  }
  return 0;
}



Measured memory_bytes: 3080
#include <stdio.h>
 
int main() {
  int N, D;
  int ans = 0;
  
  scanf("%d %d", &N, &D);
  
  for (ans = 0; N > 0; ans++) {
    N -= 2 * D + 1;
  }
  
  printf("%d", ans);
}

Measured memory_bytes: 128
#include<iostream>
#include<iomanip>
#include<cmath>
#define _USE_MATH_DEFINES

using namespace std;

int main(void){
  double r;

  cin >> r;

  cout << fixed << setprecision(6) << r * r * M_PI << " " << 2 * r * M_PI << endl;
  
  return 0;
}

Measured memory_bytes: 3236
#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector<vector<int>> mat;
//typedef unsigned int uint;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

vector<int> G[1002];
bool used[1002];
int match[1002];

bool dfs(int v)
{
	used[v] = true;
	rep(i, 0, SZ(G[v]))
	{
		int u = G[v][i], w = match[u];
		if (w < 0 || !used[w] && dfs(w))
		{
			match[v] = u;
			match[u] = v;
			return true;
		}
	}
	return false;
}

int bipartite_matching(int V)
{
	int res = 0;
	memset(match, -1, sizeof(match));
	rep(i, 0, V)
	{
		if (match[i] < 0)
		{
			memset(used, 0, sizeof(used));
			if (dfs(i))
			{
				res++;
			}
		}
	}
	return res;
}

int N;
int Ax[200],Ay[200];

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

	cin >> N;
	rep(i, 0, N)
	{
		cin >> Ax[i] >> Ay[i];
	}

	int x, y;
	rep(i, 0, N)
	{
		cin >> x >> y;
		rep(j, 0, N)
		{
			if (Ax[j] < x&&Ay[j] < y)
			{
				G[j].push_back(N + i);
				G[N + i].push_back(j);
			}
		}
	}

	cout << bipartite_matching(2 * N) << endl;

	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int a,b,k;
int main()
{
	cin>>a>>b;
	cin>>k;
	for(int i=1;i<=k;++i)
	{
		if(i&1)
		{
			if(a&1) --a;
			b+=(a>>=1);
		}
		else
		{
			if(b&1) --b;
			a+=(b>>=1);
		}
	}
	// if(k%2==0) 
		cout<<a<<' '<<b;
	// else cout<<b<<' '<<a;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100001,INF=1<<30;

int main(){
    
    int N;
    ll K;cin>>N>>K;
    vector<ll> A(N),B(N);
    for(int i=0;i<N;i++){
        cin>>A[i]>>B[i];
    }
    
    ll ans=0;
    int dig=-1;
    
    for(int i=30;i>=0;i--){
        ll sum=0;
        if(K&(1<<i)){
            if(dig==-1){
                for(int j=0;j<N;j++){
                    if(A[j]>=(1<<i)) continue;
                    if(!(A[j]&(1<<i))) sum+=B[j];
                }
                ans=max(ans,sum);
                dig=i;
            }else{
                for(int j=0;j<N;j++){
                    bool flag=true;
                    if(A[j]>=(1<<(dig+1))) flag=false;
                    for(int k=dig;k>=i+1;k--){
                        if(!(K&(1<<k))){
                            if(A[j]&(1<<k)) flag=false;
                        }
                    }
                    if(A[j]&(1<<i)) flag=false;
                    if(flag) sum+=B[j];
                }
                ans=max(ans,sum);
            }
        }
        //cout<<ans<<endl;
    }
    
    ll sum=0;
    
    for(int j=0;j<N;j++){
        bool flag=true;
        if(A[j]>K) flag=false;
        for(int k=dig;k>=0;k--){
            if(!(K&(1<<k))){
                if(A[j]&(1<<k)) flag=false;
            }
        }
        if(flag) sum+=B[j];
    }
    
    ans=max(ans,sum);
    
    cout<<ans<<endl;
    
}


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

void input(vector<int>& rvnSeq)
{
  int nSeqSiz;
  cin >> nSeqSiz;
  rvnSeq.resize(nSeqSiz);

  for (int& rnSeq : rvnSeq)
    cin >> rnSeq;
}
  
int calcLower(const vector<int>& cnrvnSeq)
{
  int nMaxSeqCnt = 0;
  int nBgn = 0;

  while (nBgn < cnrvnSeq.size() )
  {
    int nSeqCnt = 0;
    int nFoward = nBgn;

    while ( nFoward < cnrvnSeq.size() - 1  &&
            cnrvnSeq[nFoward] >= cnrvnSeq[nFoward + 1] )
    {
      nSeqCnt++;
      nFoward++;
    }
    nMaxSeqCnt = max(nMaxSeqCnt, nSeqCnt);
    nBgn = nFoward + 1;
  }
  return nMaxSeqCnt;
}
  
int main()
{
  vector<int> vnSeq;

  input(vnSeq);
  cout << calcLower(vnSeq) << endl;

  return 0;
}

Measured memory_bytes: 3740
n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)

a.unshift(0)
a.push(0)

k = 0
(n+1).times do |i|
  k += (a[i+1] - a[i]).abs
end

n.times do |i|
  p k - (a[i+1] - a[i]).abs - (a[i+2] - a[i+1]).abs + (a[i+2] - a[i]).abs
end


Measured memory_bytes: 17156
S = input()
A = [chr(ord("a")+i) for i in range(26)]

if len(set(S)) < 26:
    for a in A:
        if a not in S:
            print(S+a)
            break
else:
    X = []
    for i in range(25, 0, -1):
        if S[i] > S[i-1]:
            X.append(S[i])
            X = sorted(list(filter(lambda x: x > S[i-1], X)))
            print(S[:i-1]+X[0])
            break
        else:
            X.append(S[i])
    else:
        print(-1)

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

using namespace std;


long long fuc(long long n){
	if(n==0)
		return 1;
	else
		return n*fuc(n-1);
}

int main(){

	long long n;
	while(cin>>n)
		cout<<fuc(n)<<endl;


	return 0;
}

Measured memory_bytes: 0
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(a) begin(a),end(a)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1e+9;
const ll mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};
ll gcd(ll a, ll b){
  if (b==0) return a;
  else return gcd(b,a%b);
}
int cans(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


int fac(int num) {
  if(num==1) return 1;
  else return num*fac(num-1);
}



int main() {
  int s,w;
  cin >> s >> w;
  if(s <= w) cout << "unsafe" << endl;
  else cout << "safe" << endl;

  
  return 0;
}


Measured memory_bytes: 3132
import java.util.*;
	import java.lang.Math;
    public class Main
	{
		//int count=0;
		/*static int xor(int x,int y)
		{
			return (x | y) & (~x | ~y);
		}*/
    	public static void main(String[] args) 
		{
    		Scanner scan = new Scanner(System.in);
			int n = scan.nextInt();
			long[] a = new long[n];
			for(int i=0;i<n;i++)
			{
				a[i]=scan.nextLong();
			}
			long mod = (long) Math.pow(10,9) +7;
			
			long ans = 0;
			long base = 1;
			for (int i = 0; i <= 60; i++)
			{
				long zeroNum = 0;
				long oneNum = 0;
				for (int j = 0; j < n; j++)
				{
					long bit = ((a[j] >> i) & 1);
 
					if (bit == 0) 
						zeroNum++;
					else 
					oneNum++;
				
			}
 
			ans += (zeroNum * oneNum % mod) * (base % mod) % mod;
			ans %= mod;
			base *= 2;
		}
 
		System.out.println(ans);
 
    	}
    }

Measured memory_bytes: 99416
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,tmp,a,bsd_signal;
    int k,g;
    int r[10000];
    cin>>n;
    for(int i=0;i<n;i++) cin>>r[i];
    for(g=0;g<n;g++){
            if(g<n-1) cout<<r[g]<<' ';
            else cout<<r[g]<<endl;
        }

    for(int j=1;j<n;j++){
        a=r[j];
        for(k=j-1;k>=0;k--){
            if(a<r[k]){
                r[k+1]=r[k];
            }
            else break;
        }
        r[k+1]=a;
        for(g=0;g<n;g++){
            if(g<n-1) cout<<r[g]<<' ';
            else cout<<r[g]<<endl;
        }
    }


}


Measured memory_bytes: 3124
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#include<queue>
#include<stack>
#include<iomanip>
#include<cstring>
#include<string>
#include<set>

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

using namespace std;
using ll = long long int;

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

int main(void) {
    int n, k; cin >> n >> k;
    int sum = 0;
    REP(i, n) {
        int h; cin >> h;
        if (h >= k) sum++;
    }
    cout << sum << endl;
}

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

int main() {
    int sx, sy, tx, ty;
    std::cin >> sx >> sy >> tx >> ty;

    std::ostringstream oss;
    for (int i = 0; i < (ty - sy); ++i) {
        oss << 'U';
    }

    for (int i = 0; i < (tx - sx); ++i) {
        oss << 'R';
    }

    for (int i = 0; i < (ty - sy); ++i) {
        oss << 'D';
    }

    for (int i = 0; i < (tx - sx); ++i) {
        oss << 'L';
    }

    oss << 'L';

    for (int i = 0; i < (ty - sy) + 1; ++i) {
        oss << 'U';
    }

    for (int i = 0; i < (tx - sx) + 1; ++i) {
        oss << 'R';
    }

    oss << 'D' << 'R';

    for (int i = 0; i < (ty - sy) + 1; ++i) {
        oss << 'D';
    }

    for (int i = 0; i < (tx - sx) + 1; ++i) {
        oss << 'L';
    }

    oss << 'U';

    std::cout << oss.str() << std::endl;

    return 0;
}


Measured memory_bytes: 256
#![allow(unused_mut)]
#![allow(non_snake_case)]

//　高速 EOF要
//macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();input_inner!{iter, $($r)*}};($($r:tt)*) => {let mut s = {use std::io::Read;let mut s = String::new();std::io::stdin().read_to_string(&mut s).unwrap();s};let mut iter = s.split_whitespace();input_inner!{iter, $($r)*}};}
//macro_rules! input_inner {($iter:expr) => {};($iter:expr, ) => {};($iter:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($iter, $t);input_inner!{$iter $($r)*}};}
//macro_rules! read_value {($iter:expr, ( $($t:tt),* )) => {( $(read_value!($iter, $t)),* )};($iter:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()};($iter:expr, chars) => {read_value!($iter, String).chars().collect::<Vec<char>>()};($iter:expr, usize1) => {read_value!($iter, usize) - 1};($iter:expr, $t:ty) => {$iter.next().unwrap().parse::<$t>().expect("Parse error")};}
// 低速 EOF不要
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")};}

// https://beta.atcoder.jp/contests/abc108/tasks/abc108_a
fn main(){
    input![K:i64];
    let K:i64 = K;
    println!("{}", if K%2==1 {(K/2)*(K/2+1)} else {(K/2)*(K/2)});
}

Measured memory_bytes: 4352
import std.stdio,std.ascii,std.conv,std.string,std.algorithm,std.range,std.functional,std.math,core.bitop;

void main()
{
    auto a=readln.chomp.to!int;
    auto b=readln.chomp.to!int;
    auto h=readln.chomp.to!int;
    writeln((a+b)*(h/2));
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	
	private void doit(){
		
		Scanner sc = new Scanner(System.in);
		long mod = 1000000007;
		while(sc.hasNext()){
			
			int k = sc.nextInt();
			int s = sc.nextInt();
			int count = 0;
			for(int i = 0; i <= k; i++){
				for(int j = 0; j <= k; j++){
					int z = s - i - j;
					if(z < 0 || z > k) continue;
					count++;
				}
			}
			System.out.println(count);
		}

	}

	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().doit();
	}

}


Measured memory_bytes: 10192
#include <bits/stdc++.h>
#include <cstdio>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define VSORT(v) sort(v.begin(), v.end())
#define SORT(v, n) sort(v, v+n)
#define VREV(v) reverse(v.begin(),v.end())
#define REV(v,n) reverse(v,v+n)
#define vi vector<int>
#define pf push_front
#define pb push_back

template<class T, size_t N> size_t countof(const T (&array)[N]) { return N; }
template <class T> void chmin(T&a,const T&b) { a = min(a,b); }
template <class T> void chmax(T&a,const T&b) { a = max(a,b); }
 
void print(){cout<<"\n";}
template <class Head, class... Tail>
void print(Head&& h,Tail&&... t){ 
	if(sizeof...(t)==0)
		cout<<h;
	else
		cout<<h<<' ';
	print(move(t)...);
}

void mprint(auto *matrix,auto N){
	REP(i,N) cout<<matrix<<(i!=N-1?' ':'\n');
	return;
}

const double EPS =1e-9;
const int INF =2e+9;
const ll INFL =9e+18;
const ll MOD =1000000007;
#define PI 3.14159265258979

#define P pair<int,int>
#define Pll pair<ll,ll>
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

inline int in(){int x; cin>>x; return x;}

struct UnionFind{
	vector<int> par; //データiが属する親の番号
	vector<int> sizes; //根ノードiの木に含まれるデータの数

	// 最初は全てのデータiがグループiに存在するものとして初期化
	UnionFind(int n):par(n),sizes(n, 1){
		REP(i,n) par[i] = i;
	}

	// 根を張り替えながら再帰的に根ノードを探す
	int find(int x){
		if(x==par[x]) return x;
		return par[x]=find(par[x]);
	}

	// 2つのデータx, yが属する木をマージする
	void unite(int x, int y) {
		// データの根ノードを得る
		x = find(x);
		y = find(y);

		// 既に同じ木に属しているならマージしない
		if (x == y) return;

		// xの木がyの木より大きくなるようにする
		if (sizes[x] < sizes[y]) swap(x, y);

		// xがyの親になるように連結する
		par[y] = x;
		sizes[x] += sizes[y];
		sizes[y] = 0;  // sizes[y]は無意味な値となるため
	}

	// 2つのデータx, yが属する木が同じならtrueを返す
	bool same(int x, int y) {
		return find(x) == find(y);
	}

	// データxが含まれる木の大きさを返す
	int size(int x) {
		return sizes[find(x)];
	}
};
int gcd(int n,int m){
	if(m>n) return gcd(m,n);
	if(m==0) return n;
	else return gcd(m,n%m); 
}

int main(void){
	int N,D,X[10][10];

	cin>>N>>D;
	REP(i,N)
		REP(j,D)
			cin>>X[i][j];

	
	int result=0;
	REP(i,N){
		FOR(j,i+1,N){
			int tem=0;
			REP(r,D) tem+=pow(abs(X[i][r]-X[j][r]),2);
			REP(i,1000){
				if(pow(i,2)==tem){
					result++;
					break;
				}
			}
		}
	}

	print(result);
	return 0;
}


Measured memory_bytes: 256
function Main(input){
  var xs = input.trim().split(' ').map(v=>parseInt(v,10));
  var a = xs[0] + xs[1];
  var b = xs[0] - xs[1];
  var c = xs[0] * xs[1];
 
  console.log(Math.max(a, b, c)+0);
}
 
Main(require("fs").readFileSync("/dev/stdin","utf8"));


Measured memory_bytes: 7500
n = int(input())
v = [int(_) for _ in input().split()]
c = [int(_) for _ in input().split()]
d = [v[i] - c[i] for i in range(n)]
ans = 0
for i in range(n):
    if d[i] > 0:
        ans += d[i]
print(ans)


Measured memory_bytes: 3060
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;


int main() {
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */   
    int n;
    cin>>n;

    vector < int > a(n+1);
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }

    vector < int > ans(n+1);

    int cur=1;
    int x=1;
    for(int i=n;i>0;i-=2)
    {
        ans[cur++]=a[i];
        if(i==1)
            x=2;
    }

    for(int i=x;;i+=2)
    {
        if(cur>n)
            break;
        ans[cur++]=a[i];
    }

    for(int i=1;i<=n;i++)
        cout<<ans[i]<<" ";
    
    cout<<endl;

    return 0;
}


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2018/07/23  Problem: AOJ 0117 / Link: https://onlinejudge.u-aizu.ac.jp/challenges/search/volumes/0117  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */


int main() {

	int N, M; cin >> N >> M;
	VVI dist(N, VI(N, INF));
	FOR(i, 0, N)dist[i][i] = 0;
	FOR(i, 0, M) {
		int a, b, c, d;
		scanf("%d,%d,%d,%d,", &a, &b, &c, &d);
		a--, b--;
		dist[a][b] = min(dist[a][b], c);
		dist[b][a] = min(dist[b][a], d);
	}
	FOR(k, 0, N)FOR(i, 0, N)FOR(j, 0, N)dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
	int s, g, v, p;
	scanf("%d,%d,%d,%d,", &s, &g, &v, &p);
	s--, g--;
	LL ans = v - dist[s][g] - dist[g][s] - p;
	
	cout << ans << "\n";

	return 0;
}



Measured memory_bytes: 3180
#include<stdio.h>
#include<string.h>
int main()
{
    int n, i, j, k;
    char string[101];
 
    scanf("%d", &n);
 
    scanf(" %[^\n]", string);
    if(n%2 != 0)
    {
        printf("No\n");
        return 0;
    }
    char copy1[n], copy2[n];
    for(i=0, j=0, k=0; string[i]!='\0' ; i++)
    {
        if(i<n/2)
        {
            copy1[j] = string[i];
            j++;
        }
 
        else
        {
            copy2[k] = string[i];
            k++;
        }
 
    }
    copy1[j] = '\0';
    copy2[k] = '\0';
 
    if(strcmp(copy1,copy2) == 0)
    {
        printf("Yes\n");
    }
    else
        printf("No\n");
 
    return 0;
 
}
 

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <utility>
#include <map>
#include <vector>
#include <cstring>
#include <climits>
#include <queue>
#include <cmath>
#include <iomanip>
#include <set>
#include <bitset>

using namespace std;

typedef long long LL;
typedef pair<int, int> pii;

int x[5];
int main() {
	ios::sync_with_stdio(false);
  int ans = -1;
  for (int i = 0; i < 5; i++) {
    cin >> x[i];
    if (x[i] == 0) {
      ans = i + 1;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3580
#include <iostream>

using namespace std;

int main() {
    int a[9];
    cin >> a[0] >> a[1] >> a[2];
    cin >> a[3] >> a[4] >> a[5];
    cin >> a[6] >> a[7] >> a[8];
    int N;
    cin >> N;
    int b[N];
    for(int i = 0; i < N; i++){
        cin >> b[i];
    }
    int c[9] = {0};
    for(int i = 0; i < N; i++){
        for(int j = 0; j < 9; j++){
            if(b[i] == a[j]){
                c[j] = 1;
            }
        }
    }
    string out = "No";
    if((c[0] + c[1] + c[2] == 3) || (c[3] + c[4] + c[5] == 3) || (c[6] + c[7] + c[8] == 3) || (c[0] + c[3] + c[6] == 3) || (c[1] + c[4] + c[7] == 3) || (c[2] + c[5] + c[8] == 3) || (c[0] + c[4] + c[8] == 3) || (c[2] + c[4] + c[6] == 3)){
        out = "Yes";
    }
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

#define INFTY 1000000000

void merge(int *, int, int, int);
void mergeSort(int *, int, int);

int count=0;

int main(){
  int i, n;
  int S[500000];

  scanf("%d", &n);

  for(i=0; i<n; i++){
    scanf("%d", &S[i]);
  }

  mergeSort(S, 0, n);

  for(i=0; i<n-1; i++){
    printf("%d ", S[i]);
  }
  printf("%d\n", S[i]);
 
  printf("%d\n", count);

  return 0;
}

void merge(int *A, int left, int mid, int right){
  int i, j, k;
  int n1, n2;
  int L[mid - left + 1], R[right - mid + 1];

  n1 = mid - left;
  n2 = right - mid;

  for( i=0; i < n1; i++){
    L[i] = A[left + i];
  }

  for( i=0; i < n2; i++){
    R[i] = A[mid + i];
  }

  L[n1] = INFTY;
  R[n2] = INFTY;

  i = 0;
  j = 0;

  for( k = left; k < right; k++){
    if(L[i] <= R[j]){
      A[k] = L[i];
      i++;
    }else{
      A[k] = R[j];
      j++;
    }
    count++;
  }

}

void mergeSort(int *A, int left, int right){
  int mid;

  if(left+1 < right){
    mid = (left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }

}

Measured memory_bytes: 4504
#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;

#define FOR(i, m, n) for (int i = m; i < n; i++) // mからnまで

int main(){
    string S , SS , T ; 
    cin >> S ;
    cin >> T ;
    int s = S.length();
    int t = T.length();
    int counter = 0 ;
    int ret ;
    vector<int> V;
    
    FOR(i,0,s-t+1){
      SS = S.substr(i,t);
      FOR(j,0,t){
        if (SS[j] != T[j]) {
          counter++;
        }
     }
     V.emplace_back(counter);
     counter = 0;
    }

    ret = *min_element(V.begin(), V.end());
    cout << ret;
    return 0;
}

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

N = int(input())
L = [None] * N

for i in range(N):
    L[i] = (int(input()), i)
    
L.sort(key = lambda x:-x[0])

for i in range(N):
    if L[0][1] == i:
        print(L[1][0])
    else:
        print(L[0][0])


Measured memory_bytes: 39504
#include <stdio.h>
int main(void)
{
  int a,b,c,d,s1,s2,ans;
  scanf("%d%d%d%d",&a,&b,&c,&d);
  s1=a*b;
  s2=c*d;
  if(s1>s2)
  {
    ans=s1;
  }
  else
  {
    ans=s2;
  }
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 128
let tuple3 a b c = (a, b, c)
;;

let tuple4 a b c d = (a, b, c, d)
;;

let rec f a_list min n m list =
  if Array.length a_list == n
  then
    list
    |> List.filter_map
      (fun (a, b, c, d) -> if a_list.(b-1) - a_list.(a-1) == c then Option.some d else Option.none) 
    |> List.fold_left (+) 0
  else
    List.init (m - min + 1) ((+) min)
    |> List.map (fun min -> f (Array.append a_list [|min|]) min n m list)
    |> List.fold_left max 0
;;

let () =
  let n, m, q = Scanf.scanf "%d %d %d" tuple3 in
  let list = List.init q (fun _ -> Scanf.scanf " %d %d %d %d" tuple4) in
  let res = f [||] 1 n m list in
  Printf.printf "%d\n" res
;;

Measured memory_bytes: 5888
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n;i>=0;i--)
#define Pool(i, m, n) for(ll i=n;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(a) cout<<a<<endl
#define putout2(a,b) putout(a);putout(b)
#define putout3(a,b,c) putout(a);putout(b);putout(c)
#define putout4(a,b,c,d) putout(a);putout(b);putout(c);putout(d)
#define putout5(a,b,c,d,e) putout(a);putout(b);putout(c);putout(d);putout(e)
#define Gput(a,b) G[a].push_back(b)
#define cin1(a) cin>>a
#define cin2(a,b) cin>>a>>b
#define cin3(a,b,c) cin>>a>>b>>c
#define cin4(a,b,c,d) cin>>a>>b>>c>>d
#define cin5(a,b,c,d,e) cin>>a>>b>>c>>d>>e
#define sum(v) accumulate(all(v), 0ll)
#define gcd(x,y) __gcd(x,y)
ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
ll lcm(ll x,ll y){
  ll z=gcd(x,y);
  return x*y/z;
}
int main() {
cout << fixed << setprecision(30);
  ll n;
  cin>>n;
  vec a(n);
  loop(i,n)cin>>a[i];
  ll step=0;
  loop(i,n){
    if(a[i]==step+1)step++;
  }
  if(step>0)putout(n-step);
  else putout(-1);
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <limits.h>

int main(void) {
	int i, ix, jx, iy, jy, l, m, N, K;
	long long x[50], y[50], lx, ly, sx, sy, R, S;
	scanf("%d%d", &N, &K);
	for (i=0;i<N;i++) {
		scanf("%lld%lld", &x[i], &y[i]);
	}

	S = LLONG_MAX;
	for (ix=1;ix<N;ix++) {
		for (jx=0;jx<ix;jx++) {
			if (x[ix] < x[jx]) {
				lx = x[jx]; sx = x[ix];
			} else {
				lx = x[ix]; sx = x[jx];				
			}
			for (iy=1;iy<N;iy++) {
				for (jy=0;jy<N;jy++) {
					if (y[iy] < y[jy]) {
						ly = y[jy]; sy = y[iy];
					} else {
						ly = y[iy]; sy = y[jy];				
					}
					R = (lx-sx)*(ly-sy);
					m = 0;
					for (l=0;l<N;l++) {
						if (x[l] <= lx && x[l] >= sx && y[l] <= ly && y[l] >= sy) m++;
					}
					if (m>=K) {
						if (R<S) S = R;
					}							
				}
			}
		}
	}

	printf("%lld\n", S);
	return 0;
}

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

int main()
{
    int n, r = 0, b = 0;
    cin >> n;
    string s;
    cin >> s;
    rep(i, n)
    {
        if (s[i] == 'R')
            r++;
        else
            b++;
    }
    if (r > b)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <b; i++)
typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int,int> pi;
#define trace(x) cout<<#x<<"="<<x<<"\n";
#define sz(x) (int)(x.size())
#define mod 1000000007
#define endl "\n"
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}

#define deb(x) cerr << #x << " = " << x << endl;



int32_t main(){
    ios::sync_with_stdio(false);
    vi a(2);
    vi b(2);
    cin>>a[0]>>a[1];
    cin>>b[0]>>b[1];
    int ans = 0;
    ans=a[1]*b[1];
    ans= max(ans, a[0]*b[0]);
    ans=max(ans, a[0]*b[1]);
    ans =max(ans,a[1]*b[0]);
    cout<<ans<<"\n";

    return 0;
}

Measured memory_bytes: 3644
import numpy as np
import sys

n, m, c = map(int, input().split())
b = np.array([int(x) for x in input().split()])
ans = 0
for _ in range(n):
	a = np.array([int(x) for x in input().split()])
	a *= b
	if np.sum(a) + c > 0:
		ans += 1
print(ans)


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

using namespace std;
typedef pair<int,int> pii;
typedef long long int ll;

#define INF 1 << 30
#define REP(i,n) for(ll i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(ll i=(k);i<(int)(n);i++)

int per[30];
string s,t;

int main(){
  cin >> s >> t;
  REP(i,30) per[i] = -1;
  REP(i,s.size()){
    if(per[s[i]-'a'] == -1) per[s[i]-'a'] = t[i] - 'a';
    if(per[s[i]-'a'] != t[i]-'a'){
      cout << "No" <<endl;
      return 0;
    }
    //cout << s[i]+'a' << " " << t[i]<<endl;
  }
  REP(i,30)FOR(j,i+1,30){
    if(per[i] == -1 || per[j] == -1) continue;
    if(per[i]==per[j]){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" <<endl;
}


Measured memory_bytes: 776
#include<iostream>
#include<vector>
#include<cmath>
#include<string>
#include<algorithm>
#include<map>
#include<utility>
#include<cstdio>
#include<bits/stdc++.h>

using namespace std;
using ll = long long;
const long long INF = 1LL<<60;

typedef pair<ll,ll> Pair;
int main(){

ll N;
ll sum = 0;

cin >> N;

vector<ll> a(N);

for(ll i = 0;i < N;++i){
    cin >> a[i];
    sum ^= a[i];
}

for(ll i = 0;i < N;++i) a[i] ^= sum;

for(ll i = 0;i < N;++i) cout << a[i] << endl;

return 0;

}


Measured memory_bytes: 4832
#include <stdio.h>
#define Max 100000

int a[Max];
int partition(int,int);


int main(){
  int n,q;
  int i;

  scanf("%d",&n);
  for(i=0; i < n; i++){
    scanf("%d",&a[i]);
  }
  q=partition(0,n-1);

  for(i=0; i < n; i++){
    if(i==q) printf("[");

      printf("%d",a[i]);

      if(i==q) printf("]");

      if(i != n-1) printf(" ");
  }
  printf("\n");

  return 0;
}

int partition(int p,int r){
  int x;
  int i,j;
  int s;

  x=a[r];
  i=p-1;
  for(j=p; j < r; j++){
    if(a[j]<= x){
      i++;
      s=a[i];
      a[i]=a[j];
      a[j]=s;
    }
  }
      s=a[i+1];
      a[i+1]=a[r];
      a[r]=s;
 
    return i+1;
  }

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

using namespace std;

int main(){
    long long int A,B,C;
    cin >> A >> B >> C;
    if(A*B*C%2==0){
        cout << "0" << endl;
    }else{
        cout << min(A*B,min(A*C,B*C)) << endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {

  long n;
  scanf("%ld", &n);
  long a[n];
  for (long i = 0; i < n; i++) {
    scanf("%ld", &a[i]);
  }
  for (long i = 0; i < n; i++) {
    if (a[i]%2 != 0) {
      printf("first\n");
      return 0;
    }
  }
  printf("second\n");

  return 0;
}

Measured memory_bytes: 896
def weather_prediction():
    today = input()
    print(tomorrow_weather_q(today))

def tomorrow_weather_q(today):
    if today == "Sunny":
        return "Cloudy"
    elif today == "Cloudy":
        return "Rainy"
    elif today == "Rainy":
        return "Sunny"
    else:
        return 0

weather_prediction()

Measured memory_bytes: 2940
#include<algorithm>
//#define DEBUG
using namespace std;

int W, H;
int S, T;
int tree[100][100];

int counttree(int x, int y){
	int r = 0;
	for(int i = x; i-x < S; i++){
			for(int j = y; j-y < T; j++){
				r += tree[i][j];
			}
	}
	#ifdef DEBUG
	cout<<"r: "<<r<<endl;
	#endif
	return r;
}

int main(){
	int N;
	while(cin>>N, N){
		cin>>W>>H;
		for(int i = 0; i < 100; i++)for(int j = 0; j < 100; j++)tree[i][j] = 0;
		for(int n = 0; n < N; n++){
			int x, y;
			cin>>x>>y;
			tree[x-1][y-1] = 1;
		}
		cin>>S>>T;
		#ifdef DEBUG
		for(int i = 0; i < W; i++){
			for(int j = 0; j <H; j++)cout<<(tree[i][j]?"*":".");
			cout<<endl;
		}
		#endif
		
		int maxtree = 0;
		for(int i = 0; i+S <= W; i++){
			for(int j = 0; j+T <= H; j++){
				maxtree = max(counttree(i,j), maxtree);
			}
		}
		cout<<maxtree<<endl;
	}
	return 0;
}

Measured memory_bytes: 0