akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

const LL mod = 1e9+7;

void solve(int p, int q, vector<vector<int>> &V, vector<LL> &w, vector<LL> &b){
	w[q] = 1;
	b[q] = 1;
	for(auto u : V[q]) if(u != p){
		solve(q,u,V,w,b);
		(b[q] *= w[u]) %= mod;
		(w[q] *= (w[u]+b[u])) %= mod;
	}
}

int main(){
	int N; cin >> N;
	vector<vector<int>> V(N);
	repp(i,1,N){
		int x,y; cin >> x >> y;
		--x; --y;
		V[x].push_back(y);
		V[y].push_back(x);
	}
	vector<LL> w(N),b(N);
	solve(-1,0,V,w,b);
	cout << (w[0]+b[0])%mod << endl; 
	return 0;
}


Measured memory_bytes: 14208
//Relive your past life.
//Face your demons.
//The past is never dead,it is not even past.
//The memories are not only the key to the past but...also to the future.
//coded in Rusty Lake
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define ll   long long
#define pb   push_back
#define mp   make_pair
#define orz  1000000007
//作者:中国江苏南京丁天行
using namespace std;
bitset<4000005> b;
int n,a[2005],s;
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++)scanf("%d",a+i),s+=a[i];
    if(s&1)s=s/2+1;
    else s=s/2;
    b[0]=1;
    for(int i=1;i<=n;i++)b|=(b<<a[i]);
    for(int i=s;i<=s*2;i++){
        if(b[i]==1){
            printf("%d\n",i);
            return 0;
        }
    }
	//system("pause");
	return 0;
}


Measured memory_bytes: 1664
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <cstring>
#include <set>
#include <map>
#include <string>
#define pii pair<int,int>
#define fi first
#define se second
#define pcc pair<char,char>

using namespace std;

typedef long long ll;
char s[100][100];


int check(int r, int l){
        int ans = 0;
        for(int i = r-1; i <= r+1; ++i)
                for(int j = l-1; j <= l+1; ++j)
                        if(s[i][j] == '#') ans++;
        return ans;
}

int main(){
        int m, n; cin >> m >> n;
        for(int i = 1; i <= m; ++i) scanf("%s",s[i]+1);
        for(int i = 1; i <= m; ++i){
                for(int j = 1; j <= n; ++j)
                        if(s[i][j] == '#') putchar('#');
                        else printf("%d",check(i,j));
                puts("");
        }
        return 0;
}


Measured memory_bytes: 256
public class Main {

    static java.util.Scanner scan = new java.util.Scanner(System.in);

    public static int pow(int a){
        int b = 1;
        for(int i = 0; i < a;i++){
            b *= 10;
        }
        return b;
    }

    public static void main(String[] args) {

        String[] line = line().split(" ");
        String[] sliced_period = line[1].split("\\.");

        Long[] vars = new Long[]{Long.parseLong(line[0]),Long.parseLong(sliced_period[0]),Long.parseLong(sliced_period[1])};

        Long first = vars[0];
        Long second = (vars[1] * (pow(sliced_period[1].length())))+vars[2];
        Long calc = first * second;
        String parse = String.valueOf(calc).split("\\.")[0];

        if(parse.length() - sliced_period[1].length() <= 0){
            puts("0");
            return;
        }

        String floor = parse.substring(0,(parse.length())-sliced_period[1].length());
        puts(floor);

        scan.close();
    }

    public static String line(){
        return scan.nextLine();
    }

    public static int[] lineInts(){
        String l = line();
        String[] l1 = l.split(" ");
        int[] a = new int[l1.length];
        for(int i = 0; i < l1.length; i++){
            a[i] = Integer.parseInt(l1[i]);
        }
        return a;
    }

    public static int[] split_piriod_Ints(String[] a){
        String l = line();
        int[] b = new int[a.length];
        for(int i = 0; i < a.length; i++){
            b[i] = Integer.parseInt(a[i]);
        }
        return b;
    }

    public static long[] lineLongs(){
        String l = line();
        String[] l1 = l.split(" ");
        long[] a = new long[l1.length];
        for(int i = 0; i < l1.length; i++){
            a[i] = Long.parseLong(l1[i]);
        }
        return a;
    }

    public static void puts(Object a){
        System.out.println(a);
    }

    public static void puts(Object... a){
        for(int i = 0; i<a.length;i++){
            System.out.println(a[i]);
        }
    }
}


Measured memory_bytes: 35620
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstring>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

const int MAXN = 10010;

bool p[MAXN];

