akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cmath>
#include <climits>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <cassert>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <fstream>
#include <functional>
#include <utility>
#include <map>
#include <set>
#include <vector>
#include <list>
#include <iomanip>


#define memtst(x) (sizeof(x) / 1024. / 1024.)
#define mem0(x) memset((x), 0, (sizeof x))
#define meminf(x) memset((x), INF, (sizeof x))
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define pq std::priority_queue
#define iter iterator
#define mp(x, y) std::make_pair((x), (y))
#define fst first
#define sec second
#define lc(x) ((x) * 2)
#define rc(x) ((x) * 2 + 1) 
#define md(x, y) (((x) + (y)) / 2)


typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef std::pair <int, int> pii;


const double PI = acos(-1);
const double EPS = 1e-6;
const ll MOD = 1000000007;
const ll INF = 0x3F3F3F3F;


template <typename T>
inline T Abs(T x)
{
	return x < 0 ? x * -1 : x;
}


template <typename T>
inline T Max(T x, T y, T z)
{
	return std::max(std::max(x, y), z);
}
template <typename T>
inline T Min(T x, T y, T z)
{
	return std::min(std::min(x, y), z);
}


template <typename T>
inline void Ckmax(T &x, T y)
{
	x = std::max(x, y);
}


template <typename T>
inline void Ckmin(T &x, T y)
{
	x = std::min(x, y);
}


template <typename T>
inline T Sqr(T x)
{
	return x * x;
}


template <typename T>
inline T Pow(T x, T y)
{
	T r = 1;
	while (y > 0)
	{
		if (y % 2 > 0)
			(r *= x) %= MOD;
		(x *= x) %= MOD;
		y /= 2;
	}
	return r % MOD;
}


template <typename T>
T Pow(T x, T y, T z)
{
	T r = 1;
	while (y > 0)
	{
		if (y % 2 > 0)
			(r *= x) %= z;
		(x *= x) %= z;
		y /= 2;
	}
	return r % z;
}


template <typename T>
inline T gcd(T x, T y)
{
	return y > 0 ? gcd(y, x % y) : x;
}


template <typename T>
inline T lcm(T x, T y)
{
	return x / gcd(x, y) * y;
}


inline void cinspu(void)
{
	std::ios::sync_with_stdio(0);
	std::cin.tie(0);
}


inline ll read(void)
{
	char x;
	while (x = getchar(), x != '-' && !isdigit(x))
		;
	char flg = x == '-';
	ll num = (flg ? getchar() : x) - '0';
	while (isdigit(x = getchar()))
		(num *= 10) += x - '0';
	return flg ? -num : num;
}

int main()
{
	int a, b;
	std::cin >> a >> b;
	std::cout << a + b / 2 << std::endl;
	return 0;
}

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

#ifdef LOCAL
#define debug(var) cerr << #var << " = " << var << endl;
#else
#define debug(var)
#endif

void init() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
}

void solve() {
	string a, b; cin >> a >> b;
	if (a.size() > b.size()) {
		cout << "GREATER";
		return;
	}
	if (a.size() < b.size()) {
		cout << "LESS";
		return;
	}
	if (a == b) {
		cout << "EQUAL";
		return;
	}
	for (int i = 0; i < (int)a.size(); ++i) {
		if (a[i] == b[i]) continue;
		if (a[i] < b[i]) {
			cout << "LESS";
		} else {
			cout << "GREATER";
		}
		break;
	}
}

int main() {
	init();
	int t = 1; //scanf("%d", &t);
	while (t--) {
		solve();
	}
	return 0;
}


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

def test(s, mx):
    if len(s) == n:
        print(s)
    else:
        for c in range(ord('a'), mx+1): 
            if c == mx:
                test(s+chr(c), mx+1)
            else:
                test(s+chr(c), mx)
test('',ord('a'))

Measured memory_bytes: 56920
N, M = gets.split(" ").take(2).map(&:to_i)
Graph = M.times.map{ gets.split(" ").take(2).map(&:to_i).map(&:pred) }

def f(n, graph)
  total = 0

  g = lambda{|curr, gr, visited|
    visited[curr] = true
    if visited.all?
      total += 1
      return
    end
    gr.each_with_index{|(a, b), i|
      if a == curr || (b == curr).tap{ a, b = b, a }
        next if visited[b]
        #p [a, b, visited, i]
        _gr = gr.clone; _gr.delete_at(i)
        g.(b, _gr, visited.clone)
      end
    }
  }

  visited = [false]*n
  g.(0, graph, visited)
  total
end

puts f(N, Graph)


Measured memory_bytes: 1916
//A,Elebereth Gilthoniel mantae!
//For Temeria!
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<cstdio>
#include<map>
#include<stack>
#include<queue>
#include<cstring> 
using namespace std;
long long ar[200008];
set<long long> s[3];
void wrong()
{
	cout<<-1;exit(0);
}
int main()
{
 	//freopen("","r",stdin);
	//freopen("","w",stdout);
	 long long n;cin>>n;for(long long i=0;i<n;i++) cin>>ar[i+1];
	 long long now=0;long long ans=0;
	 if(ar[1]!=0) wrong();
	 for(long long i=n;i>=1;i--)
	 {
	 	s[now].insert(ar[i]-i);
	 	s[now].erase(-i);
	 
	 	long long t=-1;if(s[now].size())t=*(--s[now].end())+(i);
	 //	cout<<i<<" "<<s[now].size()<<"\n";
	 	ans+=s[now].size();if(t>ar[i]) wrong();

	 }cout<<ans;
	return 0;
}

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

