akhauriyash/Code-Regression huggingface dataset:
import java.util.*; 
import java.io.*;


// 
public class Main {
    static StringTokenizer st;
    static BufferedReader br;  
    static PrintWriter out;
 
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));

        // why ? because pick small is not always right
        // WA();

        Test();
    }

    public static void Test() throws IOException {
        int N = nextInt();
        int M = nextInt();
        int K = nextInt();

        long[] N_PreSum_List = new long[N+1];
        long[] M_PreSum_List = new long[M+1];
       
        for(int i = 1; i<=N; i++){
            N_PreSum_List[i] = N_PreSum_List[i-1] + nextInt();
        }
        for(int i = 1; i<=M; i++){
            M_PreSum_List[i] = M_PreSum_List[i-1] + nextInt();
        }

        int M_Index = M;
        int ans = 0;
        for(int i = 0; i<=N; i++){
            if(N_PreSum_List[i]<=K){
                for(int j = M_Index; j>=0; j--){
                    if(N_PreSum_List[i] + M_PreSum_List[j] <=K){
                        M_Index = j;
                        ans = Math.max(ans, i + j);
                        break;
                    }
                }
            }
        }
        
        System.out.println(ans);

    }
     

    public static void WA() throws IOException {
        int N = nextInt();
        int M = nextInt();
        int K = nextInt();

        int[] N_List = new int[N+1];
        int[] M_List = new int[M+1];
       
        for(int i = 1; i<=N; i++){
            N_List[i] = nextInt();
        }
        for(int i = 1; i<=M; i++){
            M_List[i] = nextInt();
        }

        int N_Index = 1;
        int M_Index = 1;
       
        int ans = 0;
        int total = 0;
        int cur = 0;

        while(true){
            if(N_Index>N && M_Index > M ){
                System.out.println(ans);
                return;
            }
            if(N_Index>N){
                cur =M_List[M_Index];
                M_Index ++;
            }
            else if(M_Index>M){
                cur =N_List[N_Index];
                N_Index ++;
            }
            else if(N_List[N_Index]< M_List[M_Index] ){
                cur = N_List[N_Index];
                N_Index ++;
            }
            else{
                cur =M_List[M_Index];
                M_Index ++;
            }
            
            if(total+cur>K){
                System.out.println(ans);
                return;
            }
            total = total + cur;
            ans ++;
        }
    }
      
    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    public static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    }
}

