akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

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

Measured memory_bytes: 3080
#include<iostream>
#include<vector>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

template<class T>
inline void swap_sort(T& a, T& b) {

	T temp;
	temp = a;
	a = b;
	b = temp;

}

template<class T>
inline T select_middle(T a, T b, T c) {

	T v[3] = { a, b, c };
	if (v[0] > v[1]) { swap_sort(v[0], v[1]); }
	if (v[0] > v[2]) { swap_sort(v[0], v[2]); }
	if (v[1] > v[2]) { swap_sort(v[1], v[2]); }
	return v[1];

}

template<class T>
void quick_sort(T& v, int Begin, int End) {

	int i = Begin - 1;
	int j = End + 1;
	int pivot = v[(Begin + End) / 2];

	if (Begin == End) {
		return;
	}

	while (1) {
		do { i++; } while (v[i] > pivot);
		do { j--; } while (pivot > v[j]);

		if (i < j) {
			swap_sort(v[i], v[j]);
		}
		else { break; }
	}

	quick_sort(v, Begin, j);
	quick_sort(v, j + 1, End);

}

int main() {

	int X;
	int Y;
	int A;
	int B;
	int C;
	cin >> X >> Y >> A >> B >> C;

	vector<int> A_(A);
	vector<int> B_(B);
	vector<int> C_(C);

	for (int i = 0; i < A; i++) {
		cin >> A_[i];
	}
	for (int i = 0; i < B; i++) {
		cin >> B_[i];
	}
	for (int i = 0; i < C; i++) {
		cin >> C_[i];
	}

	quick_sort(A_, 0, A - 1);
	quick_sort(B_, 0, B - 1);
	quick_sort(C_, 0, C - 1);

	long long Sum = 0;

	vector<int> S(X + Y + C);

	for (int i = 0; i < X; i++) {
		S[i] = A_[i];
	}
	for (int i = X; i < X + Y; i++) {
		S[i] = B_[i - X];
	}
	for (int i = X + Y; i < X + Y + C; i++) {
		S[i] = C_[i - X - Y];
	}

	quick_sort(S, 0, X + Y + C - 1);

	for (int j = 0; j < X + Y; j++) {
		Sum += S[j];
	}

	cout << Sum;

}

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

#define count_ones __builtin_popcountl
#define all(a) a.begin(), a.end()
#define gcd(a, b) __gcd(a, b)
#define lca(a, b) a / __gcd(a, b) * b
typedef long long ll;
typedef long double ld;
using namespace std;

const ll MOD = 1e9 + 7;

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

    string s, t;
    cin >> s >> t;
    ll total = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == t[i]) total++;
    }

    cout << total;

    return 0;
}

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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

    int n, k; cin >> n >> k;
    vector<int> l(n);
    for (int i = 0; i < n; i++) cin >> l[i];
    sort(l.begin(), l.end(), greater<int>());
    int ans = 0;
    for (int i = 0; i < k; i++) ans += l[i];
    cout << ans << endl;
    return 0;
}


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

int main() {
	ll n, k;
	cin>>n>>k;
	
	int arr[n];
	for(int i = 0; i<n; i++) {
		cin>>arr[i];
	}
	
	ll ans = 0;
	ll only[n];
	
	for(int i = 0; i<n; i++) {
		int ct = 0;
		for(int j = i+1; j<n; j++) 
			if(arr[i] > arr[j]) ct++;
		only[i] = ct;
	}
	
	int ct[n];
	for(int i = 0; i<n; i++) {
		int count = 0;
		for(int j = 0; j<n; j++) {
			if(i != j && arr[i] > arr[j]) count++; 
		}
		ct[i] = count;
	}
	
	ll mul = (k*(k-1))%MD;
	mul = (mul * 500000004)%MD;
	//ans = ( ans + (ans * mul)%MD)% MD;
	
	
	for(int i = 0; i<n; i++) {
		ll t = (ct[i] * mul) % MD;
		ll onlyval = only[i] * k;
		
		
		ans = (ans + t) % MD;
		ans = (ans + onlyval) % MD;
	}
	
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int x = stdIn.nextInt();
		int y = stdIn.nextInt();
		String ans;
		if( x < y) {
			ans = "a < b";
		} else if( x > y) {
			ans = "a > b";
		} else {
			ans = "a == b";
		}
		stdIn.close();
		System.out.println(ans);

	}

}



Measured memory_bytes: 26204
import java.lang.Math.sqrt

fun main(args : Array<String>) {
    var N = readLine()?.toLong() ?: return

    var min = N
    var end = sqrt(N.toDouble()).toInt()
    for (i in 1..end){
        var j = N / i
        if(i*j == N){
            var moveCount = i+j-2
            if(min > moveCount){
                min = moveCount
            }
        }
    }

    print("$min")
}

Measured memory_bytes: 33796
// AOJ 1257
// @kankichi573
#include <stdio.h>
#include <string.h>

char prime_flag[65536];

int cnt_conj_prime[10000];

int prime256[]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,
67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,
157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,
241,251};

