akhauriyash/Code-Regression huggingface dataset:
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <cstdint>
#include <chrono>

using namespace std;
#define     loop(n,i,a)     for(ll i=a;i<n;i++)
#define     loopR(n,i,a)    for(ll i=a-1;i>=n;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<ll,ll>
#define     vi              vector<int>
#define     vll             vector<ll>
#define     vii             vector<pii>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            "\n"
#define     Endl            "\n"
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
template<typename T>void max_self(T &a,T b){a=max(a,b);}
template<typename T>void min_self(T &a,T b){a=min(a,b);}
int dx[] = { 1 , 0 ,-1 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 1 , 0 ,-1 ,-1 , 1 ,-1 , 1 };
int KnightI[] = { 2, 1, -1, -2, -2, -1, 1, 2 };
int KnightJ[] = { 1, 2, 2, 1, -1, -2, -2, -1 };
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
const ll mxN=4e5+10,oo=0x3f3f3f3f,MOD=1e9+7;
const long double PI = acos(-1),eps=1.0e-14;

void solve(){
    int n;
    cin>>n;
    if(n==25)
        cout<<"Christmas"<<endl;
    else if(n==24)
        cout<<"Christmas Eve"<<endl;
    else if(n==23)
        cout<<"Christmas Eve Eve"<<endl;
    else
        cout<<"Christmas Eve Eve Eve"<<endl;
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast();
    solve();

}


Measured memory_bytes: 3640
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

using i64 = int64_t;

int N, M, A[303][303];

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    cin >> N >> M;
    for (int j = 0; j < N; ++j) {
        for (int k = 0; k < M; ++k) {
            cin >> A[j][k];
        }
    }

    char held[303];
    fill(held, held+M+1, true);
    queue<int> que[303];
    for (int j = 0; j < N; ++j) {
        for (int k = 0; k < M; ++k) {
            que[j].push(A[j][k]);
        }
    }

    int ans = N;

    int count[303];
    for (int n = 0; n < M; ++n) {
        fill(count, count+M+1, 0);
        for (int j = 0; j < N; ++j) {
            assert(!que[j].empty());
            while (!held[que[j].front()]) que[j].pop();
            ++count[que[j].front()];
        }
        int idx = -1;
        for (int j = 1; j <= M; ++j) {
            if (idx == -1 || count[idx] < count[j]) {
                idx = j;
            }
        }
        ans = min(ans, count[idx]);
        held[idx] = false;
    }
    cout << ans << endl;



    return 0;
}


Measured memory_bytes: 1152
N = int(input())
A = list(map(int, input().split()))
flag = True
ans = 0
while(1):
    for i in range(N):
        if A[i] % 2 != 0:
            flag = False
            break
    if flag:
        A = list(map(lambda x:x/2, A))
        ans += 1
    else:
        break

print(ans)



Measured memory_bytes: 3060
#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;
    template <typename T>
    using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
    #define int long long  
    typedef long double ld;
    typedef long long ll;
    #define pb push_back
    #define f(i,a,b) for(int i=a;i<b;i++)
    #define fd(i,a,b) for(int i=a-1;i>=b;i--)
    #define pf push_front
    #define fi first
    #define se second
    #define take(a,n) f(i,0,n)cin>>a[i];
    #define show(a,n) f(i,0,n){cout<<a[i]<<" ";}
    #define ashow(a)  for(auto i:a)cout<<i<<" ";
    #define khtm     cout<<endl;
    #define all(s) s.begin(),s.end()
    #define len(a) a.length()
    #define INF 1e18
    #define MAXN 2000009
    const double pi=3.14159265358979323;
    const int mod=1e9+7;
    int ng(int n){
      int i=0;
      while(n>pow(2,i))
        i++;
      i--;
      return pow(2,i)-1-n;

    }
     signed main() {
     // -------------------------------------Code starts here--------------------------------------------------------------------- 
    int t=1;
    // cin>>t;
    while(t--)
    {
        int n,k,x=0,y=0;
        int mx=-1,mi=INF,mn=INF;
        int tm=0;
        vector<int>ans;
        // string s;

     cin>>n;
     // set<int>s;
     int a[n];
     int m[1000005]={};
      
     for(int i=0;i<n;i++){
      cin>>a[i];
      m[a[i]]++;}
    for(int i=0;i<n;i++){
      y=1;
      for(int j=2;j<=sqrt(a[i]);j++){
        if(a[i]%j==0){
          // if((j==a[i]||a[i]/j==a[i])&&m[a[i]]==1)y=1;
          if(m[j]||m[a[i]/j]){y=0;break;}
        }
      }
      if(a[i]!=1&&m[1]>0)y=0;
      if(m[a[i]]>1)y=0;
  if(y==1)x++;
    }
    cout<<x<<endl;

         


        }


 }


Measured memory_bytes: 12972
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.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())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n,a[100010],ans[100010]={},m=0;
    vll v;
    map<ll,ll> mp,cnt;
    cin>>n;
    rep(i,n){
        cin>>a[i];
        v.pb(a[i]);
        m=max(m,a[i]);
        cnt[a[i]]++;
        if(mp[a[i]]==0) mp[a[i]]=i+1;
    }
    sort(all(v));
    ERASE(v);
    reverse(all(v));
    if(v[v.size()-1]!=1){
        v.pb(1);
        mp[1]=1;
    }
    ll now=cnt[m],index=mp[m];
    ans[index]+=now;
    rep2(i,1,(ll)v.size()){
        ans[index]+=now*(v[i-1]-v[i]-1);
        index=min(index,mp[v[i]]),now+=cnt[v[i]];
        ans[index]+=now;
        // cout<<v[i]<<" "<<index<<" "<<now<<endl;
    }
    rep2(i,1,n+1){
        cout<<ans[i]<<endl;
    }
  cerr<<0<<endl;
    return 0;
}


