akhauriyash/Code-Regression huggingface dataset:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

def F(A, B):
    return max(len(str(A)), len(str(B)))

def main():
    N = int(input())
    dvs = make_divisors(N)
    flag = False
    if len(dvs)%2 != 0:
        flag = True
        ldvs = dvs.pop()
    ans = float('inf')
    for i in range(len(dvs)//2):
        ans = min(ans, F(dvs[2*i], dvs[2*i+1]))
    if flag:
        ans = min(ans, len(str(ldvs)))
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 3188
#include<stdio.h>
#include<stdlib.h>
#define M 1000000
int lub(int ,int ,int ,int *);


int main(){
  int n,m,A[100010],k=0,i;
  scanf("%d",&n);
 
  for(i=0;i<n;i++)scanf("%d",&A[i]);
  scanf("%d",&m);
  
  while(m--){
    scanf("%d",&i);
    if(A[lub(0,n-1,i,A)]==i)k++;
  }
  printf("%d\n",k);
  return 0;
}


int lub(int l,int r,int n,int *A){
  int m=(l+r)/2;
  if(l==r)return m;
  return n<=A[m]?lub(l,m,n,A):lub(m+1,r,n,A);
}



Measured memory_bytes: 2188
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include <numeric>
#include <math.h>

using namespace std;
void func()
{
	int64_t N,A,B;
	cin >> N >> A >>B;

	int64_t ans(A);
	if (N % (A + B) < A)
		ans = N % (A + B);

	ans += ((int64_t)(N / (A + B))) * A;
	
	cout << ans << endl;
	
}

int main() {
//	while(1)
	func();
	return 0;
}


Measured memory_bytes: 3164
#include<stdio.h>

int main(){

   int a,b,c,i,count;

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

   for( i = a; i <= b ; i++){

  if( c%i ==0){
     count++;
}
}

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

   return 0;
}


Measured memory_bytes: 2100
#include <iostream>

using namespace std;
int main()
{
	

	int A, B, C;
	cin >> A >> B >> C;
	
		if (A != B && A != C)
		{
			cout << A << endl;
		}
		if (B != A && B != C)
		{
			cout << B << endl;
		}
		if (C != B && C != A)
		{
			cout << C << endl;
		}}

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


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

//macro
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPR(i, n) for(int i = n; i >= 0; --i)
#define FOR(i, n, m) for(int i = m; i < n; ++i)
#define LL long long

using namespace std;

typedef pair<int, int> P;
typedef pair<LL, LL> LP;
typedef pair<int, P> PP;
typedef pair<LL, LP> LPP;

int main(){
    int x, y;
    cin >> x >> y;
    int x1[] = {1,3,5,7,8,10,12};
    int x2[] = {4,6,9,11};
    int x3 = 2;
    
    int ansx , ansy;
    REP(i, 7){
        if(x == x1[i]) ansx = 1;
        if(y == x1[i]) ansy = 1;
    }

    REP(i, 4){
        if(x == x2[i]) ansx = 2;
        if(y == x2[i]) ansy = 2;
    }

    if(x == x3) ansx = 3;
    if(y == x3) ansy = 3;


    if(ansx == ansy){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"
int main() {
	int a, b;
	while (scanf("%d %d",&a,&b)!=EOF) {
		cout << a + b << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3232
#include "bits/stdc++.h"

using namespace std;

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

    int n,m,p;
    while(cin>>n>>m>>p,n||m||p){
        int su=0;
        vector<int> x(n);
        for(int i=0;i<n;i++){
            cin>>x[i];
            su+=x[i];
        }
        m--;
        if(x[m]==0) cout<<0<<endl;
        else cout<<(su*(100-p))/x[m]<<endl;
    }
}

Measured memory_bytes: 3136
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define pb push_back
set<int > se;


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

	vector<int > v(10050,0);

	for (int i = 1; i < 105; ++i)
	{
		for (int j = 1; j < 105; ++j)
		{
			for (int k = 1; k < 105; ++k)
			{
				int v1 = i*i + j*j + k*k + i*j + j*k+k*i;
				if(v1<10050)
					v[v1]=v[v1]+1;
			}
		}
	}

	for (int i = 1; i <= n; ++i)
	{
		cout << v[i] << endl;
	}


}

Measured memory_bytes: 3612
A,B,C,D = map(int,input().split())
takahasi = 0
aoki = 0
while C > 0:
  C -= B
  takahasi += 1
while A > 0:
  A -= D
  aoki += 1
if takahasi <= aoki:
  print('Yes')
else:
  print('No')

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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

static const ll INF = 1e15;

const ll mod = 1000000007;


int main(void)
{
	ll a, b, c;
	cin >> a >> b >> c;
	ll left = 4 * a * b;
	ll d = c - a - b;
	if (d < 0) {
		cout << "No" << endl;
		return 0;
	}
	ll right = d * d;
	if (left < right) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


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

#define MOD (1000000007)

using namespace std;

typedef long long ll;
typedef pair<ll, ll> tup;
const int MAX = 3000000;

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


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


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

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

map<ll,ll> prime;//素因数分解でそれぞれの素数がいくつ出てきたかを保存するmap

//O(√n)
//整列済み(mapはkeyで自動で整列される)
void prime_factorize(ll n){
    if(n<=1) return;
    ll l=sqrt(n);
   for(ll i=2;i<=(ll)(l);i++) { //
        if(n%i==0){
            prime_factorize(i);prime_factorize(ll(n/i));return;
        }
    }
    //mapでは存在しないkeyの場合も自動で構築される
    prime[n]++;return;
} 


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

    cout << (1000 - (N%1000)) % 1000 << endl;

    return 0;    
}




Measured memory_bytes: 3648
n = int(input())

s = []
while n > 26:
    tmp = n % 26
    n //= 26
    if tmp == 0:
        n -= 1
        tmp = 26
    s.append(tmp)

s.append(n)

ans = ""
for x in s[::-1]:
    ans += chr(int(x) + 96)

print(ans)

Measured memory_bytes: 9188
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "iomanip"
#include "random"

using namespace std;

const long long int MOD = 1000000007;
const long double EPS = 0.00000001;
const long double PI = 3.1415926535897932384626433;

long long int N, M, K, H, W, L, R;

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

	string s;
	cin >> s;
	s = 'A' + s;
	N = s.size();
	for (int i = 1; i < N; i++) {
		if (s[i] == s[i - 1]) {
			M++;
		}
		if (s[i] < s[i - 1]) {
			M++;
		}
	}
	cout << M << endl;
	return 0;
}

Measured memory_bytes: 3172
N=int(input())
An_list= list(map(int,input().split()))
An_list.sort()
An_list.reverse()

Alice=0
Bob=0

for i in range(N):
  if i%2==0:
    Alice=Alice+An_list[i]
  else:
    Bob=Bob+An_list[i]
score=Alice-Bob
print(score)  

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define MOD 1000000007

int main(void){
	int n;
	cin >> n;
	vector<double> p(n);
	for (int i = 0; i < n; ++i)
	{
		cin >> p[i];
	}
	vector<vector<double>> dp(n+1, vector<double>(n+1, 0));
	dp[0][0] = 1;
	for(int i = 0; i < n; ++i){
		for(int j = 0; j < n; ++j){
			dp[i+1][j+1] += dp[i][j] * p[i];
			dp[i+1][j] += dp[i][j] * (1.0 - p[i]);
		}
	}
	double ans = 0.0;
	for(int i = (n+1)/2; i <= n; ++i){
		ans += dp[n][i];
	}
	// cout << ans << endl;
	printf("%.10f\n", ans);
	return 0;
}


Measured memory_bytes: 70656
#include<bits/stdc++.h>
#define ll long long
#define llu unsigned long long
#define pb push_back
#define f(n) for(ll i=0;i<n;i++)
#define ina for(ll i=0;i<n;i++)cin>>a[i];
#define all(v) v.begin(),v.end()
#define YES printf("YES\n")
#define NO printf("NO\n")
#define fastio std::ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
//long long bigmod/* (a^p)%m */ ( long long a, long long p, long long m ){long long res = 1;long long x = a;while ( p ){if ( p & 1 ){res = ( res * x ) % m;}x = ( x * x ) % m;p = p >> 1;}return res;}
//ll modInverse(ll a, ll m) { ll m0 = m; ll y = 0, x = 1; if (m == 1) return 0; while (a > 1) { ll q = a / m; ll t = m; m = a % m, a = t; t = y; y = x - q * y; x = t; } if (x < 0) x += m0; return x; }
//call manipulated_seive(N) and get prime in prime vector
//const long long MAX_SIZE = 1000001; vector<long long >isprime(MAX_SIZE , true); vector<long long >prime; vector<long long >SPF(MAX_SIZE); void manipulated_seive(int N) { isprime[0] = isprime[1] = false ; for (long long int i=2; i<N ; i++) { if (isprime[i]) { prime.push_back(i); SPF[i] = i; } for (long long int j=0; j < (int)prime.size() && i*prime[j] < N && prime[j] <= SPF[i]; j++) { isprime[i*prime[j]]=false; SPF[i*prime[j]] = prime[j] ; } } }
//ll phi[5000001];bool mark[5000001];void sievephi(ll n){ll i,j;for(ll i=1;i<=n;i++) phi[i]=i;mark[1]=true;for(ll i=2;i<=n;i++)if(!mark[i]){for(ll j=i;j<=n;j+=i){mark[j]=true;phi[j]=phi[j]/i*(i-1);}}}

/*speedup
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
*/
// vule geli coilbi na dada cout << fixed << setprecision(6) << pi <<" "<<npi<<endl;
//Pattern? OEIS
// prime factorize?? think about 2


int main()
{
    fastio;
        ll a,b,c,d;
        cin>>a>>b>>c>>d;
        
        cout<< max({a*c, a*d, b*c, b*d}) <<endl;

    return 0;
}




Measured memory_bytes: 3648
#include <iostream>
#include<string>
#include<stdio.h>
#include<bitset>
using namespace std;

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	for (int i = 0; i < b; i++)
	{
		if (a*(i + 1) % b == c) {
			cout << "YES"; return 0;
		}
	}
	cout << "NO";
	return 0;
}


Measured memory_bytes: 256
N, X = map(int, input().split())
City = list(map(int, input().split()))

distances = [0 for _ in range(N)]
for i in range(N):
    distances[i] = abs(X-City[i])

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

ans = distances[0]
for i in range(1, N):
    ans = gcd(ans, distances[i])

print(ans)


Measured memory_bytes: 14252
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <stack>
#include <queue>
#include <deque>
#include <iomanip>
#include <string>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <bitset>

/*----------------------------------------------------------------*/

using ld = long double;
using vld = std::vector<ld>;
using ll = long long;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using str = std::string;
using vstr = std::vector<str>;
using vb = std::vector<bool>;
using vvb = std::vector<vb>;

/*----------------------------------------------------------------*/

template<typename T> bool chmin(T a, T &b) { return a < b ? b = a, true : false; }
template<typename T> bool chmax(T a, T &b) { return a > b ? b = a, true : false; }
template<typename T> T sqr(T a) { return a * a; }

/*----------------------------------------------------------------*/

constexpr ld PI = 3.141592653589793L;
constexpr ld EPS = std::numeric_limits<ld>::epsilon();

/*----------------------------------------------------------------*/

ll gcd(ll n, ll m) { return m != 0 ? gcd(m, n % m) : n; }
ll lcm(ll n, ll m) { return n / gcd(n, m) * m; }
bool is_prime(ll n) {
    if (n == 1) return false;
    for (ll i = 2; sqr(i) <= n; i++)
        if (n % i == 0) return false;
    return true;
}
ll popcnt(ll n) {
    n = ((n & 0xaaaaaaaaaaaaaaaa) >> 1) + (n & 0x5555555555555555);
    n = ((n & 0xcccccccccccccccc) >> 2) + (n & 0x3333333333333333);
    n = ((n & 0xf0f0f0f0f0f0f0f0) >> 4) + (n & 0x0f0f0f0f0f0f0f0f);
    n = ((n & 0xff00ff00ff00ff00) >> 8) + (n & 0x00ff00ff00ff00ff);
    n = ((n & 0xffff0000ffff0000) >> 16) + (n & 0x0000ffff0000ffff);
    n = ((n & 0xffffffff00000000) >> 32) + (n & 0x00000000ffffffff);
    return n;
}

/*----------------------------------------------------------------*/

void solve();

/*----------------------------------------------------------------*/

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    std::cout << std::setprecision(15);

    solve();
}

