akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main(){
  int i,j,n;
  cin>>n;
  string s;
  vector<int> b(26);
  for(i=0;i<n;i++){
    cin>>s;
    vector<int> c(26);
    for(j=0;j<s.size();j++){
      if(i==0){
		b[(s[j]-'a')]++;
      }else{
		c[(s[j]-'a')]++;
      }
    }
    if(i!=0){
      for(j=0;j<26;j++){
		if(b[j]>c[j]){
			b[j]=c[j];
        }
      }
    }
  }
  for(i=0;i<26;i++){
    for(j=0;j<b[i];j++){
	  cout<<((char)('a'+i));
    }
  }
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <map>
#include <stack>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;
const int MOD = 1e9 + 7;

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> v(m);
    for(int i = 0; i < m; i++)cin >> v[i];
    sort(v.begin(), v.end(), greater<int>());

    vector<int> dp(n + 1, 1e9);

    dp[0] = 0;

    for(int i = 0; i < m; i++){
        for(int j = v[i]; j <= n; j++){
            dp[j] = min(dp[j], dp[j - v[i]] + 1);
        }
    }
    cout << dp[n] << endl;
}

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

// T := (T)[V](T) | e

void waste(string &s,int &i){
    if(s[i] == ')') return; // e
    i++; // (
    waste(s,i);
    i++; // )
    i++; // [
    while(isdigit(s[i])) i++;
    i++; // ]
    i++; // (
    waste(s,i);
    i++; // )
}

string unite(string &s1,string &s2,int &a, int &b){
    if(s1[a] == ')'){
        waste(s2,b);
        return "";
    }
    if(s2[b] == ')'){
        waste(s1,a);
        return "";
    }

    string res;
    res += "(", a++, b++; // (
    res += unite(s1,s2,a,b);
    res += ")", a++, b++; // )
    res += "[", a++, b++; // [
    int n1 = 0, n2 = 0;
    while(isdigit(s1[a])){
        n1 = n1*10 + s1[a]-'0';
        a++;
    }
    while(isdigit(s2[b])){
        n2 = n2*10 + s2[b]-'0';
        b++;
    }
    res += to_string(n1+n2);
    res += "]", a++, b++; // ]
    res += "(", a++, b++; // (
    res += unite(s1,s2,a,b);
    res += ")", a++, b++; // )
    return res;
}

int main(void){
    string s1,s2;
    cin>>s1>>s2;
    int a = 0, b = 0;
    cout<<unite(s1,s2,a,b)<<endl;
    return 0;
}



Measured memory_bytes: 3312
from math import floor
from math import ceil
a,b = map(int,input().split())
n = floor(a / 0.08)
m = floor(b / 0.1)
n2 = ceil(a / 0.08)
m2 = ceil(b / 0.1)
p = floor(n * 0.08)
q = floor(n * 0.1)
p2 = floor(n2 * 0.08)
q2 = floor(n2 * 0.1)
x = floor(m * 0.08)
y = floor(m * 0.1)
x2 = floor(m2 * 0.08)
y2 = floor(m2 * 0.1)
if p == a and q == b and x == a and y == b:
    print(min(n,m))
elif p == a and q == b:
    print(n)
elif x == a and y == b:
    print(m)
elif p2 == a and q2 == b and x2 == a and y2 == b:
    print(min(n2,m2))
elif p2 == a and q2 == b:
    print(n2)
elif x2 == a and y2 == b:
    print(m2)
else:
    print(-1)

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

using namespace std;

int main()
{
    int a,b;
    string s1,s2,s3;
    cin>>s1>>s2;
    cin>>a>>b;
    cin>>s3;
    if(s1==s3)cout<<a-1<<" "<<b<<endl;
    else cout<<a<<" "<<b-1<<endl;
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) for (ll i=0;i<(n);i++)
#define RREP(i,n) for (ll i=(n)-1;i>=0;i--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
	EACH(x,vec) is >> x;
	return is;
}
/*
template<class... T>
ostream& operator<<(ostream& os, tuple<T...>& t) {
	for (size_t i = 0; i < tuple_size< tuple<T...> >::value; ++i) {
		if (i) os << " ";
		os << get<0>(t);
	}
	return os;
}
*/
template<typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
	REP(i,vec.size()) {
		if (i) os << " ";
		os << vec[i];
	}
	return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector< vector<T> >& vec) {
	REP(i,vec.size()) {
		if (i) os << endl;
		os << vec[i];
	}
	return os;
}

ll mod = 1e9+7;