Measured memory_bytes: 15860
#include <bits/stdc++.h>
using namespace std;
int main () {
  string S, T;
  cin >> S >> T;
  int w = S.size();
  int e = T.size();
  int count = 0;
  int ans = 0;
  for(int i = 0; i < w - e + 1; i++) {
    for(int j = i; j < i + e; j++) {
      if(S[j] == T[j - i]) {
        ans++;
      }
    }
    count = max(ans, count);
    ans = 0;
  }
  cout << e - count << endl;
}

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

namespace abc174_d
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = CIn.ReadInt();
            var c = CIn.Read();
            var red = 0;
            var ans = 0;
            for (var i = 0; i < N; i++)
            {
                if (c[i] == 'R')
                {
                    red += 1;
                }
            }
            for (var j = red; j < N; j++)
            {
                if (c[j] == 'R')
                {
                    ans += 1;
                }
            }
            Console.WriteLine(ans);
        }
    }
    class CIn
    {
        private static readonly Queue<string> fieldBuffer = new Queue<string>();

        public static string Read()
        {
            if (fieldBuffer.Count == 0)
            {
                foreach (var field in Console.ReadLine().Split())
                {
                    fieldBuffer.Enqueue(field);
                }
            }

            return fieldBuffer.Dequeue();
        }

        public static int ReadInt() => int.Parse(Read());
        public static long ReadLong() => long.Parse(Read());
        public static double ReadDouble() => double.Parse(Read());

        public static string[] ReadStringArray(long n)
        {
            var array = new string[n];

            for (var i = 0; i < n; i++)
            {
                array[i] = Read();
            }

            return array;
        }

        public static int[] ReadIntArray(long n)
        {
            var array = new int[n];

            for (var i = 0; i < n; i++)
            {
                array[i] = ReadInt();
            }

            return array;
        }

        public static long[] ReadLongArray(long n)
        {
            var array = new long[n];

            for (var i = 0; i < n; i++)
            {
                array[i] = ReadLong();
            }

            return array;
        }
        public static double[] ReadDoubleArray(long n)
        {
            var array = new double[n];

            for (var i = 0; i < n; i++)
            {
                array[i] = ReadDouble();
            }

            return array;
        }
    }

}


Measured memory_bytes: 28636
import           Data.Array.Unboxed
import           Data.Bool

main :: IO ()
main = do
    [h, w] <- map read.words <$> getLine
    css <- lines <$> getContents
    putStrLn . bool "No" "Yes" $ solve h w css

solve :: Int -> Int -> [String] -> Bool
solve h w css = and[isValid (i, j)|i<-[0..h-1],j<-[0..w-1]]
  where
    m :: UArray (Int, Int) Char
    m = listArray ((0, 0), (h - 1, w - 1)) $ concat css
    next (x, y) = [(x+1,y),(x-1,y),(x,y+1),(x,y-1)]
    inGrid (x,y) = 0 <= x && x < h && 0 <= y && y < w
    neighbors = filter inGrid . next
    isValid (x, y) = m ! (x, y) == '.' || any (\(nx, ny)-> m ! (nx, ny) == '#') (neighbors (x, y))


Measured memory_bytes: 1020
N, M = map(int, input().split())
P = list(map(int, input().split()))
P = list(enumerate(P, start=1))


class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)
        self.size = [1] * (n+1)

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.rank[x] < self.rank[y]:
            self.par[x] = y
            self.size[y] += self.size[x]
            self.size[x] = 0
        else:
            self.par[y] = x
            self.size[x] += self.size[y]
            self.size[y] = 0
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # 同じ集合に属するか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y)


uf = UnionFind(N)
for m in range(M):
    x, y = map(int, input().split())
    uf.union(x, y)

ans = 0
for now, value in P:
    if uf.same_check(now, value):
        ans += 1
print(ans)

Measured memory_bytes: 100716
// AOJ 0563: Walking Santa
// 2017.10.25 bal4u@uu

#include <stdio.h>
#include <stdlib.h>

char buf[65], *p;
int getInt(void)
{
	int n;
	if (*p == ' ') p++;
	n = 0; while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	return n;
}

typedef struct { int x, y; } PP;
PP pp[100002]; int n;

int xcmp(PP *a, PP *b) { return a->x - b->x; }
int ycmp(PP *a, PP *b) { return a->y - b->y; }

long long calc(int x0, int y0, int yid)
{
	int i, dx, dy;
	long long sum, ans, d, max;
	PP *p;

	sum = 0, max = 0, ans = 1LL << 60;
	for (p = pp, i = 0; i <= yid; i++, p++) {
		dx = x0 - p->x, dy = y0 - p->y;
		if (dx < 0) dx = -dx;
		d = dx + dy;
		sum += d << 1;
		if (d > max) max = d;
	}
	for ( ; i < n; i++, p++) {
		dx = x0 - p->x, dy = p->y - y0;
		if (dx < 0) dx = -dx;
		d = dx + dy;
		sum += d << 1;
		if (d > max) max = d;
	}
	if (sum - max < ans) ans = sum - max;
	return ans;
}

int main()
{
	int w, h, i, m, x1, x2, y1, y2, x0, y0;
	long long ans, a;
	PP *pt;

	fgets(p=buf, 64, stdin), w = getInt(), h = getInt();
	fgets(p=buf, 64, stdin), n = getInt();
	for (pt = pp, i = n; i--; pt++) {
		fgets(p=buf, 64, stdin);
		pt->x = getInt(), pt->y = getInt();
	}
	m = (n-1)/2;
	qsort(pp, n, sizeof(PP), xcmp);
	x0 = x1 = pp[m].x, x2 = pp[m+1].x;
	qsort(pp, n, sizeof(PP), ycmp);
	y0 = y1 = pp[m].y, y2 = pp[m+1].y;

	ans = calc(x0, y0, m);
	if (!(n & 1)) {
		if (x1 == x2 && y1 == y2);
		else if (x1 == x2) {
			a = calc(x0, y2, m+1);
			if (a < ans) ans = a, y0 = y2;
		} else if (y1 == y2) {
			a = calc(x2, y0, m);
			if (a < ans) ans = a, x0 = x2;
		} else {
			a = calc(x1, y2, m+1);
			if (a < ans) ans = a, x0 = x1, y0 = y2;
			a = calc(x2, y1, m);
			if (a < ans) ans = a, x0 = x2, y0 = y1;
			a = calc(x2, y2, m+1);
			if (a < ans) ans = a, x0 = x2, y0 = y2;
		}
	}
	printf("%lld\n%d %d\n", ans, x0, y0);
	return 0;
}

