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


using namespace std;

#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)

main(){
   int N;
   cin >> N;
   int W[N];
   int sum[N];
   FOR(i,0,N){
       cin >> W[i];
   }

   FOR(t,0,N){
       int  suma=0,sumb=0;
       FOR(j, 0 ,t){
           suma += W[j];
       }
       FOR(k, t, N){
           sumb += W[k];
       }
       sum[t] = abs(suma - sumb);
   }
   sort(sum, sum+N);
    cout << sum[0] << endl;
}

Measured memory_bytes: 256
#ifdef LOCAL
//#define _GLIBCXX_DEBUG
#endif
//#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;
typedef vector<vector<vector<ll>>> VVV;
typedef vector<vector<vector<vector<ll>>>> VVVV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define rEach(i, mp) for (auto i = mp.rbegin(); i != mp.rend(); ++i)
#ifdef LOCAL
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define dbgmint(n,arr) rep(i,n){cerr<<arr[i].x<<" ";}cerr<<endl;
#define dbgarrmint(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j].x<<" ";}cerr<<endl;}
#else
#define dbg(...)
#define dbgmap(...)
#define dbgarr(...)
#define dbgdp(...)
#define dbgmint(...)
#define dbgarrmint(...)
#endif
#define out(a) cout<<a<<endl
#define out2(a,b) cout<<a<<" "<<b<<endl
#define vout(v) rep(i,v.size()){cout<<v[i]<<" ";}cout<<endl
#define Uniq(v) v.erase(unique(v.begin(), v.end()), v.end())
#define fi first
#define se second

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

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,v.size())i>>v[j];return i;}

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int solve(){
    ll x,y;
    cin>>x>>y;
    ll a = (y-2*x);
    ll b = (4*x-y);
    bool ok = true;
    if(a<0)ok=false;
    if(b<0)ok=false;
    if(a%2!=0)ok=false;
    if(b%2!=0)ok=false;
    Yes(ok);
    return  0;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);
    solve();
}


Measured memory_bytes: 3652
s = gets.chomp.chars
ans = []
s.each_with_index do |le, idx|
  break if idx == s.size - 1
  if s[idx] == s[idx + 1]
    ans = [idx, idx + 1]
    break
  end 
  if s[idx] == s[idx + 2]
    ans = [idx, idx + 2]
    break
  end
end

if ans.empty?
  puts "-1 -1"
else
  puts "#{ans[0] + 1} #{ans[1] + 1}"
end

Measured memory_bytes: 19096
import java.util.*;

public class Main {
    
  public static void main(String[] args) {
   
      Scanner sc = new Scanner(System.in);                      
                   
      long X = sc.nextLong();
      long t = sc.nextLong();
      
      if(X - t <= 0){
          System.out.println(0);
          return;
      }else{
          System.out.println(X - t);
          return;
      }
  }            
    
}
    



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

using namespace std;

const int N=1e6+3;

#define pb push_back
#define all(x) (x).begin(),(x).end()
typedef long long ll;

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

const int inf=1e9;

int n,m,a[N],k,q,u,v,x,y,tc,c,l,r,ans,p,cnt,root[N],sz[N];

char s[N];

int main(){
	
	scanf("%s",s);
	n=strlen(s);
	stack<char> st;
	for(int i=0;s[i];i++){
		if (!st.empty() && st.top()!=s[i])
			st.pop();
		else
			st.push(s[i]);
	}
	
	printf("%d\n",n-st.size());
}



Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main() {
string z,x;
cin>>x;
z="7";
int length,c;
length=x.size();
for(c=0;c<=length;c=c+1){
    if(z[0]==x[c]){
        cout<<"Yes";
        return 0;
    }
    }
    cout<<"No\n";
return 0;
}



Measured memory_bytes: 3584
//失敗するからこそそこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
// ぜったいあきらめない
#include<bits/stdc++.h>
using namespace std;
 
#if defined(DAIJOBU)
#include "/home/ichigo/debug.hpp"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
#define FIO {ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);}