ll dp[100][2];
ll add(ll a, ll b) {
	return (a + b) % mod;
}
vector<int> f(string s) {
	vector<int> res;
	REP(i, s.size()) {
		res.pb(s[i] == '?' ? -1 : s[i]-'0');
	}
	return res;
}
int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	string s1, s2, s3;
	while ( cin >> s1, s1 != "0" ) {
		cin >> s2 >> s3;
		int N = s1.size();
		vector<int> v1, v2, v3;
		v1 = f(s1);
		v2 = f(s2);
		v3 = f(s3);
		fill(dp[0], dp[100], 0); dp[0][0] = 1;
		REP(i, N) REP(j, 2) {
			if (dp[i][j] == 0) continue;
			REP(a, 10) REP(b, 10) REP(ab, 2) {
				int c = a + b + ab;
				int k = 0;
				if (c >= 10) c %= 10, k = 1;
				if (v1[i] != -1 && a != v1[i]) continue;
				if (v2[i] != -1 && b != v2[i]) continue;
				if (v3[i] != -1 && c != v3[i]) continue;
				if (i == 0 && (a == 0 || b == 0 || c == 0)) continue;
				if (j != k) continue;
//				cout << i << " " << j << " " << " " << ab << " " << a << " " << b << " " << c << endl;
				dp[i+1][ab] = add(dp[i+1][ab], dp[i][j]);
			}
		}
		ll ans = dp[N][0];
		cout << ans << endl;
	}
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP (i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back

using namespace std;

typedef long long ll;

// const int INF = 1 << 29;
// const ll INF = 1LL << 60;
// const int MOD = 1000000007;

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

  vector<pair<ll, ll>> ba(N);
  rep (i, N) {
    int a, b;
    cin >> a >> b;
    ba[i] = mp(b, a);
  }

  sort(all(ba));

  ll sum = 0;
  rep (i, N) {
    sum += ba[i].S;
    if (ba[i].F < sum) {
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;
}


Measured memory_bytes: 3456
use std::str::FromStr;
struct Input {
    line: Vec<String>,
    position: usize
}
impl Input {
    fn new() -> Input {
        Input{line:vec![], position: 0}
    }
    fn read_word(&mut self) -> &String {
        if self.position == self.line.len() {
            let mut line= String::new();
            std::io::stdin().read_line(&mut line);
            self.line = line.split_whitespace().map(|x|x.to_string()).collect();
            self.position = 0
        }
        let result = &self.line[self.position];
        self.position += 1;
        result
    }
    fn read<T: FromStr>(&mut self, result: &mut T) -> &mut Input {
        *result = self.read_word().parse().ok().unwrap();
        self
    }
    fn get<T: FromStr>(&mut self) -> Result<T, T::Err> {
        self.read_word().parse()
    }
}
fn main() {
    let mut input = Input::new();
    let a: i32 = input.get().unwrap();
    let b: i32 = input.get().unwrap();
    println!("{} {}", a * b, 2 * (a + b));
}


Measured memory_bytes: 5032
#include<stdio.h>
#include<limits.h>
#define ST_SIZE ((1 << 18) - 1)
#define min(a,b) ((a) < (b) ? (a) : (b))
typedef long long int LL;
LL segadd[ST_SIZE], segmin[ST_SIZE];
LL input(void);
void add(LL a, LL b, int x, LL k, LL l, LL r);
LL find(LL a, LL b, LL k, LL l, LL r);
int main (void) {
  int command, x;
  LL i, n, q, s, t;
  n = input();
  q = input();
  for (i = 0; i < q; i++) {
    command = input();
    if (!command) {
      s = input();
      t = input();
      x = input();
      add(s, t + 1, x, 0, 0, n);
    } else {
      s = input();
      t = input();
      printf("%lld\n", find(s, t + 1, 0, 0, n));
    }
  }
}
LL input(void)
{
  LL n = 0;
  int c = getchar_unlocked();
  if (c == '-') {
    c = getchar_unlocked();
    do {
      n = 10 * n + c - '0';
      c = getchar_unlocked();
    } while (c >= '0' && c <= '9');
    return -n;
  } else {
    do {
      n = 10 * n + c - '0';
      c = getchar_unlocked();
    } while (c >= '0' && c <= '9');
    return n;
  }
}
void add(LL a, LL b, int x, LL k, LL l, LL r)
{
  if (a >= r || b <= l) return;
  else if (a <= l && b >= r) segadd[k] += x;
  else {
    add(a, b, x, k * 2 + 1, l, (l + r) / 2);
    add(a, b, x, k * 2 + 2 , (l + r) / 2, r);
    segmin[k] = min(segmin[k*2+1] + segadd[k*2+1], segmin[k*2+2] + segadd[k*2+2]);
  }
}
LL find(LL a, LL b, LL k, LL l, LL r)
{
  if (a >= r || b <= l) return INT_MAX;
  else if (a <= l && b >= r) return (segmin[k] + segadd[k]);
  else {
    LL vl, vr;
    vl = find(a, b, k * 2 + 1, l, (l + r) / 2);
    vr = find(a, b, k * 2 + 2 , (l + r) / 2, r);
    return (min(vl, vr) + segadd[k]);
  }
}


Measured memory_bytes: 4868
a,b,c=map(int,input().split())
k=int(input())

count=0
while a>=b:
    b=b*2
    count+=1

con=0
while b>=c:
    c=c*2
    con+=1

total=con+count

if total<=k:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9184
#define TEMPLATE_USED
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) for(ll i=0;i<(n);++i)
#define _rep3(i,a,b) for(ll i=(ll)(a);i<(ll)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2)(__VA_ARGS__)
#define _repe2(i,n) for(ll i=0;i<=(ll)(n);++i)
#define _repe3(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);++i)
#define repe(...) _overload3(__VA_ARGS__,_repe3,_repe2)(__VA_ARGS__)
#define _rrep2(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define _rrep3(i,a,b) for(ll i=(ll)(b)-1;i>=(ll)(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2)(__VA_ARGS__)
#define _rrepe2(i,n) for(ll i=(ll)(n);i>=0;i--)
#define _rrepe3(i,a,b) for(ll i=(ll)(b);i>=(ll)(a);i--)
#define rrepe(...) _overload3(__VA_ARGS__,_rrepe3,_rrepe2)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
const string YES = "Yes";
const string NO = "No";

ll X;
ll Y;

void solve();

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin >> X;
    cin >> Y;
    solve();
}

// 1 <= X <= 100
// 1 <= Y <= 100
// 入力中のすべての値は整数である。

// ll X, ll Y
// 発言が正しいような鶴と亀の数の組合せが存在すれば Yes、なければ No と出力せよ。
void solve(){
    if(Y%2){
        cout<<NO<<endl;
        return;
    }
    if(Y<2*X||4*X<Y){
        cout<<NO<<endl;
        return;
    }
    cout<<YES<<endl;
}


Measured memory_bytes: 3568
#[macro_use]
mod input {

use std;
use std::io;

const SPLIT_DELIMITER: char = ' ';

#[macro_export]
#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

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

#[allow(dead_code)]
pub fn p<T>(t: T)
where
    T: std::fmt::Display,
{
    println!("{}", t);
}

#[allow(dead_code)]
pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut v: Vec<Vec<T>> = Vec::new();

    for _ in 0..line {
        let vec_line = input_vector();
        v.push(vec_line);
    }
    v
}