Measured memory_bytes: 3412
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> V;

int main() {
  int n;
  cin >> n;
  V a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  int res = 1e9;
  for (int i = -100; i <= 100; i++) {
    int sum = 0;
    for (int j = 0; j < n; j++) {
      sum += (a[j]-i) * (a[j]-i);
    }
    res = min(res, sum);
  }
  dump(res);
  return 0;
}


Measured memory_bytes: 256
<?php

fscanf(STDIN, "%d", $n);

$data = array();
for ($i = 0; $i < $n; $i++) {
	fscanf(STDIN, "%d %d %d", $data['t'][$i], $data['x'][$i], $data['y'][$i]);
}

for ($i = 0; $i < $n; $i++) {
	$sum_xy = $data['x'][$i] + $data['y'][$i];
	if ($sum_xy > $data['t'][$i]) {
		die('No');
	}
	if ($sum_xy % 2 !== $data['t'][$i] % 2) {
		die('No');
	}
}

print('Yes');

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

int main() {

	int n; cin >> n;
	vector<ll> a(n), b(n), c(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> b[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> c[i];
	}
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	sort(c.begin(), c.end());
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		ll tmp = b[i];
		ll cnt_a = lower_bound(a.begin(), a.end(), tmp) - a.begin();
		ll cnt_c = c.end() - upper_bound(c.begin(), c.end(), tmp);
		ans += cnt_a * cnt_c;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5644
H,W = gets.split.map(&:to_i)

r = *0..W
r[0] = 1 # 0 は欠番
nmin = [0]*W
nmin[rmin=0] = W
puts $<.map.with_index(1){|ln,k|
	next -1 if rmin < 0
	a,b = ln.split.map(&:to_i)

	i,c = a
	until b < i
		j = r[i]
		if i < j
			i = j
		else
			c = j
			nmin[i-c] -= 1
			i += 1
		end
	end
	if c && b<W
		rb = r[b+1]
		nmin[b+1-rb] -= 1 if rb<c
		if b+1 < rb || rb < c
			r[b+1] = c
			nmin[b+1-c] += 1
		end
	end
	r.fill(b+1,a..b)

	rmin = (rmin...W).find{|v| 0<nmin[v] }||~k
	next k+rmin
}


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

#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,n,a) for(int i = (int)(n); i >= (int)(a); i--)
#define fi first
#define se second

using ll = long long;
using v_int = std::vector<int>;
using v2_int = std::vector<v_int>;
using v_ll = std::vector<ll>;
using v2_ll = std::vector<v_ll>;
using v_string = std::vector<std::string>;
using v_bool = std::vector<bool>;
using v2_bool = std::vector<v_bool>;
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;
using mii = std::map<int, int>;
using mll = std::map<ll, ll>;

const double PI = 3.1415926535897932;
const int INF = 2*(int)1e9;
const ll LINF = (ll)1e18;
const ll MOD = 1000000007;
//const int dc[4] = {1, -1, 0,  0};
//const int dr[4] = {0,  0, 1, -1};
const int dr[8] = {0,  0, 1, -1, 1,  1, -1, -1};
const int dc[8] = {1, -1, 0,  0, 1, -1,  1, -1};

using namespace std; 

template<typename T, typename U> inline
ostream& operator<<(ostream &o, pair<T,U> &p)
{
    return o << "{" << p.first << "," << p.second << "}";
}

template<typename T> inline
istream& operator>>(istream &is, vector<T> &v)
{
    int len = (int)v.size();
    for(int i = 0; i < len; i++) {
        is >> v[i]; 
    }
    return is;
}

template<typename T> inline
ostream& operator<<(ostream &os, vector<T> &v)
{
    int len = (int)v.size();
    for(int i = 0; i < len; i++) { 
        os << v[i];
        if(i != len-1) { os << ","; } 
    } 
    return os;
}

template<typename T> inline
void chmin(T &a, T b) { a = min(a, b); }

template<typename T> inline
void chmax(T &a, T b) { a = max(a, b); }

int main(void) 
{
    int n;
    cin >> n;
    mii mp;

    irep(i, n) {
        int a;
        cin >> a;
        mp[a]++;
    }
    
    v_int cnt(1000001);
    
    for(auto a : mp) {
        for(int j = a.fi * 2; j <= 1000001; j+=a.fi) {
            cnt[j]++;
        }
    }
    
    int ans = n;
    for(auto a : mp) {
        if(a.se > 1) {
            ans -= a.se;
        } else {
            if(cnt[a.fi]) { ans--; }
        }
    }
    cout << ans << endl;
    return 0;
}
/*atcoder*/


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

step00=int((n/108*100))
step01=int((n/108*100))-1
step02=int((n/108*100))+1





step10=int((step00/100*108))
step11=int((step01/100*108))
step12=int((step02/100*108))

nocnt=0
ok=0

if step10!=n:
  nocnt=nocnt+1
else:
    print(step00)
    ok=1


if step11!=n:
  nocnt=nocnt+1
else:
    if ok==0:
        print(step10)
        ok=1


if step12!=n:
  nocnt=nocnt+1
else:
    if ok==0:
        print(step02)
        ok=1

if nocnt>=3:
    print(':(')


Measured memory_bytes: 3064
X,N = map(int,input().split())
p = list(map(int,input().split()))


ans_list = []
for i in range(102):
    ans_list.append([abs(X-i),i])
ans_list = sorted(ans_list)
flag = True
for j in range(102):
    for k in range(N):
         if(p[k]==ans_list[j][1]):
             flag = False
    if(flag):
        print(ans_list[j][1])
        break
    flag = True

Measured memory_bytes: 9016
#include <iostream>
#include<algorithm>
#include<string>
#include<map>
#include<iomanip>
#include<vector>
#include<cmath>
#define mod 1000000007
#define pa(a,b) make_pair(a,b)
#define LL  long long int
using namespace std;
int buf[50];
inline void write(int x)
{
	int p=0;
	do{
		buf[p++]=x%10;
		x/=10;
	}while(x>0);
	for(int i=p-1;i>=0;i--)putchar('0'+buf[i]);
}
long long int read_int(){
	char r;
	bool start=false,neg=false;
	long long int ret=0;
	while(true){
		r=getchar();
		if((r-'0'<0 || r-'0'>9) && r!='-' && !start){
			continue;
		}
		if((r-'0'<0 || r-'0'>9) && r!='-' && start){
			break;
		}
		if(start)ret*=10;
		start=true;
		if(r=='-')neg=true;
		else ret+=r-'0';
	}
	if(!neg)
		return ret;
	else
		return -ret;
}
int main()
{
    /*Rating 1-399 : gray
Rating 400-799 : brown
Rating 800-1199 : green
Rating 1200-1599 : cyan
Rating 1600-1999 : blue
Rating 2000-2399 : yellow
Rating 2400-2799 : orange
Rating 2800-3199 : red
*/
int  n ; int a[20020]; cin>>n; for(int i=0;i<n;i++)cin>>a[i];
int mx=0,mi=0; int num[20020]={0};
for(int i=0;i<n;i++)
{
    if(a[i]>=1&&a[i]<=399)num[1]=1;
    else if(a[i]>=400&&a[i]<=799)num[2]=1;
    else if(a[i]>=800&&a[i]<=1199)num[3]=1;
    else if(a[i]>=1200&&a[i]<=1599)num[4]=1;
    else if(a[i]>=1600&&a[i]<=1999)num[5]=1;
    else if(a[i]>=2000&&a[i]<=2399)num[6]=1;
    else if(a[i]>=2400&&a[i]<=2799)num[7]=1;
    else if(a[i]>=2800&&a[i]<=3199)num[8]=1;
    else mx++;
}
for(int i=1;i<=8;i++)if(num[i])mi++;
cout<<max(mi,1 )<<" "<<mi+mx;
}


Measured memory_bytes: 384
/*  
    Talkin' to myself and feelin' old
    Sometimes I'd like to quit, nothin' ever seems to fit
    Hangin' around, nothin' to do but frown
    Rainy days and Mondays always get me down
    _________________________
    _________________________
    936 Hours of Solitude
    Quarantine_Day : 39
*/

#include<bits/stdc++.h>

using namespace std;

typedef long long int       ll;
typedef vector<int>         vi;
typedef vector<ll>          vl;
typedef pair<int, int>      pii;
typedef pair<ll, ll>		pll;

#define pb(n)           push_back(n)
#define GSORT(v)        sort(v.begin(), v.end(), greater<int>())
#define SORT(v)         sort(v.begin(), v.end());
#define REV(v)          reverse(v.begin(), v.end());
#define db(a)           cout<<#a<<" = "<<a<<endl;
#define FIN             freopen("in.txt","r",stdin);
#define FOUT            freopen("out.txt","w",stdout);
#define REP(i,n)        for(int i = (int)(0); i < (int)(n); i++)
#define FOR(i, a, b)    for(int i = (int)a; i <= (int)b; i++)    

#define MAX 90

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

    ll n, a, b;
    cin>>n>>a>>b;

    ll ans = 0;
    FOR(i, 1, n){
        ll m = i;
        ll sum = 0;
        while(m){
            sum += m % 10;
            m /= 10;
        }
        if(sum >= a && sum <= b) ans += i;
    }
    cout<<ans<<"\n";

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
     
    using namespace std;
     
    const int N = 1e5 + 5;
     
    typedef long long ll;
     
    typedef pair <int, ll> pll;
     
    vector <pll> g[N];
    int n;
    ll d[N];
    int a[N];
     
    int main() {
      int n, k; cin >> n >> k;
      double ans = 0.0;
      for(int i = 1; i <= n; i++) {
        double pro = 1.0;
        int cur = i;
        while(cur < k) {
          cur *= 2;
          pro = (pro * 0.5);
        }
        ans += pro * (1.0 / (double)n);
      }
      printf("%0.14lf\n", ans);
    }

Measured memory_bytes: 2560
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <map>
#include <stack>

#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int INF = pow(2,29);
const int MOD = 1000000007;

struct str{ int t, d; } sushi[(int)pow(10,5)+10];

bool cmp(str a, str b) { return a.d > b.d; }

int main() {
  int N, K; cin >> N >> K;
  rep(i, N) {
    int t, d; cin >> sushi[i].t >> sushi[i].d;
  }
  sort(sushi, sushi+N, cmp);

  stack<int> ss;
  map<int, int> type;
  ll result = 0, tp = 0, sum = 0;
  rep(i,K) { 
    if (!type[sushi[i].t]) { type[sushi[i].t]=1; tp++; }
    else ss.push(sushi[i].d);
    sum += sushi[i].d;
  }
  result = sum + tp*tp;

  for(int i=K; i<N; i++) {
    if (ss.empty()) break;
    if (type[sushi[i].t]) continue;
    type[sushi[i].t] = 1;
    tp++;
    sum -= ss.top(); ss.pop();
    sum += sushi[i].d;
    result = max(result, sum + tp*tp);
    // cout << i << " " << sum << " " << tp << endl;
  }
  // rep(i,N) cout << sushi[i].t << " " << sushi[i].d << endl;
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;;
#define ll long long
#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 INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
typedef unsigned long long int  ull;
const int MOD = 1000000007;
 
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;



ull check_bit(ull N,int POS){return (N & (1ULL<<POS));}

vector<ull>v;
ull gaussian_elimination()
{
    int n=v.size();
    int ind=0;  // Array index
    for(int bit=log2(v[0]);bit>=0;bit--)
    {
        int x=ind;
        while(x<n&&check_bit(v[x],bit)==0)
          x++;
        if(x==n)
          continue; // skip if there is no number below ind where current bit is 1
        swap(v[ind],v[x]);
        for(int j=0;j<n;j++)
        {
            if(j!=ind&&check_bit(v[j],bit))
                v[j]^=v[ind];
        }
        ind++;
    }
    ull ans=v[0];
    for(int i=1;i<n;i++)
      ans=max(ans,ans^v[i]);
    return ans;
}
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin >> n;
  ull all = 0;
  ll mbit = 0;
  rep(i,n){
      ull tmp; cin >> tmp;
      v.push_back(tmp);
      all = all^tmp;
  }
  rep(i,n){
      v[i] = v[i] & (~all);
  }
  sort(v.rbegin(), v.rend());
  cout  << 2 * gaussian_elimination() + all << endl;
}

Measured memory_bytes: 1400
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
  long long int k;
  cin>>k;
  long long int t;
  cin>>t;
  vector<long long int> a(t);
  for(long long int i=0; i<t; i++){
    cin>>a.at(i);
  }
  sort(a.begin(),a.end());
  while(a.size()>1){
    a.at(a.size()-1)-=a.at(0);
    a.erase(a.begin());
    sort(a.begin(),a.end());
  }
  if(a.at(0)==0){
    a.at(0)=1;
  }
  cout<<a.at(0)-1<<endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.PrintWriter;
public class Main{
	static ArrayList<Integer>[] edge;
	static long mod=1000000007;
	static long[][] dp;
	static long ans;
	static boolean[] visited;
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		edge=new ArrayList[n];
		dp=new long[n][2];
		visited=new boolean[n];
		for(int i=0; i<n; i++){
			Arrays.fill(dp[i],1);
		}
		for(int i=0; i<n; i++){
			edge[i]=new ArrayList<>();
		}
		for(int i=1; i<n; i++){
			int x=sc.nextInt()-1;
			int y=sc.nextInt()-1;
			edge[x].add(y);
			edge[y].add(x);
		}
		for(int i=0; i<n; i++){
			if(!visited[i]){
				dfs(i,i);
				ans=(dp[i][0]+dp[i][1])%mod;
			}
		}
		System.out.println(ans);
	}
	static void dfs(int now,int from){
		if(visited[now]){
			return;
		}
		visited[now]=true;
		for(int i:edge[now]){
			if(i!=from){
				dfs(i,now);
				dp[now][0]=(dp[now][0]*(dp[i][0]+dp[i][1]))%mod;
				dp[now][1]=dp[now][1]*dp[i][0]%mod;
			}
		}
	}
}

Measured memory_bytes: 120988
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {

    int n;
    cin >> n;
    vector<int> xs(n), rs(n);
    double ok = 0, ng = 1000000;
    for (int i = 0; i < n; ++i) {
        scanf("%d %d", &xs[i], &rs[i]);
        if(ng > rs[i]) ng = rs[i];
    }
    for (int i = 0; i < 100; ++i) {
        double mid = (ok+ng)/2;
        double lb = -1e10, ub = 1e10;
        for (int j = 0; j < n; ++j) {
            double r = sqrt((ll)rs[j]*rs[j]-mid*mid);
            lb = max(lb, xs[j]-r);
            ub = min(ub, xs[j]+r);
        }
        if(ub >= lb) ok = mid;
        else ng = mid;
    }
    printf("%.15lf\n", ok);
    return 0;
}


Measured memory_bytes: 3628
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<ll> vl;
typedef vector<vector<int, int> > vvi;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
int main(){
    int n; 
    cin >> n;
    vi a;
    vi b;
    vi c;
    int x;
    
    for(int i = 0; i < n; i++){
        cin >> x;
        a.pb(x);
    }
    for(int i = 0; i < n; i++){
        cin >> x;
        b.pb(x);
    }
    for(int i = 0; i < n-1; i++){
        cin >> x;
        c.pb(x);
    }
    
    int sum = 0;
    for(int i = 0; i < n; i++){
        sum+=b[a[i]-1];
    }
    for(int i = 0; i < (n-1); i++){
        if((a[i+1]-a[i])==1){
            sum+=c[a[i]-1];
        }
    }
    cout << sum;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define PB push_back
#define MP make_pair
#define endl '\n'
#define pri 1000000007
#define all(x) x.begin(),x.end()
#define mnx 1000001
#define pr pair<ll,ll>
using namespace std;

void masterstroke(){
ll n,k;
cin>>n>>k;

ll z=((n-1)*(n-2)/2ll-k);
if(z<0){cout<<-1<<endl;return;}
ll c=n-1+z;
cout<<c<<endl;
for(ll i=2;i<=n;i++){
	cout<<1<<" "<<i<<endl;
}
c-=(n-1);
for(ll i=2;i<=n&&c>0;i++){
	for(ll j=(i+1);j<=n&&c>0;j++){
		cout<<i<<" "<<j<<endl;
		c--;
	}
}


}


int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll t=1;
	//cin>>t;
	for(ll i=0;i<t;i++)masterstroke();
}


Measured memory_bytes: 256
#define __mode_debug__
/*   ξ
     ll
   ＿ll＿
 ／  ∞  ＼
│*  Ａ  *│
│*  Ｃ  *│
│*  祈  *│
│*  願  *│
│*      *│
 ￣￣￣￣￣    */
//C++14 (GCC 5.4.1)
#include <bits/stdc++.h>
using namespace std;
#ifdef __mode_debug__
    #define DBG
#else
    #define DBG if(false)
#endif

#define LLINF (1LL<<60)
typedef long long ll;
#define mod 1000000007

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define rrepd(i,a,b) for(int i=(a);i>=(b);i--)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)

