akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>

typedef long long ll;

int main(int argc, char* argv[])
{
  std::string S, T;
  std::cin >> S >> T;

  std::vector< ll > vs(26, 0);
  std::vector< ll > vt(26, 0);
  for (ll i = 0; i < (ll)S.size(); i++) {
    vs[S[i] - 'a']++;
    vt[T[i] - 'a']++;
  }

  std::sort(vs.begin(), vs.end());
  std::sort(vt.begin(), vt.end());

  std::string judge = "Yes";
  for (ll i = 0; i < 26; i++) {
    if (vs[i] != vt[i]) {
      judge = "No";
    }
  }

  std::cout << judge << std::endl;

  return 0;
}


Measured memory_bytes: 776
#include <bits/stdc++.h>
using namespace std;
int main(){
int Ahp,Bhp,Ata,Bta;
cin >> Ahp >> Ata >> Bhp >> Bta;
int Aans = (Ahp + Bta - 1) /Bta;
int Bans = (Bhp + Ata - 1) /Ata;
if(Aans >= Bans)cout << "Yes" << endl;
else cout << "No" << endl;
return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
using namespace std;

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

	vector<int> vx;
	vector<int> vy;
	long i = 0;
	for (; i < n; ++i) {
		int x, y;
		cin >> x >> y;
		vx.push_back(x);
		vy.push_back(y);
	}

	long double sum = 0;
	for (i = 0; i < n; ++i) {
		long j = 0;
		for (j = i + 1; j < n; ++j) {
			double dist_square = 0;
			dist_square += (vx[j] - vx[i]) * (vx[j] - vx[i]);
			dist_square += (vy[j] - vy[i]) * (vy[j] - vy[i]);
			sum += sqrt(dist_square);
		}
	}

	sum = sum * 2/ n;
	cout << setprecision(15) << sum << '\n';
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main() {
	var a, b float64
	fmt.Scan(&a, &b)
	if b < a {
		fmt.Println(-1)
		return
	}
	for i := 13; float64(i) < 12.5*(a+1); i++ {
		if math.Floor(0.08*float64(i)) == a && math.Floor(0.1*float64(i)) == b {
			fmt.Println(i)
			return
		}
	}
	fmt.Println(-1)
}


Measured memory_bytes: 512
#include <stdlib.h>
#include <string.h>

int main(){
   int i,len,c=0,c1=0,c2=0,c3=0;
   char a[99];
   scanf("%s",a);
   len=strlen(a);
   for(i=0;i<len;i++)
      if(a[i]!=a[len-1-i]){
          c1=1;
          break;
   }
   for(i=0;i<(len-1)/2;i++)
      if(a[i]!=a[(len-1)/2-1-i]){
          c2=1;
          break;
   }
   for(i=(len+3)/2-1;i<len;i++)
      if(a[i]!=a[len-1-i]){
          c3=1;
          break;
   }
   c=c1+c2+c3;
   if(c==0)
            printf("Yes\n");
   else
         printf("No\n");

}


Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>

int min(int x, int y){
    return x < y ? x : y;
}
int main(void){
    int N;

    scanf("%d", &N);

    int i;

    int *B = (int *) malloc(sizeof(int) * (N - 1));

    for(i = 0; i < N - 1; i ++){
        scanf("%d", B + i);
    }
    int sum = B[0];

    for(i = 1; i < N - 1; i ++){
        sum += min(B[i - 1], B[i]);
    }
    sum += B[N - 2];

    printf("%d\n", sum);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define all(a) a.begin(), a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<long long>
#define sz(x) (int)x.size()
#define pi pair<long long, long long>
#define endl '\n'
#define _ << ' '
#define min3(a, b, c) min(a, min(b, c))
#define min4(a, b, c, d) min(min(a, d), min(b, c))
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> idxset;
//find_by_order(i) : iterator to the value at index i, order_of_key(x) : the index of value x
const ll mod = (ll)1e9+7;
const ll INF = (ll)1e18+1;
const ll N = 2e5;

map<int, int> mp;
int n, x, ans=0;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    #ifndef ONLINE_JUDGE
    //freopen("B.txt", "r", stdin);
    #endif
    int n;
    cin >> n;
    for(int i=0; i<n; i++)
    {
        cin >> x;
        mp[x]++;
    }
    for(auto p : mp)
    {
        if(p.S<p.F)
            ans += p.S;
        else ans += p.S-p.F;
    }
    cout << ans;
}


Measured memory_bytes: 4736
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

class FenwickTree {
    public:
        FenwickTree(int n) : N(n), data(n, 0) {

        }

        void put(int x, int v) {
            for (; x < N; x |= x + 1) {
                data[x] += v;
            }
        }

        int get(int x) {
            int res = 0;
            for (; x >= 0; x = (x & (x + 1)) - 1) {
                res += data[x];
            }
            return res;
        }

        int get(int l, int r) {
            if (l > r) {
                return 0;
            }
            return get(r) - get(l - 1);
        }

    private:
        int N;
        vector<int> data;
};


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    string S;
    cin >> S;

    int n = S.length();
    vector<deque<int>> pos(26);

    for (int i = 0; i < n; ++i) {
        pos[S[i] - 'a'].push_back(i);
    }

    int odds = 0;
    for (auto& V : pos) {
        if (V.size() % 2 == 1) {
            ++odds;
        }
    }

    if (odds > 1) {
        cout << -1 << '\n';
        return 0;
    }


    FenwickTree ft((n + 1) * 3);
    int offset = n;
    for (int i = 0; i < n; ++i) {
        ft.put(i + offset, 1);
    }

    long long res = 0;
    for (int l = 0, r = n - 1; l < r; ++l, --r) {
        pair<int, int> best{1 << 29, -1};

        for (int i = 0; i < 26; ++i) {
            if (pos[i].size() >= 2) {
                int ll = pos[i].front();
                int rr = pos[i].back();

                ll += offset;
                rr += offset;

                int cnt = ft.get(l, ll - 1);
                cnt += ft.get(rr + 1, r + n + offset);
                best = min(best, make_pair(cnt, i));
            }
        }
        assert(best.second >= 0);

        {
            res += best.first;
            int x = best.second;
            int ll = pos[x].front();
            int rr = pos[x].back();

            ll += offset;
            rr += offset;
            ft.put(ll, -1);
            ft.put(rr, -1);


            pos[x].pop_front();
            pos[x].pop_back();
        }
    }

    cout << res << '\n';

    return 0;
}

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

