akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>

using namespace std;

long long MOD = 1000000007;

long long gcd(long long N, long long M){
    while (true){
        if (min(N,M)==0){
            return max(N,M);
        }else if (N>M){
            N%=M;
        }else{
            M%=N;
        }
    }
}

long long lcm(long long N, long long M){
    return N*M/gcd(N,M);
}

int main(){
    long long N, M;
    cin >> N >> M;
    vector<long long> A(N,0);
    cin >> A[0];
    long long tmp=A[0];
    long long fact=1;
    while(tmp%2==0){
        tmp/=2;
        fact*=2;
    }
    if(fact==1){
        cout << 0 << endl;
        return 0;
    }

    long long lcm_=A[0];
    for(int i=1; i<N; i++){
        cin >> A[i];
        if(A[i]%fact!=0 || (A[i]/fact)%2==0){
            cout << 0 << endl;
            return 0;
        }
        lcm_=lcm(lcm_, A[i]);
        if(lcm_>MOD){
            cout << 0 << endl;
            return 0;
        }
    }

    cout << 2*M/lcm_-M/lcm_ << endl;


}

Measured memory_bytes: 1024
# -*- coding: utf-8 -*-

import sys

def mCn(m, n):
    ret = 1
    for i in xrange(n):
        ret *= m - i
        ret /= i + 1
    return ret

#for line in ["35"]:
for line in sys.stdin.readlines():
    List = map(int, line.strip().split())

    n = List[0]

    ans = 0
    for i in xrange(10000):
        a = i / 1000; i %= 1000
        b = i / 100 ; i %= 100
        c = i / 10  ; i %= 10
        d = i
        if(a + b + c + d == n):
            ans += 1

    print ans

Measured memory_bytes: 4216
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[][] bingoBoard = new int[3][3];
        int[][] markedBoard = new int[3][3];

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                bingoBoard[i][j] = sc.nextInt();
            }
        }

        int n = sc.nextInt();
        int[] b = new int[n];

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

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                for (int k = 0; k < n; k++) {
                    if (bingoBoard[i][j] == b[k]) {
                        markedBoard[i][j] = 1;
                    }
                }
            }
        }

        if (markedBoard[0][0] + markedBoard[0][1] + markedBoard[0][2] == 3) {
            System.out.println("Yes");
        }

        else if (markedBoard[1][0] + markedBoard[1][1] + markedBoard[1][2] == 3) {
            System.out.println("Yes");
        }

        else if (markedBoard[2][0] + markedBoard[2][1] + markedBoard[2][2] == 3) {
            System.out.println("Yes");
        }

        else if (markedBoard[0][0] + markedBoard[1][0] + markedBoard[2][0] == 3) {
            System.out.println("Yes");
        }

        else if (markedBoard[0][1] + markedBoard[1][1] + markedBoard[2][1] == 3) {
            System.out.println("Yes");
        }

        else if (markedBoard[0][2] + markedBoard[1][2] + markedBoard[2][2] == 3) {
            System.out.println("Yes");
        }

        else if (markedBoard[0][0] + markedBoard[1][1] + markedBoard[2][2] == 3) {
            System.out.println("Yes");
        }

        else if (markedBoard[0][2] + markedBoard[1][1] + markedBoard[0][2] == 3) {
            System.out.println("Yes");
        }

        else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 23252
#include <iostream>
    #include <vector>
    #include <string>
     
    int main() {
      
      std::string inputString;
      std::cin >> inputString;
      
      std::vector<char> charVec;
      
      for (char &c : inputString) {
        if (c == '0' || c == '1') {
          charVec.push_back(c);
        } else {
          if (charVec.size() == 0) {
            continue;
          } else {
            charVec.pop_back();
          }
        }
      }
     
      for (char &d : charVec) {
        std::cout << d;
      }
     
     
      return 0;
    }

Measured memory_bytes: 256
H, W = map(int, input().split())
S = [input() for _ in range(H)]
T = []

for s in S:
    if '#' not in s:
        continue
    T.append(s)

S = []
for t in list(zip(*T)):
    if '#' not in t:
        continue
    S.append(t)
    
for s in list(zip(*S)):
    print(''.join(map(str, s)))