template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); }

//DUMP
//  ostream vector<T> , vector<vector<T>> , set<T> ,queue<T> , priority_queue<T> , pair<T,U> , map<T,U>
template<class T> ostream& operator<<(ostream&os,vector<T>&vec){os<<"{ ";rep(i,vec.size()) os<<((i==0)?"":", ")<<i<<":"<<vec[i];os<<" }";return os;}
template<class T> ostream& operator<<(ostream&os,vector<vector<T>>&vec){os<<"{"<<endl;rep(i,vec.size())os<<"\t   "<<i<<":"<<vec[i]<<((i==vec.size()-1)? "":",")<<endl;os<<"\t }";return os;}
template<class T> ostream& operator<<(ostream&os,set<T>&p){os<<"{ ";repi(itr,p)  os<<((itr==p.begin())?"":", ")<<*itr;os<<" }";return os;}
template<class T> ostream& operator<<(ostream&os,queue<T>&p){queue<T> q(p);os<<"[< "<<(q.empty()?" <]":"");while(!q.empty()){os<<q.front();q.pop();os<< (q.empty() ? " <]" : ", ");}return os;}
template<class T> ostream& operator<<(ostream&os,priority_queue<T>&p){priority_queue<T> q(p);os<<"[< "<<(q.empty()?" <]":"");while(!q.empty()){os<<q.top();q.pop();os<< (q.empty() ? " <]" : ", ");}return os;}
template<class T,class U> ostream& operator<<(ostream&os,pair<T,U>&p){os<<"("<<p.first<<","<<p.second<<")";return os;}
template<class T,class U> ostream& operator<<(ostream&os,map<T,U>&p){os<<"{ ";repi(itr,p)os<<((itr==p.begin())?"":", ")<<itr->first<<":"<<itr->second;os<<" }";return os;}
void dump_f(string &nm){cerr<<endl;}
template<class T,class... Ts> void dump_f(string &nm,T &&x,Ts&&... ts){int l=nm.find_first_of(',');string name(nm,0,l),nx(nm,l+1,-1);cerr<<"  "<<name<<"\t:"<<x<<endl;dump_f(nx,forward<Ts>(ts)...);}
    template<class... Ts> void dump_m(int &&ln,string &&nm,Ts&&... ts){cerr<<"[ln:"<<ln<<"]"<<endl;dump_f(nm,forward<Ts>(ts)...);}
    #define dump(...) DBG dump_m(__LINE__,#__VA_ARGS__,__VA_ARGS__)

    #define lower_bound_idx(V,c) distance(V.begin(),lower_bound(V.begin(),V.end(),c))