Measured memory_bytes: 62872
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(){
	int n;
	int i,j=0,k=30;
	char az[26];
	char str[1025];
	char queue[60];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		k=30;
		memset(az,0,26);
		memset(str,0,1025);
		memset(queue,0,60);
		scanf("%s",str);
		for(j=0;j<1025;j+=3){
			if(az[str[j]-'a']==0&&str[j]!=0){
				az[str[j]-'a']=1;
				queue[k]=str[j];			
			}
			else if(str[j]=='\0'){break;}
			switch(str[j+2]){
				case '>':
					k++;
					break;
				case '-':
					k--;
					break;
				default:
					break;
			}
		}
		for(j=0;j<60;j++){
			if(queue[j]){
				printf("%c",queue[j]);
			}
		}
		puts("");
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()



//library mod int
template <int mod>
struct modint{
    ll x;

    //constructor
    modint(ll x=0): x((x%mod+mod)%mod){}

    //unary operator
    modint operator-() const { return modint(mod-x);}
    modint inv() const { return this->pow(mod-2);}
    

    //compound assignment
    modint& operator+=(const modint& a){
        if((x+=a.x)>=mod) x-=mod;
        return *this;
    }
    modint& operator-=(const modint& a){
        if((x-=a.x)<0) x+=mod;
        return *this;
    }
    modint& operator*=(const modint& a){
        (x*=a.x)%=mod;
        return *this;
    }
    modint& operator/=(const modint& a){
        return *this *= a.inv();
    }

    //arithmetic
    modint operator-(const modint& a){return modint (*this) -= a.x ; }
    modint operator+(const modint& a){return modint (*this) += a.x ; }
    modint operator*(const modint& a){return modint (*this) *= a.x ; }
    modint operator/(const modint& a){return modint (*this) /= a.x ; }
    //n should not be smaller than 0.
    modint pow(ll n) const{
        auto x=modint(1);
        auto m=*this;
        while(n>0){
            if(n&1) x*=m;
            n>>=1;
            m*=m;
        }
        return x;
    }

    //compare
    bool operator==(const modint& a) const {return x==a.x ; }
    bool operator!=(const modint& a) const {return x!=a.x ; }

    //I/O
    friend istream& operator>>(istream& is, modint& a ) noexcept {return is >> a.x ; }
    friend ostream& operator<<(ostream& os, const modint& a ) noexcept {return os << a.x ; }

};

//modの調整
constexpr int mod = 1e9 + 7;
using mint = modint<mod>;


mint comb(int n, int r){
    r=min(r,n-r);
    mint ans=1;
    rep(i,r){
        ans*=(n-i);
        ans*=(mint(i+1).inv());
    }
    return ans;
}


int main(){
    int n,a,b;
    cin>>n>>a>>b;
    mint ans=mint(2).pow(n)-1;
    ans-=comb(n,a);
    ans-=comb(n,b);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

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

map<ll, int> prime_factor(ll n) {
	map<ll, int> res;
	for(ll i = 2LL; i * i <= n; ++i) {
		while( n % i == 0 ) {
			res[i]++;
			n /= i;
		}
	}
	
	if( n != 1 ) res[n] = 1;
	
	return res;
}

int main(void) {
	ll n;
	cin >> n;
	
	if( n == 1LL ) {
		cout << 0 << endl;
		return 0;
	}
	
	if( is_prime(n) ) {
		cout << 1 << endl;
		return 0;
	}
	
	map<ll, int> mp = prime_factor(n);
	int ans = 0;
	
	for(auto&x : mp) {
		int i = 1;
		
		while( x.second > 0 && x.second >= i ) {
			x.second -= i;
			ans++;
			i++;
		}
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 3620
//  Created by liszt on 2019/08/01.
#include<bits/stdc++.h>
using namespace std;

int main(){
    int a,b,c; cin>>a >>b >>c;
    if((a==5&&b==5&&c==7)||(a==5&&b==7&&c==5)||(a==7&&b==5&&c==5)){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
int main(){
    int n;
    double sum1=0, sum2=0, sum3=0, summax=0;
    cin >> n;
    double x[n], y[n];
    for(int i=0;i<n;i++){
        cin >> x[i];
    }
    for(int i=0;i<n;i++){
        cin >> y[i];
    }
    
    for(int i=0;i<n;i++){
        if(x[i]>y[i]){
            sum1 += x[i]-y[i];
            sum2 += (x[i]-y[i])*(x[i]-y[i]);
            sum3 += (x[i]-y[i])*(x[i]-y[i])*(x[i]-y[i]);
            if(x[i]-y[i]>summax){
                summax = x[i]-y[i];
            }
        }else{
            sum1 += y[i]-x[i];
            sum2 += (y[i]-x[i])*(y[i]-x[i]);
            sum3 += (y[i]-x[i])*(y[i]-x[i])*(y[i]-x[i]);
            if(y[i]-x[i]>summax){
                summax = y[i]-x[i];
            }
        }
    }
    
    cout << fixed << sum1 << endl << fixed << sqrt(sum2) << endl << fixed << cbrt(sum3) << endl << fixed << summax << endl;
    
    
    
    return 0;
}


Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
string st;
int s1[30],x,x1;
int main()
{
    cin>>st;
    for (int i=0;i<=st.size()-1;i++)
    {
    	if (st[i]=='B'||st[i]=='K'||st[i]=='I'||st[i]=='H'||st[i]=='R'||st[i]=='A')
        s1[st[i]-64]++; else {cout<<"NO"<<endl;return 0;}
    }
    if (s1['B'-64]==1&&s1['K'-64]==1&&s1['I'-64]==1&&s1['H'-64]==1&&s1['R'-64]==1) 
    {
            x=st.find('K');
            if (st[x+1]!='I') {cout<<"NO"<<endl;return 0;} else
            {
            	x=st.find('I');
                if (st[x+1]!='H') {cout<<"NO"<<endl;return 0;} else
                {
                	x1=st.find('B');
                	x=st.find('H');
                	if (x1-x<=2&&x1-x>0) 
                	{
                		x=st.find('B');
                		x1=st.find('R');
                		if (x1-x<=2&&x1-x>0) 
                        {
                            x=st.find('R');
                            if (st.size()-1-x>1) {cout<<"NO"<<endl;return 0;} else
                            {
                            	x=st.find('K');
                            	if (x+1>2) {cout<<"NO"<<endl;return 0;} else
                            	    {cout<<"YES"<<endl;return 0;}
                            }
                        } else {cout<<"NO"<<endl;return 0;}
                	} else
                	{cout<<"NO"<<endl;return 0;}
            	   	
            	}
            }
    } else cout<<"NO"<<endl;
    return 0;
}

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

// https://atcoder.jp/contests/abc097/tasks/arc097_b

using namespace std;

int findRoot(int* parent, int x) {
  if (parent[x] == x) {
    return x;
  }
  parent[x] = findRoot(parent, parent[x]);
  return parent[x];
}

bool isSame(int* parent, int x, int y) {
  return findRoot(parent, x) == findRoot(parent, y);
}

void unite(int* parent, int x, int y) {
  x = findRoot(parent, parent[x]);
  parent[x] = findRoot(parent, y);
}

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> nums;
  nums.reserve(n+1);
  nums.emplace_back(0);
  for (int i = 0; i < n; ++i) {
    int num;
    cin >> num;
    nums.emplace_back(num);
  }

  int parent[n+1];
  for (int i = 0; i <= n; ++i) {
    parent[i] = i;
  }

  for (int i = 0; i < m; ++i) {
    int num1, num2;
    cin >> num1 >> num2;
    unite(parent, num1, num2);
  }

  int res = 0;
  for (int i = 1; i <= n; ++i) {
    if (isSame(parent, i, nums.at(i))) {
      ++res;
    }
  }
  cout << res << endl;

  return 0;
}

Measured memory_bytes: 4028
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	a = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int main(void){
	int n,m,a=0,b=0,ba=0,ans=0,i,j;
	string s;
	cin >> n;
	for(i=0; i<n; ++i){
		cin >> s;
		m = s.l_ength();
		if(s[0]=='B' && s[m-1]=='A'){
			++ba;
		}else if(s[0]=='B'){
			++b;
		}else if(s[m-1]=='A'){
			++a;
		}
		for(j=1; j<m; ++j){
			if(s[j-1]=='A' && s[j]=='B'){
				++ans;
			}
		}
	}
	if(ba){
		ans += ba-1;
		if(a){
			++ans;
			--a;
		}
		if(b){
			++ans;
			--b;
		}
	}
	ans += min(a,b);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <stdio.h>
#include <bitset>
#include <complex>
#include <iomanip>
#include <math.h>
using namespace std;
#define MM 1000000000
#define MOD MM+7
#define pi pair<int32,int32>
#define pl pair<int64,int64>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    return x*y/(T)GCD(x,y);
}
int main(){
    int n; cin >> n;
    int a[n];
    int mx = 0,mx2 = 0;
    map<int,int> mp;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        if (mx < a[i]){
            mx2 = mx;
            mx = a[i];
        } else if (mx2 < a[i]){
            mx2 = a[i];
        }
        mp[a[i]]++;
    }
    for(int i = 0; i < n; i++){
        if (a[i] == mx && mp[mx] == 1){
            cout << mx2 << endl;
        } else {
            cout << mx << endl;
        }
    }
}
  



Measured memory_bytes: 7936
N = int(input())
ans = 0
def dfs(n=0,a=0,b=0,c=0):
    if n > N:
        return
    if a*b*c > 0:
        global ans
        ans += 1
    dfs(10*n+3,a+1,b,c)
    dfs(10*n+5,a,b+1,c)
    dfs(10*n+7,a,b,c+1)

dfs()
print(ans)

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

using namespace std;

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

int main(){
   
   int n,max = -10, min = 1000000009;
   cin >> n;
   int a[n];
   rep(i,n){
      cin >> a[i];
   }
   rep(i,n){
      if(a[i] < min){
         min = a[i];
      }
      if(a[i] > max){
         max = a[i];
      }
   }

   cout << max - min << endl;

   return 0;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;


#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
typedef long long ll;


void Main(){
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;
	int x = tx-sx;
	int y = ty-sy;

	// (0,0) -> (x,y) の経路を答える
	cout << string(y, 'U') << string(x, 'R') << string(y, 'D') << string(x, 'L');
	cout << 'L' << string(y+1, 'U') << string(x+1, 'R') << 'D';
  	cout << 'R' << string(y+1, 'D') << string(x+1, 'L') << 'U';
	return;
 }
  
int main(){
 cin.tie(nullptr);
 ios_base::sync_with_stdio(false);
 cout << fixed << setprecision(15);
 Main();
 return 0;
 }


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
int main(){
	string A;
	string B="CODEFESTIVAL2016";
	cin>>A;
	int c=0;
	REP(i,A.size()){
	    if(A[i]!=B[i])c++;
	}
        cout<<c<<endl;
	return(0);
}

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

string str;

map<char,int> mapa;

int main(){
	mapa['a'] = 0;
	mapa['b'] = 0;
	mapa['c'] = 0;
	cin >> str;
	int mini = 0x3f3f3f3f;
	for(auto &it: str){
		mapa[it] ++ ;
	}
	
	for(auto &it : mapa)
		mini = min(mini, mapa[it.first]);
	for(auto &it: mapa)
		it.second -= mini;
	int c = 0;
	
	for(auto &it: mapa){
		if(it.second >= 2)
			c = 100;
		else if(it.second)
			c++;
	}
	if(c <= 2)
		cout<<"YES";
	else
		cout<<"NO";
}


Measured memory_bytes: 512
#include <iostream>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define p(i, n) for (z i = 0; i < n; i++)
using z=long long;
int main(){z N,Q;cin>>N>>Q;fenwick_tree<z> b(N);p(i,N){z a;cin>>a;b.add(i,a);}p(i,Q){z w,e,r;cin>>w>>e>>r;if(w)cout<<b.sum(e,r)<<"\n";else b.add(e,r);}}


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

const int MAX = 100;
int n,d; 
int a[MAX][MAX];

int sqdist(int i,int j){
	int dist = 0;
	for(int k=0;k<d;k++){
		dist += abs(a[i][k]-a[j][k])*abs(a[i][k]-a[j][k]);
	}
	return dist;
}

int main()
{
	cin>>n>>d;
	int cnt=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<d;j++) cin>>a[i][j];
	}
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			int x = sqdist(i,j);
			int t = sqrt(x);
			if(t*t == x) cnt++;
		}
	}

	cout<<cnt;
}

Measured memory_bytes: 384
import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 1000000007
sys.setrecursionlimit(1000000)

X, A = rl()

if X < A:
	print(0)
else:
	print(10)


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



#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll nxt[MAX],need,c[MAX];
vector<ll>v;
void tour(int par,int k)
{
    v.clear();
    ll sum=0,ans=0,it=0,cur=par;
    while(nxt[cur]!=par)
    {
        cur=nxt[cur];
        sum+=c[cur];
        v.push_back(sum);
    }
    v.push_back(sum+c[par]);
}
ll test(ll k)
{
    ll sz=v.size();
    ll mx=0,ans=-1e18;
    if(sz==0)
        return ans;
    if(k>sz)
    {
        ll cur=0;
        cur=v[sz-1];
        ll mul=k/sz;
        cur*=mul;
        ll rem=k%sz;
        mx=0;
        for(int i=0; i<rem; i++)
            mx=max(mx,v[i]);
        cur+=mx;
       if(rem==0){
            for(int i=sz-1;i>=0;i--)
                ans=max(ans,cur-v[i]);
        }
        ans=max(ans,cur);
        for(int i=0; i<sz; i++)
            ans=max(ans,v[i]);
    }
    else
    {
        for(int i=0; i<k; i++)
            ans=max(ans,v[i]);
    }
    return ans;
}
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int n,k;
    cin>>n>>k;
    ll ans=-1e18;
    for(int i=1; i<=n; i++)
    {
        cin>>nxt[i];
    }
    for(int i=1; i<=n; i++)
    {
        cin>>c[i];
    }
    for(int i=1; i<=n; i++)
    {
        tour(i,k);
        ans=max(ans,test(k));
    }
    cout<<ans<<endl;


    return 0;
}