void solve() {
    ll q; std::cin >> q;

    for (ll i = 0; i < q; i++) {
        str x, y; std::cin >> x >> y;
        ll x_len = x.length(), y_len = y.length();
        vvll dp(x_len + 1, vll(y_len + 1, 0));
        for (ll i = 1; i <= x_len; i++) for (ll j = 1; j <= y_len; j++)
            if (x[i - 1] == y[j - 1])
                dp[i][j] = dp[i - 1][j - 1] + 1;
            else
                dp[i][j] = std::max(dp[i - 1][j], dp[i][j - 1]);
        std::cout << dp[x_len][y_len] << '\n';
    }
}



Measured memory_bytes: 10796
N = int(input())
a = [0] * (N+1)

for i in range(2, N+1):
	# Nまでの要素について順に因数分解していく
	cnt = i
	for j in range(2, i+1):
		# ひたすらjで因数分解して、jについての指数を求める
		while cnt%j == 0:
			a[j] += 1
			cnt //=j

def num(m):
	ret = 0
	for i in range(2, N+1):
		if a[i] >= m:
			ret += 1
	return ret

ans = 0
ans += num(74)
ans += num(24)*(num(2)-1)
ans += num(14)*(num(4)-1)
ans += num(4)*(num(4)-1)*(num(2)-2)//2
print(ans)


