akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Map = map<string,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
ll INF=1LL<<60;
ll MOD=1000000007;
 
 
 
int main(){
    ll N;
    cin >> N;
    for(ll i=1;i<=3500;i++){
     for(ll j=1;j<=3500;j++){
         if(4*i*j-N*j-N*i>0&&(N*i*j)%(4*i*j-N*j-N*i)==0){
             cout<<i<<" "<<j<<" "<<(N*i*j)/(4*i*j-N*j-N*i)<<endl;return 0;
         }
     ;}
    ;}
    
 
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	char a[3];
	int ans=700;
	for(int i=0;i<3;i++){
		cin>>a[i];
		if(a[i]=='o'){
			ans=ans+100;
		}
		/*else{
			ans=ans-100;
		}*/
	}
	cout<<ans;
}

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

int main(){
    string moto;
    int n;
    cin >>moto >> n;
    moto.size() <= 1000;
    string command, str, str1;
    int a, b;
    
    for(int i = 0; i < n; i++){
        cin >> command >> a >> b;
        command.size() <= 100;
        if(command == "replace"){
            cin >> str;
            moto = moto.replace(a, b - a + 1, str);
        } else if(command == "reverse"){
            str1 = moto.substr(a, b - a + 1);
            for(int j = 0; j < str1.size(); j++){
                moto[j + a] = str1[str1.size() - j - 1];
            }

        } else if(command == "print"){
            cout <<  moto.substr(a, b - a + 1) << endl;
        }
    }
    
    return 0;
}


Measured memory_bytes: 3216
def main():
  n, a, b = list(map(int, input().split()))
  if a == 0:
    return 0
  if b == 0:
    return n
  if n <= a:
    return n
  if (a + b) >= n:
    return a
  
  temp = n - a
  set_count = temp // (a + b)
  mod = temp % (a + b)
  blue_in_mod = 0 if mod <= b else mod - b
  
  return a + (set_count * a) + blue_in_mod

print(main())

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

bool is_prime(long long _Num){
    if(_Num < 2)return false;
    if(_Num % 2 == 0){
        if(_Num == 2)return true;
        else return false;
    }
    bool prime = true;
    for(long long i = 3; i <= sqrt(_Num); i += 2){
        if(_Num % i == 0){
            prime = false;
            break;
        }
    }
    return prime;
}

int main(){
    long long A, B;
    cin >> A >> B;
    if(A < B)swap(A, B);//A >= B
    
    set<long long> ans;
    ans.insert(1);
    for(long long i = 2; i <= sqrt(A); i++){
        if(A % i == 0){
            long long j = A / i;
            if(B % i == 0 && is_prime(i))ans.insert(i);
            if(B % j == 0 && is_prime(j))ans.insert(j);
        }
        if(B % i == 0){
            long long j = B / i;
            if(A % i == 0 && is_prime(i))ans.insert(i);
            if(A % j == 0 && is_prime(j))ans.insert(j);
        }
    }
    if(A == B && is_prime(A))ans.insert(A);
    
    cout << ans.size() << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[9]={1,0,-1,0,1,1,-1,-1,0};
const ll dx[9]={0,-1,0,1,1,-1,1,-1,0};
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;
}
vl topsort(vvl &g){
    ll n=g.size();
    vl ans,ind(n);
    rep(i,n)for(auto e:g[i])ind[e]++;
    queue<ll> que;
    rep(i,n)if(!ind[i])que.push(i);
    while(!que.empty()){
        ll v=que.front();que.pop();
        ans.pb(v);
        for(auto nv:g[v]){
            ind[nv]--;if(!ind[nv])que.push(nv);
        }
    }
    return ans;
}
int main(){
    ll n,m;cin >> n >>m;
    vvl g(n);rep(i,m){
        ll a,b;cin >> a >> b;
        g[a].pb(b);
    }
    vl ans=topsort(g);
    for(auto p:ans)cout << p <<endl;
} 


Measured memory_bytes: 3908
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[]args) {
		Scanner sc=new Scanner(System.in);
		int a[]=new int[5];

		for(int i=0;i<5;i++)
		a[i]=sc.nextInt();
		Arrays.sort(a);
		System.out.println(a[4]+" "+a[3]+" "+a[2]+" "+a[1]+" "+a[0]);
	}

}



Measured memory_bytes: 26316
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

typedef tree<int, null_type, less<int>, rb_tree_tag,
        tree_order_statistics_node_update>
        new_data_set;


#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PSET(x,y) fixed<<setprecision(y)<<x
#define pb push_back
#define pf push_front
#define mp make_pair
#define pii pair<int,int>
#define vi vector<int>
#define vip vector<pair<int,int> >
#define ff first
#define ss second
#define int long long
#define SIZE 200010
#define mod 1000000007
#define BIG 998244353
#define s(t) scanf("%d",&t)
#define p(t) printf("%d\n",t)
#define mii map<int,int>
#define MSET(table,i) memset(table, i, sizeof(table))
#define endl '\n'
#define tc int t;cin>>t;while(t--)
#define pi  3.1415926358
#define print(x) for(auto el: x) cout<<el<<" ";cout<<endl
#define bits(x) __builtin_popcount(x)
#define minimum(a,n) min_element(a,a+n)-a
#define maximum(a,n) max_element(a,a+n)-a
#define pqbig priority_queue<int>
#define pqsmall priority_queue<int,vector<int>,greater<int> >
#define all(v) v.begin(),v.end()
#define sitr set<int>:: iterator
#define mitr map<int,int>:: iterator


#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl


int32_t main()
{
    fast;
    int n;cin>>n;
    vip v;
    for(int i=0;i<n;i++)
    {
        int x,y;cin>>x>>y;
        v.pb(mp(y,x));
    }
    sort(all(v));
    int curtime=0;
    for(int i=0;i<n;i++)
    {
        int deadline=v[i].ff;
        int req=v[i].ss;
        if(curtime+req>deadline)
        {
            cout<<"No";
            return 0;
        }
        curtime+=req;
    }
    cout<<"Yes";
}

Measured memory_bytes: 6600
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <deque>

int main(){
  int X, Y, A, B, C;
  scanf("%d", &X);
  scanf("%d", &Y);
  scanf("%d", &A);
  scanf("%d", &B);
  scanf("%d", &C);
  std::vector<long long > p(A), q(B), r(C);
  for (int i=0; i<A; i++){
    scanf("%lld", &p[i]);
  }
  for (int i=0; i<B; i++){
    scanf("%lld", &q[i]);
  }
  for (int i=0; i<C; i++){
    scanf("%lld", &r[i]);
  }
  std::vector<int > ans;
  std::sort(p.begin(), p.end(), std::greater<long long>());
  std::sort(q.begin(), q.end(), std::greater<long long>());
  std::sort(r.begin(), r.end(), std::greater<long long>());
  long long sum = 0;
  for (int i=0; i<X; i++){
    ans.push_back(p[i]);
    sum += p[i];
  }
  for (int i=0; i<Y; i++){
    ans.push_back(q[i]);
    sum += q[i];
  }
  std::sort(ans.begin(), ans.end());
  int ansindex = 0;
  int Rindex = 0;
  while((Rindex<C) && (ansindex<ans.size()) && (r[Rindex]>ans[ansindex])){
    sum += r[Rindex]-ans[ansindex];
    Rindex++;
    ansindex++;
  }
  printf("%lld\n", sum);
  return 0;
}


Measured memory_bytes: 3704
#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 K;
    cin >> K;

    queue<ll> que;
    for (int i = 1; i <= 9; ++i) {
        que.push(i);
    }
    while (--K) {
        auto x = que.front();
        que.pop();
        if (x % 10 != 0) {
            que.push(10 * x + x % 10 - 1);
        }
        que.push(10 * x + x % 10);
        if (x % 10 != 9) {
            que.push(10 * x + x % 10 + 1);
        }
    }
    cout << que.front() << endl;

    return 0;
}

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

int main()
{
   int x,a,b;cin>>x>>a>>b;
   if(b-a>0){
       if(b-a>x){
           cout<<" dangerous ";
       } else {
           cout<<" safe ";
       }
   } else{
       cout<<" delicious ";
   }
   return 0;
}

Measured memory_bytes: 3612
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Edge=pair<int,int>;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
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;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll L,R,D;
  cin>>L>>R>>D;
  co(R/D-(L-1)/D);
  return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
typedef unsigned long long ll;
#define rep(i, n) for (int i=0;i < (int)(n);i++)

int a[3][100010];
int main(){
    int n;
    cin >> n;
    ll ans=0;
    vector<vector<ll>> dp(3,vector<ll> (n+1,0));
    for (int i=0;i<n;i++) for (int j=0;j < 3;j++) cin >> a[j][i];
    for (int i=1;i<=n;i++){
        for (int j=0;j<3;j++){
            for (int k=0;k<3;k++){
                if (j!=k) dp[j][i]=max(dp[j][i],dp[k][i-1]+a[j][i-1]);
            }
        }
    }
    for (int i=0;i<3;i++){
        ans=max(dp[i][n],ans);
    }
    cout << ans << endl;
    //printf("%lld\n",ans);
    
    return 0;
}


Measured memory_bytes: 3824
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<pi, pi> pp;
typedef pair<ll, ll> pl;
const double EPS = 1e-9;
const ll MOD = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;

ll kai[200001];
ll mokai[200001];
ll p;

ll mod_pow (ll x, ll y) {
    ll ret = 1;
    while (y) {
        if (y&1) ret = ret*x%p;
        x = x*x%p;
        y /= 2;
    }
    return ret;
}

void init (int _n) {
    kai[0] = 1;
    for (int i = 1; i <= _n; i++) kai[i] = kai[i-1]*i%p;
    for (int i = 0; i <= _n; i++) mokai[i] = mod_pow(kai[i],p-2);
}

ll conb (ll x, ll y) {
    ll z = x-y;
    ll ret = kai[x]*mokai[y]%p;
    ret = ret*mokai[z]%p;
    return ret;
}

ll c[3000];
ll prep[3000][3000];

int main() {
    cin >> p;
    init(3000);
    rep(i,p+1) {
        prep[i][0] = 1;
        for (int j = 1; j <= p; j++) prep[i][j] = prep[i][j-1] * i % p;
    }
    rep(i,p) {
        ll a; cin >> a;
        if (a == 0) continue;
        (c[0] += 1) %= p;
        rep(j,p) {
            (c[j] += -1 * conb(p-1, p-1-j) * prep[p-i][p-1-j] + p*p*p) %= p;
        }
    }
    rep(i,p) {
        cout << c[i];
        if (i != p-1) cout << " ";
    }
    cout << endl;
}

Measured memory_bytes: 71936
N,C,K = map(int,input().split())
T =[int(input()) for i in range(N)]

p = 0
r = 0
cnt = 1

T.sort()

for i in range(len(T)):
    if p == 0:
        p = 1
        q = T[i]
        r = 1
    elif p == 1 and q + K >= T[i] and r < C:
        r += 1
    else:
        cnt += 1
        p = 1
        q = T[i]
        r = 1

