akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
  int X, Y;
  cin >> X >> Y;

  int ans=0;
  int i=0;
  while(i<2){
    if(X>Y){
      ans=ans+X;
      X=X-1;
    }
    else{
      ans=ans+Y;
      Y=Y-1;
    }
  i++;
  }

  cout << ans << endl;

return 0;  
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

vl par(100005);//親
vl rnk(100005);//深さ
//初期化
void init(ll n){
  rep(i,n){
    par[i]=i;
    rnk[i]=0;
  }
}
//根を求める
int find(ll x){
  if(par[x]==x){
    return x;
  }
  else{
    par[x]=find(par[x]);//親の根と自分の根は等しいよね.
    return par[x];//←忘れがち
  }
}
//集合を併合する（ダジャレではない）
void unite(ll x,ll y){
  x=find(x);
  y=find(y);
  if(x==y)//親が同じだったらすでに併合されているよ.
    return;
  else{
    if(rnk[x]>rnk[y])
      par[x]=y;//xの親をyの根にする
    else
      par[y]=x;
    if(rnk[x]==rnk[y])
      rnk[x]++;//同じ深さのをくっつけたらそうなるよね.
  }
}

int main() {
  int n,m,k;
  cin >> n >> m >> k;
  vl a(m),b(m),c(k),d(k);
  rep(i,m){
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
  }
  rep(i,k){
    cin >> c[i] >> d[i];
    c[i]--;
    d[i]--;
  }
  init(n);
  rep(i,m){
    unite(a[i],b[i]);
  }
  map<ll,ll> f_map;
  rep(i,n){
    f_map[find(i)]++;
  }
  /*ここから同グループでブロックor友達関係を調べる*/
  vl cnt(n,0);
  rep(i,m){
    if(find(a[i])==find(b[i])){
      cnt[a[i]]--;
      cnt[b[i]]--;
    }
  }
  rep(i,k){
    if(find(c[i])==find(d[i])){
      cnt[c[i]]--;
      cnt[d[i]]--;
    }
  }
  rep(i,n){
    ll k=f_map[find(i)]-1;
    if(i!=n-1){
      cout << k+cnt[i] << " ";
    }
    else
      cout << k+cnt[i];
  }
}

Measured memory_bytes: 12160
#include<bits/stdc++.h>
using namespace std;
// -----------------<fast IO>------------------
#define IOS             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FLSH             fflush(stdout)
#define fileIO(name) \
    freopen(name".in", "r", stdin); \
    freopen(name".out", "w", stdout);
#define PRECISION(x)     cout << fixed << setprecision(x);
// -----------------<TypeDef Start>------------------
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
// -----------------<Constants>------------------
const int MAXN = 1000005;
const int SQRTN = 1003;
const int LOGN = 22;
const double PI=acos(-1);

const int INF=1e9;
ll mn1=-9223372036854775808;
int MOD = 1000000007;
const int FMOD = 998244353;
const double eps = 1e-9;
/*ll gcd(ll a,ll b)
{
    if(a==0)
    return(b);
    return(gcd(b%a,a));
}*/
// --------------------------------------------------</TEMPLATE>--------------------------------------------------


void solve()
{
    int x;
    cin>>x;
    if(x==0)
        cout<<1<<endl;
    else
        cout<<0<<endl;
}
int main()
{
    IOS
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return(0);

}


Measured memory_bytes: 3644
use std::cmp;
use std::fmt::Debug;
use std::str::FromStr;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where
    T: FromStr,
    <T as FromStr>::Err: Debug,
{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim()
        .split_whitespace()
        .map(|c| T::from_str(c).unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_as_string() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[test]
fn test_random() {
    assert_eq!(2 + 2, 4);
}

fn main() {
    let n = read_as_vec::<usize>()[0];
    let mut a = read_as_vec::<i64>();
    let mut steps: Vec<(i64, i64)> = vec![];
    a.sort();
    // maybe minus if given all numbers are minus.
    let mut only_plus_number = a.pop().unwrap();
    let mut minus_numbers: Vec<i64> = vec![];
    let mut plus_numbers: Vec<i64> = vec![];
    a.reverse();
    minus_numbers.push(a.pop().unwrap());
    for elem in a {
        if 0 <= elem {
            plus_numbers.push(elem);
        } else {
            minus_numbers.push(elem);
        }
    }

    while let Some(y) = plus_numbers.pop() {
        let x = minus_numbers.pop().unwrap();
        steps.push((x, y));
        minus_numbers.push(x - y);
    }

    for minus_number in minus_numbers {
        steps.push((only_plus_number, minus_number));
        only_plus_number -= minus_number;
    }

    println!("{}", only_plus_number);
    for step in steps {
        println!("{} {}", step.0, step.1);
    }
}


Measured memory_bytes: 5764
#include<cstdio>
#include<iostream>

using namespace std;

int main(){
    int n;
    scanf("%d", &n);
    int a,b,c,d;
    d = n % 10;
    int mod[4] = {10, 100, 1000, 10000};
    c = (n % mod[1]) / mod[0];
    b = (n % mod[2]) / mod[1];
    a = (n % mod[3]) / mod[2];
    if (a + b + c + d == 7) {
        cout << a << "+" << b << "+" << c << "+" << d << "=7\n";
    }else if (a - b + c + d == 7) {
        cout << a << "-" << b << "+" << c << "+" << d << "=7\n";
    }else if (a + b - c + d == 7) {
        cout << a << "+" << b << "-" << c << "+" << d << "=7\n";
    }else if (a - b - c + d == 7) {
        cout << a << "-" << b << "-" << c << "+" << d << "=7\n";
    }else if (a + b + c - d == 7) {
        cout << a << "+" << b << "+" << c << "-" << d << "=7\n";
    }else if (a - b + c - d == 7) {
        cout << a << "-" << b << "+" << c << "-" << d << "=7\n";
    }else if (a + b - c - d == 7) {
        cout << a << "+" << b << "-" << c << "-" << d << "=7\n";
    }else if (a - b - c - d == 7) {
        cout << a << "-" << b << "-" << c << "-" << d << "=7\n";
    }
}

Measured memory_bytes: 888
#pragma GCC optimize("O2")
// #include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <functional>
#include <numeric>
#include <algorithm>
using namespace std;
#define mod 1000000007
long long f_pow(long long a, long long b) {
	long long  res = 1, temp = a;
	while (b) {
		if (b & 1)res = res * temp % mod;
		temp = temp * temp % mod;
		b >>= 1;
	}
	return res;
}



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

	long long x ;
	cin >> x ;
	long long a , b ;
	for (long long i = -2000 ; i <= 2000 ; i++) {
		for (long long j = -2000 ; j <= 2000 ; j++) {
			if (i * i * i * i * i - j * j * j * j * j  == x ) {
				a = i ;
				b = j ;
				break;
			}
		}
	}

	cout << a << " " << b << "\n";

// int n , m ;
// cin >> n >> m ;
// vector<long long> h(n+1);
// for(int i = 1 ; i <= n ; i++) {
// 	cin >>  h[i] ;
// }
// vector<int> a(m+1) , b(m+1) ;
// for(int i = 1 ; i <= m ; i++){
//       cin >> a[i] >> b[i] ;
// }
// int ans = 0 ;
// for(int i = 1 ; i <= n ; i++){

// }





	return 0 ;
}


Measured memory_bytes: 3664
H, W, K = map(int, input().split())
p = 10 ** 9 + 7
G = [[0 for j in range(W)] for i in range(W)]
for pat in range(2 ** (W - 1)):
  P = [0] * (W - 1)
  for i in range((W - 1)):
    P[i] = pat % 2
    pat //= 2
  for i in range(W - 2):
    if P[i] and P[i + 1]:
      break
  else:
    for i in range(W - 1):
      if P[i] == 1:
        G[i][i + 1] += 1
        G[i + 1][i] += 1
      else:
        if i == 0 or P[i - 1] == 0:
          G[i][i] += 1
        if i == W - 2:
          G[W - 1][W - 1] += 1
HG = [[G[i][j] for j in range(W)] for i in range(W)]
for h in range(H - 1):
  _HG = [[0 for j in range(W)] for i in range(W)]
  for i in range(W):
    for j in range(W):
      for k in range(W):
        _HG[i][j] += HG[i][k] * G[k][j]
      _HG[i][j] %= p
  HG = [[_HG[i][j] for j in range(W)] for i in range(W)]
print(HG[0][K - 1] if W > 1 else 1)

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

#define int long long
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define reps(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end()))
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr double PI = 3.1415926535897932384626433832795028;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

