akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
using namespace std;

ll dp[3050][3050];
ll sum[3050][3050];

int main(){
	int n; cin >> n;
	string s; cin >> s;
	// init
	for( int j = 0; j <= n-1; ++j ) dp[0][j] = 1;
	for( int j = 0; j <= n-1; ++j ){
		sum[0][j+1] = ( sum[0][j] + dp[0][j] ) % mod;
		sum[0][j+1] %= mod;
	}
	for( int i = 0; i <= n-2; ++i ){
		for( int j = 0; j <= n-2-i; ++j ){
			if( s[i] == '>' ) dp[i+1][j] = sum[i][j+1];
			else dp[i+1][j] = ( sum[i][n-i] - sum[i][j+1] + mod ) % mod;
			// cout << "dp[" << i+1 << "][" << j << "]: " << dp[i+1][j] << endl; 
		}
		for( int j = 0; j <= n-1; ++j ){
			sum[i+1][j+1] = ( sum[i+1][j] + dp[i+1][j] ) % mod;
		}
	}
	cout << dp[n-1][0] << endl;
}

Measured memory_bytes: 143744
#include <stdio.h>
long long int gcd(long long int n1, long long int n2);
int main()
{
   long long int n1, n2;
   scanf("%lld%lld", &n1, &n2);

   printf("%lld\n",gcd(n1,n2));
   return 0;
}

long long int gcd(long long int n1, long long int n2)
{
    if (n2 != 0)
       return gcd(n2, n1%n2);
    else 
       return n1;
}


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

using namespace std;

#define ll long long
#define ld long double
#define mod 1000000007


int main()
{
	string s;
	cin>>s;

	string t1 ;
	t1 += s[0];
	t1 += s[1];

	string t2;
	t2 += s[2];
	t2 += s[3];

	ll t11 = stoi(t1);
	ll t22 = stoi(t2);

	if(t11 > 12 && t22 <= 12 && t22 > 0)
	{
		cout<<"YYMM"<<endl;
	}
	else if(t11 <= 12 && t22 > 12 && t11 > 0)
	{
		cout<<"MMYY"<<endl;
	}
	else if(t11 == 0 && t22 != 0 && t22 <= 12 && t22 > 0)
	{
		cout<<"YYMM"<<endl;
	}
	else if(t11 != 0 && t22 == 0 && t11 <= 12 && t11 > 0)
	{
		cout<<"MMYY"<<endl;
	}
	else if(t11 <= 12 && t22 <= 12 && t11 > 0 && t22 > 0)
	{
		cout<<"AMBIGUOUS"<<endl;
	}
	else
	{
		cout<<"NA"<<endl;
	}

}	

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    VL x(n), y(n), z(n);
    REP(i, n) cin >> x[i] >> y[i] >> z[i];

    ll ans = 0;
    REP(sign_bit, 8) {
        int x_sign = sign_bit & 0b001 ? 1 : -1;
        int y_sign = sign_bit >> 1 & 0b001 ? 1 : -1;
        int z_sign = sign_bit >> 2 & 0b001 ? 1 : -1;
        vector<pair<ll, int>> sum_pv;
        REP(i, n)
            sum_pv.push_back(
                make_pair(x[i] * x_sign + y[i] * y_sign + z[i] * z_sign, i)
            );
        sort(ALL(sum_pv), greater<pair<ll, int>>());
        ll x_sum = 0;
        ll y_sum = 0;
        ll z_sum = 0;
        REP(i, m) {
            x_sum += x[sum_pv[i].second];
            y_sum += y[sum_pv[i].second];
            z_sum += z[sum_pv[i].second];
        }
        ans = max(ans, abs(x_sum) + abs(y_sum) + abs(z_sum));
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<vector>
using namespace std;
#define int long long
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
#define ic(n) int n;cin>>n;
#define sc(s) string s;cin>>s;
#define mod 1000000007
#define inf 1000000000000000007
#define f first
#define s second
#define mini(c,a,b) *min_element(c+a,c+b)
#define maxi(c,a,b) *max_element(c+a,c+b)
//printf("%.12Lf\n",c);
int keta(int x){
	rep(0,i,30){
		if(x<10){
			return i+1;
		}
		x=x/10;
	}
}
int gcd(int x,int y){
	int aa=x,bb=y;
	rep(0,i,1000){
		aa=aa%bb;
		if(aa==0){
			return bb;
		}	
		bb=bb%aa;
		if(bb==0){
			return aa;
		}
	}
}	
int lcm(int x,int y){
	int aa=x,bb=y;
	rep(0,i,1000){
		aa=aa%bb;
		if(aa==0){
			return x/bb*y;
		}	
		bb=bb%aa;
		if(bb==0){
			return x/aa*y;
		}
	}
}
bool p(int x){
	if(x==1)return false;
	rep(2,i,sqrt(x)+1){
		if(x%i==0&&x!=i){
			return false;
		}
	}	
	return true;
}
int primes[200];
int prime[1000000];
int pr[100000];
int el[314514],wl[314514];
int er[314514],wr[314514];
int a[114514];
string s[214514];
int b[214514],c[214514];
int ans[41];
signed main(){
	ic(x) ic(y)
	y=y+1;
	int ni=2;
	rep(0,i,40){
		a[i]=ni;
		ni*=2;
	}	
	int ax=0,ay=0;
	int kox=0,koy=0;
	ans[0]=(y-x)%2;
	rep(1,i,40){
		ax=x%a[i];
		ay=y%a[i];
		if(ax<a[i]/2)kox=0;
		else kox=ax-a[i]/2;
		if(ay<a[i]/2)koy=0;
		else koy=ay-a[i]/2;
		ans[i]=abs(kox-koy)%2;
		kox=0;
		koy=0;
		ax=0;
		ay=0;
	}
	int sum=0;
	rep(1,i,40){
		if(ans[i]==1)sum+=a[i-1];
	}
	int yy=y/2;
	int xx=x/2;
	c(sum+(yy-xx)%2)
}


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

int main(){
    long long S;
    cin >> S;
    //long long v = pow(10,9);
    long long t = sqrt(S);
    if(t*t == S){
        cout << "0 0 " << t <<" "<< "0 0 " << t << endl;  
        return 0;
    }
    t += 1;
    long long e = t * t - S;
    cout << "0 0 " << t << " "<< e << " "<<"1 "<<t <<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    int A, B;
    cin >> A >> B;
    cout << (A-1)*(B-1) << endl;
    return 0;
}



Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vll a(n);
    REP(i,n) cin >> a[i];
    ll ans = 1;
    vll cnt(n+1);
    cnt[0]=3;
    REP(i,n){
        ll ai = a[i];
        if(cnt[ai]<=cnt[ai+1]){
            cout << 0 << endl;
            return 0;
        }
        ans *= (cnt[ai]-cnt[ai+1]);
        cnt[ai+1]++;
        ans%=mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>
int main(void)
{
    int a,b,c,d,n=0;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	if(b>c){
		if(a<c) a=c;
		if(b>d) b=d;
		n=b-a;
	}
	if(d<a) n=0;
	printf("%d\n",n);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <iostream>
#include <string>

typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;

#define REP(idx, N) for (u64 idx = 0; idx < N; idx++)

int main() {
  string s, t;
  cin >> s >> t;

  if (t.substr(0, s.length()) == s) {
    cout << "Yes";
  } else {
    cout << "No";
  }

  return 0;
}


Measured memory_bytes: 3636
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        String n;
        int[] a;

        Scanner sc = new Scanner(System.in);
        n = sc.nextLine();
        a = Arrays.stream(sc.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
        Arrays.sort(a);
        int ans = a[a.length-1] - a[0];
        System.out.println(ans);
    }

}

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

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

void solve(long long A, long long B){
    if ((A * B) % 2) cout << YES << '\n';
    else cout << NO << '\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(A, B);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<stack>
#include<iostream>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define MOD 1000000007
#define vec(a) vector<int>a
using namespace std;


int main()
{
#ifndef ONLINE_JUDGE
	freopen("output.txt", "w", stdout);
	freopen("input.txt", "r", stdin);
#endif
	ll n,i,j,k,l,m,z;
	cin>>n;
	ll arr[n];
	l=0;
	for(i=0;i<n;i++)
	{
		cin>>arr[i];
		l+=arr[i];
	}
	k=0;
	m=l-arr[0];
	for(i=0;i<n-1;i++)
	{
		k+=arr[i];
		z=l-k;
		if(m>abs(z-k))
			m=abs(z-k);
	}
	cout<<m<<"\n";
	return 0;
}
	

Measured memory_bytes: 3640
#[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)*}
    };
}

#[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, usize1) => {
        read_value!($next, usize) - 1
    };

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

