akhauriyash/Code-Regression huggingface dataset:
from itertools import permutations
n = int(raw_input())
l1 = raw_input()
l2 = raw_input()
l = []
nLong = [str(i) for i in range(1,n+1)]
pList = permutations(''.join(nLong))
for p in pList: 
	l.append(' '.join(p))
l1 = l.index(l1)
l2 = l.index(l2)
print(abs(l1-l2))

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

namespace myApp
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] arr = Console.ReadLine().Split(' ');
            int[] num = new int[n];
            for(int i = 0; i < n ; i++)
                num[i] = int.Parse(arr[i]);
            int alice = 0;
            int bob = 0;
            
            for(int i = 1; i <= n ; i++)
            {
                int card = 0;
                int index = 0;
                for(int j = 0; j < num.Count() ; j++)
                {
                    if( card < num[j] )
                    {
                        card = num[j];
                        index = j;
                    }
                }
                if( i % 2 == 0 )
                    bob += card;
                else
                    alice += card;
                
                int newcount = num.Count() - 1;
                if( newcount > 0 )
                {
                    int[] newcards = new int[newcount];
                    int k = 0;
                    for(int j = 0 ; j < num.Count() ; j++)
                    {
                        if( j != index)
                            newcards[k++] = num[j];
                    }
                    num = newcards;
                }
            }
            Console.WriteLine(alice - bob);
        }
    }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;

    int arr[n];

    for(int i=0; i<n; i++)
    {
        cin >> arr[i];
    }

    int count1 = 1;

    for(int i=0; i<n-1; i++)
    {
        if(arr[i] > arr[i+1])
        {
            count1++;
        }

        else
        {
            arr[i+1] = arr[i];
        }
    }

    cout << count1;




    return 0;
}


Measured memory_bytes: 4388
import itertools

N,C =map(int,input().split())
D = [0]+[[0]+list(map(int,input().split())) for i in range(C)]
c = [list(map(int,input().split())) for i in range(N)]
 
grid = [[],[],[]]
for i in range(N):
  for j in range(N):
    grid[(i+j)%3].append(c[i][j])

s = [[0]*(C+1) for i in range(3)]
 
for i in range(3):
  for j in range(1,C+1,1):
    for k in range(len(grid[i])):
      s[i][j]+=D[grid[i][k]][j]

ans = float("inf")
for p in itertools.permutations(list(range(1,C+1)),3):
  tmp = 0
  for i in range(3):
     tmp +=s[i][p[i]]
  ans = min(tmp,ans)

print(ans)

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

#define REP(i, n) for(decltype(n) i = 0; i < n; i++)

#define ALL(c)   c.begin(), c.end()
#define SORT(c)  std::sort(ALL(c))
#define RSORT(c) std::sort(ALL(c), std::greater<decltype(c)::value_type>())

using namespace std;
using ll = long long;

const int MOD  = (int)1e9 + 7;
const int INF  = (int)1e9 + 1;
const ll  LINF = (ll)1e18 + 1;

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

    int N;
    std::cin >> N;

    double T, A;
    std::cin >> T >> A;

    int ans = 0;
    double min_diff = INF;
    REP(i, N) {
        int H;
        std::cin >> H;
        if(abs(A - (T - H * 0.006)) < min_diff) {
            min_diff = abs(A - (T - H * 0.006));
            ans = i + 1;
        }
    }

    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			long x = scanner.nextLong(), k = scanner.nextLong(), d = scanner.nextLong();
			if (x < 0) {
				x = -x;
			}
			if (k < (x / d)) {
				System.out.println(x - k * d);
			} else {
				k -= x / d;
				if (0 == (k & 1)) {
					System.out.println(x - (x / d) * d);
				} else {
					System.out.println(Math.abs(x - (x / d) * d - d));
				}
			}
		}
	}
}


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

