akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a,i) memset(a,i,sizeof(a))
#define all(x) x.begin(),x.end()
#define itit(it,a) for(auto it=(a).begin(); it!=(a).end(); it++)
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define repr(i,a,b) for(ll i=a; i>b; i--)
#define reprr(i,a,b) for(ll i=a; i>=b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
#define trace1(x)				cerr<<#x<<": "<<x<<endl
#define trace2(x, y)			 cerr<<#x<<": "<<x<<"  "<<#y<<": "<<y<<endl
#define trace3(x, y, z)		  cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)	   cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)	cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
const ll M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e17+10;

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll t,x;
	cin >> t >> x;
	ld res=(ld)t/x;
	cout << setprecision(6) << res;
	return 0;
}
/* The judge is never wrong! Your code is buggy
   Look for:
 * * Read the problem carefully.
 * * Don't forget to sort(), mod, ll!!!!
 * * Initial value = +/- infinity instead of zero!!!
 * * an easier and alternate approach
 * * read the problem statement carefully
 * * if concept is correct and still WA, try with a different implementation
 * * special cases (n=1?)
 * * overflow (ll vs int?)
 * * array bounds
 * * if you have no idea just guess the appropriate well-known algorithm instead of doing nothing :/
 */


Measured memory_bytes: 256
n=int(input())
W=[]
for i in range(n):
    w=input()
    W.append(w)
    if i > 0:
        if W[i][0] == last and W.count(W[i]) <= 1:
            ans=1
        else:
            ans=0
            break
    last = W[i][len(W[i])-1]
if ans==0:
    print("No")
else:
    print("Yes")

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

using ll = long long;
const int N = 1e5+10;

int x, y, a, b, c;
int p[N], q[N];
vector<int> v;

int main () {
  scanf("%d %d %d %d %d", &x, &y, &a, &b, &c);
  for(int i = 0; i < a; i++) scanf("%d", &p[i]);
  for(int i = 0; i < b; i++) scanf("%d", &q[i]);
  for(int i = 0; i < c; i++) {
    int x; scanf("%d", &x);
    v.push_back(x);
  }

  sort(p, p + a); sort(q, q + b);
  for(int i = a - 1; i > a - x - 1; i--) v.push_back(p[i]);
  for(int i = b - 1; i > b - y - 1; i--) v.push_back(q[i]);
  sort(v.begin(), v.end());
  ll ans = 0; int sz = v.size();
  for(int i = sz - 1; i > sz - x - y - 1; i--) 
    ans += v[i];
  printf("%lld\n", ans);
  return 0;
}

Measured memory_bytes: 3188
<?php
fscanf(STDIN, '%d', $n);//スライムの数
$colors = str_split(trim(fgets(STDIN)));//色配列

$final_count = $n;//最終結果
$streak = 0;//連続

for($s = 1; $s < $n; $s++) {
    $color = $colors[$s];
    if($color === $colors[$s-1]) {
        $streak++;
    } else {
        if($streak > 0) {
            $final_count -= $streak;
            $streak = 0;
        }
    }
    if($s === ($n - 1) && $streak > 0) {
        $final_count -= $streak;
    }
}

echo $final_count.PHP_EOL;

Measured memory_bytes: 11000
#include <bits/stdc++.h>
    #include <set>
    #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, m, n) for(int i = m;i < n;i++)
    #define FORR(i, m, n) for(int i = m;i >= n;i--)
    #define SORT(v, n) sort(v, v+n);
    #define VSORT(v) sort(v.begin(), v.end());
    //
    #define llong long long
    #define pb(a) push_back(a)

    #define INF 100000000
    #define MOD 100000007

    #define writeln(n) cout<<n<<endl

    using namespace std;
    typedef pair<int, int> P;
    typedef pair<llong, llong> LP;
    typedef pair<int, P> PP;
    typedef pair<llong, LP> LPP;
    //vector<tuple<long long, long long, long long>>vec;


    bool isprime(int p) {
        if (p == 1) return false;
        for (int i = 2; i < p; i++) {
            if (p%i == 0) return false;
        }
        return true;
    }

    int dx[4] = {1, 0, -1, 0};
    int dy[4] = {0, 1, 0, -1};

    const int inf=100000000;

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

    int gcd(int a, int b) {
        return b != 0 ? gcd(b, a % b) : a;
    }
    //setprecision(10);

    //素数判定
    bool isprime(llong p) {
        if (p == 1) return false;
        for (llong i = 2; i*i <= p; i++) {
            if (p%i == 0) return false;
        }
        return true;
    }


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

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

        vector<int> h(n,0);
        REP(i,n) cin>>h[i];

        int ans=0;
        REP(i,n) 
        {
            if(h[i]>=k) ++ans;
        }
        cout<<ans<<endl;


        return  0;
    }


Measured memory_bytes: 640
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15,\
 2, 2, 5, 4, 1, 4, 1, 51]

k = int(input())

print(a[k-1])