fn main() {
    input!{
        n: usize,
        m: i64,
        v: [(i64, i64); n]
    }
    let mut v = v;
    v.sort();
    let mut answer = 0;
    let mut m = m;
    for (a, b) in v {
        answer += std::cmp::min(b, m) * a;
        m -= b;
        if m < 1 {
            break;
        }
    }
    println!("{}", answer);
}



Measured memory_bytes: 6396
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define piii pair<int,pii>
#define pll pair<ll,ll>
#define plii pair<ll,pii>
#define vi vector<int>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mx 100001
#define eps 0.00000000001
#define mod 1000000007
#define pi acos(-1)
#define inf 100000000
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main()
{
    fio;
    int n;
    cin>>n;
    int a1;
    vi v1;
    set<int> s1;
    loop(i,0,n)
    {
        cin>>a1;
        v1.pb(a1);
        s1.insert(a1);
    }
    if(s1.size()==1)
        cout<<"0\n";
    else
    {
        SORT(v1);
        ll k = INT_MAX;
        for(int i=v1[0];i<=v1[n-1];i++)
        {
            ll sum = 0;
            loop(j,0,n)
            {
                int r = abs(v1[j]-i);
                sum += (r*r);
            }
            k = min(k,sum);
        }

        cout<<k<<endl;
    }
    return 0;
}



Measured memory_bytes: 3616
//まいった

//#pragma GCC optimize ("O3")
//#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int AS = 500000;
char cn[AS], * ci = cn, ct;
inline int getint() {
	int A = 0;
	while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}