int main(){
	FIO
	
	long long n;cin >> n;
	int ans = 150;
	for(long long i = 1; i * i <= n; i++){
		if(n % i == 0){
			int now = max((int)to_string(i).size(), (int)to_string(n / i).size());
			ans = min(ans, now);
		}
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define IOS ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
#define ff first
#define ss second
#define pb push_back
#define debug(val) cerr << "The value of " << #val << " is = " << val << '\n';
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 0x3f3f3f3f;
const ll mininf = -922337203685477;
const ll nax = 1e5+5;
ll n, x, arr[nax];
vector<ll>v;	
	
int main(){
	IOS
	cin >> n >> x;
	arr[0]=x;
	for(int i=1;i<=n;i++){
		cin >> arr[i];
	}
	sort(arr, arr+n+1);
	for(int i=1;i<=n;i++){
		v.pb(arr[i]-arr[i-1]);
	}
	if(v.size()==1){
		cout << v[0] << '\n';
		return 0;
	}
	ll fpb=v[0];
	for(int i=1;i<=n;i++){
		fpb=__gcd(fpb, v[i]);
	}
	cout << fpb << '\n';
}


Measured memory_bytes: 5004
/**/
#include <bits/stdc++.h>
using namespace std;
/***********************************************/
/* Dear online judge:
 * I've read the problem, and tried to solve it.
 * Even if you don't accept my solution, you should respect my effort.
 * I hope my code compile and get accepted.
 *      ____________
 *     /         __ \
 *    /   __    |  | \
 *   /   |__|   |  |  \
 *  (           |__|   )
 *   \                /
 *    \      ___     /
 *     \____________/
 *
 *
 */
const long long mod = 1000000007;

pair<long long,long long> rng[100010];

pair<long long,long long> intr(long long a,long long b, long long c,long long d){
	return {max(a,c),min(b,d)};
}

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

	int N;
	cin>>N;
	long long res = 1ll;
	vector<long long> T(N),A(N);
	for(int i = 0;i < N;i++){
		cin>>T[i];
	}
	for(int i = 0;i < N;i++){
		cin>>A[i];
	}
	for(int i = 0;i < N;i++){
		if(i == 0 || T[i] > T[i-1]){
			rng[i] = {T[i],T[i]};
		}else{
			rng[i] = {1,T[i]};
		}
	}
	for(int i = N-1;i >= 0;i--){
		if(i == N-1 || A[i] > A[i+1]){
			rng[i] = intr(rng[i].first,rng[i].second,A[i],A[i]);
		}else{
			rng[i] = intr(rng[i].first,rng[i].second,1,A[i]);
		}
	}
	for(int i = 0;i < N;i++){
		res = res * max(0ll,rng[i].second - rng[i].first+1ll) % mod;
	}
	cout<<res<<'\n';
	return 0;
}
/**/


Measured memory_bytes: 3456
#include<stdio.h>
#include<algorithm>
#include<math.h>
using namespace std;
double PI=acos(-1.0);
double EPS=1e-9;
double ABS(double a){return max(a,-a);}
int main(){
	double acx,acy,acz,bcx,bcy,bcz;
	double avx1,avx2,avy1,avy2,avz1,avz2;
	double bvx1,bvx2,bvy1,bvy2,bvz1,bvz2;
	scanf("%lf%lf%lf%lf%lf%lf%lf%lf%lf",&acx,&acy,&acz,&avx1,&avy1,&avz1,&avx2,&avy2,&avz2);
	scanf("%lf%lf%lf%lf%lf%lf%lf%lf%lf",&bcx,&bcy,&bcz,&bvx1,&bvy1,&bvz1,&bvx2,&bvy2,&bvz2);
	int cnt=0;
	double wx=avy1*avz2-avz1*avy2;
	double wy=avz1*avx2-avx1*avz2;
	double wz=avx1*avy2-avy1*avx2;
//	printf("%f %f %f\n",wx,wy,wz);
	for(int i=0;i<10000;i++){
		double X1=bcx+bvx1*sin(PI*2/10000*i)+bvx2*cos(PI*2/10000*i);
		double Y1=bcy+bvy1*sin(PI*2/10000*i)+bvy2*cos(PI*2/10000*i);
		double Z1=bcz+bvz1*sin(PI*2/10000*i)+bvz2*cos(PI*2/10000*i);
		double X2=bcx+bvx1*sin(PI*2/10000*(i+1))+bvx2*cos(PI*2/10000*(i+1));
		double Y2=bcy+bvy1*sin(PI*2/10000*(i+1))+bvy2*cos(PI*2/10000*(i+1));
		double Z2=bcz+bvz1*sin(PI*2/10000*(i+1))+bvz2*cos(PI*2/10000*(i+1));
		double L=0;
		double R=1;
		double dist=999999999;
		for(int j=0;j<100;j++){
			double m1=(L*2+R)/3;
			double m2=(L+R*2)/3;
			double px=X1*m1+X2*(1.0-m1)-acx;
			double py=Y1*m1+Y2*(1.0-m1)-acy;
			double pz=Z1*m1+Z2*(1.0-m1)-acz;
			double qx=X1*m2+X2*(1.0-m2)-acx;
			double qy=Y1*m2+Y2*(1.0-m2)-acy;
			double qz=Z1*m2+Z2*(1.0-m2)-acz;
			double D1=ABS(px*wx+py*wy+pz*wz);
			double D2=ABS(qx*wx+qy*wy+qz*wz);
			dist=min(dist,min(D1,D2));
			if(D1<D2){
				R=m2;
			}else{
				L=m1;
			}
		}
	//	printf("%d: %f\n",i,dist);
		if(dist>EPS)continue;
		double x=X1*L+X2*(1.0-L)-acx;
		double y=Y1*L+Y2*(1.0-L)-acy;
		double z=Z1*L+Z2*(1.0-L)-acz;
		if(x*x+y*y+z*z<1.0)cnt++;
	}
	if(cnt==1)printf("YES\n");
	else printf("NO\n");
}

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

int A[100], N, sw;

int bubbleSort() {
    bool flag = 1;
    int sw = 0;
    int i = 0;

    while (flag) {
        flag = 0;
        for (int j = N - 1; j >= i; j--) {
            if (A[j] < A[j - 1]) {
                swap(A[j], A[j -1]);
                flag = 1;
                sw++;
            }
        }
        i++;
    }
    return sw;
}

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

    sw = bubbleSort();
    for (int i = 0; i < N; i++) {
        if (i) cout << " ";
        cout << A[i];
    }
    cout << endl;
    cout << sw << endl;
}