#[allow(dead_code)]
pub fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

#[allow(dead_code)]
pub fn str2vec(s: &str) -> Vec<char> {
    let mut v: Vec<char> = Vec::new();
    for c in s.chars() {
        v.push(c);
    }
    v
}

}

use input::*;

fn main() {
    let (h, w): (usize, usize);
    input!(h, w);
    let mut v = Vec::new();
    for _ in 0..h {
        v.push(input_line_str());
    }
    for _ in 0..w + 2 {
        print!("#");
    }
    println!("");
    for z in 0..h {
        println!("#{}#", v[z]);
    }
    for _ in 0..w + 2 {
        print!("#");
    }
    println!("");
}

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

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;
typedef vector<ld> vld;
typedef vector<pll> vpl;
typedef vector<vll> vvll;

#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 yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define no cout<<"No"<<endl
#define NO cout<<"NO"<<endl
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

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

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

  ll n,k;
  cin>>n>>k;
  vll l(k),r(k);
  REP(i,k)cin>>l[i]>>r[i];

  vll dp(n+10),imos(n+10);
  dp[0]=1;
  REP(i,n){
    dp[i]=(dp[i]+imos[i])%MOD;
    imos[i+1]=(imos[i+1]+imos[i])%MOD;
    REP(j,k){
      imos[min(i+l[j],n)]+=dp[i];
      imos[min(i+l[j],n)]%=MOD;
      imos[min(i+r[j]+1,n)]=(imos[min(i+r[j]+1,n)]-dp[i]+MOD)%MOD;
    }
  }

  cout<<dp[n-1]<<endl;
}



Measured memory_bytes: 6364
#include <bits/stdc++.h>
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;i++)
#define ALL(x) (x).begin(),(x).end()
using namespace std;

//素因数分解
vector<pair<ll,int>> factorize(ll n){
    vector<pair<ll,int>>res;
    for(ll i=2;i*i<=n;i++){
        if(n%i)continue;
        res.emplace_back(i,0);
        while (n%i == 0)
        {
        n /= i;
        res.back().second++;
        }
        
    }
    if(n != 1) res.emplace_back(n,1);
    return res;
}