bool issosu(int X){
    if(X<2)return false;
    if(X==2)return true;
    for(int i=2;i*i<=X;i++){
        if(X%i==0)return false;
    }
    return true;
}

int main() {
    ios::sync_with_stdio(false);//stdoutとcoutの同期解除
    cin.tie(nullptr);//cinとcoutの同期解除
    
    int X;
    cin >>X;

    while(1){
        if(issosu(X)) break;
        X++;
    }

    cout << X <<endl;
    return (0);
}

Measured memory_bytes: 256
fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn main() {
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let n: usize = scan(tokens);
    let a: usize = scan(tokens);
    let b: usize = scan(tokens);
    println!("{}", n / (a + b) * a + std::cmp::min(a, n % (a + b)));
}


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

int n, pos;
vector<int> pre, in, post;

void rec(int l, int r) {
    if (l>=r) return;
    int root = pre[pos++];
    int m = distance(in.begin(), find(in.begin(), in.end(), root));
    rec(l, m);
    rec(m+1, r);
    post.push_back(root);
}

void solve() {
    pos = 0;
    rec(0, pre.size());
    for (int i=0; i<n; i++) {
        if(i) cout << " ";
        cout << post[i];
    }
    cout << endl;
}

int main() {
    int k;
    cin >> n;
    
    for (int i=0; i<n; i++) {
        cin >> k;
        pre.push_back(k);
    }
    
    for (int i=0; i<n; i++) {
        cin >> k;
        in.push_back(k);
    }
    
    solve();
    return 0;
}



