akhauriyash/Code-Regression huggingface dataset:
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,a,b) for(Int i=a;i<b;++i)
#define rrep(i,a,b) for(Int i=a;i>=b;--i)
using namespace std;

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

    int A, B; char op; cin >> A >> op >> B;
    cout << (op == '+' ? A+B : A-B) << endl;
}


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

int main(){
  int a,b, c, d;
  cin >> a >> b >> c >> d;
  if((a+b)<(c+d))cout << "Right" << endl;
  else if((a+b)>(c+d))cout << "Left" << endl;
  else cout << "Balanced" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector< vector<int> > VVI;
typedef vector< vector<int> > VVL;
typedef pair<int,int> PII;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair

int main(){
  int N;
  cin>>N;
  VL P(N);
  rep(i,N) cin>>P[i];
  VL A(N),B(N);
  VL Q(N);
  rep(i,N) Q[P[i]-1]=i+1;
  rep(i,N) A[i]=Q[i]+30000*i;
  rep(i,N) B[i]=30000*(N-i);
  rep(i,N){
    if(i) cout<<" ";
    cout<<A[i];
  }
  cout<<endl;
  rep(i,N){
    if(i) cout<<" ";
    cout<<B[i];
  }
  cout<<endl;
}

Measured memory_bytes: 1280
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <cmath>
#include <random>
#include <iomanip>
#include <functional>
#include <list>
#include <unordered_map>
#include <sstream>
#include <istream>
#include <iterator>
using namespace std;

int main()
{
	long long n, m;
	cin >> n >> m;

	string s, t;
	cin >> s >> t;

	if (n < m)
	{
		swap(n, m);
		swap(s, t);
	}

	std::function<long long(long long, long long)> gcd;
	gcd = [&gcd](long long a, long long b) { return !b ? a : gcd(b, a % b); };

	long long g = gcd(n, m);

	for (long long i = 0, j = 0; i < n && j < m; i += n / g, j += m / g)
	{
		if (s[i] != t[j])
		{
			cout << -1;
			return 0;
		}
	}

	cout << n / g * m;
}

Measured memory_bytes: 512
#include <stdio.h>
     
    int main(void)
    {
        char num[5];
        if (scanf("%s", num) != -1)
            for (int i = 0; i < 3; i++)
            {
                if (num[i] == num[i + 1])
                {
                    puts("Bad");
                    break;
                }
                else if (num[i] != num[i + 1] && i == 2)
                {
                    puts("Good");
                }
            }
        return 0;
    }

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

int main()
{
  long long A,B;
  scanf("%lld%lld",&A,&B);
  long long ret;
  if(A==B){
    ret=1;
  }
  else{
    int k=62;
    while(k>=0&&(A>>k)==(B>>k)){
      k--;
    }
    long long M=1ll<<k,L2=M-A%M;
    int l=k-1;
    while(l>=0&&(((B>>l)&1)==0)){
      l--;
    }
    long long L1=(1ll<<(l+1));
    //printf("%d %lld %lld\n",k,L1,L2);
    ret=L2+min(L1+L2,M);
  }
  printf("%lld\n",ret);
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main()
{
    int a;
    scanf("%d",&a);
    int b[a],c[a],d[a];
    for(int i=0;i<a;i++){
        scanf("%d",&b[i]);
    }
    for(int i=0;i<a;i++){
        scanf("%d",&c[i]);
    }
    for(int i=0;i<a-1;i++){
        scanf("%d",&d[i]);
    }
    int e=0;
    for(int i=0;i<a;i++){
        e+=c[i];
    }
    for (int i = 0; i < a-1; i++)
    {
        if(b[i+1]==b[i]+1){
            e+=d[b[i]-1];
        }
    }
    printf("%d\n",e);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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

ll gcd(ll a, ll b)
{
    if (a % b == 0)
    {
        return (b);
    }
    else
    {
        return (gcd(b, a % b));
    }
}

ll lcm(ll a, ll b)
{
    return a / gcd(a, b) * b;
}

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

//----------------------------------------------------------------


int main(){
ll a,b;
cin>>a>>b;
if(a%3==0||b%3==0||(a+b)%3==0){
    cout<<"Possible"<<endl;
}else{
    cout<<"Impossible"<<endl;
}
}









Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
const int N = 5e5 + 5;
const int mod1 = 1e9 + 7;
const int mod2 = 1e9 + 9;
const int base = 33;
struct num{
    int a , b;
    num(){
        a = 0;
        b = 0;
    }
    num(int _a , int _b){
        a = _a;
        b = _b;
    }
    inline num operator + (const num &other) const {
        num res;
        res.a = a + other.a;
        res.b = b + other.b;
        res.a -= (res.a >= mod1) * mod1;
        res.b -= (res.b >= mod2) * mod2;
        return res;
    }
    inline num operator * (const num &other) const {
        num res;
        res.a = (1LL * a * other.a) % mod1;
        res.b = (1LL * b * other.b) % mod2;
        return res;
    }
    inline num operator - (const num &other) const {
        num res;
        res.a = a - other.a;
        res.b = b - other.b;
        res.a += (res.a < 0) * mod1;
        res.b += (res.b < 0) * mod2;
        return res;
    }
    inline bool operator == (const num &other) const {
        return make_pair(a , b) == make_pair(other.a , other.b);
    }
};
int n;
char str[N];
vector < int > v[N];
num arr[N];
num pw[N];
num inv[N];
int power(int a , int b , int mod){
    int res = 1;
    while(b){
        if(b & 1){
            res = (1LL * res * a) % mod;
        }
        a = (1LL * a * a) % mod;
        b >>= 1;
    }
    return res;
}
void pre(){
    for(int i = 1 ; i <= n ; ++i){
        for(int j = i + i ; j <= n ; j += i){
            v[j].emplace_back(i);
        }
    }
    pw[0] = num(1 , 1);
    for(int i = 1 ; i <= n ; ++i){
        pw[i] = pw[i - 1] * num(base , base);
    }
    arr[0] = num(0 , 0);
    for(int i = 1 ; i <= n ; ++i){
        arr[i] = arr[i - 1] + num(str[i] - 'a' + 1 , str[i] - 'a' + 1) * pw[i];
    }
    num tmp = num(power(base , mod1 - 2 , mod1) , power(base , mod2 - 2 , mod2));
    inv[0] = num(1 , 1);
    for(int i = 1 ; i <= n ; ++i){
        inv[i] = inv[i - 1] * tmp;
    }
}
num get(int l , int r){
    return (arr[r] - arr[l - 1]) * inv[l];
}
bool ok(int l , int r , int d){
    return get(l , r - d) == get(l + d , r);
}
bool check(int l , int r){
    for(int d : v[r - l + 1]){
        if(ok(l , r , d)){
            return 0;
        }
    }
    return 1;
}
int main(){
    scanf("%s" , str + 1);
    n = strlen(str + 1);
    bool ok = 0;
    for(int i = 2 ; i <= n ; ++i){
        if(str[i] != str[i - 1]){
            ok = 1;
        }
    }
    if(!ok){
        cout << n << "\n" << 1 << endl;
        return 0;
    }
    pre();
    if(check(1 , n)){
        cout << 1 << "\n" << 1 << endl;
    }
    else{
        cout << 2 << "\n";
        int ans = 0;
        for(int i = 1 ; i < n ; ++i){
            if(check(1 , i) && check(i + 1 , n)){
                ++ans;
            }
        }
        cout << ans << endl;
    }
}

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

int h, n;

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

	for (int i = 0; i < n; i++) {
		int a;

		cin >> a;
		h -= a;
	}

	if(h <= 0)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int a,b,n;
    cin>>a>>b>>n;
    long long int i=b-1;
    long long int x=0;
    if(a*i>b && i<=n)
        x=i;
    long long int c=n;
    long long int m=a*c;
    long long int p=m/b;
    long long int q=(c/b);
    long long int r=a*q;
    long long int diff1=(p)-r;
    long long int z=a*x;

    long long int k=z/b;
    long long int l=(x/b);
    long long int h=a*l;
    long long int diff=k-h;
    cout<<max(diff1,diff)<<endl;


}


Measured memory_bytes: 3636
#include <iostream>
#include <tuple>
#include <vector>
#include <cassert>
#include <algorithm>

using namespace std;

template<class T>
vector<T> VEC(int n, T t){
    return vector<T>(n, t);
}
template<class ...Ts>
auto VEC(int n, Ts ... ts){
    return vector<decltype(VEC(ts...))>(n, VEC(ts...));
}

template<class T> inline bool UPMIN(T& X, const T& A){ if(X > A) {X = A; return true;} return false; }
template<class T> inline bool UPMAX(T& X, const T& A){ if(X < A) {X = A; return true;} return false; }

int main() {
    using ll = long long;
    ll N;
    vector<tuple<int, int>> Ai;
    cin >> N;
    for (int i = 0; i < N; ++i) {
        int a;
        cin >> a;
        Ai.emplace_back(a, i);
    } // end i
    sort(Ai.rbegin(), Ai.rend());
    
    auto dp = VEC(N + 1, N + 1, 0ll);
    ll ans = 0;
    for (int l = 0; l <= N; ++l) {
        int x = l;
        for (int r = N; r > 0; --r) {
            if (l >= r) { break; }
            ll a, vi;
            tie(a, vi) = Ai[x];
            UPMAX(dp[l+1][r], dp[l][r] + a*abs(vi-l));
            // dp[l+1][r] = max(dp[l+1][r], dp[l][r] + a*abs(vi-l));
            UPMAX(dp[l][r-1], dp[l][r] + a*abs(vi-r+1));
            // dp[l][r-1] = max(dp[l][r-1], dp[l][r] + a*abs(vi-r+1));
            x++;
        } // end r
        UPMAX(ans, dp[l][l]);
        assert(x == N);
    } // end l

    cout << ans << endl;
}


Measured memory_bytes: 34676
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		sc.close();
		s = s.replace(" ", "");
		int k = Integer.parseInt(s);
		if(k % 4 == 0) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
	}
}