int main() {
  int w, h, n;
  cin >> w >> h >> n;

  vector<int> x(n);
  vector<int> y(n);
  vector<int> a(n);
  rep(i, n) cin >> x.at(i) >> y.at(i) >> a.at(i);

  vector<vector<int>> square(w, vector<int>(h));
  rep(i, n) {
    if (a.at(i) == 1) {
      rep (j, w) {
        rep(k, h) {
          if (j < x.at(i)) {
            square.at(j).at(k) = 1;
          }
        }
      }
    } else if (a.at(i) == 2) {
      rep (j, w) {
        rep(k, h) {
          if (j >= x.at(i)) {
            square.at(j).at(k) = 1;
          }
        }
      }
    } else if (a.at(i) == 3) {
      rep (j, w) {
        rep(k, h) {
          if (k < y.at(i)) {
            square.at(j).at(k) = 1;
          }
        }
      }
    } else {
      rep (j, w) {
        rep(k, h) {
          if (k >= y.at(i)) {
            square.at(j).at(k) = 1;
          }
        }
      }
    }
  }

  int ans = 0;
  rep (i, w) {
    rep(j, h) {
      if (square.at(i).at(j) == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
S = input()
c_odd, c_even = 0,0
# c_oddはiがoddの時1になるよーに。evenは逆。

for i in range(len(S)):
  if S[i] == '0':
    if i%2 == 0: #even
      c_even += 1
    else:
      c_odd += 1
  else:
    if i%2 == 0: #even
      c_odd += 1
    else:
      c_even += 1
      
print(min(c_odd, c_even))

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
int main(void){
    //int a,b,c;
    string a,b,c;
    cin>>a>>b>>c;
    if(a[a.length()-1]==b[0] && b[b.length()-1]==c[0]){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
	string s,t;
	cin>>s>>t;
	int sum=0;
	for(int i=0;i<s.size();i++)
	if(s[i]!=t[i])sum++;
	cout<<sum;
    return 0;
}


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

using namespace std;

int main()
{
  unsigned n;
  cin >> n;
  
  unsigned ans = 0;
  
  for (int i = 0; i < n; i++)
  {
    unsigned x;
    cin >> x;
    if (x == ans + 1)
    {
      ans++;
    }
  }
  
  if (ans == 0)
  {
    cout << -1;
  }
  else
  {
    cout << n - ans;
  }
  
  return 0;
}

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

int main(){
      int arr[3];
      int k;
      for(int i = 0;i < 3;i++)cin >> arr[i];
      cin >> k;
      int m = *max_element(arr, arr + 3);
      int n = m;
      for(int i = 0;i < k;i++)m *= 2;
      cout << arr[0] + arr[1] + arr[2] + m - n;
}

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

using namespace std;
using ll = long long;
using ld = long double;

//#define int long long
//signed main(){
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,h;
    cin >> n >> h;
    vector<pair<int,bool>> ab(2*n);
    for(int i = 0; i < n; i++) {
        cin >> ab[i*2].first >> ab[i*2+1].first;
        ab[i*2].second=false;
        ab[i*2+1].second=true;
    }
    sort(ab.rbegin(),ab.rend());

    int cnt=0;
    ll dmg=0;
    while(ab[cnt].second){
        dmg+=ab[cnt].first;
        cnt++;
        if(dmg>=h){
            cout << cnt << "\n";
            return 0;
        }
    }
    ll ta=ab[cnt].first;
    cnt += ((h-dmg+ta-1)/ta);
    cout << cnt << "\n";

    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define show(x) cout << #x << " : " << x << endl
int n, i, mx;
string s[200001];
map < string, int > mp;
int main ()
{
    cin >> n;
    for(i = 1; i <= n; i++)
    {
      cin >> s[i];
      mp[s[i]]++;
      mx = max(mx, mp[s[i]]);
    }
    for(auto it : mp)
    {
        if(it.second == mx) cout << it.first << endl;
    }
}


Measured memory_bytes: 26752
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cstring>
using namespace std;

int main(int argc, char *argv[])
{
	int n, a, b;
	cin >> n >> a >> b;

	if (n * a < b) {
		cout << n * a;
	} else {
		cout << b;
	}

	cout << endl;
	  
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
 
using namespace std;
 
struct Node{
    Node(){
        brother = parent = -1;
        height = depth = num_of_children = 0;
    }
    int parent,brother,depth,num_of_children,height;
    vector<int> children;
};
 
void calcDepth(Node nodes[],int root_id){
    for(int i = 0;i < nodes[root_id].num_of_children;i++){
        nodes[nodes[root_id].children[i]].depth = nodes[root_id].depth+1;
        calcDepth(nodes,nodes[root_id].children[i]);
    }
}
 
void calcHeight(Node nodes[],int height,int parent){
    nodes[parent].height = max(nodes[parent].height,height+1);
    if(nodes[parent].parent != -1) calcHeight(nodes,height+1,nodes[parent].parent);
}
 
int main(){
    int n,id,left_id,right_id,root_id;
    scanf("%d",&n);
    Node nodes[n];
 
    for(int i = 0; i < n; i++){
        scanf("%d %d %d",&id,&left_id,&right_id);
        if(left_id != -1){
            nodes[id].children.push_back(left_id);
            nodes[id].num_of_children++;
            nodes[left_id].parent = id;
        }
        if(right_id != -1){
            nodes[id].children.push_back(right_id);
            nodes[id].num_of_children++;
            nodes[right_id].parent = id;
        }
        if(left_id != -1 && right_id != -1){
            nodes[left_id].brother = right_id;
            nodes[right_id].brother = left_id;
        }
    }
 
    for(root_id = 0; root_id < n; root_id++){
        if(nodes[root_id].parent == -1) break;
    }
 
    if(n > 1){
        calcDepth(nodes,root_id);
 
        for(int i = 0; i < n; i++){
            if(nodes[i].num_of_children == 0) calcHeight(nodes,0,nodes[i].parent);
        }
    }
 
    for(int i = 0; i < n; i++){
        printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d,"
                ,i,nodes[i].parent,nodes[i].brother,nodes[i].num_of_children,nodes[i].depth,nodes[i].height);
        if(nodes[i].parent == -1){
            printf(" root\n");
        }else if(nodes[i].num_of_children == 0){
            printf(" leaf\n");
        }else{
            printf(" internal node\n");
        }
 
    }
}


Measured memory_bytes: 2744
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s,t;
  cin>>s>>t;
  sort(s.begin(),s.end());
  sort(t.begin(),t.end());
  int sz;
  bool flag=false;
  if(s.size()<t.size()) sz=s.size();
  else sz=t.size();
  for(int i=0;i<sz;i++){
    if(s[i]<t[t.size()-i-1]) { cout<<"Yes"; return 0; }
    if(s[i]>t[t.size()-i-1]) { flag=true; }
  }
  if(t.size()>s.size() && !flag) cout<<"Yes";
  else cout<<"No";
}


Measured memory_bytes: 256
import java.util.*;

class Main {
        public static void main(String args[]) {
                Scanner sc = new Scanner(System.in);
                int num = 0;
                for (int i = 0; i < 4; i++) {
                        num += sc.nextInt();
                }
                System.out.println(num / 60);
                System.out.println(num % 60);
        }
}

Measured memory_bytes: 26112
#include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <ios>
#include <iomanip>
#include <algorithm>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define REPR2(i, m, n) for (int i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<(n))
#define bit_check(bit, i) (bit>>(i)) & 1
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REP(i, a.size()) cin >> a[i];
#define INPUTP(a) REP(i, a.size()) cin >> a[i].first >> a[i].second;
#define ENDL cout << endl;
using namespace std;
using LL = long long;
using LD = long double;
using PII = pair<int, int>;
using VPII = vector<PII>;
using PLL = pair<LL, LL>;
using VPLL = vector<PLL>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VC = vector<char>;
using VS = vector<string>;
using VB = vector<bool>;
using VD = vector<double>;
const LL INF = 1e18;
const LL MOD = 1e9 + 7;

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

void END(){cout << 1 << endl; exit(0);}

bool primarity_test(auto a)
{
  /*
  素数判定。
  a が素数なら true を返す。
  */
  if (a < 2) return false;
  else if (a == 2) return true;
  else if (a % 2 == 0) return false;
  for (int i = 3; i*i <= a; i += 2) if (a % i == 0) return false;
  return true;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int x;
  cin >> x;
  REP2(i, x, 100004)
  {
    if (primarity_test(i))
    {
      cout << i << endl;
      break;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <functional>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <string>
#include <vector>
#include <array>
#include <memory>
#include <set>

using namespace std;

#define Get(ty,...) ty __VA_ARGS__;cins(__VA_ARGS__);
#define GetArray(ty,v,n) vector<ty> v(n);cin_arr(v,n);
#define ci cin
#define co cout
#define en endl;
#define Arr(f, arr,pred) f(arr.begin(),arr.end(),pred)
#define Arr2(f, arr) f(arr.begin(),arr.end())
#define ArrExpr(f, arr,expr) f(arr.begin(),arr.end(),[](auto x){return expr;})
#define Acc(init,arr,pred) accumulate(arr.begin(),arr.end(),init,pred)

void cins(){}

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

template<class Arr>
void cin_arr(Arr& v,int n) {
	for (int i = 0; i < n; i++)
		cin >> v[i];
}


int main() {
	Get(int, n);
	int t=-1;
	int c = 4;
	while(c--!=0) {
		int a = n % 10;
		n /= 10;
		if (t == a) {
			co << "Bad" << en;
			return 0;
		}
		t = a;
	}
	co << "Good" << en;

}




Measured memory_bytes: 256
void main()
{
    int n = readln.chomp.to!int;
    string s = readln.chomp;
    int k = readln.chomp.to!int - 1;

    foreach (x; s)
    {
        if (x == s[k]) x.write;
        else '*'.write;
    }
    writeln;
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		int a =scn.nextInt();
		int b =scn.nextInt();
		int c =scn.nextInt();
		int d =scn.nextInt();
		boolean flag=false;
		while(c>0&& a>0){
			if(!flag &&c-b<=0){
				break;
			}else{
				if(flag &&a-d<=0){
					break;
				}
			}
			if(!flag){
				c-=b;
			}else{
				a-=d;
			}
			flag=!flag;
		
			
		}
		if(!flag){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}

	}

}

Measured memory_bytes: 35756
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(a: str, b: str):
    if a == 'H':
        print(b)
    else:
        print('HD'[b == 'H'])

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    a = next(tokens)  # type: str
    b = next(tokens)  # type: str
    solve(a, b)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <stdio.h>
#define MAX 25
#define N -1
struct Node{
  int p;
  int l;
  int r;
};
struct Node T[MAX];

int n,D[MAX],H[MAX];

int setDepth(int x,int d){
  if(x==N)
    return;
  D[x]=d;
  setDepth(T[x].l,d+1);
  setDepth(T[x].r,d+1);
}

int setHeight(int x){
  int h1=0,h2=0;
  if(T[x].l!=N)
    h1=setHeight(T[x].l)+1;
  if(T[x].r!=N)
    h2=setHeight(T[x].r)+1;
  return H[x]=(h1 > h2 ? h1 : h2);
}

int getSibling(int x){
  if(T[x].p==N)
    return N;
  if(T[T[x].p].l!=x&&T[T[x].p].l!=N)
    return T[T[x].p].l;
  if(T[T[x].p].r!=x&&T[T[x].p].r!=N)
    return T[T[x].p].r;
  return N;
}

void print(int x){
  printf("node %d: ",x);
  printf("parent = %d, ",T[x].p);
  printf("sibling = %d, ",getSibling(x));
  int deg = 0;
  if(T[x].l!=N)
    deg++;
  if(T[x].r!=N)
    deg++;
  printf("degree = %d, ",deg);
  printf("depth = %d, ",D[x]);
  printf("height = %d, ",H[x]);
  if(T[x].p==N){
    printf("root\n");
  }
  else if(T[x].l==N&&T[x].r==N){
    printf("leaf\n");
  }
  else{
    printf("internal node\n");
  }
}

int main(){
  int i,v,l,r,root=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    T[i].p=N;
  }
  for(i=0;i<n;i++){
    scanf("%d%d%d",&v,&l,&r);
    T[v].l=l;
    T[v].r=r;
    if(l!=N)
      T[l].p=v;
    if(r!=N)
      T[r].p=v;
  }
  for(i=0;i<n;i++){
    if(T[i].p==N){
      root=i;
    }
  }
  setDepth(root,0);
  setHeight(root);
  for(i=0;i<n;i++){
    print(i);
  }
  return 0;
}

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

#include <stdint.h>

typedef uint8_t  u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t   s8;
typedef int16_t  s16;
typedef int32_t  s32;
typedef int64_t  s64;

const int INF = (1 << 28);
const long INFL = (1LL << 50);

template<typename T, typename U>
T Max(T arg1, U arg2) {
  T arg2T = static_cast<T>(arg2);
  if( arg1 < arg2T ) return arg2T;
  return arg1;
}

template<typename T, typename U>
T Min(T arg1, U arg2) {
  T arg2T = static_cast<T>(arg2);
  if( arg2T < arg1 ) return arg2T;
  return arg1;
}

template<typename T, u32 maxN>
class RMQ {
  static_assert(maxN == (maxN & (-maxN)), "maxN must be 2^n");
public:
  RMQ(T init_value);
  T find(u32 s, u32 t);
  void update(u32 i, T x);
private:
  T find2(u32 s, u32 t, u32 id, u32 a, u32 b);
  void update2(u32 id);  
  T data[maxN * 2];
  T init_value;
};

template<typename T, u32 maxN>
RMQ<T, maxN>::RMQ(T init_value_) {
  init_value = init_value_;
  for(u32 i = 0; i < maxN * 2; ++i) {
    data[i] = init_value;
  }
}

template<typename T, u32 maxN>
T RMQ<T, maxN>::find(u32 s, u32 t) {
  return find2(s, t + 1, 1, 0, maxN);
}

template<typename T, u32 maxN>
T RMQ<T, maxN>::find2(u32 s, u32 t, u32 id, u32 a, u32 b) {
  t = Min(t, b);
  s = Max(s, a);
  if( s == a and t == b ) return data[id];
  if( t <= a ) return init_value;
  if( b <= s ) return init_value;
  u32 m = (a + b) / 2;
  T min_left  = find2(s, t, id * 2    , a, m);
  T min_right = find2(s, t, id * 2 + 1, m, b);
  return Min(min_left, min_right);  
}

template<typename T, u32 maxN>
void RMQ<T, maxN>::update(u32 i, T x) {
  data[i + maxN] = x;
  update2((i + maxN) >> 1);
}

template<typename T, u32 maxN>
void RMQ<T, maxN>::update2(u32 id) {
  if( id == 0 ) return;
  data[id] = Min(data[id * 2], data[id * 2 + 1]);
  update2(id >> 1);
}

int main() {

  RMQ<int, 131072> rmq(0x7fffffff);

  int n, q;
  int c, x, y;

  scanf("%d %d", &n, &q);
  for(int i = 0; i < q; ++i) {
    scanf("%d %d %d", &c, &x, &y);
    if( c == 0 ) {
      rmq.update(x, y);
    }
    else {
      printf("%d\n", rmq.find(x, y));
    }
  }

  return 0;
}

Measured memory_bytes: 4248
N=int(input())
A=list(map(int, input().split()))
q=int(input())
Q=[list(map(int, input().split())) for _ in range(q)]

L=[0]*(10**5+1)
S=0
for i in range(N):
    L[A[i]]+=1
    S+=A[i]

for i in range(q):
    S+=L[Q[i][0]]*(Q[i][1]-Q[i][0])
    L[Q[i][1]]+=L[Q[i][0]]
    L[Q[i][0]]=0
    # print(L)
    print(S)

Measured memory_bytes: 96668
#include <stdio.h>
void bottom(int W);
int main(){
	int H, W;
	int i,j;
	while (1) {
		scanf("%d %d", &H, &W);
		if (H == 0 && W == 0) break;
		bottom(W);
		printf("\n");
		for (i = 0;i < H-2;i++) {
			for (j = 0;j < W;j++) {
				if (j == 0 || j == W-1) {
					printf("#");
				}else {
					printf(".");
				}
			}
			printf("\n");
		}
		bottom(W);
		printf("\n\n");
	}

	return 0;
}
void bottom(int W) {
	int i;
	for (i = 0;i < W;i++) {
		printf("#");
	}
}


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

int main(void)
{
    int N;
    cin >> N;
    vector<int> H(N);
    for (int i = 0; i < N; i++) {
        cin >> H[i];
    }
    int m = 0;
    int max_m = 0;
    for (int i = 0; i < N-1; i++) {
        if (H[i] >= H[i+1]) {
            m++;
        } else {
            max_m = max(m, max_m);
            m = 0;
        }
    }
    max_m = max(m, max_m);

    cout << max_m << endl;

    return 0;
}



Measured memory_bytes: 640
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>

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

int main(){
    ll n, k;
    cin >> n >> k;
    ll ans = 0;
    if ( k == 0 ) {
        cout << n * n << endl;
        return 0;
    }
    for ( ll i = k + 1; i <= n; ++i ) {
        int mod_group_num = n / i;
        int cntup_num = i - k;
        int rest_num = n - mod_group_num * i;
        int add_cntup_num = max(0LL, rest_num - k + 1);
        ans += cntup_num * mod_group_num + add_cntup_num;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
// And in the end, the love you take is equal to the love you make.
//                      Paul McCartney (the Beatles). The End. Abbey Road.

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

using ll = long long;

namespace _buff {

const size_t BUFF = 1e5;
char buff[BUFF], *begin = buff, *end = buff;
char getc() {
    if (begin == end) {
        begin = buff;
        end = buff + fread(buff, 1, BUFF, stdin);
    }
    return begin == end ? -1 : *begin++;
}

}

ll read() {
    using namespace _buff;
    ll ret = 0; bool pos = true; char c = getc();
    for (; (c < '0' || c > '9') && c != '-'; c = getc()) {
        assert(~c);
    }
    if (c == '-') {
        pos = false;
        c = getc();
    }
    for (; c >= '0' && c <= '9'; c = getc()) {
        ret = (ret << 3) + (ret << 1) + (c ^ 48);
    }
    return pos ? ret : -ret;
}

const size_t N = 2e5 + 5;

int n, a[N], cnt[N], vec[N], ans;
vector<int> g[N];
bool used[N];

int dfs(int v) {
    used[v] = true;
    for (int u: g[v]) {
        if (!used[u]) {
            int tmp = min(dfs(u), cnt[v]);
            cnt[v] -= tmp;
            ans += tmp;
        }
    }
    return cnt[v];
}

int main() {
    int n = read();
    generate_n(a, n, read);
    memcpy(vec, a, sizeof a);
    sort(vec, vec + n);
    int sz = unique(vec, vec + n) - vec;
    for (int i = 0; i < n; ++i) {
        ++cnt[lower_bound(vec, vec + sz, a[i]) - vec];
    }
    for (int i = 0; i < sz; ++i) {
        int x = vec[i], j = i;
        for (int k = 1; k - x <= 1e9; k <<= 1) {
            if (k - x <= x) continue;
            j = lower_bound(vec + j, vec + sz, k - x) - vec;
            if (vec[j] != k - x) continue;
            g[i].emplace_back(j);
            g[j].emplace_back(i);
        }
    }
    for (int i = 0; i < sz; ++i) {
        if (!used[i]) {
            dfs(i);
        }
    }
    for (int k = 0; k < 31; ++k) {
        int i = lower_bound(vec, vec + sz, 1 << k) - vec;
        if (vec[i] != (1 << k)) continue;
        ans += cnt[i] / 2;
    }
    printf("%d\n", ans);
    return 0;
}


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

using namespace std;

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

    size_t n, m;
    cin >> n >> m;
    vector<bool> as(n);
    vector<bool> bs(n);
    for (size_t i = 0; i < m; ++i) {
        size_t a, b;
        cin >> a >> b;
        if (a == 1) {
            as[b - 1] = true;
        } else if (b == n) {
            bs[a - 1] = true;
        }
    }
    for (size_t i = 1; i < n; ++i) {
        if (as[i] && bs[i]) {
            cout << "POSSIBLE" << endl;
            return 0;
        }
    }
    cout << "IMPOSSIBLE" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#include<assert.h>
#include<chrono>
#include<random>
#include<iostream>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
#define SZ(x) ((int)x.size())
#define VI vector<int>
using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
inline LL read()
{
	LL f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
template<typename T>inline void write(T x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
template<typename T>inline void pr1(T x){write(x);putchar(' ');}
template<typename T>inline void pr2(T x){write(x);putchar('\n');}
template<typename T>inline void chkmin(T &x,T y){x=x<y?x:y;}
template<typename T>inline void chkmax(T &x,T y){x=x>y?x:y;}
const int MAXN=2e6;
const int MAXV=13;
int bin[15];
int n,m,ans[MAXN];
struct Trie
{
	int son[MAXN][3],tot,root;
	int val[MAXN];
	bool rev[MAXN];
	void insert(int v)
	{
		int p=root;
		for(int i=0;i<=n-1;i++)
		{
			int c=v/bin[i];c%=3;
			if(!son[p][c])son[p][c]=++tot;
			p=son[p][c];
		}val[p]=v;
	}
	void down(int p)
	{
		if(!rev[p])return ;
		swap(son[p][1],son[p][2]);
		rev[son[p][0]]^=1;rev[son[p][1]]^=1;rev[son[p][2]]^=1;rev[p]=0;
	}
	void addone(int p,int dep)
	{
		if(dep==0)return ;
		down(p);int a=son[p][0],b=son[p][1],c=son[p][2];
		son[p][0]=c;son[p][1]=a;son[p][2]=b;
		addone(son[p][0],dep-1);
	}
	void getans(int p,int dep,int nowp)
	{
		if(dep==n){ans[val[p]]=nowp;return ;}
		down(p);
		getans(son[p][0],dep+1,nowp);
		getans(son[p][1],dep+1,nowp+bin[dep]);
		getans(son[p][2],dep+1,nowp+2*bin[dep]);
	}
}tr;
char ch[MAXN];
int main()
{
	#ifdef Rose
		double BeginJudgeTime=clock();
	#endif
	bin[0]=1;for(int i=1;i<15;i++)bin[i]=bin[i-1]*3;
	n=read();
	scanf("%s",ch+1);m=strlen(ch+1);
	tr.tot=tr.root=1;
	for(int i=0;i<bin[n];i++)
		tr.insert(i);
	for(int i=1;i<=m;i++)
	{
		if(ch[i]=='S')tr.rev[1]^=1;
		else tr.addone(1,n);
	}
	tr.getans(1,0,0);
	for(int i=0;i<bin[n];i++)pr1(ans[i]);
	puts("");
	#ifdef Rose
		double EndJudgeTime=clock();
		cerr<<"JudgeTime is"<<" ";
		cerr<<(EndJudgeTime-BeginJudgeTime)/CLOCKS_PER_SEC<<endl;
	#endif
	return 0;
}


Measured memory_bytes: 15380
S = gets.chomp.split("")
S.uniq!

T = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s",
     "t", "u", "v", "w", "x", "y", "z"]

flag = false
str = ""
T.each do |t|
  if S.include?(t) == false
    str = t
    flag = true
    break
  end
end

if flag
  print(str)
else
  print("None")
end

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

int main(){
	int a,b;
	cin>>a>>b;
		if(a<b){
			cout<<"a < b"<<endl;
		}else if(a>b){
			cout<<"a > b"<<endl;
		}else{
			cout<<"a == b"<<endl;
		}
	return 0;
}


Measured memory_bytes: 3068
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;

int main(void){
	int N;
	cin >> N;
	double result = 0;
	for(int cnt = 0; cnt < N; ++cnt){
		long double x;
		string u;
		cin >> x >> u;
		if (u == "JPY"){
			result += x;
		}else{
			result += x * 380000;
		}
	}
	cout << result << 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(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n, m; cin >> n >> m;
	vi sum(n + 1);
	rep(i, m){
		int l, r; cin >> l >> r; l--;
		sum[l]++;
		sum[r]--;
	}
	int ans = 0;
	rep(i, n){
		sum[i + 1] += sum[i];
		ans += sum[i] == m;
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < n; i++)
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;}

int main() {
    int k, t;
    cin >> k >> t;
    int amx = 1;
    rep(i, t) {
        int a;
        cin >> a;
        chmax(amx, a);
    }
    cout << max(2*amx - (k+1), 0) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef int sign;
typedef long long ll;
#define For(i,a,b) for(register sign i=(sign)(a);i<=(sign)(b);++i)
#define Fordown(i,a,b) for(register sign i=(sign)(a);i>=(sign)(b);--i)
const int N=300+5;
template<typename T>bool cmax(T &a,T b){return (a<b)?a=b,1:0;}
template<typename T>bool cmin(T &a,T b){return (a>b)?a=b,1:0;}
template<typename T>T read()
{
	T ans=0,f=1;
	char ch=getchar();
	while(!isdigit(ch)&&ch!='-')ch=getchar();
	if(ch=='-')f=-1,ch=getchar();
	while(isdigit(ch))ans=(ans<<3)+(ans<<1)+(ch-'0'),ch=getchar();
	return ans*f;
}
template<typename T>void write(T x,char y)
{
	if(x==0)
	{
		putchar('0'),putchar(y);
		return;
	}
	if(x<0)
	{
		putchar('-');
		x=-x;
	}
	static char wr[20];
	int top=0;
	for(;x;x/=10)wr[++top]=x%10+'0';
	while(top)putchar(wr[top--]);
	putchar(y);
}
void file()
{
#ifndef ONLINE_JUDGE
	freopen("B.in","r",stdin);
	freopen("B.out","w",stdout);
#endif
}
int n,m;
int a[N][N];
void input()
{
	n=read<int>(),m=read<int>();
	For(i,1,n)For(j,1,m)a[i][j]=read<int>();
}
int ans;
int ban[N];
int cnt[N],pos[N];
void work()
{
	For(i,1,n)pos[i]=1,cnt[a[i][1]]++;
	ans=*max_element(cnt+1,cnt+m+1);
	For(i,1,m-1)
	{
		int now=0,id=0;
		For(j,1,m)if(cmax(now,cnt[j]))id=j;
		ban[id]=1;
		For(j,1,n)if(a[j][pos[j]]==id)
		{
			cnt[id]--;
			while(ban[a[j][pos[j]]])pos[j]++;
			cnt[a[j][pos[j]]]++;
		}
		cmin(ans,*max_element(cnt+1,cnt+m+1));
	}
	write(ans,'\n');
}
int main()
{
	//file();
	input();
	work();
	return 0;
}



Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <cmath>

#define	MOD 1000000007;
#define PI 3.14159265358979323846;

using namespace std;

typedef long long ll;

int main()
{
	ll A, B, C, D, E, F;
	cin >> A >> B >> C >> D >> E >> F;

	int maxNum = 50;
	double rate = -1;
	int T = -1;
	int S = -1;

	for (int a = 0; a <= maxNum; a++)
	{
		for (int b = 0; b <= maxNum; b++)
		{
			for (int c = 0; c <= maxNum; c++)
			{
				for (int d = 0; d <= maxNum; d++)
				{
					double water = a * A * 100 + b * B * 100;
					double sugar = C * c + D * d;

					if (E*water >= sugar * 100) {
						double W = sugar + water;
						if (W != 0 && F >= W) {
							double X = 100 * sugar / W;
							if (rate < X)
							{
								rate = X;
								T = W;
								S = sugar;
							}
	/*						else if (rate == X)
							{
								cout << a << " " << b  << " " << c << " " << d << " " << X << " " << water  << " " << sugar << endl;
							}*/
						}
					}
				}
			}
		}
	}
	cout << T << " " << S << endl;
	return 0;
}

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

@jit
def solve(k,n,a):
    for _ in range(k):
        Y = [0]*(n+1)
        for i, x in enumerate(a):
            Y[max(0, i-x)] += 1
            Y[min(n, i+x+1)] -= 1
        for j in range(1, n):
            Y[j] += Y[j-1]
        if a == Y[:-1]:
            break
        a = Y[:-1]
    return a

ans=solve(K,N,A)
print(*ans)

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

using namespace std;

int main(){
	//freopen("input.in","r",stdin);
	//freopen("output.in","w",stdout);
	ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
	int i,j,n,k;
	string s,t;
	cin>>s>>t;
	int m(t.size()),cnt(0);
	for(i=0;i<=s.size()-t.size();i++){
		for(j=0,cnt=0;j<t.size();j++){
			if(t[j]!=s[i+j]){
				cnt++;
			}
		}
		if(cnt<m)m=cnt;
	}
	cout<<m;








	return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef double db;
ll n,k;
int main(){
	cin>>n>>k;
	if(n>=k){
		n%=k;
	}
	printf("%lld\n",min(n,k-n));
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

const ll mod=1e9+7;
const ll inf=1e16;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define all(x) x.begin(),x.end()
#define gll greater<ll>()


 
void solve(){
 string s,t;
  cin >> s >> t;
  
 cout << (t.substr(0,s.size())==s?"Yes":"No") << endl;
}

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


Measured memory_bytes: 3592
import java.util.*;

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

 int area = x * y;
 int length = 2 * (x + y);

 System.out.println(area + " " + length);

}

}


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

using namespace std;

int n, tmp, ec;
map<int, int> dat;

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  cin>>n;
  for(int i=0; i<n; i++){
    cin>>tmp;
    dat[tmp]++;
  }
  for(auto it : dat){
    if(it.second%2==0)
      ec++;
  }
  int ans = dat.size();
  if(ec%2==1)
    ans--;
  cout<<ans<<"\n";
  return 0;
}


Measured memory_bytes: 4992
# coding: utf-8

import sys
import math
import collections
import itertools
from inspect import currentframe
INF = 10 ** 10
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def MI() : return map(int, input().split())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def chkprint(*args) : names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}; print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))

X = I()

for i in range(X):
    if i * 100 <= X and X <= i * 105:
        print(1)
        break
else:
    print(0)


Measured memory_bytes: 43504
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <algorithm> // sort
#include <unistd.h>
#include <map>
#include <set> 

#define pii pair<int,int>
#define REP(i, n) for (long long i = 0; i < (n); i++) 
using namespace std;


typedef long long ll;
static const ll INF = 1000000000000000000LL;
static const ll MOD = 1000000007;

int main()
{
    ll h,w;
    cin >> h >> w;

    ll res = (h * w + 1) / 2;

    if(h == 1 || w == 1) res = 1;

    cout << res << endl;


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    int n;
    cin >> n;
    double a[n];
    rep(i,n)cin >> a[i];
    sort(a,a+n);

    srep(i,1,n){
        a[i] = (a[i] + a[i-1]) /2;
    }


    cout << a[n-1] << endl;
    return 0;
}
 
 


Measured memory_bytes: 256
#include <iostream>

using namespace std ;

int main()
{
int a,b,c,d;
cin>>a>>b>>c>>d;
int x;
if(a>b)
    x=b;
else x=a;
int y;
if(c>d)
    y=d;
else y=c;
cout<<x+y;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#define REP(i, a, n) for(int i = a; i <= n; i++)
#define SIZE_N 101
#define SIZE_M 210001
#define INF 100000000
using namespace std;


int N, M, a[SIZE_M], b[SIZE_M], c[SIZE_M];
int d[SIZE_N][SIZE_N], e[SIZE_N][SIZE_N];
int f[SIZE_M];
int ans;

int main(void) {
  cin >> N >> M;
  REP(i, 1, M) cin >> a[i] >> b[i] >> c[i];

  REP(i, 1, N) REP(j, 1, N) {
    d[i][j] = INF;
    e[i][j] = INF;
  }
  REP(i, 1, N) d[i][i] = 0;
  REP(i, 1, M) {
    d[a[i]][b[i]] = d[b[i]][a[i]] = c[i];
    e[a[i]][b[i]] = i;
    e[b[i]][a[i]] = i;
  }

  REP(k, 1, N) REP(i, 1, N) REP(j, 1, N)
    if(d[i][j] > d[i][k] + d[k][j])
      d[i][j] = d[i][k] + d[k][j];

  REP(i, 1, N) f[i] = 0;
  REP(k, 1, N) REP(i, 1, N) REP(j, 1, N) {
    if(i == j || i == k || j == k) continue;
    if(d[i][j] == d[i][k] + d[k][j]) f[k] = 1;
  }

  REP(i, 1, M) f[i] = 1;
  REP(k, 1, N) REP(i, 1, N) REP(j, 1, N) {
    if(i == j || k == i || k == j) continue;
    if(e[i][k] != INF && d[i][k] == c[e[i][k]]) f[e[i][k]] = 0;
    if(e[k][j] != INF && d[k][j] == c[e[k][j]]) f[e[k][j]] = 0;
  }
  ans = 0;
  REP(i, 1, M) if(f[i] == 1) ans++;

  cout << ans << endl;

  return 0;
}


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

int main() {
	int N;
	string S;
	cin >>N >>S;
	if (1 == N%2) {
		cout << "No" << endl;
		return 0;

	}
	for (int n = 0;n < N/2;++n) {
		if (S[n] != S[n+N/2]) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 3568
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n,k;
    String s;
    n=sc.nextInt();
    k=sc.nextInt();
    sc.nextLine();
    s=sc.nextLine();
    char[] c = s.toCharArray();
    c[k-1] = Character.toLowerCase(c[k-1]);
	System.out.println(String.valueOf(c));
    
  }
}


Measured memory_bytes: 19540
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <functional>
#include <stack>
#include <utility>
#include <map>
#include <queue>
#include <set>
#include <array>
#include <climits>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const ll MOD = 10e9 + 7;
const ll INF = LLONG_MAX;
const ll MAX_V = 10e3;
const double EPS = 10e-6;
const double PI = 3.14159265359;

//int dx[] = { 0,1,0,-1 }, dy[] = { 1,0,-1,0 };
//int d[] = {0,1,0,-1};
//int nx = x + d[i];
//int ny = y + d[(i+1)%4]

int main() {
	int n, a[200000];
	cin >> n;
	for (int i = 0; i < n; i++)cin >> a[i];
	for (int i = n - 1; i >= 0; i-=2) {
		cout << a[i] << " ";
	}
	for (int i = n % 2; i < n; i += 2) {
		if(i+2<n)cout << a[i] << " ";
		else cout << a[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,k;
  cin>>n>>k;
  int a;
  for(int i=0;i<n;i++)
    cin>>a;
  int cnt=0;
  int j=k;
  cnt=1;
  while(j<n){
  	j--;
    j+=k;
    cnt++;
  }
  cout<<cnt;
}

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

#define ll   long long int
#define PI 3.14159265358979
#define zig ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

using namespace std;

string a, b, c;

void c_turn(string& q, char turn)
{
    if(q.empty())
    {
        cout<<(char)(turn-32);
        return;
    }
    else
    {
        turn=q[0];
        q.erase(0, 1);
        if(turn=='a')
            c_turn(a, turn);
        else if(turn=='b')
            c_turn(b, turn);
        else
            c_turn(c, turn);
    }
    return;

}

int main()
{
    zig
    char turn='a';
    cin>>a>>b>>c;
    c_turn(a, turn);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define reg register
#define ll long long
using namespace std;
const int MAXN = 2e5 + 10;
const int MAXM = 8010;
const int mod = 1e9 + 7;
int n, a[MAXN], b[MAXN], fac[MAXM], inv[MAXM], dp[MAXM / 2 + 10][MAXM / 2 + 10], total = MAXM / 4 + 2;
int fastpow(int a, int b) {
  int ret = 1;
  while(b) {
    if(b & 1) ret = 1ll * ret * a % mod;
    b >>= 1, a = 1ll * a * a % mod;
  }
  return ret;
}
int getc(int n, int m) {
  return 1ll * fac[n] * inv[m] % mod * inv[n - m] % mod;
}
inline void work() {
  fac[1] = inv[1] = 1;
  for(reg int i = 2; i <= MAXM - 10; ++i) fac[i] = 1ll * fac[i - 1] * i % mod, inv[i] = 1ll * (mod - mod / i) * inv[mod % i] % mod;
  for(reg int i = 2; i <= MAXM - 10; ++i) inv[i] = 1ll * inv[i] * inv[i - 1] % mod;
  scanf("%d", &n);
  for(reg int i = 1; i <= n; ++i) scanf("%d%d", &a[i], &b[i]), ++dp[total - a[i]][total - b[i]];
  for(reg int i = 1; i <= MAXM / 2; ++i) for(reg int j = 1; j <= MAXM / 2; ++j) dp[i][j] = (dp[i][j] + (dp[i][j - 1] + dp[i - 1][j]) % mod) % mod;
  int ans = 0;
  for(reg int i = 1; i <= n; ++i) ans = (ans + dp[a[i] + total][b[i] + total]) % mod, ans = (ans - getc(a[i] * 2 + b[i] * 2, a[i] * 2) + mod) % mod;
  printf("%d\n", 1ll * ans * fastpow(2, mod - 2) % mod);
}
int main() {
  int _ = 1;
  // scanf("%d", &_);
  while(_--) work();
  return 0;
}


Measured memory_bytes: 64768
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] dp = new int[n+1][3];
        for (int i = 1; i <= n; i++) {
            int a = sc.nextInt();
            dp[i][0] = gcd(a, dp[i-1][0]);
            if(i == 1) dp[i][1] = a;
            else if (i == 2){
                if(dp[i-1][1] < a){
                    dp[i][1] = a;
                    dp[i][2] = dp[i-1][1];
                }else{
                    dp[i][1] = dp[i-1][1];
                    dp[i][2] = a;
                }
            }else{
                int[] tmp = new int[3];
                tmp[0] = dp[i-1][0];
                tmp[1] = gcd(a, dp[i-1][1]);
                tmp[2] = gcd(a, dp[i-1][2]);
                Arrays.sort(tmp);
                dp[i][1] = tmp[2];
                dp[i][2] = tmp[1];
            }
        }
        System.out.println(dp[n][1]);
        sc.close();

    }

    public static int gcd(int a, int b) {
        if (a < b)
            return gcd(b, a);
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

}


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

using namespace std;

using ll = long long;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

int main () {
  cin.tie(0);
  cout << fixed << setprecision(10);
  int n, m; cin >> n >> m;
  int mal = 1, mar = n;
  for(int i=0;i<m;++i) {
    int l, r; cin >> l >> r;
    mal = max(mal, l);
    mar = min(mar, r);
  }
  cout << max(0, mar - mal + 1) << endl;
  
}


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

int check(void);
char a[1001],b[1001];
int c[1001][1001];
int main(){
  int q,i,j;

  scanf("%d",&q);

  for(i=0;i<q;i++){
    scanf("%s",a);
    scanf("%s",b);

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

    /*   for(j=0;j<1001;j++) a[j]='\0';
    for(j=0;j<1001;j++) b[j]='\0';

    for(j=0;j<100;j++)printf("%c",a[j]);
    */ }
  
  return 0;
}

int check(){
  int m,n,i,j,max=0;
  m=strlen(a);
  n=strlen(b);


  for(i=1;i<=m;i++){
    c[i][0]=0;
  }
  for(j=1;j<=n;j++){
    c[0][j]=0;
  }

  for(i=1;i<=m;i++){
    for(j=1;j<=n;j++){
      if(a[i-1]==b[j-1]){
	c[i][j]=c[i-1][j-1]+1;
      }else if(c[i-1][j]>=c[i][j-1]){
	c[i][j]=c[i-1][j];
      }else{
	c[i][j]=c[i][j-1];
      }

      if(max>c[i][j])max=max;
      else max=c[i][j];

    }
  }
  
  return max;
}

Measured memory_bytes: 4516
$K=<>;$L=<>=~$";
$d=($x=abs$`)+($y=abs$');
$f=$x<$y and$x^=$y^=$x^=$y;
$K%2-$d%2<0&&exit!print-1;
$d-$K and$v=$K<($t=$K*($L+=1&$d-$K*($L+=~-$d/$K|0||1))-$d>>1)&&$t+0-($t=$K),$a=$K-$t,map{$x[@x]=$a;$y[@y]=-$t;$a+=$q-=$-=($q=$x+$v-$a)-$K;$t-=$K-$q}2..$L;
$y[@y]=$y;
$,=$/;
print$L,map{$t=shift@y;$f and($_,$t)=($t,$_);$_*=$`<=>.1,$t*=$'<=>.1}@x,$x

Measured memory_bytes: 26456
w = [x+1 for x in range(input())]
for x in range(input()):
    a, b = map(int, raw_input().split(","))
    tempor = w[a-1]
    w[a-1] = w[b-1]
    w[b-1] = tempor
for x in range(len(w)):
    print w[x]

Measured memory_bytes: 4216