Measured memory_bytes: 3064
import java.util.*;

public class Main {
  
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    if (B % A == 0) {
      System.out.println(A + B);
    } else {
      System.out.println(B - A);
    }
  }
}

Measured memory_bytes: 21844
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <map>
#include <set>
#include <vector>

using namespace std;

constexpr int64_t mod = 1000000007;

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

    vector<int64_t> ss(n), ts(m);
    for (auto& s : ss)
    {
        cin >> s;
    }
    for (auto& t : ts)
    {
        cin >> t;
    }

    vector<vector<int64_t>> dp(n + 1, vector<int64_t>(m + 1, 0));
    dp[0][0] = 1;
    vector<vector<int64_t>> accum(n + 1, vector<int64_t>(m + 1, 0));
    for (int i = 0; i <= n; i++)
    {
        accum[i][0] = 1;
    }
    for (int i = 0; i <= m; i++)
    {
        accum[0][i] = 1;
    }

    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= m; j++)
        {
            if (ss[i - 1] == ts[j - 1])
            {
                dp[i][j] = accum[i - 1][j - 1];
            }
            accum[i][j] = accum[i - 1][j] + accum[i][j - 1] - accum[i - 1][j - 1] + dp[i][j];
            accum[i][j] %= mod;
            accum[i][j] += mod;
            accum[i][j] %= mod;
        }
    }

    cout << accum[n][m] << endl;
}


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

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

typedef long long ll;

const int INF = 1e8;

int main() {
  int n, k; cin >> n >> k;
  
  cout << (n%k==0 ? 0 : 1) << endl;
}


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

using namespace std;

typedef long long ll;

int main() {
    int N;
    cin >> N;
    ll m = 999999999999999;
    for (int i = 0; i < N; i++) {
        int A;
        cin >> A;
        ll cnt = 0;
        while (A % 2 == 0) {
            A /= 2;
            cnt++;
        }
        m = min(m, cnt);
    }

    cout << m << endl;
}

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

using namespace std;

const int MAXN = 2E5;
int numBits;
int a[MAXN];
int b[MAXN];