use std::cmp::*;
use std::collections::*;

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

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

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
    ($iter:expr, mut $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")
    };
}

macro_rules! chmax {
    ($x:expr, $e:expr) => {
        if $x < $e {
            $x = $e;
        }
    };
}
macro_rules! chmin {
    ($x:expr, $e:expr) => {
        if $x > $e {
            $x = $e;
        }
    };
}

const INF: i64 = 1 << 60;

fn gcd(n: usize, m: usize) -> usize {
    match (n, m) {
        (n, 0) => n,
        (n, m) => gcd(m, n % m),
    }
}

fn lcm(n: usize, m: usize) -> usize {
    n * m / gcd(n, m)
}

fn main() {
    input!{
        N: usize,
        mut M: usize,
        mut a: [usize; N],
    }
    let mut t = 0;
    let mut minx = 1;
    for i in 0..N {
        let mut s = 0;
        a[i] /= 2;
        while a[i] % 2 == 0 {
            a[i] /= 2;
            s += 1;
        }
        if i != 0 {
            if t != s {
                println!("0");
                return;
            }
        }
        minx = lcm(minx, a[i]);
        if minx > M {
            println!("0");
            return;
        }
        t = s;
    }
    while t != 0 {
        M /= 2;
        t -= 1;
    }
    println!("{}", (M + minx) / (minx * 2));
}


Measured memory_bytes: 6396
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A = Integer.parseInt(sc.next());
    int B = Integer.parseInt(sc.next());
    int K = Integer.parseInt(sc.next());

    if((B - A) / 2.0 >= K){
      for(int i = 0; i < K; i++){
        System.out.println(A + i);
      }
      for(int i = 0; i < K; i++){
        System.out.println(B - K + i + 1);
      }
    }else{
      for(int i = 0; i < B - A + 1; i++){
        System.out.println(A + i);
      }
    }
  }
}


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

int n;
vector<string> A;

