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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

template<typename T>
T mod(T a, T b){
    return (a + b) % b;
}

template<typename T>
T gcd(T a, T b){
    if (b == 0) return a;
    return gcd(b, a % b);
}

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

// n を素因数分解
map<ll, ll> factor(ll n){
    map<ll, ll> mp;
    for (ll i = 2; i*i <= n; i++) {
        while (n % i == 0) {
            mp[i]++;
            n /= i;
        }
    }

    if (n > 1) {
        mp[n]++;
    }

    return mp;
}

// 文字列に "hoge" が含まれているか
// string str = "hogepiyo";
// if (str.find("hoge") != string::npos) {
//     cout << "文字列が含まれています" << endl;
// }

// char to string
// char c = 'a';
// string str = {c};

void solve(){
    ll N, M;
    cin >> N >> M;

    map<ll,ll> mp;
    for (int i = 0; i < N; i++) {
        ll Ai;
        cin >> Ai;
        mp[Ai]++;
    }

    vector<pair<ll,ll>> P;
    for (auto itr = mp.begin(); itr != mp.end(); itr++) {
        P.push_back({itr->first, itr->second});
    }

    vector<ll> B(M), C(M);
    for (int i = 0; i < M; i++) {
        cin >> B[i] >> C[i];
    }

    for (int i = 0; i < M; i++) {
        P.push_back({C[i], B[i]});
    }
    sort(all(P));
    reverse(all(P));

    ll sum = 0;
    ll cnt = 0;
    for (ll i = 0; i < (ll)P.size(); i++) {
        ll Bi = P[i].second, Ci = P[i].first;
        if (cnt + Bi <= N) {
            cnt += Bi;
            sum += Bi * Ci;
        } else {
            sum += (N - cnt) * Ci;
            break;
        }
    }

    cout << sum << endl;

    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


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

int main(){
	int n, R;
  	cin >> n >> R;
  
  	if(n >= 10) cout << R << endl;
  	else cout << R + 100 * (10 - n) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
const ll INF = 1LL<<60;
const ll M = pow(10,9)+7;
/*template*/

int main()
{
  ll L;cin>>L;
  double a=1.*L/3;
  printf("%.20lf\n",1.*a*a*a);
  return 0;
}


Measured memory_bytes: 256
require 'pp'
# IS_DEBUG = true
IS_DEBUG = false
def dputs str
	if(IS_DEBUG)
		puts str
	end
end
def dpp str
	if(IS_DEBUG)
		pp str
	end
end

A,B,C,X,Y=gets.chomp.split(' ').map{|n| n.to_i}
if((A+B)/1.0/2 < C)
	puts X*A+Y*B
else
	if(X < Y)
		min = X*(C)*2
		max = (Y-X)*B
		max2 = Y*C*2
	else
		min = Y*(C)*2
		max = (X-Y)*A
		max2 = X*C*2
	end
	if(min+max < max2)
		puts min+max
	else
		puts max2
	end
end



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

#ifdef DEBUG
#define PRINT(x)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#x<<" = "<<(x)<<endl;
#define PRINTA(a,first,last)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#a<<"["<<(first)<<", "<<(last)<<")"<<endl;\
    for (int i=(first);i<(last);++i){cout<<#a<<"["<<i<<"] = "<<(a)[i]<<endl;}
#else
#define PRINT(x)
#define PRINTA(a,first,last)
#endif

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

template <class T, class U> void amax(T& x, U y) {if (x < y) x = y;}
template <class T, class U> void amin(T& x, U y) {if (x > y) x = y;}

int main(void)
{
    constexpr int N_MAX = 3000;
    int N;
    int a[N_MAX];
    cin >> N;
    REP(i, N) cin >> a[i];

    ll sum[N_MAX + 1];
    sum[0] = 0;
    REP(i, N) sum[i + 1] = sum[i] + a[i];

    ll dp[N_MAX][N_MAX];
    REP(i, N) REP(j, N) dp[i][j] = -1;

    function<ll(int, int)> f = [&](int first, int last) -> ll {
        if (dp[first][last] != -1) {
            return dp[first][last];
        }
        if (first == last) {
            return dp[first][last] = a[first];
        }
        return dp[first][last] = sum[last + 1] - sum[first] - min(f(first + 1, last), f(first, last - 1));
    };

    ll X = f(0, N - 1);
    ll Y = sum[N] - X;
    cout << X - Y << endl;
    return 0;
}



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

using namespace std;

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

    return false;
}

int main()
{
    int N;
    long long W;
    cin >> N >> W;

    vector<long long> w(N), v(N);
    for (int i = 0; i < N; i++)
    {
        cin >> w[i] >> v[i];
    }

    vector<vector<long long>> dp(N, vector<long long>(W + 1, 0));

    for (int j = 0; j <= W; j++)
    {
        dp[0][j] = (j >= w[0]) ? v[0] : dp[0][j];
    }

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

            chmax(dp[i][j], dp[i - 1][j]);
        }
    }

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


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

// typedef
// -----------------------------------------------------------------------------
typedef long long ll;
typedef long double ld;

// container util
// -----------------------------------------------------------------------------
#define ALL(c)  (c).begin(),(c).end()
#define SZ(c) ((ll)(c).size())
#define MAX(c) *max_element(ALL(c))
#define MIN(c) *min_element(ALL(c))
#define SORT(c) sort((c).begin(),(c).end())

// repetition
// -----------------------------------------------------------------------------
#define FOR(i, a, b) for(ll i= (a); i < (ll)(b); ++i)
#define REP(i, n) FOR(i, 0, n)

// constant
// -----------------------------------------------------------------------------
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);