bool cmp(int a, int b)
{
    return (a % (1 << numBits)) < (b % (1 << numBits));
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    for (int i = 0; i < n; i++)
        cin >> b[i];
    int ans = 0;
    for (int i = 0; i <= 28; i++)
    {
        numBits = i + 1;
        sort(a, a + n, cmp);
        sort(b, b + n, cmp);
        int cur = n - 1;
        int p1, p2, p3;
        p1 = p2 = p3 = 0;
        while (cur >= 0)
        {
            int key = a[cur] % (1 << numBits);
            while (p1 < n && b[p1] % (1 << numBits) + key < (1 << i))
                p1++;
            while (p2 < n && b[p2] % (1 << numBits) + key < (1 << (i + 1)))
                p2++;
            while (p3 < n && b[p3] % (1 << numBits) + key < (1 << i) + (1 << (i + 1)))
                p3++;
            int num = p2 - p1 + n - p3;
            if (num % 2 != 0)
                ans ^= (1 << i);
            cur--;
        }
    }
    cout << ans << endl;
    return 0;
}


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

namespace kakomon
{
    class Program
    {
        static void Main(string[] args)
        {
            abc148_c();
        }

        static void abc148_c()
        {
            // C - Snack
            // aとbの最小公倍数
            // https://kumikomiya.com/competitive-programming-with-c-sharp/
            long[] input = Console.ReadLine().Trim().Split().Select(long.Parse).ToArray();
            long ans = Lcm(input[0], input[1]);
            Console.WriteLine(ans);
        }

        static long Gcd(long a, long b)
        {
            var v = new[] {a, b};
            while (v[1] != 0)
                v = new[] {v[1], v[0] % v[1]};
            return v[0];
        }

        static long Lcm(long a, long b)
        {
            return a / Gcd(a, b) * b;
        }
    }
}

Measured memory_bytes: 13268
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int Q;
int dp[64][32][32];

int dfs(int c, int a, int n){
  if(dp[c][a][n] >= 0) return dp[c][a][n];
  int res = 0;
  if(c > 0 && a > 0 && n > 0) res = max(res, dfs(c-1, a-1, n-1)+1);
  if(c > 1 && a > 0) res = max(res, dfs(c-2, a-1, n)+1);
  if(c > 2) res = max(res, dfs(c-3, a, n)+1);
  return dp[c][a][n] = res;
}

int main(){
  cin >> Q;
  rep(i, Q){
    memset(dp, -1, sizeof(dp));
    int c, a, n;
    cin >> c >> a >> n;
    int res = 0;
    while(c > 8 && a > 4 && n > 0){
      res++;
      c--;
      a--;
      n--;
    }

    while(c > 8 && a > 4){
      res++;
      c-=2;
      a--;
    }

    while(c > 8){
      res++;
      c-=3;
    }
    res += dfs(c, a, n);
    printf("%d\n", res);
  }
  return 0;
}

Measured memory_bytes: 1412
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
using namespace std;
const int N=1e5+5;

int n;
int a[N];

int ans;
int twice;

bool targeted[N];

int main()
{
  int i;

  cin>>n;
  for(i=1;i<=n;i++)
    scanf("%d",&a[i]);

  for(i=1;i<=n;i++)
  {
      if(a[i]==i)
      {
          if(a[i+1]==i+1 && !targeted[i])
          {
            twice++;

            targeted[i+1]=true;
          }

          ans++;
      }
  }

  printf("%d\n",ans-twice);


  return 0;
}


/*

4
1 2 3 4

*/


Measured memory_bytes: 768
import math
cnt = 0
N = int(input())
for n in range(N):
    i = int(input())
    if i == 2\
    or i == 3\
    or i == 5\
    or i == 7:
        cnt += 1
    elif i % 2 == 0:
        continue
    else:
        j = 3
        prime = 1
        while j >= 3 and j <= int(math.sqrt(i)):
            if i % j == 0:
                prime = 0
                break
                
            j += 2
        if prime == 1:
            cnt += 1

print(cnt)

Measured memory_bytes: 7760
import Control.Applicative
import Control.Monad
import Control.Monad.ST
-- import qualified Data.ByteString as BS
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import qualified Data.Foldable as Foldable
import qualified Data.Set as Set
--import qualified Data.Sequence as Sequence
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
import Data.Array
--import Data.Array.Unboxed
--import Data.Array.IArray
import Data.Array.MArray
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
import GHC.ST
-- import System.IO.Unsafe

-- templete
readInt = read :: String -> Int
readInteger = read :: String -> Integer
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getInteger = readLn :: IO Integer
getIntegers = map readInteger . words <$> getLine
getDouble = readLn :: IO Double
getDoubles = map readDouble . words <$> getLine
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
tjoin :: (Show a, Show b) => (a, b) -> String
tjoin (x, y) = show x ++ (' ' : show y)
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
apply4 :: (a -> a -> a -> a -> b) -> [a] -> b
apply4 f [x,y,z,w] = f x y z w
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
binMap :: (a -> a -> b) -> [a] -> [b]
binMap f (x:xs@(y:_)) = f x y : binMap f xs
binMap _ _ = []
splitRec :: Int -> [a] -> [[a]]
splitRec _ [] = []
splitRec n xs = let (y,ys) = splitAt n xs in y : splitRec n ys
infixl 7 `divCeil`
divCeil :: Integral a => a -> a -> a
x `divCeil` y = (x+y-1) `div` y
coverC :: Ord a => (a, a) -> a -> Bool
coverC (l,r) x = l<=x && x<=r
coverH :: Ord a => (a, a) -> a -> Bool
coverH (l,r) x = l<=x && x<r
ibsearch :: (Int -> Bool) -> (Int,Int) -> Int
ibsearch f (ok,ng) = if abs (ok-ng) <= 1 then ok else let mid = (ok + ng) `div` 2 in ibsearch f (if f mid then (mid,ng) else (ok,mid))
-- templete

