akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std; 
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)



int main(){
  string s; cin >> s;
  
  bool easy = true;
  bool odd = true;
  REP(i,s.size()){
    char c = s[i];
    if(odd){
      if(c=='L'){
        easy = false;
        break;
      }
    }else{
      if(c=='R'){
        easy = false;
        break;
      }
    }
    
    odd = !odd;
  }
  if(easy) cout << "Yes\n";
  else cout << "No\n";
}
  

Measured memory_bytes: 256
chomp($s=<>);
chomp($t=<>);

@s=split//,$s;
@t=split//,$t;

$len=length($s) - length($t);
$tlen=length($t);

@ary=split//,$s;
$k=0;
while($k<=$len){
    $flg=0;
    for($i=0;$i<$tlen;$i++){
        if($s[$i+$k] ne $t[$i] && $s[$i+$k] ne "?"){
            $flg=1;
        }
    }
    if($flg==0){
        push @aa,$k;
    }
    $k++;
}

if(@aa){
    @aa=sort{$b <=> $a}@aa;
    $k=$aa[0];
    for($i=0;$i<$tlen;$i++){
        $ary[$i+$k]=$t[$i];
    }
    for($i=0;$i<length($s);$i++){
        if($ary[$i] eq "?"){
            $ary[$i] = "a";
        }
    }
    print join "",@ary;
}else{
    print "UNRESTORABLE";
}


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

constexpr int lim = 2e6;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  vector<bool> prime(lim + 1, true);
  prime[0] = prime[1] = false;
  for (int p = 2; p * p <= lim; ++p) {
    if (prime[p]) {
      for (int i = 2 * p; i <= lim; i += p) {
        prime[i] = false;
      }
    }
  }
  int n;
  while (cin >> n, n) {
    if (prime[n]) {
      cout << "0\n";
    } else {
      int l = n, r = n;
      while (not prime[l - 1]) {
        --l;
      }
      while (not prime[r + 1]) {
        ++r;
      }
      cout << r - l + 2 << '\n';
    }
  }
}



Measured memory_bytes: 3024
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#pragma region Macros
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define all(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
int gcd(int a, int b) // assuming a,b >= 1
{
    if (a < b)
        swap(a, b);
    if (b == 0)
        return a;
    if (a % b == 0)
        return b;
    return gcd(b, a % b);
}
int lcm(int a, int b) // assuming a,b >= 1
{
    return  a * b / gcd(a, b);
}
using namespace std;
#pragma endregion
signed main() {
    char b,c[128];
    c['A'] = 'T';
    c['T'] = 'A';
    c['C'] = 'G';
    c['G'] = 'C';
    cin >> b;
    cout << c[(int)b];
}

Measured memory_bytes: 256
def main():
    n, m = map(int, input().split())
    ans = [None]*n
    for _ in range(m):
        s, c = map(int, input().split())
        try:
            if ans[s-1] is None:
                if c == 0 and s != n:
                    print("-1")
                    return
                ans[s-1] = c
            elif ans[s-1] != c:
                print("-1")
                return
        except:
            print("-1")
            return
    ans_str = ""
    p = ans.pop(0)
    if p is None:
        if n == 1:
            ans_str += "0"
        else:
            ans_str += "1"
    else:
        ans_str += str(p)
    if ans:
        for a in ans:
            ans_str += str(a) if a else "0"
    print(ans_str)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int w, h; char c; cin >> w >> h >> c;
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			if (i == 1 || i == h) {
				if (j == 1 || j == w)cout << '+';
				else cout << '-';
			}
			else if (j == 1 || j == w)cout << '|';
			else if (i == (h + 1) / 2 && j == (w + 1) / 2)cout << c;
			else cout << '.';
			if (j == w)cout << endl;
		}
	}
}


Measured memory_bytes: 3112
IDENTIFICATION DIVISION.
       PROGRAM-ID. ATCODER.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  indata PIC X(100).
       01  a1 PIC 9(08).
       01  a2 PIC 9(08).
       01  a3 PIC 9(08).
       01  r pic 9(08).
       01  g pic 9(08).
       01  r2 pic 9(08).
       01 disp pic Z(20)9.
       PROCEDURE DIVISION.
        ACCEPT indata.
        
        UNSTRING indata DELIMITED BY SPACE INTO a1 a2.
        compute r = a1 + (a2 / 2)
        MOVE FUNCTION TRIM(r) to disp
        DISPLAY disp

       STOP RUN.


Measured memory_bytes: 384
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;

