akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int a[20001][256];

int main(void){

int i,j,k;
int n,m,dummy;
int min;
int c[17];
int x[20001];



while(1){
min = 2000000000;
scanf("%d %d",&n,&m);
if(n == 0 && m == 0){
return 0;
}

for(i = 0; i < m; i++){
scanf("%d",&c[i]);
}
for(i = 0; i < n; i++){
scanf("%d",&x[i]);
}

for(i = 0; i < n + 1; i++){
for(j = 0; j < 256; j++){
a[i][j] = 2000000000;
}
}

a[0][128] = 0;

for(i = 0; i < n; i++){
for(j = 0; j < 256; j++){
if(a[i][j] != 2000000000){
for(k = 0; k < m; k++){
dummy = j + c[k];
if(dummy < 0){
dummy = 0;
}else if(dummy > 255){
dummy = 255;
}
if(a[i+1][dummy] > a[i][j] + (dummy - x[i])*(dummy - x[i])){
a[i+1][dummy] = a[i][j] + (dummy - x[i])*(dummy - x[i]);
}
}
}
}
}

for(j = 0; j < 256; j++){
if(a[n][j] > -1){
if(min > a[n][j]){
min = a[n][j];
}
}
}

printf("%d\n",min);

}
return 0;

}

Measured memory_bytes: 21104
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>

using namespace std;

typedef long long ll;

ll gcd(ll c, ll d) {
	ll e = c % d;
	if (e == 0) return d;
	return gcd(d, e);
}

bool asc(vector<ll> a, vector<ll> b) {
	return a[1] < b[1];
}

