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

using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

#define MAXN 200001
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define fi first
#define se second 
#define FAIL0 {printf("0\n"); return 0;}
#define FAIL_1 {printf("-1\n"); return 0;}

int N;
int A[MAXN];
pii H[MAXN];

LL val[MAXN*4], mx[MAXN*4];

void build(int node, int left, int right) {
    if (left == right) {
        return;
    }

    int m = (left + right) / 2;
    build(node*2, left, m);
    build(node*2 + 1, m+1, right);
}

void update(int node, int left, int right, int i, LL newval) {
    if (left == right) {
        val[node] = mx[node] = newval;
    } else {
        int m = (left + right) / 2;
        if (i <= m) 
            update(node*2, left, m, i, newval);
        else 
            update(node*2+1, m+1, right, i, newval);

        mx[node] = max(mx[node*2], mx[node*2+1]);
    }
}

LL query(int node, int left, int right, int l, int r) {
    if (r < l) return 0;
    if (r < left || right < l) return 0;
    if (l <= left && right <= r) return mx[node];

    int m = (left + right) / 2;
    return max(query(node*2, left, m, l, min(r,m)), query(node*2+1, m+1, right, max(l,m+1), r));
}

int main(int argc, char **argv)
{
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif

    scanf("%d", &N);
    for (int i = 0; i < N; i++) {
        scanf("%d", &H[i].fi);
        H[i].se = i;
    }
    sort(H,H+N);
    for (int i = 0; i < N; i++) scanf("%d", &A[i]);

    build(1,0,N-1);

    for (int i = 0; i < N; i++) {
        int idx = H[i].se;
        if (idx == 0) update(1,0,N-1,0,A[0]);
        else {
            LL m = query(1,0,N-1,0,idx-1);
            update(1,0,N-1, idx, m+A[idx]);
        }

        //printf("%lld\n", query(1,0,N-1,0,N-1));
    }
    
    printf("%lld\n", query(1,0,N-1,0,N-1));

    return 0;
}