public static class P
{
    public static void Main()
    {
        var toNext = Enumerable.Range('a', 26).Select(x => new ImmutableStack<char>().Push((char)x)).ToArray();
        foreach (var c in Console.ReadLine().Reverse())
        {
            var minStack = toNext.Aggregate(toNext[0], (x, y) => x.Count > y.Count ? y : x);
            toNext[c - 'a'] = minStack.Push(c);
        }

        Console.WriteLine(string.Join("", toNext.Aggregate(toNext[0], (x, y) => x.Count > y.Count ? y : x)));
    }
}

class ImmutableStack<T> : IEnumerable<T>
{
    readonly ImmutableStack<T> previousStack;
    public readonly T Top;
    public readonly int Count;
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public ImmutableStack() : this(null, default(T), 0) { }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    private ImmutableStack(ImmutableStack<T> prev, T top, int count)
    {
        previousStack = prev;
        Top = top;
        Count = count;
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public ImmutableStack<T> Push(T value) => new ImmutableStack<T>(this, value, Count + 1);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public ImmutableStack<T> Pop() => previousStack == null ? null : previousStack;

    public IEnumerator<T> GetEnumerator()
    {
        if (Count == 0) yield break;
        yield return Top;
        foreach (var item in previousStack) yield return item;
    }

    IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}


Measured memory_bytes: 20180
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,d;
    cin>>n>>d;
    vector<double> x(n);
    vector<double> y(n);
    for(int i=0;i<n;i++){
        cin>>x[i]>>y[i];
    }
    int ans=0;
    for(int i=0;i<n;i++){
        if(sqrt(x[i]*x[i]+y[i]*y[i])<=d)
        ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 6424
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define tr(it, a) for (auto it = a.begin(); it != a.end(); it++)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define fo(i, n) for (int i = 0; i < n; i++)
#define Fo(i, k, n) for (int i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<int, pair<int, int>> pipii;
typedef priority_queue<pii, vector<pii>, greater<pii>> minpq;
typedef priority_queue<pii> maxpq;
//const double PI = acos(-1);
const int mod = 1000000007;

// ----------------------DEBUG TEMPLATE--------------------------
void __print(int x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }

template <typename T, typename V>
void __print(const pair<T, V> &x)
{
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}
template <typename T>
void __print(const T &x)
{
    int f = 0;
    cerr << '{';
    for (auto &i : x)
        cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v)
{
    __print(t);
    if (sizeof...(v))
        cerr << ", ";
    _print(v...);
}
#ifndef ONLINE_JUDGE
#define debug(x...)               \
    cerr << "[" << #x << "] = ["; \
    _print(x)
#else
#define debug(x...)
#endif
// =========================DEBUG TEMPLATE============================



int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    long double d;
    cin>>n>>d;
    int ans=0;
    long double x,y;
    while(n--){
        cin>>x>>y;
        long double dist = sqrt(x*x + y*y);
        if(dist<=d){
            ans++;
        }
    }
    cout<<ans<<endl;
    

}


Measured memory_bytes: 3832
N = int(input())
cod = []
rx, ry, rh = 0, 0, 0
for _ in range(N):
    x, y, h = map(int, input().split())
    if h != 0:
        rx, ry, rh = x, y, h
    cod.append([x, y, h])

for i in range(101):
    for j in range(101):
        H = rh+abs(rx-i)+abs(ry-j)
        flg = True
        for x, y, h in cod:
            if max(H - abs(x-i) - abs(y-j), 0) != h:
                flg = False
                break
        if flg:
            print(i, j, H)
            quit()


Measured memory_bytes: 3188
// **** WHEN THE GOING GETS TOUGH, THE TOUGH GETS GOING. ****

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define ordered_set tree < ll ,  null_type ,  less<ll> ,  rb_tree_tag ,  tree_order_statistics_node_update >
//added two more functions to set
//(1)*(set.find_by_order(k))[kth element in the sorted set] 
//(2)set.order_of_key(k)[count of elements strictly less than k]

typedef vector< int > vi;
typedef vector< ll > lvi;
typedef vector< vi > vvi;
typedef vector< lvi > lvvi;
typedef pair< int,int > ii;
typedef pair< ll,ll > lii;
typedef vector<ii> vii;
typedef vector<lii> lvii;

#define min_prq(t) priority_queue<t,vector<t>,greater<t>>
#define max_prq(t) priority_queue<t>
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)//remember i is an iterator
#define present(c,x) ((c).find(x) != (c).end())//for sets,maps,multimaps
#define cpresent(c,x) (find(all(c),x) != (c).end())//for vectors
#define tc(t) int (t); cin>>(t);while((t)--)
#define ff first
#define ss second
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " is " << a << endl;
	err(++it, args...);
}

//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
#define mod 1000000007
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------