Measured memory_bytes: 3060
function main(input) {
  const S = input.toString();
  
  let ary = S.split('').filter((v, i) => { 
    if (i % 2 === 0) {
    	return v;
  	}
  });
  
  let result;
  
  for(let i = 0; i < ary.length; i++) {
    if (!result) {
      result = ary[i];
    } else {
      result = result + ary[i];
    }
  }
  console.log(result);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 34940
#include<bits/stdc++.h>
#define rep(i,a,b) for (int i=(a); i<=(b); i++)
#define per(i,a,b) for (int i=(a); i>=(b); i--)
using namespace std;

const int maxn = 100005;
int a[maxn], vis[maxn], n, m, x, y, mn, cur;
priority_queue<int, vector<int>, greater<int> > Q;
vector<int> e[maxn];
long long ans;

void dfs(int u) {
	int sz = e[u].size();
	if (a[u] < mn) mn = a[u], cur = u;
	vis[u] = 1;
	if (!sz) return;
	rep (i, 0, sz - 1)
		if (!vis[e[u][i]]) dfs(e[u][i]);
}

int main() {
	scanf("%d%d", &n, &m);
	if (n < 2 * (n - m - 1)) 
		return puts("Impossible"), 0;
	if (n - 1 == m)
		return puts("0"), 0;
	rep (i, 1, n) scanf("%d", &a[i]);
	rep (i, 1, m) {
		scanf("%d%d", &x, &y); x++; y++;
		e[x].push_back(y); e[y].push_back(x);
	}
	rep (i, 1, n)
		if (!vis[i]) {
			mn = 2e9;
			dfs(i);
			ans += mn;
			a[cur] = 0;
		}
	rep (i, 1, n)
		if (a[i]) Q.push(a[i]);
	m = 2 * (n - m - 1) - (n - m);
	while (m-- > 0) {
		ans += Q.top();
		Q.pop();
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 7168
#include <stdio.h>
#include <math.h>
#define PI 3.141592653589793

int main(void){
	double s,l,h,deg;
	int a,b;

	scanf("%d%d%lf", &a,&b,&deg);
	deg = deg * PI / 180.0;

	s = 0.5*a*b*sin(deg);
	l = a*a+b*b-2*a*b*cos(deg);
	l = sqrt(l);
	h = b*sin(deg);	
	printf("%f\n%f\n%f\n", s, a+b+l, h);
	return 0;
}

Measured memory_bytes: 672
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
#include <queue>
using namespace std;

long long N, M;
long long S[1 << 18], C[1 << 18];
vector<long long> T[9];

int main() {
	cin >> N >> M;
	for (int i = 0; i < M; i++) {
		cin >> S[i] >> C[i];
		T[S[i]].push_back(C[i]);
	}
	for (int i = 1; i <= N; i++) {
		sort(T[i].begin(), T[i].end());
		T[i].erase(unique(T[i].begin(), T[i].end()), T[i].end());
	}

	// 判定
	for (int i = 1; i <= N; i++) {
		if (T[i].size() >= 2) { cout << "-1" << endl; return 0; }
	}
	if (N != 1 && (T[1].size() == 1 && T[1][0] == 0)) { cout << "-1" << endl; return 0; }

	string S = "";
	for (int i = 1; i <= N; i++) {
		if (T[i].size() == 1) S += ('0' + T[i][0]);
		else {
			if (i == 1 && N != 1) S += '1';
			else S += '0';
		}
	}
	cout << S << endl;
	return 0;
}

Measured memory_bytes: 2304
#include <stdio.h>

int
main()
{
	int x, y;
	int temp;
	for (;;)
	{
		scanf("%d %d", &x, &y);

		if (x == 0 && y == 0)
			break;

		if (y < x)
		{
			temp = x;
			x = y;
			y = temp;
		}
		printf("%d %d\n", x, y);
	}

	return 0;
}

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

using namespace std;

#define ll long long

const ll MOD = 1e9 + 7;

int main()
{
	int N;
	cin >> N;
	vector < ll > A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}

	ll ans = 0;
	for (int d = 0; d < 60; d++) {
		ll n0 = 0, n1 = 0;
		for (int i = 0; i < N; i++) {
			if ((A[i] >> d) & 1) {
				n1++;
			} else {
				n0++;
			}
		}
		ll tmp = (1LL << d) % MOD;
		ll n = n0 * n1 % MOD;

		tmp = tmp * n % MOD;
		ans = (ans + tmp) % MOD;
	}

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


Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define ll long long 
#define rep(i,n) for(ll i=2;i<=n;i++)
using namespace std;
signed main(){
  ll n,a[1000000]={2,1},sum=0;
  cin>>n;
  rep(i,n){
    a[i] += a[i-2] + a[i-1];
  }
  cout<<a[n]<<"\n";
  return 0;
}

Measured memory_bytes: 8064
#[cfg(debug_assertions)]
include! {"./debug.rs"}

#[cfg(not(debug_assertions))]
macro_rules! debug {
    ($($arg:expr),*) => {};
}

macro_rules! read {
    ([$t:ident] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ([$t:ident]) =>
        (rl().split_whitespace().map(|w| read_type!(w, $t)).collect::<Vec<_>>());
    (_, [$t:ident] ; $n:expr) =>
        ((0..$n).map(|_| read!(_, [$t])).collect::<Vec<_>>());
    (_, [$t:ident]) =>
        (rl().split_whitespace().skip(1).map(|w| read_type!(w, $t)).collect::<Vec<_>>());
    ($($t:ident),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ($t:ident) => (read_type!(rl(), $t));
    ($($t:ident),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(read_type!(w.next().unwrap(), $t)),*)
    }};
}

macro_rules! read_type {
    ($s:expr, chars) => {
        $s.chars().collect::<Vec<char>>()
    };
    ($s:expr, usize1) => {
        read_type!($s, usize) - 1
    };
    ($s:expr, $t:ty) => {
        $s.parse::<$t>().unwrap()
    };
}

fn rl() -> String {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

impl<T: Iterator> IteratorExt for T {}

////////////////////////////////////////////////////////////////////////////////

fn main() {
    let s = read!(String);
    let x: i32 = s[0..2].parse().unwrap();
    let y: i32 = s[2..4].parse().unwrap();

    let ans = match x {
        1...12 => match y {
            1...12 => "AMBIGUOUS",
            _ => "MMYY",
        },
        _ => match y {
            1...12 => "YYMM",
            _ => "NA",
        },
    };

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


Measured memory_bytes: 4352
n = int(input())
A = {'S':[],'H':[],'C':[],'D':[]}
M = {'S':[],'H':[],'C':[],'D':[]}
for i in range(n):
  a, b = list(map(str, input().split(' ')))
  A[a].append(int(b))
for l in A:
  cnt = 0
  for ll in range(1, 13 + 1):
    if not ll in A[l]:
      M[l].append(ll)
  M[l].sort()
  if 0 < len(M[l]):
    for o in M[l]:
      print('{0} {1}'.format(l, o))


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

using namespace std;

int N,D,X,A,ans;

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

  for(int i=0;i<N;i++){
    cin>>A;
    for(int j=0;1+A*j<=D;j++){
      ans++;
    }
  }
  cout<<ans+X<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int N,M,X[2019]={0},A[101];
	int i,j;
	scanf("%d",&N);
	for(i=1;i<=N;i++)scanf("%d",&X[i]);
	scanf("%d",&M);
	for(j=1;j<=M;j++)scanf("%d",&A[j]);
	for(j=1;j<=M;j++){
		if(X[A[j]]+1!=X[A[j]+1] || A[j]==N){
			X[A[j]]++;
			if(X[A[j]]>2019)X[A[j]]=2019;
		}
	}
	for(i=1;i<=N;i++)printf("%d\n",X[i]);
	return 0;
}


Measured memory_bytes: 2140
//
// Created by yamunaku on 2020/05/30.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

int main(){
    //CFS;
    int h1,m1,h2,m2,k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    cout << max(0, h2*60+m2-h1*60-m1-k) << endl;
    return 0;
}

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

int n, z, w;
int a[2005] = {0};

void solve();
int calc(int x);

int main() {
  cin >> n >> z >> w;
  for(int i = 0; i < n; ++i) cin >> a[i];
  if(n == 1)
    cout << abs(w - a[n - 1]) << endl;
  else
    cout << max(abs(w - a[n - 1]), abs(a[n - 1] - a[n - 2]))
         << endl;
  return 0;
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut 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 mut $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")
    };
}

// use std::io::{stdout, Write, BufWriter};
use std::cmp::{max};

fn main() {
    input! {
        a: usize,
        b: i32,
        s: String,
    }
    let s = s.as_bytes();
    for (i, &t) in s.iter().enumerate() {
        if i == a { if t != b'-' {
            println!("No");
            return;
            }
        } else if !(b'0' <= t && t<= b'9') {
            println!("No");
            return;
        }
    }
    println!("Yes");
}


Measured memory_bytes: 4352
#include <algorithm>
#include <bits/stdc++.h>
#include<iostream>
#include<string>
using namespace std;
#define rep(i, n) for (int i = 0; i <(int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
const ll MOD=1000000007;
const ll INF=1000000000000000001;
int main(){
    ll n,m;cin>>n>>m;
    ll a[n],b[n];
    map<ll,ll> mp;
    rep(i,n){
        cin>>a[i]>>b[i];
        mp[a[i]]+=b[i];
    }
    ll sum=0;
    ll pri=0;
    for(auto p:mp){
        if(sum+p.second<=m){
            sum+=p.second;
            pri+=p.first*p.second;
        }
        else {
            pri+=p.first*(m-sum);
            break;
        }
    }
    cout << pri << endl;
}

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

int main(){
  string s;
  cin >> s;
  int ans = 0;
  int tmp = 0;
  if (s[0] == 'R') tmp++;
  if (ans < tmp) ans = tmp;
  if (s[1] == 'R') tmp++;
  else tmp = 0;
  if (ans < tmp) ans = tmp;
  if (s[2] == 'R') tmp++;
  else tmp = 0;
  if (ans < tmp) ans = tmp;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N;
  cin >> N;
  vector<char> S(N);
  bool ans = false;
  for (int i = 0; i < N; i++) {
    cin >> S[i];
    if (S[i] == 'Y') ans = true;
  }
  if (ans) cout << "Four" << endl;
  else cout << "Three" << endl;
  return 0;
}

Measured memory_bytes: 256
process.stdin.resume();
process.stdin.setEncoding('utf8');
// Here your code !
var input_text="";
process.stdin.on("data",function(chunk){
   input_text+=chunk.toString();
});
process.stdin.on("end",function(){   
   var line = input_text.trim().split("\n");
   var num = line[1].split(" ").map(function(e){return e*1});
   var min = Math.min.apply(null,num);
   var max = Math.max.apply(null,num);
   var sum = num.reduce(function(a,b){return a+b});
   
   console.log(min.toString()+" "+max.toString()+" "+sum.toString());    
});

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

#define NREP() for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define IPT(t, x) t ipt; cin >> ipt; x.push_back(ipt);
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;

const static ll MOD = 1e9 + 7;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;
string s;

int main() {
    cin >> a >> b;
    ans = 0;
    cnt = 1;
    while (cnt < b) {
        cnt--;
        cnt+=a;
        ans++;
    }

    MSG(ans)
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main ()
{
    vector<int > g;
    g.assign (3,0);
    int f=0,s=0;
    for (int i = 0;i<3;i++)
       { cin >> g[i];
       if (g[i]==5)
        f++;
    else if (g[i]==7)
        s++;
    }
    if (s==1 && f==2)
    cout << "YES\n";
    else cout << "NO\n";
    return 0;
    }


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,k,i,sum=0;
    
    cin >> n >> k;
    vector<int> p(n);
    
    for(i=0;i<n;i++){
        cin >> p.at(i);
    } 
    
    std::sort(p.begin(),p.end());

    
    for(i=0;i<k;i++){
    sum = sum + p.at(i);
    }

    cout << sum << endl;

}

Measured memory_bytes: 3628
#include<iostream>
#include<string>
#include<map>
#include<set>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;

int main(){
    int n,m,x,y;
    string s;
  	map<int,set<int>> p;
    cin>>n>>m;
    rep(i,n) s+='0';
    rep(i,m){
        cin>>x>>y;
      	p[x].insert(y);
      	
        if(p[x].size()>1) {cout<<-1;return 0;}
        else s[x-1]=y+'0';
    }
  	if(n!=1) {if(m==0) s[0]='1';else if(s[0]=='0'&&p[1].count(0)==0) s[0]='1';}
    if(s.size()>1&&s[0]=='0') {cout<<-1;return 0;}
    cout<<s;
   

}   


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lowbit(x) (x&-x)
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
const int INF=0x3f3f3f3f;
const int MOD=20010905;
const int maxn=1e5+10;
int n,a[100],b[100],t[100];
struct node
{
    int val;
    int flag;
}s[100];
int check(int x)
{
    for(int i=1;i<=n;i++)
    {
        if((x>>(i-1))&1)
            s[i]=node{a[i],1},t[i]=a[i];
        else
            s[i]=node{b[i],0},t[i]=b[i];
    }
    sort(t+1,t+n+1);
    int cnt=0;
    for(int i=1;i<=n;i++)
    {
        bool flag=false;
        for(int j=i;j<=n;j++)
        {
            if(s[j].val==t[i]&&(((j-i)&1)^s[j].flag))
            {
                flag=true;
                for(int k=j-1;k>=i;k--)
                {
                    s[k].flag^=1;
                    swap(s[k],s[k+1]);
                    cnt++;
                }
                break;
            }

        }
        if(!flag)
            return INF;
    }
    return cnt;
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    for(int i=1;i<=n;i++)
        scanf("%d",&b[i]);
    int ans=INF;
    for(int i=0;i<=(1<<n)-1;i++)
        ans=min(ans,check(i));
    if(ans==INF)
        printf("-1\n");
    else
        printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <queue>
#include <set>

using namespace std;

#define N_MAX 100001
#define M_MAX 100001

int par[N_MAX];

int find(int a)
{
	if (par[a] == a){
		return a;
	}
	return par[a] = find(par[a]);
}

void unite(int a, int b)
{
	if (find(a) == find(b)){
		return;
	}
	par[find(a)] = find(b);

	return;
}

void solv()
{
	int M, K; scanf("%d%d", &M, &K);

	long long int len = 1;
	for (int i = 0; i < M; i++){
		len = len * 2;
	}
	if (0 == K){
		for (int i = 0; i < len; i++){
			printf("%d %d ", i, i);
		}
		return;
	}

	if (K >= len){
		printf("-1");
		return;
	}
	if (0 == M){
		printf("0 0");
		return;
	}
	else if (1 == M && 1==K){
		printf("-1");
		return;
	}

	printf("%d ", K);
	for (int i = 0; i < len; i++){
		if (K == i) continue;
		printf("%d ", i);
	}
	printf("%d ", K);
	for (int i = len - 1; i >= 0; i--){
		if (K == i) continue;
		printf("%d ", i);
	}

	return;
}

int main()
{
	FILE *fin = NULL, *fout = NULL;
	//fin = freopen("input.txt", "r", stdin);
	//fout = freopen("output.txt", "w", stdout);

	solv();

	//finalize
	if (NULL != fin) fclose(fin);
	if (NULL != fout) fclose(fout);

	return 0;
}

Measured memory_bytes: 1792
public class Main{
  static int top;
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
    int n, h, w, i, j, k;
    char[][] f;
    String s;
    int[] nowh, noww, dh, dw;

    f = new char[14][14]; nowh = new int[64]; noww = new int[64];
    dh = new int[12]; dw = new int[12];
    for(i = 0;i < 3;i++){
      dh[i] = -(i + 1); dw[i] = 0;
      dh[i + 3] = 0; dw[i + 3] = -(i + 1);
      dh[i + 6] = i + 1; dw[i + 6] = 0;
      dh[i + 9] = 0; dw[i + 9] = i + 1;
    }
    n = sc.nextInt();
    for(k = 0;k < n;k++){
      for(i = 3;i < 11;i++){
        s = sc.next();
        for(j = 3;j < 11;j++)f[i][j] = s.charAt(j - 3);
      }
      w = sc.nextInt(); h = sc.nextInt(); w += 2; h += 2;

      top = 0;
      f[h][w] = '0';
      pushhw(nowh, noww, h, w);
      for(;top > 0;){
        h = poph(nowh); w = popw(noww);
        for(i = 0;i < 12;i++)if(f[h + dh[i]][w + dw[i]] == '1'){
          f[h + dh[i]][w + dw[i]] = '0';
          pushhw(nowh, noww, h + dh[i], w + dw[i]);
        }
      }

      out.printf("Data %d:%n", k + 1);
      for(i = 3;i < 11;i++){
        for(j = 3;j < 11;j++)out.print(f[i][j]);
        out.println();
      }
    }

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
  private static int poph(int[] nowh){
    return nowh[--top];
  }
  private static int popw(int[] noww){
    return noww[top];
  }
  private static void pushhw(int[] nowh, int[] noww, int h, int w){
    nowh[top] = h; noww[top++] = w;
    return;
  }
}

Measured memory_bytes: 17264
import java.util.Scanner;

public class Main {
	public static void main(String []args){
		//????????£????????????????????°?????????????????£?¨?
		Scanner sc = new Scanner(System.in);
		while(true){
			//???
			int H = sc.nextInt();
			//?¨?
			int W = sc.nextInt();
			//??\?????????0????????????
			if(H ==0 && W ==0){
				break;
			}
			//???????????¶???
			for(int i =1; i <=H; i++){
				//?¨?????????¶???
				String s = "";
				for(int j =1; j<=W; j++){
					//
					if(i ==1 || i==H || j==1 || j==W){
						s +="#";
					}else{
						s += ".";
					}
				}
				//
				System.out.println(s);
			}
			System.out.println();
		}
	}
}

Measured memory_bytes: 50064
#include<iostream>
using namespace std;
int main() {
    int n, m, l, x;
    cin >> n >> m >> l;
    int a[n][m], b[m][l] ={};
    long long int c[n][l] = {};
    for (int i=0; i<n; i++) {
        for (int j=0; j<m; j++) {
            cin >> x;
            a[i][j] = x;
        }
    }
    for (int i=0; i<m; i++) {
        for (int j=0; j<l; j++) {
            cin >> x;
            b[i][j] = x;
        }
    }
    for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			for(int k = 0; k < l; k++){
				c[i][k] += a[i][j]*b[j][k];
			}
		}
	}
    for (int i=0; i<n; i++) {
        for (int j=0; j<l; j++) {
            if (j==l-1) {
                cout << c[i][j];
            } else {
                cout << c[i][j] << " ";
            }
        }
        cout << endl;
    }
}


Measured memory_bytes: 3228
#include<iostream>
using namespace std;
int main() {
    int a[100][100] = {}, b[100] = {};
    int n, m;
    int c;
    
    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> a[i][j];
        }
    }
    for (int i = 0; i < m; i++) {
        cin >> b[i];
    }

    for (int i = 0; i < n; i++) {
        c = 0;
        for (int j = 0; j < m; j++) {
            c += a[i][j] * b[j];
        }
        cout << c << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

int main() {
    int N, M, X;  cin >> N >> M >> X;
    vector<int> A(M);  rep(i, M) cin >> A[i];

    vector<int> cost(N+1, 0);
    rep(i, M) {
        cost[A[i]]++;
    }
    int cnt1 = 0;
    rep(i, X) {
        if (cost[i]) cnt1++;
    }
    int cnt2 = 0;
    for (int i=X; i<N+1; ++i) {
        if (cost[i]) cnt2++;
    }

    cout << min(cnt1, cnt2) << endl;
}




Measured memory_bytes: 256
/*input

7
1 1 1 1 1 1 1


*/ 
#include <iostream>
#include <bits/stdc++.h>
#include <math.h> 
#include <algorithm>
#include <unordered_map>
#include <unordered_set>

using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define gc getchar_unlocked
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define bloop(i,a,b) for (int i = a ; i>=b;i--)
#define tc(t) int t; cin >> t; while (t--)
#define int long long
#define si(x)   scanf("%d",&x)
#define sl(x)   scanf("%lld",&x)
#define ss(s)   scanf("%s",s)
#define pi(x)   printf("%d\n",x)
#define pl(x)   printf("%lld\n",x)
#define ps(s)   printf("%s\n",s)
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define ms(a,x) memset(a, x, sizeof(a));
#define endl "\n"
#define trav(a,x) for(auto &a:x)
#define bits(n) __builtin_popcount(n)
int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a);}
typedef pair<int, int>  pii;
typedef vector<int>     vi;
typedef vector<pii>     vpii;
typedef vector<vi>      vvi;
int mpow(int base, int exp); 
void ipgraph(int m);
//void dfs(int u, int par);
const int mod = 1000000007;
const int N = 1000000001;
const int MAX = 2*pow(10,6)+5;
 