Measured memory_bytes: 21716
line_a = list(map(int, input().split()))
line_b = list(map(int, input().split()))
line_c = list(map(int, input().split()))

bingo = line_a + line_b + line_c


N = int(input())
Bn = []
for i in range(N):
  n = int(input())
  Bn.append(n)

for i in Bn:
  if i in bingo:
    n = bingo.index(i)
    bingo[n] = -1

if (bingo[0] == -1 and bingo[1] == -1 and bingo[2] == -1) or \
  (bingo[3] == -1 and bingo[4] == -1 and bingo[5] == -1) or \
  (bingo[6] == -1 and bingo[7] == -1 and bingo[8] == -1) or \
  (bingo[0] == -1 and bingo[4] == -1 and bingo[8] == -1) or \
  (bingo[2] == -1 and bingo[4] == -1 and bingo[6] == -1) or \
  (bingo[0] == -1 and bingo[3] == -1 and bingo[6] == -1) or \
  (bingo[1] == -1 and bingo[4] == -1 and bingo[7] == -1) or \
  (bingo[2] == -1 and bingo[5] == -1 and bingo[8] == -1):
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3064
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>

int max(int a,int b){
    if(a > b){
        return a;
    }else{
        return b;
    }
}

int N[4];


int main(){
    scanf("%d%d%d%d",&N[0],&N[1],&N[2],&N[3]);
    
    int m[4];
   
    for(int i = 0;i < 4;i++){
       m[i] = 0;
    }

    for(int i = 0;i < 4;i++){
        if(N[i] == 1)m[0] = 1;
        if(N[i] == 9)m[1] = 1;
        if(N[i] == 7)m[2] = 1;
        if(N[i] == 4)m[3] = 1;
    }

    if(m[0] == 1 && m[1] == 1 && m[2] == 1 && m[3] == 1){
        printf("YES\n");
    }else{
        printf("NO\n");
    }


    return 0;
}