ll mod_sum() { return 0LL; }
template<typename T, typename... Args>
T mod_sum(T a, Args... args) { return ((a + mod_sum(args...))%mod + mod)%mod; }

ll mod_product() { return 1LL; }
template<typename T, typename... Args>
T mod_product(T a, Args... args) { return (a*mod_product(args...))%mod; }
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------


signed main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);	
	ll x,y;
	cin>>x>>y;
	if(y>x) swap(x,y);
	if(y<=x-2)
	{
		cout<<"Alice"<<endl;
	}
	else cout<<"Brown"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

#define ABS(x) ((x) < 0 ? -(x) : (x))

#define MIN(x, y) ((x) < (y) ? (x) : (y))

using namespace std;

int main()
{
	int n, k, x;

	cin >> n >> k;

	int d = 0;
	for (int i = 0; i < n; i++) {
		cin >> x;
		d += 2 * MIN(x, ABS(k-x));
	}

	cout << d << endl;

	return 0;
}


		

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <unordered_map>
#include <climits>
#include <set>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>
#include <locale>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

using LL = long long;

int main() {

    LL N, K;
    cin >> N >> K;

    vector<LL> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];

    LL ans = accumulate(A.begin(), A.end(), 0LL);

    vector<LL> B(52, 0);
    for (LL i = 50; i >= 0; i--) {
        LL cnt1 = 0;
        for (LL j = 0; j < N; j++)if (A[j] & (1LL << i)) cnt1++;
        LL cnt0 = N - cnt1;
        if (cnt0 > cnt1) {
            B[i] = (1LL << i) * (cnt0 - cnt1);
        }
    }

    LL pre = 0;
    LL maxV = 0;

    for (LL i = 50; i >= 0; i--) {
        if (K & (1LL << i)) {
            LL sum = 0;
            for (LL j = 0; j < i; j++) sum += B[j];
            sum += pre;
            maxV = max(maxV, sum);
            pre += B[i];
        }
    }
    maxV = max(maxV, pre);

    cout << ans + maxV << endl;

    return 0;
}





























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


int main() {
    long long n,m;
    cin>>n>>m;
    long long v[100];
    long long w[100];
    for (int i=0;i<n;++i) {
        cin >>w[i] >>v[i];
    }
    long long a[100000]={0};
    for (int i=0;i<n;++i){
        for (int j=m;j>=0;--j){
            if (j >= w[i]) {
                a[j]=max(a[j], a[j-w[i]]+v[i]);
            }
        }
    }
    cout<<a[m]<<endl;
    return 0;
}

Measured memory_bytes: 1024
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 1 << 17, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += 72 - dig >> 3;
	return tmp;
}
inline int getintA() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	int dig = ((tmp & ma0) ^ ma0) ? 68 - __builtin_ctzll((tmp & ma0) ^ ma0) : 0;
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += (64 - dig >> 3);
	while ((ct = *ci++) >= '0') tmp = tmp * 10 + ct - '0';
	return tmp;
}
char dn[1300000], *di = dn;
inline void putint(int X) {
	int keta = 0;
	char C[10];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = '\n';
}
int N;
int A[200001];
int E[400001], ne[400001], he[200001], it[200001];
int V[200001], v;
int S[200001], s;

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

	N = getint();
	rep1(i, N) A[i] = getintA();
	int k = 1;
	rep(i, N - 1) {
		int u = getint(), v = getint();
		E[k] = v;
		ne[k] = he[u];
		he[u] = k++;
		E[k] = u;
		ne[k] = he[v];
		he[v] = k++;
	}

	V[v++] = 2000000000;
	S[s++] = 1;
	while (s) {
		int p = S[s - 1];
		if (p > 0) {
			S[s - 1] = -p;
			if (V[v - 1] < A[p]) {
				it[p] = v;
				swap(V[v++], A[p]);
				for (auto to = he[p]; to; to = ne[to]) {
					if (he[E[to]] > 0) {
						S[s++] = E[to];
					}
				}
			}
			else {
				it[p] = lower_bound(V, V + v, A[p]) - V;
				swap(V[it[p]], A[p]);
				for (auto to = he[p]; to; to = ne[to]) {
					if (he[E[to]] > 0) {
						S[s++] = E[to];
					}
				}
			}
			he[p] = -v;
		}
		else {
			s--;
			p = -p;
			V[it[p]] = A[p];
			v -= !A[p];
		}
	}

	rep1(i, N) putint(-he[i]);
	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 8768
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <numeric>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, k, n) for(int i = (k); i < (int)(n); i++)
using namespace std;
using ll = long long;