Measured memory_bytes: 3164
#include <stdio.h>
 
int main(){
    int n, i, a, min, max;
    long sum;
    scanf("%d %d", &n, &min);
    max = min;
    sum = min;
    for(i = 1; i < n; i++){
        scanf("%d", &a);
        if(min > a){
            min = a;
        }
        if(max < a){
            max = a;
        }
        sum += a;
    }
    printf("%d %d %ld\n", min, max, sum);
    return 0;
}
 

 

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
int b;
int main() {
	cin>>b;
	if (b<1200){
		cout<<"ABC"<<endl;
	}
	if (b>=1200&&b<2800){
		cout<<"ARC"<<endl;
	}
	if (b>=2800){
		cout<<"AGC"<<endl;
	}
}

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

const int nmax=2001; 
int DP[2001][2001];
int a[nmax],b[nmax];
 
int n, m;


int main() {
    ll N,X,Y; 
    ll i,j;
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N >> X >> Y;
    // cout << N<< " " <<X<< " " << Y << endl;
    ll ans[N+1];
    for(i=0; i<= N; i++) {
        ans[i]=0;
        // cout << "H " << ans[i] << endl;
    }for(i=1; i<= N-1; i++){
        for(j=i+1; j <= N; j++){
            ll d;
            d = min(j-i,abs(j-Y)+ 1 + abs(X-i));
            //cout << d << endl;
            ans[d] = ans[d] +1;
        }
         
    }
    for(ll i =1; i <=N-1; i++){
        cout << ans[i] << endl;
    }

}