// debug
// -----------------------------------------------------------------------------
#define DUMP(x)  cerr << #x << " = " << (x) << endl

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    ll A, B, C, D, E; cin >> A >> B >> C >> D;
    E = C * D / gcd(C, D);
    ll c = B / C - (A - 1) / C;
    ll d = B / D - (A - 1) / D;
    ll e = B / E - (A - 1) / E;
    ll ans = (B - A + 1) - (c + d - e);
    cout << ans << "\n";
}

Measured memory_bytes: 3644
N = int(input())
# N, K = map(int, input().split())
# c = list(map(int, input().split()))
# d = [list(map(int, input().split())) for _ in range(N)]
# s = input()


# ans = 0
# i = 0
#
# while N > 0:
#     s = N % 10
#     ans += pow(s*(-2), i)
#     N = N // 10
#     i = i + 1



ans = ""
n_array = []

if N == 0:
    ans = "0"

while N != 0:
    if N % 2 == 0:
        s = 0
    else:
        s = 1

    n_array.insert(0, s)

    if N > 0:
        N = (N // 2)*(-1)
    else:
        N = (-1)*N
        if N % 2:
            N += 1
        N = N // 2

maped_list = map(str, n_array)
for cc in maped_list:
    ans += cc


print(ans)

Measured memory_bytes: 3064
use proconio::{fastout, input};
// use proconio::marker::*;

#[fastout]
fn main() {
   input! {
      n: usize,
      mut ab: [(i64, i64); n]
   }
   let mut a: Vec<_> = ab.iter().map(|&(a, _)| a).collect();
   let mut b: Vec<_> = ab.iter().map(|&(_, b)| b).collect();
   a.sort();
   b.sort();
   if n % 2 == 1 {
      let x = (n - 1) / 2;
      let l = a[x];
      let r = b[x];
      println!("{}", r - l + 1);
   } else {
      let x1 = n / 2 - 1;
      let x2 = n / 2;
      let l1 = a[x1];
      let r1 = b[n - 1 - x1];
      let l2 = a[x2];
      let r2 = b[n - 1 - x2];
      let mut ans = 0;
      ans += r1 - l1 + 1;
      ans += r2 - l2 + 1;
      ans -= 1;
      println!("{}", ans);
   }
}


Measured memory_bytes: 12860
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

#[allow(dead_code)]
struct Scanner<'a> {
    cin: StdinLock<'a>,
}
#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn input<T: FromStr>(&mut self) -> T {
        self.read().unwrap()
    }

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

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

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let x: i64 = sc.input();
    let y: i64 = sc.input();
    let a: i64 = sc.input();
    let b: i64 = sc.input();
    let c: i64 = sc.input();
    let mut ps: Vec<i64> = sc.vec(a as usize);
    let mut qs: Vec<i64> = sc.vec(b as usize);
    let rs: Vec<i64> = sc.vec(c as usize);

    ps.sort_by_key(|&x| -x);
    qs.sort_by_key(|&x| -x);
    let mut v = [&ps[0..x as usize], &qs[0..y as usize], &rs].concat();
    v.sort_by_key(|&x| -x);

    let ans: i64 = v[..(x + y) as usize].iter().sum();
    println!("{}", ans);
}


Measured memory_bytes: 12540
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <math.h>
#include <string>
#include <sstream>
#define ll long long
#define F first
#define S second
#define pb push_back
#define ld long double
#define pll pair<long long,long long>
#define pld pair<long double,long double>
#define ios     ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
ll mod=1000000007;
ll INF=1e18;
ll gcd (ll a,ll b)
{
    if(b==0)
        return a;
    else
        return gcd(b,a%b);
}
ll fastexp(ll x ,ll n)
{
    ll result =1;
    while(n>0)
    {
        if(n%2==1)
            result*=x;
        x*=x;
        n=n/2;
    }
    return result;
}