Measured memory_bytes: 3116
k, a, b = map(int, input().split())
k = max(0, k - a)
if k > 0 and a <= b:
  print(-1)
elif a == b:
  print(1)
else:
  print((k // (a - b) + int(k % (a - b) != 0)) * 2 + 1)

Measured memory_bytes: 3060
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            new Main().solve(sc);
        }
    }

    void solve(Scanner sc) {
        int n = sc.nextInt();
        char[] s = sc.next().toCharArray();
        int[] wSum = new int[n + 1];
        for (int i = 1; i <= n; i++) {
            wSum[i] = wSum[i - 1];
            if (s[i - 1] == 'W') {
                wSum[i]++;
            };
        }
        
        int ans = Integer.MAX_VALUE;
        for (int i = 1; i <= n; i++) {
            int turnToE = wSum[i - 1];
            int turnToW = n - i - (wSum[n] - wSum[i]);
            ans = Math.min(ans, turnToE + turnToW);
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 32292
import sys
input = sys.stdin.readline

N = int(input())
c = []
for _ in range(N):
    c.append(int(input()))

dp = [0] * N
dp[0] = 1
dpc = [0] * (max(c) + 1)
dpc[c[0]] = 1

for i in range(1, N):
    dp[i] = dp[i - 1]
    if c[i] != c[i - 1]:
        dp[i] += dpc[c[i]]
        dpc[c[i]] += dp[i - 1]

print(dp[N - 1] % (10**9+7))

Measured memory_bytes: 774428
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>

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

using namespace std;
typedef long long int ll;
const ll INF = 1000000000000000000;
const double PI = 3.1415926535897932;
const ll MOD = 1000000007;

int main()
{
    int r;
    cin >> r;
    cout << r * r << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdlib>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;

int main(){
    int N;
    cin >> N;
    vector<unsigned int> t(N+1), x(N+1), y(N+1);
    t[0] = x[0] = y[0] = 0;
    for(int i : irange(0, N)){
        cin >> t[i+1] >> x[i+1] >> y[i+1];
    }
    int t_diff;
    int x_diff;
    int y_diff;
    int l1;
    for (int i : irange(0, N)){
        t_diff = abs((int)(t[i + 1] - t[i]));
        x_diff = abs((int)(x[i + 1] - x[i]));
        y_diff = abs((int)(y[i + 1] - y[i]));
        l1 = x_diff + y_diff;
        if (t_diff < l1){
            cout << "No" << endl;
            return 0;
        }
        if (t_diff % 2 != l1 % 2){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

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

    int N;
    cin >> N;
    map<ll, int> mp;
    for (int i = 0; i < N; ++i) {
        int A;
        cin >> A;
        mp[A]++;
    }

    int cnt = 0;
    ll ans = 1;
    for (auto itr = mp.rbegin(); itr != mp.rend(); ++itr) {
        if (itr->second >= 4 && cnt == 0) {
            ans = itr->first * itr->first;
            cnt = 2;
            break;
        } else if (itr->second >= 2) {
            ans *= itr->first;
            cnt++;
            if (cnt == 2) break;
        }
    }

    cout << ((cnt == 2) ? ans : 0LL) << endl;

    return 0;
}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define ld long double
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }     //最小公倍数
using Graph = vector<vector<ll>>;
ll inf=300000000000000000;
const double PI = 3.14159265358979323846;
const int MAX = 510000;
const ll MOD = 1000000007;
int main(){
  int n;
  cin >> n;
  int u=1;
  while(u*(u-1)/2<n){
    u++;
  }
  if(u*(u-1)/2!=n){
    cout << "No" << endl;
    return 0;
  }
  Graph ans(u);
  int l=0,r=1;
  rep(i,n){
    ans.at(l).push_back(i+1);
    ans.at(r).push_back(i+1);
    if(r!=u-1)r++;
    else{
      l++;
      r=l+1;
    }
  }
  cout << "Yes" << endl;
  cout << u << endl;
  rep(i,u){
    cout << u-1 << " ";
    rep(j,u-2)cout << ans.at(i).at(j) << " ";
    cout << ans.at(i).at(u-2) << endl;
  }
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
#define ll long long
#define ALL(x) x.begin(),x.end()
#define MOD (1000000000+7)
using namespace std;
#define PI 3.14159265359
#define tMOD 998244353
#define mkpr(x,y) make_pair(x,y)



int main() {
  ll N;

  cin>>N;
  vector<ll> t(N);
   vector<string> s(N,"");

   for(ll i=0;i<N;i++){
     cin>>s[i]>>t[i];
   }

   string X;
   cin>>X;

ll ass=0;
ll tss=0;

ll bb=0;

for(ll i=0;i<N;i++){
     if(bb ==1){
       ass += t[i];
     }

     if(X==s[i]){
       bb=1;
     }
   }

cout<<ass<<endl;

return 0;
}


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

int main()
{
    int r; cin >> r;
    double s = 2*r*M_PI; 
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 3784
pub struct Scanner {
    line: Vec<String>,
    idx: usize,
}

#[allow(dead_code)]
impl Scanner {
    fn new() -> Scanner {
        return Scanner {
            line: vec![],
            idx: 0,
        };
    }
    fn next<T: std::str::FromStr>(&mut self) -> T {
        if self.idx == self.line.len() {
            let mut buffer = String::new();
            std::io::stdin().read_line(&mut buffer).ok();
            let a: Vec<&str> = buffer.trim().split(' ').collect();
            self.line = a.iter().map(|&s| String::from(s)).collect();
            self.idx = 0;
        }
        let ret: T = self.line[self.idx].parse::<T>().ok().expect("Parse error.");
        self.idx += 1;
        ret
    }
    fn next_string(&mut self) -> Vec<char> {
        let s: String = self.next();
        return s.chars().collect::<Vec<char>>();
    }
    fn next_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        let mut v: Vec<T> = Vec::with_capacity(n);
        for _i in 0..n {
            v.push(self.next());
        }
        v
    }
}

fn main(){
    let mut scan = Scanner::new();
    let r:f64 = scan.next();
    println!("{}", 2.0 * r * std::f64::consts::PI);
}


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

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

  int x[n], y[n];
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
  }

  vector<int> Idx(n);
  for (int i = 0; i < n; i++) {
    Idx[i] = i;
  }

  double total = 0.0;
  ll cnt = 0;
  do {
    for (int i = 0; i < n - 1; i++) {
      double x2 = x[Idx[i]] - x[Idx[i + 1]];
      double y2 = y[Idx[i]] - y[Idx[i + 1]];
      double dist = sqrt(x2 * x2 + y2 * y2);
      total += dist;
    }
    cnt++;
  } while (next_permutation(Idx.begin(), Idx.end()));

  cout << fixed << setprecision(10) << total / (double)cnt << endl;
}

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

int main(void) {
	// in
	int n;
	std::cin >> n;
	std::vector<int> a(n);
	for(int i = 0; i < n; ++i) std::cin >> a[i];

	// loop
	std::vector<int> b(n);
	for(int i = 0; i < n; ++i) {
		if(i % 2 == 0) b[i/2] = a[n-i-1];
		else b[n-(i+1)/2] = a[n-i-1];
	}

	// out
	for(int i = 0; i < n; ++i) std::cout << b[i] << " ";
	std::cout << std::endl;

	return 0;
}


Measured memory_bytes: 3840
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

bool dp[110][10110];

int main(){
	int n;
	cin >> n;
	dp[0][0] = true;
	vi v(n);
	rep(i, n) cin >> v[i];
	rep(i, n) {
		rep(j, 10010) {
			dp[i+1][j+v[i]] |= dp[i][j];
			dp[i+1][j] |= dp[i][j];
		}
	}
	int ans = 0;
	for(int i = 10010-1; i >= 0; i--) if(i % 10 != 0 && dp[n][i]) {
		ans = i;
		break;
	}
	cout << ans << endl;
	// rep(i, n+1)  {
	// 	rep(j, 50) {
	// 		cout <<" " << dp[i][j];
	// 	}
	// 	cout << endl;
	// }
}


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

#define ll long long
#define pll pair<ll,ll>
#define MAX 300005

ll n;

double dp[3005][3005], a[MAX], vis[3005][3005];

double solve(ll pos, ll heads)
{
	if(pos>=n)
	{
		if(heads>(n-heads))
		return 1.0;
		else
		return 0.0;
	}
	
	if(vis[pos][heads]) return dp[pos][heads];
	
	double p= a[pos]*solve(pos+1,heads+1) + (1.00-a[pos])*solve(pos+1,heads);
	
	vis[pos][heads]++;
	
	return dp[pos][heads]=p;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	
	cin >> n;
	
	for(int i=0;i<n;i++) cin >> a[i];
	
	cout << fixed << setprecision(15) << solve(0,0) << endl;
	
    return 0;
}


Measured memory_bytes: 142208
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);  
    int n,m;
    cin>>n>>m;
    int p;
    string s;

    bool a[n]={};//false
    int w[n]={};//0
    for(int i=0;i<m;i++){
        cin>>p>>s;
        if(a[p-1]==false){
            if(s=="AC"){
                a[p-1]=true;
            }else{
                w[p-1]++;
            }
        }
    }
    int ansa=0;
    int answ=0;
    for(int i=0;i<n;i++){
        if(a[i]){
            ansa++;
            answ+=w[i];
        }
    }
    cout<<ansa<<" "<<answ;

}

Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
long long int dp[2020][2020];
int main()
{
    long long int N,cake_size[2020],ans = 0;
    scanf("%lld",&N);
    for(int i = 0; i < N; i++)scanf("%lld",&cake_size[i]);
    for(int i = 0; i < N; i++)
    {
        if(N % 2)dp[i][i] = cake_size[i];
        else dp[i][i] = 0;
    }

    for(int i = 1; i < N; i++)
    {
        for(int j = 0; j < N; j++)
        {
            if(i % 2 ^ N % 2)
                dp[j][(N + j + i) % N] = max(dp[j][(N + j + i - 1) % N] + cake_size[(N + j + i) % N],
                                           dp[(j + 1) % N][(N + j + i) % N] + cake_size[j]);
            else dp[j][(N + j + i) % N] = cake_size[(N + j + i) % N] > cake_size[j]?
                                        dp[j][(N + j + i - 1) % N]:
                                        dp[(j + 1) % N][(N + j + i) % N];
            ans = max(ans,dp[j][(N + j + i) % N]);
        }
    }
    /*for(int i = 0; i < N; i++)
    {
        for(int j = 0; j < N; j++)
        {
            printf("%3d",dp[j][i]);
        }
        printf("\n");
    }*/
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 34780
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll t1,t2,t3;
const ll mod = 1000000007;
const int INF = 1e9;
const ll INFLONG = 1e18;
void swap(ll *x,ll *y){
  ll tmp;
  tmp = *x;
  *x = *y;
  *y = tmp;
}

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; 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;
  }
}