using namespace std;

typedef long long ll;
int N, M;
bool heiro;

struct edge{
  int from;
  int to;
  ll cost;
  edge(int f,int t, ll c) : from(f),to(t),cost(c) {}
};

vector <edge> e;
ll ans[1001];
const ll INF = -1e15;


void bellman(int v) {
  for(int j = 0; j < N; j++) {
    for(int i = 0; i < e.size(); i++) {
      if(ans[e[i].from] != INF && ans[e[i].to] < ans[e[i].from] + e[i].cost) {
	ans[e[i].to] = ans[e[i].from] + e[i].cost;
      }
    }
  }
}


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

  for(int i = 0; i < M; i++) {
    int a,b; ll c;
    cin >> a >> b >> c;
    a--; b--;
    e.push_back(edge(a,b,c));
  }
  
  
  fill(ans,ans+N,INF);
  ans[0] = 0;
  bellman(0);
  ll heiro = ans[N-1];
  bellman(0);
  if(ans[N-1] <= heiro) cout << ans[N-1] <<endl;
  else cout << "inf" <<endl;

  //for(int i = 0; i < N; i++) cout <<ans[i]<<endl;
 
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<numeric>

int main(){

    size_t r, c;
    std::cin >> r >> c;

    std::vector<std::vector<size_t>> mat(r, std::vector<size_t>(c));
    std::vector<size_t> sum1(r), sum2(c);

    for(size_t i = 0; i < r; i++){
        for(size_t j = 0; j < c; j++){
            std::cin >> mat[i][j];
            sum1[i] += mat[i][j];
        }
    }

    for(size_t i = 0; i < c; i++){
        for(size_t j = 0; j < r; j++){
            sum2[i] += mat[j][i];
        }
    }

    for(size_t i = 0; i < r; i++){
        for(size_t j = 0; j < c; j++){
            std::cout << mat[i][j] << ' ';
        }

        std::cout << sum1[i] << std::endl;
    }

    for(const auto& e : sum2){
        std::cout << e << ' ';
    }
    std::cout << std::accumulate(sum1.begin(), sum1.end(), 0ul) << std::endl;

    return 0;
}



Measured memory_bytes: 3144
#include <iostream>
#include <string>

using namespace std;

int main(){
    long long int n;
    string str;
    cin >> n;
    if(n == 0){
        cout << 0 << endl;
    }else{
        while(n != 0){
            if(n%2==0){
                str.insert(0, "0");
                n = n/2*(-1);
            }else{
                str.insert(0, "1");
                n = (n - 1)/2*(-1);
            }
        }
        cout << str << endl;
    }
    return 0;
}

Measured memory_bytes: 256
a,b,c,d = list(str(input()))
op = ('+', '-')
for i in range(2):
  for j in range(2):
    for k in range(2):
      result = eval(a + op[i] + b + op[j] + c + op[k] + d)
      if result == 7:
        print(a + op[i] + b + op[j] + c + op[k] + d + '=7')
        exit()

Measured memory_bytes: 3064
<?php
$n = trim(fgets(STDIN));
for($i=0; $i<$n; $i++){
    $arr[] = explode(" ",trim(fgets(STDIN)));
}

foreach( $arr as $key => $row ) {
  $city[$key] = $row[0];
  $score[$key] = $row[1];
}

$keys = array_keys($arr);
array_multisort($city, SORT_ASC, SORT_STRING,$score, SORT_DESC, SORT_NUMERIC,$arr,$keys);
$array = array_combine($keys, $arr);

foreach($array as $k => $value){
    echo $k+1;
    echo "\n";
}
?>


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

typedef long long LL;

const int N=200000;

int n;
char s[N+9];

void into(){
  scanf("%d%s",&n,s+1);
}

int dp[N+9][2];

void Get_dp(){
  for (int i=1;i<=n;++i){
	dp[i][0]=dp[i-1][0]+(s[i]=='#');
	dp[i][1]=min(dp[i-1][0],dp[i-1][1])+(s[i]=='.');
  }
}

void work(){
  Get_dp();
}

void outo(){
  printf("%d\n",min(dp[n][0],dp[n][1]));
}

int main(){
  into();
  work();
  outo();
  return 0;
}

Measured memory_bytes: 5596
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
#define pb push_back
#define mp make_pair
#define F .first
#define S .second 
using ll=long long;
using ld=long double;
using namespace std;
const ll mod=1e9+7;
ll a[110000],s[110000];
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }

int main(){
    ll n,k,ans=0;
    cin>>k;
    rep(i,1,k+1){
        rep(j,1,k+1){
            rep(x,1,k+1)ans+=GCD(GCD(i,j),x);
        }
    }
    cout<<ans;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;cin>>N;
  double ans;ans=0;
  if(N%2==0){
    ans=1.0/2.0;
  }
  else{
    ans=((N-1.0)/2.0+1.0)/N;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
/* I have already deleted My old account because somebody stole my code
and i have no idea how. If you are copying this code atleast make it look different 
Yours Faithfully
Shobhit Yadav */

#include<bits/stdc++.h>
using namespace std;
#define ll long long 

ll N,T;
/*ll freq[200005];*/
void solve(){
	 /*memset(freq,0,sizeof(freq));*/
	cin>>N;
	string s;
	cin>>s;
	ll val = N;
	ll length = 0;


	for(ll i = 0 ; i<N-1 ; i++){
		if(s[i] == s[i+1]){
			length++;
		}

	
	}
	
 val -= length;

	cout<<val<<'\n';
}



int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
   T = 1;
   while(T--) solve();

	return 0;
}

Measured memory_bytes: 3772
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#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 rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
const long long INFLL = 1LL << 60;
const int INFINT = 1 << 30;
const long long MOD = 1e9 + 7;

int main() {
    int N, A;
    set<int> SET;
    cin >> N;
    rep(i, N) {
        cin >> A;
        SET.insert(A);
    }
    cout << (SET.size() == N ? "YES" : "NO") << endl;
}


Measured memory_bytes: 13004
from operator import itemgetter


def solve():
    N, M = map(int, input().split())
    AB = [[0, 0] for _ in range(N)]
    for i in range(N):
        AB[i][0], AB[i][1] = map(int, input().split())

    AB.sort(key=itemgetter(0))

    ans, cnt = 0, 0
    for i in range(N):
        if M <= cnt + AB[i][1]:
            ans += AB[i][0] * (M - cnt)
            break
        else:
            ans += AB[i][0] * AB[i][1]
            cnt += AB[i][1]
    print(ans)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 21284
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstring>

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

using namespace std;

int myPower(int a, int n) { // aのn乗の計算
	int x = 1;
	while (n > 0) { // 全てのbitが捨てられるまで
		if ( n & 1) { // 一番右のbitが１のとき
			x *= a;
		}
		a *= a;
		n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
	}
	return x;
}

int main() {
	int i, j;
	char s[3], t[3];
	cin >> s;
	cin >> t;
	int count = 0;
	roop(i, 3) {
		if (s[i] == t[i]) {
			count++;
		}
	}
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 256
import sys
n,k,q=map(int,input().split())
a=[]
for i in range(q):
    a.append(int(input()))
p=[k-q]*n
for i in range(q):
    p[a[i]-1]+=1
#print(p)
for i in range(n):
    if p[i]<=0:
        print('No')
    else:
        print('Yes')




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

typedef long long ll;

int q;
ll con = 0;
priority_queue<int> L;
priority_queue<int, vector<int>, greater<> > R;
ll lsum = 0, rsum = 0;

int main() {
    cin >> q;
    while(q--) {
        int type;
        cin >> type;
        if(type == 1) {
            int a, b; cin >> a >> b;
            con += b;
            if(L.empty() || a <= L.top()) L.push(a), lsum += a;
            else R.push(a), rsum += a;
            while(L.size() < R.size()) {
                rsum -= R.top();
                int x = R.top(); R.pop();
                lsum += x;
                L.push(x);
            }
            while(L.size() > R.size() + 1) {
                lsum -= L.top();
                int x = L.top(); L.pop();
                rsum += x;
                R.push(x);
            }
//
//            cout << L.size() << " " << R.size() << endl;
//            if(!L.empty()) cout << "L top: " << L.top() << endl;
//            if(!R.empty()) cout << "R top : " << R.top() << endl;
        }
        else {
            cout << L.top() << " ";
            ll sum = 1LL * L.top() * L.size() - lsum + rsum - 1LL * L.top() * R.size() + con;
            cout << sum << endl;
        }
    }
}

Measured memory_bytes: 3452
//雪花飄飄北風嘯嘯
//天地一片蒼茫

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define fi first
#define se second
#define endl '\n'
#define debug(x) cout << #x << " is " << x << endl;

#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()

ll MAX(ll a){return a;}
ll MIN(ll a){return a;}
template<typename... Args>
ll MAX(ll a,Args... args){return max(a,MAX(args...));}
template<typename... Args>
ll MIN(ll a,Args... args){return min(a,MIN(args...));}

#define indexed_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	int a;
	cin>>a;
	cout<<a+a*a+a*a*a<<endl;
}


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

#define limit (int)(2e5 + 5)
// #define mod (int)(1e9 + 7)
#define pb push_back
#define fi first
#define se second

using namespace std;
using lli = long long int;
using ulli = unsigned long long int;
using ld = long double;


lli a[limit];
int main() {

	int n;
	cin >> n;

	for (int i = 0; i < n; ++i)
	{
		cin >> a[i];
	}

	lli sum = 0;

	for (int i = 0; i < n/2; ++i)
	{
		sum = sum^( a[2*i] ^ a[2*i+1] );
	}

	lli t;

	for (int i = 0; i < n; ++i)
	{
		t = sum^a[i];
		cout << t << " ";
	}
	return 0;
}

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

using ll = long long;

int main() {
  ll n, k; cin >> n >> k;
  vector<ll> lp(n), lc(n);
  for (int i = 0; i < n; ++i) {
    cin >> lp[i];
    --lp[i];
  }
  for (int i = 0; i < n; ++i) {
    cin >> lc[i];
  }
  ll ans = -1e10;
  vector<bool> used(n, false);
  for (int i = 0; i < n; ++i) { 
    if (used[i]) continue;
    int fr = i;
    ll sum = 0;
    vector<int> ids;
    while (!used[fr]) {
      ids.push_back(fr);
      used[fr] = true;
      int to = lp[fr];
      fr = to;
      sum += lc[to];
    }
    ll sc = 0;
    ll ma = -1e10;
    int N = ids.size();
    if (sum > 0) {
      sc += sum * (k/N);
      ans = max(ans, sc);
      int l = k%N;
      for (int j = 0; j < N; ++j) {
        ll s = 0;
        for (int m = 0; m < l; ++m) {
          int to = ids[(j+m)%N];
          s += lc[to];
          // cerr << j << " " << m << " " << s << endl;
          ma = max(ma, s);
        }
      }
    }
    {
      ll sc2 = -1e10;
      for (int j = 0; j < N; ++j) {
        ll s = 0;
        for (int m = 0; m < min((int)k,N); ++m) {
          int to = ids[(j+m)%N];
          s += lc[to];
          // cerr << j << " " << m << " " << s << endl;
          sc2 = max(sc2, s);
        }
      }
      ans = max(ans, sc2);
      if (sum > 0) {
        ans = max(ans, sc2+sum*(k/N-1));
      }
    }
    sc += ma;
    // cerr << i << " " << sum << " " << ma << " " << sc << endl;
    ans = max(ans, sc);
  }
  cout << ans << endl;
}



Measured memory_bytes: 3728
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
const int N = 2e5 + 5;
const int INF = 0x3f3f3f3f;
typedef long long ll; 
using namespace std;

int n, lst;
struct node { int v, id; } p[N]; 
ll ans[N]; 

template < typename T >
inline T read()
{
	T x = 0, w = 1; char c = getchar();
	while(c < '0' || c > '9') { if(c == '-') w = -1; c = getchar(); }
	while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return x * w; 
}

bool cmp(node a, node b) { return a.v > b.v; }

int main()
{
#ifndef ONLINE_JUDGE
	freopen("cpp.in", "r", stdin); 
#endif
	n = read <int> ();
	for(int i = 1; i <= n; i++) p[i].v = read <int> (), p[i].id = i;
	sort(p + 1, p + n + 1, cmp);
	for(int lst = INF, j = 1, i = 1; i <= n; i = j)
	{
		while(j <= n && p[j].v == p[i].v) lst = min(lst, p[j].id), j++; 
		ans[lst] += 1ll * (p[i].v - p[j].v) * (j - 1); 
	}
	for(int i = 1; i <= n; i++) printf("%lld\n", ans[i]); 
	return 0; 
}


Measured memory_bytes: 4664
#include<stdio.h>

int main (){
    int S, h, m, s;
    
    scanf("%d", &S);
    
    h = S / 3600;
    
    m = (S - 3600*h) / 60;
    
    s = S - 3600*h - 60*m;
    
    printf("%d:%d:%d\n", h, m , s);
    
    return 0;
}


Measured memory_bytes: 2112
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let k: usize = read();
    let s: String = read();

    if s.len() <= k {
        print!("{}", s);
    } else {
        print!("{}...", &s[0..k]);
    }
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  string s;
  cin >> s;
  rep(i,sz(s)){
    if(s[i] == ',') s[i] = ' ';
  }
  print(s);
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long 
using namespace std;
signed main(){
  int n,m,x,a[1000],b=0,c=0;
  cin>>n>>m>>x;
  for(int i=0;i<m;i++){
    cin>>a[i];
  }
  for(int i=0;i<m;i++){
    if(a[i]<x){
      b++;
    }else{
      c++;
    }
  }
  if(b<c){
    cout<<b<<"\n";
  }else{
    cout<<c<<"\n";
  }
}


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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(), a.end());
    vector<int> cnt(n + 1, 0);
    int now = - 1;
    int tmp = 0;
    for (int i = 0; i < n; i++){
        if (a[i] != now){
            now = a[i];
            tmp = 1;
        }
        else tmp++;
        cnt[tmp]++;
    }
    vector<int> acc(n + 1, 0);
    for (int i = 1; i <= n; i++) acc[i] = acc[i - 1] + cnt[i];
    int ok = n;
    for (int i = 1; i <= n; i++){
        while(1){
            if (acc[ok] >= (long long)ok * i) break;
            ok--;
        }
        cout << ok << endl;
    }
}


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