ll modularExp(ll x,ll n,ll mod)
{
    ll result=1;
    while(n>0)
    {
        if(n%2==1)
            result=(result*x)%mod;
        x=((x%mod)*(x%mod))%mod;
        n=n/2;
    }
    return (result)%mod;
}
bool isPrime(ll n)
{
    for(ll i=2;i*i<=n;i++)
        if(n%i==0)
            return false;
    return true;
}
bool mycomp(pll &a,pll &b)
{
    if(a.F!=b.F)
        return a.F < b.F;
    else
        return a.S < b.S;
}



void solve()
{
     ll n;
     cin>>n;
     vector<ll> v(n+1);
     ll i;
     for(i=1;i<=n;i++)
          cin>>v[i];
     ll ans=0;
     for(i=2;i<=n;i++)
     {
          if(v[i]>=v[i-1])
               continue;
          else
          {
               ans+=v[i-1]-v[i];
               v[i]=v[i-1];
               
          }
     }
     cout<<ans;
}

     
     


int main()
{
    ios;
    ll t;
//    cin>>t;
   t=1;
    while(t--)
        solve();
}

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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T, class T2> void amax(T& a,T2 b){ if(a < b) a = b;}


int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int h, w, k;
	cin >>h >>w >>k;
	vector<string> s(h);
	rep(i, h) cin >>s[i];
	vector<VI> ba(h, VI(w));
	rep(i,h) rep(j,w) ba[i][j] = s[i][j] -'0';
	int res = 1<<28;
	rep(i,1<<(h-1)){
		int tsu = 0;
		vector<int> cv(h); //sh;
		rep(j, h){ cv[j] = tsu; if((i>>j)& 1) tsu++; }
		if(tsu > res) continue;
		vector<int> cdy(tsu+1,0);
		rep(x, w){
			bool addsw=false;
			vector<int> gdy(tsu+1,0);
			rep(y, h){
				gdy[cv[y]] += ba[y][x];
				if(gdy[cv[y]] > k) goto lastloop;
				cdy[cv[y]] += ba[y][x];
				if(cdy[cv[y]] > k) addsw=true;
			}
			if(addsw){
				tsu++;
				fill(all(cdy), 0);
				x--; //今回ダメだったのでなかったことに
			}
		}
		res = min(res, tsu);
		lastloop: ;
	}
	cout << res <<"\n";
	return 0;
}


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

int main() {
  int N, M; cin >> N >> M;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  vector<long long> S(N+1);
  S.at(0) = 0;
  for (int i = 0; i < N; i++) S.at(i+1) = (S.at(i) + A.at(i)) % M;
  map<int, int> m;
  long long ans = 0;
  // 自分と同じ数字 (余り) が左に何個あるのか
  for (int i = 0; i <= N; i++) {
    if (m.count(S.at(i))) {
      ans += m[S.at(i)];
      m[S.at(i)]++;
    }
    else m[S.at(i)] = 1;
  }
  cout << ans << endl;
}


Measured memory_bytes: 4352
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main() {
    ll n,m;
    bool a[200010],b[200010];
    Fill(a,false);
    Fill(b,false);
    std::cin >> n>>m;
    for (int i = 0; i < m; i++) {
        ll tmpa,tmpb;
        std::cin >> tmpa>>tmpb;
        if(tmpa==1){
            a[tmpb] = true;
        }
        if(tmpb==n){
            b[tmpa] = true;
        }
        
    }
    
    for (int i = 1; i <= n; i++) {
        if(a[i] && b[i]){
            std::cout << "POSSIBLE" << std::endl;
            return 0;
        }
    }
    std::cout << "IMPOSSIBLE" << std::endl;
}


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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int di2[] = {1, 1, -1, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2, -2, -1};
const int dj2[] = {1, -1, 1, -1, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2, -2, -1, 0, 1, 2, 2};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};