// 二項係数計算
long long COM(int n, int k){
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
  ll n,k;
  cin >> n >> k;
  ll ans = 0;

  // 前処理
  COMinit();
  ll ans_t;
  rep(i,n){
    if(i > k){
      break;
    }
    t1 = i;
    ans_t = COM(n-1,i);
    ans_t *= COM(n,i);
    ans_t %= mod;
    //cout << ans_t << endl;


    ans += ans_t;
    ans %= mod;
    //cout << ans << endl;
  }
  cout << ans << endl;
}

Measured memory_bytes: 12160
#include <cstdio>
#include <vector>
using namespace std;

int n, m;
vector <int> vt[100];

int main(){
	int i, a, s;
	scanf("%d %d", &n, &m);
	for(i = 0; i < m; i++){
		scanf("%d %d", &a, &s);
		vt[a].push_back(s);
		vt[s].push_back(a);
	}
	for(i = 1; i <= n; i++) printf("%d\n", vt[i].size());
	return 0;
}

Measured memory_bytes: 256
R, G, B, N = map(int, input().split())

count = 0

rmax = N // R
for r in range(rmax + 1):
    x = N - r * R
    gmax = x // G
    for g in range(gmax + 1):
        y = x - g * G
        if y >= 0 and y % B == 0:
            count += 1