int main(){

    string s; cin >> s;
    string t; cin >> t;
    vector<char> ans;

    for(int i = 0; i < t.size(); i++){
        ans.push_back(s[i]);
        ans.push_back(t[i]);        
    }

    if(t.size() != s.size()) ans.push_back(s[s.size() - 1]);

    for(int i = 0; i < ans.size(); i++){
        cout << ans[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
from math import pi,cos,sqrt

A,B,H,M = map(int,input().split())


A_angle=(H+M/60)/12*360
B_angle=(M/60)*360


max_angle=max(A_angle,B_angle)
min_angle=min(A_angle,B_angle)

diff = max_angle-min_angle


rad = diff*pi/180

c=A**2+B**2-2*A*B*cos(rad)
print(sqrt(c))


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

int main() {
  int n, k;
  string str;
  
  while(cin >> n, n) {
    string key = "I";
    for(int i=0; i<n; i++) key += "OI";
    
    cin >> k >> str;
    int cnt = 0;
    for(int i=0; i<k-key.size(); i++) {
      if(str.substr(i,key.size()) == key) cnt++;
    }
    cout << cnt << endl;
  }
  
  return 0;
}

Measured memory_bytes: 2160
#include <iostream>

using namespace std;

int main()
{
long long a,b;
cin>>a;
cin>>b;
long long x[b];
long long v=0;
for(long long i=0;i<b;i++)
{
cin>>x[i];
}

for(long long i=0;i<b;i++)
{
v+=x[i];

}

if(v>=a)
{
    cout<<"Yes";

}
else
{
   cout<<"No";
}

    return 0;
}



Measured memory_bytes: 4336
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(char &c){
  int i;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c = i;
}
inline int rd(char c[]){
  int i;
  int sz = 0;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c[sz++] = i;
  for(;;){
    i = getchar_unlocked();
    if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF){
      break;
    }
    c[sz++] = i;
  }
  c[sz]='\0';
  return sz;
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
template<class S, class T> inline S chmin(S &a, T b){
  if(a>b){
    a=b;
  }
  return a;
}
int N;
char S[102];
int arr[102];
int sz;
int main(){
  int k;
  int res = 1073709056;
  N = rd(S);
  for(k=(0);k<(26);k++){
    int i;
    for(i=(0);i<(N);i++){
      if(S[i]=='a'+k){
        arr[i] =0;
      }
      else{
        arr[i] =1;
      }
    }
    sz = N;
    for(;;){
      int FmcKpFmN;
      int xr20shxY;
      if(sz==0){
        xr20shxY = 0;
      }
      else{
        xr20shxY = arr[0];
        for(FmcKpFmN=(1);FmcKpFmN<(sz);FmcKpFmN++){
          xr20shxY += arr[FmcKpFmN];
        }
      }
      if(xr20shxY==0){
        break;
      }
      sz--;
      for(i=(0);i<(sz);i++){
        chmin(arr[i], arr[i+1]);
      }
    }
    chmin(res, N - sz);
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20191125-1

// --- original code ---
// int N;
// char S[102];
// int arr[102], sz;
// {
//   int res = int_inf;
//   rd(S@N);
//   rep(k,26){
//     rep(i,N) arr[i] = if[S[i]=='a'+k, 0, 1];
//     sz = N;
//     for(;;){
//       if(sum(arr(sz))==0) break;
//       sz--;
//       rep(i,sz) arr[i] <?= arr[i+1];
//     }
//     res <?= N - sz;
//   }
//   wt(res);
// }


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

using namespace std;

#define ll long long int

#define DEBUG (0)
#define MAX (1000000000)
int main()
{
  ll X = 0;
  ll money = 100;
  double risoku = 1.01;  //1%
  cin >> X;
  ll ans = 0;

  for(ll i = 1; i < MAX; i++){
    money = (ll)(money * risoku);
//    cout << money << "\n";

    if(money >= X){
      ans = i;
      break;
    }
  }

  cout << ans << "\n";

}


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

    #define ll long long
    #define pb push_back
    #define mod 1000000007
    #define mk make_pair


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

      ll n;
      cin>>n;
      ll i,j;
      ll arr[n][n-1];
      for(i=0;i<n;i++){
        for(j=0;j<n-1;j++){
            cin>>arr[i][j]; arr[i][j]--;
        }
      }
      ll node[n][n];
      memset(node,0,sizeof node);
      ll v=0;
      for(i=0;i<n;i++){
        for(j=i+1;j<n;j++){
            node[i][j]=v;
            v++;
        }
      }
      vector<vector<ll>> g(n*n);
      vector<ll> ind(n*n,0);

      for(i=0;i<n;i++){
        ll pre;
        pre=node[min(i,arr[i][0])][max(i,arr[i][0])];
        for(j=1;j<n-1;j++){
            ll next=node[min(i,arr[i][j])][max(i,arr[i][j])];
            ind[next]++;
            g[pre].pb(next);
            pre=next;
        }

      }
      queue<ll> q;
      vector<ll> dp(v,0);
      for(i=0;i<v;i++){
        if(ind[i]==0){q.push(i);  }
      }
      ll ans=0;
      while(!q.empty()){
        ll s=q.size();
        for(i=0;i<s;i++){
        ll t=q.front();
        q.pop();
        for(int s:g[t]){
            ind[s]--;
            if(ind[s]==0){
                q.push(s);
            }
        }
        }
        ans++;
      }
      
      
      for(i=0;i<v;i++){
        if(ind[i]>0){
            cout<<"-1\n";
            return 0;
        }
      }
      cout<<ans<<"\n";

      return 0;
      
      }

Measured memory_bytes: 66688
input = __import__('sys').stdin.readline
MIS = lambda: map(int,input().split())
range = xrange

n = int(input())
adj = [set() for i in range(n+1)]
white = [False]
for i in range(n-1):
    a, b = MIS()
    adj[a].add(b); adj[b].add(a)
s = input().rstrip()
for i in range(n): white.append(s[i] == 'W')

# Corner cases
if sum(white) <= 1: print(sum(white)); exit()

# Remove black leaves
stack = [i for i in range(1,n+1) if len(adj[i]) == 1 and not white[i]]
while stack:
    p = stack.pop()
    pa = min(adj[p])
    adj[pa].remove(p); adj[p].clear()
    if len(adj[pa]) == 1 and not white[pa]: stack.append(pa)

# Simulate Euler tour
root = 1
while not adj[root]: root+= 1
tadj = [[] for i in range(n+1)]
vis = [False]*(n+1); vis[root] = True
stack = [root]
while stack:
    p = stack.pop()
    for q in adj[p]:
        if vis[q]: continue
        vis[q] = True; tadj[p].append(q)
        stack.append(q)
for i in range(1, n+1):
    if adj[i] and len(tadj[i])%2 == 0: white[i] = not white[i]
white[root] = not white[root]

# Diameter
def bfs(v):
    stack = [v]
    dist = [-1]*(n+1); dist[v] = white[v]
    while stack:
        p = stack.pop()
        for q in adj[p]:
            if dist[q] != -1: continue
            dist[q] = dist[p] + white[q]
            stack.append(q)
    return dist

basecost = sum(map(len, adj)) + sum(white)
d1 = bfs(root)
diam = max(bfs(d1.index(max(d1))))
print(basecost - 2*diam)

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

using namespace std;

int main(){
int n, i, right, left, ans = 0, k;
cin >> k >> n;
int a[n];
for(i=0; i<n; i++) cin >> a[i];

if(n == 1) ans = 0;
else if(n==2){
    ans  = min(k-abs(a[0]-a[1]), abs(a[0]-a[1]));
}
else {
    int segment[n] = {0}, sum = 0, ans = INT_MAX;
    for(i=0; i<n-1; i++){
        segment[i] = abs(a[i]-a[i+1]);
        sum += segment[i];
    }
    segment[i] = k-a[n-1]+a[0];
    sum += segment[i];
    for(i=0; i<n; i++){
        ans = min(ans, sum-segment[i]);
    }
    cout << ans;
}

}


Measured memory_bytes: 5136
import math

def main():
    n, a, b = map(int, input().split())
    ans = 0
    for i in range(1, n + 1):
        data = list(map(int, list(str(i))))
        if a <= sum(data) <= b:
            ans += i
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 41324
#include <stdio.h>
#define MAX 150
 
int main (void){
 
  int n, m;
  int loop = 1;
  int i, j;
  int action;
  int min;
  int pn[MAX] = {};
  int pm[MAX] = {};
  int change[2] = {};

  
  while (loop){
    scanf("%d %d", &n, &m);
    if (n == 0 && m == 0){
      loop = 0;
    }else{
      action = 0;
      pn[n] = 0;
      pm[m] = 0;
      for(i=0; i<n; i++){
    scanf("%d", &pn[i]);
    pn[n] += pn[i]; //使わない列に合計を入れる
      }
       
      for(j=0; j<m; j++){
    scanf("%d", &pm[j]);
    pm[m] += pm[j];
      }
 
      for(i=0; i<n; i++){
    for(j=0; j<m; j++){
      pn[n+1] = pn[n] - pn[i] + pm[j];
      pm[m+1] = pm[m] - pm[j] + pn[i];
      if (pn[n+1] == pm[m+1]){
        if(action == 0){
        change[0] = pn[i];
        change[1] = pm[j];
        min = pn[i] + pm[j];
        action = 1;
        }else{
          if (min > pn[i] + pm[j]){
        min = pn[i] + pm[j];
          }
        }
      }
    }
      }
 
      if(action == 1){
    printf("%d %d\n", change[0], change[1]);
      }else{
    printf("-1\n");
      }   
    }
  }
   
  return 0;
}


Measured memory_bytes: 2672
#include <stdio.h>
#define max(X, Y) ((X) > (Y) ? (X) : (Y))

int gcd(int x, int y);

int main()
{
	int n, k;
	int a[100005];
	int g;
	int m = 0;

	scanf("%d %d", &n, &k);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		m = max(m, a[i]);
	}

	g = gcd(a[0], a[1]);
	for (int i = 2; i < n; i++) {
		g = gcd(g, a[i]);
	}

	if (k <= m && k % g == 0) {
		puts("POSSIBLE");
	}
	else {
		puts("IMPOSSIBLE");
	}

	return 0;
}

int gcd(int x, int y)
{
	if (x < y) {
		x ^= y;
		y ^= x;
		x ^= y;
	}

	while (y) {
		int r = x % y;
		x = y;
		y = r;
	}

	return x;
}


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

using namespace std;
#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 rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

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

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

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


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

  int n, k;
  cin >> n >> k;

  vector<pair<ll, int>> sushi(n);
  rep(i, n){
    int t;
    ll d;
    cin >> t >> d;
    sushi[i] = make_pair(d, t);
  }

  sort(sushi.rbegin(), sushi.rend());

  map<int, int> mp;
  auto c = [](pair<ll, int> a, pair<ll, int> b){return a.first > b.first;};
  priority_queue<pair<ll, int>, vector<pair<ll, int>>, decltype(c)> que(c);
  ll point = 0;
  rep(i, k){
    point += sushi[i].first;
    que.push(sushi[i]);
    mp[sushi[i].second]++;
  }

  point += (mp.size() * mp.size());

  ll V = mp.size();

  ll ans = point;
  rep(i, k, n){
    
    ll val = sushi[i].first;
    ll t   = sushi[i].second;

    if(mp[t] > 0) continue;
    
    while(mp[que.top().second]==1){
      if(que.empty()) break;
      que.pop();
    }

    if(que.empty()) break;

    auto p = que.top();
    mp[p.second]--;
    que.pop();

    point -= p.first;
    point += val;
    point += 2*V + 1;
    V++;
    chmax(ans, point);

    mp[t]++;
    que.push(sushi[i]);

  }

  cout << ans << endl;





  return 0;
}


Measured memory_bytes: 6256
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef complex<double> xy_t;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-11;

char moji(int i) {
    if (i <= 9) {
        return i + '0';
    } else {
        return (i - 10) + 'A';
    }
}

int main() {
    while (1) {
        int N, M, Q;
        cin >> N >> M >> Q;
        if (N == 0) {
            break;
        }
        bool bo[N][M];
        for (int i = 0; i < N; i++) {
            fill(bo[i], bo[i] + M, true);
        }
        bool swi[N];
        fill(swi, swi + N, false);
        for (int i = 0; i < Q; i++) {
            string s, b;
            cin >> s >> b;
            for (int j = 0; j < N; j++) {
                if (s[j] == '1') {
                    swi[j] = !swi[j];
                }
                char c = (swi[j]) ? '1' : '0';
                for (int k = 0; k < M; k++) {
                    if (b[k] != c) {
                        bo[j][k] = false;
                    }
                }
            }
        }
        string ans = "";
        for (int i = 0; i < M; i++) {
            int ok = 0;
            int num = 0;
            for (int j = 0; j < N; j++) {
                if (bo[j][i]) {
                    ok++;
                    num = j;
                }
            }
            if (ok == 1) {
                ans += moji(num);
            } else {
                ans += '?';
            }
        }
        cout << ans << endl;
    }
}



Measured memory_bytes: 3228
#include <stdio.h>

int main()
{
  int n, i, j, k, l, num;

  while (scanf("%d", &n) > 0) {
    num = 0;
    for (i = 0; i <= 9; i++) {
      for (j = 0; j <= 9; j++) {
        for (k = 0; k <= 9; k++) {
          for (l = 0; l <= 9; l++) {
            if (i + j + k + l == n) {
              num++;
            }
          }
        }
      }
    }
    printf("%d\n", num);
  }

  return 0;
}

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

using namespace std;

typedef complex<double> Point;
#define rep(i, n) for(int i=0; i<(n); ++i)
const double eps = 1e-8, inf = 1e8;
const Point UL = {0, 1000}, UR = {1000, 1000}, BL = {0, 0}, BR = {1000, 0};

template<typename T> inline void chmin(T& t, T f){if(t > f)t = f;}

inline double cross(const Point& a, const Point& b){
    return imag(conj(a) * b);
}

inline double dot(const Point& a, const Point& b){
    return real(conj(a) * b);
}

int ccw(Point a, Point b, Point c){
    b -= a; c -= a;
    if(cross(b, c) > eps)return 1;
    if(cross(b, c) < -eps)return -1;
    if(dot(b, c) < 0)return 2;
    if(norm(b) < norm(c))return -2;
    return 0;
}

struct Line : vector<Point> {
    Line(const Point& a, const Point& b):vector<Point>{a, b}{}
};

Point proj(const Line& l, const Point& p){
    double t = dot(p - l[0], l[1] - l[0]) / norm(l[0] - l[1]);
    return l[0] + (l[1] - l[0]) * t;
}

inline bool interSP(const Line& s, const Point& p){
    return abs(s[0] - p) + abs(s[1] - p) - abs(s[1] - s[0]) < eps;
}

inline bool interSS(const Line& s, const Line& t){
    return ccw(s[0], s[1], t[0]) * ccw(s[0], s[1], t[1]) <= 0 &&
           ccw(t[0], t[1], s[0]) * ccw(t[0], t[1], s[1]) <= 0;
}

inline double distSP(const Line& s, const Point& p){
    const Point r = proj(s, p);
    return interSP(s, r)? abs(r - p): min(abs(s[0] - p), abs(s[1] - p));
}

inline double distSS(const Line& s, const Line& t){
    return interSS(s, t)? 0: min(min(distSP(s, t[0]), distSP(s, t[1])),
                                 min(distSP(t, s[0]), distSP(t, s[1])));
}

double solve(vector<Point>& poly1, vector<Point>& poly2){
    double res = inf;
    rep(i, (int)poly1.size()-1){
        rep(j, (int)poly2.size()-1){
            chmin(res, distSS(Line(poly1[i], poly1[i+1]), Line(poly2[j], poly2[j+1])));
        }
    }
    return res;
}

int main(){
    int N1;
    cin >> N1;
    vector<Point> poly1{BL};
    rep(i, N1){
        int x, y;
        cin >> x >> y;
        poly1.emplace_back(x, y);
    }
    poly1.push_back(BR);
    int N2;
    cin >> N2;
    vector<Point> poly2{UL};
    rep(i, N2){
        int x, y;
        cin >> x >> y;
        poly2.emplace_back(x, y);
    }
    poly2.push_back(UR);
    cout << fixed << setprecision(12) << solve(poly1, poly2) << '\n';
    return 0;
}

Measured memory_bytes: 1296
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;


int main()
{ios_base::sync_with_stdio(false);
int n,m;
cin>>n>>m;
vii ans;
string s;
cin>>s;
reverse(all(s));
int ptr=0;
while(1)
{
	if(ptr==n)break;
	int mx=min(n-ptr,m);
	while(1)
	{
		if(s[ptr+mx]=='0')
		break;
		mx--;
	}
	if(mx==0)
	{
		ol("-1");
		return 0;
	}
	ptr+=mx;
	ans.pb(mx);
}
reverse(all(ans));
tr(ans,it)
{
	ol(*it);os;
}
return 0;
}



Measured memory_bytes: 1096
n, m = map(int, input().split())
ab = []
for i in range(n):
    ab.append([int(_) for _ in input().split()])
c = []
for j in range(m):
    c.append([int(_) for _ in input().split()])

# print(ab, c)


for i in range(n):
    d = []
    for j in range(m):
        d.append(abs(ab[i][0] - c[j][0]) + abs(ab[i][1] - c[j][1]))
    # print(d)
    idx = d.index(min(d))
    print(idx + 1)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const ll MOD = (ll) (998244353);
const double PI = acos(-1.0);
const int limit = 100010;

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    if (a > b) swap(a, b);
    Yes(a < c && c < b);
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using lint = long;
using llint = long long;
using namespace std;

int main() {
    fastIO;
    int a, b;
    cin >> a >> b;
    if (a > 9 || b > 9)
        cout << -1;
    else
        cout << a * b;
}


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

#define ll long long
#define ull unsigned long long
#define LL long long
#define sl(n) scanf("%lld", &n)
#define sf(n) scanf("%lf", &n)
#define si(n) scanf("%d", &n)
#define sch(n) scanf(" %c", &n)
#define ss(n) scanf("%s", n)
#define pii pair <int, int>
#define pll pair <ll, ll>
#define plp pair <int, pll >
#define pb push_back
#define fr first
#define sc second
#define all(a)  a.begin(),a.end()
#define Unique(a)  sort(all(a)),a.erase(unique(all(a)),a.end())

#define inf (1LL<<50)
#define eps 1e-9

ll Set(ll n, ll pos)
{
    return n|(1LL<<pos);
}

bool Check(ll n, ll pos)
{
    return (bool) (n&(1LL<<pos));
}

ll a[3050];
ll dp[3050][3050][2];

ll solve(ll b, ll e, bool p)
{
    if (b == e)
        return (p==0?a[b]:-a[b]);

    ll &ret = dp[b][e][p];
    if (ret != -1)
        return ret;

    if (p == 0)
    {
        ret = max(solve(b+1, e, 1) + a[b], solve(b, e-1, 1) + a[e]);
    }
    else
    {
        ret = min(solve(b+1, e, 0) - a[b], solve(b, e-1, 0) - a[e]);
    }

 //   cout << p << " " << b << " " << e << " " << ret << endl;

    return ret;
}

int main ()
{
    //  freopen("input.txt", "r", stdin);
    //  freopen("output.txt", "w", stdout);
    //  ios_base::sync_with_stdio(0); // no printf/scanf must be present
    ll cs, ts, i, j, k, x, y, z, q, m, n, cap;

    while(sl(n) != EOF)
    {
        for (i = 1; i <= n; i++)
        {
            sl(a[i]);
            a[i] *= 2;
        }

        memset(dp, -1, sizeof(dp));

        printf("%lld\n", solve(1, n, 0)/2);
    }
    return 0;
}


Measured memory_bytes: 145792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
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; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

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

int lcm(int x,int y){
	return x*y / gcd(x,y);
}

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

	char a;
	cin >> a;
	if('A'<=a && a<= 'Z') cout << "A" << endl;
	else{
		a += 'a' - 'A';
		cout << "a" << endl;
	}


	return 0;
}

Measured memory_bytes: 3608
import math
n = int(input())
x = int(n/1.08)

if math.floor(x*1.08) == n:
    print (x)
elif math.floor((x-1)*1.08) == n:
    print (x-1)
elif math.floor((x+1)*1.08) == n:
    print (x+1)
else:
    print (":(")


Measured memory_bytes: 9168
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i==n-1];};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
    ll N,K;
    cin >> N >> K;
    ll t[100010], d[100010];
    rep(i,0,N) cin >> t[i] >> d[i];
    vector<lpair> lp;
    rep(i,0,N) lp.push_back(make_pair(d[i], t[i]));
    sort(lp.begin(), lp.end(), greater<lpair>());
    map<ll,ll> mp, mp2;
    priority_queue<lpair, vector<lpair>, greater<lpair> > pq;
    vector<lpair> ans;
    rep(i,0,K){
        mp[lp[i].second]++;
    }
    bool is_first[100010];
    memset(is_first, false, sizeof(is_first));
    ll sum = 0;
    ll syurui = 0;
    rep(i,0,K){
        ll idx = lp[i].second;
        sum += lp[i].first;
        if(not is_first[idx]){
            is_first[idx] = true;
            ans.push_back(lp[i]);
            syurui++;
        }else{
            pq.push(lp[i]);
        }
    }
    ll val[100010] = {};
    val[syurui] = sum;

    rep(i,K,N){
        lpair l1 = lp[i];
        if(mp[l1.second] != 0) continue;
        if(not pq.empty()){
            lpair l2 = pq.top();
            pq.pop();
            syurui++;
            ans.push_back(l1);
            sum += l1.first - l2.first;
            val[syurui] = sum;
            mp[l1.second]++;
        }
    }
    while(not pq.empty()){
        ans.push_back(pq.top());
        pq.pop();
    }

    ll res = 0;
    rep(i,1,syurui+1){
        res = max(res, val[i] + i*i);
    }
    print(res);
}