print(cnt)


Measured memory_bytes: 7420
import java.util.Locale;
import java.util.Scanner;

public class Main {
    public static void main(String [] args){
        Scanner sc = new Scanner(System.in).useLocale(Locale.US);
        int l = sc.nextInt(), r = sc.nextInt(), d = sc.nextInt();

        if(l % d != 0) l += (d - l % d);
        if(r % d != 0) r -= r % d;

        System.out.println((r - l) / d + 1);
    }
}


Measured memory_bytes: 35608
import scala.util.control.Breaks

object Main{
  def main(args: Array[String]) {
    val sc = new java.util.Scanner(System.in)
    val n = sc.nextInt
    var list = Seq.fill(n)(sc.nextInt)

    var count = 0
    val b = new Breaks
    b.breakable { while (true) {
      if (list.forall(_ % 2 == 0)) {
        list = list.map(_ / 2)
        count += 1
      } else
        b.break
    } }
    println(count)
  }
}


Measured memory_bytes: 25544
#include<bits/stdc++.h>
using namespace std;
 
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int a, b,c;
cin >> a >> b >> c;
(b - a == c - b) ? cout << "YES\n" : cout <<"NO\n";
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ri rd<int>
#define rep(i, a, b) for (int i = (a), _ = (b); i <= _; ++i)
#define per(i, a, b) for (int i = (a), _ = (b); i >= _; --i)
#define For(i, a, b) for (int i = (a), _ = (b); i < _; ++i)
const int maxN = 20;
const int maxS = (1 << 18) + 3;
const int INF = 2147483647;

template<class T> inline T rd() {
	bool f = 1; char c = getchar(); for (; !isdigit(c); c = getchar()) if (c == '-') f = 0;
	T x = 0; for (; isdigit(c); c = getchar()) x = x * 10 + c - '0'; return f ? x : -x;
}

int n, mask;
struct pii {
	int v, i;
	explicit pii(int _v = 0, int _i = 0) : v(_v), i(_i) { }
}mx[maxS], sc[maxS];
int ans[maxS];

void combo(pii &mx, pii &sc, pii &a, pii &b) {
	if (a.v > mx.v) { 
		sc = mx;
		mx = a;
	}
	else if (a.v == mx.v) { 
		if (a.i != mx.i) {
			sc = mx;
			mx = a;
		}
	}
	else if (a.v > sc.v) {
		sc = a;
	}

	if (b.v > sc.v) {
		sc = b;
	}
}

int main() {

	n = ri();
	mask = (1 << n) - 1;
	rep (s, 0, mask) mx[s] = pii(ri(), s), sc[s] = pii(-INF, -1);
	rep (s, 1, mask) {
		For (i, 0, n) if (s >> i & 1) {
			int t = s ^ (1 << i);
			combo(mx[s], sc[s], mx[t], sc[t]);
		}
	}

	rep (s, 0, mask) ans[s] = mx[s].v + sc[s].v;
	rep (s, 1, mask) ans[s] = max(ans[s], ans[s-1]);
	rep (s, 1, mask) printf("%d\n", ans[s]);

	return 0;
}


Measured memory_bytes: 8192
#include<stdio.h>
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MIN3(a, b, c) ((a) < (MIN(b, c)) ? (a) : (MIN(b, c)))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MAX3(a, b, c) ((a) > (MAX(b, c)) ? (a) : (MAX(b, c)))

int main(){
	int a,b,c;
	
	scanf("%d %d %d",&a,&b,&c);
	
	printf("%d %d\n",MIN3(a,b,c),MAX3(a,b,c));
	
	return 0;
	
}


Measured memory_bytes: 2104
import sys

# 実行環境(0:vscode, 1:atcoder)
MODE = 1

# 入力の次元
DIMENSION = 0

# int型に変換
INT_TYPE = 0

if not (MODE):
    with open("input.txt", "r") as f:
        s = f.read()
else:
    s = sys.stdin.read()

if DIMENSION == 0:
    if INT_TYPE == 1:
        s = int(s)
elif DIMENSION == 1:
    if INT_TYPE == 0:
        s = s.split()
    elif INT_TYPE == 1:
        s = [int(x) for x in s.split()]
elif DIMENSION == 2:
    if INT_TYPE == 0:
        s = [x.split() for x in s.splitlines()]
    elif INT_TYPE == 1:
        s = [[int(y) for y in x.split()] for x in s.splitlines()]

ss = [None for _ in range(len(s))]
for i, t in enumerate(s):
    if t == "?":
        ss[i] = "D"
    else:
        ss[i] = t
print(''.join(ss))


Measured memory_bytes: 11108
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll a, b, x;
    cin >> a >> b >> x;

    ll y = (a - 1) / x;
    ll z = b / x;
    if(a != 0)
        cout << z - y << endl;
    else
        cout << z + 1 << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
int a[300005];
map<int,int> mymap;
int ans;
 main()
{
    int n;
    cin>>n;
    for(int i =1; i<=n; i++){
        cin>>a[i];
    }
    for(int i =n; i>=1; i--){
        ans+=mymap[a[i] + i];
        mymap[i-a[i]]++;
    }
    cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 27792
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
	int i,j,sum,m,n,nn,x;
	while(1) {
		scanf("%d",&nn);
		if(nn==0) break;
		sum=0;
		x=1;
		for(i=1;i<=12;i++) {
			scanf("%d %d",&m,&n);
			sum+=m-n;
			if(sum<nn) x++;	
		}
		if(sum>=nn) printf("%d\n",x);
		if(sum<nn) printf("NA\n");
	}
	return 0;
}
	

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