//standard input and output template
template<typename... T>
void in(T&... args) {
    ((cin >> args), ...);
}

template<typename... T>
void out(T&&... args) {
    ((cout << args << " "), ...);
}

template<typename... T>
void outl(T&&... args) {
    ((cout << args << endl), ...);
}


int fast_exp(int base, int exp) {
    int res=1;
    while(exp>0) {
       if(exp%2==1) res=(res*base)%mod;
       base=(base*base)%mod;
       exp/=2;
    }
    return res%mod;
}




int32_t main() {
  IOS;
  int n;cin>>n;
  int arr[n];
  for(int i=0;i<n;i++)cin>>arr[i];
  sort(arr,arr+n,greater<int>());
  if(n==1){
  	cout<<0<<endl;return 0;
  }
  n-=2;
  int ans = arr[0];
  int cnt = n/2;
  if(n==0){
  	cout<<ans<<endl;return 0;
  }
  if(n%2==0){
  	
  	for(int i=1;i<=cnt;i++){
  		ans+=arr[i]*2;
  	}
  }
  else{
  	for(int i=1;i<=cnt;i++){
  		ans+=arr[i]*2;
  	}
  	ans+=arr[cnt+1];
  }
  cout<<ans<<endl;

  return 0;
}

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

typedef long long int ll;
typedef long int li;