Measured memory_bytes: 128
def solve():
    n, y = read()
    result = think(n, y)
    write(result)


def read():
    return read_int(2)


def read_int(n):
    return list(map(int, read_line().split()[:n]))


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(n, y):
    for i in range(n + 1):
        for j in range(n + 1):
            if i + j > n:
                continue
            k = n - i - j
            if 10000 * i + 5000 * j + 1000 * k == y:
                return [i, j, k]
    return [-1, -1, -1]


def write(result):
    print('{0:d} {1:d} {2:d}'.format(result[0], result[1], result[2]))


if __name__ == '__main__':
    solve()

Measured memory_bytes: 39408
#include <iostream>
#include <cmath>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <cstring>

using namespace std;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long
#define pii pair < int, int >
#define pll pair < long long, long long>
#define ull unsigned long long
#define vi vector < int >
#define vll vector < long long >
#define sz(a) (int)a.size()
#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it++)
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x))
#define fname "searching"

const int inf = (int)1e9;
const ll INF = (ll)1e18;
const double eps = 1e-9;
const double pi = acos(-1.0);
const int mod = (int)1e9 + 7;

int n, d[100100][5];

int solve(){
    cin >> n;
    for(int i = 1, a, b, c; i <= n; ++i){
        cin >> a >> b >> c;
        d[i][1] = max(d[i - 1][2], d[i - 1][3]) + a;
        d[i][2] = max(d[i - 1][1], d[i - 1][3]) + b;
        d[i][3] = max(d[i - 1][1], d[i - 1][2]) + c;
    }
    return max(max(d[n][1], d[n][2]), d[n][3]);
}

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

    cout << solve() << "\n";
    
    return 0;
}

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

// Begin {{{
using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0; i < (n); ++i)
#define reps(i, s, n) for (i64 i = (s); i <= (n); ++i)
#define VAR(Type, ...) Type __VA_ARGS__; IN(__VA_ARGS__)
#define Float(x) OUTN(fixed, setprecision(x));

using i64 = int_fast64_t;
using pii = pair<i64, i64>;

template <class A, class B>
inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }

template <class A, class B>
inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

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

// OUTS
void OUTS() {}
template <class Head, class... Tail>
void OUTS(Head&& head, Tail&&... tail) {
  cout << head << " \n"[sizeof...(tail)==0];
  OUTS(forward<Tail>(tail)...);
}

template <class T>
void OUTS(vector<T> &vec) {
  for (auto &e : vec) cout << e << " \n"[&e==&vec.back()];
}

template <class T>
void OUTS(vector<vector<T>> &df) {
  for (auto &vec : df) OUTS(vec);
}

// OUTL
void OUTL() {}
template <class Head, class... Tail>
void OUTL(Head&& head, Tail&&... tail) {
  cout << head << "\n";
  OUTL(forward<Tail>(tail)...);
}

template <class T>
void OUTL(vector<T> &vec) {
  for (auto &e : vec) cout << e << "\n";
}

// OUTN
void OUTN() {}
template <class Head, class... Tail>
void OUTN(Head&& head, Tail&&... tail) {
  cout << head;
  OUTN(forward<Tail>(tail)...);
}
// }}} End

signed main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int a; string s;
  IN(a, s);
  OUTL((a >= 3200) ? s : "red");
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
 
typedef vector<int> vi;;
typedef vector<ll> vll;

#define l() length()
#define sz() size()
 
#define b() begin()
#define e() end()
#define all(x) x.begin(), x.end()
 
#define pb(i) push_back(i)
#define PB() pop_back()
 
 
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
#define mp make_pair
#define Fi first
#define Se second
 
const int maxx=1e6+9;
 
// Happy Coding!


void solve(){

    int n;
    cin>>n;
    vi arr(n,0);
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    int ans=0;
    int curr=0;
    for(int i=n-1-1;i>=0;i--){
        if(arr[i]>=arr[i+1]){
            curr++;
        }
        else{
            curr=0;
        }
        ans=max(ans,curr);
    }
    cout<<ans<<endl;
}




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

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