template<typename T> void drop(const T &x){cout<<x<<'\n';exit(0);}

const long long MOD = 1e9+7;

int64_t powmod(int a, int n) {
  int64_t ans = 1;
  for(int i = 0; i < n; ++i) ans = (ans*a)%MOD;
  return ans;
}

void solve() {
  int n;
  cin >> n;
  int64_t ans = powmod(10,n) - powmod(9,n) - powmod(9,n) + powmod(8,n);
  ans %= MOD;
  cout << (ans+MOD)%MOD  << '\n';
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int T=1;
  //cin >> T;
  while(T--) solve();

  return 0;
}


Measured memory_bytes: 3600
// ConsoleApplication11.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//
 
#include "stdio.h"
 
int main()
{
	int N;
	int i;
	int count;
	i = 1;
	int answer;
	count = 0;
	scanf("%d", &N);
	for(i=0;i<4;i++){
		answer = N%10;
		if(answer == 2){
			count++;
		}
		N = N/10;
		
	}
 
	printf("%d\n", count);
 
    return 0;
}

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

using namespace std;

typedef long long ll;
// const ll mod = 1000000007;

int main() {
  int n,m;
  cin>>n>>m;
  vector<pair<int,int>> p(m);

  int ans = 0;
  for (int i = 0; i < m; i++) {
      cin>>p[i].second>>p[i].first;
  }
  sort(p.begin(),p.end());
  int endtime = 0;
  for (int i = 0; i < m; i++) {
    if (p[i].second >= endtime) {
      endtime = p[i].first;
      ans++;
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>
#include <typeinfo>

int main() {
  int total_time;
  std::cin >> total_time;

  int min_price;
  std::cin >> min_price;
  int max_profit = std::numeric_limits<int>::min();
  for (auto t = 1; t < total_time; t++) {
    int price;
    std::cin >> price;
    max_profit = std::max(max_profit, price - min_price);
    min_price = std::min(min_price, price);
  }
  std::cout << max_profit << '\n';
  return 0;
}

Measured memory_bytes: 3096
#include<stdio.h>
#include<string>
#include<map>
#include<iostream>

using namespace std;

int main(){
    int N;
    string S;
    map<string, int> result;
    result["AC"] = 0;
    result["WA"] = 0;
    result["TLE"] = 0;
    result["RE"] = 0;

    scanf("%d", &N);
    for(int i = 0; i < N; i++){
        cin >> S;
        result[S]++;
    }
    

    printf("AC x %d\nWA x %d\nTLE x %d\nRE x %d\n", result["AC"], result["WA"], result["TLE"], result["RE"]);
    return 0;
}

Measured memory_bytes: 3760
import math
import sys
def input():
    return sys.stdin.readline().rstrip('\n')

def calc(A, B, N):
    x = min(B - 1, N)
    return math.floor(A * x / B)

(A, B, N) = tuple([int(s) for s in input().split()])
print(calc(A, B, N))

Measured memory_bytes: 62196
#include<stdio.h>
 
int heap[500000];
int size;
 
void max_heapify(int heap[], int i) {
    int l = 2 * i + 1;
    int r = 2 * i + 2;
    int largest;
 
    if (l <= size && heap[l] > heap[i]) {
        largest = l;
    } else {
        largest = i;
    }
    if (r <= size && heap[r] > heap[largest]) {
        largest = r;
    }
 
    if (largest != i) {
        int tmp = heap[i];
        heap[i] = heap[largest];
        heap[largest] = tmp;
        max_heapify(heap, largest);
    }
}
 
void build_max_heap(int heap[]) {
    for (int i = size / 2; i >= 0; i--) {
        max_heapify(heap, i);
    }
}
 
int main(){
    scanf("%d", &size);
    for(int i=0; i<size; i++) {
        int tmp;
        scanf("%d", &tmp);
        heap[i] = tmp;
    }
 
    build_max_heap(heap);
    for(int i=0; i<size; i++) {
        printf(" %d", heap[i]);
    }
    printf("\n");
}


Measured memory_bytes: 3656
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

ll mpow(ll a, ll b){
	if(b==0) return 1;
	else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
	else return mpow(a,b-1) * a % MOD;
}
ll gcd(ll a, ll b){
	if(b==0) return a;
	else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
	if(kaijo_memo.size() > n) return kaijo_memo[n];
	if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
	while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
	return kaijo_memo[n];
}
ll nCr(ll n, ll r){
	if(n < r || r < 0) return 0;
	ll ret = 1;
	ret *= kaijo(n); ret %= MOD;
	ret *= mpow(kaijo(r), MOD-2); ret %= MOD;
	ret *= mpow(kaijo(n-r), MOD-2); ret %= MOD;
	return ret;
}

int main(void){
	ll n,m;
	cin>>n>>m;
	if(abs(n-m)>=2){
		cout<<0<<endl;
		return 0;
	}else if(abs(n-m) == 1){
		cout<<kaijo(n) * kaijo(m) % MOD <<endl;
	}else{
		cout<<kaijo(n) * kaijo(m) % MOD * 2 %MOD<<endl;
	}
	return 0;
}


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

int main(){
  int N; cin >> N;
  int X[N]; 
  for (int i=0; i<N; i++) {
    cin >> X[i];
  }
  int ans = 10000000;
  int sum;
  for (int j=1; j<=100; j++) {
    sum = 0;
    for (int i=0; i<N; i++) {
      sum += pow((X[i] - j), 2.0);
    }
    ans = min(sum, ans);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
  ll n;
  cin >> n;
  vl p(n);
  rep(i,n){
    cin >> p[i];
  }
  sort(p.begin(),p.end());
  p[n-1] /=2;
  ll sum=0;
  rep(i,n){
    sum +=p[i];
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mins(a,b) a=min(a,b)
#define maxs(a,b) a=max(a,b)
using namespace std;

const long long INF=9000000000000000;
int main(){
  long long n,b,ans=1;
  cin>>n;
  long long num[n];
  for(int i=0;i<n;i++){
    cin>>num[i];
  }
  for(int i=0;i<n;i++){
    b=__gcd(num[i],ans);
    ans=b*(num[i]/b)*(ans/b);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll n,cnt=0;
    cin>>n;
    unordered_map<string,long long> mp;
    string s;
    for(int i=0; i<n; i++){
        cin>>s;
        sort(s.begin(),s.end());
        mp[s]++;
    }
    for(auto itr :mp){
        cnt+=itr.second*(itr.second - 1)/2;
    }
    cout<<cnt<<endl;
    return 0;
}

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

int main (void){

    int N;
    cin >> N;

    vector<int> a(N);
    rep(i,N){
        cin >> a[i];
    }

    int cnt= 0,cnt2=0;
    rep(i,N){
        if((a[i] % 4) == 0){
            cnt++;
        }else if((a[i] % 2) == 0){
            cnt2++;
        }
    }
    int n = N/2;

    if( n <= cnt + (cnt2/2) ){
        cout << "Yes";
    }else{
        cout << "No";
    }


}


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

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

typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//定数
#define INF 1000000000 //10^9:極めて大きい値,∞
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second　//pairの二つ目の要素


int main(){
    int n;
    cin>>n;
    vector<double> p(n);
    rep(i,n) cin>>p[i];
    vector<double> dp(n+1);
    dp[0]=1.;
    for(int i=1;i<=n;i++) {
        vector<double> dpt(n+1);
        dpt[0]=dp[0]*(1.-p[i-1]);
        for(int j=1;j<=n;j++){
            dpt[j]=dp[j]*(1.-p[i-1])+dp[j-1]*p[i-1];
        }
        dp=dpt;
/*        for(int j=0;j<=n;j++) {
            cout<<dp[i]<<" ";
        } 
        cout<<endl;
*/

    }
    double ans=0.;
    for(int i=n/2+1;i<=n;i++) ans+=dp[i];
    cout<<fixed<<setprecision(9)<<ans<<endl;
}

Measured memory_bytes: 256
PROGRAM piyo
      IMPLICIT NONE
      integer(16) :: n,x,y
      integer(16),allocatable :: table(:,:)
      integer(16) :: i,j,k
      integer(16),allocatable :: ans(:)
      
      
      read*,n,x,y
      allocate( table(n,n),ans(n) )
      table = n*10
      ans = 0
      do i = 1,n-1
        do j = i+1,n
        !  if( i<=x .or. j>=y )then
            table(i,j) = min( j-i,abs(x-i) + 1 + abs(j-y) )
         ! else
         !   table(i,j) = j-i
        !  end if
          
          ans(table(i,j)) = ans(table(i,j)) + 1
        end do
      end do
      
      do k = 1,n-1
        print*,ans(k)
      end do
      
      do i = 1,n
      !  print*,table(i,:)
      end do
      
      END PROGRAM

Measured memory_bytes: 62848
T = int(input())

for _ in [0]*T:
    N = int(input())
    *A, = map(int,input().split())
    S = input()

    B = []
    ans = 0
    for s,a in zip(S[::-1],A[::-1]):
        if s=="0":
            B.append(a)
        else:
            # check
            C = B[:]
            for i in range(64):
                for b in C:
                    if (b >> i) & 1 == 1: break
                else:
                    continue
                if (a >> i) & 1 == 1: a ^= b
                for j,c in enumerate(C):
                    if (c >> i) & 1 == 1: C[j] ^= b
            if a!=0:
                ans = 1
                break
    print(ans)

Measured memory_bytes: 69620
#include <stdio.h>
int main()
{
  int hs,ms,ss,he,me,se,h,m,s;
  while((scanf("%d%d%d%d%d%d",&hs,&ms,&ss,&he,&me,&se)) != EOF){
    if(se < ss){
      s = (se+60) - ss;
      if(me == 0){
	me = 59;
	he -= 1;
      }else me -= 1;
    }else s = se - ss;
    if(me < ms){
      m = (me+60) - ms;
      he -= 1;
    }else m = me - ms;
    h = he - hs;
    printf("%d %d %d\n",h,m,s);
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define pb push_back
typedef long long ll;
typedef long double ld;

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

    ll N = 3e3 + 10, n, i, j;
    cin >> n;
    ll a[n], dp[N][N];
    for (i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    for (i = 0; i < N; i++)
    {
        for (j = 0; j < N; j++)
        {
            dp[i][j] = 0;
        }
    }

    for (i = n - 1; i >= 0; i--)
    {
        for (j = i; j < n; j++)
        {
            dp[i][j] = max(a[i] - dp[i + 1][j], a[j] - dp[i][j - 1]);
        }
    }

    cout << dp[0][n - 1] << "\n";

    return 0;
}

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

int x[1000],y[1000];
string lab[1000];

int main(){
	int n,m,s,g;
	while(cin >> n >> m >> s >> g && n){
		for(int i = 0 ; i < m ; i++){
			cin >> y[i] >> x[i] >> lab[i];
		}
		string memo[40];
		for(int i = 0 ; i < 40 ; i++) memo[i] = "~";
		memo[g] = "";
		int ref = 0;
		bool bad = 0;
		int p = 0;
		while(1){
			bool f = false;
			for(int j = 0 ; j < m ; j++){
				if(memo[x[j]]=="~") continue;
				string cost = lab[j]+memo[x[j]];
				if(cost < memo[y[j]]){
					memo[y[j]] = cost;
					f = true;
				}
			}
			if(!f) break;
			ref++;
			if(ref == (n+1)*6) { break;}
		}
		if(memo[s] == "~" || memo[s].length() > n*6) cout << "NO" << endl;
		else cout << memo[s] << endl;

	}
}

Measured memory_bytes: 0
#include <stdio.h>

#define Inf 1000000000
#define White 0
#define Gray 1
#define Black 2
#define Max 100

int n, dist[Max], p[Max], color[Max], M[Max][Max];

int prim() {
  int i, u, v;
  int sum = 0;

  for (i = 0; i < n; i++) {
    dist[i] = Inf;
    p[i] = -1;
    color[i] = White;
  }

  dist[0] = 0;

  while (1) {
    int min_d = Inf;
    u = -1;
    for (i = 0; i < n; i++) {
      if (min_d > dist[i] && color[i] != Black) {
        u = i;
        min_d = dist[i];
      }
    }

    if (u == -1)  break;
    color[u] = Black;

    for (v = 0; v < n; v++) {
      if (color[v] != Black && M[u][v] != Inf) {
        if (dist[v] > M[u][v]) {
          dist[v] = M[u][v];
          p[v] = u;
          color[v] = Gray;
        }
      }
    }
  }

    for (i = 0; i < n; i++) {
      if (p[i] != -1) sum += M[i][p[i]];
    }

  return sum;
}

int main() {
  int i, j, test;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      scanf("%d", &test);
      if (test == -1) {
        M[i][j] = Inf;
      } else {
        M[i][j] = test;
      }
    }
  }

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

  return 0;
}



Measured memory_bytes: 2064
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 30;
const int MOD = 1e9 + 7;

int main() {
  int64 n, m;
  scanf("%lld%lld", &n, &m);
  if (m >= n * 2) {
    int64 ret = n + (m - n * 2) / 4;
    printf("%lld\n", ret);
  } else {
    printf("%lld\n", m / 2);
  }
  return 0;
}


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

namespace AtCoder.Abc
{
    class B_166_TrickOrTreat
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数配列の入力
            var nArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

            List<long> N = new List<long>();

            // すぬけ君リスト
            for (int i = 0; i < nArray[0]; i++)
            {
                N.Add(i + 1);
            }

            for (int i = 0; i < nArray[1]; i++)
            {
                // 整数の入力
                int di = int.Parse(Console.ReadLine());

                // 整数配列の入力
                var Ak = Console.ReadLine().Split(' ').Select(j => long.Parse(j)).ToArray();

                for (int j = 0; j < di; j++)
                {
                    N.Remove(Ak[j]);
                }
            }

            Console.WriteLine(N.Count);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 28448
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define mod 1000000007
#define inf 1e18+9
#define fr first
#define sc second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pll pair<ll,ll>
#define vll vector<ll>
#define umap unordered_map<ll,ll>
#define lpq priority_queue<ll,vector<ll>,greater<ll>>
ll globe=0;
ll powe(ll n,ll r){if(!r)return 1;else if(r%2==0)return powe(n*n,r/2);else return n*powe(n*n,(r-1)/2);}

int32_t main(){
 
	ios::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);
    
	ll t=1;
	//cin>>t;
	while(t--){
	    string s;
	    cin>>s;
	    if(s[2]==s[3]&& s[4]==s[5])
	        cout<<"Yes\n";
	    else
	        cout<<"No\n";
	}
 
	return 0;
 
}
//BitMasking->setBit: n|(1<<i); unsetBit: n&!(1<<i); checkBit: n&(1<<i);
//ll idx=upper_bound(v.begin(),v.end(),val)-v.begin();
//v.erase(unique(v.begin(),v.end()),v.end());
//ll cnt=count(v.begin(),v.end(),val);
//bool f=find(v.begin(),v.end(),val);

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

void toBit(unsigned long x);



int main(void){
  unsigned long a,b;
  cin>>a>>b;
  toBit(a&b);
  toBit(a|b);
  toBit(a^b);
  return 0;
}

void toBit(unsigned long x){
  x=x%((unsigned long)pow(2,32));
  for(int i=31;i>=0;i--){
    if(pow(2,i)<=x){
      cout<<1;
      x-=pow(2,i);
    }
    else{
      cout<<0;
    }
  }
  cout<<endl;
}



Measured memory_bytes: 3268
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007
#define mod2 1000000000
#define mod1 998244353
#define lol ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(x) (x).begin(), (x).end()
#define F(i, n) for (ll (i) = 0; (i) < (n); (i)++)
#define pb push_back
#define pf push_front
#define mp make_pair
#define f first
#define ss second

int main()
{
    ll m,n;cin >> n >> m;
    ll k;cin>>k;
    ll mat[n][m];
    ll black = 0;
    for(ll i=0;i<n;i++)
    {
        for(ll j=0;j<m;j++)
        {
            char x;cin >> x;
            if(x=='.') mat[i][j] = 0;
            else {mat[i][j] = 1;black++;}
        }
    }
    ll row[n]={0};
    ll col[m]={0};
    for(ll i=0;i<n;i++)
    {
        for(ll j=0;j<m;j++)
        {
            row[i]+=mat[i][j];
        }
    }
    for(ll i=0;i<m;i++)
    {
        for(ll j=0;j<n;j++)
        {
            col[i]+=mat[j][i];
        }
    }
    ll cnt = 0;
    for(ll i=0;i<pow(2,n);i++)
    {
        for(ll j=0;j<pow(2,m);j++)
        {
            //cout << i << j << endl;
            vector <ll> c1;
            vector <ll> c2;
            for(ll ii=0;ii<n;ii++)
            {
                if((i&((ll)pow(2,ii)))!=0) c1.pb(ii);
            }
            for(ll ii=0;ii<m;ii++)
            {
                if((j&((ll)pow(2,ii)))!=0) c2.pb(ii);
                //else cout << j << ii << endl;
            }
             
            // for(auto k1:c1)
            // {
            //     cout << k1 << " ";
            // }
            // cout << endl;
            // for(auto k2:c2)
            // {
            //     cout << k2 << " ";
            // }
            // cout << endl;
            ll cn = black;
            if(c1.size()==0)
            {
               for(ll jj=0;jj<c2.size();jj++)
                {
                    cn = cn - (col[c2[jj]]);
                } 
                if(cn==k) cnt++; 
                continue;
            }
            if(c2.size()==0)
            {
               for(ll jj=0;jj<c1.size();jj++)
                {
                    cn = cn - (row[c1[jj]]);
                } 
                if(cn==k) cnt++; 
                continue;
            }
            for(ll ii=0;ii<c1.size();ii++) 
            {
                for(ll jj=0;jj<c2.size();jj++)
                {
                    cn = cn + mat[c1[ii]][c2[jj]];
                }
            }
            for(ll ii=0;ii<c1.size();ii++) 
            {
                cn = cn - row[c1[ii]];
            }
            for(ll jj=0;jj<c2.size();jj++)
            {
                cn = cn - col[c2[jj]];
            }
            if(cn==k) cnt++; 
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 4092
N = int(input())
ABC = [list(map(int, input().split())) for i in range(N)]
dp= [[0]*3 for i in range(N)]

for i in range(N):
    if i == 0:
        dp[0][0] = ABC[0][0]
        dp[0][1] = ABC[0][1]
        dp[0][2] = ABC[0][2]
    else:
        dp[i][0] = max(ABC[i][0]+dp[i-1][1], ABC[i][0]+dp[i-1][2])
        dp[i][1] = max(ABC[i][1]+dp[i-1][0], ABC[i][1]+dp[i-1][2])
        dp[i][2] = max(ABC[i][2]+dp[i-1][0], ABC[i][2]+dp[i-1][1])

print(max(dp[N-1]))


Measured memory_bytes: 50216
#include<bits/stdc++.h>
#define rep(i,f,n) for(ll i=(f); (i) < (n); i++)
#define repe(i,f,n) for(ll i=(f); (i) <= (n); i++)
using namespace std;
using ll = long long;
#define MOD (ll)1000000007
#define PI 3.14159265359
#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";
#define P pair<int, int>
#define dvec vector<vector<ll>>
//printf("%.10f\n")
//cout << fixed << setprecision(10);
template<class T> inline bool chmax(T& a, T b){if (a < b) { a = b; return true; } return false;}
template<class T> inline bool chmin(T& a, T b){if (a > b) { a = b; return true; } return false;}
ll INF = 1e+18;
int iINF = 1e9;


int main()
{
  int N; cin >> N;
  vector<double> arr(N);
  rep(i, 0, N) cin >> arr[i];
  vector<vector<double>> dp(N + 1, vector<double>(N + 1));
  dp[0][0] = 1.0;

  rep(i, 0, N){
    repe(k, 0, i){
      dp[i + 1][k + 1] += dp[i][k] * arr[i];
      dp[i + 1][k] += dp[i][k] * (1.0 - arr[i]);
    }
  }

  double ans = 0.0;
  repe(i, N / 2 + 1, N){
    ans += dp[N][i];
  }
  
  printf("%.10f\n", ans);

}


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

int main() {
  string s,t;
  cin >> s >> t;
  int n,m;
  n = s.size(); m = t.size();
  vector<vector<int>> dp(n+1, vector<int>(m+1,0));
  rep(i,1,n+1) rep(j,1,m+1) {
    if (dp[i-1][j-1] != dp[i][j-1] || dp[i][j-1] != dp[i-1][j]) {
      dp[i][j] = max(dp[i-1][j-1], max(dp[i][j-1], dp[i-1][j]));
      continue;
    }
    if (s[i-1] == t[j-1]) {
      dp[i][j] = dp[i-1][j] + 1;
    } else {
      dp[i][j] = dp[i-1][j];
    }
  }
  int i = n, j = m;
  vector<int> ans;
  while (i > 0 && j > 0) {
    if (dp[i-1][j] == dp[i][j-1] && dp[i][j-1] == dp[i-1][j-1]) {
      if (dp[i-1][j] != dp[i][j]) {
        ans.push_back(i-1);
      }
      i--; j--;
    } else {
      if (dp[i-1][j] == dp[i][j]) {
        i--;
      } else if (dp[i][j-1] == dp[i][j]) {
        j--;
      }
    }
  }
  revrep(i,ans.size(),0) {
    cout << s[ans[i]];
  }
  cout << endl;
  return 0;
}


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

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

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

    int sum = 0;
    for (int a : as) {
        sum += a;
    }
    int ave = sum / n;
    int ans = 1e9;
    for (int i = -1; i <= 1; i++) {
        int x = ave + i;
        int tmp = 0;
        for (int a : as) {
            tmp += (a - x) * (a - x);
        }
        if (tmp < ans) ans = tmp;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long 
signed main(void){
    int N;
    string S;
    cin>>N>>S;
    int l=0,r=0;
    for (int i = 0; i < N; i++) {
        if(S[i]==')'){
            if(l)l--;
            else r++;
        }else{
            l++;
        }
    }
    while(r--){
        S = "("+S;
    }
    l=r=0;
    for (int i = S.length()-1; i >= 0; i--) {
        if(S[i]=='('){
            if(r)r--;
            else l++;
        }else{
            r++;
        }
    }
    while(l--){
        S+=')';
    }
    std::cout << S << std::endl;
    return 0;    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
typedef long long llong;
const int inf = 1 << 20;
const int mod = 1e9 + 7;

int main() {
   int n;
   cin >> n;
   vector<int> p(n);
   rep(i, n) cin >> p[i];
   int ans = 0;
   for (int i = 1; i < n - 1; i++) {
      if (p[i] >= p[i - 1] && p[i] <= p[i + 1])
         ans++;
      else if (p[i] >= p[i + 1] && p[i] <= p[i - 1])
         ans++;
   }
   cout << ans << endl;
   return 0;
}

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

int main() {
    int N;
   cin >> N;
    if(N % 10 == 2 ||N % 10 == 4 || N % 10 == 5 || N % 10 == 7 || N % 10 == 9){
    cout << "hon" <<endl;
    }
    else if(N % 10 == 0 ||N % 10 == 1 ||N % 10 == 6 ||N % 10 == 8){
    cout << "pon" <<endl;
    }
    else if(N % 10 == 3){
    cout << "bon" <<endl;
    } 
    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int lli;

int main(){
    int l;
    cin >> l;
    int n=-1;
    for(int i=0; i<25; i++){
        if((1<<i & l) != 0) n=i;
    }
    
    vector<vector<int> > ans;
    for(int i=0; i<n; i++){
        ans.push_back(vector<int>{i+1, i+2, 0});
        ans.push_back(vector<int>{i+1, i+2, 1<<i});
    }

    int num = 1<<n;
    for(int i=n-1; i>=0; i--){
        if((1<<i & l) != 0){
            ans.push_back(vector<int>{i+1, n+1, num});
            num += 1<<i;
        }
    }

    cout << n+1 << " " << ans.size() << endl;
    for(vector<int> &a: ans){
        cout << a[0] << " " << a[1] << " " << a[2] << endl;
    }

    return 0;
}

Measured memory_bytes: 256
n = int(input())
x = [0] + list(map(int, input().split()))
y = [0] + list(map(int, input().split()))
tmp = [[0 for i in range(3)] for j in range(n+1)]
max = 0
for i in range(1, n+1, 1):
    absDiff = abs(x[i]-y[i])
    absDiff2 = absDiff * absDiff
    absDiff3 = absDiff2 * absDiff
    tmp[i][0] = tmp[i-1][0] + absDiff
    tmp[i][1] = tmp[i-1][1] + absDiff2
    tmp[i][2] = tmp[i-1][2] + absDiff3
    if absDiff > max:
        max = absDiff
print(tmp[n][0])
print(tmp[n][1] ** (1/2))
print(tmp[n][2] ** (1/3))
print(max)

Measured memory_bytes: 7836
#include<bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define I vector<int>
#define S set<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())
class Edge{
public:
    int from,to,value;
    Edge(int a,int b,int c){
        from = a;
        to = b;
        value = c;
    }
    Edge(int a,int b){
        from = a;
        to = b;
    }
};
int main(){
    string s;cin >> s;
    COUT(700+(count(ALL(s),'o')*100));
    return 0;
}


Measured memory_bytes: 764
# include <iostream>
using namespace std;
int main(){
  long long int t,n,i,sum; 
    cin>>n; 
   long long int ar[n];
    for(i=0;i<n;i++){
      cin>>ar[i];
      if(i==0){
        sum=ar[i];
      }
      else{
        sum=sum^ar[i];
      }
    }
    for(i=0;i<n;i++){
      cout<<(sum^ar[i])<<" ";
    }
  return 0;
}

Measured memory_bytes: 5188
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
int gcd(int a, int b) {return b == 0 ? a : gcd(b, a % b);}
using namespace std;
const int Max_N = 1e2+10;
const int Max_W = 1e5+10;
const int Max_value = 1e5+10;
long long v[Max_value];
int w[Max_W];
long long dp[2][Max_W];

int main() {
    int N;
    cin >> N;
    int W;
    cin >> W;

    for (int i = 1; i <= N; i++) {
        cin >> w[i] >> v[i];
    }
    
    int now = 1 , pre = 0;
    
    for (int i = 1; i <= N; i++) {
        swap(now, pre);

        for (int j = 0 ; j <= W; j++) {
            if (j >= w[i]) {
                dp[now][j] = max(dp[pre][j], dp[pre][j-w[i]]+v[i]);
            }
            else{
                dp[now][j] = dp[pre][j];
            }
        }
        
    }
    
    cout << dp[now][W];
    
    
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(){  
  int N,M,S=0,P,X;
  cin>>N;
  vector<int>T(N);
  for(int i=0;i<N;i++){
    cin>>T.at(i);
    S+=T.at(i);
  }
  cin>>M; 
  for(int i=0;i<M;i++){
    cin>>P>>X;
    cout<<S-T.at(P-1)+X<<endl;
  }
}

Measured memory_bytes: 256