Measured memory_bytes: 256
s = input()
ki = {'R', 'U', 'D'}
gu = {'L', 'U', 'D'}
flg = True
for i in s[0::2]:
  if i in ki:
    continue
  else:
    flg = False
for i in s[1::2]:
  if i in gu:
    continue
  else:
    flg = False
print('Yes' if flg else 'No')
  

Measured memory_bytes: 2940
#include<stdio.h>

int main(){
	int N;
	int a[1000],b[1000],c[1000];
	int i;

	scanf("%d",&N);

	for(i=0;i<N;i++){
		scanf("%d",&a[i]);
		scanf("%d",&b[i]);
		scanf("%d",&c[i]);
	}

	for(i=0;i<N;i++)
	if(a[i]*a[i]==b[i]*b[i]+c[i]*c[i] || b[i]*b[i]==a[i]*a[i]+c[i]*c[i] || c[i]*c[i]==a[i]*a[i]+b[i]*b[i])
		   printf("YES\n");
	else
		printf("NO\n");

	return 0;
}

Measured memory_bytes: 588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cout << #x << ": " << x << endl
#define repn(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, a) for(int i = 0; i < (a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define endl '\n'

int dp[100005];
//Number of stones
//It is 1 if the person, whose move it is, wins from this many stones

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int n, k;
	cin >> n >> k;
	int a[n];
	rep(i, n){
		cin >> a[i];
	}
	repn(i, 1, k + 1){
		rep(j, n){
			if(i - a[j] >= 0 && !dp[i - a[j]]){
				dp[i] = 1;
				break;
			}
		}
	}	
	cout << (dp[k] ? "First" : "Second") << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 640
import collections

N = int(input())
V = list(map(int, input().split()))
odd = V[::2]
even = V[1::2]
odd_count =  collections.Counter(odd).most_common()
even_count = collections.Counter(even).most_common()

if odd_count[0] == even_count[0]:
  if len(odd_count) == 1:
    ans = N//2
  elif odd_count[1][1] == odd_count[0][1] or even_count[1][1] == even_count[0][1]:
    ans = N-(odd_count[0][1] + even_count[0][1])
  else:
    ans = N-max(odd_count[0][1] + even_count[1][1], odd_count[1][1]+ even_count[0][1])
else:
  ans = N-(odd_count[0][1] + even_count[0][1])

print(ans)

Measured memory_bytes: 21084
// @author: hzy
//#pragma G++ optimize("O3")

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <cstring>
#include <iostream>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <list>
#include <forward_list>
#include <stack>
#include <unordered_set>
#include <vector>
#include <limits.h>

#define DISPLAY_A 0