const ll mod = 1000000007;
const ll inf = 1000000000000000000;

typedef vector<int> vi;
typedef vector<li> vli;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef vector<vli> vvli;
typedef vector<vll> vvll;
typedef vector<vs> vvs;
typedef map<ll, ll> mll;
typedef map<ll, string> mls;
typedef map<string, ll> msl;

#pragma GCC optimize ("-O3")
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); 
#define PI 3.14159265358979323846
#define pb push_back
#define mp make_pair
#define fs first
#define sec second
#define pq priority_queue
#define lb lower_bound
#define ub upper_bound
#define tol(s) transform(s.begin(), s.end(), s.begin(), ::tolower);
#define tou(s) transform(s.begin(), s.end(), s.begin(), ::toupper);
#define all(v) v.begin(), v.end()
#define FOR(i, j, k, in) for(li i=j; i<k; i+=in)
#define RFOR(i, j, k, de) for(li i=j; i>=k; i-=de)
#define rep(i,j,k) FOR(i, j, k, 1)
#define rrep(i,j,k) RFOR(i, j, k, 1)
#define repc(v) for(auto it=v.begin(); it!=v.end(); it++)
#define T ll t; cin>>t; while(t--)

int main(){
  FAST

  string s;
  cin>>s;
  int l=s.length();
  
  int f=0;
  int i=0,j=l-1;
  while(i<j){
  	if(s[i]!=s[j]){
    	f=1;
      break;
    }      
    i++; j--;
  }
  
  if(f==0){
    int a=(l-1)/2;
  int b=(l+3)/2-1;
 
  int f1=0,f2=0;
  i=0,j=a-1;
  while(i<j){
  	if(s[i]!=s[j]){
    	f1=1;
      break;
    }      
    i++; j--;
  }
  
  i=b,j=l-1;
  while(i<j){
  	if(s[i]!=s[j]){
    	f2=1;
      break;
    } 
    i++; j--;
  }
    
    if(f1==0 && f2==0) 
      cout<<"Yes";
    else cout<<"No";
  }
  
  else cout<<"No";
  
  
  return 0;
}