int main()
{
	p[0] = p[1] = 1;
	REP(MAXN)if(!p[i])for(int j = i*2;j<MAXN;j+=i)p[j] = 1;

	int n;
	while(cin >> n )
	{
		int ans = 0;
		for(int i = 1;i<=n;i++)ans += (!p[i] & !p[n + 1 - i]);

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

Measured memory_bytes: 0
while True:
	n, x = map(int, input().split())
	if n == 0 and x == 0:
		break

	ans = 0
	for i in range(1, n + 1):
		for j in range(i + 1, n + 1):
			a = x - (i + j)
			if j < a <= n:
				ans += 1
	print(ans)

Measured memory_bytes: 7668
import collections
n = int(input())
s = input()
c = collections.Counter(s)
raw = c['R'] * c['G'] * c['B']

for i in range(n):
    for j in range(i+1, n):
        if s[i] != s[j]:
            step = j - i
            k = j + step
            try:
                m = s[k]
            except:
                break
            if s[i] != m and s[j] != m:
                raw -= 1
print(raw)

Measured memory_bytes: 68900
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <limits>
using namespace std;
#define ll long long
#define ld long double
#define pii pair<int,int>
#define x first
#define y second
#define sf scanf
#define pf printf
#define vec vector
#define pb push_back
#define mp make_pair
#define sz(a) int(a.size())
#define all(a) a.begin(),a.end()
#define clr(a,b) memset(a,b,sizeof(a))
#define bin_cnt(x) __builtin_popcount(x)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define srep(sub,s) for(int sub=s&(s-1);sub;sub=(sub-1)&s)
#define irep(i,a) for(__typeof(a.begin()) i=a.begin();i!=a.end();i++)
#define irrep(i,a) for(__typeof(a.rbegin()) i=a.rbegin();i!=a.rend();i++)
#define inf numeric_limits<int>::max()
#define finf numeric_limits<double>::infinity()
#define eps 1e-8
#pragma GCC optimize ("O3")
#define o3 __attribute__((optimize("O3")))
#pragma comment(linker, "/STACK:32505856")

template<class T> inline T sqr(T a) {return a*a;}
template<class T> inline int gmin(T&a,T b) {if(a>b){a=b;return 1;}return 0;}
template<class T> inline int gmax(T&a,T b) {if(a<b){a=b;return 1;}return 0;}
inline int dcmp(const double &a) {return a>eps?1:(a<-eps?-1:0);}
struct Initializer{Initializer(){ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}}initializer;
char st[2000];

int main() {
//  freopen("in.txt","r",stdin);
//  freopen("out.txt","w",stdout);

  int h, w;
  sf("%d%d", &h, &w);
  rep(i, 1, h)
    rep(j, 1, w) {
      sf("%s", st);
      if ((string)st == "snuke") {
        pf("%c%d\n", j-1+'A', i);
//        return 0;
      }
    }
  return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::io::{BufWriter, Write};

// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn solve() {
    input!(
        n: usize,
        a: [usize; 5],
    );

    let mut a = a;

    a.sort();
    a.reverse();

    let t = (n + a[4] - 1) / a[4];

    println!("{}", t + 4);
}

fn main() {
    let stack_size = 1 << 28;
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 8572
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
char a[1000];
char b[1000];
char c[1000];
int main()
{
    int n;
    scanf("%d",&n);
    scanf("%s",a);
    if(n%2!=0)
    {
        printf("No\n");
        return 0;
    }
    int i,j;
    for(i=0,j=0;i<n/2;i++,j++)
    {
        b[j]=a[i];
    }
    for(i=n/2,j=0;i<n;i++,j++)
    {
        c[j]=a[i];
    }
    for(i=0;i<n/2;i++)
    {
        if(b[i]!=c[i])
        {
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
    return 0;
}


Measured memory_bytes: 256
class Fixnum
  def / (x)
    y = self.to_f.fdiv(x)
    if y < 0.0
      y = y.ceil
    else
      y = y.floor
    end
    y
  end
end


while n = gets do
  n.to_i.times do
    puts eval(gets.chomp.chop)
  end
end

Measured memory_bytes: 6148
#include <bits/stdc++.h>
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb push_back
#define endl '\n'
#define MOD 1000000007
#define MOD2 998244353

using namespace std;
typedef long long int ll;

int main(void)
{
	fast;
	#ifdef LOCAL
	freopen("in", "r", stdin);
	freopen("out", "w", stdout);
	#endif
	
	int n; cin >> n;
	vector<array<ll, 3>> a(n);
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i][1] >> a[i][2];
		a[i][0] = a[i][1] + a[i][2];
	}
	sort(a.begin(), a.end());
	reverse(a.begin(), a.end());
	ll ans = 0;
	for (int i = 0; i < n; ++i)
	{
		if (i&1) ans -= a[i][2];
		else ans += a[i][1];
	}
	cout << ans;
}

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

const string YES = "Yes";
const string NO = "No";

void solve(long long A, long long B, long long C, long long K){
    while (A >= B) {
        B *= 2;
        K--;
    }
    while (B >= C) {
        C *= 2;
        K--;
    }
    if (K >= 0) {
        cout << YES << endl;
    } else {
        cout << NO << endl;
    }
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    long long K;
    scanf("%lld",&K);
    solve(A, B, C, K);
    return 0;
}


Measured memory_bytes: 3676
#include <iostream>
#include <set>
#define llint long long
#define inf 1e18

using namespace std;

llint n;
llint a[100005];
set<llint> S;

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i], S.insert(a[i]);
	cout << S.size() << endl;
	
	return 0;
}


Measured memory_bytes: 8448
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define int ll
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#ifdef int
const ll INF = (1LL<<60);
#else
const int INF = (1LL<<30);
#endif
const double PI = 3.14159265359;
const double EPS = 1e-12;
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}

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

int a[55], b[55];
int n;

bool check() {
  FOR(i, 1, n) {
    if(a[i-1] > a[i]) return true;
  }
  return false;
}