signed main() {
    string S;
    cin >> S;
    cout << S[0] << S[1] << S[2] << endl;
}

Measured memory_bytes: 3628
<?php
  list($n) = explode(" ", trim(fgets(STDIN)));

  if($n <= 599){
    echo 8;
  }else if($n <= 799){
    echo 7;
  }else if($n <= 999){
    echo 6;
  }else if($n <= 1199){
    echo 5;
  }else if($n <= 1399){
    echo 4;
  }else if($n <= 1599){
    echo 3;
  }else if($n <= 1799){
    echo 2;
  }else{
    echo 1;
  }

Measured memory_bytes: 16216
#include <iostream>
#include <vector>

using namespace std;

int main() {
	int h, w, a, b; cin >> h >> w >> a >> b;
	vector<int> rcnt(h), ccnt(w);
	vector<vector<int> > ans(h, vector<int>(w));
	for (int i = 0; i < h; ++i) {
		for (int j = 0; j < w; ++j) {
			if (w - rcnt[i] != a) {
				if (h - ccnt[j] != b) {
					ans[i][j] = 1;
					rcnt[i]++, ccnt[j]++;
				}
			}
		}
	}
	for (int i = 0; i < h; ++i) {
		for (int j = 0; j < w; ++j) {
			cout << ans[i][j];
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 5120
#include<iostream>
#include<string>
using namespace std;
int b[10010];
int main(){
    long long i,s,n;
	i=2;
	int count=0;
	while(true){
		bool t=false;
		for(int j=2;j*j<=i;j++){
			if(i%j==0)
				t=true;
		}
		if(t==false){
			count++;
			b[count]=i;
		}
		if(count==10010)
			break;
		i++;
	}
	while(true){
		s=0;
		cin>>n;
		if(n==0)
			break;
		for(int i=0;i<=n;i++){
			s+=b[i];
		}
		cout<<s<<endl;
	}
	return 0;
}

Measured memory_bytes: 1200
#include <stdio.h>

int main() {
    int n, x;
    scanf("%d %d", &n, &x);

    unsigned long long int an[n+1];
    for (int i = 0; i < n; i++) {
        scanf("%lld", &an[i]);
    }

    unsigned long long int s = 0;
    for (int i = 1; i <= n; i++) {
        if (x == 0) {
            s += an[i-1];
            continue;
        }

        if (i == n) {
            break;
        }

        unsigned long long int d = an[i-1] + an[i];
        if (d > x) {
            unsigned long long int e = d - x;
            s += e;
            an[i] -= (an[i] >= e) ? e : an[i];
        }
    }

    printf("%lld\n", s);
    return 0;
}

Measured memory_bytes: 896
N=int(input())
x=y=t=0
flag=True
for i in range(N):
  ti, xi, yi = map(int, input().split())
  dist = abs(xi-x)+abs(yi-y)
  dt = ti-t
  x, y, t = xi, yi, ti
  if dist<=dt and dist%2==dt%2:
    continue
  else:
    flag=False
print("Yes") if flag else print("No")

Measured memory_bytes: 3064
x, k, d = map(int, input().split())

x = abs(x)

t = x // d

if t > k:
  ans = x - k * d
else:
  pos = x - t * d
  r = k - t
  if r % 2 == 0:
    ans = pos
  else:
    ans = abs(pos - d)

print(ans)

Measured memory_bytes: 9180
#include <algorithm>
#include <cstdint>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>

using namespace std;

using lint=int64_t;
using uint=uint32_t;
using ulint=uint64_t;

template<class T>
using vector2d=vector<vector<T>>;

template<class T>
bool UpdateMax(T &a, const T &b){
  if(a<b){
    a=b;
    return true;
  }else{
    return false;
  }
}

template<class T>
bool UpdateMin(T &a, const T &b){
  if(a>b){
    a=b;
    return true;
  }else{
    return false;
  }
}

template <class T>
void OutVec(const vector<T>& vec){
  for(int i = 0; i < vec.size() - 1; ++i){
    cout<<vec[i]<<" ";
  }
  cout<<vec.back()<<endl;
}

template <class T>
void OutVec2d(const vector2d<T>& vec){
  for(auto v:vec){
    OutVec(v);
  }
}

int main(){
  cout << std::fixed << std::setprecision(16);
  cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  int k,t;
  cin>>k>>t;
  vector<int> a(t);
  for(int i=0;i<t;i++){
    cin>>a[i];
  }
  std::sort(a.begin(), a.end(), std::greater<>());
  int top=a[0];
  int cum=0;
  for(int i=1;i<t;i++){
    cum+=a[i];
  }

  if(top-1<=cum){
    cout<<0<<endl;
  }else{
    cout<<k-(cum*2+1)<<endl;
  }

  return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < int, int >
#define F first
#define S second
#define int  long long int
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
using namespace std;
/// age ye mosh dp ro baze dashti dp tedad baz shodeye baste nashode yadet nare !!
/// joooob zadam
const int N=2e5+100,mod=998244353;
ll t[N];
ll power(ll n,ll k){
    if (k==0){
        return 1;
    }
    if (k%2==1){
        ll x=power(n,k/2);
        return x*x%mod*n%mod;
    }
    ll x=power(n,k/2);
    return x*x%mod;
}
int32_t main(){

     ll n;
     cin >> n;
     ll ma=0;
     for (int i=0;i<n;i++){
        ll x;
        cin >> x;
        ma=max(ma,x);
        if (i==0 && x!=0){
            cout << 0;
            return 0;
        }
        t[x]++;
     }
     ll ans=1;
     if (t[0]!=1){
        ans=0;
     }
     if (ma>=n){
        ans=0;
     }
     for (int i=1;i<=ma;i++){
        ans*=power(t[i-1],t[i]);
        if (t[i-1]==0){
            ans=0;
        }
        ans%=mod;
     }
     cout << ans << endl;

}


Measured memory_bytes: 1024
using System;

namespace Csharp_ITP1 {
    class ITP1_4_A {
        static void Main() {
            string[] s = Console.ReadLine().Split();
            int a = int.Parse(s[0]); int b = int.Parse(s[1]);
            Console.WriteLine("{0} {1} {2:f5}", a / b, a % b, (double)a / b);
        }
    }
}


Measured memory_bytes: 18056
A = [0 for i in range(9)]
for i in range(3):
  A[3*i], A[3*i+1], A[3*i+2] = map(int, input().split())
N = int(input())
b = [0 for i in range(N)]
for i in range(N):
  b[i] = int(input())

#Check matching numbers
for i in range(9):
  for j in range(N):
    if A[i] == b[j]:
      A[i] = 0

# Check bingo or not
flag = 0
# Check rows
for i in [0, 3, 6]:
  if A[i]==A[i+1] and A[i+1]==A[i+2]:
    flag += 1
# Check colums
for j in range(3):
  if A[j]==A[j+3] and A[j+3]==A[j+6]:
    flag += 1
# Check naname?
if (A[0]==A[4] and A[4]==A[8]) or (A[2]==A[4] and A[4]==A[6]):
  flag += 1

if flag >= 1:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	int n,k;
	cin >> n >>k;
	int ans = 1;
	for(int i = 0; i < n; i++) {
		if(ans >= k){
			ans += k;
		}
		else{
			ans += ans;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
from collections import deque

N, K = map(int, input().split())
towns = [0] + list(map(int, input().split()))
checked = [-1 for _ in range(N+1)]
checked[1] = 0
next = towns[1]
count = 1
    
while(checked[next] < 0):
  checked[next] = count
  count += 1
  next = towns[next]
loop = count - checked[next]
pos = 0
if K >= count:
  pos = checked[next] + (K-checked[next])%loop
else:
  pos = K
for i in range(1, N+1):
  if checked[i] == pos:
    print(i)
    exit()

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

int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i += 2) {
    cout << s[i];
  }
  cout << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<iomanip>
#include<string>
#include<array>
#include<cmath>
using namespace std;

int main() {
	int p, q, r,a,b,c;
	cin >> p >> q >> r;
	a = p + q;
	b = q + r;
	c = r + p;
	if (a<=b&&a<=c) {
		cout << a;
	}
	else if (b < a && b < c) {
		cout << b;
	}
	else {
		cout << c;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(n); ++i)
#define repr(i, a, b) for (int i=a; i<(b); ++i)
#define reprev(i, n) for (int i=n-1; i>=0; --i)
#define reprrev(i, a, b) for (int i=b-1; i>=(a); --i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    cout << fixed << setprecision(10);
    
    int K, A, B; cin >> K >> A >> B;

    if (A % K == 0 || B % K == 0) {
        cout << "OK" << endl;
    } else if (A / K < B / K) {
        cout << "OK" << endl;
    } else {
        cout << "NG" << endl;
    }
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>

using namespace std;

int main()
{
    int a=0,b=0;
    char s[3];
    cin>>s;
    for(int i=0;i<3;i++)
    {
        if(s[i]=='A')
            a++;
        if(s[i]=='B')
            b++;
    }
    if(a==0||b==0)
        cout<<"No"<<endl;
    else
        cout<<"Yes"<<endl;
}


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

//return vector include prome number under N
vector<long long> prime_list(long long N){
    vector<long long> prime_list(N+1);
    for(long long i=0; i<N+1; i++){
        prime_list[i]=0;
    }

    prime_list[0]=1;
    prime_list[1]=1;

    for(long long i=2; i<=sqrt(N); i++){
        for(long long j=i*2; j<=N; j+=i){
            prime_list[j]=1;
        }
    }

    vector<long long> list;
    for(long long i=0; i<N+1; i++){
        if(prime_list[i]==0) list.push_back(i);
    }

    return list;
}

int main(){
    ll N;
    cin>>N;
    vector<ll> n(N+1, 0);

    vector<ll> prime=prime_list(N);
    vector<vector<ll>> div(N+1);

    ll ans=0;
    rep(i, N+1){
        if(i==0) continue;
        ll num=(N/i);
        ans+=(num*(num+1)*i)/2;
    }

    cout<<ans<<endl;

    // rep(i, prime.size()){
    //     //cout<<prime[i]<<endl;
    //     for(ll j=prime[i]; j<=N; j+=prime[i]){
    //         n[j]++;
    //         div[j].push_back(prime[i]);
    //     }
    // }

    // ll ans=0;
    // rep(i, N+1){
    //     if(i==0) continue;
    //     if(i==1){ ans++; continue; }
    //     ll num=1;
    //     int k=int(div[i].size());
    //     rep(j, k){
    //         //cout<<i<<" "<<i/div[i][j]+1<<endl;
    //         //num*=i*(i/div[i][j]+1);
    //         ll a, b, c;
    //         a=i;
    //         b=div[i][j];
    //         c=0;
    //         while(a>1){
    //             if(a%b!=0) break;
    //             a=a/b;
    //             c++;
    //         }
    //         num*=c+1;
    //         //cout<<num<<endl;
    //     }
    //     //cout<<i<<" "<<num<<endl;
    //     num=(num)*i;
    //     if(k>0) ans+=num;
    // }

    // cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 321048
colors = [0 for _ in range(8)]
extra = 0
n = int(input())
A = list(map(int,input().split()))

for a in A:
    color = a//400
    if color >=8:
        extra +=1
    else:
        colors[color] = 1

num_8 = sum(colors)
lower = num_8
if lower==0 and extra>0:
    lower = 1
higher = num_8+extra

print(lower,higher)

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

d = []

H.times do
  r = gets.chomp
  unless r.match(/^\.+$/)
    d << r
  end
end

result = Array.new(d.size, '')

W.times do |i|
  found_sharp = false
  d.each do |r|
    if r[i] == '#'
      found_sharp = true
      break
    end
  end
  if found_sharp
    d.size.times do |j|
      result[j] += d[j][i]
    end
  end
end

puts result

Measured memory_bytes: 2556
use std::io;

pub fn main() {
    let stdin = io::stdin();
    let mut buf = String::new();
    stdin.read_line(&mut buf).ok();
    let line: Vec<i32> = buf.split_whitespace().into_iter().map(|s| s.parse().unwrap()).collect();
    let A = line[0];
    let B = line[1];
    let T = line[2];
    println!("{}", T / A * B);
}

Measured memory_bytes: 4352
#include <cstring>
#include <cstdio>
#include <algorithm>
using namespace std;
#define loop(i,a,b) for(int i=a; i<int(b); i++)
#define rep(i,b) loop(i,0,b)

char s[1000100];
int l[1000100];
int main(){
    scanf("%s",s);
    int n = strlen(s);
    l[0] = 1;
    rep(i,n-1){
        if(s[i+1]==s[i]) l[i+1]=l[i]+1;
        else l[i+1] = 1;
    }
    int ans = 0;
    loop(i,1,n-1){
        if(s[i]=='O' && s[i+1]!='O' && i+l[i]<n && i-l[i] >= 0 && l[i+l[i]]>=l[i] && l[i-l[i]]>=l[i] && s[i+l[i]]=='I' && s[i-l[i]]=='J'){
            ans = max(ans,l[i]);
        }
    }
    printf("%d\n",ans);
}

Measured memory_bytes: 5836
#include<iostream>
#include<iomanip>
//#include<cstdio>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cassert>
using namespace std;
typedef long long ll;
const int NMmax = 1e5;
const ll INF = 1e17;
int N,M,S,T;
int U[NMmax], V[NMmax];
ll A[NMmax], B[NMmax];

void dijkstra(vector<vector<pair<int, ll> > > &graph,
		int s, vector<ll> &cost){
	for(int i=0; i<N; i++) cost[i] = INF;
	priority_queue<pair<ll, int>, vector<pair<ll, int> >,
		greater<pair<ll, int> > > que;
	cost[s] = 0;
	que.push(make_pair(0, s));
	while(!que.empty()){
		ll c = que.top().first;
		int n = que.top().second;
		que.pop();
		if(c > cost[n]) continue;
		for(int i=0; i<graph[n].size(); i++){
			int m = graph[n][i].first;
			ll d = graph[n][i].second;
			if(cost[m] > c+d){
				cost[m] = c+d;
				que.push(make_pair(c+d, m));
			}
		}
	}
}


int main(){
	cin >> N >> M >> S >> T;
	S--; T--;
	for(int i=0; i<M; i++){
		cin >> U[i] >> V[i] >> A[i] >> B[i];
		U[i]--;
		V[i]--;
	}

	vector<vector<pair<int, ll> > > s_g(N), t_g(N);
	for(int i=0; i<M; i++){
		s_g[U[i]].push_back(make_pair(V[i], A[i]));
		s_g[V[i]].push_back(make_pair(U[i], A[i]));
		t_g[U[i]].push_back(make_pair(V[i], B[i]));
		t_g[V[i]].push_back(make_pair(U[i], B[i]));
	}

	vector<ll> s_cost(N), t_cost(N);
	dijkstra(s_g, S, s_cost);
	dijkstra(t_g, T, t_cost);
	//for(int i=0; i<N; i++){
	//	cout << s_cost[i] << " " << t_cost[i] << endl;
	//}

	vector<ll> ans(N);
	ans[N-1] = 1e15-s_cost[N-1]-t_cost[N-1];
	for(int i=N-2; i>=0; i--){
		ans[i] = max((ll)1e15-s_cost[i]-t_cost[i], ans[i+1]);
	}

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

	return 0;
}


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

int main(){
	int N;
	cin >> N;
	int i, a[N], count[N];
	for(i=0; i<N; i++){
		cin >> a[i];
	}
	
	long long int ansmin = 99999999999;
	for(i=0; i<N; i++){
		count[i]=0;
		if(a[i]%2==0){
			do{
				a[i] /= 2;
				count[i]++;
			}while(a[i]%2==0);
		}
		
		if(ansmin>count[i])	ansmin = count[i];
	}
	
	cout << ansmin << endl;
	return 0;
}


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

int main(){
	string c[128];
	string ans[256];
	int w,h;

	cin >>h >> w;
	for (int i = 0; i < h; i++){
		cin >>c[i];
	}

	for (int i = 0; i < h; i++){
		ans[2*i] = c[i];
		ans[2*i+1] = c[i];
	}

	for (int i = 0; i < 2*h; i++){
		cout <<ans[i] <<endl;
	}




	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int sum;
inline int read(){
    int f=1,x=0;
    char ch;
    do{
        ch=getchar();
        if(ch=='-'){
            f=-1;
        }
    }while(ch<'0'||ch>'9');
    do{
        x=x*10+ch-48;
        ch=getchar();
    }while(ch>='0'&&ch<='9');
    return f*x;
}
inline int cmp(int a,int b){
    if(a>b){
        return a;
    }
    else{
        return b;
    }
}
int main(){
    vector<int> v;
    int n=read(),h=read();
    for(int i=0;i<n;++i){
        int temp=read();
        v.push_back(temp);
    }
    sort(v.begin(),v.end(),greater<int>());
    for(int i=0;i<h;++i){
        sum+=v[i];
    }
    cout<<sum;
    putchar('\n');
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
#define NUM 100000  // NUM以下の素数を求める
#define rep(i,n) for(int i=0;i<n;++i)
bool prime[NUM];
int shaku[NUM+1];
int eratos() {
	int i, j;
	int sq_num = (int)sqrt((double)NUM);

	// 1が立っているものが素数
	// 0が立っているものが合成数（素数ではない）

	for (i = 0; i < NUM; i++)
		prime[i] = 1;  // 全ての数に1を立てる
	prime[0] = 0;    // 1は素数ではない
	shaku[0] = 0;

	for (i = 1; i < sq_num; i++) {
		if (prime[i] == 1)          // prime[i]が素数なら
			for (j = (i + 1); (i + 1) * j <= NUM; j++)
				prime[(i + 1) * j - 1] = 0;  // 素数の倍数は素数ではない
	}
	for (i = 1; i < NUM; i++) {
		if (prime[i - 1] && prime[((i + 1) / 2) - 1])
			shaku[i] = shaku[i - 1] + 1;
		else shaku[i] = shaku[i - 1];
	}


	return (0);
}
int main() {
	eratos();
	int q;
	cin >> q;
	rep(j ,q) {
		int r, l,cnt;
		cin >> l >> r;
		cnt =shaku[r]-shaku[l-1];
		cout << cnt << endl;
	}

}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define mp make_pair
#define si short int
#define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pill pair<ll,ll>
#define f first
#define s second
#define pilc pair<ll,char>
#define all(a) (a).begin(),(a).end()
#define rep(s,e,step) for(int i = (s); i < (e) ; i += step)
#define vrep(s,e,step) for(int j = (s); j < (e) ; j += step)
#define ex exit(0) 
#define sz(a) (a).size()
#define triple pair<pill, ll>
#define pinode pair<node*, node*>
#define quadra pair<pill, pill>
using namespace std;
 
/*
 tips :
 Sqrt opt
 Binary search
 Try to find the easiest solution
 Recursiya
 FUCK YOU pishi kod akuratnee daun yobani
 sdohni v adu nahui blyat' y ub'uy tebya
 esli ti blyad' budesh pisat' kod gryaznim
 to ya tebya v rot viebu
*/
 
const ll N = 1E6 + 10;
const ll M = 3e3 + 10;
const ll big = 1e18;
const ll shift = 1000;
const ll block = 500;
const ll has = 200123140004043;

const ll mod = 998244353;

mt19937 srnd(chrono::steady_clock::now().time_since_epoch().count()); 

int main() {
    speed;
	ll str = 0;
	ll n;
	cin >> n;
	while(n--) {
	 	ll a, b;
	 	cin >> a >> b;
	 	if(a == b)
	 		str++;
		else
			str = 0;
		if(str == 3)
			cout << "Yes\n",ex;
	}
	cout << "No\n";
}             
                     
 
/*
6 0
1 2 4 6 8 10
1 4  d
*/ 

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
template <typename T>
inline void readin(T &x) {
    x = 0;
    T fh = 1;
    char ch = getchar();
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') fh = -1;
    for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ 48);
    x *= fh;
}
inline void d_read(double &x) {
    x = 0.0;
    int fh = 1;
    char ch = getchar();
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') fh = -1;
    for (; isdigit(ch); ch = getchar()) x = x * 10 + (ch ^ 48);
    if (ch == '.') {
        double num = 1.0;
        ch = getchar();
        for (; isdigit(ch); ch = getchar()) x = x + (num /= 10) * (ch ^ 48);
    }
    x *= fh;
}
template <typename T>
inline void wt(T x) {
    if (x > 9) wt(x / 10);
    putchar(x % 10 + 48);
}
template <typename T>
inline void writeln(T x, char c) {
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    wt(x);
    putchar(c);
}
const int N = 1e6 + 5;
bool vis[N];
int p[N], len, a[N];
inline void work(int x) {
    if (x <= 1) return;
    if (!vis[x]) {
        a[x] ++;
        return;
    }
    for (int i = 1; p[i] <= x / p[i]; i ++) {
        if (x % p[i] == 0) {
            a[p[i]] ++;
            while (x % p[i] == 0) {
                x /= p[i];
            }
        }
    }
    if (!vis[x]) {
        a[x] ++;
    }
    return;
}
int main() {
    for (int i = 2; i <= 1000000; i ++) {
        if (!vis[i]) {
            p[++ len] = i;
            for (int j = i; j <= 1000000 / i; j ++) {
                vis[i * j] = true;
            }
        }
    }
    int n;
    readin(n);
    for (int i = 1; i <= n; i ++) {
        int x;
        readin(x);
        work(x);
    }
    int opt = 0;
    for (int i = 1; i <= len; i ++) {
        if (a[p[i]] == n) {
            opt = 2;
            break;
        }
        else if (a[p[i]] > 1) {
            opt = 1;
        }
    }
    if (opt == 0) puts("pairwise coprime");
    else if (opt == 1) puts("setwise coprime");
    else puts("not coprime");
    return 0;
}

Measured memory_bytes: 8808
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  string S;
  cin >> S;
  int N = (int)S.size();
  ll ans = 0;
  int tmp = 0;
  for(int i=N-1; i>=0; i--) {
    if(i == 0) {
      if(S[i] == 'A')
	ans += tmp;
    } else {
      if(S[i-1] == 'B' && S[i] == 'C') {
	tmp++;
	i--;
      } else if(S[i] == 'A') {
	ans += tmp;
      } else {
	tmp = 0;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;cin>>s;int n,i=1;
  n=s.size();
  if(n==1)cout<<1<<endl;
  else{
    vector<string>a(1);
    a.at(0)=s.at(0);
    int c=0;
    while(i<n){
      for(int j=i;j<n;j++){
        string S=s.substr(i,j-i+1);
        if(S!=a.at(c)){
          a.push_back(S);
          c++;
          i=j+1;
        }
        else if(j==n-1)i++;
      }
    }
    cout<<a.size()<<endl;
  }
}

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

use itertools::Itertools;
use text_io::*;

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

fn main() {
    let s: String = read!();
    let k: usize = read!();
    let a = s.chars().take_while(|&c| c == '1').count();
    let b = s.chars().skip(a).next();

    let ans = if k <= a { '1' } else { b.unwrap() };

    println!("{}", ans);
}


Measured memory_bytes: 2164
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll knapsack(ll *wt, ll *val, ll w, ll n) {
	ll t[n + 1][w + 1];
	for (ll i = 0; i < n + 1; i++) {
		for (ll j = 0; j < w + 1; j++) {
			if (i == 0 || j == 0)
				t[i][j] = 0;
		}
	}
	for (ll i = 1; i < n + 1; i++) {
		for (ll j = 1; j < w + 1; j++) {
			if (wt[i - 1] <= j)
				t[i][j] = max(val[i - 1] + t[i - 1][j - wt[i - 1]], t[i - 1][j]);
			else
				t[i][j] = t[i - 1][j];
		}
	}
	return t[n][w];

}

int  main() {
	ll n, w;
	cin >> n >> w;
	ll wt[n], val[n];
	for (ll i = 0; i < n; i++) {
		cin >> wt[i] >> val[i];
	}
	cout << knapsack(wt, val, w, n) << endl;
}

Measured memory_bytes: 79104
//@author :  |< U $ |-|
#include<cmath>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<deque>
#include<queue>
#include<algorithm>
#include<list>
#include<cstring>
#include<unordered_map>
#define ll long long
// #define pb push_back
// #define pop pop_back
#define in(i,n) for(i=0;i<n;i++)
#define pi pair<long long ,long long>
#define mp make_pair
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define inm1(b)  memset(b,-1,sizeof(b))
#define in0(b) memset(b,0,sizeof(b))
#define ininf(b) memset(b,1000000001,sizeof(b))
#define MOD 1e9+7
#define inf 10000000001
#define d1(a) cout<<a<<" "<<endl
#define d2(a,b) cout<<a<<" "<<b<<endl
#define d3(a,b,c) cout<<a<<" "<<b<<" "<<c<<endl
#define TakeInput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
using namespace std;

int main(){
    jaldi
    #ifndef ONLINE_JUDGE
    TakeInput
    #endif

    ll i,j,k,n,m;
    ll t;
    
    cin>>n>>m>>k;
    if(m*k >= n){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
    
    
}


Measured memory_bytes: 3648
#include<stdio.h>

int main(void)
{

    int W,H;
    int i,j;

    scanf("%d %d",&H,&W);

    while(W != 0 && H != 0){
      for(i = 0;i<H;i++){
        for(j=0;j<W;j++)
          printf("#");
        printf("\n");
      }

      scanf("%d %d",&H,&W);
      printf("\n");
    }

    return 0;
}



Measured memory_bytes: 2580
#include <iostream>

using namespace std;

int main()
{
    while (true)
    {
        int N;
        cin>>N;
        if (N==0)
            break;
        int k[10000];
        k[9999] = 0;
        for (int i=0; i<N; i++)
            cin>>k[i];

        bool ok = false;
        int ans = 1;
        for (int i=0; i<N; i++)
        {
            if (k[i]>=1)
                ans++;
            if (k[i]>=2)
                ok = true;
        }
        if (ok)
            cout<<ans<<endl;
        else
            cout<<"NA"<<endl;
    }
}

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

ans = n * (n + 1) // 2

is_prime = [True] * (n + 1)
is_prime[0] = is_prime[1] = False
for i in range(2, n + 1):
    ans += i
    for j in range(2, n // i + 1):
        is_prime[i * j] = False
        ans += i * j

print(ans)


Measured memory_bytes: 145896
#include <iostream>
#include <math.h>
using namespace std;
int main() {
	int n;
	cin >> n;
	int *pt;
	pt = new int[n];
	for (int i = 1; i <= n; i++)
		cin >> pt[i];
	for (int i = 1; i <= n; i++) {
		cout << "node " << i << ": key = " << pt[i] << ", ";
		if(i != 1) cout << "parent key = " << pt[int(floor(i/2))] << ", ";
		if (i * 2 <= n) cout << "left key = " << pt[i * 2] << ", ";
		if (i * 2 + 1 <= n) cout << "right key = " << pt[i * 2 + 1] << ", ";
		cout << endl;
	}
}

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define lo long long 
#define inf 1000000000
#define md 1000000007
#define pb push_back
#define li 100005
using namespace std;
lo int a,b,c;
int main(){
	scanf("%lld %lld %lld",&a,&b,&c);
	if(a%2==1 || b%2==1 || c%2==1){
		printf("0\n");
		return 0;
	}
	if(a%4==b%4 && b%4==c%4 && a%4!=0){
		printf("-1\n");
		return 0;
	}
	for(int i=1;i<=200000000;i++){
		lo int toplam=a+b+c;
		a=(toplam-a)/2;
		b=(toplam-b)/2;
		c=(toplam-c)/2;
		if(a%2==1 || b%2==1 || c%2==1){
			printf("%d\n",i);
			return 0;
		}
	}
	printf("-1\n");
	return 0;
}


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

int main() {
    int N;

    cin >> N;

    int ans;

    if (N < 105){
        ans = 0;
    }
    else if (N < 135){
        ans = 1;
    }
    else if (N < 165){
        ans = 2;
    }
    else if (N < 189){
        ans = 3;
    }
    else if (N < 195){
        ans = 4;
    }
    else{
        ans = 5;
    }

    cout << ans << endl;
    return 0;
}

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

using namespace std;
using ll = long long;

int main()
{
    int n;
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; i++)
    {
        cin >> v[i];
    }
    sort(v.begin(), v.end(), greater<int>());
    ll ans = v[0];
    n -= 2;
    int i = 1;
    while (n > 0)
    {
        if (n == 1)
        {
            ans += v[i];
            n -= 1;
        }
        else
        {
            ans += (v[i] * 2);
            i++;
            n -= 2;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 4012
#include <iostream>
#include <string>
#include <math.h>

using namespace std;

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


long N,K;
int main(void) {

  scanf("%ld%ld",&N,&K);

  double ans = 0;
  for (int i = 1;i <= N;i++) {
    double p = 1.0 / 2.f;

    int c = 0;

    int j = i;

    while(j < K) {
      j *= 2;
      c++;
    }

    ans += 1.0 / N * pow(p,c);
  }

  printf("%.17f\n", ans);

  return 0;
}

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

int n;
int main(){
	cin>>n;
	if(n<10){cout<<n;return 0;}
	if(n<100){cout<<9;return 0;}
	if(n<1000){cout<<9+n-99;return 0;}
	if(n<10000){cout<<9+900;return 0;}
	if(n<100000){cout<<9+900+n-9999;return 0;}
	if(n<1000000){cout<<9+900+90000;return 0;}
}

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

using namespace std;

typedef long long ll;

#define faster ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define read freopen("in.txt", "r", stdin)
#define write freopen("out.txt", "w", stdout)
#define mem(x, n) memset(x, n, sizeof(x))
#define all(x) x.begin(), x.end()
#define endl "\n"

int main() {
	faster;

	string s,t;
	cin >> s >> t;
	int n = s.size(), m = t.size();
	priority_queue<int,vector<int> , greater<int> > pq;
	
	for(int i = 0; i  < n-m + 1; i++){
		int cnt = 0;
		for(int j = 0; j < m; j++){
			if(s[i+j] == t[j]){
				cnt++;
			}
		}
		pq.push(m-cnt);
	}


	cout << pq.top() << endl;

	return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  cin >> a >> b;
  double c = (a + b) / 2.0;
  int d = static_cast<int>(c);
  if(d < c){
  	d = d + 1;
  }
  cout << d << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long x[100001];
int main()
{
	long long ans=0,n,a,b,i;
	cin>>n>>a>>b;
	for(i=1;i<=n;i++)
	 cin>>x[i];
	for(i=2;i<=n;i++)
	 ans+=min((x[i]-x[i-1])*a,b);
	cout<<ans<<endl;
}

Measured memory_bytes: 1024
mod = 10 ** 9 + 7

S = input()

dp = [0] * 13

dp[0] = 1

l = len(S)

for i in S:
    nextdp = [0] * 13
    if i == "?":
        for k in range(10):
            for j in range(13):
                nextdp[((j * 10) + k) % 13] += dp[j]
                # nextdp[((j * 10) + k) % 13] %= mod

    else:
        k = int(i)
        for j in range(13):
            nextdp[((j * 10) + k) % 13] += dp[j]
            # nextdp[((j * 10) + k) % 13] %= mod

    dp = [nextdp[i] % mod for i in range(13)]

    # for i in range(13):
    #     dp[i] = nextdp[i] % mod

print(dp[5])


Measured memory_bytes: 74220
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int absi(int x1,int x2){
  if(x1>x2)swap(x1,x2);
  return x2-x1;
}

int main(){
  int N;
  cin>>N;
  int h[N];
  REP(i,N)cin>>h[i];
  int dp[N];
  REP(i,N)dp[i]=0;
  dp[1]=absi(h[0],h[1]);
  FOR(i,2,N){
    dp[i]=min(dp[i-2]+absi(h[i-2],h[i]),dp[i-1]+absi(h[i-1],h[i]));
  }
  cout<<dp[N-1]<<endl;
  return 0;
}


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

int main() {
  int n, k;
  cin >> n >> k;
  int h[n];

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

  int result = 0;

  for (int i = 0; i < n; ++i) {
    if (h[i] >= k) {
      ++result;
    }
  }

  cout << result;

  return 0;
}


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

#define pii  pair<int, int>
#define vi vector<int >
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define sz(x) (x).size()
#define all(x) (x).begin(), (x).end() //Forward traversal
#define rall(x) (x).rbegin, (x).rend() //reverse traversal

#define ll long long
#define ld long double

const ld EPS = 10e-9;
const int INF = 1e9 + 5;
const long long INFLL = (ll)INF * (ll)INF;
const ll MOD = 1e9 + 7;
const ld PI = 3.14159265358979323846;

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

template <typename T>
ostream& operator<<(ostream& os, const set<T>& v)
{
    os << "{";
    for (const auto& it : v) {
        os << it;
        if (it != *v.rbegin())
            os << ", ";
    }
    os << "}\n";
    return os;
}

template <typename T>
ostream& operator<<(ostream& os, const unordered_set<T>& v)
{
    os << "{";
    for (const auto& it : v) {
        os << it;
        if (it != *v.rbegin())
            os << ", ";
    }
    os << "}\n";
    return os;
}

template <typename T, typename S>
ostream& operator<<(ostream& os, const map<T, S>& v)
{
    os << "{";
    for (const auto& it : v) {
        os << it.first << " : "
           << it.second;

        if( it != *v.rbegin())
            os  << ", ";
    }

    os << "}\n";
    return os;
}

template <typename T, typename S>
ostream& operator<<(ostream& os, const unordered_map<T, S>& v)
{
    os << "{";
    for (const auto& it : v) {
        os << it.first << " : "
           << it.second;

        if( it != *v.rbegin())
            os  << ", ";
    }

    os << "}\n";
    return os;
}

template <typename T, typename S>
ostream& operator<<(ostream& os, const pair<T, S>& v)
{
    os << "(";
    os << v.first << ", "
       << v.second << ")";
    os << "\n";
    return os;
}

#define DEBUG

#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define debug(...)
#endif


// __gcd(x, y)

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

    int h1, m1, h2, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;

    int diff = h2 * 60 + m2 - h1 * 60 - m1;

    cout << diff - k;

//    int diff = h2 - h1;
//    int diff2 = m2 - m1;
//    if(diff2 < 0)
//        diff2 += 60;

//    cout << diff * 60 + diff2 - k << endl;



    return 0;
}


Measured memory_bytes: 3584
package main

import (
	"fmt"
)

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	var c [3]int
	c[a-1] = 1
	c[b-1] = 1

	for i, v := range c {
		if v == 0 {
			fmt.Println(i + 1)
		}
	}

}


Measured memory_bytes: 1768
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N = 1e5 + 5;

int n, m;
int a[N];
priority_queue<int> pq;

int32_t main()
{
	IOS;
	cin >> n >> m;
	for(int i = 1; i <= n; i++)
	{
		cin >> a[i];
		pq.push(a[i]);
	}
	while(m > 0)
	{
		int x = pq.top();
		pq.pop();
		pq.push(x / 2);
		m--;
	}
	int ans = 0;
	while(pq.size())
	{
		ans += pq.top();
		pq.pop();
	}
	cout << ans;
	return 0;
}


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

struct UnionFind {
    vector<int> par;
    UnionFind(int n) : par(n) {
        init(n);
    }
    
    void init(int n) {
        for(int i = 0; i < n; ++i) par[i] = i;
    }
    
    int root(int x) {
        if(par[x] == x) return x;
        else return par[x] = root(par[x]);
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    void merge(int x, int y) {
        x = root(x); y = root(y);
        if(x == y) return;
        
        par[x] = y;
    }
};

int main() {
    int N, K, L;
    cin >> N >> K >> L;
    UnionFind road(N);
    for(int k = 0; k < K; ++k) {
        int p, q;
        cin >> p >> q;
        --p, --q;
        road.merge(p, q);
    }
    UnionFind train(N);
    for(int l = 0; l < L; ++l) {
        int r, s;
        cin >> r >> s;
        --r, --s;
        train.merge(r, s);
    }
    
    map<pair<int, int>, int> ma;
    for(int i = 0; i < N; ++i) {
        ++ma[{road.root(i), train.root(i)}];
    }
    for(int i = 0; i < N; ++i) {
        cout << ma[{road.root(i), train.root(i)}];
        if(i < N-1) cout << " ";
        else cout << endl;
    }
}


Measured memory_bytes: 13568
def paint(b, type, x, y):
    if type == 1:
        b[:, :x] = 0
    elif type == 2:
        b[:, x:] = 0
    elif type == 3:
        b[:y, :] = 0
    else:
        b[y:, :] = 0
    return b

import numpy as np
W, H, N = list(map(int, input().split()))
w = []
for i in range(0, W):
    w.append(1)
b = [w for i in range(0, H)]
board = np.array(b)

for i in range(0, N):
    x, y, type = list(map(int, input().split()))
    board = paint(board, type, x, y)

print(str(np.sum(board)))

Measured memory_bytes: 18344
#include <bits/stdc++.h>
#define inf 1000000000 //1E+9
#define mod 1000000007
using std::cin;
using std::cout;
using std::endl;

int main(){
	int a,b;cin>>a>>b;
	if(a==b)cout<<a*2<<endl;
	else cout<<std::max(a,b)*2-1<<endl;

	return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using ll = long long;
using Graph = vector<vector<int>>;

int main()
{
    int A, B;
    cin >> A >> B;
    if ((1 <= A && A <= 9) && (1 <= B && B <= 9))
        cout << A * B << endl;
    else cout << -1 << endl;
}

Measured memory_bytes: 256
let n = read_int ()
let a_s = Array.init n @@ fun _ -> Scanf.scanf " %d" (+) 0
let bs = Array.make n 0
let _ = for k = n downto 1 do let s, i = ref 0, ref 2 in while !i * k <= n do s := !s + bs.(!i * k - 1); incr i done; bs.(k - 1) <- if !s mod 2 = a_s.(k - 1) mod 2 then 0 else 1 done; Array.(Printf.printf "%d\n" @@ fold_left (+) 0 bs; iteri (fun i b -> if b = 1 then Printf.printf "%d " (i + 1)) bs)

Measured memory_bytes: 6912
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());

        Map<Integer,Integer> odd_map = new HashMap<>();
        Map<Integer,Integer> evn_map = new HashMap<>();
        int odd_val; int evn_val;
        for (int i = 0; i < n; i+=2) {
            odd_val = Integer.parseInt(sc.next());
            evn_val = Integer.parseInt(sc.next());
            odd_map.put(odd_val, odd_map.getOrDefault(odd_val, 0)+1);
            evn_map.put(evn_val, evn_map.getOrDefault(evn_val, 0)+1);
        }

        EIITuple mfeOdd = fsFreqElem(odd_map);
        EIITuple mfeEvn = fsFreqElem(evn_map);

        int result;
        if (mfeOdd.fvl == mfeEvn.fvl){

            int res1 = n - mfeOdd.fst - mfeEvn.snd;
            int res2 = n - mfeOdd.snd - mfeEvn.fst;

            result = Math.min (res1, res2);
        } else {
            result = n - mfeOdd.fst - mfeEvn.fst; 
        }

        System.out.print(result + "\n");
    }


    private static EIITuple fsFreqElem(Map<Integer,Integer> map){

        int localMaxValue = -1;
        int localMax1Count = 0;
        int localMax2Count = 0;

        for (Map.Entry<Integer,Integer> entry : map.entrySet()) {

            int currentCount = (int) entry.getValue();
            if (currentCount > localMax1Count) {
                localMaxValue  = entry.getKey();

                localMax2Count = localMax1Count;
                localMax1Count = currentCount;
            } else if (currentCount > localMax2Count) {
                localMax2Count = currentCount;
            }

        }

        return new EIITuple (localMaxValue, localMax1Count, localMax2Count);
    }

}

class EIITuple {
    public int fvl;
    public int fst;
    public int snd;
    EIITuple (int v, int f, int s){
        fvl = v; fst = f; snd = s;
    }
}


Measured memory_bytes: 48448