Measured memory_bytes: 3188
#include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
    int n,m,c;
    int b[21];
    int a[21][21];
    cin >>n>>m>>c;
    for(int i=0;i<m;++i)cin >> b[i];
    int cnt =0;
    for(int j=0;j<n;++j){
        int x = 0;
        for(int i=0;i<m;++i){
            cin >>a[j][i];
            x += a[j][i]*b[i];
        }
        if(x+c>0)++cnt;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
 
 
 
int main(){
   
    string s;
    cin >> s;
    string a;

    for (int i = 0; i < s.size(); i++){
      if (i % 2 == 0){
        a = a + s[i];
      }
    }

    cout << a << endl;
  }
 


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define len(arr) (int)(sizeof(arr)/sizeof((arr)[0]))
#define Sort(arr) sort(arr,arr+len(arr))
#define For(i,s,n) for(int i=s;i<n;i++)	
#define Rep(i,n) for(int i=0;i<n;i++)
#define Per(i,n) for(int i=n;i>=0;i--)
#define All(x) (x).begin(),(x).end()
#define in(arr,n) Rep(i,n) cin >> arr[i];
#define in2(arr1,arr2,n) Rep(i,n) cin >> arr1[i] >> arr2[i];
#define in3(arr1,arr2,arr3,n) Rep(i,n) cin >> arr1[i] >> arr2[i] >> arr3[i];
#define LL_MAX 9223372036854775807
#define LL_MIN -9223372036854775808
#define MOD 1000000007
#define MOD9 1000000009

//{ ライブラリ

// 標準出力の高速化
#define endl "\n"

// 出力
template<typename Type>
void print(Type a[],int n){
	Rep(i,n) cout << a[i] << endl;
}
template<typename Type1,typename Type2>
void print(Type1 a[],Type2 b[],int n){
	Rep(i,n) cout << a[i] << " " << b[i] << endl;
}
template<typename Type1,typename Type2,typename Type3>
void print(Type1 a[],Type2 b[],Type3 c[],int n){
	Rep(i,n) cout << a[i] << " " << b[i] << " " << c[i] << endl;
}

// 配列の最大値
template<typename Type>
Type max(Type a[],int n){
	Type ret=a[0];
	For(i,1,n) ret=max(ret,a[i]);
	return ret;
}

// 配列の最小値
template<typename Type>
Type min(Type a[],int n){
	Type ret=a[0];
	For(i,1,n) ret=min(ret,a[i]);
	return ret;
}

// 最大公約数
template<typename Type>
Type gcd(Type a,Type b){return(b==0)?a:gcd(b,a%b);}
template<typename Type>
Type gcd(Type a[],int n){
	Type ret=a[0];
	For(i,1,n) ret=gcd(ret,a[i]);
	return ret;
}

// 最小公倍数
template<typename Type>
Type lcm(Type a,Type b){return (a/gcd(a,b))*b;}
template<typename Type>
Type lcm(Type a[],int n){
	Type ret=a[0];
	For(i,1,n) ret=lcm(ret,a[i]);
	return ret;
}

// aを元にしてペアでソート
template<typename Type1,typename Type2>
void PairSort(Type1 a[],Type2 b[],int left,int right){
	int i=left,j=right;
	Type1 p=a[(left+right)/2];
	while(true){
		while(a[i]<p) i++;
		while(p<a[j]) j--;
		if(i>=j) break;
		swap(a[i],a[j]);
		swap(b[i],b[j]);
		i++;j--;
	}
	if(left<i-1) PairSort(a,b,left,i-1);
	if(j+1<right) PairSort(a,b,j+1,right);
}
template<typename Type1,typename Type2,typename Type3>
void PairSort(Type1 a[],Type2 b[],Type3 c[],int left,int right){
	int i=left,j=right;
	Type1 p=a[(left+right)/2];
	while(true){
		while(a[i]<p) i++;
		while(p<a[j]) j--;
		if(i>=j) break;
		swap(a[i],a[j]);
		swap(b[i],b[j]);
		swap(c[i],c[j]);
		i++;j--;
	}
	if(left<i-1) PairSort(a,b,c,left,i-1);
	if(j+1<right) PairSort(a,b,c,j+1,right);
}

// 配列を逆順にする
template<typename Type>
void Reverse(Type a[],int n){Rep(i,n/2) swap(a[i],a[n-i-1]);}

// 文字列を逆順にする
// reverse(All(str));

//}

bool f(int a[],int n){
	for(int i=0;i<n-1;i++){
		if(a[i]>a[i+1]) return false;
	}
	return true;
}

int main(){
	int N;
	cin >> N;
	int A[N+1],B[N];
	in(A,N+1);
	in(B,N);
	
	ll ans=0;
	
	Rep(i,N){
		if(B[i]>A[i]){
			ans+=A[i];
			if(A[i+1]>=B[i]-A[i]){
				A[i+1]-=B[i]-A[i];
				ans+=B[i]-A[i];
			}
			else{
				ans+=A[i+1];
				A[i+1]=0;
			}
		}
		else{
			ans+=B[i];
		}
	}
	
	cout << ans;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define repr(i, n, m) for (int i = (int)(n) - 1; i >= (int)(m); i--)
using namespace std;
using ll = int64_t;
const int MOD = 1000000007; // 10^9+7

int main() {
    int K, N;
    cin >> K >> N;
    vector<int> A(N);

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

    vector<int> diff(N);
    rep(i, 0, N - 1) diff[i] = A[i + 1] - A[i];
    diff[N - 1] = K - A[N - 1] + A[0];

    sort(diff.begin(), diff.end());
    reverse(diff.begin(), diff.end());

    cout << K - diff[0] << endl;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define PA pair<int,int>
#define MA make_pair
#define ll long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define POS(i) cout<<(i?"POSSIBLE":"IMPOSSIBLE")<<endl
#define Pos(i) cout<<(i?"Possible":"Impossible")<<endl
#define co(i) cout<<i<<endl
#define fcout cout<<fixed<<setprecision(10)
using namespace std;

const int INF=1e9+7;
const int MOD=1e9+7;

struct edge{int to,cap,rev;};

const int MAX_V=1000;
vector<edge> G[MAX_V];
bool used[MAX_V];

void add_edge(int from,int to,int cap){
	G[from].push_back((edge){to,cap,G[to].size()});
	G[to].push_back((edge){from,0,G[from].size()-1});
}

int dfs(int v,int t,int f){
	if(v==t) return f;
	used[v]=true;
	FOR(i,0,G[v].size()){
		edge &e=G[v][i];
		if(!used[e.to]&&e.cap>0){
			int d=dfs(e.to,t,min(f,e.cap));
			if(d>0){
				e.cap-=d;
				G[e.to][e.rev].cap+=d;
				return d;
			}
		}
	}
	return 0;
}

int max_flow(int s,int t){
	int flow=0;
	for(;;){
		memset(used,0,sizeof(used));
		int f=dfs(s,t,INF);
		if(f==0) return flow;
		flow+=f;
	}
}

int n;

int main(){
	cin>>n;
	vector<PA> v,v2;
	FOR(i,0,n){
		int a,b;
		cin>>a>>b;
		v.PB(PA(a,b));
	}
	FOR(i,0,n){
		int c,d;
		cin>>c>>d;
		v2.PB(PA(c,d));
	}
	int s=n*2,t=s+1;
	FOR(i,0,n){
		add_edge(s,i,1);
		add_edge(n+i,t,1);
	}
	FOR(i,0,n){
		FOR(j,0,n){
			if(v[i].FI<v2[j].FI&&v[i].SE<v2[j].SE){
				add_edge(i,n+j,1);
			}
		}
	}
	co(max_flow(s,t));
}

Measured memory_bytes: 384
// https://atcoder.jp/contests/abc107/tasks/abc107_b

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DUMP(a, n) REP(_i, n) printf("%d%c", a[_i], _i + 1 == n ? '\n' : ' ')
#define DUMP2D(a, n, m) REP(_i, n) REP(_j, m) printf("%d%c", a[_i][_j], _j + 1 == m ? '\n' : ' '); puts("")

const int H_MAX = 100;
const int W_MAX = 100;

int H, W;
char a[H_MAX][W_MAX + 1];

bool rx[H_MAX];
bool cx[W_MAX];

void solve() {
  REP(i, H) REP(j, W) rx[i] = rx[i] || (a[i][j] == '#');
  REP(j, W) REP(i, H) cx[j] = cx[j] || (a[i][j] == '#');
  REP(i, H) if (rx[i]) {
    REP(j, W) if (cx[j]) {
      printf("%c", a[i][j]);
    }
    puts("");
  }
}

void input() {
  scanf("%d%d", &H, &W);
  REP(i, H) scanf("%s", a[i]);
}

int main() {
  input();
  solve();
  return 0;
}


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

#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

ll N, M;

int main() {
  cin >> N >> M;
  
  if (M/2 < N) {
    cout << M/2 << endl;
  } else {
    ll k = (M/2-N)/2;
    ll ans = 0;
    k -= 50;
    for (int i = 0; i < 100; ++i) ans = max(ans, min(N+k+i, M/2-k-i));
    cout << ans << endl;
  }
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    int mansions[4][3][10];
    int m,w,h,d;
    int n;
     
    int i,j,k;
     
    for(m = 0;m < 4;m++){
        for(h = 0;h < 3;h++){
            for(w = 0;w < 10;w++){
                mansions[m][h][w] = 0;
            }
        }
    }
     
    scanf("%d",&n);
     
    for(i = 0;i < n;i++){
        scanf("%d %d %d %d",&m,&h,&w,&d);
        if(0<m&&m<5&&0<h&&h<4&&0<w&&w<11)
            mansions[m-1][h-1][w-1] += d;
    }
     
    for(m = 0;m < 4;m++){
        for(h = 0;h < 3;h++){
            for(w = 0;w < 10;w++){
                printf(" %d",mansions[m][h][w]);
            }
            printf("\n");
        }
        if(m != 3)printf("####################\n");     
    }
    return 0;
}

Measured memory_bytes: 2708
import java.util.Scanner;
public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int n = s.length();
		sc.close();
		int res = 0;
		for(int i=0;i<n/2;i++) {
			if(s.charAt(i)!=s.charAt(n-1-i)) 
				res += 1;
		}
			System.out.println(res);
	}
		public static void main(String[] args) {
		solve();

	}

}


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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define ALL(v) (v).begin(), (v).end()
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO  cout << "NO"  << endl
#define No  cout << "No"  << endl

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    int N, K; cin >> N >> K;
    vi H(N); REP(i, N) cin >> H[i];
    sort(ALL(H), greater<>());
    ll ans = 0;
    for(int i = K; i < N; i++) ans += H[i];
    cout << ans << endl;
}
    