Measured memory_bytes: 256
//#include "SaveFuncs.cpp"

/*****/

#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <iomanip>	//cout << fixed << setprecision(桁数);
#include <stdexcept>

using namespace std;
using ll = long long;

#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++)
#define rep1(i, n) for(int i=1, i##_len=(n); i<i##_len; i++)
#define rrep(i, n) for(int i=(n)-1; i >= 0; i--)
#define rrep1(i, n) for(int i=(n); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define pair(a, b) make_pair(a, b);
//#define int long long
constexpr int INF = 2000000100;
constexpr ll DIV = 1000000007;	// 10e9+7
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> T divUp(T a, T b) { if (a % b == 0) { return a / b; } return a / b + 1; }
std::string strMulti(std::string t, int n) { std::string out = ""; for (int i = 0; i < n; i++) { out += t; } return out; }
template<class T> T math_P(T m, T n) { T ret = 1; for (T i = m; i > m - n; i--) { ret *= i; } return ret; }
template<class T> T math_C(T m, T n) { T ret = mathP(m, n); for (T i = 2; i <= n; i++) { ret /= i; } return ret; }
template<class T> bool compare_by_b(pair<T, T> a, pair<T, T> b) { if (a.second != b.second) { return a.second < b.second; } return a.first < b.first; }
template<class T> T math_gcd(T a, T b) { a = abs(a); b = abs(b); if (a < b) { std::swap(a, b); } T tmp; while (b != 0) { tmp = b; b = a % b; a = tmp; } return a; }
template<class T> T math_lcm(T a, T b) { a = abs(a); b = abs(b); if (a > b) { std::swap(a, b); } if (a == 1) { return b; } T i = a; while (i % b != 0) { i += a; } return i; }