print(count)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

int main() {
  string s, t;
  cin >> s;
  cin >> t;
  string ans;
  bool answer = false;
  if (s == t) answer = true;
  for (int i = s.size()-1; i > 0; i--) {
    if (s.at(i) == t.at(0)) {
      ans = s.substr(i, s.size()) + s.substr(0, i);
    }
  }
//  cout << ans << endl;
  if (ans == t) answer = true;
  if (answer) cout << "Yes" << endl;
  else  cout << "No" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a;
	int b;
	int h;
	int s;
	
	scanf("%d", &a);
	scanf("%d", &b);
	scanf("%d", &h);
	
	s = (a + b) * h / 2;
	
	printf("%d\n", s);
	
	return(0);
}
	

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

const ll INF = 1LL << 58;

//xより以下の要素へのindex
template <class T> int former(const vector<T> &v, T x) {
  return upper_bound(v.begin(), v.end(), x) - v.begin() - 1;
}
//x以上の要素へのindex
template <class T> int latter(const vector<T> &v, T x) {
  return lower_bound(v.begin(), v.end(), x) - v.begin();
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,x,res;
    cin>>n>>x;
    int ans=n;
    vector<int> m(n);
    rep(i,n){
        cin>>m[i];
    }
    res=x-accumulate(m.begin(),m.end(),0);
    int y=*min_element(m.begin(),m.end());
    ans+=res/y;
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<limits>
#define ll long long
#define F first
#define S second
#define pb push_back
#define oo (1LL<<63-1)
#define endl '\n'
#define si size()
#define all(v) v.begin(),v.end()
#define FASTIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define Matrix vector< vector < long long > >


using namespace std;

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

const long double Pi=acos(-1),e=2.718;
const int N=1e5+10,mod=1e9+7;

ll sqrt5(ll x){
    for(ll i=-1e3;i<=1e3;i++){
        if(i*i*i*i*i==x)return i;
    }
    return oo;
}

int main ()
{
    FASTIO
    ll n;
    cin >> n;
    for(ll i=-1e3;i<=1e3;i++){
        ll a = i*i*i*i*i;
        ll b5 = a-n;
        ll sq = sqrt5(b5);
        if(sq != oo){
            return cout << i << ' ' << sq << endl,0;
        }
    }
    return 0;
}
/**

*/


Measured memory_bytes: 3608
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func main() {
    let ab = readInts()
    let isEven = ab[0] * ab[1] % 2 == 0
    print(isEven ? "Even" : "Odd")
}

main()

Measured memory_bytes: 13596
'use strict'

const main = arg => {
    arg = arg.trim().split("\n")
    const N = ~~arg[0];
    const T = arg[1].split(" ").map(n=>~~n);
    const M = ~~arg[2];
    const drinks = arg.slice(3, M + 3).map(n=>n.split(" ").map(l=>~~l));
    
    const baseTime = T.reduce((m,n)=>m+n);
    
    for(let i in drinks) {
        console.log((baseTime - T[drinks[i][0] - 1]) + drinks[i][1]);
    }
}

main(require('fs').readFileSync('/dev/stdin', 'utf-8'))

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

#include <atcoder/all>
typedef long long lint;
using namespace std;
using namespace atcoder;

int n, m;
vector<string> s;

int p2i(int x, int y) {
    return x * m + y;
}

bool isEven(int x, int y) {
    return (x + y) % 2 == 0;
}

pair<int, int> i2p(int z) {
    return {z / m, z % m};
}

bool exist_right(int x, int y) {
    return y + 1 < m && s[x][y + 1] == '.';
}
bool exist_left(int x, int y) {
    return y - 1 >= 0 && s[x][y - 1] == '.';
}
bool exist_up(int x, int y) {
    return x - 1 >= 0 && s[x - 1][y] == '.';
}
bool exist_down(int x, int y) {
    return x + 1 < n && s[x + 1][y] == '.';
}

int main() {
    cin >> n >> m;
    s.resize(n);
    for (int i = 0; i < n; i++) {
        cin >> s[i];
    }
    int spring = n * m;
    int sink = n * m + 1;
    mf_graph<int> g(n * m + 2);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (isEven(i, j)) {
                g.add_edge(spring, p2i(i, j), 1);
            } else {
                g.add_edge(p2i(i, j), sink, 1);
            }
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (!isEven(i, j)) {
                continue;
            }
            if (s[i][j] != '.') {
                continue;
            }
            if (exist_right(i, j)) {
                g.add_edge(p2i(i, j), p2i(i, j + 1), 1);
            }
            if (exist_left(i, j)) {
                g.add_edge(p2i(i, j), p2i(i, j - 1), 1);
            }
            if (exist_down(i, j)) {
                g.add_edge(p2i(i, j), p2i(i + 1, j), 1);
            }
            if (exist_up(i, j)) {
                g.add_edge(p2i(i, j), p2i(i - 1, j), 1);
            }
        }
    }
    cout << g.flow(spring, sink) << endl;
    vector<string> ans = s;
    auto edges = g.edges();
    for (auto e : edges) {
        if (e.from == spring || e.to == sink) {
            continue;
        }
        if (e.flow < 1) {
            continue;
        }
        auto p = i2p(e.from);
        auto q = i2p(e.to);
        if (p.first < q.first) {
            ans[p.first][p.second] = 'v';
            ans[q.first][q.second] = '^';
        } else if (p.first > q.first) {
            ans[p.first][p.second] = '^';
            ans[q.first][q.second] = 'v';
        } else if (p.second < q.second) {
            ans[p.first][p.second] = '>';
            ans[q.first][q.second] = '<';
        } else {
            ans[p.first][p.second] = '<';
            ans[q.first][q.second] = '>';
        }
    }
    for (auto e : ans) {
        cout << e << endl;
    }
}