int count(int x, int cnt){
    while(x != 0){
        x /= 10;
        cnt++;
    }
    return cnt;
}
int main(){
    int N, cnt = 0, ans = 0;
    cin >> N;
    int M = N;
    cnt = count(N, cnt);
    rep(i, cnt){
        ans += M % 10;
        M /= 10;
    }
    if(N % ans == 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
#define eb(t) emplace_back(t)
typedef long long ll;
typedef long long unsigned int llu;
ll MOD = 1000000007;
ll INF = 1000000009;

ll x[110];

void solve(){

    ll n;
    cin >> n;
    rep(i,n){
        cin >> x[i];
    }

    ll ans = INF;
    
    rep(i,101){
        ll tmp = 0;
        rep(j,n){
            tmp += (x[j]-i)*(x[j]-i);
        }
        ans = min(ans,tmp);
    }

    cout << ans << endl;

}

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


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <string>
#include <cmath>
#include <map>
#include <iomanip>
#include <utility>
#define INF 1000000009
#define LINF 1000000000000000009
#define double long double
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, ll> PP;
typedef pair<ll, double> PD;
//ll mod = 1000000007;
ll mod = 998244353;

int main() {
	ll n;
	string s;
	cin >> n >> s;
	ll ans = 1;
	for (ll i = 1; i <= n; i++) {
		ans *= i;
		ans %= mod;
	}
	ll m = 3 * n;
	ll x = 0, y = 0, z = 0;
	vector<int> check(m);
	for (int i = 0; i < m; i++) {
		if (s[i] == 'B') {
			check[i] = x; x++;
		}
		else if (s[i] == 'G') {
			check[i] = y; y++;
		}
		else {
			check[i] = z; z++;
		}
	}
	vector<int> cnt(m);
	vector<int> flag(n);
	for (int i = 0; i < m; i++) {
		cnt[i] = flag[check[i]];
		flag[check[i]]++;
	}
	ll l = 0, r = 0;
	for (int i = 0; i < m; i++) {
		if (cnt[i] == 0) l++;
		else if (cnt[i] == 1) {
			ans *= l;
			ans %= mod;
			l--;
		}
	}
	for (int i = m - 1; i >= 0; i--) {
		if (cnt[i] == 2) r++;
		else if (cnt[i] == 1) {
			ans *= r;
			ans %= mod;
			r--;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 3460
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.BitSet;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author AnandOza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CPeaks solver = new CPeaks();
        solver.solve(1, in, out);
        out.close();
    }

    static class CPeaks {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();

            int[] h = in.readIntArray(n);
            BitSet good = new BitSet(n);
            good.set(0, n);
            for (int i = 0; i < m; i++) {
                int a = in.nextInt() - 1;
                int b = in.nextInt() - 1;
                if (h[b] >= h[a]) {
                    good.clear(a);
                }
                if (h[a] >= h[b]) {
                    good.clear(b);
                }
            }

            out.println(good.cardinality());
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

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

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

    }
}



Measured memory_bytes: 46868
#include <iostream>

using namespace std;

int main(){
    int A, B, C, D, ans;
    cin >> A >> B >> C;
    D = B / A;
    
    if (D >= C) ans = C;
    else if (D < 1) ans = 0;
    else ans = B / A;
    cout << ans << endl;
    return 0;
}


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


int main(){
  int a,b;
  cin>>a>>b;


  if( a < b ) cout<<"a < b"<<endl;
  if( a > b ) cout<<"a > b"<<endl;
  if( a == b ) cout<<"a == b"<<endl;


  return 0;
}


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

int main() {
    ll n, m, msum = 0;
    cin >> n >> m;

    ll a;
    for (int i=0; i<m; i++) {
        cin >> a;
        msum += a;
    }

    if (n - msum >= 0) cout << n - msum << endl;
    else cout << -1 << endl;



}

Measured memory_bytes: 3620
def ggcd(a,b):
    if(b==0):
        return a
    return ggcd(b,a%b)
import math
import fractions
import collections
import itertools
import pprint
N=int(input())
l1=[]
adivb=[]
bis0=0
bdiva=[]
ais0=0
both0=0
p=10**9+7
fish=[list(map(int,input().split())) for _ in range(N)]
fishcomp=[]
d={}
for i in range(N):
    #イメージ的にはa/bを格納していく感じ
    #ai/bi==-bj/ajならダメ
    a=fish[i][0]
    b=fish[i][1]
    g=ggcd(a,b)
    if g!=0:        #ggcdの定義よりa=b=0なら0になりそう(a=0,b!=0ならb,逆もしかり)、つまり(a,0)(0,b)は(1,0)(0,1)にmapされる
        a=a//g
        b=b//g
    #ここらへんで、a,bをそのgcdで割ることによる正規化が完了しているはず
    if b<0:     #b<0の時に強制的にbを正の値に変換しても影響はない(これを噛ませると後々嬉しい)
        a=-a
        b=-b
    if (a!=0)or(b!=0):          #a=b=0でない時は(a,b)(-b,a)といった組みをなすことで仲が悪くなる。よって、(a,b)の連想配列を組んでそのペアを探す下準備
        if d.get(a)==None:
            d[a]={}
            d[a][b]=1
        else:
            if d[a].get(b)==None:
                d[a][b]=1
            else:
                val=d[a].get(b)
                d[a][b]=val+1
        fishcomp.append([a, b])
    else:                       #a=b=0の時は、単体でいてもダメなので、別カウント
        both0=both0+1
#print(d)
#print(fishcomp)
fishcomp=list(map(list,set(map(tuple,fishcomp))))   #二次元配列のset(地味にreferenceがないやつ)
#print(fishcomp)
length=N-both0                                      #とりあえずどっちも0なやつは制約なしには使えないので引く
#print(both0)
sets=[]
#以下ではai/bi==-bj/ajの組みを探している。d[a][b]の個数とd[-b][a]及びd[b][-a]の個数のみ探せば良い、ただ一方のみフォーカスして取ればok
#(a,b)のkeyにて(-b,a)のkeyを取れるか探すことをf(a,b)=(-b,a)としてmapするとf(f(a,b))=(-a,-b)となり、b>0より-b<0のキーは必ず存在しない
#一方f(a,b)=(b,-a)としてもf(f(a,b))=(-a,-b)より、逆方向のキーは存在せず、取れるときは一方向にしか取れない
#(ここでb>0が生きる)
#
for i in fishcomp:
    a=i[0]
    b=i[1]
    val1=d[a][b]
    #print(a,b,val1)
    if d.get(-b)!=None:
        if d[-b].get(a)!=None:
            val2=d[-b][a]               #(a,b)とペアにして都合の悪いものの個数
            sets.append([val1,val2])    #[(a,b)の個数,(-b,a)の個数]のペア
            length=length-(val2+val1)   #((a,b)の個数+(-b,a)の個数)個は自由に扱えなくなりました
#print(sets,length)
pro=1
for i in sets:
    #都合が悪いペアについては、(a,b)同士のみまたは(-b,a)同士のみしか含めることができない
    #よって都合が悪くなるペアごとに、(a,b)の方のみにフォーカスして使う/使わないをbinaryに考えたpow(2,#(a,b))こ、
    #(-b,a)の方のみにフォーカスして使う/使わないをbinaryに考えたpow(2,#(-b,a))こ、そこからどちらとも考えている空集合を1つひいて
    #P(ai,bi)=pow(2,#(ai,bi))+pow(2,#(-bi,ai))-1こが、あるペアP(ai,bi)のイワシを使って仲良くできる組み合わせ数である。
    #この組み合わせ数はペアごとに独立に決まるため、Π(i for allpairs)P(ai,bi)が制約あるイワシ同士で捻出できる選び方である
    pro=(pro*(pow(2,i[0],p)+pow(2,i[1],p)-1))%p
#print(pro)
print((pow(2,length,p)*pro-1+both0)%p)          #制約のないイワシの個数はlengthこで、その自由な選び方はpow(2,length)通り
#(制約のないイワシの選び方)*(都合の悪くなりうるイワシの選び方)で良いが、
#考察から除外した(0 0)のイワシは単体でのみいられるため、1匹につき1count増やし、(0匹)*(0匹)となる1通りを除外し、
#よってpow(2,length)*Π(i for allpairs)P(ai,bi)+both0-1が解である

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

int keta(int N){
  if(N == 0) return 1;
 int a =  log10(N);
  return a+1;
}


int main() {
int64_t N;
  cin >>N;
  int64_t k = sqrt(N);
  int i= k+1;
while(N%k != 0) k--;
 int ans = max(keta(k),keta(N/k));
  printf("%ld\n",ans);
  }


Measured memory_bytes: 256
n = int(input())
cards = list(input().split())
cardb = cards.copy()
cards = cards.copy()

for i in range(n-1):
    for j in range(n-1,i,-1):
        if int(cardb[j].strip('S''H''C''D')) < int(cardb[j-1].strip('S''H''C''D')):
            cardb[j],cardb[j-1] = cardb[j-1],cardb[j]
for i in range(n):
    if i != n-1:
        print(cardb[i], end=' ')
    else:
        print(cardb[i])
print('Stable')

for i in range(n-1):
    # minj=入れ替える数のindex
    minj = i
    for j in range(i+1,n):
        if int(cards[j].strip('S''H''C''D')) < int(cards[minj].strip('S''H''C''D')):
            minj = j
    if i != minj:
        cards[i],cards[minj] = cards[minj],cards[i]
for i in range(n):
    if i != n-1:
        print(cards[i], end=' ')
    else:
        print(cards[i])

judge = True
for i in range(n):
    if cardb[i] != cards[i]:
        judge = False
if judge == True:
    print('Stable')
else:
    print('Not stable')


Measured memory_bytes: 5612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vp;
typedef pair<int,int> pii;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;

int main(){
  int k,x;
  cin >> k >> x;
  if(500*k>=x){
    cout << "Yes" << endl;
  }
  else {cout << "No" << endl;}

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
// g++ Main.cpp -std=gnu++1y -O2 -I/opt/boost/gcc/include -o main && ./main
// g++ Main.cpp -std=gnu++1y -O2 -I/opt/boost/gcc/include -o main && ./main

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vll = vector<vl>;
using vii = vector<vi>;
using pii = pair<int, int>;

using vc = vector<char>;
using vcc = vector<vc>;
using vb = vector<bool>;
using vbb = vector<vb>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using vd = vector<double>;
using vdd = vector<vd>;

#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i, a, b) for(int (i) = a; (i) < (b);(i)++)
#define MAX(a, b) ((a > b) ? a : b)
#define MIN(a, b) ((a > b) ? b : a)

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


const int MOD = 1e9 + 7;

vector<pii> prime_factorization(int n){ // 素因数分解をしたvector<素数, 指数>を返す
  vector<pii> res;
  int tmp, root_n = floor(sqrt(n));
  if(n % 2 == 0){
    tmp = 1;
    n /= 2;
    while(n % 2 == 0){
      n /= 2;
      tmp++;
    }
    res.push_back(make_pair(2, tmp));
  }
  ll i = 3;
  while(i <= root_n && i <= n){
    if(n % i == 0){
      tmp = 1;
      n /= i;
      while(n % i == 0){
        n /= i;
        tmp++;
      }
      res.push_back(make_pair(i, tmp));
    }
    i += 2;
  }
  if(n != 1) res.push_back(make_pair(n, 1));
  return res;
}
vector<pli> prime_factorization(ll n){ // 素因数分解をしたvector<素数, 指数>を返す
  vector<pli> res;
  int tmp, root_n = floor(sqrt(n));
  if(n % 2 == 0){
    tmp = 1;
    n /= 2;
    while(n % 2 == 0){
      n /= 2;
      tmp++;
    }
    res.push_back(make_pair(2, tmp));
  }
  ll i = 3;
  while(i <= root_n && i <= n){
    if(n % i == 0){
      tmp = 1;
      n /= i;
      while(n % i == 0){
        n /= i;
        tmp++;
      }
      res.push_back(make_pair(i, tmp));
    }
    i += 2;
  }
  if(n != 1) res.push_back(make_pair(n, 1));
  return res;
}

// n は 2以上の素数表を返す
vb Primes(int n){
  vector<bool> res(n + 1, true);
  res.at(0) = false; res.at(1) = false;
  for(int i = 2; i <= sqrt(n); i++){
    if(res.at(i)){
      for(int j = 2 * i; j <= n; j += i){
        res.at(j) = false;
      }
    }
  }
  return res;
}
// ===================================================


ll power(ll a, int n){
  if(n == 0) return 1;
  ll prev = power(a, n / 2);
  if((n & 1) == 0) return prev * prev;
  return a * prev * prev;
}

int main(){
  int n, k; cin >> n;
  bool flag = true;
  REP(i, n){
    cin >> k;
    flag = flag && ((k & 1) == 0);
  }
  cout << (flag ? "second" : "first") << endl;
  return 0;
}

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

Measured memory_bytes: 0
using AtCoderBeginnerContest143.Questions;
using AtCoderBeginnerContest143.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace AtCoderBeginnerContest143.Questions
{
    public class QuestionC : AtCoderQuestionBase
    {
        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            var n = inputStream.ReadInt();
            var s = "_" + inputStream.ReadLine();

            var slimes = 0;
            for (int i = 0; i < s.Length - 1; i++)
            {
                if (s[i] != s[i + 1])
                {
                    slimes++;
                }
            }

            yield return slimes;
        }
    }
}


namespace AtCoderBeginnerContest143
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionC();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

#region Base Classes

namespace AtCoderBeginnerContest143.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }

}

#endregion

#region Extensions

namespace AtCoderBeginnerContest143.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion

Measured memory_bytes: 11488
#include <iostream>
#include <vector>
#include <cmath>

int main(){
 long long A,V,B,W,T;
 std::cin>>A>>V>>B>>W>>T;

 long long distance=std::abs(A-B);
 if(distance==0){
  std::cout<<"YES"<<std::endl;
  return 0;
 }
 long long dd=V-W;
 if(dd*T>=distance){
  std::cout<<"YES"<<std::endl;
 }else{
  std::cout<<"NO"<<std::endl;
 }

 return 0;
}

Measured memory_bytes: 3624
/*input
takahashi
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
 
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
#define ll long long 
#define ld long double
#define pii pair<int,int>
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define MP make_pair
const ll INF64=4e12;
const int INF=0x3f3f3f3f;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
ll mult(ll a,ll b){
    return ((a%MOD)*(b%MOD))%MOD;
}
ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1){
            res=(res*a)%MOD;
        }
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
const ll maxn=1e6+5;
const ll maxlg=__lg(maxn)+2;
int main(){
    ios::sync_with_stdio(false),cin.tie(0);
    string s;
    cin>>s;
    REP(i,3) cout<<s[i];
}

Measured memory_bytes: 3652
import java.io.*;
import java.util.*;

public class Main {
    public static PrintWriter out;
    public static FastScanner in;

    private void solve() {
        long n = in.nextLong();
        long s = in.nextLong();
        if(n==s){
            out.print(n+1);
            return;
        }

        List<Long> lst = new ArrayList<>();

        for(int i=2;i<=(int)Math.sqrt(n);i++){
            if(calC(i,n) == s){
                out.print(i);
                return;
            }
        }

        long a = n-s;
        if(a<0){
            out.print(-1);
            return;
        }
        for(int i=1;i<=(int)Math.sqrt(a);i++){
            if(a%i == 0){
                lst.add((long)i+1);
                if(i != a/i) lst.add(a/i+1);
            }
        }

        Collections.sort(lst);
        for(long i:lst){
            if(i > (long)Math.sqrt(n) && calC(i,n) == s){
                out.print(i);
                return;
            }
        }
        out.print(-1);
    }

    private long calC(long b, long n){
        long cnt = 0;
        while (n>0){
            cnt+= n%b;
            n = n/b;
        }
        return cnt;
    }


    private void runIO() {
        in = new FastScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        solve();
        out.close();
    }
    private static class FastScanner {
        BufferedReader bufferedReader;
        StringTokenizer stringTokenizer;

        private FastScanner() {
            bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        }

        private String next() {
            if (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return stringTokenizer.nextToken();
        }

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

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

        private String nextLine() {
            String ret = "";
            try {
                ret = bufferedReader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return ret;
        }
    }

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


Measured memory_bytes: 24020
#include<stdio.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)



int main(){
  int N;
  int A[110];
  int count = 0;
  scanf("%d", &N);
  rep(i,N){
    scanf("%d", &A[i]);
    if(A[i]%2==0)
      {
        if(A[i]%3!=0&&A[i]%5!=0)
        {
          count++;
        }
      } 
}
  
  
 if(count == 0){
   printf("APPROVED\n");
 } else{
    printf("DENIED\n");
 }
 return 0;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

class DLL {

private:
    typedef struct NodeData {
	NodeData * next;
	NodeData * prev;
	int key;
	NodeData(int newKey) {
	    next = nullptr;
	    prev = nullptr;
	    key = newKey;
	}
	~NodeData() { }
    }* Node;

    Node root;

public:
    DLL(void);
    void insert(int);
    void deleteKey(int);
    void deleteFirst(void);
    void deleteLast(void);
    void printList(void);
    ~DLL(); 
};

DLL::DLL(void)
{
    root = new NodeData(0);
    root->next = root;
    root->prev = root;
}

DLL::~DLL()
{
    Node node = root->next, nextNode;
    while (node != root) {
	nextNode = node->next;
	delete node;
	node = nextNode;
    }
    delete root;
};

void DLL::insert(int key)
{
    Node newNode = new NodeData(key);
    newNode->next = root->next;
    newNode->prev = root;
    
    root->next->prev = newNode;
    root->next = newNode;
}

void DLL::deleteKey(int key)
{
    Node node = root->next;
    while (node != root && node->key != key)
	node = node->next;

    if (node != root) {
	node->prev->next = node->next;
	node->next->prev = node->prev;
	delete node;
    }
}

void DLL::deleteFirst(void)
{
    if (root->next != root) {
	Node temp = root->next;
	root->next->next->prev = root;
	root->next = root->next->next;
	delete temp;
    }
}

void DLL::deleteLast(void)
{
    if (root->prev != root) {
	Node temp = root->prev;
	root->prev->prev->next = root;
	root->prev = root->prev->prev;
	delete temp;
    }
}

void DLL::printList(void)
{
    if (root->next != root) {
	cout << root->next->key;
	for (Node node = root->next->next; node != root; node = node->next)
	    cout << " " << node->key; 
	cout << endl;
    }
}

int main(void)
{
    size_t n;
    DLL dlist; 
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;

    for (size_t i = 0; i < n; i++) {
	string buf;
	cin >> buf;
	if (buf == "insert") {
	    int key; cin >> key;
	    dlist.insert(key);
	} else if (buf == "delete") {
	    int key; cin >> key;
	    dlist.deleteKey(key);
	} else if (buf == "deleteFirst")
	    dlist.deleteFirst();
	else if (buf == "deleteLast")
	    dlist.deleteLast();
	else {
	    cout << "Invalid input";
	    exit(-1);
	}
    }

    dlist.printList();

    return 0;
}

Measured memory_bytes: 32492
import Control.Monad

main = do
  n <- read <$> getLine
  print $ length $ filter ( <= n) numbers_with_eight_divisors

numbers_with_eight_divisors =
  filter (\k -> count_divisors k == 8) [1, 3 .. 199]

count_divisors k =
  length $ filter (\d -> mod k d == 0) [1 .. k]


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
//const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) {cout << (A) << '\n'; exit(0);}

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

  multiset<ll> st;
  for (ll i = 0; i < N; i++)
  {
    ll A;
    cin >> A;
    st.emplace(A);
  }

  ll ans = 0;
  while (!st.empty())
  {
    ll a = *st.rbegin();
    ll b = (1LL << ((ll)log2(a) + 1)) - a;

    st.erase(st.find(a));
    if (st.count(b) > 0)
    {
      st.erase(st.find(b));
      ans++;
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

// 2部グラフの判定
// 使い方：colorを-1で初期化してください．
// 注意：連結かどうかに気をつけてください．
// 参考：https://qiita.com/drken/items/a803d4fc4a727e02f7ba#4-3-%E4%BA%8C%E9%83%A8%E3%82%B0%E3%83%A9%E3%83%95%E5%88%A4%E5%AE%9A

vector<ll> color;
bool is_2bu_graph(vector< vector<ll> >& G, ll now, ll col) {
    color[now] = col;
    for(auto g : G[now]) {
        if(color[g] != -1) {
            if(color[g] == col) return false;
            else continue;
        } else {
            if(!is_2bu_graph(G, g, 1-col)) return false;
        }
    }
    return true;
}

int main(){    
    ll n, m;
    cin >> n >> m;
    vector< vector<ll> > G(n + m);

    rep(i, 0, n){
        ll k; cin >> k;
        rep(j, 0, k){
            ll t; cin >> t;
            G[i].push_back(n+t-1);
            G[n+t-1].push_back(i);
        }
    }

    color.resize(n+m, -1);
    bool f = is_2bu_graph(G, 0, 0);
    rep(i, 0, n) if(color[i] == -1) f = false;
    cout << (f ? "YES" : "NO") << endl;
    return 0;
}


Measured memory_bytes: 13368
import collections

bluecard = []
redcard = []

n = int(input())
for i in range(n):
    bluecard.append(input())

m = int(input())
for i in range(m):
    redcard.append(input())

blue_count = collections.Counter(bluecard)
red_count = collections.Counter(redcard)
diff = blue_count - red_count
if len(diff.keys()) > 0:
    print(diff.most_common(1)[0][1])
else:
    print(0)


Measured memory_bytes: 3316
N = int(input())
Flag = False
if 1<=N<=9:
    print('Yes')
else:
    if N%2==0:
        for T in range(2,10,2):
            if N%T==0 and 1<=N//T<=9:
                Flag = True
                break
    else:
        for T in range(3,10,2):
            if N%T==0 and 1<=N//T<=9:
                Flag = True
                break
    if Flag:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 9196
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

trait Joinable {
    fn join(self, sep: &str) -> String;
}

impl<U: ToString, T: Iterator<Item = U>> Joinable for T {
    fn join(self, sep: &str) -> String {
        self.map(|x| x.to_string()).collect::<Vec<_>>().join(sep)
    }
}
fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let L: f64 = sc.get();
    let x = L / 3.;
    let ans = x * x * x;
    println!("{}", ans);
}


Measured memory_bytes: 4352
n = int(input())
dat = list(map(int, input().split()))
f = True
res = []
while len(dat) > 0:
    t = -1
    for i in range(len(dat)):
        if i+1 == dat[i]:
            t = i
    if t == -1:
        f = False
        break
    res.append(dat[t])
    del dat[t]
if f is False:
    print(-1)
else:
    res.reverse()
    print("\n".join(list(map(str, res))))

Measured memory_bytes: 38512