int main() 
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

Measured memory_bytes: 1024
import networkx as nx
n,m,*s = map(int, open(0).read().split())
 
g=nx.Graph()
g.add_nodes_from([i for i in range(1,n+1)])
for x in zip(*[iter(s)] * 2):
    g.add_edge(x[0],x[1])
di=nx.predecessor(g,source=1)
 
if len(di)!=n:
    print("No");exit()
print("Yes")
for x in range(2,n+1):
    print(di[x][0])

Measured memory_bytes: 205028
n, k = map(int, input().split())
x = n+1
y = k-1
M = x*x*(x+1)/2-x*(x+1)*(2*x+1)/6+x
m = x*y*(y+1)/2-y*(y+1)*(2*y+1)/6+y
ans = M-m
print(int(ans%(1000000007)))

Measured memory_bytes: 9196
#include <iostream>
#include <vector>
#include <numeric>
#include <string>
#include <stdio.h>
#include <set>
#include <iomanip>
using namespace std;
 
int main(){
    int N;
    cin >> N;
    string a;
    set<string> s;
    for (int i=0; i<N; i++){
        cin >> a;
        s.insert(a);
    }
    cout << s.size() << endl;
    return 0;
}

Measured memory_bytes: 19104
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <iterator>
#include <stack>
#include <string.h>
#include <cstdlib>
#include <queue>
#include <list>
#include <string>