make_furui()
{
        int i,j,num;
        memset(prime_flag,-1,65536);
        
        prime_flag[0]=prime_flag[1]=0;

        for(i=0;prime256[i];i++)
                for(j=2;(num=prime256[i]*j)<65536;j++)
                {
                        //printf("%d\n",num);
                        prime_flag[num]=0;
                }
}
int next_prime(int n)
{
        int i;

        for(i=n+1;i<=11000;i++)
                if(prime_flag[i])
                        return(i);
}
void make_table()
{
        int pr,pr2,sum;

        pr=2;
        while(pr < 10000)
        {
                sum = pr2 = pr;
                //printf("%d\n",sum);
                while(sum < 10000)
                {
                        cnt_conj_prime[sum]++;
                        pr2 = next_prime(pr2);
                        sum += pr2;
                }
                pr=next_prime(pr);
        }
}
main()
{
        int N,ret;
        unsigned int num;

        make_furui();
        make_table();
        //printf(">\n");
        while(EOF!=scanf("%d",&N) && N)
        {
                ret=cnt_conj_prime[N];
                printf("%d\n",ret);
        }
        return(0);
}

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

using namespace std;

int main() {

	int m,f,r;

	while (1) {
		cin >> m >> f >> r;
		if (m == -1 && f == -1 && r == -1) {
			return 0;
		}
		else if (m==-1 || f ==-1){
			cout << "F" << endl;
		}
		else if (m + f >= 80) {
			cout << "A" << endl;
		}
		else if (m + f >= 65) {
			cout << "B" << endl;
		}
		else if (m + f >= 50) {
			cout << "C" << endl;
		}
		else if (m + f >= 30) {
			if (r >= 50) {
				cout << "C" << endl;
			}
			else {
				cout << "D" << endl;
			}
		}
		else {
			cout << "F" << endl;
		}
	}
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
typedef long long int64;
#define debug(x) cerr << #x << ":" << x << endl;

int main()
{
  int lw = 0, uw, lh = 0, uh, N;
  cin >> uw >> uh >> N;
  for (int i = 0; i < N; ++i) {
    int x, y, a;
    cin >> x >> y >> a;
    switch (a) {
    case 1:
      lw = max(lw, x);
      break;
    case 2:
      uw = min(uw, x);
      break;
    case 3:
      lh = max(lh, y);
      break;
    case 4:
      uh = min(uh, y);
      break;
    }
  }

  int H = uh - lh;
  int W = uw - lw;
  int ans = H * W;
  if (H < 0 || W < 0) ans = 0;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,k;
  k=0;
  cin>>n;
  vector<int> vec(n);
  vector<int> kazu(3);
  for(int i=0; i<n; i++){
    cin>>vec.at(i);
  }
  for(int i=1; i<n-1; i++){
    kazu.at(0)=vec.at(i-1);
    kazu.at(1)=vec.at(i);
    kazu.at(2)=vec.at(i+1);
    sort(kazu.begin(), kazu.end());
    if(kazu.at(1)==vec.at(i)){
      k=k+1;
    }
  }
  cout<<k;
}

Measured memory_bytes: 256
n,k=map(int,raw_input().split())
a=map(int,raw_input().split())
s1=[0]*n
s1[0]=a[0]
s2=[0]*n
if a[0]>0:
    s2[0]=a[0]
for i in xrange(1,n):
    s1[i]+=s1[i-1]+a[i]
    s2[i]+=s2[i-1]
    if a[i]>0:
        s2[i]+=a[i]
ans=-float("inf")
for i in xrange(n-k+1):
    if i==0:
        tmp1=s1[i+k-1]
        tmp2=s2[n-1]-s2[i+k-1]
    else:
        tmp1=s1[i+k-1]-s1[i-1]
        tmp2=s2[n-1]-(s2[i+k-1]-s2[i-1])
    ans=max(ans,tmp1+tmp2,tmp2)
print ans


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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

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

	int a;
	string s;

	cin >> a >> s;

	if(a < 3200){
		cout << "red" << '\n';
	}
	else{
		cout << s << '\n';
	}
}


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

int main() {
	int K;
	cin >> K;
	vector<long long> A(K);
	for (int i = 0; i < K; i++) cin >> A[i];
	if (A[K - 1] != 2) {
		cout << -1 << endl;
		return 0;
	}
	long long MAX = 3, MIN = 2;
	for (int i = K - 2; i >= 0; i--) {
		if (MIN % A[i]) MIN += A[i] - MIN % A[i];
		MAX -= MAX % A[i];
		if (MIN > MAX) {
			cout << -1 << endl;
			return 0;
		}
		MAX += A[i] - 1;
	}
	cout << MIN << " " << MAX << endl;
}

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

const int mod = 998244353;
const int g = 3;
const int N = 65536;

int a[100010];
int res[100010];
int f[100010], t[100010];
int cnt[100010];
long long fac[100010], inv[100010], ways[100010];
int num[100010];