int main() {

	ll n;
	cin >> n;
	vector<vector<ll> > ab(n, vector<ll>(2));
	for (ll i = 0; i < n; i++)
	{
		cin >> ab[i][0] >> ab[i][1];
	}

	sort(ab.begin(), ab.end(), asc);

	ll now = 0;
	bool flag = true;
	for (ll i = 0; i < n; i++)
	{
		now += ab[i][0];
		if (now > ab[i][1]) {
			flag = false;
			break;
		}
	}
	if (flag) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

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

int dp[100005][30];
int vis[30];
int main()
{
    string s;
    string t;
    cin >> s >> t;
    memset(dp,0x3f,sizeof(dp));
    for(int i = 0; i < s.length(); i++)
    {
        vis[s[i] - 'a'] = 1;
    }
    for(int i = s.length() - 2; i >= 0; i--)
    {
        for(int j = 0; j < 26; j++)
        {
            dp[i + 1][j] = dp[i + 2][j];
        }
        dp[i + 1][s[i + 1] - 'a'] = i + 2;
    }
    for(int j = 0; j < 26; j++)
    {
        dp[0][j] = dp[1][j];
    }
    dp[0][s[0] - 'a'] = 1;
    long long nowl = 0,nowr = 0;
    for(int i = 0; i < t.length(); i++)
    {
        if(!vis[t[i] - 'a'])
        {
            cout << "-1" << endl;
            return 0;
        }
        if(dp[nowl][t[i] - 'a'] == 0x3f3f3f3f)
        {
            nowr++;
            nowl = dp[0][t[i] - 'a'];
        }
        else
        {
            nowl = dp[nowl][t[i] - 'a'];
        }
        // cout << nowl << " " << nowr <<endl;
    }
    cout << nowl + nowr * s.length();
}

Measured memory_bytes: 12288
#include<stdio.h>
int main(void){
int a;
int b;
int d,r;
double f;
scanf("%d %d",&a,&b);

d=a/b;
r=a%b;
f=(double)a/b;
printf("%d %d %5lf\n",d,r,f);
return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;

const ll INF = (ll)(1e+18);
int N, W;
vi M, V;
vector<vl> dp;

void input_init(void) {
	cin >> N >> W;
	M.resize(N);
	V.resize(N);
	for (int i = 0; i < N; ++i)
		cin >> M[i] >> V[i];
	dp.resize(N, vl(1000 * N + 1, INF));
}

void solve(void) {
	dp[0][0] = (ll)0;
	dp[0][V[0]] = (ll)M[0];
	for (int i = 1; i < N; ++i) {
		for (int j = 1000 * (N - 1); j >= 0; --j) {
			// i を選ばない
			dp[i][j] = min(dp[i - 1][j], dp[i][j]);
			// i を選ぶ
			dp[i][j + V[i]] = min(dp[i - 1][j] + (ll)M[i], dp[i][j + V[i]]);
		}
	}
}

int main(void) {
	input_init();
	solve();
	int ans = 0;
	for (int i = 1000 * N; i >= 0; --i) {
		if (dp[N - 1][i] <= (ll)W) {
			ans = i;
			break;
		}
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 79488
#include <iostream>

using namespace std;

int main(){
  int c[3][3];
  for(int i = 0; i < 3; i++){
    for(int j = 0; j < 3; j++){
      cin >> c[i][j];
    }
  }
  int line1 = c[0][0] + c[1][1] + c[2][2];
  int line2 = c[0][1] + c[1][2] + c[2][0];
  int line3 = c[0][2] + c[1][0] + c[2][1];
  if(line1 == line2 && line2 == line3) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())

sokudo = abs(w - v)
kyori = abs(b - a)

if w >= v:
    print("NO")
    exit()

if sokudo*t >= kyori:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 9072
#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long
// 220
// 44

using namespace std;

// ans = sum((-1) ^ i * comb(n, i) * ways[i]), i = 0, ..., n
// ways[i] = seturi de ramen care au topingurile 1, ..., i in cel mult un ramen
// ways2[i][j] = pui i topinguri in j ramen
// ways[i] = sum(ways2[i][j]) * (2 ^ ((n - i) * j)) * 2 ^ (2 ^ (n - i)), j = 0, ..., n

const int MAXN = 3000;

int fact[MAXN + 1], invfact[MAXN + 1];
int p2[MAXN + 1], invp2[MAXN + 1];

inline void mod(int &x, int md) {
    if(x < 0)
        x += md;
    if(x >= md)
        x -= md;
}

inline int lgput(int a, int b, int md) {
    int ans = 1;
    while(b > 0) {
        if(b & 1)
            ans = (1LL * ans * a) % md;
        b >>= 1;
        a = (1LL * a * a) % md;
    }
    return ans;
}

inline void prec(int n, int md) {
    fact[0] = 1;
    for(int i = 1; i <= n; i++) {
        fact[i] = (1LL * fact[i - 1] * i) % md;
    }
    invfact[n] = lgput(fact[n], md - 2, md);
    for(int i = n - 1; i >= 0; i--) {
        invfact[i] = (1LL * invfact[i + 1] * (i + 1)) % md;
    }
    p2[0] = invp2[0] = 1;
    for(int i = 1; i <= n; i++) {
        p2[i] = 2 * p2[i - 1];
        mod(p2[i], md);
        invp2[i] = 2 * invp2[i - 1];
        mod(invp2[i], md - 1);
    }
}

inline int comb(int n, int k, int md) {
    return (1LL * fact[n] * ((1LL * invfact[k] * invfact[n - k]) % md)) % md;
}

int ways2[MAXN + 1][MAXN + 1];
int ways[MAXN + 1];

int main() {
    //ifstream cin("A.in");
    //ofstream cout("A.out");
    int i, j, n, md;
    ios::sync_with_stdio(false);
    cin >> n >> md;
    prec(n, md);
    for(i = 0; i <= n; i++) {
        ways2[i][0] = 1;
        for(j = 1; j <= i; j++) {
            ways2[i][j] = (1LL * ways2[i - 1][j] * (j + 1) + ways2[i - 1][j - 1]) % md;
        }
    }
    for(i = 0; i <= n; i++) {
        int cur_p2 = 1;
        int cur_invp2 = lgput(2, invp2[n - i], md);
        for(j = 0; j <= i; j++) {
            int cur = (1LL * cur_p2 * cur_invp2) % md;
            ways[i] = (ways[i] + 1LL * cur * ways2[i][j]) % md;
            cur_p2 = (1LL * cur_p2 * p2[n - i]) % md;
        }
    }
    int ans = 0;
    for(i = 0; i <= n; i++) {
        if(i % 2 == 0)
            ans += (1LL * comb(n, i, md) * ways[i]) % md;
        else
            ans -= (1LL * comb(n, i, md) * ways[i]) % md;
        mod(ans, md);
    }
    cout << ans;
    //cin.close();
    //cout.close();
    return 0;
}


Measured memory_bytes: 34176
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::io::{stdout, Write, BufWriter};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
//#[allow(unused_imports)]
//use proconio::marker::{Isize1, Usize1, Bytes, Chars};

//#[proconio::fastout]

fn main() {
    input!{
        n: usize,
        s: [String; n],
    }
    let mut counter = std::collections::HashMap::new();
    for s in s {
        let count = counter.entry(s).or_insert(0);
        *count += 1;
    }
    let mut to_print: Vec<_> = {
        let max = counter.values().max().unwrap();
        counter.keys().filter(|s| counter[*s] == *max).collect()
        };
    to_print.sort_by(|a, b| a.chars().cmp(b.chars()));
    for scan in to_print { println!("{}", scan); }
 }




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

int main() {
	using ll = long long;
	ll x, y;
	cin >> x >> y;
	
	ll start = x;
	int cnt = 1;
	
	while(true) {
		start*=2;
		if(start < 0 or start > y) break;
		cnt++;
	}
	
	printf("%d", cnt);
}


Measured memory_bytes: 3692
#include <bits/stdc++.h>
using namespace std;
using lint = long;
using ll = long long;
#define rep(i,n) for(lint (i) = 0;(i) < (lint)(n);(i)++)
#define repInRange(i,start,end) for(lint (i) = (start);(i) < (end);++(i))
using lpair = pair<lint,lint>;
using vl = vector<lint>;
using vll = vector<long long>;
using Llist = list<lint>;
using vs = vector<string>;
#define all(v) (v).begin(),(v).end()
#define out1(x) cout << (x) << '\n';

ll pow(ll k,ll l) {
	ll ret = 1;
	rep(i,l) {
		ret *= k;
	}
	return ret;
}

template <typename T>
T sum(vector<T> vec) {
	ll ret = 0;
	rep(i,vec.size()) {
		ret += vec.at(i);
	}
	return ret;
}

void Main() {
	ll x,p = 0;
	cin >> x;
	p += 1000*(x / 500);
	x %= 500;
	p += 5*(x/5);
	out1(p);
}

signed main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	Main();
	return 0;
}


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

int main() {
  long long N;
  cin >> N;
  
  string ans = "";
  while ( N > 0 ) {
    if ( N % 26 == 1 ) {
      ans += "a";
    } else if ( N % 26 == 2 ) {
      ans += "b";
    } else if ( N % 26 == 3 ) {
      ans += "c";
    } else if ( N % 26 == 4 ) {
      ans += "d";
    } else if ( N % 26 == 5 ) {
      ans += "e";
    } else if ( N % 26 == 6 ) {
      ans += "f";
    } else if ( N % 26 == 7 ) {
      ans += "g";
    } else if ( N % 26 == 8 ) {
      ans += "h";
    } else if ( N % 26 == 9 ) {
      ans += "i";
    } else if ( N % 26 == 10 ) {
      ans += "j";
    } else if ( N % 26 == 11 ) {
      ans += "k";
    } else if ( N % 26 == 12 ) {
      ans += "l";
    } else if ( N % 26 == 13 ) {
      ans += "m";
    } else if ( N % 26 == 14 ) {
      ans += "n";
    } else if ( N % 26 == 15 ) {
      ans += "o";
    } else if ( N % 26 == 16 ) {
      ans += "p";
    } else if ( N % 26 == 17 ) {
      ans += "q";
    } else if ( N % 26 == 18 ) {
      ans += "r";
    } else if ( N % 26 == 19 ) {
      ans += "s";
    } else if ( N % 26 == 20 ) {
      ans += "t";
    } else if ( N % 26 == 21 ) {
      ans += "u";
    } else if ( N % 26 == 22 ) {
      ans += "v";
    } else if ( N % 26 == 23 ) {
      ans += "w";
    } else if ( N % 26 == 24 ) {
      ans += "x";
    } else if ( N % 26 == 25 ) {
      ans += "y";
    } else if ( N % 26 == 0 ) {
      ans += "z";
    }
    if ( N % 26 == 0 ) {
      N = N / 26 - 1;
    } else {
      N = N / 26;
    }
  } 
  
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 3608
memo = {}
def f(x):
    if x==0:
        return 0
    if x==1:
        return 1
    if x in memo:
        return memo[x]
    k = sum(list(map(int,list(bin(x)[2:]))))
    memo[x] = 1+f(x%k)
    return memo[x]
    
N = int(input())
X = input().strip()
n = sum(list(map(int,list(X))))
if n==0:
    for i in range(N):
        print(1)
elif n==1:
    D = {i:0 for i in range(N)} # mod n+1
    D[0] = 1
    for i in range(1,N):
        D[i] = (D[i-1]*2)%(n+1)
    cnt1 = 0
    for i in range(N):
        if X[i]=="1":
            print(0)
        else:
            a = (cnt1+D[N-1-i])%(n+1)
            print(1+f(a))
else:
    C = {i:0 for i in range(N)}  # mod n-1
    C[0] = 1
    for i in range(1,N):
        C[i] = (C[i-1]*2)%(n-1)
    D = {i:0 for i in range(N)} # mod n+1
    D[0] = 1
    for i in range(1,N):
        D[i] = (D[i-1]*2)%(n+1)
    cnt0 = 0
    cnt1 = 0
    for i in range(N):
        if X[i]=="1":
            cnt0 = (cnt0+C[N-1-i])%(n-1)
            cnt1 = (cnt1+D[N-1-i])%(n+1)
    for i in range(N):
        if X[i]=="1":
            a = (cnt0-C[N-1-i])%(n-1)
            print(1+f(a))
        else:
            a = (cnt1+D[N-1-i])%(n+1)
            print(1+f(a))

Measured memory_bytes: 129348
#pragma region

#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define _rep3(i, begin, end) for (register int i = (begin), i##_end = (end); i < i##_end; i++)
#define _irep3(i, begin, end) for (register int i = (end)-1, i##_begin = (begin); i >= i##_begin; i--)
#define _rep2(i, n) _rep3(i, 0, n)
#define _irep2(i, n) _irep3(i, 0, n)
#define _overload3(_1, _2, _3, name, ...) name
#define rep(...) _overload3(__VA_ARGS__, _rep3, _rep2, )(__VA_ARGS__)
#define irep(...) _overload3(__VA_ARGS__, _irep3, _irep2, )(__VA_ARGS__)
#define out(x) cout << (x) << '\n';
#define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl;

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<long long>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<long long>>;
using vvb = vector<vector<bool>>;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &pair) {
  cin >> pair.first >> pair.second;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "[ ";
  rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i];
  os << " ]";
  return os;
}

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

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

void init() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(16);
}

#pragma endregion

#define MOD 1000000007
#define INF 2147483647

int main() {
  init();

  ll N;
  cin >> N;

  N %= 10;

  if (N == 3) {
    out("bon");
  } else if (N <= 1 || N == 6 || N == 8) {
    out("pon");
  } else {
    out("hon");
  }
}


Measured memory_bytes: 3640
n = int(input())
a = list(map(int,input().split()))

b = sum(a)//n

co = 10**9
su = 0
for k in range(3):
    for i in a:
        su += abs(i-b+(k-1)) ** 2
    co = min(co,su)
    su = 0

print(co)

Measured memory_bytes: 38488
#include <stdio.h>

int main (void){
int W, H , x , y, z=0;
double menseki;
scanf("%d %d %d %d" , &W ,&H , &x , &y);
menseki = (double)W*H/2;
if(x == W/2.0 && y ==H/2.0)
z=1;
printf("%.6f %d " ,menseki, z);

return 0;

}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define REP(name, stop) for (ll(name) = 0; (name) < (stop); (name)++)
using ll = long long;
using vi = vector<ll>;

int main(void) {
    ll N;
    cin >> N;
    vi stuff(N);
    REP(i, N - 1) {
        ll t;
        cin >> t;
        stuff[t - 1]++;
    }
    for (ll cnt : stuff) {
        cout << cnt << endl;
    }

    return 0;
}


Measured memory_bytes: 4848
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(long long i=0;i<(n);i++)
#define REP1(i,n) for(long long i=1;i<=(n);i++)
#define REP2D(i,j,h,w) for(long long i=0;i<(h);i++) for(long long j=0;j<(w);j++)
#define REP2D1(i,j,h,w) for(long long i=1;i<=(h);i++) for(long long j=1;j<=(w);j++)
#define PER(i,n) for(long long i=((n)-1);i>=0;i--)
#define PER1(i,n) for(long long i=(n);i>0;i--)
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define FORE(i,a,b) for(long long i=(a);i<=(b);i++)
#define ITE(arr) for(auto ite=(arr).begin();ite!=(arr).end();++ite)
#define ALL(a) ((a).begin()),((a).end())
#define RANGE(a) (a),((a)+sizeof(a))
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define YNPRT(b) cout<<((b)?"Yes":"No")<<endl
#define ENTER printf("\n")
#define REV(arr) reverse(ALL(arr))
#define PRT(a) cout<<(a)<<endl
#ifdef DEBUG
#define DBPRT(a) cout << "[Debug] - " << #a << " : " << (a) << endl
#define DBSTART if(1){
#define DBEND }
#else
#define DBPRT(a) do{}while(0)
#define DBSTART if(0){
#define DBEND }
#endif
#define PRTLST(arr,num) REP(_i,num) cout<<_i<<" - "<<arr[_i]<<endl;
#define PRTLST2(arr2,d1,d2) REP(_i,d1) REP(_j,d2) cout<<_i<<","<<_j<<" : "<<arr2[_i][_j]<<endl;
#define PRTLST2D(arr2,d1,d2) do{cout<<"L\t";REP(_i,d2) cout<<_i<<"\t"; cout<<endl; REP(_i,d1){cout<<_i<<"\t";REP(_j,d2){cout<<arr2[_i][_j]<<"\t";}cout<<endl;}}while(0);

#define TOSUM(arr,sum,n) {sum[0]=arr[0];REP1(i,n-1) sum[i]=sum[i-1]+arr[i];}

#define MIN(target,v1) (target)=min(target,v1)
#define MAX(target,v1) (target)=max(target,v1) 
#define P1 first
#define P2 second
#define PB push_back
#define UB upper_bound
#define LB lower_bound
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int INF_INT = 2147483647;
const ll INF_LL = 9223372036854775807LL;
const ull INF_ULL = 18446744073709551615Ull;
const ll P = 92540646808111039LL;
const int Move[4][2] = {-1,0,0,1,1,0,0,-1};
const int Move_[8][2] = {-1,0,-1,-1,0,1,1,1,1,0,1,-1,0,-1,-1,-1};
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p) {os<<"( "<<p.P1<<" , "<<p.P2<<" )";return os;}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {ITE(v) os << (ite-v.begin()) << " : " << *ite <<endl;return os;}
template<typename T>
ostream& operator<<(ostream& os,const set<T>& v) {os<<" { ";ITE(v) {os<<*ite;if(ite!=--v.end()){os<<" , ";}} os<<" } ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const map<T1,T2>& m) {ITE(m) {os<<ite->P1<<"\t\t|->\t\t"<<ite->P2<<endl;} return os;}

//---------------------
#define MAXN 100000
//---------------------

ll n;
string s;

int main(){
	cin >> n>> s;
	char lastc = '_';
	ll ct = 0;
	ITE(s) if(lastc != (*ite)) {ct++;lastc = *ite;}
	PRT(ct);
	return 0;
}









Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pll pair<ll,ll>
#define P push
#define R return
#define C continue
#define MEM(dp,i) memset(dp,i,sizeof(dp))
#define SI size()
#define F first
#define S second
#define W while
using namespace std;
long long MOD=1e9+7;
long long INF=1e16+7;
char cc[503][503];
bool c[503],r[503];
bool fc[503],fr[503];
int main(){
    ll n;
    cin>>n;
    bool b=0;
    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++){
            cin>>cc[i][j];
            if(cc[i][j]=='#')b=1;
        }
    if(!b){cout<<-1; R 0;}
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(cc[i][j]=='#')r[i]=1;
            if(cc[j][i]=='#')c[i]=1;
        }
    }
    bool bol=0;
    for(int i=0;i<n;i++){
        fr[i]=1;
        fc[i]=1;
        for(int j=0;j<n;j++){
            if(cc[i][j]=='.')fr[i]=0;
            if(cc[j][i]=='.')fc[i]=0;
        }
        if(fr[i])bol=1;
    }

    ll res=INF;
    for(int i=0;i<n;i++){
        ll s=0;
        if(c[i]==0)s++;
        for(int j=0;j<n;j++){
            if(cc[i][j]=='.')s+=2;
        }
        for(int j=0;j<n;j++){
            if(cc[i][j]=='.')C;
            s+=(fc[j]==0);
        }
        res=min(res,s);
    }
    cout<<res;
    return 0;
}


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

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		char[] S = sc.next().toCharArray();
		int[] ans = new int[3];
		for (int i = 0; i < S.length; i++) {
			if (i % 2 == 0) {
				if (S[i] == '0') {
					ans[0]++;
				} else {
					ans[1]++;
				}
			} else {
				if (S[i] == '1') {
					ans[0]++;
				} else {
					ans[1]++;
				}
			}
		}
		if (ans[0] <= ans[1]) {
			ans[2] = ans[0];
		} else {
			ans[2] = ans[1];
		}
		System.out.println(ans[2]);
	}
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

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

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

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

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

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

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