using namespace std;

int main()
{
    int a[51];
    int n;
    
    cin >> n;
    for(int i = 1;i <= n;i++){
        cin >> a[i];
    }
    
    int check = 1;
    for (int i = 1;i <= n;i++){
        if (a[i] != i && check == 1){
            check = 0;
            int t = a[i];
            if (a[t] != i){
                check = -1;
                break;
            }
            else {
                a[i] = i;
                a[t] = t;
            }
        }
        
        else if (a[i] != i && check == 0){
            check = -1;
            break;
        }
    }
    
    if (check == -1){
        cout << "NO" << endl;
    }
    else {
        cout << "YES" << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF INT_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(ll i=0; i<n; ++i)
#define FOR(i, s, e) for(ll i=s; i<e; ++i)
#define MOD 1000000007
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if(a<b) {a=b; return true;} return false;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int A, B; cin >> A >> B;
  if(A >= 10 || B >= 10) cout << -1 << endl;
  else cout << A * B << endl;
}


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

int main(){
	int i, n, p, j;
	cin >> n;
	vector<tuple<string, int, int>> t(n);
	string s;
	for (i = 0; i < n; i++){
		cin >> s >> p;
		t[i] = make_tuple(s, 100 - p, i + 1);
	}
	sort(t.begin(), t.end());
	for (i = 0; i < n; i++) cout << get<2>(t[i]) << endl;
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=1010,p=1e9+7;
typedef long long ll;
int inc(int x,int y){x+=y;return x>=p?x-p:x;}
int dec(int x,int y){x-=y;return x<0?x+p:x;}
int mul(int x,int y){return (ll)x*y%p;}
int power(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=mul(x,x))
		if (y&1) ans=mul(ans,x);
	return ans;
}
int n,l,r,L,R,fac[N],ifac[N],dp[N][N];
//dp[i][j]表示用到第i个,和为j的方案数
int main()
{
	scanf("%d%d%d%d%d",&n,&l,&r,&L,&R);
	fac[0]=1;
	for (int i=1;i<=n;i++) fac[i]=mul(fac[i-1],i);
	ifac[n]=power(fac[n],p-2);
	for (int i=n;i;i--) ifac[i-1]=mul(ifac[i],i);
	dp[l-1][0]=fac[n];
	for (int i=l;i<=r;i++)
	for (int cnt=0,k=1;cnt<=R;cnt++,k=mul(k,ifac[i]))
	if (!cnt||cnt>=L)
	for (int j=0;i*cnt+j<=n;j++)
		dp[i][i*cnt+j]=inc(dp[i][i*cnt+j],mul(dp[i-1][j],mul(k,ifac[cnt])));
	printf("%d\n",dp[r][n]);
	return 0;
}

Measured memory_bytes: 4096
void main(){
  import std.stdio, std.string, std.conv, std.algorithm;

  string s; rd(s);

  if(s.length<4){writeln("No"); return;}
  auto t="YAKI";
  foreach(i; 0..t.length){
    if(s[i]!=t[i]){writeln("No"); return;}
  }

  writeln("Yes");
}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  foreach(i, ref e; x){
    e=l[i].to!(typeof(e));
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<map>

using namespace std;

void solve3() {
	string s;
	cin >> s;
	int k;
	cin >> k;
	
	for (int i = 0; i < s.size(); i++)
	{
		if (s[i] == 'a')
			continue;
		int index = s[i] - 'a' + 1;
		int num = 27 - index;
		if (k >= num) {
			k -= num;
			s[i] = 'a';
		}
		
	}
	
	k = k % 26;
	
	while (k > 0) {
		int n = s.size() - 1;
		if (s[n] == 'z') {
			s[n] = 'a';
		}
		else {
			s[n] = s[n] + 1;
		}
		k--;
	}
	cout << s << endl;
}

void solve2() {
	int N;
	cin >> N;
	map<int, int> m;
	for (int i = 0; i < N; i++)
	{
		int n;
		cin >> n;
		m[i+1] = n;
	}
	int ans = 0;
	for (auto it = m.begin(); it != m.end(); it++)
	{
		if ((*it).first == m[(*it).second])
			ans++;
	}
	cout << ans/2 << endl;
}

void solve1() {
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i++)
	{
		cout << s[i];
		if (i == 3)
			cout << " ";
	}
	cout << endl;
}

int main() {
	solve3();
	return 0;
}

Measured memory_bytes: 512
// Created by ...Lusifer
#include<bits/stdc++.h>
using namespace std;
 
#define pb 		push_back
#define mp 		make_pair
#define prior   priority_queue
#define MOD 	1000000007
#define INF64 	(long long)1e18
#define INF 	(int)1e9
#define PI 		3.1415926535897932384626433832795 
#define ll      long long
#define ld		long double
#define ret     return
#define NUM 	1000001
const int SIZE = 2e5+4;
void fastio(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

void solveTest(){
	string a,b;
	cin>>a>>b;
	if(a.size()>b.size()){
		cout<<"GREATER"<<endl;
	}
	else if(a.size()<b.size()){
		cout<<"LESS"<<endl;
	}
	else {
		int g=0;
		int l=0;
		int e=0;
		for(int i=0;i<a.size();i++){
			if(a[i]<b[i]){
				l=1;
				break;
			}
			else if(a[i]>b[i]){
				g=1;
				break;
			}
		}
		if(l==1){
			cout<<"LESS"<<endl;
		}
		else if(g==1) {
			cout<<"GREATER"<<endl;
		}
		else {
			cout<<"EQUAL"<<endl;
		}
	}
	return ;
}
 
int main(){
	fastio();

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

Measured memory_bytes: 256
#include<algorithm>
#include<cmath>
#include<cctype>
#include<iomanip>
#include<iostream>
#include<map>
#include <queue>
#include<string>
#include<vector>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define out(x) cout << x << endl;
#define each(e, v) for (auto&& e : v)
#define clamp(v,lo,hi) min(max(v,lo),hi)
#define debug(i) cout<<"point :"<< i << endl;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define all(a) a.begin(),a.end()
typedef long long LL;
typedef vector<int> vint;
typedef vector<long> vl;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef map<string, int> mapstri;
typedef map<int, int> mapii;
typedef std::pair<int, int> pairii;

int main () {
    double A,B;
    cin >> A >> B;
    for (int i = 0; i < 1e5; i++) {
        double a = floor(i * 0.08);
        double b = floor(i * 0.1);
        if (a == A && b == B) {
            out(i)
            return 0;
        }
    }
    out(-1)
}

Measured memory_bytes: 384
import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
		int res = 0;
		//String s = sc.next();
		int n = sc.nextInt();
		//int arr[] = new int[n];
//		for(int i=0;i<n;i++) {
//			arr[i] = sc.nextInt();
//		}
		res = n +(n*n)+(n*n*n);
		System.out.println(res);
		sc.close();

	}
}


Measured memory_bytes: 35604
#!/usr/bin/env python3
import sys


def solve(N: int, A: int, B: int, C: int, l: "List[int]"):
    def dfs(cur, a, b, c):

        if cur == N:
            return (
                abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else 10e9
            )
        ret0 = dfs(cur + 1, a, b, c)
        ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
        ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
        ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10

        return min(ret0, ret1, ret2, ret3)

    print(dfs(0, 0, 0, 0))


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    l = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A, B, C, l)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define MIN -1000000
using namespace std;
typedef long long ll;
typedef pair <int,int> pii;
ll N;
ll ans;
ll mini=1e16;
int main(void)
{
  cin >> N;
  for (int i = 0; i < 5; ++i)
    {
      ll trans;
      cin >> trans;
      mini=min(mini,trans);
    }
  ans=N/mini;
  if(N%mini!=0) ans++;
  cout << ans+4 << endl;
  
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
int main(void)
{
	int d,e,f;
	cin >> d >> e >> f;
	if(d<= f && f<=d+e)
	{
		cout << "YES" << "\n";
	}
	else {
		cout << "NO" << "\n";
	}
}


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

using namespace std;

#define ll long long
#define ld long double
#define P pair<ll, ll>

#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

#define all(v) v.begin(), v.end()

#define sortAl(v) sort(all(v))
#define sortAlr(v)          \
  sort(v.begin(), v.end()); \
  reverse(v.begin(), v.end())

#define cout(n) cout << fixed << setprecision(n)

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

template <class T>
inline void chmax(T &a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T &a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
#define INF LLONG_MAX

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

  ll a, p;
  cin >> a >> p;

  cout << ((3 * a + p) / 2) << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define max(x, y) ((x) > (y) ? (x) : (y))

int nums[100][100];

int main(){
  int row = 0,pos = 0, ans = 0, i, j;
  while(scanf("%d", &nums[row][pos]) != EOF){
    pos++;
    if(getchar() == '\n'){
      row++;
      pos = 0;
    }
  }
  row /= 2;
  row++;
  for(i = 1;i < row;i++){
    nums[i][0] += nums[i - 1][0];
    for(j = 1;j < i;j++){
      nums[i][j] += max(nums[i - 1][j - 1], nums[i - 1][j]);
    }
  }
  for(;i < row * 2 - 1;i++){
    for(j = 0;j < row;j++){
      nums[i][j] += max(nums[i - 1][j], nums[i - 1][j + 1]);
      ans = max(nums[i][j], ans);
    }
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    string s;
    cin >> s;
    int n = s.size();

    // dp[digit][smaller]
    int dp[20][2] = {};
    dp[0][1] = -INF;

    rep(i, n) {
        int ni = i+1;
        int nd = s[i] - '0';
        rep(j, 2) {
            rep(d, 10) {
                int nj = j;

                if (j == 0) {
                    if (d < nd) nj = 1;
                    if (d > nd) continue;
                }

                dp[ni][nj] = max(dp[ni][nj], dp[i][j] + d);
            }
        }
    }
    cout << max(dp[n][0], dp[n][1]) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>

using namespace std;

#define INF 1 << 29
#define LL long long int

LL const MOD = 1000000007;

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

    int a,b;
    cin >> a;
    cin >> b;

    if(a <= 8 && b <= 8){
        cout << "Yay!" << endl;
    }else{
        cout << ":(" << endl;
    }
    
    return 0;
}

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

typedef long long ll;
const ll MOD = 1e9+7;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll n;
    cin>>n;

    cout<<(n-1)*n/2LL;

    return 0;
}



Measured memory_bytes: 256
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

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

        int car;
        int[] tracks = new int[100];
        int head = 0;
        StringBuilder sb = new StringBuilder("");

        while (sc.hasNextInt()) {
            car = sc.nextInt();

            if (car == 0) {
                head--;
                sb.append(tracks[head]);
                sb.append('\n');
            } else {
                tracks[head] = car;
                head++;
            }
        }

        System.out.print(sb);
    }
}

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