long long power(int a, int b) {
	if (!b) return 1;
	long long tmp = power(a, b >> 1);
	return b & 1 ? tmp * tmp % mod * a % mod : tmp * tmp % mod;
}

void NTT(int *a, int N, int *f, int flag) {
	for (int i = 0; i < N; i++) {
		f[i] = a[num[i]];
	}
	for (int len = 2; len <= N; len <<= 1) {
		long long E = power(g, (mod - 1) / len);
		if (flag) E = power(E, mod - 2);
		for (int i = 0; i < N; i += len) {
			long long now = 1;
			for (int j = i; j < i + (len >> 1); j++) {
				long long tmp = now * f[j + (len >> 1)] % mod;
				f[j + (len >> 1)] = f[j] - tmp;
				if (f[j + (len >> 1)] < 0) f[j + (len >> 1)] += mod;
				f[j] = f[j] + tmp;
				if (f[j] >= mod) f[j] -= mod;
				now = now * E % mod;
			}
		}
	}
	if (flag) {
		long long inv = power(N, mod - 2);
		for (int i = 0; i < N; i++) {
			f[i] = f[i] * inv % mod;
		}
	}
}

long long C(int n, int k) {
	return fac[n] * inv[k] % mod * inv[n - k] % mod;
}

int main () {
	fac[0] = inv[0] = 1, ways[0] = 1;
	for (int i = 1; i <= 100000; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = power(fac[i], mod - 2);
		ways[i] = (2 * i - 1) * ways[i - 1] % mod;
	}
	int n; scanf("%d", &n), n <<= 1;
	for (int i = 0; i < n; i++) {
		int x; scanf("%d", &x);
		cnt[x]++;
	}
	for (int i = 0; i < N; i++) {
		num[i] = num[i >> 1] >> 1 | (i & 1 ? N >> 1 : 0);
	}
	f[0] = 1;
	NTT(f, N, res, 0);
	for (int i = 1; i <= 100000; i++) {
		a[cnt[i]]++;
	}
	for (int i = 1; i <= 100000; i++) {
		if (!a[i]) continue;
		memset(f, 0, sizeof(f));
		for (int j = 0; j * 2 <= i; j++) {
			f[j] = C(i, j * 2) * ways[j] % mod;
		}
		NTT(f, N, t, 0);
		for (int j = 0; j < N; j++) {
			res[j] = 1ll * res[j] * power(t[j], a[i]) % mod;
		}
	}
	NTT(res, N, f, 1);
	long long ans = 0;
	for (int i = 0; i < N; i++) {
		if (2 * i > n) break;
		long long tmp = 1ll * f[i] * ways[n - 2 * i >> 1] % mod;
		ans = (ans + (i & 1 ? -1 : 1) * tmp + mod) % mod;
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 7672
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <algorithm>
#include <vector>
#include <math.h>
#include <bitset>
#include <cmath>
#include <set>

#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)
#define rep_r(i,s,n)for(int i = n-1;i>=s;i--)
#define rep_re(i,s,n)for(int i = n;i>=s;i--)
using namespace std;
typedef long long ll;
static const ll MOD = 1e9 + 7;
static const ll INF = 1e25;
static const ll MAX_N = 100001;

int  main() {
	ll n; cin >> n;
	cout << (n - 1)*n / 2 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename TypeInt>

string Itoa(const TypeInt v, int base){
	static const char table[] = "abcdefghijklmnopqrstuvwxyz";
	string ret;
	static numeric_limits<TypeInt> t;
	TypeInt n = v;
	if (t.is_signed) {
		if (v < 0) n *= -1;
	}

	while (n >= base) {
		ret += table[n%base];
		n /= base;
        n--;
	}
	ret += table[n];
	if (t.is_signed) {
		if (v < 0 && base == 10) ret += '-';
	}
	// 文字列の順番を逆にする
	std::reverse(ret.begin(), ret.end());

	return ret;
}



int main(void){
    uint64_t n;
    cin >> n;
    cout << Itoa(n-1, 26) << endl;
}


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

// templates -------------------------------------

#define ULL unsigned long long
#define LL long long
#define LLD long long double
#define REP(i, n) for(LL i = 0; i < n; i++)
#define INV_REP(i, n) for(LL i = n; 0 <= i; i--)

LL combination(LL n, LL m)
{
  LL nume = 1;
  REP(i, m) nume *= (n-i);
  LL demo = 1;
  for(int i = 1; i <= m; i++) demo *= i;
  return nume / demo;
}

template<class T>
class UnionFind
{
private:
  vector<T> par;
  vector<T> rank;
  vector<T> size;

public:
  UnionFind(T N) :
    par(N, T()), rank(N, T()), size(N, T())
  {
    REP(i, N)
    {
      par[i] = i;
      rank[i] = 0;
      size[i] = 1;
    }
  }

  inline T root(T x)
  {
    return par[x] == x ? x : par[x] = root(par[x]);
  }

  inline bool same(T x, T y)
  {
    return root(x) == root(y);
  }

  inline T getSize(T x)
  {
    return size[root(x)];
  }

  void unite(T x, T y)
  {
    T r1 = root(x);
    T r2 = root(y);
    if(r1 == r2) return;

    if(rank[r1] < rank[r2]) swap(r1, r2);
    if(rank[r1] == rank[r2]) rank[r1]++;
    par[r2] = r1;
    size[r1] += size[r2];
  }
};

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

LL n, m;
vector<LL> a;
vector<pair<LL, LL>> cb;

void input()
{
  cin >> n >> m;
  a.resize(n);
  cb.resize(m);
  for(int i = 0; i < n; i++)
  {
    cin >> a[i];
  }
  for(int i = 0; i < m; i++)
  {
    cin >> cb[i].second >> cb[i].first;
  }
}

void solve()
{
  priority_queue<pair<LL, LL>> q;
  for(int i = 0; i < n; i++)
  {
    q.push({a[i], 1LL});
  }

  for(int i = 0; i < m; i++)
  {
    q.push(cb[i]);
  }

  LL res = 0;
  for(int i = 0; i < n; i++)
  {
    auto p = q.top();
    res += p.first;
    q.pop();

    if(1 < p.second)
    {
      p.second--;
      q.push(p);
    }
  }
  cout << res;
}

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

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

int w[110], v[110];
long long dp[110][200100];

int main() {
    int N, W;
    cin >> N >> W;
    for (int i = 0; i < N; i++) cin >> w[i] >> v[i];

    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= W; j++) {
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
            dp[i + 1][j + w[i]] = max(dp[i + 1][j + w[i]], dp[i][j] + v[i]);
        }
    }

    long long ans = 0;
    for (int i = 0; i <= W; i++) ans = max(ans, dp[N][i]);

    cout << ans << endl;
}

Measured memory_bytes: 116708
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define uniq(v) v.erase(unique(v.begin(),v.end()),v.end())
#define lb(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define ub(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
const ll mod=1000000007;
//const ll mod=998244353;
const ld pi=acos(-1.0);
const ll INF = 1LL<<61;
template<class T>bool chmax(T &a, const T &b) { 
  if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) {
  if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる



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

  int d;
  cin>>d;

  vector<ll> p(26);
  rep(i,26) cin>>p[i];

  vector<vector<ll>> q(d,vector<ll>(26));
  rep(i,d) {
    rep(j,26) {
      cin>>q[i][j];
    }
  }

  ll pre=0;
  vector<int> r(26,0);
  rep(i,d-4){
    ll ans=-INF;
    ll memo;
    rep(j,26){
      ll sum=pre;
      auto last=r;
      sum+=q[i][j];
      last[j]=i+1;
      rep(k,26){
        sum-=p[k]*(i+1-last[k]);
      }
      if(sum>ans) {
        memo=j;
        chmax(ans,sum);
      }
    }
    cout << memo+1 << endl;
    pre=ans;
    r[memo]=i+1;
  }

  ll answer=-INF;
  ll A,B,C,D;
  vector<int> zen(4);
  rep(i,26){
    rep(j,26){
      rep(k,26){
        rep(l,26){
            zen[0]=i;
            zen[1]=j;
            zen[2]=k;
            zen[3]=l;

            ll sum=0;
            auto last=r;
            rep(n,4){
              sum+=q[d-4+n][zen[n]];
              last[zen[n]]=d-4+n+1;
              rep(o,26){
                sum-=p[o]*(d-4+n+1-last[o]);
              }
            }

            if(sum>answer) {
              A=zen[0];
              B=zen[1];
              C=zen[2];
              D=zen[3];
            }
            chmax(answer,sum);

        }
      }
    }
  }

  cout << A+1 << endl;
  cout << B+1 << endl;
  cout << C+1 << endl;
  cout << D+1 << endl;
  
}

Measured memory_bytes: 3684
#include <cstdio>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <ctime>
#include <cstring>
#include <cassert>
#include <bitset>
#include <sstream>
#include <queue>

#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define sz(a) ((int) (a).size())
#define eprintf(...) fprintf(stderr, __VA_ARGS__)

using namespace std;

typedef long long int64;
typedef long double ldb;

const long double eps = 1e-9;
const int inf = (1 << 30) - 1;
const long long inf64 = ((long long)1 << 62) - 1;
const long double pi = acos(-1);

template <class T> T sqr (T x) {return x * x;}
template <class T> T abs (T x) {return x < 0 ? -x : x;}

int main () {
//  ios_base::sync_with_stdio(0);
//	freopen("input.txt", "rt", stdin);
//	freopen("output.txt", "wt", stdout);

	long long x, y;
	cin >> x >> y;

	cout << (abs(x - y) > 1 ? "Alice" : "Brown") << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define FORUL(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#define FORULE(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define FOREACH(it, X) for(__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#if defined(_MSC_VER) || __cplusplus > 199711L
#define AUTOVAR(newvar,v) auto newvar = (v)
#else
#define AUTOVAR(newvar,v) __typeof(newvar) r = (v)
#endif
#define PB(x) push_back(x)
#define MP(x,y) make_pair((x),(y))
#define MEMSET(m,v) memset(m,v,sizeof(m))

typedef long long				 ll;
typedef unsigned long long		ull;

#define DEBUG 1

#if DEBUG
#define DOUT cout<<"["<<__LINE__<<"]:"
#else
#define DOUT 0 && cout
#endif

using namespace std;

string s;
string t;
vector<vector<int> > posvec;

int main(int argc, char *argv[])
{
	ios::sync_with_stdio(false);

	cin >> s;
	cin >> t;

	posvec.resize(26);

	FOR(i,s.size()) {
		posvec[s[i]-'a'].push_back(i);
	}
	FOR(i,s.size()) {
		posvec[s[i]-'a'].push_back(i+s.size());
	}
	int pos = 0;
	ll ans = 0;
	string::iterator it_t = t.begin();
	for(;it_t!=t.end();it_t++) {
		if(posvec[(*it_t)-'a'].size()==0) {
			cout << -1 << endl;
			return 0;
		}
		pos = *lower_bound(
				posvec[(*it_t)-'a'].begin(),
				posvec[(*it_t)-'a'].end(),
				pos)+1;
		if(pos>=s.size()) {
			pos -= s.size();
			ans += s.size();
		}
	}

	ans += pos;
	cout << ans << endl;

	return 0;
}




Measured memory_bytes: 1736
A,B,C = map(int, input().split())

ret = 0

if not (A%2 == B%2 and B%2 == C%2):
    # どれか一つにイレギュラーがある
    ret += 1
    if A%2 == B%2:
        A += 1
        B += 1
    elif B%2 == C%2:
        B += 1
        C += 1
    else:
        A += 1
        C += 1

max_elem = max(A,B,C)
# print((A,B,C),max_elem, (max_elem-A)//2, (max_elem-B)//2, (max_elem-C)//2)
ret += (max_elem-A)//2 + (max_elem-B)//2 + (max_elem-C)//2

print(ret)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <map>
using namespace std;
#define lli long long int

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int r;
	cin>>r;
	int ans = 3*r*r;
	cout<<ans<<endl;
	return 0;
}

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

typedef long long ll;
const ll INF = 1LL << 60;

ll N, K;
vector<ll> dp, h;

int main() {
    cin >> N >> K;
    h.resize(N);
    dp.resize(N + K + 5);
    rep(i, N) cin >> h[i];
    rep(i, N + K + 5) dp[i] = INF;

    dp[0] = 0;
    rep(i, N) {
        for (ll j = 1; j <= K; j++) {
            if (i + j >= N) break;
            dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] - h[i]));
        }
    }

    cout << dp[N - 1] << endl;
}