void trace(int A[],int N){
    REP(i,N){
        if(i>0)printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
}


int main(){
    int A,B;
    cin >> A >> B;
    if(A==1 && B == 1)puts("Draw");
    else if(B == 1)puts("Bob");
    else if(A == 1)puts("Alice");
    else if(A>B)puts("Alice");
    else if(A<B)puts("Bob");
    else puts("Draw");
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
#define endn "\n"
typedef pair<int,int> P;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const int MOD = 1000000007;
//const int MOD = 998244353;
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
const string abc="abcdefghijklmnopqrstuvwxyz";
const string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 


////////////////////////////////////////////////////////////////////
///////////////////////___modpow___////////////////////
ll modpow(ll a,  ll n, const ll &MOD = MOD){
  ll ret = n == 0 ? 1 : modpow(a, n/2, MOD);
  (ret *= ret) %= MOD;
  if(n%2)((ret *= a) %= MOD);
  return ret;
}
///////////////////////___modinv___////////////////////
ll modinv(ll d, const ll &MOD = MOD){
  return modpow(d, MOD-2, MOD);
}
///////////////////////___combination___////////////////////
vector<ll> fac, finv, inv;
void COMinit(const int MAX = 5000000, const ll &MOD = MOD){
  fac.resize(MAX);finv.resize(MAX);inv.resize(MAX);
  fac[0] = fac[1] = finv[0] = finv[1] = inv[1] = 1;
  repd(i,2,MAX){
    fac[i] = fac[i-1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
    finv[i] = finv[i-1] * inv[i] % MOD;
  }
}
ll COM(int n, int k){
  if(n < k)return 0;
  if(n < 0 || k < 0)return 0;
  return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

///////////////////////////////////////////////////////////
int n,a,b;
vector<int> ans, vec;

signed main(){
  cin>>n>>a>>b;
  if(n+1 < a+b || a*b < n){
    cout << -1 << endl;return 0;
  }
  int ind = 1;
  vec.resize(b);vec[0] = a;
  repd(i,a+1,n+1){
    vec[ind]++;
    ind++;
    if(ind == b)ind = 1;
  }
  int m = n;
  rep(i,b){
    repd(j,m-vec[i],m){
      ans.push_back(j);
    }
    m -= vec[i];
  }
  rep(i,n)cout << ans[i]+1 << (i == n-1 ? endn : " ");
}



Measured memory_bytes: 7664
X, N = map(int, input().split())
if N == 0:
  print(X)
  exit()
else:
  P = [int(x) for x in input().split()]  
  if X in P:
    i = 1
    while True:
      if (X-i in P) and (not X+i in P):
        print(X+i)
        exit()
      elif (not X-i in P) and (X+i in P):
        print(X-i)
        exit()
      elif (X-i in P) and (X+i in P):
        i+=1
      elif (not X-i in P) and (not X+i in P):
        print(X-i)
        exit()
  else:
    print(X)
    
	
  

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

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n;i >= 0;--i)
#define FOR(i, a, b) for(int i = a;i < b;++i)
#define ALL(x) (x).begin(),(x).end()
#define INF 999999999
using namespace std;
#define lint long long

int main()
{
  int n; cin >> n;
  int a[n];
  REP(i,n){
    cin >> a[i];
  }
  int b[n];
  REP(i,n){
    cin >> b[i];
  }
  int c[n-1];
  REP(i,n-1){
    cin >> c[i];
  }
  int sum = 0; 
  REP(i,n){
    if(a[i-1]+1 == a[i]){
      sum += b[a[i]-1] + c[a[i-1]-1]; 
    }else{
      sum += b[a[i]-1]; 
    }
  }
  cout << sum << "\n";
  return 0;
}




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

double dp[nn][nn];
double solve(double *arr, int n, int h, int i) {
    //cout << i << " ";
    if (i == n) {
        if (h > n / 2) {
            // cout<<"R";
            return 1.0;
        }
        return 0.0;
    }
    if (dp[i][h] == -1.0) {
        double a1 = arr[i] * solve(arr, n, h + 1, i + 1);
        double a2 = (1 - arr[i]) * solve(arr, n, h, i + 1);
        //cout<<a1<<" "<<a2<<" "<<i<<" "<<h<<endl;
        dp[i][h] = a1 + a2;
        //cout << dp[i][h] << " ";
    }
    return dp[i][h];
}
int main() {
    int n;
    cin >> n;
    double arr[n];
    int i;
    int j ;
    for(i=0;i<nn;i++){
        for(j=0;j<nn;j++){
            dp[i][j] = -1.0;
        }
        
    }
    for (i = 0; i < n; i++)
        cin >> arr[i];

    double res= solve(arr, n, 0, 0) ;
    cout << fixed << setprecision(10) << res << '\n';
    return 0;
}

Measured memory_bytes: 70912
#include<bits/stdc++.h>
	using namespace std;
	typedef long long int ll;
	typedef pair<int,int> pii;
	#define MAX 1000000
	#define mp make_pair
	#define pb push_back
	#define F first
	#define S second
	#define _min(x,y) x = min(x,y)
	ll h[MAX],dp[MAX];
	int main(){
		ios_base::sync_with_stdio(false);
		cin.tie(NULL);
		
		ll n,k;cin >> n >> k;
		cin >> h[0] >> h[1];
		dp[1] = abs(h[0]-h[1]);
		//dp[0] = (unsigned int)-1;
		for(int i = 2;i < n;i++){
			cin >> h[i];
			int x = __INT_MAX__;
			for(int j = i-1;j >= 0 && i-j <= k;j--){
				if(x > dp[j] + abs(h[i]-h[j]))
					x = dp[j] + abs(h[i]-h[j]);
			}
			dp[i] = x;
			//cout << x << ' ';
		}
		/*for(int i = 0;i < n;i++){
			cout << dp[i] << ' ';
		}*/
		cout << dp[n-1];
		return 0;
	}


Measured memory_bytes: 5120
#include <bits/stdc++.h>
    using namespace std;
    #define ll  long long
    #define rep(i,n) for(ll i=0;i<n;i++)
    #define pb push_back
    #define in insert
    #define test   ll t;cin>>t;while(t--)
    #define bs  binary_search
    #define rep1(x,n) for(ll x=n-1;x>=0;x--) 
    
    #define SORT(x) sort(x.begin(),x.end())
    #define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
    #define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
    #define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
    #define All(x) (x).begin(),(x).end()
    #define rAll(x) (x).rbegin(),(x).rend()
    #define db  double
    #define sc scanf
    #define pf printf
    const ll MAX=1e8;
    //ll d[MAX],h[MAX];
    const double pi=3.14159265358979323846;
    const ll M=2e18 +7;
    ll gcd(ll x,ll y){
    	if(x==0)return y;
    	else return gcd(y%x,x);
    }
    ll lcm(ll x,ll y){
    	return (x*y)/gcd(x,y);
    }
   
      bool isPrime(ll n) 
{  
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
  
    for (ll i = 5; i * i <= n; i = i + 6){ 
        if (n % i == 0 || n % (i + 2) == 0){ 
            return false; 
        }
    }
    return true; 
} 
bool pdrome(string s){
    ll n = s.length();
    for(ll i=0;i<n/2;i++){
        if(s[i]!=s[n-i-1]){
            return false;
        }
    }
    return true;
}
ll mindig(ll x){
    ll ans = 9;
    ll t = x;
    while(x){
        ans = min(ans,x%10);
        x/=10;
    }
    x = t;
    return ans;
}
ll maxdig(ll x){
    ll ans = 0;
    ll t = x;
    while(x){
        ans = max(ans,x%10);
        x/=10;
    }
    x = t;
    return ans;
}
ll modpow(ll x,ll n,ll M){
	if(n==0)return 1%M;
	ll u=modpow(x,n/2,M);
	u=(u*u)%M;
	if(n%2==1)u=(u*x)%M;
	return u;

}
ll sum(ll a) {
    ll result = 0;
    while (a > 0) {
        result += a % 10;
        a /= 10;
    }
    return result;
}
ll digits(long long n) 
{ 
    return floor(log10(n) + 1); 
}                                  

    int main() {
    	ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
    	int n;
    	cin>>n;
    	vector<int>v(4);
    while(n--){
    	string s;
    	cin>>s;
    	if(s[0]=='A')v[0]++;
    	if(s[0]=='W')v[1]++;
    	if(s[0]=='T')v[2]++;
    	if(s[0]=='R')v[3]++;
    }
    cout<<"AC x "<<v[0]<<endl;
    cout<<"WA x "<<v[1]<<endl;
    cout<<"TLE x "<<v[2]<<endl;
    cout<<"RE x "<<v[3]<<endl;
    return 0;
}
    


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

#include <algorithm>
#include <vector>
using namespace std;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

#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() {
    int N;
    ll ans = 0;
    cin >> N;
    vector<ll> L(N);
    rep(i, N) cin >> L[i];

    for (int i = 0; i < N - 2; i++) {
        for (int j = i; j < N - 1; j++) {
            for (int k = j; k < N; k++) {
                ll num[3];
                num[0] = L[i];
                num[1] = L[j];
                num[2] = L[k];
                sort(num, num + 3);
                // 同じ長さを選んだ時
                if (num[0] == num[1] || num[1] == num[2] || num[2] == num[0]) {
                    continue;
                }
                // 三角形が作れない時
                if (num[0] + num[1] <= num[2]) {
                    continue;
                }
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3624
{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
{-# LANGUAGE BangPatterns      #-}
{-# LANGUAGE CPP               #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TupleSections     #-}

import           Control.Applicative
import           Control.Monad
import           Control.Monad.Primitive
import           Control.Monad.ST
import           Control.Monad.State.Strict
import           Data.Bool
import qualified Data.ByteString.Char8       as B
import qualified Data.ByteString.Unsafe      as B
import           Data.Char
import           Data.Function
import qualified Data.IntMap.Strict          as IM
import qualified Data.IntSet                 as IS
import           Data.List
import qualified Data.Map.Strict             as M
import           Data.Monoid
import           Data.Ord
import           Data.Primitive.MutVar
import qualified Data.Set                    as S
import           Data.Tuple
import qualified Data.Vector                 as V
import qualified Data.Vector.Generic         as G
import qualified Data.Vector.Generic.Mutable as GM
import qualified Data.Vector.Unboxed         as U
import qualified Data.Vector.Unboxed.Mutable as UM
import           Debug.Trace
import           Foreign                     hiding (void)
import           Unsafe.Coerce

main :: IO ()
main = do
    !n <- readLn :: IO Int
    xs <- map read.words <$> getLine :: IO [Int]
    print $ solve xs

solve xs = go 0 xs
  where
    go !acc (x:y:xs)
      | x == y = go (acc + 1) xs
      | otherwise = go acc (y:xs)
    go acc _ = acc



Measured memory_bytes: 892
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <stdio.h>
using namespace std;
 
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
typedef long long ll;

int main() {


    int N; cin >> N;
    vector<ll> A(N);

    REP(i,N) cin >> A[i];

    ll sum = 0;
    REP(i,N) sum += A[i];

    ll ans = 1e18;
    ll aray = A[0];
    ll snuke = sum - A[0];

    for(int i = 1; i<N; i++) {
        ans = min(ans,abs(aray-snuke));
        aray += A[i];
        snuke -= A[i];
    }

    cout << ans << endl;

    return 0;
}

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

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


Measured memory_bytes: 3088
N, K = map(int, input().split())
ans = 0
mod = 10 ** 9 + 7
for k in range(K, N + 2):
    max_range = int(k * (2 * N - k + 1) / 2)
    min_range = int((k-1) * k / 2)
    tmp = (max_range - min_range + 1) % mod
    ans += tmp
    ans %= mod

print(ans)


Measured memory_bytes: 64832
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const ll MOD = 1000000007;
const double EPS = 1e-9;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;


int main(void) {

    // int n;
    // cin>>n;
    // cout<<pow(2,floor(log2(n)))<<endl;

    int n;
    cin>>n;
    vi v(n);
    rep(i,n)cin>>v[i];
    Sort(v);
    int sum=0;
    rep(i,n-1)sum+=v[i];
    if(v[n-1]>=sum)fin("No");
    else fin("Yes");
}


Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, Q = mapint()
Cs = list(mapint())
LR = []
for i in range(Q):
    l, r = mapint()
    LR.append((l, r, i))
LR.sort(key=lambda x:x[1])
A = [0]*N

def add(A,a,w):#リストに値を追加する関数
    x = a
    while x <= N:
        A[x-1] += w
        x += x&(-x)

def sums(A,a):#k番目までの和
    x = a
    S = 0
    while x != 0:
        S += A[x-1]
        x -= x&(-x)
    return S

ans = [0]*Q
idx = 0
dic = {}
for i in range(N):
    c = Cs[i]
    if c not in dic:
        dic[c] = i+1
        add(A, i+1, 1)
    else:
        past = dic[c]
        dic[c] = i+1
        add(A, past, -1)
        add(A, i+1, 1)
    while idx<Q and LR[idx][1]<=i+1:
        l, r, ans_idx = LR[idx]
        ans[ans_idx] = sums(A, r)-sums(A, l-1)
        idx += 1
for a in ans:
    print(a)

Measured memory_bytes: 243616
// #pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#define String std::string
#define fir first
#define sec second
#define mp std::make_pair
#define Pair std::pair<int, int>
#define Map std::map< int, int >
#define Vector std::vector<int>

typedef long long ll;
typedef unsigned long long ull;

const int N = 100000 + 5;
const int M = 3000 + 5;
const int MOD = 1e9 + 7;
const int inv2 = 500000004;
const int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };
const int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };

inline ll read() {
    ll res = 0, f = 1;
    char ch = getchar();
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
    for (; isdigit(ch); ch = getchar()) res = (res << 1) + (res << 3) + ch - '0';
    return res * f;
}

inline void exgcd(ll a, ll b, ll &g, ll &x, ll &y) {
    if (!b) g = a, x = 1, y = 0;
    else exgcd(b, a % b, g, y, x), y -= x * (a / b);
}

inline ll inv(ll a) {
    ll g, res, tmp;
    exgcd(a, MOD, g, res, tmp);
    return ((res % MOD) + MOD) % MOD;
}

int n, k;
int a[N];
ll f[N], fi[N], ans;

inline void prepare() {
    f[0] = 1;
    int n = 100000;
    for (int i = 1; i <= n; i++) f[i] = f[i - 1] * i % MOD;
    fi[n] = inv(f[n]);
    for (int i = n - 1; i >= 1; i--) fi[i] = fi[i + 1] * (i + 1) % MOD;
}

inline ll C(int n, int k) {
    if (!k) return 1;
    if (n == k) return 1;
    if (k > n) return 0;
    if (k < 0) return 0;
    return f[n] * fi[k] % MOD * fi[n - k] % MOD;
}

int main() {
    prepare();
    scanf("%d %d", &n, &k);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    std::sort(a + 1, a + n + 1);
    for (int i = 1; i <= n; i++) {
        (ans += C(i - 1, k - 1) * a[i] % MOD) %= MOD;
    }
    for (int i = 1; i <= n; i++) {
        ll tmp = C(n - i, k - 1) * a[i] % MOD;
        ans -= tmp;
        if (ans < 0) ans += MOD;
        ans %= MOD;
    }
    printf("%lld\n", ans);
    return 0;
}

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

using namespace std;

#define countof(a) (sizeof(a)/sizeof(*a))

#define vi vector<int>
#define vvi vector<vector<int> >
#define vpi vector<pi >
#define pi pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define all(n) n.begin(), n.end()

#define FROMTO(var, from, to) for (register int var = (from), var##down = ((int)(to)) < ((int)(from));var##down ? (var >= (int)(to)) : (var <= (int)(to));var##down ? var-- : var++)
#define UPTO(var, from, to)   for (register int var = (from); var <= ((int)to); var++)
#define DOWNTO(var, from, to) for (register int var = (from); var >= ((int)to); var--)
#define FOR(var, to)          UPTO(var, 0, (to)-1)
#define DOWN(var, from)       DOWNTO(var, (from)-1, 0) 

#define INIT(var, val) FOR(i,countof(var)) var[i] = val
#define INPUT(var) FOR(i,countof(var)) cin >> var[i]
#define INPUT1(var) FOR(i,countof(var)) cin >> var[i], var[i]--

#define SORT(v) qsort(v,countof(v),sizeof(*v),int_less)
#define SORTT(v) qsort(v,countof(v),sizeof(*v),int_greater)
#define QSORT(v,b) qsort(v,countof(v),sizeof(*v),b)

#define MOD 1000000007
#define INF ((1 << 30)-1)
#define LINF ((1LL << 62)-1)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

struct Comb {
    vector<vector<s64> > data;
    Comb(int n) { // O(n^2)
        data = vector<vector<s64> >(n+1,vector<s64>(n+1,1));
        UPTO(i,1,n) {
            FOR(j,i+1) {
                if (!j || j == i) data[i][j] = 1;
                else data[i][j] = data[i-1][j-1] + data[i-1][j];
            }
        }
    }
    
    s64 ncr(int n, int r) {
        return data[n][r];
    }
};

static inline int ri() {
  int a;
  scanf("%d", &a);
  return a;
}

int int_less(const void *a, const void *b) {
  return (*((const int*)a) - *((const int*)b));
}
int int_greater(const void *a, const void *b) {
  return (*((const int*)b) - *((const int*)a));
}
int n;s64 k;

s64 b[100];
s64 num[100];

s64 get_b(int level, s64 left) {
	// cout << level << ":" << left << endl;
	if (level == 0) {
		assert(left < 2);
		return left;
	}
	if (left == 0) return left;
	s64 times = left/num[level];
	// assert(!times);
	s64 res = times*b[level];
	left %= num[level];
	if (left > num[level-1]+1) {
		res++;
		res += b[level-1];
		res += get_b(level-1, left - (num[level-1]+2));
	} else if (left) {
		res += get_b(level-1, left - 1);
	}
	return res;
}

int main() {
    n = ri();
	cin >> k;
	b[0] = 1;
	num[0] = 1;
	FOR(i,n) b[i+1] = b[i] * 2 + 1, num[i+1] = num[i]*2 + 3;
	
	
	cout << get_b(n,k) << endl;
	
	
	
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


vector<int> G[100005];

int main(){
  int N, M;
  cin >> N >> M;
  rep(i,M){
    int a, b;
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  
  REP(i,1,N+1){
    vector<int> visited(N+1,0);
    visited[i] = 1;
    vector<int> order1, order2;
    order1.push_back(i);
    int now = i;
    bool flg = true;
    bool ok = true;
    while(flg){
      flg = false;
      rep(j,G[now].size()){
        if(visited[G[now][j]] == 1) continue;
        visited[G[now][j]] = 1;
        order1.push_back(G[now][j]);
        now = G[now][j];
        flg = true;

        ok = true;
        rep(j,G[now].size()){
          if(visited[G[now][j]] == 0){
            ok = false;
            break;
          }
        }
        rep(j,G[i].size()){
          if(visited[G[i][j]] == 0){
            ok = false;
            break;
          }
        }
        if(ok) flg = false;
        
        break;
      }
    }
    if(!ok){
      bool cango = false;
      rep(j,G[i].size()){
        if(visited[G[i][j]] == 0){
          cango = true;
        }
      }
      if(cango){
        now = i;
        flg = true;
        ok = true;
        while(flg){
          flg = false;
          rep(j,G[now].size()){
            if(visited[G[now][j]] == 1) continue;
            visited[G[now][j]] = 1;
            order2.push_back(G[now][j]);
            now = G[now][j];
            flg = true;
            
            ok = true;
            rep(j,G[order1[order1.size()-1]].size()){
              if(visited[G[order1.size()-1][j]] == 0){
                ok = false;
                break;
              }
            }
            rep(j,G[now].size()){
              if(visited[G[now][j]] == 0){
                ok = false;
                break;
              }
            }
            if(ok) flg = false;
            
            break;
          }
        }
      }
    }
    

    if(ok){
      cout << order1.size()+order2.size() << endl;
      reverse(ALLOF(order2));
      rep(j,order2.size()){
        if(j>0) cout << " ";
        cout << order2[j];
      }
      rep(j,order1.size()){
        if(j>0 || order2.size()>0) cout << " ";
        cout << order1[j];
      }
      cout << endl;
      return 0;
    }
  }
  
  
  return 0;
}



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

using namespace std;
using ll = long long;
using ld = long double;
using Vec = vector<int>;
using Graph = vector<vector<int>>;
int main(){

int n,k;
cin>>n>>k;
Vec vec(n);

for(int i=0;i<n;i++){
cin>>vec[i];
}
sort(vec.begin(),vec.end());
vec.erase(vec.end()-k+1, vec.end());
ll ans=0;

for(int i=0;i<n-k;i++){
    ans+=vec[i];
}
cout<<ans<<endl;


}

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

const int M = 5;
const long long MAX = 1000000000000000;

int main() {
  int i;
  long long N;
  long long bottle_neck = MAX + 1, cap;  

  cin >> N;  
  for (i = 0; i < M; i++) {
    cin >> cap;
    if (cap < bottle_neck) bottle_neck = cap;
  }
  
  long long pair;
  pair = N / bottle_neck;
  if (N % bottle_neck > 0) pair++;

  cout << pair - 1 + M << endl;

  return 0;
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n, a, b = map(int, input().split())
    print(min(a, b), 0 if n > a + b else abs(n - (a + b)))


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 3060
#include <stdio.h>

int main(){
        int a,b;
        scanf("%d%d" ,&a,&b);
        if(a > b){
                printf("a > b\n",a,b);
        }
        if(a < b ){
                printf("a < b\n",a,b);
        }
        if(a == b){

                printf("a == b\n",a,b);
        }

        return 0;
}

Measured memory_bytes: 580
# -*- coding: utf-8 -*-
"""


"""
import sys

def main(args):
    n = int(input())
    numbers = [int(input()) for _ in range(n)]
    numbers.sort()

    combi = []
    combi.append(int(str(numbers[0]) + str(numbers[1])))
    combi.append(int(str(numbers[0]) + str(numbers[2])))
    combi.append(int(str(numbers[1]) + str(numbers[0])))
    combi.append(int(str(numbers[2]) + str(numbers[0])))
    combi.append(int(str(numbers[2]) + str(numbers[1])))
    if n > 3:
        combi.append(int(str(numbers[0]) + str(numbers[3])))
        combi.append(int(str(numbers[3]) + str(numbers[0])))

    combi.sort()
    print(combi[2])


if __name__ == '__main__':
    main(sys.argv[1:])

Measured memory_bytes: 8128
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



int main(){

	int N;

	scanf("%d",&N);

	if(N >= 'A' && N <= 'Z'){

		printf("1\n");

	}else if(N >= 'a' && N <= 'z'){

		printf("2\n");

	}else{

		printf("0\n");
	}

	return 0;
}



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

using namespace std;

class dsu {
  vector<int> p, sz;
public:
  dsu(int n) {
    p.resize(n);
    sz.resize(n, 1);
    iota(p.begin(), p.end(), 0);
  }

  int get(int v) {
    return (v == p[v] ? v : p[v] = get(p[v]));
  }

  bool unite(int u, int v) {
    u = get(u), v = get(v);
    if (u == v) {
      return false;
    }
    if (sz[u] > sz[v]) {
      p[v] = u;
      sz[u] += sz[v];
    } else {
      p[u] = v;
      sz[v] += sz[u];
    }
    return true;
  }

  int size(int v) {
    return sz[get(v)];
  }
};

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

  int n, m, k;
  cin >> n >> m >> k;
  vector<int> ans(n), fr(n);
  vector<vector<int>> g(n);
  dsu d(n);
  for (int i = 0; i < m; ++i) {
    int u, v;
    cin >> u >> v;
    --u, --v;
    d.unite(u, v);
    ++fr[u], ++fr[v];
  }
  for (int i = 0; i < k; ++i) {
    int u, v;
    cin >> u >> v;
    --u, --v;
    g[u].push_back(v), g[v].push_back(u);
  }
  for (int i = 0; i < n; ++i) {
    ans[i] = d.size(i) - fr[i] - 1;
    for (int v : g[i]) {
      if (d.get(v) == d.get(i)) {
        --ans[i];
      }
    }
  }
  for (int x : ans) {
    cout << x << ' ';
  }

  return 0;
}

Measured memory_bytes: 7552
import collections
N, M = map(int, input().split())
keys = collections.defaultdict(lambda:float('inf'))
for _ in range(M):
    cost, _ = map(int, input().split())
    key_set = 0
    for i in map(int, input().split()):
        key_set |= (1 << (i -1))
    keys[key_set] = min(keys[key_set], cost)

allstate = (1 << N) - 1
dp = collections.defaultdict(lambda:float('inf'))
dp[0] = 0

for key_set, cost in keys.items():
    ndp = collections.defaultdict(lambda:float('inf'))
    for state, val in dp.items():
        ndp[state] = min(ndp[state], val)
        ndp[state|key_set] = min(ndp[state|key_set], val + cost)
    dp = ndp

if dp[allstate] != float('inf'):
    print(dp[allstate])
else:
    print(-1)


Measured memory_bytes: 75736
#include<iostream>
#include <string> 
using namespace std;
int main(){
	int i=0,N,A=0,B=0,C=0,D=0;
  	string X;
	cin >> N;
  	while(i<N){
    	cin >> X;
      	if(X == "AC"){
        	A++;
        }else if(X == "WA"){
        	B++;
        }else if(X == "TLE"){
        	C++;
        }else if(X == "RE"){
        	D++;
        }
      	i++;
    }
    cout << "AC x " << A << endl;
    cout << "WA x " << B << endl;
    cout << "TLE x " << C << endl;
    cout << "RE x " << D << endl;  	
    return 0;
}

Measured memory_bytes: 3212
//
//  main.cpp

#include <iostream>
#include <vector>
using namespace std;


int main(){	
	while(1){
		int n;
		cin >> n;
		if(n == 0)break;
		vector<pair<int,int> >hashira;
		bool check[5001][5001];
		for(int i=0;i<5001;i++){
			for(int j=0;j<5001;j++){
				check[i][j] = false;
			}
		}
		for(int i=0;i<n;i++){
			int a,b;
			cin >> a >> b;
			check[a][b] = true;
			hashira.push_back(make_pair(a,b));
		}
		int answer=0;
		for(int i=0;i<n;i++){
			for(int j=i+1;j<n;j++){
				int x = hashira[j].first - hashira[i].first;
				int y = hashira[j].second - hashira[i].second;
				if(hashira[i].first-y > 5000 ||
				   hashira[i].second+x > 5000 ||
				   hashira[i].first-y+x > 5000 ||
				   hashira[i].second+y+x > 5000 ||
				   hashira[i].first-y < 0 ||
				   hashira[i].second+x < 0 ||
				   hashira[i].first-y+x < 0 ||
				   hashira[i].second+y+x < 0){
					continue;
				}
				
				if(check[hashira[i].first-y][hashira[i].second+x] && check[hashira[i].first-y+x][hashira[i].second+y+x]){
					answer = max(answer,x*x+y*y);
				}
			}
		}
		cout << answer << endl;
		
	}
	return 0;
}

Measured memory_bytes: 27476
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector> 
#include <algorithm>
#include <typeinfo>
#include <cmath>
#include <numeric>
using namespace std;


int main()
{
    int time = 0;
    std::vector<int> A(5);
    for (int i = 0; i < 5; ++i)
    {
        std::cin >> A[i];
        if(A[i]%10 == 0){
            time += A[i];
            A[i] = 10;
        }else{
            time += (A[i]/10 + 1)*10;
            A[i] = A[i]%10;
        }
    }
    time = time - 10 + *min_element(A.begin(), A.end());
    std::cout << time << "\n";
}

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

int main() {
    cin.tie(0)->sync_with_stdio(false);

    int r, g, b, n;
    cin >> r >> g >> b >> n;

    ll cnt = 0;
    REP(i, 3001) REP(j, 3001) {
        if (i * r + j * g <= n)
            if ((n - (i * r + j * g)) % b == 0)
                cnt++;
    }
    cout << cnt << '\n';
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF         1e9
#define INFLL       1e18
#define EPS         1e-9
#define REP(i,n)    for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(ll i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP(n)     cout<<fixed<<setprecision(n)
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

ll gcd(ll x, ll y)
{
	return y == 0 ? x : gcd(y, x % y);
}
ll lcm(ll x, ll y)
{
	return x / gcd(x, y) * y;
}
signed main()
{
	ll a[3], m[3];
	while (cin >> a[0] >> m[0] >> a[1] >> m[1] >> a[2] >> m[2], a[0]) {
		ll cood[3] = { 1,1,1 };
		ll cnt[3];
		REP(i, 3) {
			ll foo = 0;
			while (true) {
				cood[i] = a[i] * cood[i] % m[i];
				++foo;
				if (cood[i] == 1) {
					cnt[i] = foo;
					break;
				}
			}
		}
		cout << lcm(lcm(cnt[0], cnt[1]), cnt[2]) << endl;
	}
}


Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t n,m;cin>>n>>m;
  int64_t ans=n;
  if(2*n>=m){
    cout <<m/2<<endl;
    return 0;
  }
  else{
    m-=2*n;
    while(1){
      m-=4;
      if(m>=0)ans++;
      else break;
    }
  }
  cout <<ans<<endl;
}

Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,i,j,k,l,a,b;
    cin>>a>>b>>k;
    for(i=a; i<a+k&&i<=b; i++)
    {
        cout<<i<<endl;
    }
    l=b-k;
    if((a+k)>l)
    {
        i=a+k;
    }
    else if((a+k)<=l)
    {
        i=l+1;
    }
    for(i=i;i<=b;i++)
    {
        cout<<i<<endl;

    }
//    if((a+k)<=b)
//    {
//        if((b-k)>(a+k))
//        {
//            for(i=b-k; i<=b; i++)
//            {
//                cout<<i<<endl;
//            }
//        }
//        else
//        {
//            for(i=a+k+1; i<=b; i++)
//            {
//                cout<<i<<endl;
//            }
//        }
//
//    }
    return 0;

}


Measured memory_bytes: 256
package main

import(
    "bufio"
    "fmt"
    "os"
)

var r = bufio.NewReader(os.Stdin)

func main(){
    var S int
    fmt.Fscan(r, &S)
    
    s := S%60
    m := (S%3600)/60
    h := S/3600
    
    fmt.Printf("%v:%v:%v\n",h,m,s)
}


Measured memory_bytes: 1172
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define be begin()
#define en end()
#define le length()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (__typeof(n) i = 0; i < n; i++)
#define repo(i, n) for (__typeof(n) i = 1; i <= n; i++)
#define eps 1e-6
#define pi 3.141592653589793
#define c(a) cout << a << "\n";
#define a(a)         \
    for (auto i : a) \
        cout << i << " ";
typedef vector<int> vii;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MOD = 1e9 + 7;
const int INF = 1e9;
int main()
{
    ll n, k, c = 0, x;
    cin >> n >> k;
    rep(i, n)
    {
        cin >> x;
        if (x >= k)
            c++;
    }
    c(c)

        return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> P;
LL INF = 1e9;

vector<vector<int>> G(300010);
vector<int> d(300010, -1);
vector<int> used(300010, 0);

int main(){
    int N, M, S, T;
    cin >> N >> M;
    for(int i = 0;i < M;i++){
        int u, v;
        cin >> u >> v;
        u--;    v--;
        G[3*u].push_back(3*v+1);
        G[3*u+1].push_back(3*v+2);
        G[3*u+2].push_back((3*v));
    }
    cin >> S >> T;
    S--;    T--;
    queue<int>  que;
    que.push(3*S);
    d[3*S] = 0;
    used[3*S] = 1;
    while(!que.empty()){
        int u = que.front();
        que.pop();
        for(auto s : G[u]){
            if(!used[s]){
                d[s] = d[u]+1;
                used[s] = 1;
                que.push(s);
            }
        }
    }
    if(d[3*T] == -1)   cout << -1 << endl;
    else    cout << (d[3*T]/3) << endl;
}

Measured memory_bytes: 18944
#include<iostream>
#include<cmath>
#include<vector>
#include <algorithm>
#include<string>

using namespace std;

int main() {
	string str;
	const char* c;
	cin >> str;
	int n = str.length();
	c = str.c_str();
	for (int i = 0; i < n; i++) {
		if ((i + 1) % 2 == 1 && c[i] == 'L') {
			cout << "No";
			return 0;
		}
		else if ((i + 1) % 2 == 0 && c[i] == 'R') {
			cout << "No";
			return 0;
		}
	}
	cout << "Yes";
	return 0;
}

Measured memory_bytes: 256