int main(){
  string s;
  int k;
  vector<string> V;
  cin>>s>>k;
  for(int i=0;i<s.length();i++){
    for(int j=1;j<=k;j++){
      V.push_back(s.substr(i,j));
    }
  }
  sort(V.begin(),V.end());
  V.erase(unique(V.begin(),V.end()),V.end());
  cout<<V[k-1]<<endl;
}


Measured memory_bytes: 1660
import sys
import numpy as np
import random
from decimal import Decimal
import itertools
import re
import bisect
from collections import deque, Counter
from functools import lru_cache

sys.setrecursionlimit(10**9)
INF = 10**13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
def SERIES(n): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ')
def GRID(h,w): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ').reshape(h,-1)[:,:w]
def GRIDfromString(h,w): return np.frombuffer(sys.stdin.buffer.read(), 'S1').reshape(h,-1)[:,:w]
MOD = 1000000007

def main():
	a = I()
	print(a+a**2+a**3)

if __name__ == '__main__':
    main()

Measured memory_bytes: 27136
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
int main(){
    string s;
    cin >> s;
    int cnt = 0;
    bool q = true;
    while(q){
        bool w = false;
        for(int i = 0; i < s.size() - 1; i++){
            if(s[i] != s[i+1]){
                s.erase(s.begin() + i, s.begin() + i + 2);
                i-=2;
                cnt+=2;
                w = true;
            }
        }
        if(s.size() == 0) break;
        q = w;
    }
    cout << cnt;
}

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

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