int main()
{
  string s; cin >> s;
  int sum = 0;
  for(auto c : s) {
    sum += c-'0';
  }
  if(sum%9 == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

int main(){
  int n;
  vector<int> a;
  cin >> n;

  int temp;
  for(int i = 0; i < n; i++){
    cin >> temp;
    a.push_back(temp);
  }

  int now = 1;
  for(int i = 0; i < n; i++){
    if(a.at(i) == now){
      now++;
    }
  }

  int ans = n - now + 1;
  if(now == 1){
    ans = -1;
  }
  cout << ans << endl;
}

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

int main(){
	double L;
	cin>>L;
	L/=3.000000000000;
	double s=1;
	s*=L;
	s*=L;
	s*=L;
	cout<<fixed<<setprecision(12)<<s<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  int coin1,coin2,price,money;
  char str[16];
  
  fgets(str,sizeof(str),stdin);
  sscanf(str,"%d%d%d",&coin1,&coin2,&price);
  
  money = coin1 + coin2;
  
  if(money>=price)
  {
    puts("Yes");
  }else
  {
    puts("No");
  }
  
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <queue>
#include <bitset>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, n) for(int i = (a); i < (n); i++)
#define MP make_pair
#define all(s) (s).begin(), (s).end()
#define rev(s) (s).rbegin(), (s).rend()
#define X first
#define Y second

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> P;

void test(){freopen("test.txt", "r", stdin);}

int main(){
	string s;
	vector<vi> vv;
	while(getline(cin, s)){
		vector<int> v;
		stringstream ss;
		ss << s;
		int n;
		char c;
		while(ss >> n){
			ss >> c;
			v.push_back(n);
		}
		vv.push_back(v);
	}

	const int INF = 2<<29;

	reverse(all(vv));

	FOR(i, 1, vv.size()){
		rep(j, vv[i].size()){
			int left = j, right = j+1;
			if(i <= vv.size()/2){
				left--;
				right--;
			}
			if(left < 0) left = -INF;
			else left = vv[i-1][left];
			if(right >= vv[i-1].size()) right = -INF;
			else right = vv[i-1][right];

			vv[i][j] += max(left, right);
		}
	}

	cout << vv[vv.size()-1][0] << endl;

	return 0;
}

Measured memory_bytes: 1268
///Users/wantedly/Documents/git/atcoder-swift/Sources/atcoder-swift/main

let k = cin.n
var (a,b) = cin.pair

while(a <= b) {
  if a%k == 0 {
    print("OK")
    a = 9999
    break
  }
  a += 1
}

if a != 9999 {
  print("NG")
}

import Foundation
#if os(Linux)
    import Glibc
#else
    import Darwin.C
#endif

enum cin {
    // 123
    static var n: Int { Int(readLine()!)! }
    // 12 23
    static var pair: (Int, Int) { let line = readLine()!.components(separatedBy: " "); return (Int(line[0])!, Int(line[1])!) }
    // 12 23 34
    static var triple: (Int, Int, Int) { let line = readLine()!.components(separatedBy: " "); return (Int(line[0])!, Int(line[1])!, Int(line[2])!) }
    // AtCoder
    static var line: String { readLine()! }
    // At Coder
    static var arrayStr: [String] { line.components(separatedBy: " ") }
    // 1 2 3 4
    static var array: [Int] { line.components(separatedBy: " ").map { Int($0)! } }
    // 1
    // 2
    // 3
    static func v_array(count: Int) -> [Int] { (0..<count).map { _ in n } }
}

extension Int {
    // 123 -> [1, 2, 3]
    var digits: [Int] { Array(String(self)).map { Int(String($0))! } }
}

extension Array where Element == Int {
    // [2, 1, 3, 2] -> 8
    var sum: Int { self.reduce(0, +) }
    // [2, 1, 3, 2] -> [1, 2, 2, 3]
    var orderBy: [Int] { sorted() }
    // [2, 1, 3, 2] -> [3, 2, 2, 1]
    var orderByDesc: [Int] { sorted(by: { $0 > $1 }) }
    // [2, 1, 3, 2] -> [2, 1, 3]
    var distinct: [Int] { Array(Set(self)) }
}

extension String {
    // e.g. cin.line.regex(match: "^(dream|dreamer|erase|eraser)*$")
    func regex(match pattern: String) -> Bool {
        let regex = try! NSRegularExpression(pattern: pattern)
        return regex.firstMatch(in: self, range: NSRange(location: 0, length: self.count)) != nil
    }
    // "ABC"[1] -> "B"
    subscript(i: Int) -> Character {
        get {
            self[index(at: i)]
        }
        set(char) {
            var characters = Array(self)
            characters[i] = char
            self = String(characters)
        }
    }
    func index(at offset: Int) -> String.Index { index(startIndex, offsetBy: offset) }
    // "ABC".swapAt(0, 1) -> "BAC"
    mutating func swapAt(_ index1: Int, _ index2: Int) {
        var characters = Array(self)
        characters.swapAt(index1, index2)
        self = String(characters)
    }
}

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

int main()
{
    ll n, k;
    cin >> n >> k;
    vector<int> nums;
    map<int, ll> num_cnt;

    rep(i, 0, n)
    {
        int a, b;
        cin >> a >> b;

        if (num_cnt.count(a) == 0)
            nums.push_back(a);

        num_cnt[a] += b;
    }
    sort(nums.begin(), nums.end());

    ll cnt = 0;
    int now;
    for (int i = 0; i < nums.size() and cnt < k; i++)
    {
        now = nums[i];
        cnt += num_cnt[now];
    }
    cout << now << endl;
    return 0;
}


Measured memory_bytes: 4476
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.math, std.typecons;


void main() {
    int n, t;
    scan(n, t);

    auto imos = new int[](t + 2);

    foreach (i ; 0 .. n) {
        int li, ri; scan(li, ri);
        imos[li]++;
        imos[ri]--;
    }

    foreach (i ; 0 .. t + 1) {
        imos[i + 1] += imos[i];
    }

    writeln(imos.reduce!max);
}







void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}



Measured memory_bytes: 3720
from operator import itemgetter

# main
n,m = map(int,input().split())

tasks = []
for i in range(m):
    a,b = map(int,input().split())
    tasks.append([b,a])



tasks = sorted(tasks, key=lambda x: x[0])
end = 0
start = 0
ans = 0
for task in tasks:
    if task[1]<start: continue
    end = task[0]
    ans += 1
    start = end

print(ans)

Measured memory_bytes: 22088
#include <algorithm>
#include <iostream>
#include <cstdio>

int main()
{
    int a = 0, b = 0, c = 0, cnt = 0;
    std::cin >> a >> b >> c;
    for (int i = a; i <= b; ++i)
        if (c % i == 0)
            ++cnt;
    std::cout << cnt << std::endl;
    return 0;
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define LINF 1e18
#define INF 1e9
using namespace std;

int main(){
    
    ll l;
    double temp;
    cin >> l;
    temp = l/3.0;
    cout << setprecision(10) <<  pow(temp,3) << endl;
    return 0;
}

Measured memory_bytes: 256
# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
# list(map(int, list(input()))) # スペースがない数字リストを読み込み
import math
import fractions
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)
import collections
from collections import Counter
from collections import deque
import pprint
import itertools

sr = lambda: input()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""


def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


# a^n
def power(a, n, mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod


# n*(n-1)*...*(l+1)*l
def kaijo(n, l, mod):
    if n == 0:
        return 1
    a = n
    tmp = n - 1
    while (tmp >= l):
        a = a * tmp % mod
        tmp -= 1
    return a


inf = 10 ** 18
mod = 10 ** 9 + 7

n = ir()
a = []
b = []
for i in range(n):
    x,y = lr()
    a.append(x)
    b.append(y)

ans = 0
a.reverse()
b.reverse()
for i in range(n):
    if (a[i]+ans)%b[i] != 0:
        ans+=(b[i]*((a[i]+ans)//b[i]+1)-(a[i]+ans))
print(ans)


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

#define rep(i, a, b) for (int i = (a), i##end = (b); i <= i##end; ++i)
#define per(i, a, b) for (int i = (a), i##end = (b); i >= i##end; --i)

namespace IO {
    #define gc getchar()
    template <typename T>
    inline void read(T& x) {
        x = 0; bool f = 1; char ch;
        for (ch = gc; ch < '0' || '9' < ch; ch = gc) if (ch == '-') f ^= 1;
        for (; '0' <= ch && ch <= '9'; ch = gc) x = (x << 3) + (x << 1) + (ch ^ 48);
        x = f ? x : -x;
    }
    #undef gc
}

int n, x, t;

int main() {
    IO::read(n), IO::read(x), IO::read(t);
    int ans = t * ceil(1.0 * n / x);
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 3660
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    string s; cin>>s;
    for(char c='a';c<='z';c++){
        bool found=false;
        REP(i,s.size()){
            if(s[i]==c) found=true;
        }
        if(!found){
            cout<<c<<endl;
            return 0;
        }
    }
    cout<<"None"<<endl;
}


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

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

    sort(a, a + n);

    int t = a[0], tt = 1 << 29;
    for (int i = 0; i < n; i++) {
        if (abs((a[n - 1] + 1 ) / 2 - a[i]) < tt) {
            tt = abs((a[n - 1] + 1) / 2 - a[i]);
            t = a[i];
        }
    }

    cout << a[n - 1] << " " << t << endl;

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
//:/
#define pb emplace_back
#define mp make_pair
#define nt _ll128
#define ld long double
long double PI =3.14159265358979323846;
using ll = long long;



const ll modo=998244353;
const ll inf=1e17;
const ll ms=(2e6)+5;

ll ar[ms];


int main()
{
    idfc;

    int n;
    cin>>n;
    int i;

    for(i=1;i<=n;i++)
    {
        cin>>ar[i];
    }
    if(ar[1])cout<<"0";
    else{

        sort(ar+1,ar+n+1);

        map<int,int> mm;
        ll ans=1;
      mm[0]=1;
        for(i=2;i<=n;i++)
        {
            if(ar[i]==0)
            {
                cout<<"0";
                return 0;
            }
            ans=(ans*mm[ar[i]-1])%modo;

            mm[ar[i]]+=1;
        }
        cout<<ans;
    }


    return 0;
}

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#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 FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

ll voiceResult(ll speaker, char voice, ll neighbor){
  if(voice == 'o'){
    if(speaker == 0)
      return neighbor;
    else
      return (neighbor+1)%2;
  }
  else{
    if(speaker == 0)
      return (neighbor+1)%2;
    else
      return neighbor;
  }
}

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

  ll n;
  cin >> n;
  string s;
  cin >> s;

  vll zoo(n);
  REP(a, 2){
    REP(b, 2){
      zoo[0] = a;
      zoo[1] = b;
      REP1(i, n-1){
        zoo[i+1] = voiceResult(zoo[i], s[i], zoo[i-1]);
      }
      if(voiceResult(zoo[0], s[0], zoo[n-1]) == zoo[1] &&
          voiceResult(zoo[n-1], s[n-1], zoo[n-2]) == zoo[0]){
        REP(i, n){
          if(zoo[i] == 0)
            cout << 'S';
          else
            cout << 'W';
        }
        cout << endl;
        return 0;
      }
    }

  }

  cout << -1 << endl;
}


Measured memory_bytes: 1360
#include <bits/stdc++.h> 
#define REP(i, b) for(int i = 0; i < (b); i++)
#define REPS(i, b) for(int i = 1; i <= (b); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vd = vector<double>;
using vs = vector<string>;
using vb = vector<bool>;
using vp = vector<P>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using vvb = vector<vb>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll  INFL = 1e18;

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;
}

signed main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int N; cin >> N;
    vvi p(N, vi(3)); REP(i, N) cin >> p[i][0] >> p[i][1] >> p[i][2]; 
    vvi dp(N+1, vi(3, 0));
    REPS(i, N)
    {
        REP(j, 3)
        {
            REP(k, 3)
            {
                if(j == k) continue;
                chmax(dp[i][j], dp[i-1][k]+p[i-1][k]);
            }
        }
    }
    cout << *max_element(ALL(dp[N])) << endl;
}

Measured memory_bytes: 11264
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define crep(i) for(char i='a';i<='z';i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define ALL(x) (x).begin(),(x).end()
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

int main(){
    char A[107];
    cin >> A;
    rep(i,strlen(A)){
        if((i%2==0 && A[i]=='L')||(i%2==1 && A[i]=='R')){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes"  << endl;
}


Measured memory_bytes: 760
"""
0011 = 4
0101 = 4
00111 = 4
01011 = 4
10011 = 4
000111 = 6
001011 = 6

0または1のいずれか個数の少ない文字を特定する
特定した文字の個数を2倍する
"""

s = input()
n = min(s.count("0"), s.count("1"))
r = n*2
print(r)


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;

#define MAX_N 200000
i64 N;
i64 A[MAX_N];

void solve() {
  i64 cnt = 0;

  i64 minv = MAX_N + 1;
  REP(i, N) {
    if (A[i] <= minv) cnt++;
    chmin(minv, A[i]);
  }

  cout << cnt << endl;
}

int main() {
  cin >> N;
  REP(i, N) {
    cin >> A[i];
  }

  solve();

  return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

int main(){
    ll A; string B;
    cin >> A >> B;
    ll b = 100*(B[0]-'0') + 10*(B[2]-'0') + (B[3]-'0');
    cout << (A*b)/100 << endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
using namespace std;
using ll = long long;
using vi = vector<ll>;
using pi = pair<ll, ll>;
const int maxn = 4e5 + 33, mod = 1e9 + 7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	string s;
	cin >> s;
	cout << (count(all(s), 'A')==1||count(all(s), 'A')==2?"Yes":"No");
}



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

int main() {
    int a,b,c,d,e;
    cin>>a>>b>>c;
    if(b-a<c*2){
        for(int i=a;i<=b;i++){
            cout<<i<<endl;
        }
    }
    else{
        for(int i=a;i<a+c;i++){
            cout<<i<<endl;
        }
        for(int i=b-c+1;i<b+1;i++){
            cout<<i<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#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##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T, class U>bool chmax(T& a, U&& b) { return a < b ? a = b, 1 : 0; }
template<class T, class U>bool chmin(T& a, U&& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int main() {
    int N;
    cin >> N;
    vector<double> p(N);
    rep(i, N) cin >> p[i];

    vv<double> dp = vvec(N + 1, N + 1, 0.0);
    dp[0][0] = 1;
    rep(i, N) rep(j, i + 1) {
        dp[i + 1][j + 1] += dp[i][j] * p[i];
        dp[i + 1][j] += dp[i][j] * (1 - p[i]);
    }

    double ans = 0;
    rep(j, N / 2 + 1, N + 1) ans += dp[N][j];
    write(ans);
}

Measured memory_bytes: 70784
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			if(n == 0) break;
			double[] score = new double[n];
			double sum = 0.0;

			for(int i = 0; i < n; i++){
				score[i] = sc.nextDouble();
				sum += score[i];
			}
			double m = sum / n;
			sum = 0.0;
			for(int j = 0; j < n; j++){
				sum += Math.pow((score[j] - m), 2);
			}
			System.out.printf("%.8f\n", Math.sqrt(sum / n));
		}
	} 

}


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

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define SUM(x) accumulate(ALL(x), 0)
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MAXR 100000

int main()
{
  int h, w; cin >> h >> w;
  vector<vector<char>> s(h, vector<char>(w));
  REP(i, h) {
    string s_; cin >> s_;
    REP(j, w) {
      s.at(i).at(j) = s_[j];
    }
  }

  int bk; int wh;
  REP(i, h) {
    REP(j, w) {
      if (s.at(i).at(j) == '.') wh++;
      else bk++;
    }
  }

  if (wh == h * w) {
    cout << "Yes" << endl;
    return 0;
  }

  int cnt = 0;
  REP(i, h) {
    REP(j, w) {
      if (s.at(i).at(j) == '.') continue;
      if (i == 0) {
        if (j == 0) {
          if (s.at(i + 1).at(j) == '#' || s.at(i).at(j + 1) == '#') cnt++;
        } else if (j == w - 1) {
          if (s.at(i + 1).at(j) == '#' || s.at(i).at(j - 1) == '#') cnt++;
        } else {
          if (s.at(i + 1).at(j) == '#' || s.at(i).at(j - 1) == '#' || s.at(i).at(j + 1) == '#') cnt++;
        }
      } else if (i == h - 1) {
        if (j == 0) {
          if (s.at(i - 1).at(j) == '#' || s.at(i).at(j + 1) == '#') cnt++;
        } else if (j == w - 1) {
          if (s.at(i - 1).at(j) == '#' || s.at(i).at(j - 1) == '#') cnt++;
        } else {
          if (s.at(i - 1).at(j) == '#' || s.at(i).at(j - 1) == '#' || s.at(i).at(j + 1) == '#') cnt++;
        }
      } else {
        if (j == 0) {
          if (s.at(i - 1).at(j) == '#' || s.at(i + 1).at(j) == '#' || s.at(i).at(j + 1) == '#') cnt++;
        } else if (j == w - 1) {
          if (s.at(i - 1).at(j) == '#' || s.at(i + 1).at(j) == '#' || s.at(i).at(j - 1) == '#') cnt++;
        } else {
          if (s.at(i - 1).at(j) == '#' || s.at(i + 1).at(j) == '#' || s.at(i).at(j - 1) == '#' || s.at(i).at(j + 1) == '#') cnt++;
        }
      }
    }
  }

  if (cnt == bk) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
typedef long long ll;

int main() {
    string s; cin >> s;
    string E = "abcdefghijklmnopqrstuvwxyz";
    int v[26] = {0};
    rep(i,s.size()){
        rep(j,26){
            if(s[i] == E[j]){
                v[j]++;
            }
        }
    }
    rep(i,26){
        if(v[i] == 0){
            cout << E[i] << endl;
            return 0;
        }
    }
    cout << "None" << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <complex>
using namespace std;
const double INF = 1e12;
typedef complex<double> P,point;
typedef vector<P> G,polygon;
namespace std {bool operator < (const P& a, const P& b) {return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);}}
double cross(const P& a, const P& b) {return imag(conj(a)*b);}
double dot(const P& a, const P& b) {return real(conj(a)*b);}
struct L : public vector<P> {L(const P &a, const P &b) {push_back(a); push_back(b);}};
int ccw(P a, P b, P c) {b -= a; c -= a;if (cross(b, c) > 0)   return +1;if (cross(b, c) < 0)   return -1;if (dot(b, c) < 0) return +2;if (norm(b) < norm(c)) return -2;return 0;}
bool intersectSS(const L &s, const L &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;}

// Where is Point in Polygon? //
#define curr(P, i) P[i]
#define next(P, i) P[(i+1)%P.size()]
enum { OUT, ON, IN };
int contains(const polygon& P, const point& p) {bool in = false;for (int i = 0; i < P.size(); ++i) {point a = curr(P,i) - p, b = next(P,i) - p;if (imag(a) > imag(b)) swap(a, b);if (imag(a) <= 0 && 0 < imag(b))if (cross(a, b) < 0) in = !in;if (cross(a, b) == 0 && dot(a, b) <= 0) return ON;}return in ? IN : OUT;}

#define rep(i,n) for(int i=0;i<n;i++)
int main(){
	int n;cin >> n;
	while(n--){
		P data[5];
		G v;
		rep(i,3){P c; cin >> c.real() >> c.imag(); v.push_back(c);}
		P a,b;
		cin >> a.real() >> a.imag() >> b.real() >> b.imag();
		cout << ( (!!contains(v,a)) ^ (!!contains(v,b)) ?"OK":"NG") << endl;
	}
}

Measured memory_bytes: 960
import sys
input = sys.stdin.readline
import numpy as np

def main():
    N, W = [int(item) for item in input().split()]
    item = np.array([[int(item) for item in input().split()] for _ in range(N)])


    dp = np.full(10**5 + 1, W+1)
    dp[0] = 0

    for i in range(N):
        w, v = item[i]
        np.minimum(dp[v:], dp[:-v] + w, out=dp[v:])

    print(np.where(dp <= W)[0][-1])

if __name__ == "__main__":
    main()

Measured memory_bytes: 13992
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    vector<int> vec;
    int tmp;
    for (int i = 0; i < 3; i++)
    {
        cin >> tmp;
        vec.push_back(tmp);
    }

    sort(vec.begin(), vec.end());

    cout << (vec[0] + vec[1]) << endl;
    return 0;
}

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

using namespace std;
typedef long long int LL;
typedef long long int LLint;
typedef pair<int,int> intpair;
typedef pair<bool,bool> boolpair;
typedef pair<string,string> strpair;
typedef pair<LL,LL> LLpair;
typedef pair<double,double> doublepair;
typedef pair<float,float> floatpair;
typedef vector<int> intvector;
typedef vector<bool> boolvector;
typedef vector<string> strvector;
typedef vector<LL> LLvector;
typedef vector<double> doublevector;
typedef vector<float> floatvector;
#define wait(sec) usleep((sec) * 1000000)
#define ED return 0;
#define TEST cout << "OK" << endl;
#define UP(a,b) ((a+(b-1))/b)
#define SORT(vec) sort(vec.begin(),vec.end());
#define DOUBLECHANGE(count) cout << setprecision(count);
#define REV(vec) reverse(vec.begin(),vec.end());
#define ipow(x,y) LL(pow(x,y))
#define INF 999999999
const long long mod = 1000000007;

LL Pnum(LL N, LL X, vector<pair<LL,LL>> dp){
    //cout << "Calculate " << N << "," << X << " (dp[" << N << "] = " << dp[N].first << ")" << endl;
    LL ans = 0;
    if(N == 0){
        if(X >= 1){
            //cout << "Return 1" << endl;
            return 1;
        }
        else{
            //cout << "Return 0" << endl;
            return 0;
        }
    }

    if(X > dp[N].first/2){
        if(N != 0){
            ans += dp[N-1].second;
        }
        X -= (dp[N].first)/2;
        //cout << "X -> half (" << X << ")" << endl;
        if(X > 0){
            X--;
            ans++;
            ans += Pnum(N-1,X,dp);
            //cout << "Return " << ans << endl;
            return ans;
        }
        else{
            //cout << "Return " << ans << endl;
            return ans;
        }
    }
    else{
        if(X > 0){
            X--;
            ans += Pnum(N-1,X,dp);
            //cout << "Return " << ans << endl;
            return ans;
        }
        else{
            //cout << "Return " << ans << endl;
            return ans;
        }
    }
}

int main(){
//    random_device rnd;
//    mt19937 mt(rnd());
      cin.tie(0);
      ios::sync_with_stdio(false);
      LL N, X;
      cin >> N >> X;
      vector<pair<LL,LL>> dp (52,make_pair(1,1));
      for(int i = 1;i < 51;i++){
        dp[i].first = dp[i-1].first*2+3;
        dp[i].second = dp[i-1].second*2+1;
      }
      cout << Pnum(N,X,dp) << endl;
}


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 namespace std;

int main() {
    string s, t;
    cin >> s >> t;

    int day = 0;
    rep(i, 3) if (s.at(i) == t.at(i)) day++;
    cout << day << endl;
}

Measured memory_bytes: 3608
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define pb(a) push_back(a)

typedef long long ll;
using namespace std;

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

//const int dy[] = { 0, 0, 1, -1 };
//const int dx[] = { 1, -1, 0, 0 };
const int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
const int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
ll gcd(ll a, ll b);
ll lcm(ll x, ll y);

vector<ll> a;
map<ll,ll> m;

int main()
{
	map<std::string, int> map;
	string x, y;

	map["A"] = 10;
	map["B"] = 11;
	map["C"] = 12;
	map["D"] = 13;
	map["E"] = 14;
	map["F"] = 15;

	cin >> x >> y;
	if (map[x] > map[y]) {
		cout << ">" << endl;
	}
	else if (map[x] < map[y]) {
		cout << "<" << endl;
	}
	else {
		cout << "=" << endl;
	}
	
	return 0;
}



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

typedef vector<int> vi;

int K,N; vi A;
void input()
{
    cin>>K>>N;
    for(int i=0;i<N;++i){
        int a; cin>>a; A.emplace_back(a);
    }    
}

void solve()
{
    int ans=A[0]+K-A[N-1];
    for(int i=0;i<N-1;++i){
        ans=max(ans,A[i+1]-A[i]);
    }
    cout<<K-ans<<endl;
}

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

Measured memory_bytes: 4244
using System;
class Program
{
    public static void Main()
    {
        string[] str = Console.ReadLine().Split(' ');
        int count = 3;
        Array.Sort(str);
        for (int i = 0; i < str.Length - 1; i++)
            if (str[i] == str[i + 1])
                count--;
        Console.WriteLine(count);
    }
}

Measured memory_bytes: 11360