akhauriyash/Code-Regression huggingface dataset:
/* be name khoda */

// #define long_enable
#include <iostream>
#include <algorithm>
#include <cstring>
#include <numeric>
#include <vector>
#include <fstream>
#include <set>
#include <map>
using namespace std;

#ifdef long_enable
typedef long long int ll;
#else
typedef int ll;
#endif

typedef pair<ll, ll> pii;
typedef pair<pii, ll> ppi;
typedef pair<ll, pii> pip;
typedef vector<ll> vi;
typedef vector<pii> vpii;

#define forifrom(i, s, n) for (ll i = s; i < n; ++i)
#define forirto(i, n, e) for (ll i = (n) - 1; i >= e; --i)
#define fori(i, n) forifrom (i, 0, n)
#define forir(i, n) forirto (i, n, 0)

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define smin(a, b) a = min(a, (b))
#define smax(a, b) a = max(a, (b))

#define debug(x) cout << #x << " -> " << (x) << endl
#define debug2(x, y) cout << #x << ' ' << #y << " -> " << (x) << ' ' << (y) << endl
#define debug3(x, y, z) cout << #x << ' ' << #y << ' ' << #z << " -> " << (x) << ' ' << (y) << ' ' << (z) << endl
#define debug4(x, y, z, t) cout << #x << ' ' << #y << ' ' << #z << ' ' << #t << " -> " << (x) << ' ' << (y) << ' ' << (z) << ' ' << (t) << endl
#define debugp(x) cout << #x << " -> " << "(" << (x).F << ", " << (x).S << ")" << endl
#define debuga(x, n) cout << #x << " -> "; fori (i1_da, n) { cout << (x)[i1_da] << ' '; } cout << endl
#define debugap(x, n) cout << #x << " ->\n"; fori (i1_dap, n) { cout << "(" << (x)[i1_dap].F << ", " << (x)[i1_dap].S << ")\n"; } cout << endl
#define debugaa(x, n, m) cout << #x << " ->\n"; fori (i1_daa, n) { fori (i2_daa, m) { cout << (x)[i1_daa][i2_daa] << ' '; } cout << '\n'; } cout << endl
#define debugav(x, n) cout << #x << " ->\n"; fori (i1_dav, n) { fori (i2_dav, (x)[i1_dav].size()) { cout << (x)[i1_dav][i2_dav] << ' '; } cout << '\n'; } cout << endl
#define debugia(x, n) cout << #x << " ->\n"; fori (i1_dia, n) { cout << i1_dia << " : " << (x)[i1_dia] << '\n'; } cout << endl

const ll MOD = 1000000007;
const ll INF = 2000000000;
const long long BIG = 1446803456761533460LL;

#define Add(a, b) a = ((a) + (b)) % MOD
#define Mul(a, b) a = (1LL * (a) * (b)) % MOD

// -----------------------------------------------------------------------

const ll maxn = 3010;
const ll maxnlg = 20;

ll N, M;
ll dp[maxn][maxn][2];

int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    // ifstream cin("agc013_d.in");

    cin >> N >> M;
    dp[0][0][1] = 1;
    fori (i, N) dp[0][i + 1][0] = 1;
    fori (i, M) {
        fori (j, N + 1) {
            if (j > 0) {
                Add(dp[i + 1][j - 1][j == 1], dp[i][j][0]);
                Add(dp[i + 1][j][j == 1], dp[i][j][0]);
                Add(dp[i + 1][j - 1][1], dp[i][j][1]);
                Add(dp[i + 1][j][1], dp[i][j][1]);
            }
            if (j < N) {
                Add(dp[i + 1][j + 1][0], dp[i][j][0]);
                Add(dp[i + 1][j][0], dp[i][j][0]);
                Add(dp[i + 1][j + 1][1], dp[i][j][1]);
                Add(dp[i + 1][j][1], dp[i][j][1]);
            }
        }
    }
    ll ans = 0;
    fori (j, N + 1) Add(ans, dp[M][j][1]);
    cout << ans << '\n';

}


Measured memory_bytes: 70784
#include<bits/stdc++.h>
#define eps 1e-9
#define MOD1 998244353
#define MOD2 1000000007
#define INV_10 299473306
#define INF 1000000001
#define PI 3.14159265358979323846
using namespace std;
bool vu[1000005];
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int k;
	cin >> k;
	int nb=1;
	int cu=(7%k);
	while(true)
	{
		if(vu[cu])
		{
			cout << "-1\n";
			return 0;
		}
		if(cu==0)
		{
			cout << nb << '\n';
			return 0;
		}
		vu[cu]=1;
		cu=(cu*10)+7;
		cu%=k;
		nb++;
	}
}

Measured memory_bytes: 4616
import itertools
n, m, d = map(int, raw_input().split())

def solve():
    if d >= n:
        return 0.0
    if n == 1:
        return 1.0

    k = 1.0*(m - 1)*2/n**2
    t = n/2 if d == 0 else n - d
    return k*t

print("%.15f"%solve())