template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }

inline int calc(int price, int tax_rate) {
	return price * (100 + tax_rate) / 100;
}

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

	for(int x, y, s; cin >> x >> y >> s && x;) {
		int ans = 0;
		REP(p1, 1, s) {
			const int c_p1 = calc(p1, x);

			REP(p2, p1, s - c_p1 + 1) {
				if(c_p1 + calc(p2, x) == s) {
					chmax(ans, calc(p1, y) + calc(p2, y));
					break;
				}
			}
		}

		cout << ans << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1192
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>
#include <queue>
#include <deque>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
ll gcd(ll a, ll b){ return (b == 0) ? a : gcd(b, a % b); }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T> &p){ cout << "[" << p.first << ", " << p.second << "]"; return os; }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define Return(expr) { Cout(expr); return 0; }
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(int, n, k);
    Cins(int, n, a);

    Rep(min(k, 100)){
        vc<int> b(n+1);
        For(i, n){
            b[max(i-a[i], 0)] ++;
            b[min(i+a[i]+1, n)] --;
        }
        int tmp = 0;
        For(i, n){
            a[i] = tmp + b[i];
            tmp = a[i];
        }
    }
    Couts(a);
}




Measured memory_bytes: 4844
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
#define  pi  pair<int,int>
#define  pb  push_back
#define  F   first
#define  S   second
const int N=2e5+3;
string s,p;
int main()
{
    ft
    ll t,i,j,n,m,l,r,a[27],c[27];
    for(i=0; i<26; i++)
    {
        a[i]=LLONG_MAX;
    }
    cin>>n;
    for(i=0; i<n; i++)
    {
        cin>>s;
        memset(c,0,sizeof(c));
        for(char cc:s)
        {
            l=cc-97;
            c[l]++;
        }
        for(j=0; j<26; j++)
        {
            a[j]=min(a[j],c[j]);
        }
    }
    for(i=0; i<26; i++)
    {
        if(a[i]>0)
        {
            for(j=0; j<a[i]; j++)
            {
                cout<<(char)(i+97);
            }
        }
    }
    return 0;
}



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

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecbool vector<bool>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)