/*****/

int Main()
{
	ll N;
	cin >> N;

	ll ret = 0;
	ret = N * (N - 1) / 2;

	cout << ret;

	return 0;
}

/*****/

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

	//std::cout << std::fixed << std::setprecision(10);

	Main();

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
#pragma GCC optimize("Ofast")  
#pragma GCC target("avx,avx2,fma") 
using namespace std;

int main(int argc, char const *argv[])
{
	int n, m; cin >> n >> m;
	vector<int> edge[n+1];
	for(int i=0; i<m ; i++) {
		int u, v; cin >> u >> v;
		edge[u].push_back(v);
		edge[v].push_back(u);
	}
	vector<int> ans(n+1);
	cout << "Yes" << endl;
	queue<int> q; q.push(1);
	unordered_set<int> hset;

	while(q.empty() == false) {
		int t = q.front(); q.pop();
		for(auto x : edge[t]) {
			if(hset.count(x) > 0) continue;
			ans[x] = t;
			q.push(x); hset.insert(x);
		}
	}
	for(int i=2 ; i<=n ; i++) cout << ans[i] << endl;
	return 0;
}

Measured memory_bytes: 14224
#include <atcoder/all>
#include <bits/stdc++.h>

using namespace atcoder;
using namespace std;

#define vt          vector
#define sz(x)       int((x).size())
#define all(x)      (x).begin(), (x).end()
#define rall(x)     (x).rbegin(), (x).rend()
#define fi          first
#define se          second

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

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

    dsu d(n);
    while (m--) {
        int u, v;
        cin >> u >> v;
        d.merge(--u, --v);
    }
    
    cout << sz(d.groups()) - 1;
}

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

    int tcs = 1;
    for (int tc = 1; tc <= tcs; tc++) {
        // cout << "Case " << tc << ": ";
        solve();
    }
}



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

using namespace std;

typedef long long ll;
const ll MOD = (ll)(1e9 + 7);

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 2; i <= n; i++)
    {
        int j = 2, t = i;

        while (j <= t)
        {
            while (t % j == 0)
            {
                a[j - 1]++;
                t = t / j;
            }
            j++;
        }
    }
    ll res = 1;
    for (int i = 0; i < n; i++)
    {
        res *= a[i] + 1;
        res %= MOD;
    }
    cout << res;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  int ans = (n - m) * 100;
  ans += 1900 * m;
  for (int i = 0; i < m; i++) {
    ans *= 2;
  }
  cout << ans << '\n';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };


// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */

const int inf = 1<<30;

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

    int n, m; cin >> n >> m;
    string s; cin >> s;

    vector<int> dp(n+1, inf);
    dp[n] = 0;

    queue<int> q;
    q.push(0);
    reprev(i, n){
        while(1){
            if(q.size() == 0) { cout << -1 << endl; return 0; }
            if(q.front() != inf && q.size() <= m) break;
            q.pop();
        }
        if(s[i]=='0') dp[i] = q.front()+1;
        q.push(dp[i]);
    } 

    vector<int> ans;
    int x = 0;
    int rest = dp[0];
    while(x < n){
        --rest;
        int i = 1;
        while(dp[x+i] != rest) ++i;
        ans.push_back(i);
        x += i;
    }
    for(int i=0; i<ans.size(); ++i){
        if(i) cout << ' ';
        cout << ans[i];
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 1484
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int MAX_N = 105;
P r[MAX_N],b[MAX_N];
bool used[MAX_N];

int main()
{
	int N;
	cin >> N;
	int x,y;
	for (int i = 0; i < N; ++i)
	{
		cin >> x >> y;
		r[i] = P(x,y);
	}
	for (int i = 0; i < N; ++i)
	{
		cin >> x >> y;
		b[i] = P(x,y);
	}

	sort(b,b+N);
	int ans = 0;

	for (int i = 0; i < N; ++i)
	{
		used[i] = false;
	}

	rep(i,N)
	{
		bool ok = false;
		int idx;
		rep(j,N)
		{
			if (!used[j] && r[j].first < b[i].first && r[j].second < b[i].second)
			{
				if (ok && r[j].second > r[idx].second)
				{
					idx = j;
				}
				else if (!ok)
				{
					idx = j;
				}
				ok = true;
			}
		}

		if (ok)
		{
			ans++;
			used[idx] = true;	
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
MOD=(10**9)+7
n,k=map(int,input().split())
ans=0
for i in range(k,n+2):
    min_start=0
    min_end=min_start+i-1
    max_end=n
    max_start=n-i+1
    min_sum=(min_end-min_start+1)*(min_end+min_start)//2
    max_sum=(max_end-max_start+1)*(max_end+max_start)//2
#    print(i,min_start,min_end,min_sum,max_start,max_end,max_sum,max_sum-min_sum+1)
    ans+=max_sum-min_sum+1
    ans=ans%MOD
print(ans%MOD)

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

#define lp(i,n) for(int i=0;i<n;i++)
#define lpin(a,i,n) for(int i=0;i<n;i++){cin>>a[i];}
int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  a+=b+c+d;
  b=0;
  while(1){
    b++;
    a-=60;
    if(a<60) break;
  }
  cout<<b<<endl<<a<<endl;
  return 0;
}



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

int main(){
   int n,a;
   set<int> s;
   cin >> n;
   for (int i=0;i<n;i++){
       cin >> a;
       s.insert(a);
   }
   if(n==s.size()){
       cout << "YES" << endl;
   }else{
       cout << "NO" << endl;
   }
}

Measured memory_bytes: 9600
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>

using namespace std;

int main()
{string S; int K; cin >> S; cin >> K;
 
 vector<string> vec;
 
 for(int i = 0; i < S.size(); i++){
   for(int j = 1; j <= K; j++){
     string tmp = S.substr(i,j);
     vec.push_back(tmp);}}
   
   sort(vec.begin(),vec.end());
   
   vec.erase(unique(vec.begin(),vec.end()),vec.end());
   
   cout << vec[K-1] << endl;
   
   return 0;
 }

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

using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
template <typename T>
constexpr T INF = numeric_limits<T>::has_infinity ? numeric_limits<T>::infinity() : numeric_limits<T>::max() / 4;

#define REP(i, stop) FOR(i, 0, stop)
#define FOR(i, start, stop) for (int i = start, i##_len = stop; i < i##_len; ++i)
#define RREP(i, n) for (int i = n; i-- > 0;)
#define ALL(v) (v).begin(), (v).end()

template<typename T, typename U> istream& operator>>(istream& in, pair<T, U>& a) { cin >> a.first >> a.second; }
template<typename T> istream& operator>>(istream& in, vector<T>& a) { for (T& x : a) cin >> x; }

void LOG(const int& x) { cerr << x << "\n"; }
void LOG(const vector<int>& a) { for (int x : a) cerr << x << " "; cerr << "\n"; }
template<typename T, std::size_t S> void LOG(const T (&a)[S]) { REP(i, S) cerr << a[i] << " "; cerr << "\n"; }
template<typename T, std::size_t S, std::size_t R> void LOG(const T (&a)[S][R]) { REP(i, S) { REP(j, R) cerr << a[i][j] << " "; cerr << "\n"; } }

int ceil(int a, int b) { return (a - 1) / b + 1; }
i64 gcd(i64 a, i64 b) { while (b != 0) { i64 t = b; b = a % b; a = t; } return a; }
i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
i64 gcd(const vector<i64>& v) { return accumulate(ALL(v), 1LL, static_cast<i64(*)(i64, i64)>(gcd)); }
i64 lcm(const vector<i64>& v) { return v.empty() ? 0LL : accumulate(v.begin() + 1, v.end(), v[0], static_cast<i64(*)(i64, i64)>(lcm)); }
i64 pow(i64 x, i64 y, i64 z) { i64 a = 1; while (y > 0) { if (y & 1) a = a * x % z; x = x * x % z; y /= 2; } return a; }
i64 inv(i64 x, i64 m) { return pow(x, m - 2, m); }

#define COMP(key) [](const auto& a, const auto& b) { return a.key < b.key; }

class UnionFind { private: vector<int> par; vector<int> rnk; int find(int x) { return par[x] == x ? x : par[x] = find(par[x]); } public: UnionFind(int size) { par.resize(size); rnk.resize(size); REP(i, size) par[i] = i, rnk[i] = 0; } void unite(int x, int y) { x = find(x); y = find(y); if (x == y) return; if (rnk[x] < rnk[y]) { par[x] = y; } else { par[y] = x; if (rnk[x] == rnk[y]) rnk[x]++; } } bool same(int x, int y) { return find(x) == find(y); } };

struct InitCpp { InitCpp() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); } } initCpp;

// dp[i][s] = i 枚選んで合計 s になる通り数
i64 dp[52][2525];
signed main() {
  int n, a;
  cin >> n >> a;
  vector<int> X(n);
  cin >> X;
  dp[0][0] = 1;
  for (int x : X) {
    RREP(i, n) {
      REP(s, 2500) {
        dp[i + 1][s + x] += dp[i][s];
      }
    }
  }
  i64 ans = 0;
  FOR(i, 1, n + 1) {
    ans += dp[i][a * i];
  }
  cout << ans << endl;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
int main() {
int A,B,C,D,E,F,sum;
cin >> A >> B;
  
sum = 0;
C = A; //Cは取り出す回文数、入力した最初の数Aを代入して各桁を調べる
  
while (C <= B) {
  	D = C /10000;   //万の位
 	E = C /1000 - D*10;   //千の位 
  	F = C /100 - 100 * D - 10 * E;   //百の位
 	C = 10000*D + 1000*E + 100*F + 10 * E + D;
  	if (C < A) { //最初の回文数がAよりも小さかったら、合計から-1
      sum --;
    }
    sum ++;
    C += 100;
}
  cout << sum << endl;
}


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

int n,q;
vector<int>G[(int)2e6];
vector<int>E((int)2e6,0);
vector<int>flag((int)2e6,0);

void dfs(int x){
    flag[x]=1;
    REP(i,G[x].size()){
        if(flag[G[x][i]])continue;
        E[G[x][i]]+=E[x];
        dfs(G[x][i]);
    }
}

void solve() 
{
    cin>>n>>q;
    REP(i,n-1){
        int a,b;cin>>a>>b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    REP(i,q){
        int p,x;cin>>p>>x;
        E[p]+=x;
    }
    dfs(1);
    REP(i,n)cout<<E[i+1]<<" ";cout<<endl;
}

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


Measured memory_bytes: 80512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll, ll> P;
using VP = vector<P>;
using VVP = vector<VP>;
using VI = vector<ll>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;
const int inf = 1e9 + 7;
const ll INF = 1LL << 61;
const ll mod = 1e9 + 7;

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int i, j;
    int n;
    cin >> n;
    ll ans = 1;
    ll a[n];
    for (i = 0; i < n; i++) {
        cin >> a[i];
        if (a[i] == 0) {
            cout << 0 << endl;
            return 0;
        }
    }
    for (i = 0; i < n; i++) {
        if(a[i]>=(ll)2000000000000000001/ans){
            cout << -1 << endl;
            return 0;
        }
        ans *= a[i];
        if(ans >= 1000000000000000001){
            cout << -1 << endl;
            return 0;
        }
    }
    cout << ans << endl;
}


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

#define v vector
#define ll long long 
#define vpll vector<pair<long long,long long> > 
#define F first
#define S second
#define mp make_pair
#define ld long double
#define pb push_back
#define pii pair<int,int>
#define pci pair<char,int>
 
using namespace std; 



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int a,b;
    cin>>a>>b;
    if(a >= 13)
    cout<<b;
    else if( a >= 6 && a <= 12)
    cout<<b/2;
    else
    {
        cout<<0;
    }
    
    return 0;
}

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

int main(){
    string s,result="";
    cin >> s;
    for(int i=0; i<s.length(); i++){
        char c = s[i];
        switch(c){
            case '0':
                result += c;
                break;
            case '1':
                result += c;
                break;
            case 'B':
                if(result.length()>0){
                    result = result.substr(0, result.length()-1);
                }
                break;
        }
    }
    cout << result << '\n';
}


Measured memory_bytes: 3080
s=input()

if(s[0]=='1'):
    print('Error')

if(s[0]==s[len(s)-1]):
    if(len(s) & 1): 
        print('Second')
    else:
        print('First')
else:
    if(len(s) & 1): 
        print('First')
    else:
        print('Second')

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
const long long mod = pow(10, 9) + 7;
const long long MOD = 998244353;
const long long INF = 1LL << 60;
const int inf = pow(10, 9) + 7;
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, int B) {return (A + (B - 1)) / B;}
long long divCeil(int A, long long B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, long long B) {return (A + (B - 1)) / B;}

int main()
{
  int N, M;
  cin >> N >> M;
  
  vector<int> ANS(N, 0);
  for (int i = 0; i < M; i++)
  {
    int a, b;
    cin >> a >> b;
    ANS.at(a - 1)++;
    ANS.at(b - 1)++;
  }
  
  for (int i = 0; i < N; i++)
  {
    cout << ANS.at(i) << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define what_is(x) cerr << #x << " is " << x << endl;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
typedef long long ll;
const int N = 1e5+5;
const int INF = 1e9;
const int MOD = 1e9+7;

string s1, s2;
int main()
{
	IOS
	//freopen("input.txt", "r", stdin);
	cin >> s1 >> s2;
	int ans = 0;
	for(int i=0; i<3; i++) ans += (s1[i] == s2[i]);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256