signed main(void)
{
  cin >> n;
  REP(i, n) cin >> a[i];

  int maidx = max_element(a, a+n) - a, miidx = min_element(a, a+n) - a;
  int ma = a[maidx], mi = a[miidx];

  vector<PII> v;

  if(abs(ma) > abs(mi)) {
    REP(i, n) {
      if(a[i] < 0) {
        a[i] += ma;
        v.PB({maidx, i});
      }
    }
    FOR(i, 1, n) {
      a[i] += a[i-1];
      v.PB({i-1, i});
    }
  } else {
    REP(i, n) {
      if(a[i] > 0) {
        a[i] += mi;
        v.PB({miidx, i});
      }
    }
    for(int i=n-1; i>=1; --i) {
      a[i-1] += a[i];
      v.PB({i, i-1});
    }
  }

  if(v.size() > 2*n) assert(false);
  cout << v.size() << endl;
  REP(i, v.size()) {
    cout << v[i].first+1 << " " << v[i].second+1 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
main(){
	int A,B,K=0;
	int i;

	
	scanf("%d",&A);
	scanf("%d",&B);
	
	K=(A+B)/2;
	if(abs(A-K)==abs(B-K)){
		printf("%d",K);
	}
	else{
		printf("IMPOSSIBLE");
	}
	
	
}

Measured memory_bytes: 128
#include<stdio.h>
int main()
{
    int h,w,n,omen;
    scanf("%d %d %d",&h,&w,&n);
    if(h > w) omen = h;
    else omen = w;
    int hitung = 1;
    for(int i = omen;i<n;i += omen)
    hitung++;
    printf("%d\n",hitung);
    return 0;
}

Measured memory_bytes: 1732
package main

import "fmt"

func main() {
	var s, t string
	fmt.Scanf("%s", &s)
	fmt.Scanf("%s", &t)
	var c int
	for i := 0; i < len(s); i++ {
		if s[i] != t[i] {
			c++
		}
	}
	fmt.Printf("%d", c)
}


Measured memory_bytes: 4588
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-13;
const long double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long double ABS(long double a){return max(a,-a);}
int A[210000];
long long bit[210000];
long long sum(int a,int b){
	if(a>b)return 0;
	if(a)return (mod+sum(0,b)-sum(0,a-1))%mod;
	long long ret=0;
	for(;b>=0;b=(b&(b+1))-1)ret=(ret+bit[b])%mod;
	return ret;
}
void add(int a,long long b){
	for(;a<210000;a|=a+1)bit[a]=(bit[a]+b)%mod;
}
long long pw(long long a,long long b){
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
long long inv[210000];
int val[210000];
long long V[210000];
long long D[210000];
int x[210000];
int main(){
	inv[1]=1;
	for(int i=2;i<210000;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	int n;scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%d",A+i);
	for(int i=0;i<n;i++){
		val[A[i]]++;
	}
	long long ret=0;
	long long S=1;
	D[0]=1;
	for(int i=n;i;i--){
		val[i-1]+=val[i];
	}
	for(int i=1;i<=n;i++){
	//	val[i+1]+=val[i];
		val[i]-=(n-i);
		if(val[i]<=0){
			printf("0\n");return 0;
		}
		S=S*val[i]%mod;
		V[i]=(val[i]-1)*inv[val[i]]%mod;
		if(V[i]==0){
			D[i]=D[i-1];
			x[i]=x[i-1]+1;
		}else{
			D[i]=D[i-1]*V[i]%mod;
			x[i]=x[i-1];
		}
	}
	//for(int i=1;i<=n;i++){printf("%d\n",val[i]);}

	for(int i=0;i<n;i++){
		int left=lower_bound(x,x+n+1,x[A[i]])-x;
		long long tmp1=sum(left,A[i]);
		add(A[i],pw(D[A[i]],mod-2));
		ret=(ret+tmp1*D[A[i]]%mod*inv[2]%mod*S)%mod;
	}
	for(int i=0;i<210000;i++)bit[i]=0;
	for(int i=0;i<n;i++){
		int right=upper_bound(x,x+n+1,x[A[i]])-x-1;
		long long tmp2=sum(A[i]+1,right);
		add(A[i],D[A[i]]);
		ret=(ret+mod-tmp2*pw(D[A[i]],mod-2)%mod*inv[2]%mod*S%mod)%mod;
	}
	long long pr=0;
	for(int i=0;i<210000;i++)bit[i]=0;
	for(int i=0;i<n;i++){
		pr+=sum(A[i]+1,n+1);
		add(A[i],1);
	}
	pr%=mod;
	ret=(ret+pr*S)%mod;
	printf("%lld\n",ret);
}

Measured memory_bytes: 9088
a, b = input().split()

if a == 'H' and b == 'H':
    print('H')
elif a == 'H' and b == 'D':
    print('D')
elif a == 'D' and b == 'H':
    print('D')
elif a == 'D' and b == 'D':
    print('H')


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

int main(){

  int n, w[5]={5, 7, 5, 7, 7};
  string s[40];

  while(cin>>n, n){
    for(int i=0;i<n;i++) cin>>s[i];

    for(int i=0;i<n;i++){
      int id=0, sw=0;
      bool f=false;
      for(int j=i;j<n;j++){
        sw+=s[j].size();
        if(sw==w[id]){
          id++;
          sw=0;
        }else if(sw>w[id]) break;
        if(id==5){
          cout<<i+1<<endl;
          f=true;
          break;
        }
      }
      if(f) break;
    }
  }

  return 0;
}

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

int main() {

  int64_t N,ans=0; cin>>N;
  vector<int> A(N);
 
  
  for(int i=0;i<N;i++){
    cin>>A.at(i);}
  
  for(int j=0; j<N-1; j++){
    for(int k=j+1; k<N;k++){
      ans += A.at(j)*A.at(k);
    }
  }
cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string.h>

using namespace std;

int main(void)
{
	char a[100000];
	cin >> a;
	int len = strlen(a);
	int count = 0;

	for(int i = 0;i < len-1;i++)
	{
		if(a[i] != a[i+1])
		{
			count++;
		}
	}
	cout << count << endl;

	return 0;
}


Measured memory_bytes: 384
/*そーなのかー
　　　＿
　 '´　　 ヽ
 ./ ﾉﾉ））)）〉
〈《.! ﾟ ヮﾟﾉ》
　⊂!::V::!つ
　 く::::::::〉
　　 し'ﾉ*/
#include <bits/stdc++.h>
using namespace std;

int main() {
  int a,b;
  cin >> a >> b;
  vector<int>c(b);
  for(int i=0;i<b;i++){
  cin >> c.at(i);
  }
  for(int i=0;i<b;i++){
  a-=c.at(i);
  }
  if(a<=0){
  cout << "Yes" << endl;
  }
  else{
  cout << "No" << endl;
  }
}

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

int main(){
    long double a,b,c;
    cin >> a >> b >> c;
    LL d = c - a - b;
    if(d > 0 && d * d > 4 * a * b){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 768
S = [a for a in input()]
N = [int(a) for a in S]
M = [N[0]] + [-N[i] for i in range(1,4)]

S.insert(1, '+')
S.insert(3, '+')
S.insert(5, '+')

if sum(N) == 7:
    S = S
    print(''.join(S) + '=7')
    exit()

for i in range(1, 4):
    N[i] = -N[i]
    
    if sum(N) == 7:
        
        S[2 * i - 1] = '-'
        print(''.join(S) + '=7')
        exit()
    else: N[i] = -N[i]

for i in range(1, 4):
    S[1], S[3], S[5] = '-', '-', '-'
    
    M[i] = -M[i]
    
    if sum(M) == 7:
        S[2 * i - 1] = '+'
        print(''.join(S) + '=7')
        exit()
    else:
      M[i] = -M[i]

Measured memory_bytes: 9216
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    int n;
    std::cin >> n;
    double v[1000];
    for (int i = 0; i < n; i++) {
        std::cin >> v[i];
    }
    sort(v,v+n);
    double a=(v[0]+v[1])/2;
    for (int i = 2; i < n; i++) {
        a=(a+v[i])/2;
    }
    std::cout << a << std::endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
int cnt = 0;
void dfs(int x, int y,int n){
    int k = 10 * x + y;
   if(k > n)
   return;
    if(n / 100 >= 1){
        int t = k;
        bool three = false,five = false,seven = false;
        while(t > 0){
            if(t % 10 == 3)
            three = true;
            if(t % 10 == 5)
            five = true;
            if(t % 10 == 7)
            seven = true;
            t /= 10;
            if(three && five && seven)
            break;
        }
        if(three && five && seven)
        cnt++;
    }
    dfs(k, 3, n);
    dfs(k, 5, n);
    dfs(k, 7, n);
}
signed main(){
    int n;
    cin >> n;
   dfs(0,3,n);
   dfs(0,5,n);
   dfs(0,7,n);
  cout << cnt << "\n";
}

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

const double pi=acos(-1);
typedef long long ll;
const int maxn=1e6+10;

int main()
{
    ll h,n,a;
    cin >> h >> n ;
    ll s=0;
    while(n--){
        scanf("%lld",&a);
        s+=a;
    }
    if(s>=h)
        cout << "Yes";
    else
        cout << "No";
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//using namespace atcoder;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define pb push_back
#define fi first
#define se second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void chOut(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using v_bool = vector<bool>;
using v_Pii = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;



signed main(){

    string N; cin >> N;
    int n = SZ(N);

    int m0 = 0, m1 = 10 * n;
    while(m1 - m0 > 1){
        int m = (m0 + m1) / 2;
        int now = 0, t = m;
        bool ok = true;
        IREP(i, n){
            int x = N[i] - '0';
            int next = now + t;
            if(next % 10 >= x) next -= next % 10 - x;
            else next -= next % 10 - x + 10;

            t = next - now;
            if(t < 0){
                ok = false;
                break;
            }
            now = next / 10;
        }
        if(ok) m1 = m;
        else m0 = m;
    }
    int ans = (m1 + 8) / 9;
    Out(ans);

    return 0;
}


Measured memory_bytes: 3860
#include <iostream>
using namespace std;
int main() {
	string S;
		cin >> S;
	if (S == "a" || S == "i" || S == "u" || S == "e" || S == "o") {
		cout << "vowel" << endl;
	}else {
		cout << "consonant" << endl;
	}
}

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

int main(void){
    int n, t, i, min=10000;
    scanf("%d %d", &n, &t);
    int cc[n], tt[n];
    for(i=0; i<n; i++){
        scanf("%d %d", &cc[i], &tt[i]);
        if(tt[i]<=t){
            if(min>cc[i]) min=cc[i];
        }
    }
    if(min == 10000) printf("TLE");
    else printf("%d", min);
}


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

const long long MOD = 1000000007;
const long long INF = 1LL << 60;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<ll> S(n);
  for (int i = 0; i < n; i++)
    cin >> S[i];
  int q;
  cin >> q;
  vector<ll> T(q);
  for (int i = 0; i < q; i++)
    cin >> T[i];
  int cnt = 0;
  for (int i = 0; i < q; i++)
  {
    if (binary_search(S.begin(), S.end(), T[i]))
      cnt++;
  }
  cout << cnt << endl;
  return 0;
}



Measured memory_bytes: 4092
n = int(input())
hatugen = [[]for i in range(n)]
for i in range(n):
    a = int(input())
    for j in range(a):
        c,d = map(int,input().split())
        hatugen[i].append((c,d))
ans = 0
for i in range(1,2**n):
    consistent = True
    for j in range(n):
        #i通り目のj番目の人の発言が不誠実の時は、どうでもいいのでcontinue
        if (i >> j) & 1 == 0:
                continue
        else:
            for l,m in hatugen[j]:
                if (i >> (l-1)) & 1 != m:
                    consistent = False
                    break
    if consistent == True:
        ans = max(ans,bin(i)[2:].count('1'))
        
print(ans)

Measured memory_bytes: 3064
n,a,b,*h=map(int,open(0).read().split())
i,j=0,-(-max(h)*n//a)
while j-i>1:
 k=c=(j+i+1)//2
 for t in h:c+=min(0,(b*k-t)//(a-b))
 if c>=0:j=k
 else:i=k
print(j)

Measured memory_bytes: 14092
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jaynil
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ACurtain solver = new ACurtain();
        solver.solve(1, in, out);
        out.close();
    }

    static class ACurtain {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            out.println(a - 2 * b > 0 ? a - 2 * b : 0);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 23380
#include<stdio.h>
int main(void)
{
	int h,w,i,j,a,b;
	do{
	scanf("%d %d",&h,&w);
	if(h<=300 && w<=300)
	{
	for(i=0;i<h;i++)
	{
		for(j=0;j<w;j++)
		{
			a=i%2;b=j%2;
			if((a==0 && b==0) || (a==1 && b==1))printf("#");
			if((a==1 && b==0) || (a==0 && b==1))printf(".");
		}
		if(h!=0 && w!=0)printf("\n");
	}
	if(h!=0 && w!=0)printf("\n");
	}a=0;
	}while(h!=0 && w!=0);
return 0;
}

Measured memory_bytes: 572
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

void solve(int, vector<int> X) {
  sort(X.begin(),X.end());
  int mi = 1000000;
  for (auto p = X.front(); p <= X.back(); ++p) {
    mi = min(mi,accumulate(X.begin(),X.end(),0,
                           [&p](int acc, int x){
                             return acc + (x-p)*(x-p);}));
  }
  cout << mi << endl;
}

int main() {
  int N;
  cin >> N;
  vector<int> X(N);
  for (int i = 0; i < N; i++) {
    cin >> X[i];
  }
  solve(N, move(X));
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <queue>
#include <random>
#include <iomanip>
#include <iterator>
#include <utility>

typedef long long ll;
typedef unsigned long long ull;

int main() {
	ll d, g;
	std::cin >> d >> g;
	ll p[11], c[11];

	for (int i = 0; i < d; ++i) {
		std::cin >> p[i] >> c[i];
	}

	ll ans = 1 << 29;

	for (int bit = 0; bit < (1 << d); ++bit) {
		ll sum = 0;
		ll adds = 0;
		for (int i = 0; i < d; ++i) {
			if (bit & (1 << i)) {
				sum += c[i] + p[i] * 100 * (i + 1);
				adds += p[i];
			}
		}
		if (g <= sum) {
			ans = std::min(adds, ans);
		}
		else {
			for (int i = d - 1; i >= 0; --i) {
				if (bit & (1 << i)) {
					continue;
				}
				for (int j = 0; j < p[i]; ++j) {
					if (g <= sum) {
						break;
					}
					sum += 100 * (i + 1);
					++adds;
				}
			}
			ans = std::min(ans, adds);
		}
	}
	std::cout << ans << std::endl;
}

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

const int MAX = 510000;

struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
}aaaaaaa;

int main(){

ll x;
cin >>x;
    if(x%11 == 0){
        cout<<(x/11)*2<<endl;
    }
    else{
        ll a = x%11;
        if(a<=6){
            cout<<(x/11)*2+1<<endl;
        }
        else{
        cout<<(x/11)*2 + 2<<endl;
        }
    }





    return 0;
}

Measured memory_bytes: 256
from collections import *

N = int(input())
A = list(map(int, input().split()))

c = Counter(A)
t = {key : (value*(value-1)//2) for key, value in c.items()}
s = sum(t.values())
ans = {a : s-t[a] + ((c[a]-1)*(c[a]-2)//2) for a in A }

for a in A: print(ans[a])

Measured memory_bytes: 41232
#include <iostream>
#include <cmath>

using namespace std;

int main (void) {
  double x1, y1, x2, y2, x3, y3, x4, y4;
  int n;
   
  cin >> n;
  
  for(int i = 0; i < n; i++) {
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    double t1 = (y1-y2)/(x1-x2);
    double t2 = (y3-y4)/(x3-x4);
    //cout << t1 << " " << t2 << endl;
    if ( t1 == t2 ) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  
  return 0;
}

Measured memory_bytes: 1224
#include<stdio.h>
#define MAX 1400
int dp[MAX][MAX], map[MAX][MAX];
int large_square(int h, int w);
int main(void)
{
  int i, j, h, w;
  scanf("%d%d", &h, &w);
  for (i = 0; i < h; i++) {
    for (j = 0; j < w; j++) {
      scanf("%d", &map[i][j]);
    }
  }
  printf("%d\n", large_square(h, w));
}
int large_square(int h, int w)
{
  int i, j, maxw = 0;
  for (i = 0; i < h; i++) {
    for (j = 0; j < w; j++) {
      dp[i][j] = (map[i][j] + 1) % 2;
      maxw |= dp[i][j];
    }
  }
  for (i = 1; i < h; i++) {
    for (j = 1; j < w; j++) {
      if (map[i][j]) dp[i][j] = 0;
      else {
        int temp = (dp[i-1][j] < dp[i][j-1] ? dp[i-1][j] : dp[i][j-1]);
        dp[i][j] = (dp[i-1][j-1] < temp ? dp[i-1][j-1] + 1 : temp + 1);
        if (maxw < dp[i][j]) maxw = dp[i][j];
      }
    }
  }
  return maxw * maxw;
}


Measured memory_bytes: 17112
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
typedef long long ll;
typedef unsigned long long ull;

char A[8][8];

int main()
{
	int H, W, x = 0, y = 0;
	bool ans = true;

	cin >> H >> W;
	rep(i, H) rep(j, W) cin >> A[i][j];

	A[0][0] = '*';
	while (!(x == H - 1 && y == W - 1)) {
		if (x != H - 1 && A[x + 1][y] == '#') x++;
		else if (y != W - 1 && A[x][y + 1] == '#') y++;
		else break;
		A[x][y] = '*';
	}

	rep(i, H) rep(j, W) if (A[i][j] == '#') ans = false;

	cout << (ans ? "Possible" : "Impossible") << endl;

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(int argc, char const *argv[])
{
   int N,K,Q,R,i,t;
   scanf("%d", &N);
   scanf("%d", &K);
   scanf("%d", &Q);
   int p[N];
  R=K-Q;
  for(i=0;i<N;i++) p[i]=R;
  for(i=0;i<Q;i++){
    scanf("%d",&t);
    p[t-1]++;
  }
  for(i=0;i<N;i++){
    if(p[i]>0){
      printf("Yes\n");
    }else{
      printf("No\n");
    }
  }
  return (0);
}

Measured memory_bytes: 896
#include<iostream>
#include<vector>
using namespace std;
int main(){
    vector<vector<int>>a(3,vector<int>(3));
    for(int i=0;i<3;i++)
    {
        for(int j=0;j<3;j++)
        {
            cin>>a[i][j];
        }
    }
    bool no=false;
    for(int i=0;i<2;i++)
    {
        int f=-1,s=-1;
        for(int j=0;j<=2;j++)
        {
            if(f==-1)
            {
                f=a[i+1][j]-a[i][j];
                s=a[j][i+1]-a[j][i];
            }
            if(a[i+1][j]-a[i][j]!=f){
                no=true;
                break;
            }
            if(s!=a[j][i+1]-a[j][i]){
                no=true;
                break;
            }
        }
        if(no)
        {
            break;
        }
    }
    if(no)
    {
        cout<<"No\n";
    }
    else
    {
        cout<<"Yes\n";
    }
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll a,b,x,result;
    cin>>a>>b>>x;

    if(a%x==0)
    {
        cout<<(b/x)-(a/x)+1<<endl;
    }
    else
    {
        cout<<(b/x)-(a/x)<<endl;
    }
    //cout<<result<<endl;

}


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

int main() {
  int N, a, ans = 1, minA=100000, maxA=0; cin >> N;
  vector<int> A(100000, 0);
  for (int i = 0; i<N; i++) {
    cin >> a;
    A[a]++;
    minA = min(minA, a);
    maxA = max(maxA, a);
  }
  for (int i = minA-1; i<N-2; i++) ans = max(ans, A[i]+A[i+1]+A[i+2]);
  cout << ans << "\n";
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long

const int mod=1e9+7;
ll power(ll a,ll b){
    ll res=1;
    while(b){
        if(b&1)res=res*a%mod;
        b>>=1;
        a=a*a%mod;
    }
    return res;
}
ll inv(ll x){

    return power(x,mod-2);
}
vector<ll>g[200020];
int a[44444],b[44444];
vector<ll>v1,v2;
int main(){
    ll n,i,j,k,x,y,z,t,m;
    cin>>n>>x>>y;
    ll c=n/(x+y),yy=n%(x+y);
    cout<<c*x+min(yy,x);
}







Measured memory_bytes: 4992
import java.util.ArrayList;

import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
	
		Scanner scn=new Scanner(System.in);
		ArrayList<Long> list=new ArrayList<>();
		
		long x=scn.nextInt();
		long t=scn.nextInt();
		
		for(int i=0;i<t;i++) {
			
			long y=scn.nextLong();
			list.add(y);
		}
		
		long s=0;
		for(Long i:list) {
			s=s+i;
		}
		
		if(s>=x) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
		
		
		scn.close();
	}
}

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

int main(){
    int c11,c12,c13,c21,c22,c23,c31,c32,c33;
    cin >> c11 >> c12 >> c13 >> c21 >> c22 >> c23 >> c31 >> c32 >> c33;
    if(c11-c12==c21-c22 && c21-c22==c31-c32 && c12-c13==c22-c23 && c22-c23==c32-c33 && c13-c11==c23-c21 && c23-c21==c33-c31 && c11-c21==c12-c22 && c12-c22==c13-c23 && c21-c31==c22-c32 && c22-c32==c23-c33 && c31-c11==c32-c12 && c32-c12==c33-c13)    cout << "Yes" << endl;
    else    cout << "No" << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int N,M,i,j,n[1000],m[1000]={},a,max=0,nom;
	scanf("%d %d", &N, &M);
	for(i = 0; i < N; i++){
		scanf("%d", &n[i]);
	}
	for(i = 0; i < M; i++){
		scanf("%d", &a);
		for(j = 0; j < N; j++){
			if(a>=n[j]){
				m[j]++;
				break;
			}
		}
	}
	for(i = 0; i < N; i++){
		if(max<m[i]){
			max = m[i];
			nom = i+1;
		}
	}
	printf("%d\n",nom);
	return 0;
}

Measured memory_bytes: 604
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<functional>
#include<set>
#include<queue>
#include<limits.h>
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <bitset>
#include <climits>
using namespace std;

signed main() {
	int n, a, b; cin >> n >> a >> b;
	cout << min(a, b) << " " << max(0, a + b - n) << endl;
}

Measured memory_bytes: 764
#include<stdio.h>
int main(){
int h,w,k;
scanf("%d %d %d",&h,&w,&k);
char s[h][w];
int ans[h][w];

int no[h];
int lebel=1;
for(int i=0;i<h;i++){
    scanf("%s",s[i]);
    no[i]=1;
    for(int j=0;j<w;j++){
        if(s[i][j]=='#'){
            no[i]=0;
            break;
        }    
    }
}
int nolen=0;
int first=0;

for (int i = 0; i < h; i++)
{
    first=0;
    if(no[i]==1 ){
        if(i== nolen){
            nolen++;
        }
        for (int j = 0; j < w; j++)
        {
            ans[i][j]=-1;
        }
        
    }else{
        for (int j = 0; j < w; j++)
        {
            
            if (s[i][j] == '#')
            {
                if(first==0){
                    first=1;
                    ans[i][j]=lebel;
                }else{
                    lebel++;
                    ans[i][j]=lebel;
                }
            }else{
                ans[i][j]=lebel;
            }
        }
        lebel++;
    }

}

for (int i = 0; i < h; i++)
{
    
    for(int j=0;j<w;j++){
        if(ans[i][j]!= -1){
            break;
        }
        if(i< nolen){
            ans[i][j]=ans[nolen][j];
        }else{
            ans[i][j]=ans[i-1][j];
        }
    }
}

for (int i = 0; i < h; i++)
{

    for (int j = 0; j < w; j++)
    {
       printf("%d",ans[i][j]);
       if(j==w-1){
           printf("\n");
       }else{
           printf(" ");
       }
    }
}

return 0;
}

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

using namespace std;

int main()
{
   string inpstr;
   long long removable_box = 0;
   cin >> inpstr;
   long long str_size = inpstr.size();
   stack<char> char_stk;
   char_stk.push(inpstr[0]);
   for(long long i = 1; i < str_size;i++)
   {
        if(char_stk.empty())
        {
            char_stk.push(inpstr[i]);
            continue;
        }
        if((inpstr[i] == '0' && char_stk.top() == '1') || (inpstr[i] == '1'&& char_stk.top() == '0'))
        {
            removable_box  = removable_box + 2;
            char_stk.pop();

        }
        else
        {
            char_stk.push(inpstr[i]);
        }

   }

    cout << removable_box;


    return 0;
}


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

int main() {
  int n;
  cin >> n;
  string ans = "No";
  rep(i, 9) {
    rep(j, 9) {
      if ((i+1)*(j+1) == n) ans = "Yes";
    }
  }
  cout << ans << endl;
}

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

 using namespace std;
 typedef long long ll;
 #define rep(i, n) for(int i = 0; i < (int)(n); i++)

 int main() {
   int N, X, ans;
   cin >> N >> X;
   vector<int> x(N);
   rep(i, N) cin >> x.at(i);
   sort(x.begin(), x.end());

   int minD = 1000000000;
   rep(i, N) {
     if (minD > abs(x.at(i) - X)) minD = abs(x.at(i) - X);
     else break;
   }

   for (int i = 1; i <= minD; i++) {
     if (minD % i != 0) continue;
     bool done = true;
     rep(j, N) {
       if ((x.at(j) - X) % (minD / i) != 0) {
         done = false;
         break;
       }
     }
     if (done) {
       ans = minD / i;
       break;
     }
   }

   cout << ans << endl;
 }


Measured memory_bytes: 640
def solve():
    MOD = 10**9 + 7

    N = int(input())
    As = list(map(int, input().split()))

    ans = 0
    for d in range(60):
        nums = [0, 0]
        for A in As:
            b = (A>>d) & 1
            nums[b] += 1
        v = nums[0]*nums[1]
        v *= pow(2, d, MOD)
        ans += v
        ans %= MOD

    print(ans)


solve()


Measured memory_bytes: 124080
/*                                  /   \                                                                   (Hello)//JSM//*/      
/*                                 /*****\                                                                              */
/*     Jai Shree Mataji           /       \ |\| |_| $ |-| K                                                            */
#include<vector>
#include<iostream>
#include<algorithm>                
#include<string.h>                 
#include<bits/stdc++.h>            
#include<cstring>                  
#include<map>                     
#include<cmath>                  
#include<set>
using namespace std;            
#define ll long long int        
#define ld long double
#define MOD 1000000007 
#define PI 3.1415926535897932384626433832795                                               
#define YY cout<<"YES"
#define NN cout<<"NO"
#define EE cout<<"\n"
#define ee cout<<"\n"
#define ne cout<<"-1"
#define pb push_back 
#define ff first
#define ss second
#define mkp make_pair    
#define mkt make_tuple
#define all(v ) sort(v.begin(), v.end())      
#define fo(i , n) for(ll i = 0 ; i < n ; i++)
#define vl vector<ll>
#define vc vector<char> 
#define vll vector< pair<ll,ll> > 
#define pr pair<ll,ll>
#define mps map<string ,ll>
#define mpc map<char ,char>
#define mpl map<ll,ll>
#define tpl tuple<ll,ll,ll>
ll fac[1000000], inv[1000000], finv[1000000];
void C_init() {
  fac[0] = 1; fac[1] = 1;
  finv[0] = 1; finv[1] = 1;
  inv[1] = 1;
  for (ll i=2; i<1000000; i++){
    fac[i] = fac[i-1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
    finv[i] = finv[i-1] * inv[i] % MOD;
  }
}
 
ll COMB(ll a, ll b) {
  if (a < b)
    return 0;
  if (a < 0 || b < 0)
    return 0;
  return fac[a] * (finv[b] * finv[a-b] % MOD) % MOD;
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);	
	  ll t=1;
//	   cin>>t;
	      while(t--)
{

/*
2 3 1 1*/
ll h,w,a,b;
cin>>h>>w>>a>>b;
ll i;
ll ans=0;
C_init();
for(i=b+1;i<=w;i++)
{
	ans+=((COMB((h-a-1)+(i-1),(i-1)))%MOD)*(COMB((w-i)+(a-1),(a-1)))%MOD;
	ans%=MOD;
}
cout<<ans;
ee;

}
return 0;
}



Measured memory_bytes: 27020
#include<iostream>
#include<algorithm>

using namespace std;

int const N = 1e5 + 41;
int a[N], n, k;
long long pref[N], prefP[N], ans;

int main(){
	scanf("%d %d",&n,&k);
	for(int i=1;i<=n;++i){
		scanf("%d",&a[i]);
		pref[i] = pref[i-1] + a[i];
		prefP[i] = prefP[i-1] + max(0, a[i]);
	}

	for(int i=1;i<=n-k+1;++i){
		long long pans = prefP[i-1] + prefP[n] - prefP[i+k-1];
		pans += max(0LL, pref[i+k-1] - pref[i-1]);
		ans = max(ans, pans);
	}
	printf("%lld\n",ans);




	return 0;
}

Measured memory_bytes: 2176
#include <iostream>

using namespace std;

int main()
{
    int x,c=0;
    cin>>x;
    int arr[x];
    for(int i=1;i<=x;i++){
        cin>>arr[i];
        if(arr[i]%2==1&&i%2==1){c++;}
    }
    cout<<c<<endl;
    return 0;
}

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

int
main ()
{
    int n, k;
    std::cin >> n >> k;
    std::vector<long long> accum(n+1);

    accum[0] = 0;
    for (int i = 1; i <= n; ++i) {
      long long p;
      std::cin >> p;
      accum[i] = accum[i - 1] + (p + 1);
    }

    auto max = 0ll;
    for (int i = k; i <= n; ++i) {
      auto k_sum = accum[i] - accum[i - k];
      max = std::max(max, k_sum);
    }

    std::printf("%.10f\n", max / 2.0);
}


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

int n;
int a[55];

bool chk(){
    for(int i=1;i<=n;i++){
        if(a[i]<=a[i-1]){
            return false;
        }
    }
    return true;
}

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    for(int i=1;i<n;i++){
        for(int j=i+1;j<=n;j++){
            swap(a[i],a[j]);
            if(chk()){
                cout<<"YES"<<endl;
                return 0;
            }
            swap(a[i],a[j]);
        }
    }
    if(chk()){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }

    return 0;
}

Measured memory_bytes: 256
def main():
  N, x = map(int, input().split())
  a = list(map(int, input().split()))
  c = [a[i] for i in range(N)]
  ans = sum(a)
  for i in range(N):
    tmp = i*x
    for j in range(N):
      c[j]=min(c[j],a[j-i])
      tmp += c[j]
    ans=min(ans,tmp)
  print(ans)
main()

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

int compare_int(const void *a, const void *b)
{
    return *(int *)a - *(int *)b;
}

int main(void)
{
    int ans = 0;
    int n;
    scanf("%d", &n);

    int d[n];
    for (int i = 0; i < n; i++)
        scanf("%d", &d[i]);

    qsort(d, n, sizeof(int), compare_int);

    if (d[n / 2] != d[n / 2 - 1])
        ans = d[n / 2] - d[n / 2 - 1];

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

    return 0;
}

Measured memory_bytes: 892
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>

//#include<bits/stdc++.h>


using namespace std;



int main() {


	int n;
	cin >> n;
	vector<int>p(n);
	for (int i = 0; i < n; i++)cin >> p[i];
	sort(p.begin(), p.end());

	int ans = p[0];
	for (int i = 1; i < n; i++) {
		int t = p[i];
		if (t < ans)swap(t, ans);
		while (t%ans) {
			int y = ans;
			ans = t%ans;
			t = y;
		}

	}
	cout << ans << endl;

	return 0;

}

Measured memory_bytes: 640