int main()
{
  ll a, n, count=0, next = 1;
  cin >> n;

  forll(i, 0, n){
	cin >> a;
	if (a == next)
	  next += 1;
	else
	  count += 1;
  }
  if (count == n)
	count = -1;
  cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
#define ll long long int
#define mod 1000000007
#define mem(a,val) memset(a,val,sizeof(a))

using namespace std;
int main()
{
	std::ios::sync_with_stdio(false);
	ll n,k;
	cin>>n>>k;
	if(n<k){
		cout<<min(n,abs(k-n));
	}else{
		ll a = n/k;
		cout<<min(abs(n-a*k),abs(n-k*(a+1)));
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pr(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define all(v) (v).begin(), (v).end()
#define int long long
#define sz(v) (int)(v).size()
#define mod 1000000007 // ((a- b)% mod+ mod)% mod

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

vector<pair<int, int>> v[200001];

void solve() {
        int n; cin >> n;
        vector<int> v(n);
        for (auto& i: v) cin >> i;
        int ans= 0, mx= v[0];
        for (int i= 1; i< n; i++) {
                ans+= max(mx- v[i], (int)0);
                mx= max(mx, v[i]);
        }
        cout << ans<< "\n";
}

int32_t main(){
ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
        int T= 1;
        //cin >> T;
        while ( T-- ) {
                solve();
        }
return 0;
}


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

using namespace std;

int a, b;

int main (int argc, char const *argv[]) {
//    freopen("input.txt", "r", stdin);

    scanf("%d %d", &a, &b);

    if (a <= 0 and b >= 0) {
        printf("Zero\n");
        return 0;
    }

    if (a > 0 and b > 0) {
        printf("Positive\n");
        return 0;
    }

    int tot = b - a + 1;

    printf("%s\n", tot & 1 ? "Negative" : "Positive");
    return 0;
}



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


using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 1 << 30;
const ll INFL = 1LL<<60;
const ll mod =1000000007;






int main() {

	ll n, k;
	cin >> n >> k;
	VI v(n);
	REP(i, n)cin >> v[i];

	ll ans = 0;

	REP(i, min(k + 1,n)) {
		ll j = k - i;
		ll cur = 0;
		VI p;
		

		REP(a, i) {
			p.push_back(v[a]);
			cur += v[a];
			ans = max(ans, cur);
		}

		sort(ALL(p));

		ll res = cur;
		REP(a, min(k - i, (ll)p.size())) {
			res -= p[a];
			ans = max(ans, res);
		}

		REP(a, min(j,n-i)) {
			p.push_back(v[n - 1 - a]);
			cur += v[n - 1 - a];
			res = cur;
			ans = max(ans, res);
			sort(ALL(p));
			REP(b, min(k - i - a-1, (ll)p.size())) {
				res -= p[b];
				ans = max(res, ans);
			}
		}
	
	}

	cout << ans << endl;

}



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

const int INF = 1e9 + 1;

long long cnt = 0;

void merge( int* a, int left, int mid, int right ){
  int n1 = mid - left;
  int n2 = right - mid;
  int* L = new int[n1 + 1];
  int* R = new int[n2 + 1];
  for( int i = 0; i < n1; i++ ) L[i] = a[left + i];
  for( int i = 0; i < n2; i++ ) R[i] = a[mid + i];
  L[n1] = INF;
  R[n2] = INF;

  int i = 0, j = 0;
  for( int k = left; k < right; k++ ){
    if( L[i] <= R[j] ){
      a[k] = L[i++];
    }else{
      a[k] = R[j++];
      cnt += n1 - i;
    }
  }
}

void mergeSort( int* a, int left, int right ){
  if( right - left > 1 ){
    int mid = ( right + left ) / 2;
    mergeSort( a, left, mid );
    mergeSort( a, mid, right );
    merge( a, left, mid, right );
  }
}

int main(){
  int n; cin >> n;
  int* s = new int[n];
  for( int i = 0; i < n; i++ ) cin >> s[i];

  mergeSort( s, 0, n );
  cout << cnt << endl;
}



Measured memory_bytes: 27296
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//------------------------------------------------------------------------------
template<typename T, int N, T F(const T& a, const T& b)>
struct SegTree
{
public:
    SegTree()
    {
        dat = vector<T>(N * 2 - 1, 0);
    }

    void update(int i, T x)
    {
        i += N - 1;
        dat[i] = x;
        while (i > 0)
        {
            i = (i - 1) / 2;
            dat[i] = F(dat[i * 2 + 1], dat[i * 2 + 2]);
        }
    }

    T query(int a, int b, int k = 0, int l = 0, int r = N)
    {
        if (r <= a || b <= l) return 0;
        if (a <= l && r <= b) return dat[k];
        else
        {
            T vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
            T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
            return F(vl, vr);
        }
    }

    vector<T> dat;
};

/*------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
------------------------------------------------------------------------------*/











//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int N;
    cin >> N;
    vector<int> p(N);
    rep(i, 0, N) cin >> p[i];
    int ans = 0;
    rep(i, 0, N)
    {
        if (p[i] == i + 1)
        {
            if (i == N - 1)
            {
                swap(p[i - 1], p[i]);
            }
            else
            {
                swap(p[i], p[i + 1]);
            }
            ++ans;
        }
    }
    cout << ans << endl;
}


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

using namespace std;
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define sz size
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORN(i,a,b) for(int i=a;i<=b;i++)
#define FORRN(i,a,b) for (int i=(a);i>=(b);i--)
#define FORR(i,a,b) for (int i=(a);i>(b);i--)
typedef unsigned long long ull;
typedef long long ll;

int main(){
    ios_base::sync_with_stdio(false); //Fast I/O
    cin.tie(0);
    cout.tie(0);
	//freopen("input.in","r",stdin);
	//freopen("output.out","w",stdout);

    string s;
    cin >> s;

    string A="",B=s.substr(0,4),C="";
    if(s[5]=='0'){
        A+=s[6];
    }else{
        A+=s[5];
        A+=s[6];
    }

    if(s[8]=='0'){
        C+=s[9];
    }else{
        C+=s[8];
        C+=s[9];
    }

    int x=stoi(A),y=stoi(B);

    if(y<=2019 && x<=4)
        cout << "Heisei\n";
    else
        cout << "TBD\n";

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n, s, maxn, minn;

  while(1){
    scanf("%d", &n);
    if(n==0) break;

    maxn=0;
    minn=1000;
    int x=0;
    for(int i=0;i<n;i++){
      scanf("%d", &s);
      x+=s;
      maxn=max(s,maxn);
      minn=min(s,minn);
    }

    printf("%d\n",(x-maxn-minn)/(n-2) );
  }
  return 0;
}

Measured memory_bytes: 3172
import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
INF = 10 ** 18
MOD = 10**9+7

from math import gcd

Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

d,t,s =  Ri()
if d/s <= t:
    Yes()
else:
    No()

Measured memory_bytes: 63076
// Solid <candgenesis>
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define fs first
#define sc second
using namespace std;
const ll N = 3e3 + 1;
const ll mod = 1e9 + 7;
typedef pair<ll,ll> LL;

ll n,m,k,x,y,val,d[N][N],dp[N][N][4];
ll f(ll x,ll y,ll cnt){
    if (x == n&&y == m){
        if (cnt < 3) return d[x][y];
        return 0;
    }
    if (dp[x][y][cnt] != -1) return dp[x][y][cnt];
    ll ans = 0;
    if (x + 1 <= n){
        ans = max(ans,f(x + 1,y,0));
        if (cnt < 3) ans = max(ans,d[x][y] + f(x + 1,y,0));
    }
    if (y + 1 <= m){
        ans = max(ans,f(x,y + 1,cnt));
        if (cnt < 3) ans = max(ans,d[x][y] + f(x,y + 1,cnt + 1));
    }

    return dp[x][y][cnt] = ans;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    #define task "tst"
    if (fopen(task".inp", "r")){
        freopen(task".inp", "r", stdin);
        //freopen(task".out", "w", stdout);
    }
    cin>>n>>m>>k;
    while(k--){
        cin>>x>>y>>val;
        d[x][y] = val;
    }
    memset(dp,-1,sizeof(dp));
    cout<<f(1,1,0);
}


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

int main() {
	char c;

	cin >> c;

	if ( c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o' ) {
		cout << "vowel" << endl;
	} else {
		cout << "consonant" << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define Repr(i, n, a) for (int i = (n); i >= (a); i--)
#define rep(i, n) Rep(i, 0, n)
#define repr(i, n) Repr(i, n, 0)
#define all(a) a.begin(), a.end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    int n;
    cin >> n;
    int ans = 0;
    for (int i = 1; i * i <= n; i++)
    {
        if (n % i != 0)
            continue;
        int x = i, y = n / i;
        if (x < y - 1)
            ans += (y - 1);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256