Measured memory_bytes: 5628
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] times = new int[n];
        int[] a = new int[n];
        long min = 999999999;
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            while (a[i] % 2 == 0) {
                a[i] = a[i] / 2;
                times[i]++;
            }
           
            if (min > times[i]) {
                min = times[i];
            }
        }

        System.out.println(min);


    }
}






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


Measured memory_bytes: 2664
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;

ll inf=9223372036854775806;

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);
	ll n,i,t,k,ans=inf;
	cin>>n;
	for (i=0;i<n;i++){
		cin>>t;
		k=0;
		while (t%2==0){
			t/=2;
			k++;
		}
		ans=min(ans,k);
	}
	cout<<ans;
	return 0;
}

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

int main()
{
    for(;;){
        int n;
        cin >> n;
        if(n == 0)
        return 0;

        vector<vector<string> > d(1000);
        vector<vector<int> > t(1000);
        for(int i=0; i<n; ++i){
            string s;
            int t1, t2;
            char c;
            int id;
            cin >> s >> t1 >> c >> t2 >> c >> id;
            d[id].push_back(s);
            t[id].push_back(t1*60 + t2);
        }

        vector<int> sum(1000, 0);
        for(unsigned i=0; i<t[0].size(); i+=2){
            int t1 = t[0][i];
            int t2 = t[0][i+1];
            for(int j=1; j<1000; ++j){
            for(unsigned k=0; k<t[j].size(); k+=2){
                if(d[0][i] != d[j][k])
                    continue;
                int t3 = t[j][k];
                int t4 = t[j][k+1];
                sum[j] += max(0, min(t2, t4) - max(t1, t3));
                }
            }
        }

        cout << *(max_element(sum.begin(), sum.end())) << endl;
    }
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  double sum = 0;
  cin >> n ;

  rep(i,n){
    int k;
    cin >> k;
    sum += k;
  }
  cout << (int)(sum / n)<<endl;
  return 0;
}