int main() {
    int m, d;
    cin >> m >> d;

    int ans = 0;

    for (int j = 1; j <= m; j++)
        for (int i = 20; i <= d; i++){
            if ((i % 10) < 2) continue;
            if ((i / 10) * (i % 10) == j){
                ans++;
            }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
  input = input.trim().split(' ');
  var A = BigInt(input[0]);
  var B = input[1].slice(0,1)+input[1].slice(2);
  B = BigInt(B);
  var prod = (A * B).toString()
  prod = prod.slice(0,-2);
  if (prod == ''){
    prod = 0
  }
  console.log(prod);
}

Main(require("fs").readFileSync("/dev/stdin","utf8"));


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

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

  int numop = 32;
  for (int i = 0; i < N; i++) {
    int a, b = 0;
    cin >> a;
    while ((a > 0) && (numop >= b)) {
      int c = a % 2;
      if (c == 0) {
	b++;
      } else {
	if (numop > b) {
	  numop = b;
	  break;
	}
      }
      a /= 2;
    }
  }
  cout << numop << endl;
}


Measured memory_bytes: 3620
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define rep(i,n) for(int i=0;i<n;i++)
int gcd(int a, int b){
    int r=1;
    while(r!=0){
        r=a%b;
        a=b;
        b=r;
    }
    return a;
}
typedef long long ll;
void revStr(char* str){
    int size = strlen(str);
    int i,j;
    char tmp = {0};
    for(i = 0, j = size - 1; i < size / 2; i++, j--){
        tmp = str[i];
        str[i] = str[j];
        str[j] = tmp;
    }return;
}
typedef struct{
    int a,b;
}data;

//昇順
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}
//構造体降順
int comp( const void *c1, const void *c2 )
{
  data test1 = *(data *)c1;
  data test2 = *(data *)c2;
  int tmp1 = test1.b;   /* b を基準とする */
  int tmp2 = test2.b;
  return tmp2 - tmp1;
}


int kai(int n){
    if(n==0){
        return 1;
    }
    int sum=1;
    for(int i=1;i<=n;i++){
        sum*=i;
    }
    return sum;
}

int main(){
    char a[102],b[102];
    scanf("%s%s",a,b);
    if(strlen(a)>strlen(b)){
        printf("GREATER");
        return 0;
    }else if(strlen(a)<strlen(b)){
        printf("LESS");
        return 0;
    }else{
        for(int i=0;i<strlen(a);i++){
            if((a[i]-'0')>(b[i]-'0')){
                printf("GREATER");
                return 0;
            }else if((a[i]-'0')<(b[i]-'0')){
                printf("LESS");
                return 0;
            }else{
                ;
            }
        }
    }
    printf("EQUAL");
}


Measured memory_bytes: 1700
import numpy as np
n = int(input())
p = list(map(int, input().split()))
a = np.arange(1, n+1)
p = list(p)
p = np.array(p)
match = a == p
ans = 'YES'
if sum(match) == n - 2:
    pos = np.where(match == False)
    pos1 = pos[0][0]
    pos2 = pos[0][1]
    p[pos1], p[pos2] = p[pos2], p[pos1]
    if sum(a == p) != n:
        ans = 'NO'
elif sum(match) != n:
    ans = 'NO'
print(ans)


Measured memory_bytes: 14520
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
int a[200010];
bool ok[1000010];
int cnt[1000010];
int main () {
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        ok[a[i]] = 1;
        cnt[a[i]]++;
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        cnt[a[i]]--;
        if (cnt[a[i]] == 0) ok[a[i]] = 0;
        bool f = 1;
        for (int j = 1; j * j <= a[i]; j++) {
            if (a[i] % j == 0) {
                if (ok[j] == 1 || ok[a[i]/j] == 1) f = 0;
            }
        }
        ok[a[i]] = 1;
        cnt[a[i]]++;
        ans += f;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9256
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
int main()
{
    ll a,b,k,i,c;
    while(cin>>k>>a>>b)
    {
        c=0;
        for(i=a;i<=b;i++)
        {
            if(i%k==0)
                c++ ;
        }
        if(c>=1)
            cout<<"OK"<<endl ;
        else
            cout<<"NG"<<endl ;
    }
    return 0 ;
}


Measured memory_bytes: 3640
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
int min(int x, int y) {
	return x > y ? y : x;
}
int max(int x, int y) {
	return x < y ? y : x;
}
int main() {
	int n;
	int x[100], y[100], h[100];
	int epos;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d%d%d", &x[i], &y[i], &h[i]);
		if (h[i] != 0) {
			epos = i;
		}
	}
	for (int cx = 0; cx <= 100; cx++) {
		for (int cy = 0; cy <= 100; cy++) {
			for (int i = 0; i < 2; i++) {
				int ah;
				if (i == 0) {
					ah = h[epos] + abs(cx - x[epos]) + abs(cy - y[epos]);
				} else {
					ah =
						max(h[epos] - abs(cx - x[epos]) + abs(cy - y[epos]), 0);
				}
				bool isOK = true;
				for (int j = 0; j < n; j++) {
					if (max(ah - abs(x[j] - cx) - abs(y[j] - cy), 0) != h[j]) {
						isOK = false;
					}
				}
				if (isOK) {
					printf("%d %d %d\n", cx, cy, ah);
					return 0;
				}
			}
		}
	}
	return 0;
}

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