Measured memory_bytes: 1792
n,q = map(int ,input().split())
s = input()

nums = [0]*len(s)
for i in range(1,n):
  if s[i-1] == "A" and s[i] == "C": nums[i] = nums[i-1] + 1
  else: nums[i] = nums[i-1]

for _ in range(q):
  l,r = map(lambda x: int(x)-1, input().split())
  print(nums[r]-nums[l])

Measured memory_bytes: 11476
#import sys
#import numpy as np
n = int(input())
#input = sys.stdin.readline
#a = np.array(list(map(int, input().split())))
a = list(map(int, input().split()))
for i in a:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            print('DENIED')
            exit()
print('APPROVED')


Measured memory_bytes: 2940
#define _CRT_NONSTDC_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <list>
#include <iomanip>
#include <queue>
#include <functional>
#include <cassert>
#include <cmath>
#include <set>
#include <map>
#include <numeric>

#define NL << endl

using namespace std;
using ll = long long;
const int INTMAX = numeric_limits<int>::max();
const int INTMIN = numeric_limits<int>::min();
const ll LLMAX = numeric_limits<long long>::max();
const ll LLMIN = numeric_limits<long long>::min();
const int MOD = 1000000007;
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }

using namespace std;


int main() {

	int n;
	cin >> n;
	vector<int> p(n);
	for (auto& e : p) {
		int t;
		cin >> t;
		e = t - 1;

	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (i == p[i]) {
			ans++;
			i++;
		}
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#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, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main(){	
	cin.tie(0);
   	ios::sync_with_stdio(false);
	
	string a, x, c;
	cin >> a >> x >> c;
	
	cout << a[0] << x[0] << c[0] << '\n';

	return 0;
}


Measured memory_bytes: 256
using System;

public class Hello
{
    public static void Main()
    {
        var a2 = 0; var a4 = 0;
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        for (int i = 0; i < n; i++)
        {
            var a = int.Parse(line[i]);
            if (a % 4 == 0) a4++;
            else if (a % 2 == 0) a2++;
        }
        Console.WriteLine(checkP(n - a2 - a4, a2, a4) ? "Yes" : "No");
    }
    public static bool checkP(int a1, int a2, int a4)
    {
        if (a4 == 0) return a2 >= 2 && a1 == 0;
        else
        {
            var c = 0;
            if (a2 >= 1) c = a1 + 1;
            else c = a1;
            return c <= a4 + 1;
        }
    }
}


Measured memory_bytes: 18016
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,b) FOR(i,0,b)
#define INF 1e9