Measured memory_bytes: 2988
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp65 {
    class Program {
        static void Main(string[] args) {
            string s = Console.ReadLine();
            string t = Console.ReadLine();

            var s_ = s.ToCharArray();
            var t_ = t.ToCharArray();

            Array.Sort(s_);
            Array.Sort(t_);

            t_ = t_.Reverse().ToArray();


            //Console.WriteLine(string.Join("", s_));
            //Console.WriteLine(string.Join("", t_));

            int len_s = s_.Count();
            int len_t = t_.Count();

            for (int i = 0; i < Math.Min(len_s, len_t); i++) {
                if (s_[i] + 1 < t_[i] + 1) {
                    Console.WriteLine("Yes");
                    return;
                } else if (s_[i] + 1 > t_[i] + 1) {
                    Console.WriteLine("No");
                    return;
                }

                if (i == Math.Min(len_s, len_t) - 1 && len_s < t_.Length) {
                    Console.WriteLine("Yes");
                    return;
                }
            }

            Console.WriteLine("No");
        }
    }
}


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

using namespace  std;

int happy[100000+5][3];
int dp[100000+5][3];

int main() {
    int N;
    scanf("%d",&N);
    for(int i = 0 ;i < N; ++i) {
        for(int j = 0 ; j < 3 ; ++j)
            scanf("%d",&happy[i][j]);
    }
    dp[0][0] = happy[0][0];
    dp[0][1] = happy[0][1];
    dp[0][2] = happy[0][2];
    for(int i = 1; i < N ; ++i){
        for(int j = 0 ; j < 3; ++j) {
            dp[i][j] = max(dp[i][j], dp[i-1][(j+1)%3] + happy[i][j]);
            dp[i][j] = max(dp[i][j], dp[i-1][(j+2)%3] + happy[i][j]);
        }
    }
    int ans = 0;
    for(int i = 0 ;i < 3; ++i)
        ans = max(ans, dp[N-1][i]);
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 6160
// Problem E

#include <stdio.h>
#include <iostream>
#include <vector>
#include <string.h>
#include <cassert>
#include <algorithm>
#include <set>
#include <map>
#include <math.h>
#include <queue>
#include <stack>

#define MAXN 400000
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long int ll;
typedef pair<int, int> ii;

int n, m, b;
ii bombe[MAXN];
int col[MAXN], row[MAXN];
set<ii> coso;

int main() {
  cin >> n >> m >> b;
  ii a;
  for (int i=0; i<b; i++) {
    cin >> a.first >> a.second;
    col[a.second-1]++;
    row[a.first-1]++;
    coso.insert(mp(a.first-1,a.second-1));
  }
  
  int maxrow = 0;
  for (int i=0; i<n; i++) maxrow = max(maxrow, row[i]);
  vector<int> r;
  for (int i=0; i<n; i++)
    if (row[i] == maxrow)
      r.pb(i);
      
  int maxcol = 0;
  for (int i=0; i<m; i++) maxcol = max(maxcol, col[i]);
  vector<int> c;
  for (int i=0; i<m; i++)
    if (col[i] == maxcol)
      c.pb(i);
      
  bool ok = false;
  for (int i=0; i<(int)r.size() && !ok; i++)
    for (int j=0; j<(int)c.size() && !ok; j++)
      if (coso.find(mp(r[i],c[j])) == coso.end()) 
	ok = true;
	
  if (ok) cout << maxrow + maxcol << endl;
  else cout << maxrow + maxcol - 1 << endl;
  
  return 0;
}


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

#define FOR(i, j, k) for (int i = j; i < k; i++)
#define REP(i, j) FOR(i, 0, j)
#define fst first
#define snd second
#define pb push_back
#define eb emplace_back
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;

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 <typename T> istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec) {
        is >> x;
    }
    return is;
}

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int k, x;
    cin >> k >> x;

    for (int i = x - k + 1; i < x + k; i++) {
        cout << i << " ";
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()

se = list(set(A))

if len(A) == len(se):
	print("YES")
else:
	print("NO")

Measured memory_bytes: 27224
#include <iostream>
#include <vector>
#include <functional>
#include <algorithm>
#include <numeric>
#include <string>
#include <map>
using namespace std;

typedef long long ll;
int main()
{
        int N;
        cin >> N;
        vector<pair<ll ,ll>> pairs(N);
        ll Time = 0;
        for(int i=0; i<N; i++){

                cin >> pairs[i].second;
                cin >> pairs[i].first;
        }
        sort(pairs.begin(), pairs.end());
        int flag = 0;
        for(int i=0; i<N; i++){
                Time += pairs[i].second;
                if(Time > pairs[i].first){
                        cout << "No";
                        flag = 1;
                        break;
                }
        }
        if(flag == 0) cout << "Yes";

}

Measured memory_bytes: 3328
import math
inp = [input() for i in range(2)]
N = int(inp[0])
A = list(map(int, inp[1].split()))
# B = 0
d = {}
for k in A:
    # a = A.count(k)
    # B += (a - 1) / 2
    if k in d.keys():
        d[k] += 1
    else:
        d[k] = 1

# for k in range(N):
#     c = A.count(A[k]) - 1
#     counter = B - c
#     print(int(counter))

p = {}
for k in d.keys():
    cnt = d[k]
    p[k] = cnt * (cnt-1) / 2

total = sum(p.values())

for item in A:
    print(int(total - d[item] + 1))

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

#define INF (2e9)
#define FOR(i, a, b) for (ll (i) = (a); (i) < (b); ++(i))
#define REP(i, n) FOR(i, 0, n)

using namespace std;

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

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

using ll = long long;
using ld = long double;

#define ALL(x) (x).begin(), (x).end()
template<class T>
using vc = vector<T>;
using vi = vc<ll>;
using vvi = vc<vi>;

template<class T>
using va = valarray<T>;
using vad = va<ld>;
using vai = va<ll>;

vi Read(ll n) {
    auto      v = vi(n);
    for (auto i = std::size_t(0); i < n; ++i) {
        cin >> v[i];
    }
    return v;
}

template<class T>
void Dump(const T& A) {
    REP(i, A.size() - 1) cout << A[i] << " ";
    cout << A[A.size() - 1] << "\n";
}

template<class T>
void PushBack(T& v) {
    auto x = 0;
    cin >> x;
    v.push_back(x);
}

template<class T>
void RandomAccess(const T& v) {
    auto x = 0;
    cin >> x;
    cout << v[x] << endl;
}

template<class T>
void PopBack(T& v) {
    v.pop_back();
}

int main() {
    ll p;
    cin >> p;

    vi v;
    REP(i, p) {
        int query;
        cin >> query;
        if (query == 0) PushBack(v);
        else if (query == 1) RandomAccess(v);
        else if (query == 2) PopBack(v);
        else cout << "Error: query is not correct\n";
    }

    return 0;
}



Measured memory_bytes: 4916
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int D = sc.nextInt();

        for (int i = 0; i < 100000000; i++) {
            if ((2 * D + 1) * i >= N) {
                System.out.println(i);
                return;
            }
        }
    }
}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
int main() 
{
    //ifstream cin("input.in");
    //ofstream cout("output.out");
    ios::sync_with_stdio(0);cin.tie(0);
    long n,x;
    map<long,long> m;
    cin>>n;
    while(n--)
    {
        cin>>x;
        m[x-1]++;
        m[x+1]++;
        m[x]++;
    }
    long h=0;
    for(auto i:m)
        h=max(h,i.second);
    cout<<h;
    return 0;
}   