Measured memory_bytes: 15104
@$_=(1e9)x@@for@@=0..<>;"  "=~/ (.*) /;//,${$`}[$1]=$$1[$`]=$' for@M=<>;for$i(@@){for$j(@@){$$_[$j]-=$-=$$_[$j]-$$_[$i]-$$i[$j]for@@}}print~~grep//*${$`}[$1]<$',@M

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=3E5+7;
ll arr[N];
ll crr[N];
int main(){
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        ll x;
        cin>>x;
        arr[x]++;
        crr[arr[x]]++;//这样可以让crr维护出现次数大于等于其下标的元素的个数。秒。。 
    }
    for(int i=1;i<=n;i++) crr[i]+=crr[i-1];
    for(int k=1;k<=n;k++){
        ll ans=0;
        ll left=0,right=n;
        while(left<=right){
            ll mid=(left+right)/2;
            if(k*mid<=crr[mid]){
                left=mid+1;
                ans=max(ans,mid);
            }
            else{
                right=mid-1;
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 8328
#include <stdio.h>

int main()
{
    int num[3];
    int num_save;

    scanf("%d %d %d", &num[0], &num[1], &num[2]);

    while((num[0] > num[1]) || (num[1] > num[2])) {
        if(num[0] > num[1]) {
            num_save = num[0];
            num[0] = num[1];
            num[1] = num_save;
        }
        else {
            /* NOP */
        }

        if(num[1] > num[2]) {
            num_save = num[1];
            num[1] = num[2];
            num[2] = num_save;
        }
        else {
            /* NOP */
        }

    }

    printf("%d %d %d\n", num[0], num[1], num[2]);
    
}


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

int n;
int a[100001];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string a, b;
    cin >> a >> b;
    
    for (int i = 0; i < 3; i++)
        if (a[i] != b[2-i]) {
            cout << "NO\n";
            return 0;
        }
    
    cout << "YES\n";
    
    
    
    
    
    return 0;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  long long H;
  int N; 
  cin >> H >> N;
  int A[N];
  long long sum = 0;
  for(int i=0; i<N; i++){
    cin >> A[i];
    sum += A[i];
  }
  if(sum<H) cout << "No";
  else cout << "Yes";
}

Measured memory_bytes: 640
#include<iostream>
#include<cstring>
#include<vector>
#define N 1000
#define MOD 1000000007
using namespace std;
typedef long long LL;
int main()
{
	LL n, walk, tele; cin >> n >> walk >> tele;
	LL pos; cin >> pos;
	LL goal;

	LL ans = 0;
	for(int i = 0; i < n-1; i++)
	{
		cin >> goal;
		ans += min((goal-pos)*walk,tele);
		pos = goal;
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func sliceAtoi(arr []string) []int {
	si := make([]int, 0, len(arr))
	for _, a := range arr {
		i, _ := strconv.Atoi(a)
		si = append(si, i)
	}
	return si
}

func main() {
	s := sliceAtoi(strings.Split(nextLine(), " "))
	n, k := s[0], s[1]
	arr := make([]int, n, n)
	for i := 0; i < k; i++ {
		nextLine()
		a := sliceAtoi(strings.Split(nextLine(), " "))
		for _, m := range a {
			arr[m-1] = 1
		}
	}

	result := 0
	for _, m := range arr {
		if m == 0 {
			result += 1
		}
	}

	fmt.Println(result)
}


Measured memory_bytes: 2060
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define FT first
#define SC second

using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef pair<int, int> pint;
const int INF = 1e9;
const double EPS = 1e-9;



int main()
{
  int x ;
  cin >> x ;
  vector<int> vec ;
  vec.push_back(1) ;
  int tmp ;
  
  FOR(i,2,x+1){
    tmp = i ;
    int k = i*i ;
    while(k<=x){
      vec.push_back(k) ;
      k = tmp*k ;
    }
  }
  
  sort(ALL(vec)) ;
  int n = vec.size() ;
  
  cout << vec.at(n-1) <<endl ;
      
    
    

  return 0 ;
}




Measured memory_bytes: 256
#!python3

from math import pi, cos, sin

iim = lambda: map(int, input().rstrip().split())

def resolve():
    A, B, H, M = iim()

    ar =  2 * pi * (H / 12 + M / (12 * 60))
    br =  2 * pi * M / 60

    ai = A * complex(cos(ar), sin(ar))
    bi = B * complex(cos(br), sin(br))


    print(abs(ai - bi))

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 9572
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(a, n) rep(hoge, n) printf("%d%c", a[hoge], hoge == n - 1? '\n' : ' ');
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define ln(a) cout << (a) << endl
#define INF 1000000000

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

struct segtree {
    int n;
    int* dat;

    segtree(int _n) {
        n = 1;
        while(n < _n) n *= 2;
        dat = new int[n * 2 - 1];
        fill(dat, dat + n * 2 - 1, INT_MAX);
    }

    void update(int i, int x) {
        i += n - 1;
        dat[i] = x;
        while(i > 0) {
            i = (i - 1) / 2;
            dat[i] = min(dat[i * 2 + 1], dat[i * 2 + 2]);
        }
    }

    int find(int s, int t, int i, int l, int r) {
        if(t <= l || r <= s) return INT_MAX;
        if(s <= l && r <= t) return dat[i];
        int lv = find(s, t, i * 2 + 1, l, (l + r) / 2);
        int rv = find(s, t, i * 2 + 2, (l + r) / 2, r);
        return min(lv, rv);
    }
};

signed main() {
    int x;
    cin >> x;
    vector<int> p;
    bool* prime = new bool[x * 2 + 1];
    fill(prime, prime + x * 2 + 1, true);
    prime[0] = prime[1] = false;
    for(int i = 2; i <= x * 2; i++) {
        if(prime[i]) {
            p.pb(i);
            for(int j = i * 2; j <= x * 2; j += i) prime[j] = false;
        }
    }
    ln(*lower_bound(all(p), x));
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
double dp[3001][3001];
double p[3001];

double solve(ll n, ll heads){
    if(heads==0)
        return 1;
    if(n==0)
        return 0;
    
    if(dp[n][heads] > -1) return dp[n][heads];

    double op1 = p[n-1]*solve(n-1,heads-1);
    double op2 = (1-p[n-1])*solve(n-1,heads);
    return dp[n][heads] = op1+op2;
}
int main() {
    int n;
    cin>>n;
    for(int i=0;i<n;i++) cin>>p[i];
    memset(dp,-1,sizeof dp);
    cout<<fixed<<setprecision(10)<<solve(n,(n+1)/2)<<endl;
    return 0;
}


Measured memory_bytes: 70784
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=200010;
const ll mod=1e9+7;

int main(){
  int n,x,y;
  cin >> n >> x >> y; x--; y--;
  vector<vector<int>> a(n, vector<int>(n));
  rep(i,n)rep(j,n){
    a[i][j] = abs(i-j);
  }
  a[x][y] = 1;
  a[y][x] = 1;
  
  rep(i,n)rep(j,n){
    a[i][j] = min(a[i][j], a[i][x]+a[x][j]);
    a[i][j] = min(a[i][j], a[i][y]+a[y][j]);
  }
  
  rep(i,n)rep(j,n){
    a[i][j] = min(a[i][j], a[i][x]+a[x][j]);
    a[i][j] = min(a[i][j], a[i][y]+a[y][j]);
  }
  vector<int> ans(n,0);
  for(int i=0; i<n; i++)for(int j=i+1; j<n; j++){
    ans[a[i][j]]++;
  }
  for(int i=1; i<=n-1; i++){
    cout << ans[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 16000
#include <iostream>
using namespace std;
int main()
{
    int a , b;
    cin>>a>>b;
    if (a == 1) {a = 14;}
    if (b==1) {b = 14;}
    if (a>b) {cout<<"Alice"<<endl;}
    else if (b>a) {cout<<"Bob"<<endl;}
    else {cout<<"Draw"<<endl;}

    return 0;
}


Measured memory_bytes: 3604
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <climits> // FOO_MAX, FOO_MIN
#include <cmath> 
#include <cstdlib> // abs(int)
#include <numeric>

using namespace std;

#define roundup(n,d) ( ((n) + ((d)-1)) / (d) )
#define assign_max(into, compared) (into = max((into), (compared)))
#define assign_min(into, compared) (into = min((into), (compared)))
#define rep(i,n) for(long long i = 0;i < n;++i)
#define fast_io() ios::sync_with_stdio(false); cin.tie(nullptr)
#define fix(n) fixed << setprecision(n)

using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;


int main(void){
    fast_io();
    
    ll n,m;
    cin >> n >> m;
    vector<bool> is_ac (n,false);
    vll penalty (n,0);

    ll ac = 0;
    ll wa = 0;
    rep(i,m){
        ll p;
        string s;
        cin >> p >> s;
        if(!is_ac[p-1]){
            if(s == "AC"){
                is_ac[p-1] = true;
                ac++;
                wa+= penalty[p-1];
            } else {
                penalty[p-1]++;
            }
        }
    }

    cout << ac << " " << wa << endl;

    
    return 0;
}

Measured memory_bytes: 3596
# find the first index that value <= than n
def binary_search(arr,n,l,r)
	if(r == l)
		return r
	end
	i = (r+l)/2
	if(n <= arr[i])
		r = i
		return binary_search(arr,n,l,r)
	else
		l = i+1
		return binary_search(arr,n,l,r)
	end
end

N,Q=gets.split(" ").map{|i| i.to_i}
A=gets.split(" ").map{|i| i.to_i}
X = Array.new(Q)
0.upto(Q-1){|d|
	X[d],_=gets.chomp.split(' ').map{|n| n.to_i}
}

sum = Array.new(N)
stepsum0 = Array.new(N)
stepsum1 = Array.new(N)
sum[0] = A[0]
for i in 1..(N-1)
	sum[i] = A[i] + sum[i-1]
end
stepsum0[0] = A[0]
stepsum0[1] = A[0]
2.step(N-2,2){|i|
	stepsum0[i] = stepsum0[i-2] + A[i]
	stepsum0[i+1] = stepsum0[i-1] + A[i]
}
stepsum0[N-1] = stepsum0[N-3] + A[N-1] if(N%2==1)
stepsum1[0] = A[1]
stepsum1[1] = A[1]
stepsum1[2] = A[1]
3.step(N-2,2){|i|
	stepsum1[i] = stepsum1[i-2] + A[i]
	stepsum1[i+1] = stepsum1[i-1] + A[i]
}
stepsum1[N-1] = stepsum1[N-3] + A[N-1] if(N%2==0)

# p sum
# p stepsum0
# p stepsum1
# p X

if(N==2)
	Q.times{|i|
		puts A[1]
	}
exit(0)
end
if(N%2==0)
	left = 1
	right = 1 + N/2-1
	arr = []
	while(left < right)
		arr << A[left]*1.0 + (A[right]-A[left])*1.0/2
		left += 2
		right += 1
	end
	# p arr
	for i in 0..(Q-1)
		# 0 .. a
		# 0 はくりかえしがなやつ
		patnum = nil
		if arr[arr.size-1] < X[i]
			patnum = arr.size
		else
			patnum = binary_search(arr, X[i], 0, arr.size-1)
		end
		# puts " "
		# puts X[i]
		# puts "patnum #{patnum}"
		puts sum[N-1] - sum[N-1-N/2+patnum] + (patnum == 0 ? 0 : stepsum1[1+(patnum-1) * 2])
		# puts sum[N-1]
		# puts sum[N-1-N/2+patnum]
		# puts patnum == 0 ? 0 : stepsum1[1+(patnum-1) * 2]
	end
else
	left = 0
	right = 0 + N/2
	arr = []
	while(left < right)
		arr << A[left]*1.0 + (A[right]-A[left])*1.0/2
		left += 2
		right += 1
	end
	# p arr
	for i in 0..(Q-1)
		# 0 .. a
		# 0 はくりかえしがなやつ
		patnum = nil
		if arr[arr.size-1] < X[i]
			patnum = arr.size
		else
			patnum = binary_search(arr, X[i], 0, arr.size-1)
		end
		# puts " "
		# puts X[i]
		# puts "patnum #{patnum}"
		a = sum[N-1] 
		b = sum[N-1-N/2+patnum-1]
		c = (patnum == 0 ? 0 : stepsum0[0+(patnum-1) * 2])
		# puts a
		# puts b
		# puts c
		puts a - b + c
	end
end


Measured memory_bytes: 18232
// inputに入力データ全体が入る
function Main(input) {
    var a = input[0].split(" ")[0]-0;
    var b = input[0].split(" ")[1]-0;
    var c = input[0].split(" ")[2]-0;
    var map = {};
    map[c] = map[b] = map[a] = true
    console.log(Object.keys(map).length);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n"));

Measured memory_bytes: 22084
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ldb = long double;
using pa = pair < ll, ll >;
using vec = vector < ll >;
#define pb push_back
#define F  first
#define S  second
#define int ll
#define f(i,x,n) for(ll i=x;i<n;i++) 
#define all(c) c.begin(),c.end()
#define edl "\n"
#define ceils(s,n) (s+n-1)/n
#define str string
#define add insert
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
const int MOD = 1e9 + 7, N = 1e5 + 10;
const ll LINF = LLONG_MAX;


int countWays(int arr[], int m, int N) 
{ 
    int count[N + 1]; 
    memset(count, 0, sizeof(count)); 
    

    count[0] = 1; 
    

    for (int i = 1; i <= N; i++) 
        for (int j = 0; j < m; j++) 

            if (i >= arr[j]) 
                count[i] += count[i - arr[j]]; 

    return count[N]; 
    
} 

int32_t main() 
{ 
    fast();
    int arr[] = {100, 101,102,103,104,105}; 
    int m = sizeof(arr) / sizeof(arr[0]); 
    int N ;
    cin >> N;
   if(countWays(arr, m, N)==0){
    cout<<0<<edl;
   } 
   else
    cout<<1;

    return 0; 
} 


Measured memory_bytes: 1024
#include<stdio.h>

#define MAX 100000
#define NIL -1

struct Node{
  int le;
  int ri;
  int pa;
};
struct Node T[MAX];

void pre(int);
void in(int);
void post(int);

int main(){
  int n,i;
  int v,l,r,root;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    T[i].pa=NIL;
  }

  for(i=0;i<n;i++){
    scanf("%d %d %d",&v,&l,&r);
    T[v].le=l;
    T[v].ri=r;
    if(l!=NIL) T[l].pa=v;
    if(r!=NIL) T[r].pa=v;
  }

  for(i=0;i<n;i++) if(T[i].pa==NIL) root=i;

  printf("Preorder\n");
  pre(root);
  printf("\n");

  printf("Inorder\n");
  in(root);
  printf("\n");

  printf("Postorder\n");
  post(root);
  printf("\n");

  return 0;
}

void pre(int a){
  if(a==NIL) return;
  printf(" %d",a);
  pre(T[a].le);
  pre(T[a].ri);
}

void in(int a){
  if(a==NIL) return;
  in(T[a].le);
  printf(" %d",a);
  in(T[a].ri);
}

void post(int a){
  if(a==NIL) return;
  post(T[a].le);
  post(T[a].ri);
  printf(" %d",a);
}



Measured memory_bytes: 2036
#include <bits/stdc++.h>
#define PB push_back
#define X first
#define Y second
#define INF 1000 * 1000 * 1000

#define LL long long
using namespace std;
const int mod = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL)INF;
const int MAX = 1 << 17;
int comp[MAX];
int sub[MAX];
int p[MAX];
int p2[MAX];
int X[MAX];
int used[MAX];
LL waga[MAX];
LL waga2[MAX];
int depth[MAX];
int Comp = 4;
int N , M;
vector<pair<int , int> > ob[MAX];
vector<vector<pair<int , int> > > g(MAX);
void init()
{
	for(int i = 0; i < N; i++)
	{
		p[i] = i;
	}
}
int find2(int u)
{
	if(u == p2[u])
		return u;
	return p2[u] = find2(p2[u]);
}
void unite2(int u , int v)
{
	u = find2(u) , v = find2(v);
	
	p2[v] = u;
	
	waga2[u] += waga2[v];
}

int find(int u)
{
	if(u == p[u])
		return u;
	return p[u] = find(p[u]);
}
void unite(int u , int v)
{
	u = find(u) , v = find(v);
	if(ob[v].size() > ob[u].size())
		swap(u , v);
	for(auto zalupa : ob[v])
	{
		ob[u].PB(zalupa);
	}
	ob[v].clear();
	p[v] = u;
	waga[u] += waga[v];
}


int main()
{
	ios_base::sync_with_stdio(0);
	cin >> N >> M;
	init();
	for(int i = 0; i < N; i++)
	{
		cin >> X[i];
		waga2[i] = waga[i] = X[i];
	}
	vector<pair<int , pair<int , int> > > edges;
	for(int i = 0; i < M; i++)
	{
		int u , v , y;
		cin >> u >> v >> y;
		u--;v--;
		edges.PB({y , {u , v} });
	}
	sort(edges.begin() , edges.end());
	vector<pair<int , pair<int , int> > > rebra , rebra2;
	for(int i = 0; i < edges.size(); i++)
	{
		int u = edges[i].Y.X , v = edges[i].Y.Y;
		if(find(u) != find(v))
		{
			unite(u , v);
			rebra.PB(edges[i]);
		}
		else
			rebra2.PB(edges[i]);
	}
	
	for(int i = 0; i < N; i++)
	{
		p[i] = p2[i] = i;
		waga2[i] = waga[i] = X[i];
	}
	int ans = 0;
	for(int i = 0; i < N - 1; i++)
	{
		int u = rebra[i].Y.X , v = rebra[i].Y.Y;
		//	cout << u << " " << v << " " << rebra[i].X << endl;
		int pU = find(u) , pV = find(v);
		
		if(waga[pU] + waga[pV] >= rebra[i].X)
		{
			ans++;
			unite(u , v);
			unite2(u , v);
			for(auto u : ob[pU])
			{
				unite2(u.X , u.Y);
				ans++;
			}
			for(auto u : ob[pV])
			{
				unite2(u.X , u.Y);
				ans++;
			}

			ob[pU].clear();
			ob[pV].clear();
		}
		else
		{
			unite(u , v);
			ob[find(u)].PB({u , v});
		}
	}

	for(auto rebro : rebra2)
	{
		ans += find2(rebro.Y.X) == find2(rebro.Y.Y) && waga2[find2(rebro.Y.X)] >= rebro.X;
	}
	cout << M - ans;
}


Measured memory_bytes: 20596
/*

宣告——
汝身在我之下，托付吾之命运于汝之剑，
遵从圣杯之名，若汝遵从此意志此理，回应吧。
在此起誓，吾是成就世间一切行善之人，吾是肃清世间一切罪恶之人，
被狂乱之槛所囚的囚徒。吾是此锁链的操纵者，
汝为身缠三大言灵之七天，从抑止之轮显现吧，天秤之守护者！

*/
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cassert>
#define ll long long
using namespace std;
inline int read(){
	int re=0,flag=1;char ch=getchar();
	while(!isdigit(ch)){
		if(ch=='-') flag=-1;
		ch=getchar();
	}
	while(isdigit(ch)) re=(re<<1)+(re<<3)+ch-'0',ch=getchar();
	return re*flag;
}
long double n,nn,d,delta;
long double calc(long double st,long double del,long double tot){
	return ((st*tot)+del*(tot*(tot+1.0)/2.0))/tot;
}
int main(){
	nn=n=read();d=read();delta=read();d-=delta;
	long double ans=0;
	for(int i=1;i<=nn;i++){
		ans+=calc(d,delta,n*2.0);
//		cout<<i<<' '<<d<<' '<<delta<<' '<<ans<<'\n';
		d=(3.0*delta+(2.0*n+2.0)*d)/(2.0*n);
		delta=((2.0*n+4.0)*delta)/(2.0*n);
		n--;
	}
	printf("%.15lf\n",(double)ans);
}


Measured memory_bytes: 256
def traveling_salesman(n,edge,INF=10**18):
    dist = [[INF for j in range(n)] for i in range(n)]
    for s,t,d in edge:
        dist[s][t] = d
    dp = [[INF for j in range(n)] for i in range(2**n)]
    dp[2**n-1][0] = 0
    for i in range(2**n-1)[::-1]:
        for j in range(n):
            for k in range(n):
                if not (i>>k & 1):
                    dp[i][j] = min(dp[i][j],dp[i|1<<k][k]+dist[j][k])
    return dp[0][0] if dp[0][0]!=INF else -1

V,E = map(int,input().split())
edge = [tuple(map(int,input().split())) for _ in range(E)]

print(traveling_salesman(V,edge))


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



int main()
{
    ll n,k,x=-2,y=2000000,m;map<ll,ll>ml;
    cin>>n>>m;
    vector<pair<ll,ll>>v;
    for(int i=1;i<=m;i++){
        ll a,b;
        cin>>a>>b;
        v.push_back(make_pair(a,b));
    }
    sort(v.begin(),v.end());
    for(int i=0;i<v.size();i++){
        if(v[i].first==1)ml[v[i].second]=1;
        else if(v[i].second==n&&ml[v[i].first]){
            cout<<"POSSIBLE";return 0;
        }
    }
    cout<<"IMPOSSIBLE";

    return 0;
}


Measured memory_bytes: 16492
#include<stdio.h>

int main(void){
  double min=0,max=0;
  double tmp;

  if(scanf("%lf",&tmp)!=EOF){
    min=tmp;
    max=tmp;
  }
  else{
    puts("0.0");
    return 0;
  }
  while(scanf("%lf",&tmp)!=EOF){
    if(min>tmp)
      min=tmp;
    if(max<tmp)
      max=tmp;
  }
  printf("%.1f",max-min);
  return 0;
}

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

using namespace std;

int main() {
    list<int> l;
    int q;
    scanf("%d", &q);
    char a[13];
    while (q--) {
        scanf("%s", a);
        string s(a);
        if (s[0] == 'i') {
            int x;
            cin >> x;
            l.push_front(x);
        } else if (s.size() == 6) {
            int x;
            cin >> x;
            for (auto it = l.begin(); it != l.end(); it++) {
                if (*it == x) {
                    l.erase(it);
                    break;
                }
            }
        } else if (s[6] == 'F') {
            l.pop_front();
        } else {
            l.pop_back();
        }
    }
    int c = 0;
    for (auto x: l) {
        if (c++) printf(" ");
        printf("%d", x);
    }
    printf("\n");
}


Measured memory_bytes: 34480
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char[] c = s.toCharArray();
		int n = s.length() - 1;
		long ans = 0;
		for (int i = 0; i < (1 << n); i++) {
			long tmp = c[0] - '0';
			for (int j = 0; j < n; j++) {
				if ((i & (1 << j)) != 0) {
					ans += tmp;
					tmp = c[j + 1] - '0';
				} else {
					tmp *= 10;
					tmp += c[j + 1] - '0';
				}
			}
			ans += tmp;
		}
		System.out.println(ans);
		sc.close();
	}
}

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

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef double db;

#define mp make_pair
#define pb push_back
#define pt(i) printf("%lld\n",(ll)i)
#define mp make_pair
#define ff first
#define ss second
#define pi acos(-1.0)

ll in() { ll a;scanf("%lld",&a); return a;}
db din(){ db a;scanf("%lf",&a); return a; }
ll bigmod(ll b, ll p,ll md){if(p==0) return 1;if(p%2==1){ return ((b%md)*bigmod(b,p-1,md))%md;} else {ll y=bigmod(b,p/2,md);return (y*y)%md;}}
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b);}

int main()
{
    db n=din(),m=din(),d=din();
    db ans=((n-d)*(m-1))/(n*n);
    if(d>0)
        ans*=2;
    printf("%.8lf\n",ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
    
#define M 1000000007
int n[2], a[2][50], memo[2][51][51][101][2];
int score(int p, int ai[2], int st) {
    int q = p, ret = 0;
    int ait[2] = {ai[0], ai[1]};
    bool b[2] = {true, true};
    for (int i = 0; i < st && (b[0] || b[1]); ++i) {
        q ^= 1;
        --ait[q];
        if (a[q][ait[q]] == -1){
            b[!q] = false;
            continue;
        }
        if (b[q]) ret += (p == q) ? a[q][ait[q]] : -a[q][ait[q]];
    }
    return ret;
}
int dfs(int p, int ai[2], int st, int finflg) {
    if (memo[p][ai[0]][ai[1]][st][finflg] > -M) return memo[p][ai[0]][ai[1]][st][finflg];
    
    int s = score(p, ai, st);
    if (ai[p] == n[p]) return memo[p][ai[0]][ai[1]][st][finflg] = s - (finflg ? 0 : dfs(!p, ai, 0, !st));
    
    int usei[2];
    usei[p] = ai[p] + 1;
    usei[!p] = ai[!p];
    return memo[p][ai[0]][ai[1]][st][finflg] = max(s - (finflg ? 0 : dfs(!p, ai, 0, !st)), -dfs(!p, usei, st + 1, 0));
}
int main(){
    for (int i = 0; i < 2; ++i)
        for (int j = 0; j < 51; ++j)
            for (int k = 0; k < 51; ++k)
                for (int l = 0; l < 101; ++l)
                    for (int p = 0; p < 2; ++p)
                        memo[i][j][k][l][p] = -M;
    
    cin >> n[0] >> n[1];
    for (int i = 0; i < 2; ++i)
        for (int j = 0; j < n[i]; ++j)
            cin >> a[i][j];
    
    int ini[2] = {};
    cout << dfs(0, ini, 0, 0) << "\n";
    
    return 0;
}

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

int main()
{
   int n,m;
   cin>>n>>m;
   int a[n];
   int sum=0;
   for(int i=0;i<n;i++)
   {
       cin>>a[i];
       sum+=a[i];
   }
   sort(a,a+n);
   int sum2=0;
   int flag=1;
   for(int i=1;i<=m;i++)
   {
       if(a[n-i]*4*m>=sum)
        ;
       else
       {
           flag=0;
           break;
       }
   }

   if(flag)
    cout<<"Yes";
   else
    cout<<"No";
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
#pragma GCC optimize("Ofast")

// Begin {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}

constexpr size_t    operator""_sz(unsigned long long value) { return value; };
constexpr intmax_t  operator""_im(unsigned long long value) { return value; };
constexpr uintmax_t operator""_um(unsigned long long value) { return value; };
// }}} End

size_t N;
vector<int64_t> a, b, c;
auto dp = make_v(-1_im, int(1e5) + 5, 5);

intmax_t rec(size_t idx, short yesterday) {
    if (idx >= N) return 0;
    if (~dp[idx][yesterday]) return dp[idx][yesterday];

    intmax_t ret = 0;
    if (yesterday != 0) chmax(ret, rec(idx + 1, 0) + a[idx]);
    if (yesterday != 1) chmax(ret, rec(idx + 1, 1) + b[idx]);
    if (yesterday != 2) chmax(ret, rec(idx + 1, 2) + c[idx]);

    return dp[idx][yesterday] = ret;
}

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

    cin >> N;
    a.resize(N), b.resize(N), c.resize(N);

    for (size_t i = 0; i < N; ++i) {
        cin >> a[i] >> b[i] >> c[i];
    }

    cout << rec(0, 3) << "\n";

    return 0;
}


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

using namespace std;

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

const int MOD = 1e9 + 7;
const int MX = 2e5 + 5;
const ll INF = 1e18;
const ld PI = acos((ld) - 1);

int main() {
	int x;
	cin >> x;
	cout << (x >= 30 ? "Yes" : "No") << '\n';
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

bool comp(i_i a, i_i b){
    if(a.first != b.first){
        return a.first < b.first;
    }
    return a.second < b.second;
}

int main() {
    //cout.precision(10);
    int h, w, n;
    cin >> h >> w >> n;
    vector<i_i> v;
    for(int i = 1; i <= n; i++){
        int x, y;
        cin >> x >> y;
        v.push_back({x, y});
    }
    sort(v.begin(), v.end(), comp);
    for(int i = 0; i < v.size(); i++){
        //cout << v[i].first << " " << v[i].second << endl;
    }
    int back = 0;
    for(int i = 0; i < v.size(); i++){
        int x = v[i].first;
        int y = v[i].second;
        if(x > (y + back)){
            cout << x - 1 << endl;
            return 0;
        }
        if(x == (y + back)) back++;
    }
    cout << h << endl;
    return 0;
}


Measured memory_bytes: 2420
def do():
    n,m=map(int,input().split())
    num=[]
    k=0
    for i in range(m):
        d=int(input())
        l=list(map(int,input().split()))
        num.extend(l)
    for i in range(1,n+1):
        if i not in num:
            k+=1
    return k


print(do())

Measured memory_bytes: 9300
/**
*    author:  yuya1234
*    created: 25.06.2020 15:29:56
**/

#include <bits/stdc++.h>

using namespace std;
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 SORT(s) sort((s).begin(), (s).end())
#define SORTD(s) sort((s).rbegin(), (s).rend())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());

#define SZ(x) ((int)(x).size())
#define MEMSET(v, h) memset((v), h, sizeof(v))

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

    int n, k;
    cin >> n >> k;

    int tmp, ans = 0;
    map<int, int> m;
    vector<int> v;

    REP(i, n)
    {
        cin >> tmp;
        ans++;
        if (m.count(tmp) == 0)
            m.insert(make_pair(tmp, 1));
        else
            m[tmp]++;
    }

    for (auto it = m.begin(); it != m.end(); ++it)
    {
        v.push_back(it->second);
    }
    SORTD(v);

    int aa;
    int i = 0;

    REP(j, k)
    {
        for (auto it = m.begin(); it != m.end(); ++it)
        {
            if (it->second == v[i])
            {
                ans -= it->second;
                m.erase(it->first);
                break;
            }
        }
        i++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 13628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
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<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;


int main() {
    ll a,b,c;
    cin >> a >> b >> c;
    cout << c << " " << a << " " << b << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    const ll inf = LONG_LONG_MAX / 2 - 1;
    ll n;
    cin >> n;
    vector<vector<ll>> g(n);
    rep(i, n) {
        ll u, k;
        cin >> u >> k;
        u--;
        rep(j, k) {
            ll v;
            cin >> v;
            v--;
            g[u].push_back(v);
        }
    }
    vector<ll> dist(n, inf);
    queue<ll> q;
    q.push(0);
    dist[0] = 0;
    while(!q.empty()) {
        ll u = q.front(); q.pop();
        for(auto v : g[u]) {
            if (dist[v] <= (dist[u] + 1)) continue;
            dist[v] = dist[u] + 1;
            q.push(v);
        }
    }
    rep(i, n) printf("%lld %lld\n", i + 1, (dist[i] == inf) ? -1 : dist[i]);
    return 0;
}



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

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

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

const int MAX = 55;
const int INF = 1e9;
const int MOD = 1e9 + 7;

ll dp[MAX][MAX][MAX * MAX];

int main(){
    int N, A, x[MAX];
    cin >> N >> A;
    rep(i, N) cin >> x[i];

    int X = A;
    rep(i, N) X = max(X, x[i]);

    // dp[i][j][k] i枚目まで・j枚使用・合計がkになる場合の数
    dp[0][0][0] = 1;
    rep(i, N) {
        rep(j, N) {
            if (i < j) continue;
            rep(k, N * X) {
                dp[i + 1][j][k] += dp[i][j][k];
                dp[i + 1][j + 1][k + x[i]] += dp[i][j][k];
            }
        }
    }

    ll ans = 0;
    for (int i = 1; i <= N; ++i) {
        ans += dp[N][i][i * A];
    }

    cout << ans << endl;
}

Measured memory_bytes: 65792
#include<stdio.h>

int main(void)
{
	int n,i;
	int a[100001];
	int b[100000];
	long int sum=0;
	
	scanf("%d",&n);
	
	for(i=0;i<n+1;i++)
		scanf("%d",&a[i]);
	for(i=0;i<n;i++)
		scanf("%d",&b[i]);
	for(i=0;i<n;i++){
		if(a[n-i]>=b[n-1-i])
			sum+=b[n-1-i];
		else{
			sum+=a[n-i];
			b[n-1-i]-=a[n-i];
			if(a[n-1-i]>=b[n-1-i]){
				sum+=b[n-1-i];
				a[n-1-i]-=b[n-1-i];
			}else{
				sum+=a[n-1-i];
				a[n-1-i]=0;
				}
			}
		}
	printf("%ld",sum);
	return 0;
}
				
			

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


#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define fastIO ios::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL);cerr.tie(NULL);
#define endl '\n'
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define inf INT_MAX
#define minf INT_MIN

typedef long long int lli;

using namespace std;

ofstream outfile;
ifstream infile;

int main()
{
	infile.open("input.txt");
	outfile.open("output.txt");

	fastIO
	unordered_multiset <int> myset;
	unordered_multiset <int>::iterator iter;
	int n, d, i, j, t;
	cin >> n;
	for(i = 1;i <= n; ++i){
		cin >> t;
		myset.insert(t);
	}
	cin >> d;
	for(i = 1;i <= d; ++i){
		cin >> t;
		iter = myset.find(t);
		if(iter == myset.end()){
			cout << "NO\n";
			return 0;
		}
		myset.erase(iter);
	}
	cout <<"YES\n";
}

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

signed main(){
	ll n, a, b; scanf("%lld%lld%lld", &n, &a, &b);
	vector<ll> h(n);
	for(int i = 0; i < n; i++){
		scanf("%lld", &h[i]);
	}
	ll low = 0, high = 1e9 + 2;
	while(high - low > 1){
		vector<ll> h1 = h;
		ll mid = (high + low) / 2;
		for(int i = 0; i < n; i++){
			h1[i] = max(0LL, h[i] - b * mid);
		}
		ll num = 0;
		for(int i = 0; i < n; i++){
			num += (h1[i] + a - b - 1) / (a - b);
		}
		if(num > mid) low = mid;
		else high = mid;
	}
	cout << high << endl;
}

Measured memory_bytes: 4964
#include<stdio.h>

int main(){
  int N,i,j,l,c,d,e;
  long b,m,p[100005][3];
  scanf("%d",&N);
  scanf("%ld",&m);
  for(i=0;i<N;i++){
    scanf("%ld",&p[i][0]);
    p[i][1]=-1;
    p[i][2]=1;
  }
  l=1;
  while(l==1){
    l=0;
    for(i=0;i<N;i++){
      if(p[i][2]==1){
        c=i;
        for(j=i+1;j<N;j++){
          if(p[j][2]==1){
            l=1;
            i=j;
            d=j;
            e=-1;
            while(1){
              if(e>=i){
                i=e;
              }
              if(c==-1){
                if(d==-1){
                  p[e][1]=-1;
                  break;
                }
                p[e][1]=d;
                p[d][2]=0;
                e=d;
                d=p[e][1];
              }else if(d==-1){
                p[e][1]=c;
                p[c][2]=0;
                e=c;
                c=p[e][1];
              }else if(p[c][0]>p[d][0]){
                if(e!=-1){
                  p[e][1]=c;
                  p[c][2]=0;
                }
                e=c;
                c=p[e][1];
              }else{
                if(e!=-1){
                  p[e][1]=d;
                  p[d][2]=0;
                }
                e=d;
                d=p[e][1];
              }
            }
            break;
          }
        }
      }
    }
  }
  d=c;
  for(j=0;j<m;j++){
    b=p[c][0]>>1;
    l=p[c][1];
    while(1){
      e=p[d][1];
      if(e==-1){
        p[c][1]=-1;
        break;
      }
      if(p[e][0]<=b){
        p[c][1]=e;
        break;
      }
      d=e;
    }
    p[c][0]=b;
    if(e!=l){
      p[d][1]=c;
      d=c;
      c=l;
    }
  }
  m=0;
  for(i=0;i<N;i++){
    m+=p[i][0];
  }
  printf("%ld",m);
  return(0);
}

Measured memory_bytes: 2560
#define _CRT_SECURE_NO_DEPRECATE
#pragma comment(linker, "/STACK:102400000,102400000")
#include<iostream>  
#include<cstdio>  
#include<fstream>  
#include<iomanip>
#include<algorithm>  
#include<cmath>  
#include<deque>  
#include<vector>
#include<bitset>
#include<queue>  
#include<string>  
#include<cstring>  
#include<map>  
#include<stack>  
#include<set>
#include<functional>
#define pii pair<int, int>
#define mod 1000000007
#define mp make_pair
#define pi acos(-1)
#define eps 0.00000001
#define mst(a,i) memset(a,i,sizeof(a))
#define all(n) n.begin(),n.end()
#define lson(x) ((x<<1))  
#define rson(x) ((x<<1)|1) 
#define inf 0x3f3f3f3f
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
ll a[55];
ll tempcheck[55];
ll n;
bool check(ll t)
{
	for (int i = 1; i <= n; ++i)
		tempcheck[i] = (a[i] + t) / (n + 1LL);
	ull ans = 0;
	for (int i = 1; i <= n; ++i)
	{
		ans += tempcheck[i];
		if (ans > t)return 0;
	}
	if (ans < t)return 1;
	else return 0;
}
int tt[60];
bool fit(ll t)
{
	for (int i = 1; i <= n; ++i)
		tempcheck[i] = (a[i] - n + t) / (n + 1LL);
	ull ans = 0;
	for (int i = 1; i <= n; ++i)
		ans += tempcheck[i];
	for (int i = 1; i <= n; ++i)
		tt[i] = a[i] - tempcheck[i] * (n + 1) + ans;
	int flag = 1;
	while (flag)
	{
		for (int i = 1; i <= n; ++i)
		{
			if (tt[i] >= n)
			{
				tt[i] -= n;
				tempcheck[i]++;
				for (int j = 1; j <= n; ++j)
				{
					if (i != j)tt[j]++;
				}
			}
		}
		flag = 0;
		for (int i = 1; i <= n; ++i)
			if (tt[i] >= n)flag = 1;
	}
	ans = 0;
	for (int i = 1; i <= n; ++i)
		ans += tempcheck[i];
	if (ans == t)return 1;
	else return 0;
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int i, j, k, m;
	cin >> n;
	for (int i = 1; i <= n; ++i)
		cin >> a[i];
	ll l = 0, r = 1000000000000000000LL;
	while (r - l > 1)
	{
		ll mid = (l + r) >> 1;
		if (check(mid))r = mid;
		else l = mid;
	}
	l -= 2000;
	r += 2000;
	for (ll i = max(l, 0LL); i <= r; ++i)
		if (fit(i)) { cout << i << endl; }
	return 0;
}

Measured memory_bytes: 256
//#pragma comment(linker, "/STACK:102400000,102400000") 
#pragma warning(disable:4996)
#include <fstream>
#include <iostream>
#include <functional>
#include <algorithm>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
using namespace std;

typedef long long ll;
#define eps 1e-10
#define LL_INF 0x33ffffffffffffff
#define INF 0x3f3f3f3f
#define mem(a, b) memset(a, b, sizeof(a))
#define pper(i,n,m) for(int i = n;i >= m; i--)
#define repp(i, n, m) for (int i = n; i <= m; i++)
#define rep(i, n, m) for (int i = n; i < m; i++)
#define sa(n) scanf("%d", &(n))
#define mp make_pair
#define ff first
#define ss second
#define pb push_back

const int maxn = 2e6 + 10;
const ll mod = 1e9 + 7;
const double PI = acos(-1.0);
ll po(ll a, ll b) { ll res = 1; a %= mod; for (; b; b >>= 1) { if (b & 1)res = res*a%mod; a = a*a%mod; }return res; }




int main()
{
	int a, b;
	sa(a), sa(b);
	if (a > 0)
	{
		puts("Positive");
		return 0;
	}
	if (b < 0)
	{
		int num = b - a + 1;
		if (num & 1)
		{
			puts("Negative");
		}
		else
		{
			puts("Positive");
		}
		return 0;
	}
	puts("Zero");
	return 0;
}


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

def main():
    a=[[0]*3 for _ in range(3)]
    for i in range(3):
        a[i]=list(map(int,input().split()))
    n=int(input())
    b=[0]*n
    for i in range(n):
        b[i]=int(input())
    for i in range(3):
        for j in range(3):
            if a[i][j] in b:
                a[i][j]=0
    ans=a[0][0]+a[1][1]+a[2][2]
    ans*=a[0][0]+a[0][1]+a[0][2]
    ans*=a[0][0]+a[1][0]+a[2][0]
    ans*=a[1][0]+a[1][1]+a[1][2]
    ans*=a[0][1]+a[1][1]+a[2][1]
    ans*=a[2][0]+a[2][1]+a[2][2]
    ans*=a[0][2]+a[1][2]+a[2][2]
    ans*=a[0][2]+a[1][1]+a[2][0]
    if ans==0:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Measured memory_bytes: 38384
from collections import Counter

X,Y,A,B,C=map(int,input().split())
#3logN
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort()
q.sort()
p_list=p[-X:]
q_list=q[-Y:]
r.extend(p_list)
r.extend(q_list)
r.sort()
print(sum(r[-(X+Y):]))

Measured memory_bytes: 108524
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
    int a, b, c, d,t,i,x=0;
    cin>>a>>b;
    if(a>=0&&a<=1000000000&&b>=0&&b<=1000000000)
    {
        if(a>b)
        {
            t=a;
            a=b;
            b=t;
        }
        for(i=1;i<=b;i++)
        {
            c=abs(a-i);
            d=abs(b-i);
            if(c==d)
            {
                x=i;
                break;
            }
        }
        if(x==0)
            cout<<"IMPOSSIBLE"<<endl;
        else
            cout<<x<<endl;
    }

}

Measured memory_bytes: 3604
#include <iostream>
using namespace std;
int main() {
  int K, S;
  cin >> K >> S;

  int count = 0;
  for (int x = 0; x <= K; ++x) {
    for (int y = 0; y <= K; ++y) {
      int z = S - x - y;
      if (0 <= z && z <= K) {
          count += 1;
      }
    }
  }
  cout << count << endl;
  return 0;
}

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

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

  std::vector<long long> A(N);
  std::vector<long long> S(N + 1, 0);

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

  for (int i = 1; i <= N; i++) {
    S[i] = S[i - 1] + A[i - 1];
  }

  // sum of [l, r] = S[r+1] - S[l]
  long long ans = 0;
  int mod = 1000000007;

  for (int i = 0; i < N; i++) {
    ans += A[i] * (((S[N] - S[i + 1]) % mod + mod) % mod);
    ans %= mod;
  }

  ans = (ans + mod) % mod;
  std::cout << ans << "\n";

  return 0;
}


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

using namespace std;

int main(){
int N;

cin >> N;

string S[N];

int A[N],max=0,l=0,ans,j;

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

for (int i = 0; i < N; i++)
{
 A[i] = 1;
}

sort(S,S+N);

while(l<N-1){
  j = l+1;
  while(1){
    if (S[j]==S[l])
    {
      j++;
     continue;
    }
    else {
      A[l] = j-l;
      if (max < A[l])
      {
       max = A[l];
      }
      l=j;
      break;
    }
  }
}
for (int i = 0; i < N; i++)
{
  if (A[i] == max)
  {
    cout << S[i] <<endl;
  }
  
}

return 0;
}

Measured memory_bytes: 15104
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	private static final long M = 1000000007;
	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer tok;

	void solve() throws IOException {

		char[] a = ns().toCharArray();
		long dp[] = new long[5];
		dp[1] = 1;
		for (int i = 0; i < a.length; i++) {
			if (a[i] == 'C')
				dp[4] += dp[3];
			else if (a[i] == 'B')
				dp[3] += dp[2];
			if (a[i] == 'A')
				dp[2] += dp[1];
			else if (a[i] == '?') {
				for (int j = 4; j >= 1; j--)
					dp[j] = dp[j] * 3 + dp[j - 1];
			}
			for (int j = 4; j >= 1; j--)
				dp[j] %= M;
//			Helper.tr(dp);
		}

		out.println(dp[4]);
	}

	String ns() throws IOException {
		while (!tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine(), " ");
		}
		return tok.nextToken();
	}

	int ni() throws IOException {
		return Integer.parseInt(ns());
	}

	long nl() throws IOException {
		return Long.parseLong(ns());
	}

	double nd() throws IOException {
		return Double.parseDouble(ns());
	}

	String[] nsa(int n) throws IOException {
		String[] res = new String[n];
		for (int i = 0; i < n; i++) {
			res[i] = ns();
		}
		return res;
	}

	int[] nia(int n) throws IOException {
		int[] res = new int[n];
		for (int i = 0; i < n; i++) {
			res[i] = ni();
		}
		return res;
	}

	int[][] nia(int n, int m) throws IOException {
		int[][] res = new int[n][];
		for (int i = 0; i < n; i++) {
			res[i] = nia(m);
		}
		return res;
	}

	long[] nla(int n) throws IOException {
		long[] res = new long[n];
		for (int i = 0; i < n; i++) {
			res[i] = nl();
		}
		return res;
	}

	public static void main(String[] args) throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		tok = new StringTokenizer("");
		Main main = new Main();
		main.solve();
		out.close();
	}
}

Measured memory_bytes: 23252
#include <cstdio>
#include <algorithm>

using namespace std;

namespace io
{
	const int SIZE = (1 << 21) + 1;
	char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c, qu[55]; int f, qr;
	#define gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	inline void flush (){fwrite (obuf, 1, oS - obuf, stdout);oS = obuf;}
	inline void putc (char x){*oS ++ = x;if (oS == oT) flush ();}
	template <class I>
	inline void gi (I &x) {for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;
		for (x = 0; c <= '9' && c >= '0'; c = gc()) x = x * 10 + (c & 15); x *= f;}
	template <class I>
	inline void print (I x){
		if (!x) putc ('0'); if (x < 0) putc ('-'), x = -x;while(x) qu[++ qr] = x % 10 + '0',  x /= 10;while (qr) putc (qu[qr--]);}
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
}
using io::gi;
using io::putc;
using io::print;

int Q, A, B, _A, _B, C, D, K, L;

inline bool check(int a)
{
	int b = a / (K + 1);
	if (b > B)
		return false;
	if ((a -= b) > A)
		return false;
	return K * 1LL * (A - a) >= B - b;
}

inline char query(int p)
{
	_A = A, _B = B;
	if (p <= L)
		if (p % (K + 1))
			return 'A';
		else
			return 'B';
	p -= L;
	int b = L / (K + 1), a = L - b;
	A -= a, B -= b;
	if (p <= B - K * A)
	{
		A = _A, B = _B;
		return 'B';
	}
	p -= B - K * A, A = _A, B = _B;
	if ((p - 1) % (K + 1))
		return 'B';
	else
		return 'A';
}

int main()
{
	gi(Q);
	for (int l, r, mid;Q--;)
	{
		gi(A), gi(B), gi(C), gi(D);
		K = max(A, B) / (min(A, B) + 1);
		while ((min(A, B) + 1) * K < max(A, B))
			++K;
		l = 0, r = A + B + 1;
		while (l < r)
		{
			mid = l + ((r - l) >> 1);
			if (check(mid))
				l = mid + 1;
			else
				r = mid;
		}
		L = l;
		for (int i = C;i <= D;++i)
			putc(query(i));
		putc('\n');
	}
	return 0;
}

Measured memory_bytes: 2432
#include<iostream>

using namespace std;

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

	int n,k;
	cin >> n >> k;
	int a[n];
	int ans=0;
	for (int i = 0; i < n ; ++i)
	{
		cin >> a[i];
		if(a[i]>=k) ans++;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 3920
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll memo[3][100005];
ll arr[3][100005];
int main()
{
    int n;
    cin>>n;
    
    for(int i=0;i<n;i++)
    {
        cin>>arr[0][i]>>arr[1][i]>>arr[2][i];
    }
    
    memo[0][0]=arr[0][0];
    memo[1][0]=arr[1][0];
    memo[2][0]=arr[2][0];
    
    for(int i=1;i<n;i++)
    {
        memo[0][i]=arr[0][i]+max(memo[1][i-1],memo[2][i-1]);
        memo[1][i]=arr[1][i]+max(memo[0][i-1],memo[2][i-1]);
        memo[2][i]=arr[2][i]+max(memo[0][i-1],memo[1][i-1]);
    }
    
    printf("%lld\n",max(max(memo[0][n-1],memo[1][n-1]),memo[2][n-1]));
}

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

int n , a , b , ans ;

bool check(int x) {
	int s = 0 ;
	for (; x ; x /= 10) {
		int tmp = x % 10 ;
		s += tmp ;
	}

	return a <= s && s <= b ;
}

int main() {
	scanf("%d %d %d" , &n , &a , &b) ;
	for (int i = 1 ; i <= n ; ++i)
		if (check(i)) ans += i ;

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

	return 0 ;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
string to_string(const string& s) {
	return '"' + s + '"';
}
string to_string(const bool b) {
	return (b ? "true" : "false");
}
string to_string(const char* s) {
	return to_string((string)s);
}
string to_string(const char c) {
	string s = "'";
	s += c;
	s += "'";
	return s;
}
template<class T, class U>
string to_string(const pair<T, U>& p) {
	string s = "(";
	s += to_string(p.first);
	s += ", ";
	s += to_string(p.second);
	s += ")";
	return s;
}
template<class T>
string to_string(const T& a) {
	bool first = true;
	string s = "{";
	for (const auto& x : a) {
		if(!first){
			s += ", ";
		}
		first = false;
		s += to_string(x);
	}
	s += "}";
	return s;
}
void debug_out() {cerr << '\n';}
template<class Head, class... Tail>
void debug_out(Head head, Tail... tail) {
	cerr << ' ' << to_string(head);
	debug_out(tail...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "] = ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
using ll = long long;
using ld = long double;
const int mod = 1e9 + 7;
const int inf = 1e9 + 100;
const ll inf64 = 7e18l;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(20);
	int x, a;
	cin >> x >> a;
	cout << (x < a ? 0 : 10) << '\n';
 	return 0;
}


Measured memory_bytes: 256