int main() {
	int n,t,s=0,dfr=0,sum=0;
	cin>>n>>t;
	rep(i,n){
		dfr=-s;
		cin>>s;
		dfr+=s;
		if(dfr>t){
			sum+=t;
		}else{
			sum+=dfr;
		}
	}
	cout<<sum+t<<endl;
	return 0;
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
#define double long double
#define int long long
#define mii map<int,int>
#define low lower_bound
#define upp upper_bound
#define inf 1000000007 //10^9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define sort(vec) sort(all(vec));
#define rever(vec) reverse(all(vec));
#define bisea binary_search
#define cend cout<<endl;
#define F first
#define S second
using namespace std;
signed main() {
  int n;
  cin>>n;
  int mi=inf;
  for(int i=sqrt(n);i>=1;i--) {
    if(n%i) continue;
    int a=n/i;
    int b=n/a;
    a=to_string(a).size();
    b=to_string(b).size();
    mi=min(mi,max(a,b));
  }
  cout<<mi<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
#define LL long long
#define PP pair<int,int>
int N;
vector<int> A;

bool solve(int k){
	map<int, int> mp;
	for(int i = 1; i < N; i++){
		if(A[i - 1] < A[i]) continue;
		while(!mp.empty()){		
			int m = mp.rbegin() -> first;
			if(m <= A[i]) break;
			mp.erase(m);
		}
		int update = A[i];
		while(!mp.empty()){
			int m = mp.rbegin() -> first;
			if(mp[m] == k - 1 && m == update){
				mp.erase(m);
				update--;
			}else{
				break;
			}
		}
		if(update == 0) return false;
		mp[update]++;
	}
	return true;
}


int main(){
	cin >> N;
	for(int i = 0; i < N; i++){
		int tmp;
		cin >> tmp;
		A.push_back(tmp);
	}
	bool flag = true;
	for(int i = 1; i < N; i++){
		if(A[i - 1] >= A[i])flag = false;
	}
	if(flag){
		cout << 1 << endl;
		return 0;
	}
	int lb = 1, ub = N;
	while(ub - lb > 1){
		int mid = (lb + ub) / 2;
		if(solve(mid)){
			ub = mid;
		}else{
			lb = mid;
		}
	}
	cout << ub << endl;
	return 0;
}

Measured memory_bytes: 1400
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <limits>
#include <algorithm>
#include <array>
#include <random>
#include <complex>
#include <regex>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define fcout cout << fixed << setprecision(10)
#define rep(i,n)    for(int i=0; i<(int)n; i++)
#define mp(a,b) make_pair(a,b)
#define pb push_back
const ll inf = 1e18;
const ll mod = 1e9 + 7;

ll pow (ll x, ll n){
    ll ans = 1;
    while(n>0){
        if(n & 1 == 1){
            ans *= x;
        }
        x = x * x;
        n >>= 1;
    }
    return ans;
}


int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    while(1){
        c -= b;
        if(c <= 0){
            cout << "Yes" << endl;
            break;
        }
        a -= d;
        if(a <= 0){
            cout << "No" << endl;
            break;
        }
    }
}


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    string ans = "No";
    int N,M;
    cin >> N >> M;
    double S;
    int a[N];
    int count;
    S = 0;

    for(int i = 0; i  < N; i++){
        cin >> a[i];
        S = S + a[i];
    }
    
    count = 0;
    for(int i = 0; i < N; i++){
        //cout << a[i] <<" " << S/(4*M) << endl;
        if(a[i]*4*M >= S) count++;
    }
    //cout << M << endl;
    //cout << count << endl;
    if(M <= count) ans = "Yes";
    
    cout << ans << endl;
    
    
}