Measured memory_bytes: 12144
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var items = Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToArray();
            var X = items[0];
            var Y = items[1];
            var Z = items[2];
            this.Swap(ref X, ref Y);
            this.Swap(ref X, ref Z);
            Console.WriteLine($"{X} {Y} {Z}");
        }

        private void Swap(ref int A, ref int B)
        {
            int temp = A;
            A = B;
            B = temp;
        }
    }
}


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

namespace _164A
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] SW = Console.ReadLine().Split(' ').Select(tmp => long.Parse(tmp)).ToArray();
            if (SW[0] <= SW[1])
            {
                Console.WriteLine("unsafe");
            }
            else {
                Console.WriteLine("safe");
            }
        }
    }
}


Measured memory_bytes: 28168
fn check(s: String) -> bool {
    let s: Vec<char> = s.chars().collect();
    let mut res = true;
    for i in 0..s.len() {
        if s[i] != s[s.len() - i - 1] {
            res = false;
        }
    }
    res
}

fn main() {
    let s: String = read();
    let n = s.len();

    if check(s.clone()) && check(s.clone()[0..((n-1)/2)].to_string()) && check(s.clone()[((n+3)/2-1)..].to_string()) {
        println!("Yes");
    } else {
        println!("No");
    }

}
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}



Measured memory_bytes: 4352
#include<iostream>
using namespace std;
int main(){
  int n, a, b;
  while(cin >> n, n){
      int as =0, bs =0;
      for(int i =0; i<n; i++){
	cin >>a >>b;
	if(a>b) as += a+b;
	else if(a<b) bs += a+b;
	else {as += a; bs += b;}
      }
      cout<<as <<" "<<bs <<endl;
  }
  return 0;
}

Measured memory_bytes: 1160