Measured memory_bytes: 6144
#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>;

int main() {
    int A, B;
    cin >> A >> B;
    if (A < B) {
        rep(i, B) cout << A;
        cout << endl;
    }

    else {
        rep(i, A) cout << B;
        cout << endl;
    }
}


Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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

    int n; cin>>n;
    int count = 0;
    vector<int> v(n+1);
    for(int i=1;i<=n;++i) cin>>v[i];

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

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

    for(int i=1;i<=n;++i)
    {   
        if(dp[v[i]]==0){
        for(int j=2*v[i];j<=max;j+=v[i])
        {
            dp[j]=1;
        }
        if(i!=n) if(v[i]==v[i+1]) dp[v[i]]=1;
        
        if(dp[v[i]]==0) count++;
        }
    }
    cout<<count;
}

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

int main() {
  double a,b,dx;
  int ix,tmp,ans;
  cin >> a >> b;
  dx = (a+b)/2;
  tmp = dx*10;
  ix = dx;
  tmp = tmp%10;
  tmp = (tmp*2)/10;
  ans = ix+tmp;
  cout << ans << endl;
}


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

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


Measured memory_bytes: 3636
#include<stdio.h>
#include<stdlib.h>
int main(){
  int n,i,j;
  long long int count,r=0,g=0,b=0;
  scanf("%d ",&n);
  char s[4010];
  for(i=0;i<n;i++){
    scanf("%c",&s[i]);
    if(s[i]=='R')
      r++;
    else if(s[i]=='G')
      g++;
    else
      b++;
  }
  count=r*g*b;
  for(i=0;i<n;i++){
    j=1;
    while(i+j+j<n){
      if(s[i]!=s[j+i] && s[j+i]!=s[j+j+i] && s[i]!=s[j+j+i])
        count-=1;
      j+=1;
    }
  }
  printf("%lld\n",count);
  return 0;
}


Measured memory_bytes: 1736
/*
	submission # - User: herp_sy
	https://atcoder.jp/contests/
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[])
{
	int a,b;
	int psum = 0;
	scanf("%d%d",&a,&b);
	for (int i = 1; i <= (b - a); ++i)	psum += i;
	printf("%d\n", psum - b);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long 
#define REP(i, a, b) for (ll i = a; i < b; i++)
#define REPI(i, a, b) for (ll i = b - 1; i >= a; i--)
#define i_os ios::sync_with_stdio(0);  cin.tie(0);  cout.tie(0);
#define INF (ll)1e18 + 100
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
#define MAX 1e6
/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit*/
#define o_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define o_setll tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
typedef tree<pair<ll, ll>,null_type,less<pair<ll, ll>>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

int main() 
{
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	ll val1 = (a+d-1)/d;
	ll val2 = (c+b-1)/b;
	if(val1 >= val2) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}  


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define endl enjoy_codeforces
using lint=long long;
int main(){
    std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
    lint n,k,q;std::cin>>n>>k>>q;
    std::vector<lint>a(n,k-q);
    while(q--){
        lint x;std::cin>>x;x--;
        a.at(x)++;
    }
    for(lint&x:a){
        std::cout<<(0<x?"Yes":"No")<<'\n';
    }
}


Measured memory_bytes: 1408