Measured memory_bytes: 256
import sys
# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    l, r, d = ns()
    print(r // d - (l - 1) // d)


if __name__ == '__main__':
    main()


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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

int32 ans = 0;
int32 n,m,q;
vector<int32> v;

vector<int32> a(55),b(55),c(55),d(55);

void dfs(int32 idx){
    if(idx == n){
        // REP(i,n)cout << v[i] << " ";
        // cout << endl;
        int32 score = 0;
        REP(i,q){
            if(v[b[i]] - v[a[i]] == c[i])score += d[i];
        }
        ans = max(ans, score);
        return;
    }
    for(int32 i = v[idx-1];i<=m;++i){
        v[idx] = i;
        dfs(idx+1);
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m >> q;
    REP(i,q){
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        a[i]--;b[i]--;
    }
    v.resize(n,1);
    dfs(1);
    ANS(ans);
    return 0;
}

Measured memory_bytes: 3648
import sys
from heapq import heappush,heappop
r=sys.stdin.readline
def g(s,g):
 F=[1e7]*-~n;F[s]=0
 H=[(0,s)]
 while H:
  c,u=heappop(H)
  if u==g:return c
  for f,v in E[u]:
   t=c+f
   if t<F[v]:F[v]=t;heappush(H,(t,v))
 return-1
for e in iter(input,'0 0'):
 n,k=map(int,e.split())
 E=[[]for _ in[0]*-~n]
 for _ in[0]*k:
  f=[*map(int,r().split())]
  if f[0]:
   c,d,e=f[1:]
   E[c]+=[(e,d)];E[d]+=[(e,c)]
  else:print(g(*f[1:]))


Measured memory_bytes: 6272
#include <bits/stdc++.h>
using namespace std;
void print(vector<int> v) {
  for (size_t i = 0; i < v.size(); i++) {
    if (i) cout << " ";
    cout << v[i];
  }
  cout << endl;
}
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (auto &p : a) cin >> p;
  vector<int> b(a), c(a);
  prev_permutation(b.begin(), b.end());
  next_permutation(c.begin(), c.end());
  if (b < a) print(b);
  print(a);
  if (c > a) print(c);
  return 0;
}


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

int main(){
  int n,j=0;
  cin>>n;
  vector<int> p(n);
  for(int &i:p)
    cin>>i;
  for(int i=1;i<n-1;i++)
    if((p[i-1]<p[i] && p[i]<p[i+1])||(p[i-1]>p[i] && p[i]>p[i+1]))
      j++;
  cout<<j<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
    int n;
    cin >> n;
    map<string, int> m;
    ll ans=0;
    string s;
    
    for(int i=0;i<n;i++){
        cin >> s;
        sort(s.begin(), s.end());
        ans += m[s];
        m[s]++;
    }
    cout << ans << endl;
    
}


Measured memory_bytes: 11136
#include<stdio.h>
int main(void)
{
	int a,b,c,d,e,f,g,h,i,n;
	scanf("%d",&n);
	while(n!=0) {
		b=0;
		c=0;
		d=0;
		e=0;
		f=0;
		g=0;
		h=0;
		for(i=1;i<=n;i++) {
			scanf("%d",&a);
			if(a<10) {
				b+=1;
			}
			else if(a<20) {
				c+=1;
			}
			else if(a<30) {
				d+=1;
			}
			else if(a<40) {
				e+=1;
			}
			else if(a<50) {
				f+=1;
			}
			else if(a<60) {
				g+=1;
			}
			else {
				h+=1;
			}
		}
		printf("%d\n",b);
		printf("%d\n",c);
		printf("%d\n",d);
		printf("%d\n",e);
		printf("%d\n",f);
		printf("%d\n",g);
		printf("%d\n",h);
	scanf("%d",&n);
	}
	return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <climits>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string.h>
#include <iomanip>
#include <ctype.h>

#define ll          long long int
#define ull         unsigned long long int
#define pb          push_back
#define pii         pair<int,int>
#define fp          first
#define sp          second
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define M_PI        3.14159265358979323846
#define mp          make_pair
#define sz(x)       (int)x.size()
#define hell        1000000007
#define forn(i,a,b)  for(int i=a;i<b;i++)
#define eps 1e9
#define all(a)      (a).begin(),(a).end()
const long long INF = (long long) 1e18+2;


using namespace std;
void solve();

void fastIO() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}

int main(){
   fastIO();
    solve();
}
//void sieve();
ll pw(ll k,ll x);
ll gcd(ll x,ll y);


void solve(){

  int n;
  cin>>n;
  int h[n];
  forn(i,0,n)
  cin>>h[i];

  int dp[n];
  dp[0]=0;
  dp[1]=abs(h[1]-h[0]);
  forn(i,2,n)
  dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
  cout<<dp[n-1];
}


///Before submit=>
///    *check for integer overflow,array bounds
///    *check for n=1

ll gcd(ll x,ll y){
  if(x==0)
  return y;
  else
  return gcd(y%x,x);
}


ll pw(ll k,ll x){
  if(x==0)
  return 1;
  if(x&1)
  return ((pw(k,x-1)%hell)*k%hell)%hell;
  else
  return ((pw(k,x/2)%hell)*(pw(k,x/2)%hell))%hell;
}

/*void sieve(){

  for(int i=2;i<=1000000;i++){
    if(prime[i]==true){
      for(int j=i*i;j<=1000000;j+=i)
      prime[j]=false;
    }
  }

}*/


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cassert>
#include <memory>
#include <stack>
#include <set>
#include <map>
#include <cctype>
#include <climits>
#include <list>
#include <queue>

#define INF 1000000000
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;
using namespace std;


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

  int a,b,c; cin>>a>>b>>c;
  int ans;
  if(a == b) {
    ans = c;
  } else if(b == c) {
    ans = a;
  } else {
    ans = b;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <chrono>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9
#define f first
#define s second

typedef long long ll;

using namespace std;

const int N = 1e5;
int a[N+5];

int main()

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

    int n, m;
    ll sum = 0;

    cin >> n >> m;

    pair <int,int> p[n];

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

        cin >> p[i].first >> p[i].second;
    }

    sort(p, p+n);

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

        if (m < p[i].second) {

            sum+=(ll)m*p[i].first;
            break;
        }

        sum+=(ll)p[i].second*p[i].first;
        m-=p[i].second;
    }

    cout << sum;

    return 0;
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<iostream>
#define ll long long 
#define ull unsigned long long 
#define ld long double
#define pb push_back
#define pf push_front
#define mp make_pair
#define all(v) v.begin(),v.end()
#define BP(n) __builtin_popcount(n)
#define bs(v,x) binary_search(all(v),x)
#define rep(i,n) for(i=0;i<n;i++)
#define rep1(j,n) for (j=i+1;j<n;j++)
#define Unique(v) vector<int>::iterator it; sort(all(v)); it= unique(all(v)); v.resize(distance(v.begin(),it))
#define mod 1000000007
#define PI acos(-1.0)
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL) 
using namespace std;
void input(vector<ll>& v,ll n){ ll i,io; rep(i,n) { cin>>io; v.pb(io);} }
void output(vector<ll> v) { ll i; rep(i,v.size()) cout<<v.at(i)<<" "; }
map<ll,ll>  frequency(vector<ll> v){ ll i; map<ll,ll> m; rep (i,v.size()) {  if (m.find(v[i])==m.end()) m.insert({v.at(i),1}); else m[v.at(i)]++; } return m; }
/*bool perfsq(ll n){ return (ceil(sqrt(n))==floor(sqrt(n))); }
bool ispower2(int n) { if (n&(n-1)==0) return true; else return false; }
bool binary_pred(int a,int b){ return a==b; }*/
int main() {
	fastio;
	//freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
	string s;
	cin>>s;
	int i,c = 0,n = s.length();
	vector<int> test;
	rep(i,n) {
			if (s[i] == 'R')
				c++;
			else  {
				if (c != 0)
					test.pb(c);
				c = 0;
			}
	}
    test.pb(c);
	cout<<*max_element(all(test))<<endl;
}




Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define int long long
bool possible(vector<int>&a,int k,int mid){
    int cnt=0;int n=a.size();
    for(int i=0;i<n;i++){
        cnt+=(a[i]/mid);
        if(a[i]%mid==0) cnt--;
    }
    return (cnt<=k);
}
void solve(){
	int n,k;
    cin>>n>>k;
    vector<int>a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int ans=1e9;
    int low=1;int high=*(max_element(a.begin(),a.end()));
    while(low<=high){
        int mid=low+(high-low)/2;
        if(possible(a,k,mid))
        {
            ans=min(ans,mid);
            high=mid-1;
        }
        else{
            low=mid+1;
        }
    }
    cout<<low;
}
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL); 
	int T=1;
	// cin>>T;
	while(T--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 4752
#include <cstdio>
#include <string>
#include <iostream>
#include <vector>


using namespace std;

int main(int argv, char** argc) {
  int N;
  cin >> N;
  int V[N],C[N],R[N];
  int val=0;
  for(int i=0;i<N;i++)cin>>V[i];
  for(int i=0;i<N;i++)cin>>C[i];
  for(int i=0;i<N;i++){
    R[i]=V[i]-C[i];
    if(R[i]>0)val+=R[i];
  }
  cout << val;

return 0;
}


Measured memory_bytes: 256
N, C = map(int, input().split(' '))

ss = [0] * N
tt = [0] * N
cc = [0] * N

for n in range(N):
    ss[n], tt[n], cc[n] = map(int, input().split(' '))

L = 10 ** 5 * 2 + 2
timeline = [[0] * L for c in range(C)]

# print(len(timeline), len(timeline[0]))

# 同じチャンネルでマージ
for n in range(N):
    timeline[cc[n] - 1][ss[n] * 2] += 1
    timeline[cc[n] - 1][tt[n] * 2] -= 1

# チャンネルのスタート時間0.5ずらして一個前のところに
num = [0] * L
for c in range(C):
    for t in range(L):
        if timeline[c][t] > 0:
            num[t - 1] += timeline[c][t]
        if timeline[c][t] < 0:
            num[t] += timeline[c][t]

stack = 0
max_ = 0
for i in range(L):
    stack += num[i]
    if stack > max_:
        max_ = stack

print(max_)
# 3 2
# 1 3 1
# 3 4 1
# 4 5 2


Measured memory_bytes: 97368
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AC
{


    public static int[] ReadArray()
    {
        return Array.ConvertAll(Console.ReadLine().Split(' '), m => Convert.ToInt32(m));
    }

    public static int ReadInt()
    {
        return Convert.ToInt32(Console.ReadLine());
    }

    public static string ReadStr()
    {
        return Console.ReadLine();
    }

    public static long ReadLong()
    {
        return Convert.ToInt64(Console.ReadLine());
    }

    public static long[] ReadLongArray()
    {
        return Array.ConvertAll(Console.ReadLine().Split(' '), m => Convert.ToInt64(m));

    }


    public static void Main()
    {
        string s = ReadStr();

        int sum = 0;

        for (int i = 0; i < s.Length; i++)
            sum += (s[i] - '0');


        Console.WriteLine(sum % 9 == 0 ? "Yes" : "No");



    }

}


Measured memory_bytes: 17336
"""
author : halo2halo
date : 12, Jan, 2020
"""

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N = int(readline())
V = map(int, readline().split())
C = map(int, readline().split())
ans = 0
for v, c in zip(V, C):
    if v - c > 0:
        ans += v - c

print(ans)


Measured memory_bytes: 3060
use std::io::*;
use std::str::FromStr;
 
/* 
The read function reads a string according to each one. 
*/
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


//main function
fn main() {
    let n: String = read();
    let s: i32 = n.chars().count() as i32;
    for _i in 0..s {
	print!("x");
    }
    println!("");
	
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

int main() {
	string s; cin>>s;
	for(int i=0;i<3;i++){
		if(s[i]==s[i+1]){
			cout<<"Bad"<<endl;
			return 0;
		}
	}
	cout<<"Good"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;

int main() {
    int n,x,order;
    cin >> n;
    vector<int> a(n);

    for (int i = 0; i < n; i++)
    {
        cin >> x;
        swap(a.at(i),x);
    }
    order = a[0];
    if(order==2) {
            cout << 1 << endl;
            return 0;
        }
    for (int i = 0; i < n-1; i++)
    {
        if(order!=2) order = a[order-1];
        if(order==2) {
            cout << i+2 << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 3796
import java.util.Scanner;

public class Main {
	
	static Scanner sc = new Scanner(System.in);
	
	public static void main(String[] args) {
		String s = sc.next();
		long k = sc.nextLong();
		
		int sum = 0;
		int i = 0;
		for(; i < s.length(); i++) {
			if(s.charAt(i) == '1') {
				sum++;
			} else {
				break;
			}
		}
		
		if(k <= sum) {
			System.out.println("1");
		} else {
			System.out.println(s.charAt(i));
		}
	}

}

Measured memory_bytes: 21844
#!/usr/bin/env python3
# coding:utf-8
# Reverse Polish Notation

def main():
    RPM = input().split()
    stack = []
    operator = ['+', '-', '*']
    
    while len(RPM) > 0:
        value = RPM.pop(0)
        if value not in operator:
            stack.append(value)
        else:
            x, y = str(stack.pop()), str(stack.pop())
            stack.append(eval(y + value + x))
    
    print(stack[0])

if __name__ == "__main__":
    main()

Measured memory_bytes: 7532
import numpy as np
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7


def main():
  N = int(readline())
  A = np.array(readline().split(), np.float128)
  B = 1 / A
  C = B.sum()
  print(1/C)
  
  
if __name__ == '__main__':
  main()

Measured memory_bytes: 12480
import bisect

N = int(input())
L = list(map(int, input().split()))
L.sort()

ans = 0

for i in range(N - 1, 1, -1):
    for j in range(i - 1, 0, -1):
        x = bisect.bisect(L, L[i] - L[j])
        ans += max((j - x), 0)

print(ans)


Measured memory_bytes: 74424
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
//#define int long long  
int main(){
    int N;
    int A[364];
    int Ans=1;
    int calc=1;
    cin >> N;
    REP(i,N){cin >> A[i];Ans*=3;}
    REP(i,N){
        if(A[i]%2==0){
            calc*=2;
        }
    }
    cout << Ans-calc << endl;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))
 
using namespace std;
 
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
 
const ll INF=1e9+7;

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

Measured memory_bytes: 3612
#include <stdio.h>

int main() {
  int NUM;
  int MAX=0;
  char c[101];
  
  int cnt_same=0;
  
  int reg_same_left[26];
  int reg_same_right[26];
  
  scanf("%d", &NUM);
  scanf("%s", c);
  
  for (int i=0; i<(NUM-1); i++) {

    // Init
    for (int j=0; j<26; j++) {
      reg_same_left[j] = 0;
      reg_same_right[j] = 0;  
    }    
    cnt_same = 0;
    
    // Check Char Left Side
    for (int j=0; j<i; j++) {
      reg_same_left[c[j] - 0x61] |= 1; 
    }
    // Check Char Right Side
    for (int j=i; j<NUM; j++) {
      reg_same_right[c[j] - 0x61] |= 1; 
    }
    // Count
    for (int j=0; j<26; j++)
      cnt_same += (reg_same_left[j] & reg_same_right[j]);
    
    if (cnt_same > MAX)
      MAX = cnt_same;
  }
  printf("%d", MAX);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define MAX 100005

int n,q;
int arr[MAX];


void updateTree(int index, int *st){
    if(index==0){
        if(index+2<n){
            st[index] = st[index+1] + st[index+2];
        }
        return;
    }
    if(index%2==0){
        st[(index-1)/2] = st[index-1] + st[index];
        updateTree((index-1)/2, st);
    }
    else{
        st[(index-1)/2] = st[index+1] + st[index];
        updateTree((index-1)/2, st);
    }
}

int addValue(int pos, int value, int ss, int se, int index, int *st){
    if(ss==se){
        if(se==pos){
            st[index] += value;
            //printf("change %d to %d\n",index,value);
            return index;
        }
    }
    if(pos>=ss && pos<=se){
        int mid = (ss+se)/2;
        if(pos<=mid){
            return addValue(pos, value, ss, mid, index*2+1,st);
        }
        else{
            return addValue(pos, value, mid+1, se, index*2+2,st);
        }
    }
}

int getSum(int ss, int se, int qs, int qe, int *st, int index){
    if(qs<=ss && qe>=se){
        return st[index];
    }
    if(se<qs || qe<ss){
        return 0;
    }
    int mid = (ss+se)/2;
    return getSum(ss,mid,qs,qe,st,2*index+1)\
        +getSum(mid+1,se,qs,qe,st,2*index+2);
}

int constructSTUtil(int ss, int se, int *st, int index){
    if(ss==se){
        st[index] = arr[ss];
        return st[index];
    }
    int mid = (ss+se)/2;
    st[index] = constructSTUtil(ss, mid, st, 2*index+1)\
                    + constructSTUtil(mid+1, se, st, 2*index+2);
    return st[index];
}

int* constuctSegTree(){
    int x = (int)(ceil(log2(n)));
    // Maximum size of segment tree
    int max_size = 2*(int)pow(2, x) - 1;
    int *st = new int[max_size];
    constructSTUtil(0, n-1, st, 0);
    return st;
}

int main(){
    int comd, x, y, res, index;
    //FILE *fp=fopen("In3.txt","r");
    scanf("%d %d",&n,&q);
    for(int i=0;i<n;++i) arr[i] = 0;
    int *st = constuctSegTree();
    for(int i=0;i<q;++i){
        scanf("%d %d %d",&comd,&x,&y);
        if(comd==0){
            // add y to arr[x]
            x -= 1;
            index = addValue(x, y, 0, n-1, 0,st);
            updateTree(index,st);
        }
        if(comd==1){
            x -= 1;
            y -= 1;
            res = getSum(0,n-1,x,y,st,0);
            printf("%d\n",res);
        }
    }
    return 0;
}



Measured memory_bytes: 4832