using ll = long long;
const ll mod = LLONG_MAX;

string a,b,c;
int main(){
  cin>>a>>b>>c;
  if(a[a.size()-1]==b[0] && b[b.size()-1]==c[0]){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <set>
#include <assert.h>
#include <sstream>
#include <string>
//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater <>())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
typedef std::pair<int,int> P;
using namespace std;
using ll = long long;





// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&t=1619
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

bool check(vector<int> a, vector<int>b, int n){
    rep(i,n){
        if (a[i]!= b[i]) rn false;
    }
    rn true;
}

int main(){

    int n;
    cin >> n;
    vector<int> p(n);
    vector<int> q(n);
    rep(i,n) cin>> p[i];
    rep(i,n) cin >> q[i];
    vector<int> a(n);
    rep(i,n) a[i] = i+1;
    int A = 0;
    int B = 0;
    int i = 0;
    do{
        if (check(a,p,n)) A = i;
        if( check(a,q,n)) B = i;
        i ++;
    } while(next_permutation(a.begin(),a.end()));
    cout << abs(A-B);
rn 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {
	int N;
	int[] a;
	int[] color = {400,800,1200,1600,2000,2400,2800,3200,4801};

	public void solve() {
		N = nextInt();

		a = new int[color.length+1];

		for(int i = 0;i < N;i++){
			int x = nextInt();

			for(int j = 0;j < color.length;j++){
				if(x < color[j]){
					a[j]++;
					break;
				}
			}
		}

		int count = 0;
		for(int i = 0;i < color.length-1;i++){
			if(a[i] > 0){
				count++;
			}
		}
		int min = count;
		int max = count + a[color.length-1];

		if(count == 0 && a[color.length-1] > 0){
			min = 1;
		}

		out.println(min + " " + max);
	}

	public static void main(String[] args) {
		out.flush();
		new Main().solve();
		out.close();
	}

	/* Input */
	private static final InputStream in = System.in;
	private static final PrintWriter out = new PrintWriter(System.out);
	private final byte[] buffer = new byte[2048];
	private int p = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (p < buflen)
			return true;
		p = 0;
		try {
			buflen = in.read(buffer);
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (buflen <= 0)
			return false;
		return true;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrint(buffer[p])) {
			p++;
		}
		return hasNextByte();
	}

	private boolean isPrint(int ch) {
		if (ch >= '!' && ch <= '~')
			return true;
		return false;
	}

	private int nextByte() {
		if (!hasNextByte())
			return -1;
		return buffer[p++];
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = -1;
		while (isPrint((b = nextByte()))) {
			sb.appendCodePoint(b);
		}
		return sb.toString();
	}

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

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

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

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

// Loops
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define _rrep(i, n) rrepi(i, n, 0)
#define rrepi(i, a, b) for (int i = int(a) - 1; i >= int(b); --i)

#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(xi, x) for (auto &&xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)

// typedef
template <class T> using vec = vector<T>;
using ll = long long;
using vi = vec<ll>;
using vvi = vec<vi>;
using vvvi = vec<vvi>;
using pii = pair<ll, ll>;

// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define mp make_pair

// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase(unique(all(v)), v.end())
#define perm(c)                                                                \
  sort(all(c));                                                                \
  for (bool c##p = 1; c##p; c##p = next_permutation(all(c)))

template <class T> pair<T, size_t> max(vector<T> &x) {
  auto it = max_element(all(x));
  return mp(*it, it - x.begin());
}
template <class T> pair<T, size_t> min(vector<T> &x) {
  auto it = min_element(all(x));
  return mp(*it, it - x.begin());
}

template <class T> inline bool chmax(T &maxval, const T &newval) {
  if (maxval < newval) {
    maxval = newval;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &minval, const T &newval) {
  if (minval > newval) {
    minval = newval;
    return 1;
  }
  return 0;
}

// Utilities
// Grid world utilities
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
#define inside(H, W, y, x) 0 <= (x) && (x) < (W) && 0 <= (y) && (y) < (H)

// Debug
#ifdef LOCAL
#include "dump.hpp"
#define debug(x) cerr << #x << ": " << x << '\n'
#else
#define dump(...)
#define debug(x)
#endif

// Yes or No
void yesno(bool ok, string yes = "Yes", string no = "No") {
  cout << (ok ? yes : no) << endl;
}

// Paste snippets here!!
ll pow5(ll a){
  ll ret = a*a;
  return ret*ret*a;
}
//

void solve(long long X) 
{
  ll a, b; bool fin = false;
  for(a=0;a<150;++a){
    for(b=-150;b<a;++b){
      ll score = pow5(a)-pow5(b);
      //dump(a,b,score, X);
      if(score==X) { fin = true; break; }
    }
    if(fin) break;
  }
  cout << a << " " << b << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false); // Magic for faster cin
  cout.precision(12);
  long long X;
  std::cin >> X;
  solve(X);
  return 0;
}


Measured memory_bytes: 3612
#include <iostream>

using namespace std;

typedef long long ll;

void extgcd(ll a, ll b, ll& d, ll& x, ll& y) {
    if (b == 0) {
        x = 1;
        y = 0;
        d = a;
    }
    
    else {
        extgcd(b, a % b, d, y, x);
        y -= x * (a / b);
    }  
}

int main() {
    ll a, b;
    cin >> a >> b;
    ll d, x, y;
    extgcd(a, b, d, x, y);
    cout << x <<" " << y << endl;
    return 0;
}

Measured memory_bytes: 3116
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

struct mint {
  ll x;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};

mint factorial(ll n) {
  mint answer = 1;
  while (n > 1) {
    answer *= n;
    n--;
  }
  return answer;
}

mint combination(ll n, ll r) {
  return factorial(n) / (factorial(r) * factorial(n - r));
}

mint permutation(ll n, ll r) { return factorial(n) / factorial(n - r); }

// setprecision(8) 桁数指定
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

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

template <typename T>
void remove(std::vector<T>& vector, unsigned int index) {
  vector.erase(vector.begin() + index);
}

map<ll, ll> prime_factor(ll n) {
  map<ll, ll> ret;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}
// for (auto p : prime_factor(n)) {
//	while (p.second--) {
//		cout << p.first << endl;
//	}
//}

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

bool compare_by_b(pair<ll, ll> a, pair<ll, ll> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

vector<ll> Eratosthenes(const ll N) {
  bool is_prime[1000000 + 1];
  vector<ll> P;
  for (ll i = 0; i <= N; i++) {
    is_prime[i] = true;
  }
  for (ll i = 2; i <= N; i++) {
    if (is_prime[i]) {
      for (ll j = 2 * i; j <= N; j += i) {
        is_prime[j] = false;
      }
      P.emplace_back(i);
    }
  }
  return P;
}

typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

int main() {
  int n;
  cin >> n;
  ivec l(n), r(n);
  REP(i, n) { cin >> l[i] >> r[i]; }
  int ans = 0;
  REP(i, n) {
    ans += r[i] - l[i];
    ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

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

        int n = sc.nextInt();

        double ans = 0;

//        if (n%2==0){
//            System.out.println(n/2);
//        }else {
            System.out.println(((double)(n-(n/2))/(double)n));
//        }

    }
}

Measured memory_bytes: 21844
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		String S = stdIn.next();
		if(S.equals("ABC")){
			System.out.println("ARC");
		}
		else{
			System.out.println("ABC");
		}
		stdIn.close();
	}
}

Measured memory_bytes: 35552
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

int main(void)
{
    IOS
    string s;
    cin >> s;
    sort(ALL(s));
    ATYN(s == "abc")

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<iomanip>
using namespace std;
int main() {
	double x1, y1, x2, y2, tate, yoko;
	cin >> x1 >> y1 >> x2 >> y2;
	tate = y1 - y2;
	yoko = x1 - x2;
	if (tate < 0){
		tate = tate*(-1);
	}
	if (yoko < 0){
		yoko = yoko*(-1);
	}
	double answer = sqrt(tate*tate + yoko*yoko);
	cout << std::setprecision(12) << answer << endl;
	return 0;
}


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

using namespace std;
typedef long long LL;

#ifdef BTK
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww {cww() {CIN_ONLY{ios::sync_with_stdio(false); cin.tie(0);}}
}star;
#define DEBUG if(0)
#endif

#define ALL(v) (v).begin(),(v).end()
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l, T r){bool a = l>r; if (a)l = r; return a;}
template <typename T>inline bool chmax(T &l, T r){bool a = l<r; if (a)l = r; return a;}
template <typename T>istream& operator>>(istream &is, vector<T> &v){for (auto &it : v)is >> it;return is;}

class range {private: struct I { int x; int operator*() { return x; }bool operator!=(I& lhs) { return x<lhs.x; }void operator++() { ++x; } }; I i, n;public:range(int n) :i({ 0 }), n({ n }) {}range(int i, int n) :i({ i }), n({ n }) {}I& begin() { return i; }I& end() { return n; }};

int main() {
	LL A, B, C, K;
	while (cin >> A >> B >> C >> K) {
		if (K % 2)cout << B - A << endl;
		else cout << A - B << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
    using namespace std ;
    #define endl '\n'
    #define lld long long int 
    #define ull unsigned long long int 
    ull power(ull x, ull y){ull temp;if( y == 0)return 1;temp = power(x, y/2); if (y%2 == 0) return temp*temp;else return x*temp*temp; } 
    ull gcdFactor(ull n){ ull tmp=n,res=0;for(ull i=1 ; i*i <=tmp ; i++){if(tmp%i==0){res++;if(tmp/i!=i)res++;}}return res;}
    #define ullmax ULLONG_MAX
    void solution(void);
    int main()
    {
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        solution();
        return 0;
    }
    
    
    // The difference between the novice and the master is that the master has failed more than the novice has tried  
    // It is not over when you lose it is over when you quit
    // If you have time to think for a beautiful end, then live beautifully until the end
    
    
    void solution(){
        int a ;
        string st;
        cin>>a;
        cin>>st;
        if(a>=3200)
            cout<<st;
        else
            cout<<"red";
    }

Measured memory_bytes: 256
package main

import (
	"bufio"
	_ "container/heap"
	"fmt"
	"os"
	_ "sort"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	return a / gcd(a, b) * b
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
const MOD = int(1e+9) + 7
const INF = 1 << 60

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	defer wtr.Flush()
	N := sc.nextInt()
	A := sc.nextIntSlice(N)
	r := 0
	now := 0
	ans := 0
	for l := 0; l < N; l++ {
		for r < N && now&A[r] == 0 {
			now += A[r]
			r++
		}
		ans += r - l
		if l == r {
			r++
		}
		now -= A[l]
	}

	fmt.Fprintln(wtr, ans)
}


Measured memory_bytes: 3840
import sys
input = sys.stdin.readline

def gcd(a, b):
    while b:
        a, b = b, a%b
    return a

def lcm(a, b):
    return a*b//gcd(a, b)

N, M = map(int, input().split())
a = list(map(int, input().split()))
b = [ai//2 for ai in a]
cnt = [0]*N

for i in range(N):
    tmp = b[i]
    
    while tmp%2==0:
        tmp //= 2
        cnt[i] += 1

if len(set(cnt))!=1:
    print(0)
    exit()
    
L = 1

for bi in b:
    L = lcm(L, bi)

L2 = 1

for ai in a:
    L2 = lcm(L2, ai)

if L>M:
    print(0)
else:
    print((M-L)//L2+1)


Measured memory_bytes: 60900
A, B, Q = map(int, input().split())
S = [-10**18]+sorted([int(input()) for _ in range(A)])+[10**18]
T = [-10**18]+sorted([int(input()) for _ in range(B)])+[10**18]
import bisect
for _ in range(Q):
  x = int(input())
  i = bisect.bisect_left(S, x)
  j = bisect.bisect_left(T, x)
  p, q, r, s = S[i-1], S[i], T[j-1], T[j]
  res = 10**18
  for a in (p, q):
    for b in (r, s):
      res = min(res, abs(x-a)+abs(a-b), abs(x-b)+abs(a-b))
  print(res)

Measured memory_bytes: 18476
import Control.Arrow
import Control.Monad
import Data.Bits
import Data.Char
import Data.List

main :: IO ()
main = do
  [n, x] <- getInts
  ms <- replicateM n getInt
  print $ n + (x - sum ms) `div` minimum ms

getInt :: IO Int
getInt = readLn

getInts :: IO [Int]
getInts = map read . words <$> getLine


Measured memory_bytes: 1020
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n+1);
  for(int i=0; i<n-1; i++){
    int x;
    cin >> x;
    a[x]++;
  }
  for(int i=1; i<=n; i++){
    cout << a[i] << endl;
  }
} 

Measured memory_bytes: 4052
import sys
from scipy.sparse.csgraph import shortest_path
import numpy as np

stdin = sys.stdin

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split())) # applies to numbers only
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces

N, M = rl()
edges = [rl() for _ in range(M)]
graph = np.zeros((N, N))

for a, b, c in edges:
    graph[a-1, b-1] = c

dist = shortest_path(graph, directed=False).astype(int)
answer = 0
for a, b, c in edges:
    if c != dist[a-1, b-1]:
        answer += 1

print(answer)
#05

Measured memory_bytes: 18492
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int N; cin >> N;
    int n = bit(N);
    vec S(n); cin >> S;
    map<int, int> cnt;
    REP(i, n) cnt[-S[i]] += 1;

    priority_queue<int> pq;
    pq.push(N);
    for(auto k: cnt){
        int m = k.s;
        if(SZ(pq) < m){
            Out("No");
            return 0;
        }
        vec v;
        REP(i, m){
            v.pb(pq.top());
            pq.pop();
        }
        REP(i, m){
            REP(j, v[i]) pq.push(j);
        }
    }
    Out("Yes");

    return 0;
}


Measured memory_bytes: 19836
#include <stdio.h>

int right(int x, int y, int z);

int main(void)
{
    int n, x, y, z;
    scanf("%d", &n);
    for (int i = 0; i < n; i ++) {
	scanf("%d %d %d", &x, &y, &z);
	if (right(x, y, z) == 1) {
	    printf("YES\n");
	} else {
	    printf("NO\n");
	}
    }
    return 0;
}

int right(int x, int y, int z)
{
    if (x * x == y * y + z * z) {
	return 1;
    } else if (y * y ==  x * x + z * z) {
	return 1;
    } else if (z * z == x * x + y * y) {
	return 1;
    } else {
	return 0;
    }
}

Measured memory_bytes: 1008