using namespace std;

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    int n;
    cin >> n;
    vector<int> A(n), B(n);
    for (int i = 0; i < n; i++) {
        cin >> A[i] >> B[i];
    }
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    if (n % 2) {
        // n is odd
        int minMedian = A[n / 2];
        int maxMedian = B[n / 2];
        cout << maxMedian - minMedian + 1 << endl;
    } else {
        // n is even
        int minMedian = (A[n / 2 - 1] + A[n / 2]) / 2;
        int maxMedian = (B[n / 2 - 1] + B[n / 2]) / 2;
        int ans = (maxMedian - minMedian) * 2 + 1;
        if ((A[n / 2 - 1] + A[n / 2]) % 2) {
            // .5
            ans -= 1;
        }
        if ((B[n / 2 - 1] + B[n / 2]) % 2) {
            ans += 1;
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 4780
import bisect as bs
N, K = (int(x) for x in input().split())
A = sorted([int(x) for x in input().split()])
f = lambda X, x: bs.bisect_right(X,x)-bs.bisect_left(X,x)
cnt = sorted([f(A,a) for a in set(A)],reverse=True)
vrt = len(cnt)
print(sum(cnt[K:]) if vrt > K else 0)

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

// macros
#define pb emplace_back
#define mk make_pair
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define irep(itr, st) for(auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for(auto itr = (st).rbegin(); itr != (st).rend(); ++itr)
#define whole(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define bit(n) (1LL<<(n))
#define F first
#define S second
// functions
template <typename T> void unique(T& c){c.erase(std::unique(c.begin(), c.end()), c.end());}
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(a > b){a = b; return 1;} return 0;}
template <typename T> istream &operator>>(istream &is, vector<T> &vec){for(auto &v: vec)is >> v; return is;}
template <typename T> ostream &operator<<(ostream &os, const vector<T>& vec){for(int i = 0; i < vec.size(); i++){ os << vec[i]; if(i + 1 != vec.size())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p){os << "(" << p.first << ", " << p.second << ")"; return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << "(" << itr->first << ", " << itr->second << ")"; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const unordered_map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << "(" << itr->first << ", " << itr->second << ")"; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
//  types
using ll = long long int;
using P = pair<int, int>;
// constants
const int inf = 1e9;
const ll linf = 1LL << 60;
const double EPS = 1e-10;
const int mod = 1000000007;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
// io
struct fast_io{
  fast_io(){ios_base::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(20);}
} fast_io_;


int main(int argc, char const* argv[])
{
  ll d, t, s; cin >> d >> t >> s;
  if(t * s >= d)cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3616
/* *>>>>>Anshit_Bhardwaj<<<<<* */
#include <bits/stdc++.h>
#define ll long long
#define f(i, x, n) for(int i = x; i < n; i++)
#define dbg(x) cout << x << endl
#define dbg2(x, y) cout << x << ' ' << y << endl
#define dbg3(x, y, z) cout << x << ' ' << y << ' ' << z << endl
#define mod 1000000007
using namespace std;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    cout << ((n < 30)? "No" : "Yes") << endl;
}

Measured memory_bytes: 3608
import heapq,math
n, m = map(int, input().split())
a =[int(i) *(-1) for i in input().split()]
heapq.heapify(a)
for _ in range(m):
    amin = heapq.heappop(a)
    heapq.heappush(a, amin/2)
ans = 0
for _a in a:
    ans += math.floor(_a * (-1))
print(ans)

Measured memory_bytes: 14536
using System;

class Program
{
  static void Main(string[] args)
  {
    string[] input = Console.ReadLine().Split(' ');
    string a = input[0];
    string b = input[1];
    string c = input[2];
    
    if(a[a.Length - 1] == b[0] && b[b.Length - 1] == c[0]) Console.WriteLine("YES");
    else Console.WriteLine("NO");
  }
}

Measured memory_bytes: 11092
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <queue>

using namespace std;

const int N = 101;
const int INF = 1000000000;

int node, limit, fr, edge, start, goal;
// n, m, l, k, a, h
set<int> Fr;
int G[N][N];

class S{
public:
  int p, d, t;
  S(int p, int d, int t):p(p), d(d), t(t){}
  bool operator < (const S &s) const {
    return s.d < d;
  }
};

int sssp(){
  int dist[N][N];
  fill(dist[0], dist[N], INF);
  bool vis[N][N];
  fill(vis[0], vis[N], false);
  priority_queue<S> q;
  q.push(S(start, 0, limit));
  while(!q.empty()){
    S u = q.top();
    q.pop();
    if(vis[u.p][u.t]) continue;
    vis[u.p][u.t] = true;
    if(u.p == goal) return u.d;
    if(Fr.count(u.p)){
      for(int i=0;u.t+i<=limit;i++){
        if(!vis[u.p][u.t+i]){
          if(dist[u.p][u.t+i] > u.d+i){
            dist[u.p][u.t+i] = u.d + i;
            q.push(S(u.p, u.d+i, u.t+i));
          }
        }
      }
    }
    for(int i=0;i<node;i++){
      if(G[u.p][i] == INF) continue;
      if(u.t-G[u.p][i] < 0) continue;
      dist[i][u.t-G[u.p][i]] = min(dist[i][u.t-G[u.p][i]], u.d + G[u.p][i]);
      if(!vis[i][u.t-G[u.p][i]]) q.push(S(i, u.d + G[u.p][i], u.t-G[u.p][i]));
    }
  }
  return -1;
}

main(){
  while(cin >> node >> limit >> fr >> edge >> start >> goal){
    if((node | limit | fr | edge | start | goal) == 0) break;
    fill(G[0], G[N], INF);
    Fr.clear();
    for(int i=0;i<fr;i++){
      int in;
      cin >> in;
      Fr.insert(in);
    }
    for(int i=0;i<edge;i++){
      int a, b, c;
      cin >> a >> b >> c;
      G[a][b] = G[b][a] = c;
    }
    int res = sssp();
    if(res < 0) cout << "Help!" << endl;
    else cout << res << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define lli long long int
#define vec2 vector<vector<lli>> 
#define fio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define FRE freopen("explicit.in","r",stdin);freopen("explicit.out","w",stdout)
#define pll pair <lli,lli>
#define vll vector <lli>
#define vpll vector <pll>
#define f first
#define s second
#define pb push_back
#define priq priority_queue
#define unm unordered_map
#define pf push_front
#define minii LLONG_MAX
#define all(x) x.begin(), x.end()
#define mem(a,b) memset(a,b,sizeof(a))
#define ld double
#define eb emplace_back
const long double pi = 3.1415926535898;
const lli mod=1e9+7;
//const lli mod=100000000;
using namespace std;
lli lcm (lli a, lli b) {return ((a*b)/__gcd(a,b));}
lli modpower (lli a,lli b)
{
    if(b==0) return 1;
    lli c=modpower(a,b/2)%mod;
    if (b%2) return (((a*c)%mod)*c)%mod;
    else return (c*c)%mod;
}
lli power (lli a,lli b)
{
    if(b==0) return 1;
    lli c=power(a,b/2);
    if (b%2) return (a*c*c);
    else return c*c;
}
bool prime (lli k)
{
    if (k==1||k==0) return 0;
    bool flag=1;
    lli a=sqrt(k);
    for (int i=2;i<=a;i++)
    {
        if (k%i==0)
        {flag=0;break;}
    }
    return flag;
}
lli sieve (int n)
{
    bool qrr[n+1];
    for (int i=0;i<=n;i++)
    qrr[i]=1;qrr[0]=0;qrr[1]=0;
    for (int i=2;i*i<=n;i++)
    {
        if (qrr[i]==1)
        {
            for (int j=2*i;j<=n;j+=i)
            {qrr[j]=0;}
        }
    }
    return 0;
}
int main()
{
    fio;
    lli n,k;
    cin>>n>>k;
    lli a[n];
    for (int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    int b[2*k+5];
    mem(b,-1);
    for (int i=0;i<k;i++)
    {
        if (b[i]==0)
        continue;
        for (int j=0;j<n;j++)
        {
            b[i+a[j]]=0;
        }
    }
    
    if (b[k]==-1)
    {
        cout<<"Second";
    }
    else
    {
        cout<<"First";
    }
    return 0;
}

Measured memory_bytes: 4448
#include <iostream>
#include <stdio.h>
#include <sstream>
using namespace std;

int main() {
	string s;
	cin >> s;
	int sp = -1,ep = -1;
	for (int i = 0;i < s.size();i++) {
		if (s[i] == 'A'&&sp == -1) sp = i;
		if (s[s.size()-i - 1] == 'Z' && ep == -1) ep = s.size()-i - 1;
	}
	cout << ep - sp + 1 << endl;
}

Measured memory_bytes: 640