Measured memory_bytes: 3792
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define nl '\n'
typedef long long ll;
//////////////////////////////////////////////////////////////////////



int main(){
  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  
  int n;cin>>n;
  string s = string(to_string(n));

  string r;r=s;
  reverse(r.begin(),r.end());
  cout << ((s==r)?"Yes":"No") << nl;
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589


#define izryt bool

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}
pii Dir[8] = { //移動
	{ 0 ,1 },{ -1 ,0 },{ 1 ,0 },{ 0 ,-1 },
	{ 1 ,1 },{ 1 ,-1 },{ -1 ,1 },{ -1 ,-1 }
};
__int128 factorial(__int128 s, __int128 e) {//階乗
	__int128 ret = 1;
	vector<int> deki;
	for (__int128 i = 0; e > i; i++) {
		ret *= s-i;
		if (!(ret % (i + 1))) {
			ret /= i + 1;
		}
		else 
			deki.push_back(i+1);
	}
	for(auto itr : deki)
		ret /= itr;
	return ret;
}
signed main() {
	int n,a,b;
	scanf("%d %d %d", &n, &a, &b);

	vector<ll> v(n);

	map<ll, int> samec;
	REP(i, n) {
		scnaf("%lld", &v[i]);
		samec[v[i]]++;
	}
	sort(ALL(v), greater<ll>());

	pair<__float128, int> Max = {};

	ll bs = 0;
	REP(i, a-1) {
		bs += v[i];
	}
	ll bufbs = bs;
	vector<int> anc;
	rep(i, a-1, b) {
		bs += v[i];
		if (Max.first < (__float128)bs / (i + 1)) {
			Max = { (__float128)bs / (i + 1), i };
		}
	}
	rep(i, a - 1, b) {
		bufbs += v[i];
		if (Max.first == (__float128)bufbs / (i + 1)) {
			anc.push_back(i);
		}
	}
	double cus = Max.first;
	printf("%.7lf\n", cus);

	__int128 ans = 0;
	for (auto itr : anc) {
		int cc = samec[v[itr]];
		int befc = 0;
		REP(i, itr + 1) {
			if (v[i] == v[itr]) {
				befc++;
			}
		}

		ans += factorial(cc, befc);
	}
	printf("%lld\n", (ll)ans);
	return 0;
}