f x y b p = min (x * b + y * p) ((x * (max 5 b) + y * (max 2 p)) * 4 `div` 5)

main = getInt >>= flip replicateM getInts >>= mapM_ (print . apply4 f)
    
    


Measured memory_bytes: 4316
n,k = map(int,input().split())
mod = 998244353

kukan = []
for _ in range(k):
    l,r = map(int,input().split())
    l -= 1
    kukan.append([l,r])

dp = [0 for i in range(n)]
dp[0] = 1
ruiseki = [0 for i in range(n+1)]
ruiseki[1] = 1

for i in range(1,n):
    for l,r in kukan:
        l = i - l
        r = i - r
        l,r = r,l
        if r < 0:
            continue
        elif l >= 0:
            dp[i] += (ruiseki[r] - ruiseki[l])%mod
        else:
            dp[i] += (ruiseki[r])%mod
    ruiseki[i+1] = (ruiseki[i] + dp[i])

print(dp[-1]%mod)

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

using namespace std;
typedef long long int ll;

int main()
{
//    freopen("out.txt","w",stdout);
    ll a,b;
    cin >> a >> b;
    if (a==1||b==1)
    {
        cout << 1 << endl;
        return 0;
    }
    if ((a*b)%2==0)
        cout << ((a*b)/2) << endl;
    else
        cout << ((a*b)/2)+1 << endl;
    return 0;
//    fclose(stdout);
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

int main(){
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	a=max(a,b);
	printf("%d",(c+a-1)/a);
}

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

#define fori(i, ini, lim) for(int i = int(ini); i < int(lim); i++)
#define ford(i, ini, lim) for(int i = int(ini); i >= int(lim); i--)

#define debug(x) cout << "> " << #x << " = " << x << endl;
#define debug_at(arr, at) cout << "> " << #arr << "[" << at << "] = " << arr[at] << endl;
#define debug_pair(p) cout << "> " << #p << " = (" << p.first << ", " << p.second << ")" << endl;

using namespace std;

typedef long long ll;

int main() {
    ios_base::sync_with_stdio(false);

    string s;
    cin >> s;
    map<char, int> his;

    ll ans = 1;
    fori(i, 0, s.size()) {
        char c = s[i];
        ll add = i - his[c];
        ans += add;

        ++his[c];
    }
    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 720
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>

using namespace std;

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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    char a, b;
    cin >> a >> b;
    if (a == 'H') {
        if (b == 'H') {
            cout << 'H' << endl;
        } else {
            cout << 'D' << endl;
        }
    } else {
        if (b == 'D') {
            cout << 'H' << endl;
        } else {
            cout << 'D' << endl;
        }
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main(void){
  int N,P,M=0,sum=0;
  cin >> N;
  for(int i=0;i<N;i++){
    cin >> P;
  	M=max(M,P);
    sum+=P;
  }
  cout << sum-M/2 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;

int main()
{
    int n,k;
    while(scanf("%d%d",&n,&k)==2)
    {
        int non,ope=0;
        for(int i=0;i<n;i++)
            scanf("%d",&non);
        if(n==k)
            ope=1;
        else
        {
            while(n>k)
            {
                n-=k-1;
                ope++;
            }
            ope++;
        }
        printf("%d\n",ope);
    }
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cctype>
#include<cmath>
#include<cstring>
#include<sstream>
#include<set>
#include<map>
#define maxn 100000
using namespace std;
int main()
{
    char s[1000];
    int a,i,m,n;
    scanf("%s",s);
    n=strlen(s);
    a=m=0;
    s[n]='K';
    for(i=0;i<=n;i++)
    {
        if(s[i]=='A'||s[i]=='T'||s[i]=='C'||s[i]=='G')
            m++;
        else
        {
            a=max(a,m);
            m=0;
        }
    }
    cout<<a;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int   LL;
typedef long double     LD;
#define OR              ||
#define AND             &&
#define nl              '\n'
#define S               string
#define inf             INT_MAX
#define SQR(a)          (a) * (a)
#define GCD(a, b)       __gcd(a, b)
#define pi              2.0*acos(0.0)
#define LCM(a, b)       (a * b) / GCD(a, b)
#define mem(a,b)        memset(a,b,sizeof(a))
#define srtv(v)         sort(v.begin(),v.end())
#define T               int t; cin>>t; while(t--)
#define boost		    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inout           freopen("input.txt","r",stdin);freopen("output.txt","w",stdout)
using namespace std;

long long powerMod(long long number,long long power,long long mod)
{
    LL ret=0;

    if(power==0) return 1LL%mod;
    if(power==1) return number%mod;
    if(power%2==0)
    {
        ret=powerMod(number,power/2,mod);
        ret=(ret%mod*ret%mod)%mod;
        return ret%mod;
    }
    else
    {
        ret=powerMod(number,power/2,mod);
        ret=(ret%mod*ret%mod*number%mod)%mod;
        return ret%mod;
    }
}


int main()
{


    int a[4][4];

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


    map<int,int> mp;


    int n;
    cin>>n;


    while(n--)
    {
        int x;
        cin>>x;

        mp[x]++;
    }


    int flag=0;

    if(mp.count(a[1][1])  && mp.count(a[1][2])  && mp.count(a[1][3]))
        flag=1;

    else if(mp.count(a[2][1])  && mp.count(a[2][2])  && mp.count(a[3][3]))
        flag=1;

    else if(mp.count(a[3][1])  && mp.count(a[3][2])  && mp.count(a[3][3]))
        flag=1;

    else if(mp.count(a[1][1])  && mp.count(a[2][1])  && mp.count(a[3][1]))
        flag=1;

    else if(mp.count(a[1][2])  && mp.count(a[2][2])  && mp.count(a[3][2]))
        flag=1;
    else if(mp.count(a[1][3])  && mp.count(a[2][3])  && mp.count(a[3][3]))
        flag=1;
    else if(mp.count(a[1][1])  && mp.count(a[2][2])  && mp.count(a[3][3]))
        flag=1;
    else if(mp.count(a[1][3])  && mp.count(a[2][2])  && mp.count(a[3][1]))
        flag=1;

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



    return 0;
}


Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>

//#include <bits/stdc++.h>
using namespace std;
using LL = int;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7;
constexpr long long INF = numeric_limits<LL>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourd; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Mfor(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, k, t, s, q, last, cnt, sum, ans, dp[10000], a[2000000], b[2000000];
string str, ss;
bool f[1100][1100];
char c;
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
struct Edge { LL to, cost; };
vector<Edge>vec[200000];
vector<LL>v;
map<string, vector<LL>>ma;
//set<LL>st;
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
int main() {
	cin >> n;
	set<LL>st[3];
	rep(i, n) {
		LL x;
		cin >> x;
		st[0].insert(x);
	}
	cin >> m;
	rep(i, m) {
		LL x;
		cin >> x;
		st[1].insert(x);
	}
	set_difference(st[0].begin(),st[0].end(), st[1].begin(), st[1].end(), inserter(st[2], st[2].begin()));
	for (auto& i: st[2]) {
		cout << i << endl;
	}
	return 0;
}


Measured memory_bytes: 35928
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace abc113_a
{
    class Program
    {
        public static int TrainFare(int X, int Y)
        {
            return X + Y / 2;
        }

        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int X = int.Parse(input[0]);
            int Y = int.Parse(input[1]);

            Console.WriteLine(TrainFare(X, Y));

        }
    }
}


Measured memory_bytes: 11092
T = 0
X = 1
Y = 2
item = input()
tabiji = [[0,0,0]]
for i in range(1, int(item)+1):
    tabiji.append(input().split(' '))

a = 'Yes'
for i in range(0, len(tabiji)-1):
    time = int(tabiji[i+1][T]) - int(tabiji[i][T])
    dX = abs(int(tabiji[i+1][X]) - int(tabiji[i][X]))
    dY = abs(int(tabiji[i+1][Y]) - int(tabiji[i][Y]))
    dtime = time - dX - dY
    if dtime < 0 or dtime % 2 == 1:
        a = 'No'

print(a)

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

int main()
{
  long long a,b,c;
  

  cin >> a;
  cin >> b;
  c=a*500;
  if(c>=b)
  {
    cout <<"Yes"<<endl;
    
  }else
  {
    cout <<"No"<<endl;
  }
  return 0;

}


Measured memory_bytes: 256
# include <iostream>
# include <cmath>
# include <algorithm>
# include <stdio.h>
# include <cstdint>
# include <cstring>
# include <string>
# include <cstdlib>
# include <vector>
# include <bitset>
# include <map>
# include <queue>
# include <ctime>
# include <stack>
# include <set>
# include <list>
# include <random>
# include <deque>
# include <functional>
# include <iomanip>
# include <sstream>
# include <fstream>
# include <complex>
# include <numeric>
# include <immintrin.h>
# include <cassert>
# include <array>
# include <tuple>
# include <unordered_map>
# include <unordered_set>
# include <thread>

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using ui32 = unsigned int;
constexpr ll INFLL = 1e18;

#define CHECK_IMPL1(cond)              \
if (!(cond)) {                         \
    DEBUG("expected cond: " << #cond); \
    assert(cond);                      \
}

#define CHECK_IMPL2(cond, message)                                            \
if (!(cond)) {                                                                \
    DEBUG("expected cond: " << #cond << " failed with message: " << message); \
    assert(cond);                                                             \
}
#define CHECK_IMPL(_1, _2, NAME, ...) NAME
#define CHECK(...) CHECK_IMPL(__VA_ARGS__, CHECK_IMPL2, CHECK_IMPL1, CHECK_IMPL0)(__VA_ARGS__)

#ifdef __APPLE__
#define DEBUG(message) std::cerr << message << std::endl;
#else
#define DEBUG(message)
#endif

void solve() {
  ll ai, ao, at, aj, al, as, az;
  cin >> ai >> ao >> at >> aj >> al >> as >> az;
  ll res = 0;
  ll ans = 0;
  for (int k = 0; k <= 1; k++) {
    if (min({ai, aj, al}) < k) {
      continue;
    }
    ans = max(ans, (k * 6 + ao * 2 + ((ai - k) / 2) * 4 + ((aj - k) / 2) * 4 + ((al - k) / 2) * 4) / 2);
  }
  ans = max(ans, ((ai / 2) * 4 + ao * 2 + (aj / 2) * 4 + (al / 2) * 4) / 2);
  cout << ans + res << endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
#ifdef __APPLE__
  freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
#endif
  int t = 1;
//  cin >> t;
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <string>
#include <cstdio>
#include <cstring>
#include <assert.h>
#include <functional>
#define  lowbit(x) (x&(-x))
#define  ll long long
#define  ull unsigned long long
#define  max(a,b) (a>b?a:b)
#define  min(a,b) (a>b?b:a)
#define  PI acos(-1.0)
#define  fir first
#define  sec second
#define  SZ(x) (x.size())
#define  inf 0x3f3f3f3f
#define  PB push_back
#define  MP make_pair
#define  all(x) (x).begin(),(x).end()
#define  PII pair<int,int>
#define  E 2.7182818284590452353602874713527
using namespace std;

/**********************************************Head-----Template****************************************/
bool Finish_read;
template<class T>inline void read(T &x){Finish_read=0;x=0;int f=1;char ch=getchar();while(!isdigit(ch)){if(ch=='-')f=-1;if(ch==EOF)return;ch=getchar();}while(isdigit(ch))x=x*10+ch-'0',ch=getchar();x*=f;Finish_read=1;}
template<class T>inline void print(T x){if(x/10!=0)print(x/10);putchar(x%10+'0');}
template<class T>inline void writeln(T x){if(x<0)putchar('-');x=abs(x);print(x);putchar('\n');}
template<class T>inline void write(T x){if(x<0)putchar('-');x=abs(x);print(x);}
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

const ll mod = 9901;
ll ksm(ll a,ll b){ll ans=1;a%=mod;assert(b>=0);for(;b;b>>=1){if(b&1) ans=ans*a%mod;a=a*a%mod;}return ans;}
/********************************Head----Template**********************************************/

multiset<int>s;
vector<int>vec;

ll dp[100007][3];

ll a[100007],b[100007];

int main (){
    int n;cin>>n;
    for(int i=0;i<n;i++)cin>>a[i];
    dp[0][0]=0;
    dp[0][1]=-100000000000;
    for(int i=0;i<n;i++) {
        dp[i+1][0]=max(dp[i][0]+a[i],dp[i][1]-a[i]);
        dp[i+1][1]=max(dp[i][0]-a[i],dp[i][1]+a[i]);
    }
    cout<<dp[n][0]<<endl;
    //for(int i=0;i<=n+1;i++)
    //cout<<dp[i][1]<<" "<<dp[i][0]<<endl;
    return 0;
}



Measured memory_bytes: 3328
fun main(args: Array<String>) = abc161c()

fun abc161c() {
    val (n, k) = readLine()!!.split(' ').map { it.toLong() }

    var currN = n % k
    val appeared = mutableSetOf(currN)
    var i = 0

    while (i++ < 10000000) {
        if (currN % k == 0L) return println(0)
        val diff = if (currN > k) currN % k else Math.abs(currN - k)
        appeared.add(diff)
        currN = diff
    }

    println(appeared.min()!!)
}


Measured memory_bytes: 103916
a,b,c,k = map(int,input().split())
ans = 0

kk=k-a
for i in range(1):
    if kk<0:
        ans=k
        k=-1
        break
    else:
        ans = a
        k=k-a
    kk = k-b
    if kk<0:
        k=-1
        break
    else:
        k=k-b

    kk = k-c

    if kk<0:
        ans=ans-k
    elif kk>=0:
        ans=ans-c
print(ans)



Measured memory_bytes: 9140
// Copyright 2019 yaito3014
#include "bits/stdc++.h"
using namespace std;

int main() {
  cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false);
  int N, K;
  cin >> N >> K;
  vector<int> p(N);
  for (auto& v : p)cin >> v;
  vector<double> csum(N + 1, 0);
  for (int i = 0; i < N; ++i)
    csum[i + 1] = csum[i] + (p[i] + 1) / 2.;
  double ans = 0;
  for (int i = 0; i <= N - K; ++i)
    ans = max(ans, csum[i + K] - csum[i]);
  cout << fixed << setprecision(7) << ans << endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  string a,b;
  cin >> a >> b;
  if(sz(a) > sz(b)) {
    cout << "GREATER" << endl;
  } else if(sz(a) < sz(b)) {
    cout << "LESS" << endl;
  } else {
    if(a>b) {
      cout << "GREATER" << endl;
    } else if(a<b) {
      cout << "LESS" << endl;
    } else {
      cout << "EQUAL" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 256
import sys
readline = sys.stdin.readline
K = [0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(K[int(readline())])

Measured memory_bytes: 38384
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	static final long DIVIDE_NUMBER = 1000000007;

	static List<List<Integer>> sideList = new ArrayList<>();
	static long[][] dp;

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();

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

			sideList.add(new ArrayList<Integer>());
		}

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

			int x = scan.nextInt() - 1;
			int y = scan.nextInt() - 1;

			sideList.get(x).add(y);
			sideList.get(y).add(x);
		}

		dp = new long[n][2];

		long answer = (dpMethod(n, 0, 0) + dpMethod(n, 0, 1)) % DIVIDE_NUMBER;

		println(answer);
	}

	public static long dpMethod(int parentVertex, int targetVertex, int isBlack) {

		if (dp[targetVertex][isBlack] != 0) {

			return dp[targetVertex][isBlack];
		}

		long result = 1;

		if (isBlack == 0) {

			// 白の場合、黒と白を計算する
			for (int side : sideList.get(targetVertex)) {

				if (side != parentVertex) {

					result *= dpMethod(targetVertex, side, 1) + dpMethod(targetVertex, side, 0);
					result %= DIVIDE_NUMBER;
				}
			}

		} else {

			// 黒の場合、白を計算する
			for (int side : sideList.get(targetVertex)) {

				if (side != parentVertex) {

					result *= dpMethod(targetVertex, side, 0);
					result %= DIVIDE_NUMBER;
				}
			}
		}

		if (result == 0) {

			result = DIVIDE_NUMBER;
		}

		dp[targetVertex][isBlack] = result;

		return result;
	}

	public static void println(Object target) {
		System.out.println(target);
	}
}


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

/**
 * startからすべての頂点への最小距離を求める O(|E| log |V|)
 * 負辺はないものとする
 */
std::vector<int> dijkstra(int start, std::vector<std::vector<std::pair<int, int>>> graph) {
    const unsigned long num_node = graph.size();

    //[(最短距離, node番号)]のque(距離が近い順にとりだす)
    std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int>>, std::greater<std::pair<int, int>>> que;
    que.push({0, start});

    std::vector<int> prev(num_node, -1);            // 経路復元用
    std::vector<int> distance(num_node, INT_MAX);   // startからの距離
    distance[start] = 0;

    while (not que.empty()) {
        int now_dist, from;
        std::tie(now_dist, from) = que.top();
        que.pop();

        if (distance.at(from) < now_dist) {
            continue;
        }
        for (const std::pair<int, int> &p : graph.at(from)) {
            int to = p.first;
            int dist = p.second;
            int new_dist = now_dist + dist;

            if (new_dist < distance.at(to)) {
                prev.at(to) = from;
                distance.at(to) = new_dist;
                que.push({new_dist, to});
            }
        }
    }

    return distance;
}

using namespace std;

int main(void) {
    int V, E, r;
    cin >> V >> E >> r;

    vector<vector<pair<int, int>>> graph(V);
    for (int i = 0; i < E; ++i) {
        int s, t, d;
        cin >> s >> t >> d;
        graph[s].emplace_back(make_pair(t, d));
    }

    auto distance = dijkstra(r, graph);
    for (int i = 0; i < distance.size(); ++i) {
        if (distance[i] == INT_MAX) {
            cout << "INF" << endl;
        }
        else {
            cout << distance[i] << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 20696
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>

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

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

using namespace std;


signed main() {
  int H, N;
  cin >> H >> N;

  int sum = 0;
  int a;
  REP(i, N){
    cin >> a;
    sum += a;
  }

  if(sum >= H) Yes;
  else No;

  return 0;
}

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

const int maxn=2e5+100;

int a[maxn],b[maxn],c[maxn],n;

int want(int x){
	for(int i=1;i<=n;i++) c[i]=b[i]%(x*2);
	sort(c+1,c+n+1);
	int ans=0;
	for(int i=1;i<=n;i++){
		int k=a[i]%(x*2);
		int f1,f2;
		f1=lower_bound(c+1,c+n+1,x*2-k)-1-lower_bound(c+1,c+n+1,x-k);
		f2=lower_bound(c+1,c+n+1,4*x-k)-1-lower_bound(c+1,c+n+1,3*x-k);
		ans+=f1+f2;
	}
	if(ans%2==0) return 0;
	else return 1;
}

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	for(int i=1;i<=n;i++) scanf("%d",&b[i]);
	int ans=0;
	for(int i=0;i<=28;i++) ans+=want(1<<i)*(1<<i);
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define dhoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);  
typedef long long ll;
typedef long double ld;
const ll inf = 1e18;
const int nax = 2e6 + 7;
const ll mod = 1e9 + 7;
//ll tree[4 * nax];
//9uS-22RSwk7gQqh
ll gcd(ll a , ll b){
	if(b == 0) return a;
	return gcd(b , a % b);	
}
ll lcm(ll a , ll b){
	ll g = gcd(a , b);
	ll lc = (a/g) * b;
	return lc;
}
string cal(ll n)
{
	if(n == 0LL) 
		return "0";
	string ans = "";
	while(n!=0){
		
		if(n%2 == 0)
			ans += "0";
		else
			{
				ans += "1";
				n--;
			}
		n/=-2;
	}
	reverse(ans.begin() , ans.end());
	return ans;
	
}
int main()
{
	dhoom;
	ll n;
	cin >> n;
//	cout << "Hey" << endl;
	cout << cal(n) <<endl;
	return 0;
} 



Measured memory_bytes: 256
//Mahir Ratanpara (DA-IICT)
#include<bits/stdc++.h>
using namespace std;
#define Ff(i,a,n) for(i=a;i<n;i++)
#define Fr(i,a,n) for(i=a;i>n;i--)
#define ll long long
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define pb push_back
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
typedef pair<ll, ll>	pa;
typedef vector<ll>		vc;
typedef vector<pa>		vp;
typedef vector<vc>		vvc;
int mpow(int base, int exp); 
void ipgraph(ll n,ll m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vc g[N];

int main() {
    FAST;
    ll t, i, j, k, p, q,l,r, x, y, u, v, n, m;
    string a,b;
    cin>>a>>b;
    n=a.size();
    m=b.size();

    ll dp[n+1][m+1];

    Ff(i,0,m+1)
    dp[0][i]=0;

    Ff(i,0,n+1)
    dp[i][0]=0;

    Ff(i,1,n+1)
    {
        Ff(j,1,m+1)
        {
            if(a[i-1]==b[j-1])
            {
                dp[i][j]=1+dp[i-1][j-1];
            }
            else{
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }

    i=n;
    j=m;
    string s="";
    while(i>0 and j>0)
    {
        if(a[i-1]==b[j-1])
        {
            s+=a[i-1];
            i--;
            j--;
        }
        else
        {
            if(dp[i][j]==dp[i-1][j])
            i--;
            else
            j--;
        }
    }

    reverse(all(s));
    cout<<s;
    return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

void ipgraph(ll n, ll m){
	int i, u, v;
	while(m--){
		cin>>u>>v;
		g[u-1].pb(v-1);
		g[v-1].pb(u-1);
	}
}

void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}


Measured memory_bytes: 80964