Measured memory_bytes: 2568
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1111;
#define INF 0x3f3f3f
int n;
struct qnode
{
	int v, c;
	qnode(int _v=0,int _c=0):v(_v),c(_c){}
	bool operator < (const qnode &r)const
	{
		return c > r.c;
	}
};
struct Edge
{
	int v,cost;
	Edge(int _v=0,int _cost =0):v(_v),cost(_cost){}
};
vector<Edge> E[maxn];
bool vis[maxn];
int dis[maxn];
void Dijkstra(int n, int s)
{
	memset(vis, false, sizeof(vis));
	fill(dis, dis + n, INF);
	priority_queue<qnode> que;
	while (que.size())que.pop();
	dis[s] = 0;
	que.push(qnode(s, 0));
	qnode temp;
	while (que.size())
	{
		temp = que.top();
		que.pop();
		int u = temp.v;
		if (vis[u])
			continue;
		vis[u] = true;
		for (int i = 0;i < E[u].size();i++)
		{
			int v = E[u][i].v;
			int cost = E[u][i].cost;
			if (!vis[v] && cost + dis[u] < dis[v])
			{
				dis[v] = dis[u] + cost;
				que.push(qnode(v, dis[v]));
			}
		}
	}
}
void addedge(int u, int v, int w)
{
	E[u].push_back(Edge(v, w));
}
int main()
{
	cin >> n;
	for (int i = 0;i < n;i++)
	{
		int a, b, w,k;
		cin >> a >> k;
		for (int j = 0;j < k;j++)
		{
			cin >> b >> w;
			addedge(a, b, w);
		}
	}
	Dijkstra(n,0);
	for (int i = 0;i < n;i++)
	{
		cout<<i<<" "<< dis[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 3128
import sys
N = int(input())
a = list(map(int, input().split()))
infi =100
#答えとなる変数
ans = 0

for i in range(infi):
    for j in range(len(a)):
        if(a[j]%2 != 0):
           print(ans)
           sys.exit()
        else:
            a[j] = a[j]/2
            
    ans +=1
print(ans)

Measured memory_bytes: 3060
A,B,C,D,E,F=map(int,input().split())
wDP=[False]*(F+1)
wDP[0]=True
water=[]
for i in range(1,int(F/100)+1):
    if(i>=B and wDP[i-B]):
        wDP[i]=True
    elif(i>=A and wDP[i-A]):
        wDP[i]=True
for i in range(F+1):
    if(wDP[i] and i!=0):
        water.append(i*100)
A,B=A*100,B*100
water=list(set(water))
ans=[water[0],0]
mconc=0
for x in water:
    up=min(x*E//100,F-x)
    sDP=[0]*(up+1)
    for i in range(1,up+1):
        if(i>=D):
            sDP[i]=max(sDP[i-1],sDP[i-C]+C,sDP[i-D]+D)
        elif(i>=C):
            sDP[i]=max(sDP[i-1],sDP[i-C]+C)
        else:
            sDP[i]=sDP[i-1]
    conc=100*sDP[-1]/(x+sDP[-1])
    if(conc>=mconc):
        mconc=conc;ans[0]=x+sDP[-1];ans[1]=sDP[-1]
print(*ans)

Measured memory_bytes: 3188
int main(){
	long long int n,k,total,mod;
  	scanf("%lld%lld",&n,&k);
  
  	total=n/k;
  
  	mod=n%k;
  
  	if(mod==0)
      	printf("0");
  	else
    {
      if((k-mod)<=mod)
    	printf("%lld",(k-mod));
      else
        printf("%lld",mod);
    }
 
}

Measured memory_bytes: 128
s = input()
n = len(s)

kaibun = 0
for i in range(n // 2):
    if s[i] == s[n - 1 - i]:
        kaibun += 1
    else:
        break

half_bun = 0
for i in range(n // 4):
    if s[i] == s[n // 2  - 1 - i] and s[(n + 3) // 2 - 1 + i] == s[n - 1 - i]:
        half_bun += 1
    else:
        break

if kaibun == n // 2 and half_bun == n // 4:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#define DEB
#include<bits/stdc++.h>
#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define ALL(t) (t).begin(),(t).end()
#define CLR(a) memset((a),0,sizeof(a))
#define pb push_back
#define mp make_pair
#define fr first
#define sc second

using namespace std;


#ifdef DEB
#define dump(x)  cerr << #x << " = " << (x) << endl
#define prl cerr<<"called:"<< __LINE__<<endl
template<class T> void debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr<<endl;}
#else
#define dump(x) ;
#define prl ;
template<class T> void debug(T a,T b){ ;}
#endif

template<class T> void chmin(T& a,const T& b) { if(a>b) a=b; }
template<class T> void chmax(T& a,const T& b) { if(a<b) a=b; }

typedef long long int lint;
typedef pair<int,int> pi;

namespace std{
  template<class S,class T>
  ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.fr<<','<<a.sc<<')';
    return out;
  }
}

//const int INF=5e8;
const lint INF=1e18;
int n;
vector<pi> g[150000];
lint dep[150000];
int size[150000];
void prep(int v,lint d){
  dep[v]=d;
  size[v]=1;
  for(auto e:g[v]){
    prep(e.fr,d+e.sc);
    size[v]+=size[e.fr];
  }
}
typedef pair<lint,lint> pl;
vector<pl> memo[150000];

lint K;
void dfs(int v){
  if(g[v].empty()){
    memo[v].clear();
    memo[v].pb(mp(0,0));
    return;
  }
  pi e1=g[v][0],e2=g[v][1];
  if(size[e1.fr]>size[e2.fr]) swap(e1,e2);

  dfs(e1.fr);
  dfs(e2.fr);
  for(auto& e:memo[e1.fr]) e.fr+=e1.sc,e.sc+=e1.sc;
  for(auto& e:memo[e2.fr]) e.fr+=e2.sc,e.sc+=e2.sc;

  vector<pl>& res=memo[v];
  res.clear();
  int x=e1.fr,y=e2.fr;
  for(auto e:memo[x]){
    int ub=lower_bound(ALL(memo[y]),mp(K-e.sc+1,-1ll))-memo[y].begin();--ub;
    if(ub>=0){
      pl a=mp(e.fr,memo[y][ub].sc);
      res.pb(a);
      res.pb({a.sc,a.fr});
    }
  }
  sort(ALL(res));
  lint evermin=INF;
  for(auto& e:res){
    if(e.sc>=evermin) e=mp(-1,-1);
    else chmin(evermin,e.sc);
  }
  res.erase(remove_if(ALL(res),[](pl a){
    return a==mp(-1ll,-1ll);
    }),res.end());
}

bool check(lint md){
  K=md;
  dfs(0);
  if(!memo[0].empty()) return true;
  return false;
}
int main(){
  cin>>n;
  REP(i,n-1){
    int a,v;scanf("%d%d",&a,&v);
    --a;
    g[a].pb(mp(i+1,v));
  }
  prep(0,0);

  lint lb=-1,ub=1e12;
  while(ub-lb>1){
    lint md=(lb+ub)>>1;
    if(check(md)) ub=md;
    else lb=md;
  }
  cout<<ub<<endl;
  return 0;
}





Measured memory_bytes: 32364
#![allow(unused_imports)]
#![allow(dead_code)]
#![macro_use]
use std::io::prelude::*;
use std::cmp::{max, min};
use std::collections::{HashSet, HashMap, BinaryHeap};

const MOD: i64 = 1e9 as i64 + 7;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

fn gcd(x: usize, y: usize)->usize{
    if y == 0{
        return x
    }
    gcd(y, x % y)
}

fn main() {
    input! {
        s: chars,
        w: usize,
    }
    let mut i = 0;
    while i < s.len(){
        print!("{}", s[i]);
        i += w;
    }
    println!();
}


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

int main(){
  int N, A, max, min;
  cin >> N >> A;
  max = A;
  min = A;
  for(int i=1; i<N; i++){
    cin >> A;
    if(A > max){
      max = A;
    }
    else if(A < min){
      min = A;
    }
  }
  cout << max - min << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
	
int main(){
	string A, B;
	cin >> A >> B;
	int a = A.size(), b = B.size();
	if(a > b) cout << "GREATER" << endl;
	else if(a < b) cout << "LESS" << endl;
	else if(a == b){
		if(A > B) cout << "GREATER" << endl;
		else if(A < B) cout << "LESS" << endl;
		else cout << "EQUAL" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    vll a(3);
    cin >> a[0] >> a[1] >> a[2];
    sort(a.begin(), a.end());
    if (~a[0]&1 || ~a[1]&1 || ~a[2]&1) cout << 0 << endl;
    else cout << a[0] * a[1] << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define BUGAVOID(x) x
#define rep(...) BUGAVOID(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define sz(c) ((int)(c).size())
#define all(c) (c).begin(),(c).end()
#define m0(a) memset(a,0,sizeof(a))
#define unq(v) v.erase(unique(v.begin(),v.end()),v.end());
#define mp make_pair
#define write(x) cout<<(x)<<endl
#ifdef LOCAL
#define debug(...) debug_vars(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#endif
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
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; }
const int INF = 1 << 28;
const double EPS = 1e-8;
const int MOD = 1e9 + 7;
const int MAX = 1e5 + 10;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

int N, M;
int a[MAX], b[MAX];

bool comp(const int i, const int j) {
    if (a[i] < a[j]) return true;
    if (a[i] > a[j]) return false;
    return b[i] < b[j];
}

int main()
{
    cin >> N >> M;
    rep(i, M) cin >> a[i] >> b[i];
    vector<int> dmnd; dmnd.resize(M);
    rep(i, M) dmnd[i] = i;
    sort(dmnd.begin(), dmnd.end(), comp);
    int ans = 0;
    for (int di = 0, dj = 0; di < M; di = dj) {
        int ulmt = b[dmnd[di]];
        dj = di;
        for ( ; dj < M; ++dj) {
            if (a[dmnd[dj]] >= ulmt) break;
        }
        rep(dk, di, dj) {
            chmin(ulmt, b[dmnd[dk]]);
        }
        for (dj = di; dj < M; ++dj) {
            if (a[dmnd[dj]] >= ulmt) break;
        }
        ans++;
    }
    write(ans);
}

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

typedef long long ll;

int main()
{
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll n;
    cin>>n;
    long double x = 2*(22.0/7.0)*n;
    cout<<x<<endl;
    
    return 0;
}

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

typedef long long ll;
ll a, b, ans = 1;

int main() {
    scanf("%lld%lld", &a, &b);
    while (a * 2 <= b) {
        a *= 2, ans++;
    }
    printf("%lld\n", ans);
    return 0;
}


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

using namespace std;
vector<vector<int> >adj2;
vector<int>vis;
vector<int>val;

int slv(int idx){
    int mx=0;
    for(int i=0;i<adj2[idx].size();i++){
        if(vis[adj2[idx][i]]==0){
            slv(adj2[idx][i]);
        }
        mx=max(mx,val[adj2[idx][i]]+1);
    }
    vis[idx]=1;
    return val[idx]=mx;
}

int main()
{
    int n,m;
    cin>>n>>m;
    vector<vector<int> >adj(n);
    for(int i=0;i<m;i++){
        int x,y;
        cin>>x>>y;
        x--;  y--;
        adj[y].push_back(x);
    }
    adj2=adj;
    val=vis=vector<int>(n);
    int ans=0;
    for(int i=0;i<n;i++){
        if(vis[i]==0)
            ans=max(ans,slv(i));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 22408
#include <iostream>
#include <algorithm>
#include <functional>
#include <set>
#include <vector>
#include <array>
#include <cmath>
#include <queue>
#include <numeric>

#define r(i, v, n) for(int i = v; i < n; i++)
#define re(i, v, n) for(int i = v; i <= n; i++)
#define rr(e, v) for(auto&& (e) : (v))

using namespace std;
using ll = long long;
using ul = unsigned long;

int main() {
    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;
    auto w = vector<int>(n);
    r(i, 0, n) {
        cin >> w[i];
    }

    int s1, s2;
    int smallest_t = INT32_MAX;
    r(i, 1, n) {
        s1 = accumulate(w.begin(), w.begin() + i, 0);
        s2 = accumulate(w.begin() + i, w.end(),0);
        int abs_t = abs(s1 - s2);
        smallest_t = abs_t < smallest_t ? abs_t : smallest_t;
    }

    cout << smallest_t << endl;

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)

using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;

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

    int n;
    cin>>n;
    vector<int> as(n);
    rep(i, n) cin>>as[i];

    as.erase(unique(as.begin(), as.end()), as.end());
    rep(i, as.size()) cout<<as[i]<<(i != as.size() - 1 ? ' ' : '\n');
}


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

const int64_t MOD=998244353;

int64_t modpow(int64_t a,int64_t n){
  int64_t res=1;
  if(n==0) return res;
  while(n>0){
    if(n&1) res=(res*a)%MOD;
    a=(a*a)%MOD;
    n >>= 1;
  }
  return res;
}


int main(){
  int N;
  cin>>N;
  vector<int64_t> D(N);
  for(int i=0;i<N;++i) cin>>D[i];
  int64_t ans=0;

  if(D[0]!=0) cout<<0<<endl;
  else{
    ans=1;
    map<int,int> S;
    for(int i=0;i<N;++i){
      ++S[D[i]];
    }
    if(S[0]>1) cout<<0<<endl;
    else{
      for(auto p:S){
        if(p.first>0){
        ans *= modpow(S[p.first-1],S[p.first]);
        ans %= MOD;
        }
      }
      cout<<ans<<endl;
    }
  }
}

Measured memory_bytes: 5760
#include<bits/stdc++.h>
 using namespace std;
 #define rep(i,n) for(int i=0; i<(n); i++)
 #define pb push_back
 #define all(v) (v).begin(),(v).end()
 #define fi first
 #define se second
 #define sz(x) ((int)(x).size())
 using ll=long long;
 typedef pair<int,int> pii;
 typedef pair<ll,ll> pll;
 #define MOD  1000000007
 const ll INF=1e18;
 template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<endl;}
 template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
 template<class T> inline bool chmin(T& a, T b) { if (a > b){ a = b; return 1; } return 0; }
 
 
 
 int main(int argc, char const *argv[]) {
   char c;
   cin >> c;
   cout << char(c+1) << endl;
   return 0;
 }

Measured memory_bytes: 3416
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
	static void Main() => new Program().Solve();

	void Solve()
	{
		var abc = ReadLongArray();
		var a = abc[0];
		var b = abc[1];
		var c = abc[2];
		var k = ReadLong();

		for (; b <= a; k--) b *= 2;
		for (; c <= b; k--) c *= 2;

		Console.WriteLine(k >= 0 ? "Yes" : "No");
	}

	#region Console.Read 関係
	long[] ReadLongArray() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
	long ReadLong() => long.Parse(Console.ReadLine());
	#endregion
}


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

int main()
{
	int N;
	cin >> N;
	vector<double> v(N);
	for (int i = 0; i < N; i++)
	{
		cin >> v[i];
	}
	sort(v.begin(), v.end());
	double ans = v[0];
	for (int i = 1; i < v.size(); i++)
	{
		ans = (ans + v[i]) / 2;
	}
	cout << ans << endl;
	return 0;
}


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

using namespace std;

int main(){
  vector<bool> v(26,false);
  char c;
  while(cin>>c){
    v[c-'a']=!v[c-'a'];
  }
  for(int i=0;i<26;i++){
    if(v[i]){
      cout<<"No"<<endl;
      return 0;
    }
  
  }
  cout<<"Yes"<<endl;
  return 0;
}

Measured memory_bytes: 256
# /user/bin/python
# -*- coding: utf-8 -*-
import numpy as np
import sys

N,W = map(int, sys.stdin.readline().rstrip().split())

dp = np.zeros(W+1, dtype=np.int64)

for _ in range(N):
  w,v = map(int, sys.stdin.readline().rstrip().split())
  np.maximum(dp[:-w]+v, dp[w:], out=dp[w:])

print(dp[-1])



Measured memory_bytes: 14568
from collections import deque
N = int(input())
E = [[] for _ in range(N+1)]
for i in range(N-1):
    u,v,w = map(int,input().split())
    E[u].append([u,v,w])
    E[v].append([v,u,w])
color = [-1]*(N+1)
color[1] = 0
e = deque(E[1])
while(e):
    v = e.popleft()
    if(color[v[1]] == -1):
        if(v[2]%2 == 0):
            color[v[1]] = color[v[0]]
        else:
            color[v[1]] = color[v[0]]^1
        for p in E[v[1]]:
            e.append(p)
for i in range(1,N+1):
    print(color[i])

Measured memory_bytes: 45356
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  vi v(3);
  cin>>v[0]>>v[1]>>v[2];
  sort(all(v));
  int ans=0;
  while(v[2]-v[1]>=2){
    v[1]+=2;
    ans++;
  }
  while(v[2]-v[0]>=2){
    v[0]+=2;
    ans++;
  }
  sort(all(v));
  if(v[0]==v[1]){
    if(v[1]!=v[2])ans++;
  }else{
    if(v[1]==v[2])ans+=2;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
  int x, y, i;
  scanf("%d %d", &x, &y);
  
  for (i = 0; i <= x; i++) {
    if ((i * 2 + (x - i) * 4) == y) {
      printf("Yes");
      return (0);
    }
  }
  
  printf("No");
  return (0);
}

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

int main() {
  string S;
  int price = 0;
  cin >> S;
  
  if (S.at(0) == 'o') price += 100;
  if (S.at(1) == 'o') price += 100;
  if (S.at(2) == 'o') price += 100;
 
  cout << 700 + price << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define dbug(x) cout<<#x<<"="<<x<<endl
#define m0(x) memset(x,0,sizeof(x))
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(ll i = n; i >= 0; i--)
#define reps(i, m, n) for(ll i = m; i < n; i++)
#define reprs(i, m, n) for(ll i = n; i >= m; i--)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef long long ll;
typedef pair<ll, ll> pl;

template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) is >> x;
  return is;
}

ll fu(ll b,ll n){
  if(n<b) return n;
  return fu(b,floor(n/b))+n%b;
}

int main(){

  ll n,s;
  cin >> n >>s;

  ll x=floor(sqrt(n));


  reps(i,2,x+2){
    if(fu(i,n)==s) {
      std::cout << i << '\n';
      return 0;
    }
  }

  reprs(j,1,min(x,s)){
    if((n-s+j)%j==0&&(n-s+j)/j>x&&(n-s+j)/j<=n) {
      if(fu((n-s+j)/j,n)==s) {
        std::cout << (n-s+j)/j << '\n';
        return 0;}
    }
  }

  if(n==s) {
  std::cout << n+1 << '\n';
  return 0;}

  std::cout << -1 << '\n';

  return 0;
}

// repのintをllにしてない
//


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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
#define LINF 1e18
typedef long long ll;


int main() {
    string s; cin >> s;
    string ans;
    int itr = 0;
    REP(i,s.size()){
        if(s[i] == 'B'){
            itr = max(0,itr-1);
        }else{
            ans[itr] = s[i];
            itr++;
        }
    }
    REP(i,itr){
        cout << ans[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define PI 3.14159265358979323
#define ll long long int
#define vi vector <int>
#define vl vector <ll>
#define all(v) (v).begin(),(v).end()
#define pb push_back
 
ll power(ll a, ll b){//a^b
    ll res=1;
    while(b>0){
        if(b&1){res=(res*a);b--;}
        a=(a*a);
        b>>=1;
    }
    return res;
}
 
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
 
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n;
	cin>>n;
	vl v(n);
	ll sum=0;
	for(ll i=0;i<n;i++)
		cin>>v[i];
	for(ll i=0;i<n;i++){
		for(ll j=i+1;j<n;j++)
			sum+=v[i]*v[j];
	}
	cout<<sum<<"\n";
}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
int main(){ 
    char c;
    cin>>c;
    if(c=='a'||c=='i'||c=='u'||c=='e'||c=='o'){
        cout<<"vowel";
    }else{
        cout<<"consonant";
    }
    return 0;
}


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

using namespace std;

int main() {
  int x, y;
  cin >> x >> y;
  for (int i = 0; i < 100; i++) {
    for (int j = 0; j < 100; j++) {
      int sum = 2 * i + j * 4;
      int num = i + j;
      if (sum == y && num == x) {
        cout << "Yes";
        return 0;
      }
    }
  }
  cout << "No";
  return 0;
}


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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
void tostr(ll x,string& res){while(x)res+=('0'+(x%10)),x/=10; reverse(ALL(res)); return;}
template<class T> inline bool chmax(T& a,T b){ if(a<b){a=b;return 1;}return 0; }
template<class T> inline bool chmin(T& a,T b){ if(a>b){a=b;return 1;}return 0; }
//template end

template<unsigned mod>struct mint {
   static int get_mod(){return mod;}
   int val;
   int inv() const{
      int tmp,a=val,b=mod,x=1,y=0;
      while(b)tmp=a/b,a-=tmp*b,swap(a,b),x-=tmp*y,swap(x,y);
      if(x<0)x+=mod; return x;
   }
   mint():val(0){}
   mint(ll x):val(x>=0?x%mod:mod+(x%mod)){}
   mint pow(ll t){mint res=1,b=*this; while(t){if(t&1)res*=b;b*=b;t>>=1;}return res;}
   mint& operator+=(const mint& x){if((val+=x.val)>=mod)val-=mod;return *this;}
   mint& operator-=(const mint& x){if((val+=mod-x.val)>=mod)val-=mod; return *this;}
   mint& operator*=(const mint& x){val=(ll)val*x.val%mod; return *this;}
   mint& operator/=(const mint& x){val=(ll)val*x.inv()%mod; return *this;}
   mint operator+(const mint& x)const{return mint(*this)+=x;}
   mint operator-(const mint& x)const{return mint(*this)-=x;}
   mint operator*(const mint& x)const{return mint(*this)*=x;}
   mint operator/(const mint& x)const{return mint(*this)/=x;}
   bool operator==(const mint& x)const{return val==x.val;}
   bool operator!=(const mint& x)const{return val!=x.val;}
};
using Mint=mint<1000000007>;
struct factorial {
   vector<Mint> Fact, Finv;
public:
   factorial(int maxx){
      Fact.resize(maxx+1),Finv.resize(maxx+1); Fact[0]=Mint(1); rep(i,0,maxx)Fact[i+1]=Fact[i]*(i+1);
      Finv[maxx]=Mint(1)/Fact[maxx]; rrep(i,maxx,0)Finv[i-1]=Finv[i]*i;
   }
   Mint fact(int n,bool inv=0){if(inv)return Finv[n];else return Fact[n];}
   Mint nPr(int n,int r){if(n<0||n<r||r<0)return Mint(0);else return Fact[n]*Finv[n-r];}
   Mint nCr(int n,int r){if(n<0||n<r||r<0)return Mint(0);else return Fact[n]*Finv[r]*Finv[n-r];}
};

int main(){
   int n; scanf("%d",&n);
   vector<int> a(n);
   rep(i,0,n)scanf("%d",&a[i]);
   Mint res; factorial fact(100010);
   Mint coeff[100010];
   coeff[0]=fact.fact(n-1);
   rep(i,0,n)coeff[i+1]+=coeff[i]+fact.fact(n-1)/(i+2);
   rep(i,0,n-1)res+=coeff[i]*(a[i+1]-a[i]);
   printf("%d\n",res.val);
   return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<cassert>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<bitset>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
typedef long long ll;
typedef long double ld;
#define str string
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct E {//辺の情報を入れる変数
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
ll ari(ll a, ll b, ll c) {
	return (a + b)*c / 2;
}//等差数列の和
ll fact(ll x, ll k, ll p) {//最大値、個数、あまり
	ll sum = 1;
	for (int i = 0; i < k; i++) {
		sum *= (x--);
		sum %= p;
	}
	return sum;
}//階乗(正）
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x%p;
		x = x * x%p;
		n >>= 1;
	}
	return res;
}//x^n%p
short ctos(char a) {
	return (int)(a - '0');
}
#define int long long
const long long Inf = 4523372036854775807;
const int inf = 15000000000;
//----------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++
int n;
int a[300000];
int b[100];
signed main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int ans = 0;
	int l = 0;
	for (int r = 0; r < n; r++) {
		int sum = 0;
		for (int i = 0; i < 30; i++) {
			if ((1 << i)&a[r]) {
				b[i]++;
				if (b[i] > 1) sum++;
			}
		}
		for (; sum > 0; l++) {
			for (int i = 0; i < 30; i++) {
				if ((1 << i)&a[l]) {
					b[i]--;
					if (b[i] == 1) sum--;
				}
			}
		}
		ans += (r - l + 1);
	}
	cout << ans << endl;
}

Measured memory_bytes: 1792
#include <cstdio>

typedef long long ll;
const int Maxn = 10003;

inline ll read() {
    ll f = 1, x = 0;
    char cp;
    while( cp < '0' || cp > '9' ) {
        cp = getchar();
        if(cp == '-') f = -1;
    }
    while( cp <= '9' && cp >= '0' ) {
        x = x * 10 + cp - 48;
        cp = getchar();
    }

    return f * x;
}

int main() {
    register int i, j;
    register int n;

    n = read();
    if(n < 1200) {
        puts("ABC");
        return 0;
    }
    if(n < 2800) {
        puts("ARC");
        return 0;
    }
    puts("AGC");
    return 0;
}


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

const int MOD=998244353;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

int main(){
	int a,b,c,K;cin>>a>>b>>c>>K;
	int sum=0;
	int d=min(a,K);
	sum+=d;K-=d;
	d=min(b,K);
	K-=d;
	d=min(c,K);
	sum-=d;K-=d;
	cout<<sum<<endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

struct UnionFind{
   vector<int> par;
   UnionFind(int n):par(n,-1){}
   int find(int x){
       if(par[x]<0)return x;
       return par[x]=find(par[x]);
   }
   bool unite(int x,int y){
       x=find(x);
       y=find(y);
       if(x==y)return false;
       if(par[x]>par[y]){
           par[y]+=par[x];
           par[x]=y;
       }
       else{
           par[x]+=par[y];
           par[y]=x;
       }
       return true;
   }

   bool same(int x,int y){
       return find(x)==find(y);
   }
   int size(int x){
       return -par[find(x)];
   }
};
int main(){
    int n,m,k;
    cin>>n>>m>>k;
    int c[n];
    int cnt=0;
    vector<int> cost;
    UnionFind uf(n+k);
    rep(i,n){
        cin>>c[i];
        --c[i];
        if(c[i]==-1)++cnt;
        else {
            uf.unite(i,c[i]+n);
            cost.push_back(0);
        }
    }
    int a[m],b[m],z[m];
    rep(i,m){
        cin>>a[i]>>b[i]>>z[i];
        --a[i];
        --b[i];
    }
    vector<int> ord(m);
    iota(ord.begin(),ord.end(),0);
    sort(ord.begin(),ord.end(),[&](int x,int y){
        return z[x]<z[y];
    });
    for(auto i : ord){
        if(uf.unite(a[i],b[i])){
            cost.push_back(z[i]);
        }
    }
    int s=cost.size();
    if(s+cnt<n+k-1){
        cout<<-1<<endl;
        return 0;
    }
    else {
        ll sum=0;
        rep(i,n+k-1-cnt){
            sum+=cost[i];
        }
        cout<<sum<<endl;
    }

    return 0;
}

Measured memory_bytes: 4088
L=list(input().split())
s=[]
for l in L:
  s.append(l)
  if l in ['+','-','*']:
    op=s.pop()
    b=int(s.pop())
    a=int(s.pop())
    s.append(a+b) if op=='+' else s.append(a-b) if op=='-' else s.append(a*b)
print(s[0])


Measured memory_bytes: 5600
# python 3.4.3
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# library
# -------------------------------------------------------------
class Combination:
    def __init__(self, n, mod):
        self.mod = mod
        self.fact = [1]*n
        self.finv = [1]*n
        self.inv  = [1]*n
        for i in range(2,n):
            self.fact[i] = (self.fact[i-1]*i) % self.mod
            self.inv[i]  = self.mod - self.inv[self.mod%i] * (self.mod//i)%self.mod
            self.finv[i] = self.finv[i-1] * self.inv[i] % self.mod
 
    def nCr(self, n, r):
        if n<r:
            return 0
        else:
            return self.fact[n] * (self.finv[r] * self.finv[n-r] % self.mod) % self.mod

mod = 10**9+7
Combination = Combination(200010, mod)

# -------------------------------------------------------------
# main
# -------------------------------------------------------------

N,M,K = map(int,input().split())

ans = 0
for d in range(1,N):
    t = d * Combination.nCr(N*M-2, K-2)
    t %= mod
    t *= (N-d)*M*M
    t %= mod
    ans += t
    ans %= mod
for d in range(1,M):
    t = d * Combination.nCr(N*M-2, K-2)
    t %= mod
    t *= (M-d)*N*N
    t %= mod
    ans += t
    ans %= mod

print(ans)


Measured memory_bytes: 26740
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    int n, m;
    map<int, int> d, t;
    cin >> n;
    rep(i, n) {
        int a; cin >> a;
        d[a]++;
    }
    cin >> m;
    rep(i, m) {
        int a; cin >> a;
        t[a]++;
    }

    bool ok = true;
    for (auto kv: t) {
        if (kv.second > d[kv.first]) ok = false;
    }
    cout << (ok ? "YES" : "NO") << endl;
}


Measured memory_bytes: 18944
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
using namespace std;
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n+1)
#define SUM(c) accumulate((c).begin(),(c).end(),0)
#define UNIQ(c) (c).erase(unique((c).begin(), (c).end()), (c).end());
#define Yn(b) puts(b?"Yes":"No")
#define YN(b) puts(b?"YES":"NO")
 
bool isprime(int p) {
  if (p==1) return false;
  FOR(i,2,p) {
    if (p%i==0) return false;
  }
  return true;
}

int main(){
  int n;
  cin >> n;
  if (n<1000) {
    cout << "ABC";
  } else {
    cout << "ABD";
  }
  return 0;
}

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

int main() {
	ios_base::sync_with_stdio( false );

	int N;
	cin >> N;

	int result = 0;
	int x = 0;

	for( int i = 1; i <= N; ++i ) {
		int y = 0;

		for( int j = i; j > 0; j /= 2 ) {
			y += 1;
		}

		if( y > x ) {
			x = y;
			result = i;
		}
	}

	cout << result << endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

#define MOD 1000000007
#define PI 3.14159265358979

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

using namespace std;

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};

typedef vector< edge > edges;
typedef vector< edges > graph;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;

template < typename T >
bool chmin(T &x, const T &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T >
bool chmax(T &x, const T &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(11);
	}
};
initializer _____;

int N, M, K, T, Q;
int main() {
	double A, B, X;
	cin >> A >> B >> X;
	X /= A;
	double ans;
	if (X > A * B / 2) {
		ans = 180 * atan(2 * (A * B - X) / (A * A)) / PI;
	} else {
		ans = 180 * atan(B * B / (2 * X)) / PI;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512
import scala.io.StdIn.readLine;
object Main {
    def main(args: Array[String]): Unit = {
        val stack = new LongStack(100)
       for (i <- readLine.split(" ")) {
            if (i  == "+") {
                stack.push(stack.pop + stack.pop);
            } else if (i == "*"){
                stack.push(stack.pop * stack.pop);
            } else if (i == "-") {
                val a = stack.pop;
                stack.push(stack.pop - a);
            } else {
                stack.push(i.toLong);
            }
        }
        println(stack.pop);
    }
}
class LongStack(size: Int) {
    val arr = new Array[Long](size);
    var ptr = 0;
    def push(e: Long): Unit = if (ptr < size) {
        arr(ptr) = e;
        ptr += 1;
    }
    def pop: Long = if (ptr > 0) {
        ptr -= 1;
        arr(ptr);
    } else {
        throw new NoSuchElementException();
    }
}


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

int main(){
    int box[100][100];

    
    int r, c;
    cin >> r >> c;

    for(int i=0; i<r; i++){
        for(int j=0; j<c; j++){
            cin >> box[i][j];
        }
    }
    
    for(int i=0; i<r; i++){
        int sum = 0;
        for(int j=0; j<c; j++){
            sum += box[i][j];
            cout << box[i][j] << " ";
        }
        cout << sum << endl;
    }
    
    int allsum = 0;
    for(int j=0; j<c; j++){
        int sum = 0;
        for(int i=0; i<r; i++){
            sum += box[i][j];
        }
        cout << sum << " ";
        allsum += sum;
    }
    cout << allsum << endl;
    
//    int sum = 0;
//    for(int i=0; i<r; i++)
//        for(int j=0; j<c; j++)
//            sum += box[i][j];
//    cout << sum << endl;
    
    return 0;
}



Measured memory_bytes: 3116
H, W =list(map(int, input().split()))
X = []
def neibour(x,y):
    try:
        if X[x][y] == '#':
            return 1
        else:
            return 0
    except:
        return 0
for i in range(H):
    X.append(list(input()))
for i in range(H):
    for j in range(W):
        if X[i][j] == '#':
            c = 0
            c += neibour(i+1,j)
            c += neibour(i-1,j)
            c += neibour(i,j+1)
            c += neibour(i,j-1)
            if c == 0:
                print('No')
                exit()
print('Yes')


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

const int MAXN = 1e4 + 10;
int arr[MAXN];

int main()
{
	int N, ans;
	cin>>N;
	
	for(int i = 0; i < N; i++)
	{
		cin>>arr[i];
	}
	
	for(int i = 0; i < N; i++)
	{
		if(arr[i] == arr[i + 1])
		{
			arr[i + 1] = -1;
			ans ++;
		}	
	}
	
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n,k,ans=0;
    cin>>n>>k;
    ll arr[n+5];
    for (int i=1;i<=n;i++)
    {
        cin>>arr[i];
    }
    sort(arr+1,arr+n+1);
    for (int i=1;i<=k;i++)
    {
        ans=ans+arr[i];
    }
    cout<<ans;


}

Measured memory_bytes: 3636
#include<iostream>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  if(a>b){
    cout<<"a > b"<<"\n";
  }  if(a<b){
    cout<<"a < b"<<"\n";
  }  if(a==b){
    cout<<"a == b"<<"\n";
  }	return 0;
     }

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

const int N=1e3+20;

int x,n,a[N];

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

	sort(a,a+n);
	for(int d=0;;d++)
	{
		int l=x-d,r=x+d;
		if(not binary_search(a,a+n,l)) return 0 * printf("%d",l);
		if(not binary_search(a,a+n,r)) return 0 * printf("%d",r);
	}
}

Measured memory_bytes: 3836
#include <iostream>
#include <cstdio>
#define INF (1e9)
using namespace std;

int main(){
  while(1){
    int n;
    cin>>n;
    if(!n)break;
    int sum[1001]={},in[1001];
    for(int i=0;i<1000;i++)in[i]=INF;
    
    while(n--){
      int month,day,h,m,id;
      char IO;
      scanf("%d/%d %d:%d %c %d",&month,&day,&h,&m,&IO,&id);
      int t=(h*60)+m;
      if(IO=='I')in[id]=t;
      if(IO=='O'){
	if(id&&t>in[0])sum[id]+=t-max(in[0],in[id]);
	for(int j=1;!id&&j<1000;j++) sum[j] += (t>in[j])? t-max(in[0],in[j]):0;
	in[id]=INF;
      }
    }
    int ans=0;
    for(int i=1;i<1000;i++)ans=max(ans,sum[i]);
    cout <<ans<<endl;
  }

  return 0;
}

Measured memory_bytes: 1252
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    string S,T;
    cin >> S >> T;
    vector<char> c(26,' ');
    rep(i,0,S.length()){
        if(c[ S[i] - 'a'] == ' '){
            c[ S[i] - 'a'] = T[i];
        }else if(c[ S[i] - 'a'] != T[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    sort(c.begin(), c.end());
    rep(i,1,26){
        if(c[i] != ' ' && c[i-1] == c[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

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

int main(){
    string s;
    cin >> s;
    int n = s.size();
    rep(i,n){
        if(i&1){
            if(s[i] != 'L' && s[i] != 'U' && s[i] != 'D'){
                cout << "No\n";
                return 0;
            }
        }else{
            if(s[i] != 'R' && s[i] != 'U' && s[i] != 'D'){
                cout << "No\n";
                return 0;
            }
        }
    }
    cout << "Yes\n";
}



Measured memory_bytes: 256
def main():
    from itertools import product
    n=int(input())
    s=input()
    
    cnt=0
    num='0123456789'
    for pw in product(num,repeat=3):
        j=0
        for i in range(n):
            if pw[j]==s[i]:
                j+=1
                if j==3:
                    cnt+=1
                    break
    
    print(cnt) 
if __name__=='__main__':
    main()

Measured memory_bytes: 40304
#include <stdio.h>
typedef long long ll;
ll dp[110][100010];
ll max(ll x, ll y) {
	return x > y ? x : y;
}
int main() {
	int n, w, weight[100], value[100];
	scanf("%d%d", &n, &w);
	for (int i = 0; i < n; i++) {
		scanf("%d%d", &weight[i], &value[i]);
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= w; j++) {
			if (j >= weight[i]) {
				dp[i + 1][j] = max(dp[i][j], dp[i][j - weight[i]] + value[i]);
			}
			dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
		}
	}
	printf("%lld\n", dp[n][w]);
	return 0;
}

Measured memory_bytes: 79820
/* 	* In the name of GOD 
	* Thanks God */
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
#define F first
#define S second

void solve() {
	string s;
	cin >> s;
	int sum = 0;
	for (int i = 0; i < s.size(); i++) {
		sum += (s[i] - '0');
	}
	cout << (sum % 9 == 0 ? "Yes" : "No");
}

int32_t main() {
	int t = 1;
//	cin >> t;
	while (t--) {
		solve();
	}
}


Measured memory_bytes: 3712
#include <iostream>

int b[25];

int main(){
    int n, m, c;
    std::cin >> n >> m >> c;
    for(int i = 0; i < m; i++){
        std::cin >> b[i];
    }
    int count = 0;
    for(int i = 0; i < n; i++){
        int t = 0;
        for (int j = 0; j < m; j++) {
            int a;
            std::cin >> a;
            t += a*b[j];
        }
        if(t+c>0) count++;
    }
    std::cout << count << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
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;}
/*
void chmin(ll a, ll b){if (a>b){a = b; return true;}return false;}
void chmax(ll a, ll b){if (a<b){a = b; return true;}return false;}
*/

const ll MOD = 1000000007;
const ll INF = 9999999999;

int main() {
  ll N,A,B; cin >>N >>A >>B;
  ll now; cin >>now;
  ll next;
  ll ans = 0;
  for (int i=2; i<=N; i++){
    cin >>next;
    ll walk = A * (next - now);
    ll tele = B;
    ans += min(walk, tele);
    now = next;
  }
  cout <<ans <<endl;
}

Measured memory_bytes: 256