Measured memory_bytes: 24532
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

//long mod = 10^^9 + 7;
long mod = 998_244_353;
//long mod = 1_000_003;
void moda(T)(ref T x, T y) { x = (x + y) % mod; }
void mods(T)(ref T x, T y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(T)(ref T x, T y) { x = (x * y) % mod; }
void modpow(T)(ref T x, T y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(T)(ref T x, T y) { y.modpow(mod - 2); x.modm(y); }

void main()
{
	auto A = RD!long;
	auto B = (RD!string).replace(".", "").to!long;

	auto ans = A * B;
	writeln(ans/100);
	stdout.flush;
	debug readln;
}


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

int main(){
	int H, W, i, j;

	while(1){
		cin >> H >> W;
		if(H == 0 && W == 0){
			break;
		}
		for(i = 0; i < H; i++){
			for(j = 0; j < W; j++){
				if((i + j) % 2 == 0){
					cout << '#';
				}else{
					cout << '.';
				}
			}
			cout << endl;
		}
		cout << endl;
	}
			
	return 0;
}

Measured memory_bytes: 3048
#include <bits/stdc++.h>
using namespace std;
int main(){
  string a,b,c;
  cin >> a >> b >> c;
  if(a.at(a.size() -1) == b.at(0) && 
     b.at(b.size() -1) == c.at(0)){
    cout << "YES";
  }
  else{ cout<< "NO";}
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, a, b) for(int i = (a); i <= (b); i++)
#define PER(i, a, b) for(int i = (a); i >= (b); i--)
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define all(S) (S).begin(), (S).end()
#define pf push_front
#define pb push_back
#define mk make_pair
#define S second
#define F first
typedef long long ll;
typedef long double lf;
typedef pair<int, int> ii;
typedef pair<ii, ii> pii;
const int MAX = 2e5+5;
int N, K, a[MAX];

bool check(int m) {
	int cnt = 0;
	rep(i, 0, N)
		cnt += (a[i]-1)/m;
	return cnt <= K;
}

int search(int i, int j) {
	int m = (i+j)/2;
	if(i == j) return m;
	if(check(m)) return search(i, m);
	return search(m+1, j);
}

int main(int argc, char** argv) {
	int ma = 0;
	scanf("%d%d", &N, &K);
	rep(i, 0, N) scanf("%d", a+i);
	rep(i, 0, N) ma = max(ma, a[i]);
	if(!K) printf("%d\n", ma);
	else printf("%d\n", search(1, 1e9));
	return 0;
}


Measured memory_bytes: 4488
#include<bits/stdc++.h>
using namespace std;
template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string &s)
{
    return '"' + s + '"';
}

string to_string(const char *s)
{
    return to_string((string)s);
}

string to_string(bool b)
{
    return (b ? "true" : "false");
}

string to_string(vector<bool> v)
{
    bool first = true;
    string res = "{";
    for (int i = 0; i < static_cast<int>(v.size()); i++)
    {
        if (!first)
        {
            res += ", ";
        }
        first = false;
        res += to_string(v[i]);
    }
    res += "}";
    return res;
}

template <size_t N>
string to_string(bitset<N> v)
{
    string res = "";
    for (size_t i = 0; i < N; i++)
    {
        res += static_cast<char>('0' + v[i]);
    }
    return res;
}

template <typename A>
string to_string(A v)
{
    bool first = true;
    string res = "{";
    for (const auto &x : v)
    {
        if (!first)
        {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p)
{
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p)
{
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p)
{
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{
    cerr << " " << to_string(H);
    debug_out(T...);
}

typedef long long ll;
typedef pair<int, int> pii;
#define mp make_pair
#define fst first
#define snd second
#define fr(i, a, b) for(int i=a; i<b; i++)
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
    cin.tie(nullptr); ios::sync_with_stdio(false);
    ll n; cin >> n;
    string s;
    while(n) {
        s += 'a'+((n-1)%26);
        n = (n-1) /26;
    }
    reverse(s.begin(), s.end());
    cout << s << endl;
}


Measured memory_bytes: 3652
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstdlib>
#include <stack>
#include <queue>
#include <valarray>
#include <utility>

using namespace std;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,n) for(int i=1;i<=(int)(n);i++)
#define rep3(i,n) for(int i=0;i<=(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
#define REP2(i,m,n) for(int i=m+1;i<=(int)(n);i++)
#define REP3(i,m,n) for(int i=m;i<=(int)(n);i++)
#define INF 2000000000
#define INFLL 9000000000000000000
#define MOD (1e9)+7

typedef long long int ll;

// a 0x61  z 0x7a  0 0x30

int main() {
    int c;
    cin >> c;
    cout << (c < 1200 ? "ABC" : "ARC") << endl;

    return 0;

}



Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#define N 200010
using namespace std;
int n,mx,my,x,y,f[N];
struct node {
	int x,y;
} d[N];
bool cmp(const node &a,const node &b) {
	return a.x<b.x;
}
int main() {
	int a,b;bool rev;
	scanf("%d%d%d%d%d",&mx,&my,&x,&y,&n);
	if(mx>x) {//Make sure mx<=x
		a=mx;mx=x;x=a;
		a=my;my=y;y=a;
	}
	if(my>y) {
		a=my;my=y;y=a;
		rev=true;
	} else rev=false;
	for(int i=0;i<n;) {
		scanf("%d%d",&a,&b);
		if(mx<=a&&a<=x&&my<=b&&b<=y) {
			if(rev) b=y+my-b;
			d[i].x=a-mx;
			d[i].y=b-my;
			++i;
		} else --n;
	}
	x-=mx;y-=my;
	if(!x||!y) {
		printf("%.15lf\n",(x+y)*100.0+(n?10.0*M_PI-20.0:0));
		return 0;
	}
	sort(d,d+n,cmp);
	b=0;f[0]=0;
	for(int i=0,j;i<n;++i) {
		j=upper_bound(f,f+b+1,d[i].y)-f;
		if(j>b) b=j;
		if(!f[j]||d[i].y<f[j]) f[j]=d[i].y;
	}
	cout<<fixed<<setprecision(15)<<((x+y)*100.0-b*(long double)(20.0-5.0*M_PI)+(b==min(x,y)+1?5.0*M_PI:0))<<endl;
	return 0;
}

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

using namespace std;

using uint = unsigned int;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_p(x) cerr<<#x": "<<(x).first<<' '<<(x).second<<endl
#define dbg_v(x, n) {cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<(x)[_]<<' ';cerr<<endl;}
#define all(v) v.begin(), v.end()
#define fi first
#define se second
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}
 
template<typename T1, typename T2>
ostream& operator <<(ostream &out, const pair<T1, T2> &item) {
	out << '(' << item.first << ", " << item.second << ')';
	return out;
}
 
template <typename T>
ostream& operator <<(ostream &out, const vector<T>& v) {
	for(const auto &item : v) out << item << ' ';
	return out;
}

int n;
string s;

void bkt(int rem, char last = 'a' - 1)
{
	if (rem == 0)
	{
		cout<<s<<'\n';
		return;
	}

	for (int i = 'a'; i<=last; i++)
	{
		s += i;
		bkt(rem-1, last);
		s.pop_back();
	}
	s += (last+1);
	bkt(rem-1, last+1);
	s.pop_back();
}

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

	cin>>n;
	bkt(n);
	return 0;
}