char * di = cn;
int dat[2 * AS];

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


	int N = 0;
	while ((ct = getchar_unlocked()) >= '0') N = N * 10 + ct - '0';
	fread(cn, 1, N, stdin);
	auto da = dat + AS;
	rep(i, N) *da++ = (1 << *ci++ - 'a');
	da = dat + AS - 1;
	for (auto db = dat + AS * 2 - 1; da > dat; da--) *da = *db-- | *db--;
	getchar_unlocked();
	ci = cn;
	fread(cn, 1, 320010, stdin);
	int Q = getint();

	const char a[27] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1', '2', '3', '4', '5', '6' };

	rep(j, Q) {
		char q = *ci++;
		ci++;
		if (q == '1') {
			int i = getint() - 1 + AS;
			for (dat[i] = 1 << *ci++ - 'a'; i > 1; i >>= 1) dat[i >> 1] = dat[i] | dat[i ^ 1];
			ci++;
		}
		else {
			int ret = 0;
			for (int l = getint() - 1 + AS, r = getint() + AS; l < r; l >>= 1, r >>= 1) {
				if (l & 1) ret |= dat[l++];
				if (r & 1) ret |= dat[--r];
			}
			int kotae = __builtin_popcount(ret);
			if (kotae >= 20) *di++ = '2';
			else if (kotae >= 10) *di++ = '1';
			*di++ = a[kotae];
			*di++ = '\n';
		}
	}
	fwrite(cn, 1, di - cn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 4608
#create date: 2020-09-19 21:04

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    n = ni()
    ans = 0
    for a in range(1, n):
        ans += (n-1)//a
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 9200
#include <stdio.h>
#include <string.h>

#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define sq(x) ((x) * (x))

#define INF 1000000000

int dp[20001][256];

int main(void) {
	int i, j, k;
	int n, m;

	while (scanf("%d %d", &n, &m), n) {
		int c[16];
		int min;

		for (i = 0; i < n + 1; i++)
			for (j = 0; j < 256; j++)
				dp[i][j] = INF;

		for (i = 0; i < m; i++)
			scanf("%d", c + i);

		dp[0][128] = 0;
		for (i = 0; i < n; i++) {
			int x;
			scanf("%d", &x);
			for (j = 0; j < 256; j++)
				for (k = 0; k < m; k++) {
					int idx = max(0, min(255, j + c[k]));
					dp[i + 1][idx] = min(dp[i + 1][idx], dp[i][j] + sq(idx - x));
				}
		}

		min = INF;
		for (i = 0; i < 256; i++)
			min = min(min, dp[n][i]);

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

	return 0;
}

Measured memory_bytes: 20600
#include <bits/stdc++.h>
using namespace std;
int main()
{   int a,b;
    cin>>a>>b;
    if((a==1 || a==3 || a==5 || a==7 || a==8 || a==10 || a==12 ) &&
       (b==1 || b==3 || b==5 || b==7 || b==8 || b==10 || b==12 ))
        cout<<"Yes";
    else if ((a==4 || a==6 || a==9 || a==11) &&
       (b==4 || b==6 || b==9 || b==11) )
       cout<<"Yes";
    else
        cout<<"No";
return 0;
}

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

int main(){

    int a, b, c, x;
    int count = 0;

    cin >> a >> b >> c >> x;
    
    for(int i = 0; i <= a; i++){
        for(int j = 0; j <= b; j++){
            for(int k = 0; k <= c ;k++){
                if(500 * i + 100 * j + 50 * k == x){
                    count++;
                }
            }
        }
    }

    cout << count << endl;

}



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

int main() {
  int ans = 0;
  long long n, d;
  cin >> n >> d;

  long long x, y;
  for(int i=0;i<n;i++){
    cin >> x >> y;
    long long tmp = x*x + y*y;
    if(tmp <= (d*d)) ans++;
  }
  cout << ans << endl;
  
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
#define int long long
#define rep(i,a,b) for(int i=a;i<b;i+=1)
#define reps(i,a,b) for(int i=a;i>=b;i-=1)
#define vi vector<int>
#define vvi vector<vector<int>>
#define pb push_back
#define pi pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define in1(x) int x; cin>>x;
#define in2(x, y) int x, y; cin>>x>>y;
#define in3(x, y, z) int x, y, z; cin>>x>>y>>z;
#define in4(x, y, z, w) int x, y, z, w; cin>>x>>y>>z>>w;
#define mi unordered_map<int,int>
#define mem(x) memset(x, 0, sizeof(x))
#define IOS ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define mod 1000000007
using namespace std;
bool primes[1000001];vi prime; void seive(); int gcd(int a, int b); int power(int x, int y);

int32_t main(void){
	IOS;
	in1(x);
	cout<<(!x)<<endl;
}

void seive(){memset(primes, true, sizeof(primes));primes[0] = primes[1] = false;for(int i = 2; i*i<=1000000;i += 1){
if(primes[i]){for(int j = i*i; j <= 1000000;j += i) primes[j] = false;}}rep(i, 2, 1000001){if(primes[i]) prime.pb(i);}}
int gcd(int a, int b){return b==0 ? a : gcd(b, a%b);}
int power(int x, int y){ int res = 1;x = x % mod; if (x == 0) return 0;
while (y > 0){ if(y & 1) res = (res*x) % mod; y = y>>1; x = (x*x) % mod;} return res;}


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

using namespace std;

set<int> s;
map<int,int> mp,mmp;

int main()
{
    mp.clear();
    mmp.clear();
    s.clear();
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        int d;
        scanf("%d",&d);
        mp[d]++;
    }
    int m;
    scanf("%d",&m);
    for(int i=0;i<m;i++){
        int t;
        scanf("%d",&t);
        mmp[t]++;
        s.insert(t);
    }
    for(int x:s){
        if(mp[x]<mmp[x]){
            puts("NO");
            return 0;
        }
    }
    puts("YES");
    return 0;
}


Measured memory_bytes: 28416
#include<bits/stdc++.h>
#define ll                long long int
#define ld                long double
#define F                 first
#define S                 second
#define C                 continue
#define G                 goto done
#define pb                push_back
#define pf                push_front
#define ppb               pop_back
#define ppf               pop_front
#define sz                size()
#define pi                acos(-1.0)
#define mod               1000000007
#define maxe              *max_element
#define mine              *min_element
#define min3(a,b,c)       min(a,min(b,c))
#define max3(a,b,c)       max(a,max(b,c))
#define min4(a,b,c,d)     min(a,min(b,min(c,d)))
#define max4(a,b,c,d)     max(a,max(b,max(c,d)))
#define mem(a,b)          memset(a,b,sizeof(a))
#define all(a)            (a).begin(),(a).end()
#define gcd(a,b)          __gcd(a,b)
#define lcm(a,b)          ((a)*((b)/gcd(a,b)))
#define case(a)           cout<<"Case "<<(a)<<": "
#define point(a)          fixed<<setprecision(a)
#define get(a)            for(auto &x:a) cin>>x;
#define print(a)          for(auto x:a) cout<<x<<" "; cout<<endl;
#define uniq(a)           sort(all(a)); (a).erase(unique((a).begin(),(a).end()),(a).end())
#define big(a)            transform((a).begin(),(a).end(),(a).begin(),::toupper)
#define small(a)          transform((a).begin(),(a).end(),(a).begin(),::tolower)
#define ischar(a)         (('a'<=a&&a<='z')('A'<=a&&a<='Z'))
#define isvowel(a)        (a=='a'||a=='e'||a=='i'||a=='o'||a=='u'||a=='A'||a=='E'||a=='I'||a=='O'||a=='U')
#define fast              ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define tc                int test; cin>>test; while(test--)
using namespace std;
int main()
{
    string s,t; cin>>s>>t;
    set<ll>st;
    for(ll i=0;i<=(s.sz-t.sz);i++)
    {
        ll c=0,k=0;
        for(ll j=i;j<(i+t.sz);j++)
        {
            if(s[j]!=t[k]) c++; k++;
        }
        st.insert(c);
    }
    cout<<*st.begin()<<endl;
}




















Measured memory_bytes: 3616
#include<cstdio>

using namespace std;

int ansu[100001],ansv[100001],ans;
int main(){
	int n;
	scanf("%d",&n);
	if(n&1){
		for(int i=1;i<=n;i++){
			for(int j=1;j<i;j++)
				if(j!=i&&j!=n-i){
					ansu[++ans]=i;
					ansv[ans]=j;
				}
		}
	}
	else{
		for(int i=1;i<=n;i++)
			for(int j=1;j<i;j++)
				if(j!=i&&j!=n-i+1){
					ansu[++ans]=i;
					ansv[ans]=j;
				}
	}
	printf("%d\n",ans);
	for(int i=1;i<=ans;i++)
		printf("%d %d\n",ansu[i],ansv[i]);
}

Measured memory_bytes: 1716
#include <bits/stdc++.h>
#define EPS (1e-8)
#define x p.real()
#define y p.imag()
using namespace std;
typedef complex <double> point;
struct po{
  point p;
  double l;
  po(){x=y=l=0;};
  po(double a,double b,double c){x=a,y=b,l=c;}
  po(point a,double b){p=a,l=b;}
};
int n;
po bal[10];
double Abs(po a){return (a.x*a.x+a.y*a.y+a.l*a.l);}

po get_po(po a,po b){
  if(a.l>b.l) swap(a,b);
  double D=Abs(po(a.p-b.p,0));
  if(a.l*a.l+D<=b.l*b.l)return a;
  
  double t=(a.l*a.l+D-b.l*b.l)/(2*sqrt(D));
  point vec=b.p-a.p;
  vec=(vec/abs(vec))*t+a.p;
  return po(vec,sqrt(a.l*a.l-t*t));
}

po BinarySearch(double l,po b){
  double L=0,Y,R=l,h;
  int cnt=50;
  while(cnt--){
    Y=(L+R)/2;
    h=sqrt(l*l-Y*Y);
    if(Abs(po(b.x,Y-b.y,h))-b.l*b.l<=EPS) R=Y;
    else L=Y;
  }
  return po(0,Y,h-EPS);
}

bool check(po a){
  for(int i=0;i<n;i++)
    if(Abs(po(a.p-bal[i].p,a.l))-bal[i].l*bal[i].l>EPS)return 0;
  return 1;
}

double solve(){
  if(n==1)return bal[0].l;
  double res=0;
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++){
      po a=get_po(bal[i],bal[j]);
      for(int k=0;k<n;k++){
	point p=bal[i].p-a.p,q=bal[k].p-a.p;
	q*=conj(p)/abs(p);
	po b=BinarySearch(a.l,po(q,bal[k].l));
	b.p=b.p*p/abs(p)+a.p;
	if(check(b))res=max(res,b.l);
      }
    }
  return res;
}

int main(){
  while(cin>>n,n){
    for(int i=0;i<n;i++) cin>>bal[i].x>>bal[i].y>>bal[i].l;
    printf("%.8f\n",solve());
  }
  return 0;
}

Measured memory_bytes: 1272
#include <iostream>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

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

void solve(int primes[], int n)
{
  for (int i = 3, pos = 0; i <= 55555; ++i) {
    // cout << is_prime(i) << endl;
    if (is_prime(i) && i % 5 == 1) {
      primes[pos] = i;
      ++pos;
      if (pos == n)
        break;
    }
  }
}

int main()
{
  int n;
  cin >> n;
  int primes[55];
  solve(primes, n);
  REP(i, n - 1)
    cout << primes[i] << " ";
  cout << primes[n - 1] << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
  int a,b,c,k;
  cin>>a>>b>>c>>k;
  while(!(b>a))
  {
    b*=2;
    k--;
  }
  while(!(c>b))
  {
    c*=2;
    k--;
  }
  
  if(k>=0)
  {
    cout<<"Yes";
  }
  else
  {
    cout<<"No";
  }
  return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
int check(int ans,int a[])
{
	while(ans)
	{
		int n = ans%10;
		if(a[n])
			return true;
		ans/=10;
	}
	return false;
}

int main()
{
	cin.tie(0);
    ios::sync_with_stdio(false);
	int n,k;
	cin>>n>>k;
	int a[10]={0};
	for (int i = 0; i < k; ++i)
	{
		int no;
		cin>>no;
		a[no]=1;
	}
	int ans=n;
	while(check(ans,a))
		ans++;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define re register
long long m[110],f[125010];
int p[110],v[110],p1[110],la[110];
inline bool cmp(re int a,re int b){return v[a]*m[b]>v[b]*m[a];}
int main()
{
	re int n,x,d,num=0,ans=0;
	scanf("%d%d%d",&n,&x,&d);
	v[1]=1;p1[1]=1;scanf("%lld",&m[1]);
	for(re int i=2;i<=n;i++)scanf("%lld%d",&m[i],&p[i]),v[i]=1,p1[i]=i;
	for(re int i=n;i>=2;i--)
	{
		m[p[i]]+=m[i];
		v[p[i]]+=v[i];
		num+=v[i]*std::min(n,d);
		la[i]=std::max(d-n,0);
	}
	la[1]=x;
	std::sort(p1+1,p1+n+1,cmp);
	for(re int i=1;i<=num;i++)f[i]=1ll<<60;
	for(re int i=2;i<=n;i++)
	{
		for(re int j=num;j>=0;j--)if(f[j]<(1ll<<60))
		{
			for(re int k=1;k<=std::min(n,d);k++)f[j+k*v[i]]=std::min(f[j+k*v[i]],f[j]+k*m[i]);
		}
	}
	for(re int i=0;i<=num;i++)
	if(f[i]<=x){
		re int x1=x-f[i],vv=i;
		for(re int j=1;j<=n;j++)
		{//printf("***%d %d %lld %d %d\n",i,p1[j],f[i],x1,vv);
			re int x2=std::min(x1/m[p1[j]],1ll*la[p1[j]]);
			vv+=x2*v[p1[j]];x1-=x2*m[p1[j]];
		}
		ans=std::max(ans,vv);
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 768
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <algorithm>
using namespace std; 
#define MAXN 9999
int main(int argc,char const* argv[])
{
  string s;
  cin >> s;
  if((s[0] == s[1] && s[1]==s[2]) || (s[1]==s[2] && s[2]==s[3]))
    {
      cout << "Yes" << endl;
      return 0;
    }
  else
    {
      cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#define llint long long

using namespace std;

int N;
int a[10];
string s;

llint calc(int bit)
{
	llint ret = 0;
	llint tmp = a[0];
	for(int i = 0; i < N-1; i++){
		if(bit & (1<<i)){
			ret += tmp;
			tmp = 0;
		}
		else tmp *= 10;
		tmp += a[i+1];
	}
	return ret + tmp;
}

int main(void)
{
	cin >> s;
	N = s.size();
	for(int i = 0; i < N; i++) a[i] = s[i] - '0';
	
	llint ans = 0;
	for(int i = 0; i < (1<< (N-1)); i++){
		ans += calc(i);
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
/***
 ** "Learn to forgive the ones who deserve it?and?the ones who don?t."
 **
***/

/**
  *  Author: dhruv_gheewala
  *  Problem: __________
  *  Date:   02.08.2020
  *  Time:   17:34:36
**/

#if __has_include("debug.h")
    #include "debug.h"
#else
    #include<bits/stdc++.h>
    using namespace std;
    
    #define fundri 108
    #define debug(...) 1729
#endif

#define int int64_t
typedef pair<int, int> pii;
typedef vector<int> vi;

const bool testcases = false;
#define ff first
#define ss second
#define endl '\n'
#define all(s) s.begin(), s.end()

// if vector isn't soted then it will remove consecutive same elements
#define make_unique(vec) vec.erase(unique(all(vec)), vec.end())
#define test int TC = 1;if(testcases)cin >> TC;for(int tc = 1 ; tc <= TC ; tc++)solve(), fundri
#define sort_by(cont,expr) sort(all(cont),[&](const auto &lhs,const auto &rhs){return expr;})

int seed; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline int rnd(int l = 0, int r = INT_MAX) {return uniform_int_distribution<int>(l, r)(rng);}

inline bool in_range(int a, int l, int r) {return (a >= l && a <= r);}
template<typename H, typename ...T>void inp(H &head) {cin >> head;}
template<typename H, typename ...T>void inp(H &head, T &...tail) {cin >> head;inp(tail...);}
template<typename T>bool isPrime(T n) {for(T i = 2; i * i <= n; i++)if(n % i == 0)return false; return n >= 2;}
template<typename T>inline istream &operator >>(istream &in, vector<T> &a) {for(T &x : a)in >> x; return in;}
template<typename T, typename U>inline istream &operator >>(istream &in, pair<T, U> &a) {in >> a.ff >> a.ss; return in;}

void solve();
void fast_io();

int32_t main(int32_t argc, char **argv)
{
    fast_io();
    test;
    return 0;
}

void solve()
{
    int n, d;
    cin >> n >> d;
    
    int u, v, ans = 0;
    long double dist;

    for(int i = 0 ; i < n ; i++) {
        cin >> u >> v;
        dist = sqrt(u * u + v * v);
        ans += (dist <= d);
    }
    cout << ans << endl;
}

void fast_io()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

#ifdef DHRUV_GHEEWALA
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
#endif
}

Measured memory_bytes: 3672
n = gets.to_i
an = gets.split(' ').map{|a|a.to_i}

l = Array.new(n+2, 0)
r = Array.new(n+2, 0)

1.upto(n) do | i |
  l[i]= (l[i-1]).gcd(an[i-1])
end
n.downto(1) do | i |
  r[i]= (r[i+1]).gcd(an[i-1])
end

max = 0
(1..n).each do | i |
  a = (l[i-1]).gcd(r[i+1])
  max = a if a > max
end
p max

Measured memory_bytes: 10124
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class ABC106_B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int ans = 0;
            for (int i = 1; i <= n; i++) {
                if (i % 2 == 1) {
                    int cnt = 0;
                    for (int j = 1; j <= i; j++) {
                        if (i % j == 0) {
                            cnt++;
                        }
                    }

                    if (cnt == 8) {
                        ans++;
                    }
                }
            }

            out.print(ans);
        }

    }
}



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

int main()
{
  int64_t N, sa = 0, sb = 0, minus = 0, cnt = 0;
  cin >> N;
  vector<int64_t> A(N), B(N), D(N);
  for (int i = 0; i < N; i++)
  {
    cin >> A.at(i);
    sa += A.at(i);
  }
  for (int i = 0; i < N; i++)
  {
    cin >> B.at(i);
    sb += B.at(i);
    D.at(i) = A.at(i) - B.at(i);
    if (D.at(i) < 0)
    {
      minus += D.at(i);
      cnt++;
    }
  }
  if (sb > sa)
  {
    cout << -1 << endl;
    return 0;
  }
  sort(D.begin(), D.end());
  for (int i = N - 1; i >= 0; i--)
  {
    if (minus >= 0)
      break;
    minus += D.at(i);
    cnt++;
  }
  cout << cnt << endl;
}

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

using namespace std;

int main()
{
    int n, t, a;
    double h, most = 10000000000;
    int result = 0;
    cin >> n >> t >> a;
    for(int i = 1; i <= n; ++i) {
        cin >> h;
        h = t - h * 0.006;
        if(most > abs(a - h)) {
            most = abs(a - h);
            result = i;
        }
    }
    cout << result << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(){
	int k,len;
	char s[101];
	scanf("%d",&k);
	scanf("%s",s);
	len = strlen(s);
	if(len <= k){
		printf("%s",s);
	}else{
		s[k] = '\0' ;
		printf("%s...",s);
	}
	return 0;
}

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

void swap(int & x, int & y)
{
	x = x ^ y;
	y = x ^ y;
	x = x ^ y;
}

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	
	if (a > b) swap(a, b);
	if (a > c) swap(a, c);
	if (b > c) swap(b, c);
	
	cout << c - a;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		int X = sc.nextInt();
		sc.close();
		int a = X - K + 1;
		int b = X + K - 1;
		String c = "";
		while(a<=b) {
			c += a + " ";
			a++;
		}
		System.out.println(c);
	}

}

Measured memory_bytes: 23764
n, m = map(int, input().split())
students=[]
for i in range(n):
    students.append(list(map(int, input().split())))
checkpoints=[]
for i in range(m):
    checkpoints.append(list(map(int, input().split())))

def dist(x, y):
    return abs(x[0]-y[0])+abs(x[1]-y[1])


for student in students:
    mini = [1e20, -1]
    for i in range(m):
        if dist(student,checkpoints[i]) < mini[0]:
            mini = [dist(student, checkpoints[i]),i]
    print(mini[1]+1)


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

int main()
{
    int n;
    scanf("%d",&n);
    vector <long long> a(n);
    for(auto&i : a)
        scanf("%d",&i);
    sort(a.begin() ,a.end());
    for(int i=1; i<n; i++)
        a[i] += a[i-1];
    for(int i=n-2; ~i; i--)
        if(2*a[i] < a[i+1]-a[i]){
            cout << n-i-1 << endl;
            return 0;
        }
    cout << n << endl;
}


Measured memory_bytes: 1024
import math


def is_prime(x: int):
    if x == 2:
        return True

    if x < 2 or x % 2 == 0:
        return False

    i = 3
    while i <= math.sqrt(x):
        if x % i == 0:
            return False
        i = i + 2
        
    return True


ans = 0
n = int(input())
for _ in range(n):
    x = int(input())
    if is_prime(x):
        ans = ans + 1

print(ans)




Measured memory_bytes: 5676
#include <bits/stdc++.h>
using namespace std;
using ll=long long int;
using lld=long double;
#define all(c) (c).begin(), (c).end()
#define rep( i, a, n ) for( int i=a; i<n; i++ )
#define repp( i, a, n, p ) for( int i=a; i<n; i+=p )
#define per( i, a, n ) for( int i=n-1; i>=a; i--)
#define pb push_back
#define mp make_pair
#define acc accumulate

int main () {
  string s;
  cin >> s;
  for ( ll i=0; i<s.size(); i++ ) { 
    if ( i % 2 == 0 ) {
      cout << s[i];
    }
  }
}



Measured memory_bytes: 512
from collections import Counter
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = Counter(A)
D = Counter(B)
for k, v in C.items():
    if v + D[k] > n:
        print("No")
        exit()
print("Yes")
seen = set()
L = []
E = dict()
for i, a in enumerate(A):
    if a not in seen:
        seen.add(a)
        if i != 0:
            E[A[i-1]] = i-1
E[A[-1]] = -1
seen = [False]*n
K = [-1]*n
M = []
for k, v in D.items():
    if k in C:
        M.append((C[k]+v, k))
M.sort(reverse=True)
for p, q in M:
    if q in D:
        s = D[q]
        i = E[q]
        for j in range(s):
            if seen[(i+j+1)%n]:
                break
            seen[(i+j+1)%n] = True
            K[(i+j+1)%n] = q
            D[q] -= 1
        else:
            D.pop(q)
            
            
for i in range(n-1, -1, -1):
    if K[i] == -1:
        for k in D.keys():
            if A[i] != k:
                K[i] = k
                break
        D[k] -= 1
        if D[k] == 0:
            D.pop(k)
print(*K)

Measured memory_bytes: 228404
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <stack> 
#include <map>
#include <queue>
#include <unordered_map>
#include <cassert>
#include <iomanip>
#include <cmath>
#include <cstring>
using namespace std;
#define pb 					push_back
#define FAST_IO          ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
template<typename T,typename S>
ostream& operator <<(ostream& os, pair<T, S> input) {
	os<<"("<<input.first<<", "<<input.second<<")";
	return os;
}
template<typename T>
ostream& operator <<(ostream& os, vector<T> input) {
	for(auto t: input)
		os << t <<"\n";
	return os;
}
template<typename T>
ostream& operator <<(ostream& os, set<T> input) {
	for(auto t: input)
		os << t <<"\n";
	return os;
}
int main() {
	//FAST_IO;
  	long long x;
  	cin >> x;
  	long long ans = (x/500)*1000 + ((x%500)/5)*5;
	  cout << ans << "\n";
	return 0;
}


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

#define ASC(vec) vec.begin(), vec.end()    // 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend() // 降順ソート 例：sort(DESC(vec));
#define rep(i, n) for (int i = 0; i < (n); i++)
#define Rep(i, n) for (int i = 1; i < n; i++)
#define REP(i, vec) for (auto i = vec.begin(); i != vec.end(); ++i)

const int       mod = 1000000007;
const int       inf = (1 << 21);
const long long INF = 1LL << 60;

using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;
using vll = vector<pair<ll, ll>>;

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; }
template<class T>
T GCD(T a, T b) { if (b == 0) return a; else return GCD(b, a % b); }
template<class T>
T LCM(T a, T b) { return a / GCD(a, b) * b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

int n, m, q;
int a[60], b[60], c[60], d[60];
int ans = 0;

void f(vi s) {
	if (s.size() == n + 1) {
		int tmp = 0;
		for (int i = 0; i < q; ++i) {
			if (s[b[i]] - s[a[i]] == c[i]) tmp += d[i];
		}

		ans = max(ans, tmp);
		return;
	}

	s.push_back(s.back());
	while (s.back() <= m) {
		f(s);
		s.back()++;
	}
}

int main() {
	cin >> n >> m >> q;
	rep(i, q) cin >> a[i] >> b[i] >> c[i] >> d[i];

	f(vi(1, 1));
	cout << ans << endl;
}

Measured memory_bytes: 3556
#include <stdio.h>

int main() {
    int h, w;
    while (1) {
        scanf("%d %d", &h, &w);
        if (h == 0 && w == 0) {break;}
        for (int i=0; i<h; i++) {
            for (int j=0; j<w; j++) {
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}


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

int main(){
  int n,m,ans;
  vector<int> v;
  cin >> n >> m;
  v.push_back(m);
  ans = m;
  for(int i=0; i<n-1; i++){
    cin >> m;
    ans ^= m;
    v.push_back(m);
  }
  for(int i=0; i<n; i++){
    int u = ans^v[i];
    if(i<n-1){
      cout << u << ' ';
    }
    else{
      cout << u << endl;
    }  
  }
}

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

public class Main {
    

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int n = Integer.parseInt(br.readLine());

        Deque<String> list = new ArrayDeque<>();

        for (int i = 0; i < n; i++) {
            String sp = br.readLine();
            if (sp.startsWith("insert")) {
                list.addFirst(sp.substring(sp.indexOf(" ") + 1));
            }else if (sp.equals("deleteFirst")) {
                list.removeFirst();
            } else if (sp.equals("deleteLast")) {
                list.removeLast();
            } else {
                list.remove(sp.substring(sp.indexOf(" ") + 1));
            }
        }
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        StringBuilder ans = new StringBuilder();
        ans.append(list.poll());
        for (String s : list) {
            ans.append(" ");
            ans.append(s);
        }
        bw.write(ans.toString());
        bw.newLine();
        bw.close();
        br.close();
    }
}



Measured memory_bytes: 159888
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <cmath>
#include <tuple>
#include <map>
#include <unordered_map>
using namespace std;
typedef long long ll;

int main(int argc, char *argv[])
{
	double n, k, i;
	cin >> n >> k;
	vector<double> p(n);
	double answer = 0;
	double tmp = 0;

	for (i = 0; i < n; i++) 
		cin >> p[i];

	for (i = 0; i < k; i++) 
		tmp += (p[i] + 1.0) / 2.0;
	answer = tmp;
	
	for (i = k; i < n; i++) {
		tmp -= (p[i - k] + 1.0) / 2.0;
		tmp += (p[i] + 1.0) / 2.0;
		if (tmp > answer)
			answer = tmp;
	}
	
	cout << fixed << setprecision(12) << answer << endl;

	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

signed main() {
    int n;
    cin >> n;
    int cnt[n + 1] = {};
    int a[n], b[n];
    rep(i, n) {
        cin >> a[i];
        cnt[a[i]]++;
    }
    rep(i, n) {
        cin >> b[i];
        cnt[b[i]]++;
    }
    for (int i = 1; i <= n; i++) {
        if (cnt[i] > n) {
            cout << "No" << endl;
            return 0;
        }
    }
    reverse(b, b + n);
    int ng = -1;
    rep(i, n) {
        if (a[i] == b[i]) {
            ng = a[i];
        }
    }
    if (ng == -1) {
        cout << "Yes" << endl;
        rep(i, n) {
            if (i) cout << " ";
            cout << b[i];
        }
        cout << endl;
        return 0;
    }
    vector<int> okidx, ngidx;
    rep(i, n) {
        if (a[i] != ng && b[i] != ng) {
            okidx.emplace_back(i);
        }
        if (a[i] == b[i]) {
            ngidx.emplace_back(i);
        }
    }
    if (ngidx.size() > okidx.size()) {
        cout << "No" << endl;
        return 0;
    }
    int cur = 0;
    rep(i, ngidx.size()) {
        swap(b[okidx[cur]], b[ngidx[i]]);
        cur++;
    }
    ng = -1;
    rep(i, n) {
        if (a[i] == b[i]) {
            ng = a[i];
        }
    }
    if (ng != -1) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    rep(i, n) {
        if (i) cout << " ";
        cout << b[i];
    }
    cout << endl;
    return 0;
}

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

int main(){
    int n,d;cin >> n;
    string s;cin >> s;
    cin >> d;
    string ans=s;
    for (int i = 0; i < n; i++) {
        if(!d) break;
        if(s[i]=='0'){
            ans[i]='1';
            d--;
        }
    }
    for (int i = n-1; i >=0 ; i--) {
        if(!d) break;
        if(s[i]=='1'){
            ans[i]='0';
            d--;
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3224
/*
No i'm not down, No I'm not out
*/
#include <bits/stdc++.h>
#define fast() ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll  long long
#define f(i,a,b) for(int i=a; i<b; i++)
#define pb push_back
#define MP make_pair
#define vi vector<int>
#define vll vector<long long>
#define M map<int,int>
#define F     first
#define S    second
#define nl "\n"
#define lb lower_bound
#define ub upper_bound
#define max(a, b) (a < b ? b : a)
#define min(a, b) (a > b ? b : a)
#define mem(a,n)  memset(a, n, sizeof(a))
#define all(v) v.begin(), v.end()
int dx[8] ={0, 0, 1, 1, 1, -1, -1, -1};
int dy[8] ={1, -1, -1, 0, 1, -1, 0, 1};
#define mod 10000007
#define N 100005

using namespace std;

int main()
{
    fast();
    int n, w;
    cin >> n >> w;
    ll dp[w+1] = {}, curr[w+1], weight, cost;
    dp[0] = 0;
    f(i, 0, n)
    {
        cin >> weight >> cost ;
        f(j, 1, w+1)
        {
            // cout<< j << " " << dp[j] <<" " << dp[j-weight] << "\n";
            if(j < weight)curr[j] = dp[j];
            else curr[j] = max(
                (dp[j-weight] + cost), dp[j]);
        }
        f(j, 1, w+1)dp[j] = curr[j] ;
        // cout << "\n";
    }
    cout<< dp[w] ;
    return 0;
}


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

const int MOD = 1000000007;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define copy(from, to) copy(from.begin(), from.end(), back_inserter(to))
#define sort(a) sort(a.begin(), a.end())
#define reverse(s) reverse(s.begin(), s.end())
#define p(s) cout << (s) << endl

typedef long long ll;
using namespace std;

template<class T>
void load(vector<T> &v, int n) {
  for (int i = 0; i < n; ++i) {
    T t;
    cin >> t;
    v.push_back(t);
  }
}

template<class T>
T max(vector<T> &v) {
  return *max_element(v.begin(), v.end());
}

template<class T>
T min(vector<T> &v) {
  return *min_element(v.begin(), v.end());
}

void py(bool isUpper = false) {
  if (isUpper) {
    p("YES");
  } else {
    p("Yes");
  }
}

void pn(bool isUpper = false) {
  if (isUpper) {
    p("NO");
  } else {
    p("No");
  }
}

int main() {
  const int dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
  const int dy[8] = {-1, -1, -1, 0, 0, 1, 1, 1};

  int h, w;
  cin >> h >> w;
  char table[50][50];
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      cin >> table[i][j];
    }
  }

  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      if (table[i][j] == '#') {
        cout << "#";
        continue;
      }

      int count = 0;
      for (int k = 0; k < 8; ++k) {
        int x = i + dx[k];
        int y = j + dy[k];

        if (x < 0 || x >= h) continue;
        if (y < 0 || y >= w) continue;

        if (table[x][y] == '#') {
          count++;
        }
      }

      cout << count;
    }
    cout << endl;
  }
}

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

void Main()
{
    int N, W;
    cin >> N >> W;
    vector<int> w(N), v(N);
    vector<vector<long>> nap(N, vector<long>(W+1));
    for (int i = 0; i < N; i++)
        cin >> w[i] >> v[i];

    for (int j = 0; j <= W; j++)
        if(j >= w[0]) nap[0][j] = v[0];
    for (int i = 1; i < N; i++)
    {
        cin >> w[i] >> v[i];
        for (int j = 0; j <= W; j++)
        {
            if(j >= w[i]){
                nap[i][j] = max(nap[i-1][j-w[i]] + v[i], 
                                nap[i-1][j]);
            }else{
                nap[i][j] = nap[i-1][j];
            }
        }
        
    }

    cout << nap[N-1][W] << endl;
}

int main(int argc, char **argv)
{
    Main();
    return 0;
}


Measured memory_bytes: 79488
#include<stdio.h>
int main() {
	long long int n, a[10000], tmp, ans=0;
	int i, j;
	scanf("%lld", &n);

	for (i = 0; i < n; i++) {
		scanf("%lld", &a[i]);
		ans = ans + a[i];
	}

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

	printf("%lld %lld %lld\n", a[n - 1], a[0], ans);
}


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

string S,T; int n,now,ok,nxt;
vector<int> pos[26];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> S >> T; n=S.size();
    for (int i=0;i<n;++i){
        pos[T[i]-'a'].emplace_back(i);
    }
    for (int s=0;s<2;++s){
        now=-1,ok=1;
        for (int i=s;i<n;i+=2){
            nxt=S[i]-'a';
            auto itr=upper_bound(pos[nxt].begin(),pos[nxt].end(),now);
            if (itr==pos[nxt].end()){ok=0; break;}
            now=*itr;
        }
        if (ok){cout << "Yes" << '\n'; return 0;}
    }
    cout << "No" << '\n';
}


Measured memory_bytes: 3252
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i < n; ++i)
#define repe(i, n) for(int i=0; i <= n; ++i)
#define repr(i, n) for(int i=n-1; i > 0; --i)
#define all(x) (x).begin(), (x).end()
#define pb(x) push_back(x)
using namespace std;
template <class T> bool chmax(T &a, const T &b) {if (a<b) {a = b; return 1;} return 0;}
template <class T> bool chmin(T &a, const T &b) {if (b<a) {a = b; return 1;} return 0;}
template <class T> using V=vector<T>;
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
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 main() {
    ll n, h;
    cin >> n;
    vector<ll> v;
    for(ll i=0; i<n; ++i) {
        cin >> h;
        v.pb(h);
    }
    vector<ll> cnt(n);
    for (ll i=1; i<n; ++i) {
        if (v[i-1] >= v[i]) {
            cnt[i] = cnt[i-1]+1;
        } else {
            cnt[i] = 0;
        }
    }
    sort(all(cnt));
    cout << cnt[n-1] << "\n";
}


Measured memory_bytes: 1908
#include <bits/stdc++.h>
#define  MOD 1000000007

using namespace std;
typedef long long ll;

ll n,a,b,mem[2][100005];
vector <vector<ll> >arr;

ll dp(int colAnt, ll x, ll fx){
    if(arr[x].size()==1 && arr[x][0]==fx){
        if(colAnt==0)return 1;
        else return 2;
    }
    if(mem[colAnt][x]!=-1)return mem[colAnt][x];
    ll res1=1;ll res2=1;
    for(long long i : arr[x]){
        if(i!=fx){
            res1=(res1*dp(1,i,x))%MOD;
            if(colAnt==1)
                res2=(res2*dp(0,i,x))%MOD;
        }
    }
    if(colAnt==1)res1+=res2;
    return mem[colAnt][x]=(res1)%MOD;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);cout.tie(nullptr);
    cin>>n;
    arr.resize(n+2);
    for(int i=0;i<n-1;i++){
        cin>>a>>b;
        arr[a].push_back(b);
        arr[b].push_back(a);
    }
    memset(mem,-1,sizeof(mem));
    cout<<dp(1,1,0);
}

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

int main(){
   char A[4];
   cin>>A;
   int k=0;
   for(int i=0;i<3;i++){
       if(A[i]=='A')k++;
   }
   if(k==0||k==3)printf("No\n");
   else printf("Yes\n");
}


Measured memory_bytes: 3632