Measured memory_bytes: 256
x, y = map(int, input().split())

prize = 0
if x <= 3:
    prize += (300000 - (x - 1) * 100000)
if y <= 3:
    prize += (300000 - (y - 1) * 100000)
if (x == 1) & (y == 1):
    prize += 400000
print(prize)

Measured memory_bytes: 8988
/*
*/

#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>

#include <memory.h>
#include <assert.h>

#define y0 sdkfaslhagaklsldk

#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define have adsgagshdshfhds
#define ends asdgahhfdsfshdshfd
#define prev asdgSHJsfgsdfhdsh
#define hash asdgasdgasdgdfrywewery

#define eps 1e-9
#define M_PI 3.141592653589793
#define bsize 1024

#define ldouble long double
using namespace std;

#define bs 1000000007

const int N = 200031;

int n;
int g[231][231];
int used[231];
queue<int> qu;
int mx;

bool shit;

void dfs(int v,int cl){
	if (shit)
		return;
	used[v]=cl;
	for (int i=1;i<=n;i++){
		if (g[v][i]==0)
			continue;
		if (used[i]==used[v]){
			shit=1;
			return;
		}
		if (used[i])
			continue;
		dfs(i,3-cl);
	}
}

int main(){
//    freopen("apache.in","r",stdin);
//    freopen("apache.out","w",stdout);
 //   freopen("input.txt", "r", stdin);
 //   freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(0);
 //   cin.tie(0);

    cin>>n;
    for (int i=1;i<=n;i++){
    	string st;
    	cin>>st;
    	for (int j=1;j<=n;j++){
    		if (st[j-1]=='1')
    			g[i][j]=1;
    		else
    			g[i][j]=0;
    	}
    }

    dfs(1,1);

    if (shit){
    	cout<<-1<<endl;
    	return 0;
    }

	mx=0;
    for (int root=1;root<=n;root++){
    	for (int i=1;i<=n;i++){
    		used[i]=0;
    	}
    	qu.push(root);
    	used[root]=1;
    	while (qu.size()){
    		int v=qu.front();
    		qu.pop();
    		for (int i=1;i<=n;i++){
    			if (g[v][i]==1&&used[i]==0){
    				qu.push(i);
    				used[i]=used[v]+1;
    				mx=max(mx,used[i]);
    			}
    		}
    	}
    }
    cout<<mx<<endl;

//    cin.get(); cin.get();
    return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;
class Main{
 public static void main(String[] args){
   Scanner sc=new Scanner(System.in);
   
   int N=sc.nextInt();
   int sum=0;
   for(int i=1; i<=N; i++){
     sum+=i;
   }
   System.out.println(sum);
 }
}

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;
#define rep(i,s,e) for(int i = (int)(s); i < (int)(e); ++i)
#define per(i,s,e) for(int i = (int)(s)-1; i >= (int)(e); --i)

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int Max(auto b,auto e){
  if(b == e)return 0;
  return max(*b,Max(++b,e));
}

int main(){
  int n; cin >> n;
  vector<int> v(n);
  vector<int> m(n+1,0);
  cin >> v;
  for(int i = 0; i < n; ++i){
    m[v[i]] = m[v[i]-1]+1;    
  }
  cout << n - Max(m.begin(),m.end()) << endl;
  return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <utility>
#include <algorithm>
using namespace std;
const int mod = 1e9 + 7;
int main() {
  int N, X;
  cin >> N >> X;
  vector <int> L(N);
  for (int i = 0; i < N; i++) {
	  cin >> L[i];
	}
  int D   = 0;
  int ans = 1;
  for (int i = 0; i < N; i++) {
	  D += L[i];
	  if (D <= X) {
		  ans++;
		}
	}
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
 
""" n! mod m 階乗
mod = 1e9 + 7
N = 10000000
fac = [0] * N
def ini():
  fac[0] = 1 % mod
  for i in range(1,N):
    fac[i] = fac[i-1] * i % mod"""
 
"""mod = 1e9+7
N = 10000000
pw = [0] * N
def ini(c):
  pw[0] = 1 % mod
  for i in range(1,N):
    pw[i] = pw[i-1] * c % mod"""
 
"""
def YEILD():
  yield 'one'
  yield 'two'
  yield 'three'
generator = YEILD()
print(next(generator))
print(next(generator))
print(next(generator))
"""
"""def gcd_(a,b):
  if b == 0:#結局はc,0の最大公約数はcなのに
    return a
  return gcd_(a,a % b) # a = p * b + q"""
"""def extgcd(a,b,x,y):
  d = a
  if b!=0:
    d = extgcd(b,a%b,y,x)
    y -= (a//b) * x
    print(x,y)
  else:
    x = 1
    y = 0
  return d"""
 
# 最大公約数 と 最小公倍数
"""def gcd(a,b):
  if b == 0:
    return a
  return gcd(b, a % b)
def lcm(a,b):
  g = gcd(a,b)
  return (a * b) // g"""
 
# 二分探索
"""import bisect # 二分探索
print(A,bisect.bisect_left(A,4))
print(C,n - bisect.bisect_right(C,4))
print(sum(bisect.bisect_left(A,b) * (n-bisect.bisect_right(C,b)) for b in B))"""
 
# 円周率 pi
"""import math
pi_ = math.pi"""
 
# エラトステネスの篩
"""def Erato(n):
    prime = []
    is_prime = [True] * (n+1)
    p = 0
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2,n+1):
      if is_prime[i] == True:
        prime.append(i)
        p += 1
        for j in range(2 * i,n+1,i):
          is_prime[j] = False
    return p"""
 
def readInts():
  return list(map(int,input().split()))
mod = 10**9 + 7
def main():
  s = list(input())
  if s.count('7'):
    print('Yes')
  else:
    print('No')
if __name__ == '__main__':
  main()

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

int n;

void Init() {
	scanf("%d",&n);
}

int Calc(int x) {
	int ret=0;
	while (x) {
		ret+=x%10;
		x/=10;
	}
	return ret;
}

void Solve() {
	int Min=1e9;
	for (int i=1;i<n;++i)
		Min=std::min(Calc(i)+Calc(n-i),Min);
	printf("%d\n",Min);
}

int main()
{
	Init();
	Solve();
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>

#include <algorithm>
#include <random>
#include <bitset>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <chrono>
#include <iostream>
#include <limits>
#include <numeric>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  if (!v.empty()) {
    os << v.front();
    for (int i = 1; i < v.size(); ++i)
      os << ' ' << v[i];
  }
  return os;
}

int main() {
#ifdef LBT
  freopen("test.in", "r", stdin);
  int nol_cl = clock();
#endif
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int n;
  cin >> n;
  vector<int> a(n);
  cin >> a;
  int sum = accumulate(a.begin(), a.end(), 0);
  function<int(int)> calc = [&](int x) {
    int ret = 0;
    for (int i = 0; i < n; ++i)
      ret += (a[i] - x) * (a[i] - x);
    return ret;
  };
  cout << min(calc(sum / n), calc(sum / n + 1));

#ifdef LBT
  LOG("Time: %dms\n", int ((clock()
          -nol_cl) / (double)CLOCKS_PER_SEC * 1000));
#endif
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, n) for (long long i = (a); i < (long long)(n); ++i)
#define REPC(i, a, n) for (long long i = (a); i <= (long long)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init) \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}
/* calculate n^p mod M. O(log(p)) */ long long modpow(long long n, long long p,
                                                      long long M) {
  long long ans = 1;
  while (p > 0) {
    if (p & 1) ans = (ans * n) % M;
    n = (n * n) % M;
    p >>= 1;
  }
  return ans;
}
LL M = 1e9 + 7;
const LL MAX = 510000;
const LL MOD = 1000000007;

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

// テーブルを作る前処理
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (LL i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

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

int main() {
  LL N, K;
  cin >> N >> K;
  if(N==K){
    cout<<1<<endl;
    REP(i,0,K-1)cout<<0<<endl;
    return 0;
  }
  int R = N - K;
  COMinit();
  VEC<LL> ans(K, 0);
  REP(i, 1, K + 1) {
    // DUMP(i);
    ans[i - 1] =
        (num(K, i) * (2 * num(R, i) + num(R, i + 1) + num(R, i - 1)) % M) % M;
  }
  REP(i, 0, K) { cout << ans[i] << endl; }

  return 0;
}


Measured memory_bytes: 12160
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN=1e6+5;//最大1e9 
const int mod=998244353; 
int prime[MAXN],mu[MAXN],pnum=0;
bool vis[MAXN];//是否是素数 
ll a[MAXN],cnt[MAXN],value[MAXN];
ll inv[MAXN];
ll f[MAXN];
ll qkpow(ll a,ll p,ll mod){
    ll t=1,tt=a%mod;
    while(p){
        if(p&1)t=t*tt%mod;
        tt=tt*tt%mod;
        p>>=1;
    }
    return (t+mod)%mod;
}
ll getInv(ll a){
    return qkpow(a,mod-2,mod);
}
void sieve(){//素数+莫比乌斯函数线性筛 
	memset(vis,true,sizeof(vis)); 
	vis[0]=vis[1]=false; 
	mu[1]=1;
	f[1]=1;
	for(int i=2;i<MAXN;i++)
		inv[i]=getInv(i);
	for(int i=2;i<MAXN;i++){
		if(vis[i]){//i is a prime
			prime[pnum++]=i;
			mu[i]=(-1+mod)%mod;//mu(p)=-1
			f[i]=((1-i)%mod*inv[i]%mod+mod)%mod;//f[p]=(1-p)*inv(p) 
		} 
		for(int j=0;j<pnum&&1LL*i*prime[j]<MAXN;j++){//遍历当前素数 
			int x=prime[j];
			vis[i*x]=false;
			if(i%x==0){//x是i的最小素因子 
				mu[i*x]=0;//mu(p^k)=0,k>1 
				f[i*x]=(f[i]*inv[x]%mod+mod)%mod;
				break;
			}
			else{//i,x互质 
				mu[i*x]=(-mu[i]+mod)%mod;//积性函数性质,mu(x)=-1 
				f[i*x]=(f[i]*inv[x]%mod-f[i]+mod)%mod;
			}
		}
	}
}
int n;
int main(){
	sieve();
	memset(cnt,0,sizeof cnt);
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%lld",a+i);
		cnt[a[i]]++;
	}
	for(int i=1;i<=MAXN;i++)
		for(int j=i;j<=MAXN;j+=i)
			value[i]=(value[i]+1ll*j*cnt[j]%mod+mod)%mod;
	ll ans=0;
	for(int i=1;i<=MAXN;i++)
		ans=(ans+1ll*value[i]*value[i]%mod*f[i]%mod+mod)%mod;
	for(int i=0;i<n;i++)
		ans=(ans-a[i]+mod)%mod;
	printf("%lld",1ll*ans*inv[2]%mod);
}

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

std::vector<long long> divisors(long long n) {
	std::vector<long long> ret(0), st(0);
	for (int i = 1; i <= n / i; i++) {
		if (n % i == 0) {
			ret.push_back(i);
			if (i < n / i) st.push_back(n / i);
		}
	}
	while (st.size()) {
		ret.push_back(st.back());
		st.pop_back();
	}
	return ret;
}

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

int main() {
	long long a, b;
	std::cin >> a >> b;
	std::vector<long long> v = divisors(a), w = divisors(b);
	long long ans = 1;
	for (auto i : v) {
		auto itr = lower_bound(w.begin(), w.end(), i);
		if (itr != w.end() && *itr == i && is_prime(i)) ans++;
	}
	std::cout << ans << '\n';

	return 0;
}

Measured memory_bytes: 3700
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class BGoldenApple {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int d = in.nextInt();
            int total = 0;
            int pos = d + 1;
            int painted = 0;
            while (true) {
                if (pos > n) {
                    break;
                } else {
                    total++;
                    painted += d * 2 + 1;
                    pos = pos + d + 1 + d;
                }

            }
            if (painted < n)
                total++;
            out.println(total);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define debug(x) cerr<<#x<<": "<<x<<endl
#define trav(a,x) for(auto &a:x)
#define all(x) x.begin(),x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;

const ll MOD = 1e9+7;

using Mat = vector<vector<ll>>;

Mat mult(const Mat &a, const Mat &b) {
    int n = a.size();
    Mat c(n,vector<ll>(n));
    rep(i,0,n) rep(k,0,n) rep(j,0,n)  {
        c[i][j]=(c[i][j]+a[i][k]*b[k][j])%MOD;
    }
    return c;
}

Mat pow(Mat a, ll k) {
    if(k==1) return a;
    else {
        auto x = pow(a,k/2);
        x = mult(x,x);
        if(k%2==1) x = mult(x,a);
        return x;
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    ll k;
    cin >> n >> k;
    Mat a(n,vector<ll>(n));
    rep(i,0,n) rep(j,0,n) cin >> a[i][j];
    auto x = pow(a,k);
    ll sum = 0;
    rep(i,0,n) rep(j,0,n) sum=(sum+x[i][j])%MOD;
    cout << sum << "\n";
} 


Measured memory_bytes: 1664
#include <algorithm>
#include <array>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
#define int long long

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

    int n, a, b;
    cin >> n >> a >> b;

    if (!b) {
        cout << (a ? n : 0) << endl;
        return 0;
    }

    const int head = n / (a + b) * a;
    const int tail = min(n - n / (a + b) * (a + b), a);

    cout << head + tail << endl;
}


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

public class Program
{

	public void Proc()
	{
        int inputCount = int.Parse(Reader.ReadLine());

        long[] items = Reader.ReadLine().Split(' ').Select(a => long.Parse(a)).ToArray();

        int divOther = 0;
        int div2 = 0;
        int div4 = 0;

        items.ToList().ForEach(a=>{
            if(a%4==0) {
                div4++;
            } else if(a%2==0) {
                div2++;
            } else{
                divOther++;
            }
        });
        if(div2>0) {
            div2 = 1;
        }
        string ans = "Yes";
        if(div2+divOther>div4+1) {
            ans = "No";
        }
        Console.WriteLine(ans);
    }



    public class Reader
	{
		private static StringReader sr;
		public static bool IsDebug = false;
		public static string ReadLine()
		{
			if (IsDebug)
			{
				if (sr == null)
				{
					sr = new StringReader(InputText.Trim());
				}
				return sr.ReadLine();
			}
			else
			{
				return Console.ReadLine();
			}
		}
		private static string InputText = @"


6
2 7 1 8 2 8


";
	}

	public static void Main(string[] args)
	{
#if DEBUG
		Reader.IsDebug = true;
#endif
		Program prg = new Program();
		prg.Proc();
	}
}


Measured memory_bytes: 21600
#include<bits/stdc++.h>
using namespace std;
int const nax = 3e5 + 10, mod = 1e9 + 7;

int add (int a, int b) {
    return ((a += b) >= mod) ? a - mod : a;
}

int mul (int a, int b) {
    return 1LL * a * b % mod;
}

int power (int a, int b) {
    int res = 1;

    for ( ; b > 0 ; b >>= 1, a = mul(a, a))
        if (b & 1) res = mul(res, a);
    return res;
}

int f[nax], n, deg[nax], sz[nax];

vector<int> a[nax];

void dfs_sz (int nod = 1, int pa = 0) {

    for (int i : a[nod]) {
        if (i == pa) continue;
        dfs_sz(i, nod);
        sz[nod] += sz[i];
    }
    ++ sz[nod];
}

int inv[nax], ans = 1;

int b[nax];

int main () {
    f[0] = 1;

    scanf("%d", &n);

    for (int i = 1 ; i < n; ++ i) {
        int u, v;
        scanf("%d %d", &u, &v);
        a[u].push_back(v);
        a[v].push_back(u);
    }

    int base = 1;
    for (int i = 1 ; i <= n; ++ i) {
        base = mul(base, i);
        inv[i] = power(i, mod - 2);
    }


    int ans = 1;

    dfs_sz();

    for (int i = 1 ; i <= n ; ++ i) {
        ans = mul(ans, sz[i]);
    }

    function<void (int, int) > dfs = [&] (int nod, int pa) -> void {

        b[nod] = mul(base, power(ans, mod - 2));

        for (int i : a[nod]) {
            if (i == pa) continue;
            int pre_sz_nod = sz[nod];
            int pre_sz_i = sz[i];
            int pre_ans = ans;
            ans = mul(ans, inv[pre_sz_nod]);
            ans = mul(ans, inv[pre_sz_i]);
            sz[nod] = n - sz[i];
            sz[i] = n;
            ans = mul(ans, sz[nod]);
            ans = mul(ans, sz[i]);
            dfs(i, nod);
            sz[nod] = pre_sz_nod;
            sz[i] = pre_sz_i;
            ans = pre_ans;
        }
    };

    dfs(1, 0);

    for (int i = 1 ; i <= n;  ++ i) {
        printf("%d\n", b[i]);
    }



}
/*
    Good Luck
        -Lucina
*/


Measured memory_bytes: 21056
#include <iostream>

using namespace std;
static const int MAX=100;
static const int INFTY= (1<<21);
int M[MAX][MAX]; //?????\??????
int d[MAX]; //?????????????????¬
bool visited[MAX]; //???????¢??????????

void dijkstra(int n)
{
    int min;
    //init
    for(int i=0;i<n;i++)
    {
        visited[i]=false;
        d[i]=INFTY;
    }
    //select node 0
    d[0]=0;
    while(true)
    {
        min=INFTY;
        int min_point=-1;
        for(int i=0;i<n;i++)  //?????????????????????????????\??¶???
        {
            if(min>d[i]&&visited[i]==false)
            {
                min_point=i;
                min=d[i];
            }
        }
        if(min_point==-1) break;  //??????????????°????????????????????????

        visited[min_point]=true;
        //update
        for(int i=0;i<n;i++)
        {
            if(visited[i]==false&&M[min_point][i]!=INFTY)
                if(d[min_point]+M[min_point][i]<d[i])
                    d[i]=d[min_point]+M[min_point][i];
        }
    }
    //print
    for(int i=0;i<n;i++)
        cout<<i<<' '<<(d[i]==INFTY?-1:d[i])<<endl;
}
int main()
{
    int n;
    cin>>n;
    //init
    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)
            M[i][j]=INFTY;
    for(int i=0;i<n;i++)
    {
        int j;
        cin>>j;
        int nodes_num;
        cin>>nodes_num;
        for(int k=0;k<nodes_num;k++)
        {
            int v,d;
            cin>>v>>d;
            M[j][v]=d;
        }
    }
    dijkstra(n);
}

Measured memory_bytes: 3092
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
 {
	public static void main (String[] args)
	 {
            Scanner sc=new Scanner(System.in);
            int n=sc.nextInt(),a[]=new int[n],i;
            long sum=0;
            for(i=0;i<n;i++) {
            	a[i]=sc.nextInt();sum+=a[i];
            }
            Arrays.sort(a);
            sum-=a[n-1]/2;
            System.out.println(sum);
	 }
}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using Bint = boost::multiprecision::cpp_int;

int main() {
  Bint A, B, V, W, T;
  cin >> A >> V >> B >> W >> T;

  if (V < W) {
    cout << "NO" << endl;
    return 0;
  }
  
  // Bint d = abs(A - B);
  // Bint v = V - W;
  string result;
  if (abs(A - B) <= (V - W) * T) {
    result = "YES";
  } else {
    result = "NO";
  }
  cout << result << endl;
}

Measured memory_bytes: 3680
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <climits>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

#define INF INT_MAX/3
#define REP(i,n) for(int i=0;i<n;i++)

int main(){

	ll N;

	cin>>N;

	vector<char> ans;
	ans.reserve(100);
	int i = 0;
	while(N > 0){
		N--;
		ll a = N % 26;
		ans.push_back('a' + char(a));
		N /= 26;
	}

	for(int i = ans.size()-1; i >= 0; i--){
		cout<<ans[i];
	}
	cout<<endl;
	return 0;
}



Measured memory_bytes: 3600
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;

//using Graph = vector<vector<edge>>;
using dou =long double;
string yes="yes";
string Yes="Yes";
string YES="YES";
string no="no";
string No="No";
string NO="NO";

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(ll i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(ll i = m; i < (ll)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define query int qq;std::cin >> qq;rep(qqq,qq)
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0ll)
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
#define case std::cout <<"Case #" <<qqq+1<<": "
#define RES(a,i,j) a.resize(i);rep(ii,i)a[ii].resize(j); 
#define as assign
#define ffor for(;;)
#define ppri(a,b) std::cout << a<<" "<<b << std::endl
#define pppri(a,b,c) std::cout<<a<<" "<<b<<" "<<c<<std::endl
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define ssum(a) accumulate(a,0ll) 
#define gre(n) greater<n>()

typedef long long ll;
//
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
//typedef long long T;
const int INF = 1000000000;
const double dINF = 1000000000;
const ll INF64 = 922337203685477580ll;
//const ll MOD = 1000000007ll;
const ll MOD = 998244353ll;
const dou pi=3.141592653589793;
//メモ
//二次元配列のresizeのしかた
//vv.resize(n);
//for(size_t i=0; i<n; i++){
// vv[i].resize(n);
//}

//メモ
//負の辺を持つ最短経路問題では到達不可経路でも初期化値より小さくなりうるので注意しよう

int main(){
    int n,m;
    std::cin >> n>>m;
    vvector(a,char,n,n,0);
    vvector(b,char,m,m,0);
    reprep(i,j,n,n)std::cin >> a[i][j];
    reprep(i,j,m,m)std::cin >> b[i][j];
    bool ans=0;
    reprep(i,j,n-m+1,n-m+1){
        bool bo=1;
        reprep(ii,jj,m,m){
            if(a[i+ii][j+jj]!=b[ii][jj])bo=0;
        }
        if(bo)ans=1;
    }
    if(ans)std::cout << Yes << std::endl;
    else std::cout << No << std::endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
#include <iomanip>
#include <math.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60
const double PI = 3.14159265358979323846;

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

	int A[3];
	for (int i = 0; i < 3; i++) cin >> A[i];
	sort(A, A + 3);
	bool flag = false;
	if (A[0] == A[1] && A[1] != A[2]) flag = true;
	if (A[0] != A[1] && A[1] == A[2]) flag = true;
	if (flag) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
//前缀和
int main() {

	int n;
	scanf("%d", &n);

//	int a[n];
	long long prefix[n + 1];

//	scanf("%d", &a[0]);
//	prefix[0] = a[0];
	prefix[0] = 0;
	for (int i = 1; i <= n; ++i) {
		scanf("%lld", &prefix[i]);
		prefix[i] += prefix[i - 1];
	}

	long long min = abs(2 * prefix[1] - prefix[n]);
	long long temp;
	for (int i = 2; i < n; ++i) {
		temp = abs(2 * prefix[i] - prefix[n]);
		min = min < temp ? min : temp;
	}

	printf("%lld", min);


	return 0;
}

Measured memory_bytes: 1792
N, M = map(int, input().split())
H = list(map(int, input().split()))
AB = [list(map(int, input().split())) for i in range(M)]

tf_array = [0]*N

for a, b in AB:
    if H[a-1] > H[b-1]:
        tf_array[b-1] += 1
    elif H[a-1] == H[b-1]:
        tf_array[a-1] += 1
        tf_array[b-1] += 1
    else:
        tf_array[a-1] += 1

print(tf_array.count(0))


Measured memory_bytes: 31980