void f(int digitNum, string s, int lim){
    bool a = false, b = false, c = false;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == '3') a = true;
        if(s[i] == '5') b = true;
        if(s[i] == '7') c = true;
    }
    if(a && b && c){
        A.push_back(s);
    }
    if(digitNum == lim){
        return;
    }
    f(digitNum + 1, s + '3', lim);
    f(digitNum + 1, s + '5', lim);
    f(digitNum + 1, s + '7', lim);
    return;
}

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

    cin >> n;

    int lim = to_string(n).length();

    if(lim < 3){
        cout << 0 << endl;
        return 0;
    }

    f(0, "", lim);

    vector<int> B;
    for(auto &x : A){
        B.push_back(stoi(x));
    }

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

    //int idx = lower_bound(B.begin(), B.end(), n) - B.begin();

    //cout << idx << endl;

    int ans = 0;
    for(auto &x : B){
        if(x <= n){
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

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

lst = []
for i in range(n):
    A = int(input())
    xy = []
    for j in range(A):
        xy.append(list(map(int, input().split())))
    lst.append(xy)


for i in reversed(range(2**n)):
    bi = format(i, 'b').zfill(n)
    flag = True
    for j, data in enumerate(lst):
        if bi[j] == '0':
            continue
        for x, y in data:
            if int(bi[x - 1]) != y:
                flag = False
                break
        
        if not flag:
            break

    if flag:
        break

if flag:
    print(bi.count('1'))
else:
    print(0)

Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>
int main()
{
	char str[102];
	long long k;
	scanf("%s %lld",str,&k);
	char c=str[0];
	int len=strlen(str);
	long long t=0;
	int pre=0;
	int jian=0;
	for(int i=0;i<len-1;i++)
	if(str[i]!=str[i+1]) jian++;
	if(jian){
	
	for(int i=1;i<=len;i++)
	{	
		
		if(str[i]==str[i-1]) pre++;
		else {
			pre++;
			pre/2==0?pre:pre-1;
			t=t+pre/2;
			pre=0;
		}
	}
	if(str[len-1]!=str[0]) t=t*k;
	else{
		int x=0,y=0;
		for(int i=0;str[i]==str[0];i++)
		x++;
		for(int j=len-1;str[len-1]==str[j];j--)
		y++;
		if(x%2!=0&&y%2!=0) t=t*k+k-1;
		else t=t*k;
	}
}
else {
	t=len*k;
	if(t%2==0) t=t/2;
	else t=(t-1)/2;
}
	printf("%lld",t);
	return 0;
	
}

Measured memory_bytes: 128
//#pragma comment(linker, "/STACK:1024000000,1024000000")
/* vim: set fdm=marker */
//{{{
#define __ return
int ATTENTION() {
	/* pls IGNORE this function and go down and HACK me
	 * read this AFTER contest
	 * this function is empty and it will not be called !
	 */

	http://codeforces.com/group/Pmz2A2x7ES
	/* I created a group there.
	 * I hope with the group, people can finish
	 * past contests, which is important for 
	 * increasing rating.
	 * I am still getting familiar with this function.
	 */
	 __ 0;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int iinf = 0x7fffffff;
const ll linf = ~(1LL<<63);
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef map<ll, int> mli;
typedef map<ll, ll> mll;
template<typename T>
inline T gcd(T a, T b) {
	if(a < 0) return gcd(-a, b);
	if(b < 0) return gcd( a,-b);
	if(a < b) return gcd(b, a);
	if(b == 0) return a;
	return gcd(b, a%b);
}

ll qpow(ll a, ll n, ll mod) {
	a %= mod;
	ll ans = 1LL;
	while(n) {
		if(n & 1) ans = (ans*a % mod);
		a = (a*a % mod);
		n >>= 1;
	}
	return ans;
}

inline ll rev(ll a, ll p) {
	return qpow(a, p - 2, p);
}

#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define rep(x, st, en) for(int x = st; x < en; x++)
#define rer(x, st, en) for(int x = st; x >= en; x--)
#define pb push_back
#define mp make_pair
#define dbgm(msg, var) cerr<<#msg<<" "<<#var<<" = "<<var<<endl; 
#define dbg(var) cerr<<#var<<" = "<<var<<endl;
#define X first
#define Y second
// build prefix sum
template<typename T>
inline void BPS(T* DST, T* SRC, int N, int s = 0) {
	DST[s] = SRC[s];
	rep(i, 1, N) DST[s + i] = DST[s + i - 1] + SRC[s + i];
}
inline int in() { int x; cin>>x; return x; }
#ifdef ALNDBG
namespace alndbg {
	clock_t s, e;
}
#endif

inline void tic() {
#ifdef ALNDBG
	alndbg::s = clock();
#endif
}

inline void toc() {
#ifdef ALNDBG
	alndbg::e = clock();
	cerr<<1000.0 * (alndbg::e - alndbg::s) / CLOCKS_PER_SEC<<" ms"<<endl;
#endif
}



//}}}

// -------------------- Spliters ------------------------
// BFS求最短路小心vis可能访问过
const int maxn = 2222;

int a[3] = {1, 5, 10};

int main() {
	ios::sync_with_stdio(0);
  int n,y; cin>>n>>y; y/=1000;
  rep(i, 0, 2001) {
    rep(j, 0, 2001) {
      int k = n - i - j;
      
      if(k < 0 or i + j * 5 + k * 10 != y) continue;
      else {
        cout<<k<<" "<<j<<" "<<i;
        return 0;
      }
    }
  }
  cout<<"-1 -1 -1";
	return 0;
}
// --USE C++11
// *-USE O2


Measured memory_bytes: 256
while(True):
    n = input()
    if n=="0":
        break
    elif (int)(n)>50000:
        continue
    hairetu = input()

    tarou = hairetu.split(" ")
    avg=0

    for i in range(0,(int)(n)):
        avg=avg+(int)(tarou[i])
    avg=avg/(int)(n)

    cdnt=0
    for j in range(0,(int)(n)):
        if (int)(tarou[j]) <= (int)(avg):
            cdnt=cdnt+1 
    print(cdnt)



Measured memory_bytes: 6360
import Control.Applicative
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as B
import Data.List
import Data.Char (isSpace)

main :: IO ()
main = solve <$> f <*> f >>= print
  where
    f = readil B.readInt <$> B.getLine

solve :: [Int] -> [Int] -> Int
solve [n, m] as = maximum $ (head as - 1) : (n - last as) : map (flip div 2) (zipWith (-) (tail as) as)

readil :: Integral a =>  (ByteString -> Maybe (a, ByteString)) -> ByteString -> [a]
readil f = unfoldr g
  where
    g s = do
      (n, s') <- f s
      return (n, B.dropWhile isSpace s')



Measured memory_bytes: 13296
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <complex>

#define forin(i, f, t) for(auto i = f; i < t; i++)

using namespace std;
using ll = long long;

int main() {
    ll a, b;
    cin >> a >> b;
    
    if (a + b == 15)
        cout << '+';
    else if (a * b == 15)
        cout << '*';
    else
        cout << 'x';

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#define MAXN 100005
using namespace std;

int n, h[MAXN], dp[MAXN];

int main() {
	cin >> n;
	for (int i=1; i<=n; i++) {
		cin >> h[i];
	}
	dp[1] = 0; dp[2] = fabs(h[2] - h[1]); dp[3] = fabs(h[3] - h[1]);
	for (int i=4; i<=n; i++) {
		dp[i] = min(dp[i - 1] + fabs(h[i] - h[i - 1]), dp[i - 2] + fabs(h[i] - h[i - 2]));
	}
	cout << dp[n] << "\n";
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
map<int, int> mp;
int main(){
	int n;
	cin >> n;
	while(n--){
		int x;
		cin >> x;
		mp[x]++;
	}
	vector<pair<int, int> >m;
	for(auto &x : mp){
		m.push_back({x.first, x.second});
	}
	reverse(m.begin(), m.end());
	int mx = -1;
	for(auto x : m){
		if(x.second >= 2){
			if(mx == -1) mx = x.first;
			else return 0 * printf("%lld\n", 1ll * mx * x.first);
		}
		if(x.second >= 4){
			if(mx == -1) mx = x.first;
			else return 0 * printf("%lld\n", 1ll * mx * x.first);
		}
	}
	return 0 * puts("0");
}

Measured memory_bytes: 6136
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string a;
    cin>>a;
    int ans=0;
    for(int i=0;i<a.size();i++)
	{
        if(a[i]=='C')
		{
            ans=1;
        }
        if(a[i]=='F'&&ans==1)
		{
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define abs(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))
#define EPS 1e-5

int main(void)
{
    int q;

    while (scanf("%d", &q), ~q){
        double x = q / 2.0;
        while (EPS * q < abs(x * x * x, q)){
            x = x - (x * x * x - q) / (3 * x * x);
        }
        printf("%.6f\n", x);
    }

    return 0;
}

Measured memory_bytes: 636
#include <bits/stdc++.h>
#define FOR(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define FORUL(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#define FORULE(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define FOREACH(it, X) for(__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#if defined(_MSC_VER) || __cplusplus > 199711L
#define AUTOVAR(newvar,v) auto newvar = (v)
#else
#define AUTOVAR(newvar,v) __typeof(newvar) r = (v)
#endif
#define PB(x) push_back(x)
#define MP(x,y) make_pair((x),(y))
#define MEMSET(m,v) memset(m,v,sizeof(m))
 
typedef long long				 ll;
typedef unsigned long long		ull;
 
#define DEBUG 1
 
#if DEBUG
#define DOUT cout<<"["<<__LINE__<<"]:"
#else
#define DOUT 0 && cout
#endif
 
using namespace std;
 
#define MAX_N (1000*100+5)
 
int N;
// int N;
// int A[MAX_N];
 
pair<int,int> A[MAX_N];
pair<int,int> B[MAX_N];
// pair<int,int> Ap[MAX_N];
int G[MAX_N];
 
bool visited[MAX_N];
 
int main(int argc, char *argv[])
{
	ios::sync_with_stdio(false);
	string S;
	cin>>N;
	// visited.resize(N);
	// cout<<N<<endl;
	FOR(n,N){cin>>A[n].first; A[n].second=n;}
	FOR(n,N){cin>>B[n].first; B[n].second=n;}
	sort(&A[0],&A[N]);
	sort(&B[0],&B[N]);
	FOR(n,N) {
		if(A[n].first>B[n].first) { cout << "No" << endl; return 0; }
		G[A[n].second] = B[n].second;
	}
 
	int cc=0;
	FOR(n,N) {
		if(visited[n]) {
			continue;
		}
		cc++;
		int i=n;
		while(!visited[G[i]]) {
			visited[G[i]]=true;
			i=G[i];
		}
	}
 
	if(cc>1) {
		cout <<"Yes"<<endl;
		return 0;
	}
 
	FOR(n,N-1) {
		if(A[n+1].first<=B[n].first) {
			cout << "Yes"<<endl;
			return 0;
		}
	}
 
	cout<<"No"<<endl;
 
	return 0;
}


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

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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> tiii;

const int INF=1<<30;
const ll LINF = 1e18+5;

int main() {
    int X;
    cin >> X;
    int MAX_N = X / 100;
    X = X % 100;
    int money = 5;
    int used = 0;
    if (X > MAX_N * 5){
        cout << 0 << endl;
        return 0;
    } else {
        cout << 1 << endl;
        return 0;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    int N, w[200001], b[200001];
    string S;
    cin >> N >> S;
    int cnt = 0;
    w[0] = 0;
    REP(i, S.size()) {
        if (S[i] == '#') cnt++;
        w[i + 1] = cnt;
    }
    cnt = 0;
    b[S.size()] = 0;
    RREP(i, S.size()) {
        if (S[i] == '.') cnt++;
        b[i] = cnt;
    }
    int ans = w[0] + b[0]; 
    REP(i, S.size() + 1) {
        ans = min(ans, w[i] + b[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2180
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>
 
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("Yes\n")
#define NO() printf("No\n")
 
using namespace std;
 
#define int long long
//typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;
 
const int INF=1e+9;
const double EPS=1e-9;
const int MOD=1000000007;
 
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
 
signed main(){
	int a,b,c;
	cin >> a >> b >> c;
	if(a <= c && c <= b) YES();
	else NO();
	return 0;
}

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

using i64 = int64_t;

i64 compute_num_digits(i64 x){
    i64 res = 0;
    while(x > 0){
        res++;
        x /= 10;
    }
    return res;
}

i64 compute_num_chars(i64 x){
    i64 base = 1, res = 0;
    while(base*10 < x){
        i64 d = compute_num_digits(base);
        res += (base*10 - base) * d;
        res -= ((base*10-1)/3 - (base-1)/3) * d;
        res -= ((base*10-1)/5 - (base-1)/5) * d;
        res += ((base*10-1)/15 - (base-1)/15) * d;
        base *= 10;
    }
    i64 d = compute_num_digits(base);
    res += (x - base + 1) * d;
    res -= (x/3 - (base-1)/3) * d;
    res -= (x/5 - (base-1)/5) * d;
    res += (x/15 - (base-1)/15) * d;
    res += (x/3) * 4;
    res += (x/5) * 4;
    return res;
}

int main(){
    i64 s;
    cin >> s;
    //cout << compute_num_chars(s) << endl;
    i64 valid = 0, invalid = 100000000000000000;
    while(invalid - valid > 1){
        i64 mid = (invalid + valid) / 2;
        if(compute_num_chars(mid) < s)valid = mid;
        else invalid = mid;
    }
    string ans = "";
    i64 d = compute_num_chars(valid);
    valid++;
    while(ans.size() < s-d+20){
        if(valid % 15 == 0)ans += "FizzBuzz";
        else if(valid % 3 == 0)ans += "Fizz";
        else if(valid % 5 == 0)ans += "Buzz";
        else ans += to_string(valid);
        valid++;
    }

    for(int i=s-d-1;i<s-d+19;++i)cout << ans[i];
    cout << endl;

    return 0;
}


Measured memory_bytes: 3288
#include <iostream>
#include <string>
#include <set>

using namespace std;

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

int main(){
    set<string> ids;
    int n; cin>>n;
    rep(i,n){
        string id; cin >> id;
        ids.insert(id);
    }
    int m; cin >> m;
    bool open = true;
    string s[2]={"Opened by ","Closed by "};

    rep(i,m){
        string id; cin >> id;
        auto it=ids.find(id);
        if(it!=ids.end()){
            cout << s[open=1-open] << *it << endl;
        } else {
            cout << "Unknown " << id << endl;
        }
    }
}

Measured memory_bytes: 1236
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef queue<P> Q;

#define _CRT_SECURE_NO_WARNINGS

int N = 0;
int a[101];
int main() {
	scanf("%d",&N);
	int t;
	int ans = 0; bool f = false;
	for (int i = 0; i < N;i++) {
		scanf("%d",a+i);
		if (a[i]==t && !f) {
			ans++;
			f = true;
		}
		else {
			f=false;
		}
		t = a[i];
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main(){
	for (int i = 0; i < 100; i++){
		int m, r, f;
		cin >> m >> r >> f;
		if (m < 0 && r < 0 && f < 0){
			break;
		}
		else if(m<0|r<0|m+r<30){
			cout << "F" << endl;
		}
		else if (m + r < 50){
			if (f>49){
				cout << "C" << endl;
			}
			else{ cout << "D" << endl; }
		}
		else if (m + r < 65){
			cout << "C" << endl;
		}
		else if (m + r < 80){
			cout << "B" << endl;
		}
		else{
			cout << "A" << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3084
/**Bismillahir Rahmanir Rahim.**/
#include<bits/stdc++.h>
#define ln '\n'
#define D(x) cout<< #x " = "<<x<<endl
#define foreach(i,c) for(__typeof(c.begin())i=c.begin();i!=c.end();i++)

#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define _case cout<<"Case "<<++cs<<": "

#define MOD 1000000007
#define countv(v,a) count(v.begin(),v.end(),a)
#define grtsrt(v) sort(v.begin(),v.end(),greater<int>())
#define mnv(v) *min_element(v.begin(),v.end())
#define mxv(v) *max_element(v.begin(),v.end())
#define uniq(v) v.resize( unique(all(v)) - v.begin())

#define PI acos(-1)
#define ll long long int
#define ull unsigned long long

#define vi vector <int>
#define vll vector <ll>
#define vs vector <string>
#define pb push_back
#define mpii map <int,int>
#define mpsi map <string,int>
#define mpll map <long long,long long>
#define MP make_pair
#define F first
#define S second

#define GCD(a,b) __gcd(a,b)
#define LCM(a,b) (a*(b/__gcd(a,b)))

#define rev(v) reverse(v.begin(),v.end())
#define srt(v) sort(v.begin(),v.end())

#define all(v) v.begin(),v.end()
#define MEM(a, b) memset(a, b, sizeof(a))

#define fast ios_base::sync_with_stdio(false)
using namespace std;

const ll INF = 0x3f3f3f3f3f3f3f3f;
const long double EPS = 1e-9;
const int inf = 0x3f3f3f3f;
/// count set bit C = (num * 0x200040008001ULL & 0x111111111111111ULL) % 0xf; /// 32 bit integer

/*------------------------------Graph Moves----------------------------*/
//Rotation: S -> E -> N -> W
//const int fx[] = {0, +1, 0, -1};
//const int fy[] = {-1, 0, +1, 0};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/

//Bit Operations
inline bool checkBit(ll n, int i) { return n&(1LL<<i); }
inline ll setBit(ll n, int i) { return n|(1LL<<i); }
inline ll resetBit(ll n, int i) { return n&(~(1LL<<i)); }


inline bool isSquare(ll x)  { ll s = sqrt(x); return (s*s==x); }
inline bool isFib(ll x) { return isSquare(5*x*x+4)|| isSquare(5*x*x-4); }
inline bool isPowerOfTwo(ll x)   { return ((1LL<<(ll)log2(x))==x); }

typedef struct {
    double x,y;
   /// Point() {}
  ///  Point(double x,double y) : x(x), y(y) {}
} Point;

double distance(Point a , Point b) {
    return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}

string s,s1;
ll n,m,a,b,i,j,d,t,cs=0,counT=0,k,ans=0,l=0,sum1=0,sum=0,Max,Min,num;
ll arr[10000000];
vector<ll>vc;
map<ll,ll>mp;

int main()
{
  //  fast;
    cin >> s ;
    f0(i,s.size()-1)
    {
        if(s[i] == s[i+1])
        {
            return cout << i+1 << " " << i+2 << ln,0 ;

        }
    }

f0(i,s.size()-2)
    {
        if(s[i] == s[i+2])
        {
            return cout << i+1 << " " << i+3 << ln,0 ;

        }
    }

cout << "-1" << " -1" << ln ;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define meow(args...) fprintf(stderr, args)
typedef unsigned u32;
typedef long long s64;
typedef unsigned long long u64;
template<class T1, class T2> inline bool cmin(T1 &a, const T2 &b) {return b<a?(a=b, true):false;}
template<class T1, class T2> inline bool cmax(T1 &a, const T2 &b) {return a<b?(a=b, true):false;}
const int N=1e7+5;
char s[N], t[N];
int mem[2*N], *cnt=mem+N;
int main() {
	int n, x, y=0, k=0;
	long long ans=0;
	assert(scanf("%d%s%s", &n, s, t)==3);
	x=(s[0]!=t[0]);
	for(int i=0; i<n; ++i) {
		++cnt[x-y];
		k+=(x>=y);
		ans+=x>y?x-y:y-x;
		x+=s[i+1]!=s[i];
		y+=t[i+1]!=t[i];
	}
	if(2*k-n+cnt[-1]<0)
		for(int i=-1, d; (d=4*k-2*n+2*cnt[i])<0; i-=2) ans+=d, k+=cnt[i]+cnt[i-1];
	else
		for(int i=0, d; (d=2*n-4*k+4*cnt[i]+2*cnt[i+1])<0; i+=2) ans+=d, k-=cnt[i]+cnt[i+1];
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 6400
/*
    Author: Alam Khan
    AUST CSE 40th Batch

*/

#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;

typedef long long ll;
typedef tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
#define pb     push_back
#define inf     2e18
#define low     -2e18
#define PI        acos(-1.0)
#define endl  "\n"
#define FAST  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fr freopen("input.txt","r",stdin)
#define fw freopen("output.txt","w",stdout)
const int sz = 1e5+9;

int main()
{
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
    ll i,n,t,k,j,x=0,y=0,m;
    cin>>n>>m>>k;
    if(n+m>=k)
    {
    	cout<<"No"<<endl;
    	return 0;
    }
    k-= n+m;
    if(4*n*m>=k*k)
    {
    	cout<<"No"<<endl;
    }
    else
    {
    	cout<<"Yes"<<endl;
    }

    
    return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using ll = long long;
using namespace std;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){
    int N;
    cin >> N;
    vector<int> a(N+1),b(N+1);
    rep1(i,N) cin >> a[i];
    
    int j = 1, ct = 0;
    while(1){
        if(j == 2){ cout<<ct<<endl; break;}
        if(b[j] != 0){ cout<<-1<<endl; break;}
        b[j]++;
        j = a[j];
        ct++;
    }

}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
#include<set>
#include<map>
using namespace std;
#define rep(i,n) for(int i=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int i=(m);(i)<(n);(i)++)
typedef long long ll;

int main(){
    int h,w,d;
    cin >> h >> w >> d;
    int px[90010]={},py[90010]={},dis[90010]={};
    FOR(i,1,h+1){
        FOR(j,1,w+1){
            int a;
            cin >> a;
            py[a]=i,px[a]=j;
        }
    }
    for(int i=d+1;i<=h*w;i++){
        dis[i]=dis[i-d]+abs(py[i]-py[i-d])+abs(px[i]-px[i-d]);
    }
    int q;
    cin >> q;
    rep(i,q){
        int l,r;
        cin >> l >> r;
        cout << dis[r]-dis[l] <<endl;
    }
    return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
long long MOD;
template <typename T>
struct rerooting{
	vector<T> dp1;
	vector<T> dp2;
	T E;
	function<T(T, T)> add;
	function<T(T)> root;
	void dfs1(vector<vector<int>> &c, int v){
		dp1[v] = E;
		for (auto w : c[v]){
			dfs1(c, w);
			dp1[v] = add(dp1[v], root(dp1[w]));
		}
	}
	void dfs2(vector<vector<int>> &c, int v){
		int deg = c[v].size();
		vector<T> L(deg + 1, E);
		for (int i = 0; i < deg; i++){
			L[i + 1] = add(L[i], root(dp1[c[v][i]]));
		}
		vector<T> R(deg + 1, E);
		for (int i = deg - 1; i >= 0; i--){
			R[i] = add(R[i + 1], root(dp1[c[v][i]]));
		}
		for (int i = 0; i < deg; i++){
			dp2[c[v][i]] = root(add(dp2[v], add(L[i], R[i + 1])));
			dfs2(c, c[v][i]);
		}
	}
	rerooting(vector<vector<int>> &c, function<T(T, T)> add, function<T(T)> root, T E): add(add), root(root), E(E){
		int N = c.size();
		dp1 = vector<T>(N, E);
		dfs1(c, 0);
		dp2 = vector<T>(N, E);
		dfs2(c, 0);
	}
	T operator [](int k){
		return add(dp1[k], dp2[k]);
	}
};
long long add(long long a, long long b){
  return a * b % MOD;
}
long long root(long long a){
  return (a + 1) % MOD;
}
vector<vector<int>> child(vector<vector<int>> E, int r){
	int N = E.size();
	vector<vector<int>> c(N);
	queue<int> Q;
	Q.push(r);
	while (!Q.empty()){
		int v = Q.front();
		Q.pop();
		for (int w : E[v]){
			if (c[w].empty()){
				c[v].push_back(w);
				Q.push(w);
			}
		}
	}
	return c;
}
int main(){
  int N;
  cin >> N >> MOD;
  vector<vector<int>> E(N);
  for (int i = 0; i < N - 1; i++){
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    E[x].push_back(y);
    E[y].push_back(x);
  }
  vector<vector<int>> c = child(E, 0);
  rerooting<long long> ans(c, add, root, (long long) 1);
  for (int i = 0; i < N; i++){
    cout << ans[i] << endl;
  }
}

Measured memory_bytes: 34812
def main():
    N = int(input())

    def count(x):
        ret = 0
        while x % 2 == 0:
            x //= 2
            ret += 1
        return ret

    ret = max(range(1, N + 1), key=count)
    print(ret)


if __name__ == '__main__':
    main()


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

using namespace std;

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

	int n;
	cin >> n;
	vector<int> a(n), b(n), c(n - 1);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	for (int i = 0; i < n; ++i) {
		cin >> b[i];
	}
	for (int i = 0; i < n - 1; ++i) {
		cin >> c[i];
	}
	int ans = 0;
	for (int i = 0; i < n; ++i) {
		ans += b[a[i] - 1];
		if (i + 1 < n and a[i + 1] - 1 == a[i]) {
			ans += c[a[i] - 1];
		}
	}
	cout << ans;

	return 0;
}

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



int main() {
	int N,m;
	cin >> N;
	vector<int> vec(N);
	rep(i, N) {
		cin >> m;
		vec.at(m - 1) = i + 1;
	}
	rep(i, N) {
		cout << vec.at(i) << " ";
	}
}

Measured memory_bytes: 3692
N, T = map(int, input().split())
A = list(map(int, input().split()))

mi = 10**18
miCnt = 1
S = []
for i, a in enumerate(A):
    S.append((a - mi, i, miCnt))
    if a == mi:
        miCnt += 1
    mi = min(mi, a)

S.sort(reverse=True)
S = [c for v, i, c in S if v == S[0][0]]
ans = min(len(S), sum(S))
print(ans)


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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 h,w,n;
    cin >> h >> w >> n;
    int32 x = max(h,w);
    cout << (n + x - 1) / x << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

int main(){
    int n, k;
    string s;
    cin >> n;
    cin >> s;
    cin >> k;

    char c = s[k-1];

    for(int i=0; i<n; i++){
        if(s[i] != c) s[i] = '*';
    }

    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
//程序名:新的C++程序
//作者: 

#include<iostream>
using namespace std;
int a[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int main()
{
	int b,c;
    cin>>b>>c;
	if(a[b-1]==a[c-1]) cout<<"Yes";
	else cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <iomanip>
using namespace std;
 
#define LOCAL  1
#define UPLOAD 2
 
#define ll long long
const long long INF = 1LL << 60;
 
template <class T = long long> T input(){T x;cin >> x;return x;}
template <class T> void output(T x){cout << x << endl;}
#define debug(x) cerr << #x<< ": " << x<< '\n';
#define debugBit(x,n) cerr << #x<< ": " << std::bitset<n>(x) << '\n';
 
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
 
int main()
{
#if ENVIRONMENT == LOCAL
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
 
  ll H = input();
  ll W = input();

  if(H == 1 || W == 1){
    output(1);
  }
  else{
    output((ll)ceil((double)H/2*W));
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[105];
int main(){
    int n;
    scanf("%d", &n);
    int sum = 0;
    for(int i=1;i<=n;i++) scanf("%d", &a[i]), sum += a[i];
    int sum2 = 0, ans = 1e9;
    for(int i=1;i<n;i++){
        sum2 += a[i];
        sum -= a[i];
        ans = min(ans, abs(sum-sum2));
    }
    printf("%d\n", ans);
}

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


const int MAXN = 1e5 + 10;
vector<int> g[MAXN];
bool vis[MAXN] = {0};
bool inst[MAXN] = {0};
vector<pair<int, int>> ans;

bool dfs(int u, int p = -1) {
  vis[u] = 1;
  inst[u] = 1;
  int outdeg = 0;
  for (int v : g[u]) if (v != p) {
    if (not vis[v]) {
      if (dfs(v, u)) ++outdeg, ans.emplace_back(u, v);
    }
    else if (inst[v]) ++outdeg, ans.emplace_back(u, v);
  }
  if (outdeg&1) ans.emplace_back(u, p);
  inst[u] = 0;
  return outdeg % 2 == 0;
}

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  int n, m; cin >> n >> m;
  if (m % 2) cout << -1 << '\n', exit(0);
  for (int i = 0; i < m; ++i) {
    int u, v; cin >> u >> v;
    --u, --v;
    g[u].push_back(v), g[v].push_back(u);
  }
  assert(dfs(0));
  sort(ans.begin(), ans.end());
  for (auto P : ans) cout << P.first + 1 << ' ' << P.second + 1 << '\n';
}



Measured memory_bytes: 14196
#include <bits/stdc++.h>
using namespace std;
using ll=long long;using ull=unsigned ll;
using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;
using P=pair<int,int>;using PL=pair<ll,ll>;
const int INF=1<<30,MOD=1000000007;const ll LINF=1ll<<60;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...) _overload3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n) for(int i=n-1;i>=0;--i)
#define REPARR(i,v) for(int i=0;i<v.size();++i)
#define all(v) (v).begin(),(v).end()
#define uniq(v) sort(all(v));v.erase(unique(all(v)),v.end())
#define bit(n) (1ll<<(n))
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(a>b){a=b;return 1;}return 0;}
#define cut(n, Min, Max) max(min(n,Max),Min)
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"":"im")<<"possible"<<endl
#define Poss(n) cout<<((n)?"P":"Imp")<<"ossible"<<endl
template<typename T>ostream&operator<<(ostream&o,const vector<T>&v){for(T i:v)o<<i<<' ';return o;}
template<typename T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<typename T>ostream&operator<<(ostream&o,const set<T>&v){for(T i:v)o<<i<<' ';return o;}
template<typename T,typename U>ostream&operator<<(ostream&o,const pair<T,U>&v){o<<v.first<<' '<<v.second;return o;}

int main(){
    int a,b;
    cin>>a>>b;
    if(b%a){
        cout<<b-a<<endl;
    }else{
        cout<<b+a<<endl;
    }
    return 0;
}

Measured memory_bytes: 764
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,m=0,z,c=0;
    cin>>a>>b;
    z=b;
        for(int i=1;i<b;i++)
        {
            if(a*i>=b)
            {
                z=a*i;
                if(z-i+1>=b)
                {
                    cout<<i;
                    return 0;
                }
            }
        }
        cout<<m;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1e9 + 7
#define PI 3.141592653589793238
#define pb push_back
#define ALL(V) (V).begin(), (V).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long long int lint;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<int> VI;
ll gcd(ll a, ll b) { return (a % b == 0 ? b : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll char_to_ll(char c) { return (int)(c - '0'); }

ll move(ll N, ll A, ll B){
    ll count = 0;
    while(A != B){
        if((B - A) % 2 == 0){
            count += (B - A) / 2;
            break;
        }else{
            if(A - 1 < N - B){
                if(A > 1){
                    B -= A - 1;
                    count += A - 1;
                    A = 1;
                }else{
                    B--;
                    count++;
                }
            }else{
                if(B < N){
                    A += N - B;
                    count += N - B;
                    B = N;
                }else{
                    A++;
                    count++;
                }
            }
        }
        //cout << A << " " << B << endl;
    }

    return count;
}

int main(){
    ll N, A, B;
    cin >> N >> A >> B;

    ll ans = move(N, A, B);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cassert>
#include <cmath>
#include <iomanip>
//#define NDEBUG
int main(void){
    using namespace std;
    static const double INPUT_A_MAX = pow(10,9.0);
    static const double INPUT_B_MAX = pow(10,9.0);
    static const double INPUT_A_MIN = 1;
    static const double INPUT_B_MIN = 1;
    int input_a = 0;	/* 入力値は整数 */
    int input_b = 0;	/* 入力値は整数 */
    int d = 0;
    int r = 0;
    double f = 0;
 
    cin >> input_a;
    cin >> input_b;
 
    /* 入力値の前提条件 */
    assert (INPUT_A_MIN <= static_cast<double>(input_a) && static_cast<double>(input_a) <= INPUT_A_MAX);
    assert (INPUT_B_MIN <= static_cast<double>(input_b) && static_cast<double>(input_b) <= INPUT_B_MAX);
 
    /* Calculation */
    d = input_a / input_b;          /* 割り算(整数) */
    r = input_a % input_b;          /* あまり(整数) */
    f = static_cast<double>(input_a) / static_cast<double>(input_b);	/* 割り算(浮動小数点数) */
 
    /* Output */
    cout << d << " " << r << " " << fixed << f << endl;
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> v(N);
  vector<int> c(N);
  for (int i = 0; i < N; i++) {
    cin >> v.at(i);
  }
  for (int i = 0; i < N; i++) {
    cin >> c.at(i);
  }
  int ans = 0;
  for (int bit = 0; bit < (1 << N); bit++) {
    int sum_v = 0;
    int sum_c = 0;
    for (int i = 0; i < N; i++) {
      if (bit & (1 << i)) {
        sum_c += c.at(i);
        sum_v += v.at(i);
      }
    }
    ans = max(sum_v - sum_c, ans);
  }
  cout << ans << endl;
}
        
        
    
  



Measured memory_bytes: 256
#include<iostream> 
#include<iomanip> 
#include<vector> 
#include<map> 
#include<set> 
#include<algorithm> 
#include<numeric> 
#include<limits> 
#include<bitset> 
#include<functional> 
#include<type_traits> 
#include<queue> 
#include<stack> 
#include<array> 
#include<random> 
#include<utility> 
#include<cstdlib> 
#include<ctime>
#define INT_MAX 2147483647
#define _LIBCPP_DEBUG 0
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (n); ++i)	
using namespace std;


int max(int a,int b) {
	int max;
	if (a > b) max = a;
	else max = b;
	return max;
}
int min(int a, int b) {
	int min;
	if (a < b) min = a;
	else min = b;
	return min;
}


int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) {
		cin >> a[i];
	}
	int max = a[0];
	int min = a[0];
	rep(i, n) {
		if (min > a[i]) {
			min = a[i];
		}
		else if (max < a[i]) {
			max = a[i];
		}
	}
	cout << abs(min - max) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <chrono>

using namespace std;

int main(int argc, const char * argv[]) {
     
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n; cin >> n;
    
    int p = 0;
    for (int i = 0; i < n; i++) {
        int a; cin >> a;
        p ^= a;
    }
    
    cout << (p ? "No" : "Yes") << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std; 
#define vll vector<long long>
#define mll map<long long,long long>
#define pb push_back
typedef  long long ll;
typedef long double ld;
long double pi=3.14159265358979323846;

vll al[500005];
ll vis[500005],color[500005],I[101][101];

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

bool isPrime(int n)
{
    if (n<=1) return false; 
    if (n<=3) return true; 
    if (n%2==0||n%3==0) return false; 
    for (int i=5;i*i<=n;i=i+6) if (n%i==0||n%(i+2)==0) return false; 
    return true; 
}

ll bpow(ll n, ll po)
{
	ll res=1;
	while(po>0)
	{
		if(po%2)
		{
			res*=n;
			po--;
		}
		else
		{
			n*=n;
			po/=2;
		}
	}
	return res;
}

ll binpow(ll n, ll po, ll mod)
{
	ll res=1;
	while(po>0)
	{
		if(po%2)
		{
			res=(res*n)%mod;
			po--;
		}
		else
		{
			n=(n*n)%mod;
			po/=2;
		}
	}
	return res;
}

ll swap(ll a, ll b)
{
	a=a+b;
	b=a-b;
	a=a-b;
}

ll fact(ll n) { 
   if ((n==0)||(n==1))
      return 1;
   else
      return n*fact(n-1);
}

ll C(ll n, ll r) {
    if(r > n - r) r = n - r; 
    ll ans = 1;
    ll i;

    for(i = 1; i <= r; i++) {
        ans *= n - r + i;
        ans /= i;
        ans=ans%1000000007;
    }

    return ans;
}

//bool bipartite_dfs(ll node, ll flag)
//{
//	vis[node]=1;
//	ll cflag=flag;
//	color[node]=cflag;
//	for(ll child : al[node])
//	{
//		if(!vis[child])
//		{
//			bool n=bipartite_dfs(child,1-cflag);
//			if(n==false) return false;
//		}
//		else if(color[child]==color[node]) return false;
//	}
//	return true;
//}

void mmul(ll A[][101], ll B[][101], ll dim)
{
	ll res[dim][dim];
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++)
	{
		res[i][j]=0;
		for(ll k=0;k<dim;k++) res[i][j]=(res[i][j]+A[i][k]*B[k][j])%1000000007;
	}
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++) A[i][j]=res[i][j];
}

void mpow(ll A[][101],ll dim, ll po)
{
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++)
	{
		if(i==j) I[i][j]=1;
		else I[i][j]=0;
	}
	while(po>0)
	{
		if(po%2==1)
		{
			mmul(I,A,dim);
			po--;
		}
		else
		{
			mmul(A,A,dim);
			po/=2;
		}
	}
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++) A[i][j]=I[i][j];
}


int main()
{
	string a,b;
	cin>>a>>b;
	ll flag=0;
	for(ll i=0;i<a.size();i++)
	{
		if(a[i]!=b[i]) flag=1;
	}
	if(flag) cout<<"No";
	else cout<<"Yes";
}

Measured memory_bytes: 15328
#include<bits/stdc++.h>
using namespace std;
int n,m,a;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		cin>>a;
		n-=a;
	}
	if(n<0) cout<<-1;
	else cout<<n;
	return 0;
} 

Measured memory_bytes: 3668
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
 
#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)
 
int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));
 
using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using namespace std;
 
int main() {
  ll A, B, C, K;
  cin >> A >> B >> C >> K;
  const ll answer = (K % 2 == 0) ? A - B : B - A;
  if (abs(answer) > 1'000'000'000'000'000'000ll) {
    cout << "Unfair" << endl;
  } else {
    cout << answer << endl;
  }
  return 0;
}

Measured memory_bytes: 3660