Measured memory_bytes: 1536
#include "bits/stdc++.h"
using namespace std;


//int h[100001];
int memo[100001][3];
/*
int solve(int i){
	if(i == 0) return 0;
	if(i == 1) return 0;
	if(memo[i] != -1) return memo[i];
	int m = INT_MAX;
	for(int d = 1; d <= k; d++){
		if(i - d < 0) break;
		m = min(solve(i-d, k)+abs(h[i]-h[i-d]), m);
	}
	return memo[i] = m;
}
*/
int main(){

	int n;
	cin >> n;

	memo[0][0] = 0;
	memo[0][1] = 0;
	memo[0][2] = 0;

	int a,b,c;
	
	for(int i = 1; i <= n; i++){
		cin >> a >> b >> c;
		memo[i][0] = max(memo[i-1][1], memo[i-1][2]) + a;
		memo[i][1] = max(memo[i-1][2], memo[i-1][0]) + b;
		memo[i][2] = max(memo[i-1][0], memo[i-1][1]) + c;
	}


	cout << max(max(memo[n][0], memo[n][1]), memo[n][2]) << endl;

    return 0;
}


Measured memory_bytes: 1408
#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())

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

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

void solve(){
    int n;
    cin >> n;

    if (n == 3 || n == 5 || n == 7) {
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }


    return;
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Graph= vector<vector<ll>>;
struct edge{ll to ; ll cost ;} ;
using graph =vector<vector<edge>> ;
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define mpa make_pair
#define fi first
#define se second 
#define set20 cout<<fixed<<setprecision(20) ;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
double pi=acos(-1) ;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
 

 int main(){
  ll n ; cin>> n;
  vector<ll> A(n) ,B(n) ;
  rep(i,n) cin>>A[i]>>B[i] ;
  bool ok=1 ;
  ll sum=0 ;
  rep(i,n){
    if(A[i]!=B[i]) ok=0 ;
    sum+= A[i] ;
  }
  if(ok) cout<<0<<endl ;
  else{
    ll ans=INF ;
    rep(i,n){
      if(A[i]>B[i]){
        chmin(ans,B[i]) ;
      }
    }
  cout<<sum-ans<<endl ;
  }
   return 0 ;
 }



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

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

use std::cmp::max;

fn optPotions(pos: (usize, usize), h: usize, w: usize) -> Vec<(usize, usize)> {
    let (x, y) = pos;
    let mut res = Vec::new();
    // x方向
    if x > 0 {
        res.push((x - 1, y));
    }

    if x < w - 1 {
        res.push((x + 1, y));
    }
    // y方向
    if y > 0 {
        res.push((x, y - 1));
    }

    if y < h - 1 {
        res.push((x, y + 1));
    }
    res
}

fn main() {
    let h: usize = read();
    let w: usize = read();
    let mut map: Vec<Vec<char>> = vec![];
    let mut ans = "Yes";

    for _ in 0..h {
        let row: Vec<char> = read::<String>().chars().collect();
        map.push(row);
    }

    'outer: for i in 0..h {
        for j in 0..w {
            if map[i][j] != '#' {
                continue;
            }

            let optPos = optPotions((i, j), h, w);
            if optPos.iter().all(|x| map[x.0][x.1] != '#') {
                ans = "No";
                break 'outer;
            }
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <set>
#include <list>
#include <utility>
#include <queue>
#include <memory>
#include <cstring>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std; 

int
main(int argc, char const *argv[])
{
    int64_t n;
    cin >> n;
    vector<int64_t> v(n), c(n);

    for (int64_t i = 0; i < n; ++i) {
	cin >> v[i];
    }
    for (int64_t i = 0; i < n; ++i) {
	cin >> c[i];
    }
    int64_t y = 0;

    for (int64_t i = 0; i < n; ++i) {
	if (v[i] > c[i]) {
	    y += v[i] - c[i];
	}
    }
    cout << y << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

class Main
{
  static boolean checkDivofNine(String str)
  {
	int n=str.length();
    int res=0;
    for(int i=0;i<n;i++)
    {
		res+=(str.charAt(i)-'0');
    }
      	return(res%9==0);
  }
  public static void main(String[] args)
  {
    Scanner sc=new Scanner(System.in);
   	String str=sc.next();
    if(checkDivofNine(str))
    {
      System.out.print("Yes");
    }
    else
    {
      System.out.print("No");
    }
  }
}

Measured memory_bytes: 39976
import java.util.*;
	import java.util.Map.Entry;
	 
	 
	 class Main {
		 static int mod =  (int) (Math.pow(10,9)+7);
//		 static int mod =  (int) 998244353;
		 static List<ArrayList<Integer>> list= new ArrayList<ArrayList<Integer>>();
		 static int a_dist[];
		 public static void main(String[] args) {
	    	
	        Scanner sc = new Scanner(System.in);
	        int max = 2*100005;
	        int N = sc.nextInt();	
	        int[] a = new int[N];
	        long[] dp = new long[N+5];
	        long[] cnt = new long[max];
	        for (int i=0 ; i<N; i++) {
	            a[i] = sc.nextInt();
	            dp[i+1]=dp[i];
	            if(i==0||a[i]!=a[i-1]) {
	            	dp[i+1]=(dp[i+1]+cnt[a[i]])%mod;
	            	cnt[a[i]]=(cnt[a[i]]+dp[i]+1)%mod;
	            }
	        }	        
	        	        
	        System.out.println(dp[N]+1);
	        
		 }
		 
	}

Measured memory_bytes: 63588
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from random import *

def readln():
    _res = list(map(int,str(input()).split(' ')))
    return _res

n = readln()[0]
a = {}
char = 'abcdefghijklmnopqrstuvwxyz'
for i in char:
    a.update({i:1000000})

for i in range(0,n):
    s = input()
    b = {}
    for ch in char:
        b.update({ch:0})
    for ch in s:
        b[ch] = b[ch] + 1
    for ch in char:
        a[ch] = min(a[ch],b[ch])
ans = ''
for ch in char:
    for i in range(0,a[ch]):
        ans = ans + ch
print(ans)


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

using namespace std;

#define ll long long


int main() {
//#ifndef ONLINE_JUGDE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
//#endif

    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int n;
    cin>>n;
	string s;
    cin>>s;
    ll ans=0,rs=0;
	for(int i=0;i<n;i++)
		if(s[i]=='R')
			rs++;
	for(int i=0;i<rs;i++)
		if(s[i]!='R')
			ans++;
    cout<<ans;
    return 0;
}

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

int main() {
  int A, B, M;
  cin >> A >> B >> M;
  vector<int> fridge(A);
  vector<int> oven(B);
  for(int i = 0; i < A; i++) {
    cin >> fridge.at(i);
  }
  for(int i = 0; i < B; i++) {
    cin >> oven.at(i);
  }
  
  vector<vector<int>> coupen(M,vector<int>(3));
  for(int i = 0; i < M; i++) {
    for(int j = 0; j < 3; j++) {
      cin >> coupen.at(i).at(j);
    }
  }
  
  vector<int> price(M);
  for(int i = 0; i < M; i++) {
    price.at(i) = fridge.at(coupen.at(i).at(0) - 1) + oven.at(coupen.at(i).at(1) - 1) 
                - coupen.at(i).at(2);
  }
  sort(price.begin(), price.end());
  
  sort(fridge.begin(), fridge.end());
  sort(oven.begin(), oven.end());
  cout << min(price.at(0), fridge.at(0) + oven.at(0)) << endl;
}

Measured memory_bytes: 6912
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#define FPEN freopen("in.txt", "r", stdin);
#define debug(...)                                                             \
    { cerr << "# " << __VA_ARGS__ << "\n"; }
#else
#define debug(...)
#define FPEN
#endif
const int maxn = 200009;
typedef long long i64;
typedef pair<i64, i64> pi64;
typedef pair<int, int> pi;
const i64 MOD = 119 << 23 | 1;
class {
  public:
    void solve() {
        int n;
        cin >> n;
        cout << (n + 1) / 2 << '\n';
    }
} NSPACE;
int main() {
    FPEN;
    ios_base::sync_with_stdio(false);
    cout.tie(0);
    cin.tie(0);
    NSPACE.solve();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i = (a);i <= (b);i++)
#define pii pair<int,int>
#define fi first
#define se second
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
const int maxn = 2e5 + 5;
const int maxm = 1e6 + 5;
const double eps = 1e-8;
const double pi = acos(-1.0);
int a[3][3];
int n,x;
bool vis[3][3];
int main(){
	for(int i = 0;i < 3;i++){
		for(int j = 0;j < 3;j++) cin >> a[i][j];
	}
	cin >> n;
	for(int i = 0;i < n;i++){
		cin >> x;
		for(int i = 0;i < 3;i++){
			for(int j = 0;j < 3;j++){
				if(a[i][j] == x) vis[i][j] = 1;
			}
		}
	}
	bool ok = 0;
	for(int i = 0;i < 3;i++){
		if(vis[0][i] && vis[1][i] && vis[2][i]) ok = 1;
		if(vis[i][0] && vis[i][1] && vis[i][2]) ok = 1;
	}
	if(vis[0][0] && vis[1][1] && vis[2][2]) ok = 1;
	if(vis[0][2] && vis[1][1] && vis[2][0]) ok = 1;
	if(ok) cout << "Yes" << endl;
	else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<Integer> a = new ArrayList<>();
        a.add(0);
        for(int i = 0;i < n;i++){
            a.add(sc.nextInt());
        }
        a.add(0);
        long sum = 0;
        for(int i = 0;i <= n;i++){
            sum += Math.abs(a.get(i+1)-a.get(i));
        }

        for(int i = 1;i <= n;i++){
            long x = sum + Math.abs(a.get(i-1)-a.get(i+1));
            long si = x - (Math.abs(a.get(i-1)-a.get(i))+Math.abs(a.get(i+1)-a.get(i)));
                System.out.println(si);
        }
    }
}


Measured memory_bytes: 69632
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e10;
const int MOD = 1e9 + 7;
#define dump(x) cout << #x << " = " << (x) << endl;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define pb push_back
#define lb lower_bound
#define all(v) (v).begin(), (v).end()
#define P pair<int, int>
#define V vector<int>
#define M map<int, int>
#define S set<int>
#define itn int
#define tin int
#define tni int
bool dbg = false;
int N, a[100010];
V n;

void solve()
{
    /*auto LB = [&](int key) {
        int left = 0, right = n.size(), mid = 0;

        while (left + 1 < right) {
            mid = (left + right) / 2;
            if (key <= vec[mid]) {
                right = mid;
            } else {
                left = mid + 1;
            }
        }
        return left;
    };*/
    FOR(i, 0, N)
    {
        auto it = upper_bound(all(n), a[i] * -1);
        if (it == n.end()) {
            n.pb(a[i] * -1);
        } else {
            //it--;
            *it = a[i] * -1;
        }
    }
    cout << (int)n.size() << endl;
}

signed main()
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> N;
    FOR(i, 0, N)
    cin >> a[i];
    solve();
    return 0;
}


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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if (a == b){
    if (a != c){
      cout << "Yes" << endl;
      return 0;
    }else{
      cout << "No" << endl;
      return 0;
    }
  }else{
    if (a == c || b == c){
      cout << "Yes" << endl;
      return 0;
    }else{
      cout << "No" << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#define PI 3.14159265

int main(){

    double a,b,c,s,h,d,l;
    
    scanf("%lf",&a);
    scanf("%lf",&b);
    scanf("%lf",&c);
   
    h=b*sin(2*PI/360*c);
    s=a*h/2;
    d=sqrt(a*a+b*b-2*a*b*cos(2*PI/360*c));
    l=a+b+d;
    
    printf("%f\n",s);
    //printf("%f\n",d);    
    printf("%f\n",l);
    printf("%f",h);
    return 0;
}

Measured memory_bytes: 1980
import sys
counter = [0] * 26
s = ""
for item in sys.stdin:
    s += item

for item in s:
    tmp = ord(item) - ord('a')
    if 0 <= tmp and tmp <= 25:
        counter[tmp] += 1

    tmp = ord(item) - ord('A')
    if 0 <= tmp and tmp <= 25:
        counter[tmp] += 1

for i in range(len(counter)):
    print(f"{chr(i+ord('a'))} : {counter[i]}")



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

int main()
{
 int a,b;
 string t,s,u;
 cin>>s>>t;
 cin>>a>>b;
 cin>> u;
 if(u==s){
     cout<<a-1<<" "<<b;
 }
 else
 {
     cout<<a<<" "<<b-1;
 }

    return 0;
}


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

LL A[200005],B[200005];
LL n,m,ms;


int main(){
   cin>>n>>m>>ms;

    for(int i=0;i<n;i++) cin>>A[i];
    for(int i=0;i<m;i++) cin>>B[i];
    long long sum = 0;
        int x = 0, y = 0;

        while (x < n && sum + A[x] <= ms) {
            sum += A[x++];
        }

        int ans = x;

        while (y < m && x >= 0) {
            sum += B[y++];
            while (sum > ms && x > 0) {
                sum -= A[--x];
            }

            if (sum <= ms && ans < x + y) {
                ans = x + y;
            }
        }
    cout<<ans<<endl;
}

Measured memory_bytes: 6752
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    int x[5];
    int ans = -1;
    for (int i = 0; i < 5; i++) {
        cin >> x[i];
        if (x[i] == 0) ans = i;
    }
    cout << ans + 1 << endl;
}

Measured memory_bytes: 3524
#include<stdio.h>
#include<string.h>
int main(){
  char s[102],p[102],iti;
  int i,j,k,count;
  scanf("%s",s);
  scanf("%s",p);
  int len =strlen(s);
  int len2 =strlen(p);
  for(i=0;i<len+1;i++){
    count=0;
    iti=s[0];
    for(j=0;j<len+1;j++){
      s[j]=s[j+1];
    }
    s[len-1]=iti;
    if(s[0]==p[0]){
      for(k=0;k<len2;k++){
	if(s[k]==p[k])count++;
      }
    }
    if(count==len2)break;
  }
  if(count==len2)printf("Yes\n");
  else printf("No\n");
  return 0;
}

Measured memory_bytes: 524
import java.util.Scanner;

/**
 * Transformation
 */
public class Main {

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

        String str = scan.next();
        int q = scan.nextInt();
        String cmond;
        int a,b;

        for (int i=0; i < q; i++) {
            cmond = scan.next();
            a = scan.nextInt();
            b = scan.nextInt();
            if (cmond.equals("replace")) {
                StringBuffer buffer = new StringBuffer();
                buffer.append(str);
                buffer.replace(a, b + 1, scan.next());
                str = buffer.toString();
            } else if (cmond.equals("reverse")) {
                if (str.length() > b) {
                    StringBuffer buffer = new StringBuffer();
                    buffer.append(str.substring(a, b + 1));
                    buffer.reverse();
                    if (a > 0) {
                        str = str.substring(0, a) + buffer.toString() + str.substring(b + 1, str.length());
                    } else {
                        str = buffer.toString() + str.substring(b + 1, str.length());
                    }
                }
            } else if (cmond.equals("print")) {
                System.out.println(str.substring(a, b + 1));
            }
        }
        scan.close();
    }
}

Measured memory_bytes: 22336
#include <bits/stdc++.h>
#define int long long
#define x first
#define y second
#define hashset unordered_set
#define hashmap unordered_map
#define getbit(x, i) (((x) >> (i)) & 1)
using namespace std;
typedef pair<int, int> pii;
template <typename T> inline vector<T> readvector(size_t size) {
  vector<T> res(size);
  for (size_t i = 0; i < size; ++i) {
    cin >> res[i];
  }
  return res;
}
template <typename T>
inline void printvector(vector<T> &arr, string sep = " ", string ends = "\n") {
  for (size_t i = 0; i < arr.size(); ++i) {
  }
}
inline int binPow(int x, int deg, int mod) {
  int ans = 1;
  for (int i = sizeof(x) * CHAR_BIT - 1; i >= 0; i--) {
    ans *= ans;
    ans %= mod;
    if (getbit(deg, i))
      ans *= x;
    ans %= mod;
  }
  return ans;
}
const int MAXN = 3e5 + 10;
const int MOD = 1e9 + 7;



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

  int h, n;
  cin >> h >> n;
  auto arr = readvector<int>(n);
  h -= accumulate(arr.begin(), arr.end(), 0ll);
  cout << (h <= 0 ? "Yes" : "No");

  return 0;
}

Measured memory_bytes: 1024