akhauriyash/Code-Regression huggingface dataset:
use std::io::*;
use std::mem;
use std::str::FromStr;
use utils::*;

pub fn main() {
    let i = stdin();
    let mut o = Vec::new();
    run(i.lock(), &mut o);
    stdout().write_all(&o).unwrap();
}

fn run<R: BufRead, W: Write>(i: R, o: &mut W) {
    let mut i = CpReader::new(i);
    let (n, m) = i.read2::<usize, usize>();
    let mut bss = vec![Vec::new(); n];
    for _ in 0..n - 1 + m {
        let (a, b) = i.read2::<usize, usize>();
        bss[a - 1].push(b - 1);
    }
    let tree = solve(&bss);
    for node in tree {
        let no = if let Some(p) = node { p + 1 } else { 0 };
        writeln!(o, "{}", no).unwrap();
    }
}
fn solve(bss: &[Vec<usize>]) -> Vec<Option<usize>> {
    let n = bss.len();
    let mut cs = vec![0; n];
    for bs in bss {
        for &b in bs {
            cs[b] += 1;
        }
    }
    let root = cs.iter().position(|&c| c == 0).unwrap();
    let mut a = vec![root];
    let mut a_next = Vec::new();
    let mut ps = vec![None; n];

    while !a.is_empty() {
        for &a in &a {
            for &b in &bss[a] {
                cs[b] -= 1;
                if cs[b] == 0 {
                    ps[b] = Some(a);
                    a_next.push(b);
                }
            }
        }
        a.clear();
        mem::swap(&mut a, &mut a_next);
    }
    ps
}

mod utils {
    use super::*;

    pub struct CpReader<R: BufRead> {
        r: R,
        s: String,
    }

    macro_rules! fn_read {
        { $f:ident($($t:ident),*) } => {
            #[allow(dead_code)]
            pub fn $f<$($t: FromStr),*>(&mut self) -> ($($t),*) {
                let i = &mut self.read_line().split(' ');
                ($(read_next::<$t,_>(i)),*)
            }
        };
    }

    impl<R: BufRead> CpReader<R> {
        pub fn new(r: R) -> Self {
            CpReader {
                r: r,
                s: String::new(),
            }
        }
        pub fn read_line(&mut self) -> &str {
            self.s.clear();
            self.r.read_line(&mut self.s).unwrap();
            self.s.trim()
        }

        fn_read! { read2(T1, T2) }
        fn_read! { read3(T1, T2, T3) }
        fn_read! { read4(T1, T2, T3, T4) }
        fn_read! { read5(T1, T2, T3, T4, T5) }
    }
    fn read_next<'a, T: FromStr, I: Iterator<Item = &'a str>>(i: &mut I) -> T {
        i.next().unwrap().parse().ok().unwrap()
    }

}


Measured memory_bytes: 14588
import java.util.*;
// warm-up
public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		System.out.println(((sc.nextInt()*sc.nextInt())&1)==0 ? "Even" : "Odd");
		sc.close();		
	}

	public static void main(String args[]) {
		solve();
	}

}

Measured memory_bytes: 35600
package main

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

const (
	defaultBufferSize = 1024
	maxBufferSize     = 1e6
	Mod               = 1e9 + 7
)

var sc = bufio.NewScanner(os.Stdin)

// sc.Buffer(make([]byte, defaultBufferSize), maxBufferSize)

func readInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

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

func readInt64() int64 {
	sc.Scan()
	i, err := strconv.ParseInt(sc.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return int64(i)
}

func readfloat64() float64 {
	sc.Scan()
	f, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		panic(err)
	}
	return f
}

func abs(a int) int {
	if a < 0 {
		return a * -1
	}
	return a
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

func ModComb(n, k int) int {
	if k == 0 {
		return 1
	}
	x, y := n, k
	for i := 1; i < k; i++ {
		x = x * (n - i) % Mod
		y = y * (k - i) % Mod
	}
	inv := ModInv(y)
	return x * inv % Mod
}

func ModFact(x int) int {
	fact := 1
	for i := 1; i <= x; i++ {
		fact = fact * i % Mod
	}
	return fact
}

func ModInv(x int) int {
	return ModPow(x, Mod-2)
}

func ModPow(a, n int) int {
	res := 1
	for n > 0 {
		if n%2 != 0 {
			res = res * a % Mod
		}
		a = a * a % Mod
		n /= 2
	}
	return res
}

func pow(a, n int) int {
	if n == 0 {
		return 1
	}

	ans := 0
	if n%2 == 0 {
		ans = pow(a*a, n/2)
	} else {
		ans = a * pow(a*a, (n-1)/2)
	}
	return ans
}

func intSliceReverse(slice []int) []int {
	for i, j := 0, len(slice)-1; i < j; i, j = i+1, j-1 {
		slice[i], slice[j] = slice[j], slice[i]
	}
	return slice
}

func stringReverse(str string) string {
	runes := []rune(str)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func primeFactorization(x int) map[int]int {
	result := make(map[int]int, 0)
	for i := 2; i*i <= x; i++ {
		for x%i == 0 {
			result[i]++
			x /= i
		}
	}
	if x != 1 {
		result[x]++
	}
	return result
}

func isPrime(x int) bool {
	if x == 1 {
		return false
	}
	for i := 2; i*i <= x; i++ {
		if i == x {
			continue
		}
		if x%i == 0 {
			return false
		}
	}
	return true
}

func main() {
	sc.Split(bufio.ScanWords)

	N, K, Q := readInt(), readInt(), readInt()

	ansCount := make(map[int]int, 0)
	for i := 0; i < Q; i++ {
		a := readInt()
		a--
		ansCount[a]++
	}
	for i := 0; i < N; i++ {
		ans := K - (Q - ansCount[i])
		if ans > 0 {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	}
}


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

ll N;

int main(){
    cin>>N;

    ll ans=N*(N-1)/2;

    cout<<ans<<endl;
}

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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

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

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

ll gcd(ll a, ll b){
  ll r = a%b;
  if(r==0) return b;
  else return gcd(b, a%b);
}

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

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

struct UnionFind{
  ll N;
  llvec p;
  llvec cnt;
  UnionFind(ll n){
    N = n;
    p=llvec(N);
    cnt=llvec(N, 0);
    rep(i, N){
      p[i] = i;
      cnt[i] = 1;
    }
  }

  void con(ll a, ll b){
    P at = root(a);
    P bt = root(b);
    if(at.second!=bt.second){
      if(at.first>bt.first){
        swap(at, bt);
        swap(a, b);
      }
      p[at.second] = bt.second;
      cnt[bt.second]+=cnt[at.second];
      p[a]=bt.second;
    }
  }

  P root(ll a){
    ll atmp = a;
    ll c=0;
    while(atmp!=p[atmp]){
      atmp = p[atmp];
      c++;
    }
    p[a] = atmp;
    return {c, atmp};
  }

  bool is_con(ll a, ll b){
    P at=root(a);
    P bt=root(b);
    return at.second == bt.second;
  }
  
};

struct dijkstra{
  ll N;
  llvec d;
  vector<vector<edge>> e;
  dijkstra(ll n){
    N = n;
    //d = llvec(N, 1e18);
    e = vector<vector<edge>>(N);
  }

  void add_edge(ll from, ll to, ll cost){
    e[from].push_back({to, cost});
  }

  void run(ll start){
    priority_queue<P, vector<P>, greater<P>> que;
    que.push({0, start});
    d = llvec(N, 1e18);
    d[start]=0;
    while(!que.empty()){
      P q = que.top();que.pop();
      ll dc = q.first;
      ll x = q.second;
      if(dc>d[x]){
        continue;
      }else{
        for(auto ip: e[x]){
          if(d[ip.x]<=d[x]+ip.c){
            continue;
          }else{
            d[ip.x]= d[x]+ip.c;
            que.push({d[ip.x], ip.x});
          }
        }
      }
    }
  }  
};


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N, K;
  cin >> N >> K;
  ll ans = 0;
  llvec d(K+1, 0);
  ll cnt=0;
  rrep(i, K+1){
    if(i==1)break;
    ll num = K / i;
    d[i] = modpow(num, N, MOD);
    ll j=2;
    while(i*j<=K){
      d[i] = mod(d[i] - d[i*j], MOD);
      j++;
    }
    cnt =mod(cnt+ d[i], MOD);
    ans = mod(ans + d[i]*i, MOD);
  }
  ans = mod(ans + mod(modpow(K,N,MOD) - cnt ,MOD),MOD);
  cout << ans;
  return 0;
}


Measured memory_bytes: 4012
n = int(input())
ary = list(map(int,input().split()))
a = sorted(ary)
b = (len(ary)+1)//2-1
for i in range(n):
    if a[b] < ary[i]:
        print(a[b])
    elif a[b] == ary[i]:
        print(a[b+1])
    elif a[b] > ary[i]:
        print(a[b+1])

Measured memory_bytes: 26772
#define _GLIBCXX_DEBUG //エラーを出すためのおまじない
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
//#include <cstdlib>  // abs() for integer
#include <cmath>    // abs() for float, and fabs()
#include <math.h>
using namespace std;
#define coYES cout << "YES" << endl
#define coNO cout << "NO" << endl
#define coYes cout << "Yes" << endl
#define coNo cout << "No" << endl
#define coyes cout << "yes" << endl
#define cono cout << "no" << endl
//#define cocount cout << count << endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define Cinint(n) int n;\
cin >> n;
#define Cinvecint(a, n) vector<int> a(n);\
for (int i = 0; i < (int)(n); i++) {\
  int num;\
  cin >> num;\
  a.at(i) = num;\
}
#define Cinstring(s) string s;\
cin >>s;

int main() {
  int n;
  cin >> n;
  vector<vector<int>> d(n, vector<int>(2));
  rep(i, n) {
    rep(j, 2) {
      int num;
      cin >> num;
      d.at(i).at(j) = num;
    }
  }
  bool flag = true;
  rep(i, n-2) {
    if (d.at(i).at(0) == d.at(i).at(1)) {
      if (d.at(i+1).at(0) == d.at(i+1).at(1)) {
        if (d.at(i+2).at(0) == d.at(i+2).at(1)) {
          coYes;
          flag = false;
          
          break;
        }
      }
    }
  }
  if (flag) {
    coNo;
  }
  

  
  
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define pb(x) push_back(x)
#define MP(x,y) make_pair(x,y)
using namespace std;
int gcd(int a,int b)
{
	if(a%b==0)
		return b;
	else
		return gcd(b,a%b);
}
int x[107],y[107],alt[107];
void solve()
{
    int cx,cy,h,n,index=0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x[i]>>y[i]>>alt[i];
        if(alt[i]>0)
            index=i;
    }
    for(int i=0;i<=100;i++)
        for(int j=0;j<=100;j++)
        {
            int coun=0;
            h=alt[index]+abs(i-x[index])+abs(j-y[index]);
            for(int k=0;k<n;k++)
            {
                if(alt[k]==max(0,h-abs(i-x[k])-abs(j-y[k])))
                    coun++;
            }
            if(coun==n)
            {
                cout<<i<<" "<<j<<" "<<h;
                return;
            }
        }
}
int main()
{
	int t=1;
	//cin>>t;
	while(t--)
		solve();
	return(0);
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 0xccccccc;
const ll LINF = 922337203685477580LL;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

const int mod = 1000000007;
//const int mod = 998244353;

struct mint {
  int64_t x;
  mint(int64_t x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(int64_t t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  //for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) {return mint(*this) /= a;}
};

istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
  vector<mint> frac, ifrac;
  combination(int n):frac(n+1), ifrac(n+1) {
    assert(n < mod);
    frac[0] = 1;
    for (int i = 1; i <= n; ++i) frac[i] = frac[i-1]*i;
    ifrac[n] = frac[n].inv();
    for (int i = n; i >= 1; --i) ifrac[i-1] = ifrac[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return frac[n]*ifrac[k]*ifrac[n-k];
  }
} C(1000000);

const int N = 3010;

//head

int h, w, n;
P rc[N];
mint dp[N];
inline int ssu(const P &a) {return a.first + a.second;}
bool operator<(const P &a, const P &b) {return ssu(a) < ssu(b);}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> h >> w >> n;
  rep(i, n) {
    cin >> rc[i];
    rc[i].first--;
    rc[i].second--;
  }
  sort(rc, rc+n);
  rc[n] = P(h-1, w-1);
  rep(i, n+1) {
    int r, c;
    tie(r, c) = rc[i];
    dp[i] += C(r+c, r);
    for(int j = i+1; j <= n; j++) {
      int r_, c_;
      tie(r_, c_) = rc[j];
      if(r_ >= r and c_ >= c) dp[j] -= dp[i] * C(r_+c_-r-c, r_-r);
    }
  }

  cout << dp[n] << endl;
}

Measured memory_bytes: 19012
#include <iostream>
#include <string>
#include <set>
#include <algorithm>
#include <cmath>
using namespace std;

int main(){
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(0);
 
	int n;
	string cmd, dna;
	set<long long int> dictionary;

	cin>>n;
	for(int i=0;i<n;i++){
		cin>>cmd>>dna;
		long long int x = 0;
		if(cmd == "insert"){
			for(int j=0;j<dna.length();j++){
				if(dna[j] == 'A')
					x += 1 * pow((double)10, (double)(j+1));
				else if(dna[j] == 'C')
					x += 2 * pow((double)10, (double)(j+1));
				else if(dna[j] == 'G')
					x += 3 * pow((double)10, (double)(j+1));
				else if(dna[j] == 'T')
					x += 4 * pow((double)10, (double)(j+1));
			}
			dictionary.insert(x);
		}else if(cmd == "find"){
			for(int j=0;j<dna.length();j++){
				if(dna[j] == 'A')
					x += 1 * pow((double)10, (double)(j+1));
				else if(dna[j] == 'C')
					x += 2 * pow((double)10, (double)(j+1));
				else if(dna[j] == 'G')
					x += 3 * pow((double)10, (double)(j+1));
				else if(dna[j] == 'T')
					x += 4 * pow((double)10, (double)(j+1));
			}
			
			if(dictionary.find(x) == dictionary.end())
				cout<<"no"<<endl;
			else
				cout<<"yes"<<endl;
		}
	}

	return 0;
}

Measured memory_bytes: 14176
#include<bits/stdc++.h>
#include<string.h>
#include<math.h>
#include<vector>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i = 0;i < (ll)(n);i++)
#define INF (1e9 + 1)
int main()
{
    int N,A;
    cin >> N >> A;
    if(N % 500 <= A){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
        }

    return 0;
}

/*
    REP(i,a){
        REP(j,b){

        }
    }
    */



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

int main(){
    int N,K;
    cin>>N>>K;
    int ans=0;
    rep(i,N){
        int h;
        cin>>h;
        if(h>=K) ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")

using namespace std;

typedef long long ll;

//#include<ext/pb_ds/assoc_container.hpp>
//#nclude<ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>pb_ds;

#define pi pair<int,int>
#define F first
#define S second
#define pb push_back
#define pp pop_back
#define mod 1000000007
#define pai acos(-1)
#define N 1000005


int main ()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
//    freopen("in.txt","r",stdin);
//   freopen("out.txt","w",stdout);
    int t,n,m,k,a,b,c;
    string s;
    cin>>s;
    if(s[0]=='7'||s[1]=='7'||s[2]=='7') cout<<"Yes\n";
    else cout<<"No\n";

    return 0;
}


Measured memory_bytes: 3640
#include <stack>
#include <queue>
#include <cstdio>
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n0,n) for(int i=n0;i<n;i++)
#define Com(i,j,n) for(int i=0;i<n-1;i++)for(int j=i+1;j<n;j++)
const int INF =100100100;
const int MOD = (int)1e9+7;
const double EPS = 1e-9;
typedef long long ll;
typedef long li;
#define pb push_back 
#define mp make_pair

signed main (){	
	string hoge;
	int NN,KK ;
	cin >> NN >> KK ;
	cin >> hoge;
	vector <int> renzokuchi;
	char temp;
	temp = hoge[0];
	int counter = 1;
	Rep(i,1,NN){
		if(temp == hoge[i]) {
			counter ++;
		} else {
			temp = hoge[i];
			renzokuchi.pb(counter);
			if(i == NN - 1){
				renzokuchi.pb(1);
				counter = 0;
				break;
			}
			counter = 1;
		}
	}
	if(counter != 0 ) {
		renzokuchi.pb(counter);
	}

	int max = 0;
	int current_value = 0;
	int blocks = renzokuchi.size();

	int start,end;
	// 直立はじまりのとき
	if(hoge[0] == '0') {

		// 全部行けるとき
		if ((blocks + blocks%2)/2 <= KK) {
			rep(i,blocks){
				max += renzokuchi[i];
			}
			cout << max << endl;
			return 0;
		}

		start = 0;
		end = 2 * KK;

		rep(i, end) {	// 最初の長さを取る
				current_value += renzokuchi[i];
		}
		max = current_value;

		while(end < blocks) {
			// blocksの先頭を取って、しゃくとりをする
			if(start == 0) {
				current_value -= renzokuchi[start];
				current_value += renzokuchi[end];
				if(end+1 < blocks){
						current_value += renzokuchi[end+1];
				}
				start += 1;
				end +=2 ;
				if( max < current_value) {max = current_value;}
				continue;
			}
			else {
				current_value -= renzokuchi[start];
				current_value -= renzokuchi[start+1];
				current_value += renzokuchi[end];
				if(end+1 < blocks){
						current_value += renzokuchi[end+1];
				}
			}

			if( max < current_value) {max = current_value;}
			start += 2;
			end +=2;
		}

	} 
	else { // 倒立始まり
		// 全部行けるとき
		if ((blocks - blocks%2)/2 <= KK) {
			rep(i,blocks){
				max += renzokuchi[i];
			}
			cout << max << endl;
			return 0;
		}

		start = 0;
		end = 2 * KK + 1;

		rep(i, end ) {
				current_value += renzokuchi[i];
		}
		max = current_value;

		while(end < blocks) {	// 最初の長さを取る
			
			// blocksの先頭を取って、しゃくとりをする
			current_value -= renzokuchi[start];
			current_value -= renzokuchi[start+1];

			current_value += renzokuchi[end];
			if(end+1 < blocks){
				current_value += renzokuchi[end+1];
			}
			if( max < current_value) max = current_value;
			
			start += 2;
			end +=2;
		}
	}
	cout << max << endl;


	return 0;
}


Measured memory_bytes: 1020
import math
n = int(input())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
p1 = 0
p2 = 0
p3 = 0
pinf = 0
for i in range(n):
    D = abs(x[i] - y[i])
    p1 += D
    p2 += D**2
    p3 += D**3
    if pinf < D:
        pinf = D
p2 = math.sqrt(p2)
p3 = p3**(1/3)
print("{0:.6f}".format(p1))
print("{0:.6f}".format(p2))
print("{0:.6f}".format(p3))
print("{0:.6f}".format(pinf))


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

#define MAX 200000
#define SENTINEL 2000000000
typedef long long ll;

int L[MAX / 2 + 2], R[MAX / 2 + 2];
int A[MAX];

ll merge(int left, int mid, int right) {
	int i, j, k;
	ll cnt = 0;
	int n1 = mid - left;
	int n2 = right - mid;
	for (i = 0; i < n1; i++)L[i] = A[left + i];
	for (i = 0; i < n2; i++)R[i] = A[mid + i];
	L[n1] = R[n2] = SENTINEL;
	i = j = 0;
	for (k = left; k < right; k++) {
		if (L[i] <= R[j]) {
			A[k] = L[i++];
		}
		else {
			A[k] = R[j++];
			cnt += n1 - i;
		}
	}
	return cnt;
}
ll mergeSort(int left, int right) {
	int mid;
	ll v1, v2, v3;
	if (left + 1 < right) {
		mid = (left + right) / 2;
		v1 = mergeSort(left, mid);
		v2 = mergeSort(mid, right);
		v3 = merge(left, mid, right);
		return v1 + v2 + v3;
	}
	else return 0;
}
int main(void) {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) cin >> A[i];
	ll ans = mergeSort(0, n);
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 4664
#include <algorithm>
#include <array>
#include <cassert>
#include <iostream>
#include <vector>
using namespace std;

template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<typename T, size_t size> ostream& operator<<(ostream &os, const array<T, size> &arr) { os << '{'; string sep; for (const auto &x : arr) os << sep << x, sep = ", "; return os << '}'; }
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }

void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }

#ifdef NEAL_DEBUG
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif

const int BITS = 60;

template<typename T>
struct xor_basis {
    // A list of basis values sorted in decreasing order, where each value has a unique highest bit.
    // We use a static array instead of a vector for better performance.
    T basis[BITS];
    int n = 0;

    T min_value(T start) const {
        if (n == BITS)
            return 0;

        for (int i = 0; i < n; i++)
            start = min(start, start ^ basis[i]);

        return start;
    }

    T max_value(T start = 0) const {
        if (n == BITS)
            return ((T) 1 << BITS) - 1;

        for (int i = 0; i < n; i++)
            start = max(start, start ^ basis[i]);

        return start;
    }

    bool add(T x) {
        x = min_value(x);

        if (x == 0)
            return false;

        basis[n++] = x;

        // Insertion sort.
        for (int k = n - 1; k > 0 && basis[k] > basis[k - 1]; k--)
            swap(basis[k], basis[k - 1]);

        return true;
    }

    void merge(const xor_basis<T> &other) {
        for (int i = 0; i < other.n && n < BITS; i++)
            add(other.basis[i]);
    }

    void merge(const xor_basis<T> &a, const xor_basis<T> &b) {
        if (a.n > b.n) {
            *this = a;
            merge(b);
        } else {
            *this = b;
            merge(a);
        }
    }
};


void run_case() {
    int N;
    cin >> N;
    vector<int64_t> A(N);

    for (auto &a : A)
        cin >> a;

    string S;
    cin >> S;
    xor_basis<int64_t> basis;
    bool problem = false;

    for (int i = N - 1; i >= 0; i--)
        if (S[i] == '0')
            basis.add(A[i]);
        else if (basis.min_value(A[i]) != 0)
            problem = true;

    cout << problem << '\n';
}

int main() {
    ios::sync_with_stdio(false);
#ifndef NEAL_DEBUG
    cin.tie(nullptr);
#endif

    int tests;
    cin >> tests;

    while (tests-- > 0)
        run_case();
}


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

	return 0;
}
	


Measured memory_bytes: 256
// Author : Sarthak Kapoor
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,n) for(int i=0;i<n;++i)
#define repa(i,a,n) for(int i=a;i<n;++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define repba(i,b,a) for(int i=b;i>=a;--i)
#define repab(i,a,b) for(int i=a;i<b;++i)
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define msi map<string,int>
#define mii map<int,int>
#define viip vector<pair<int,pair<int,int> > > 
#define mp make_pair
#define vip vector<pair<int,int> >
#define pb push_back 
#define po pop_back
#define fi first
#define sec second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define s(v) v.size()
ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());//use rng()%n for numbers in range [0,n-1]
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int n;
	cin>>n;
	vi v(n);
	rep(i,n){
		cin>>v[i];
	}	
	rep(i,n){
		if(v[i]%2==0){
			if(v[i]%3==0 || v[i]%5==0)continue;
			else{
				cout<<"DENIED";
				return 0;
			}
		}
	}
	cout<<"APPROVED";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template < typename T > string tost( const T& n ) { ostringstream stm; stm << n; return stm.str();}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
int const INF = 1001001001;


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

int a,b,x;
cin >> a >> b >> x;
if(a <= x && x <= a+b) cout << "YES" << endl;
else cout << "NO" << endl;

return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include <string>
using namespace std;
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(int)(n); i++)
typedef long long ll;
const int INF = numeric_limits<int>::max();
const int MOD = 1e9 + 7;

int main(){
  int N;
  ll ans=1;
  cin >> N;
  int C[N+1] = {0};
 for(int i=2; i<=N; i++){
    int j = i;
    for(int k=2; k<=N; k++){
      while(j%k==0){
        j /= k;
        C[k]++;
      }
    }
  }
 for(int k=1; k<=N; k++){
    ans *= (C[k]+1);
   ans %= MOD;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
 
static const int N = 100;
 
int main() {
  int n, p[N+1], m[N+1][N+1];
  cin >> n;
  for ( int i = 1; i <= n; i++ ) {
    cin >> p[i - 1] >> p[i];
  }
 
  for ( int i = 1; i <= n; i++ ) m[i][i] = 0;
  for ( int l = 2; l <= n; l++ ) {
    for( int i = 1; i <= n -l +1; i++ ) {
      int j = i + l -1;
      m[i][j] = (1 << 21);
      for(int k = i; k <= j -1; k++) {
    m[i][j] = min(m[i][j], m[i][k] + m[k+1][j] + p[i-1] * p[k] * p[j]);
      }
    }
  }
 
  cout << m[1][n] << endl;
 
  return 0;
}

Measured memory_bytes: 1200
k = int(input())

r = 7 % k
ans = 1
cnt = [0] * (k+1)
while r != 0:
  cnt[r] = 1
  r *= 10
  r += 7
  r %= k
  ans += 1
  if cnt[r]:
    ans = -1
    break

print(ans)


Measured memory_bytes: 16788
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

class Solution {
public:
    long long solve(vector<int>& A, vector<int>& B, int h) {
        int n = A.size();
        const long long INF = 1LL << 60;
        vector<long long > dp(h + 1, INF);
        dp[h] = 0;
        
        for (int i = h; i > 0; --i) {
            for (int j = 0; j < n; ++j) {
                int ni = max(0, i - A[j]);
                dp[ni] = min(dp[ni], dp[i] + B[j]);
            }
        }
        return dp[0];
    }
};

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int h, n;
    cin >> h >> n;
    vector<int> A(n);
    vector<int> B(n);
    for (int i = 0; i < n; ++i) {
        cin >> A[i] >> B[i];
    }

    Solution sol;

    cout << sol.solve(A, B, h) << "\n";

    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#define INF 1000000
#define NIL -2
#define GRAY -3
#define WHITE -4
#define BRACK -5

using namespace std;

int n;
int M[101][101];
int d[101];//重み
int p[101];//親
int color[101];
int sum = 0;

void Prim(int u) {
	color[u] = BRACK;

	for (int i = 1; i <= n; i++) {
		if (color[i] != BRACK && M[u][i] != -1) {
			color[i] = GRAY;
			if (d[i] > M[u][i]) {
				d[i] = M[u][i];
				p[i] = u;
			}
		}
	}

	sum += d[u];

	//全体のうち重みが一番小さいものについて再帰
	//color[v] = WHITE かつ　d[v]が一番小さい点v について再帰
	//かつGRAYの点とつながっている
	int min = 0;
	d[min] = 100000;


	for (int v = 1; v <= n; v++) {
		if (color[v] == GRAY) {
			if (d[v] < d[min]) {
				min = v;
			}
		}
	}

	if (min != 0) {
		Prim(min);
	}
}

int main() {
	cin >> n;

	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			M[i][j] = 0;
		}
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			cin >> M[i][j];
		}
	}
	for (int i = 1; i <= n; i++) {
		color[i] = WHITE;
	}

	for (int i = 1; i <= n; i++) {
		d[i] = INF;
		p[i] = NIL;
	}
	d[1] = 0;

	//関数
	Prim(1);

	cout << sum << endl;


	return 0;
}


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

signed main(void)
{
	long long n, t, T, tmp, ans;
	cin >> n >> T >> tmp;

	ans = 0;
	rep(i, n - 1)
	{
		cin >> t;
		ans += min(T, t - tmp);
		tmp = t;
	}
	ans += T;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
# count p<=x<=q and p<=y <=q
# 長方形に含まれる格子点の数
import numpy as np
N,M,Q = map(int,input().split())

cnt = [[0]*(N+1) for _ in range(N+1)]
for _ in range(M):
  x,y = map(int,input().split())
  cnt[x][y] += 1

cnt = np.cumsum(cnt,axis=0).cumsum(axis=1)

for _ in range(Q):
  p,q = map(int,input().split())
  p -= 1
  x = cnt[q,q]
  x -= cnt[q,p]
  x -= cnt[p,q]
  x += cnt[p,p]
  print(x)

Measured memory_bytes: 18280
#include <cstdio>
#include <algorithm>
#define fo(i,a,b) for(int i=a;i<=b;++i)
#define fod(i,a,b) for(int i=a;i>=b;--i)
#define min(q,w) ((q)>(w)?(w):(q))
#define max(q,w) ((q)<(w)?(w):(q))
using namespace std;
const int N=350,M=1e7;
int read(int &n)
{
    char ch=' ';int q=0,w=1;
    for(;(ch!='-')&&((ch<'0')||(ch>'9'));ch=getchar());
    if(ch=='-')w=-1,ch=getchar();
    for(;ch>='0' && ch<='9';ch=getchar())q=q*10+ch-48;n=q*w;return n;
}
int m,n,ans;
bool az[M+10],prz[M+10];
bool B[N][N];
int pr[M/5];
int a[N],b[N],zx[N];
int z[N],TI;
void Pre()
{
    fo(i,2,M)
    {
        if(!prz[i])pr[++pr[0]]=i;
        fo(j,1,pr[0])
        {
            int t=i*pr[j];
            if(t>M)break;
            prz[t]=1;
            if(!t%pr[j])break;
        }
    }
    prz[1]=prz[2]=1;
}
bool OK(int q)
{
    if(z[q]==TI)return 0;
    z[q]=TI;
    fo(i,1,b[0])if(B[q][i]&&(!zx[i]||OK(zx[i])))return zx[i]=q,1;
    return 0;
}
int main()
{
    int q;
    Pre();
    read(n);
    fo(i,1,n)az[read(q)]=1;
    fo(i,1,M+1)if(az[i]!=az[i-1])
    {
        if(i&1)a[++a[0]]=i;
        else b[++b[0]]=i;
    }
    fo(i,1,a[0])fo(j,1,b[0])if(!prz[abs(a[i]-b[j])])B[i][j]=1;
    q=0;
    fo(i,1,a[0])
    {
        ++TI;if(OK(i))++q;
        
    }
    ans=q+2*((a[0]-q)/2+(b[0]-q)/2);
    if((a[0]-q)&1)ans+=3;
    printf("%d\n",ans);
}

Measured memory_bytes: 24832
#include<stdio.h>
int main()
{
	long n,i,cnt=0;
	char a[100010]={};
	while(~scanf("%ld",&n)){
		getchar();
		gets(a);
		for(i=0;i<n;i++){
			while(a[i]==a[i+1]){
				i++;
			}cnt++;
		}printf("%ld\n",cnt);
		cnt=0;
	}
}

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

int a[20][3];
int b[20];
int n;
int main()
{
	while(cin>>n)
	{
		for(int i=1;i<=n;i++)
		{
			cin>>a[i][1]>>a[i][2];
			b[i] = i;
		}
		double tot = 0;
		int num = 0;
		do
		{
			num++;
			double lenth=0;
			for(int i=1;i<n;i++)
			{
				lenth+=sqrt((a[b[i]][1]-a[b[i+1]][1])*(a[b[i]][1]-a[b[i+1]][1]) + ((a[b[i]][2]-a[b[i+1]][2])*(a[b[i]][2]-a[b[i+1]][2])));
			}
			//cout<<lenth<<" ";
			tot+=lenth;
		}while(next_permutation(b+1,b+n+1));
		tot=tot/num;
		printf("%.10f\n",tot);
	}
}

Measured memory_bytes: 256
/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
        Comilla  University

*/
#include<bits/stdc++.h>
#define pi 2*acos(0.0)
#define ll long long
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node
#define spc " "
#define  E  2.71828182845904523536
#define pb push_back
#define pp pop_back
#define valid(nx,ny) nx>=0 && nx<n && ny>=0 && ny<m
#define ee endl
#define pii pair<int,int>
#define infinity 10000000000000000
#define mod 1000000007
int fx[]={0,0,+1,-1};
int fy[]={+1,-1,0,0};

using namespace std;
///check n=1;
///check corner case;
const int maX=1e5+1;
vector<ll>Graph[maX],cost[maX];
ll visit[maX];


int main()
{
    ll n,m,i;cin>>n>>m;
    if(n>m)swap(n,m);
    for(i=1;i<=m;i++)cout<<n;
return 0;
}


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

using namespace std;

//??\???
#define MAX_N 44
int dp[MAX_N + 1];

int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  dp[0] = 1;
  dp[1] = 1;
  for(int i = 2; i <= n; i++) {
    dp[i] = dp[i-1] + dp[i-2];
  }

  cout << dp[n] << "\n";

  return 0;
}

Measured memory_bytes: 3208
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		int n = 0;
		int x = 0;
		while (true) {
			String[] str = (br.readLine()).split(" ");
			n = Integer.parseInt(str[0]);
			x = Integer.parseInt(str[1]);
			if (n == 0 && x == 0) {
				break;
			}
			int count = 0;
			for (int i = 1; i <= n - 2; i++) {
				for (int j = i + 1; j <= n - 1; j++) {
					for (int k = j + 1; k <= n; k++) {
						if (i + j + k == x) {
							count++;
						}
					}
				}
			}
			sb.append(count).append("\n");
		}
		System.out.print(sb);
	}
}

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

int main() {
  int N, K, res = 1;
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    if (res < K) {
      res *= 2;
    } else {
      res += K;
    }
  }
  cout << res;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,N) for(int (i)=0;(i)<(N);++(i))
#define rrep(i,N) for(int (i)=(N-1);(i)>0;--i)
#define FOR(i,j,N) for(int (i)=(j);(i)<(N);++(i))
#define put(n) cout<<(n)<<endl;
#define VI vector<int>
#define VII vector<vector<int>>
#define all(v) v.begin(),v.end()
#define pb(n) push_back(n)

int gcd(int n,int m){return (m==0?n:gcd(m,n%m));}

int main(){
    int N,X,a,ans;
    cin>>N>>X;
    vector<int> x,dist;
    rep(i,N){cin>>a;x.pb(a);}
    sort(all(x));
    a = lower_bound(all(x),X) - x.begin();
    x.insert(x.begin()+a,X);
    rep(i,N)dist.pb(x[i+1]-x[i]);
    if(dist.size()==1) ans = dist[0];
    else{
        ans = dist[0];
        for(int i=1;i<dist.size();++i){
            ans = gcd(ans,dist[i]);
        }
    }

    put(ans);
}

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

using namespace std;

using ll = long long;
constexpr int mo = 1e9+7;
constexpr int inf = 1<<30;
constexpr ll infl = 1ll<<60;
constexpr ll mo2 = 998244353;
const double PAI = acos(-1);
constexpr long double eps = 1e-9;


int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int a,b,c,d,e;
    cin>>a>>b>>c>>d>>e;
    int h = c-a;
    int m = d-b;
    if(m < 0){
        m = 60+m;
        h--;
    }
    int mh = h*60 + m -e;
    if(mh <0)cout << 0 << endl;
    else cout << mh << endl;
    return 0;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
const double EPS = 1e-8;
const double INF = 1e12;
typedef complex<double> point;
namespace std{
    bool operator < (const point& a, const point& b) {
        return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
    }
}
double cross(const point& a, const point& b) {
    return imag(conj(a)*b);
}
double dot(const point& a, const point& b) {
    return real(conj(a)*b);
}

int main()
{
    double xp1, yp1, xp2, yp2;
    scanf("%lf %lf %lf %lf", &xp1, &yp1, &xp2, &yp2);
    point p1(xp1, yp1), p2(xp2, yp2);
    int n;
    scanf("%d", &n);
    for(int i = 0; i < n; ++i) {
        double xp, yp;
        scanf("%lf %lf", &xp, &yp);
        point p(xp,yp);
        point q = dot(p-p1,p2-p1)/dot(p2-p1,p2-p1)*(p2-p1);
        point res = p + (q-(p-p1))*2.0;
        printf("%.10lf %.10lf\n", res.real(), res.imag());
    }
    return 0;
}


Measured memory_bytes: 3244
#include<iostream>
#include<cstdlib>
#include <cmath>
#include<algorithm>
#include<vector>
#include<string>
#include<unordered_map>
#include <bits/stdc++.h>
using namespace std;

#define INF 10000000
int main()
{ 
    string S;
    cin >> S;
    
    int count = 0;
    int ans = 0;
    bool cout_r = false;
    
    for(int i=0; i<3; i++){
        if(S[i] == 'R'){
            if(cout_r==true){
                count++;
            }else{
                count = 1;
            }
            cout_r = true;
        }else{
            count = 0;
            cout_r = false;
        }
        ans = ans < count ? count : ans;
        
    }
    cout << ans << endl;
}


Measured memory_bytes: 3624
import java.util.Scanner;
import java.util.stream.IntStream;

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

        int N = sc.nextInt();
        double[] x = new double[N];
        String[] u = new String[N];
        for (int i = 0; i < N; ++i) {
            x[i] = sc.nextDouble();
            u[i] = sc.next();
        }

        System.out.println(solve(x, u));

        sc.close();
    }

    static double solve(double[] x, String[] u) {
        return IntStream.range(0, x.length).mapToDouble(i -> x[i] * (u[i].equals("JPY") ? 1 : 380000)).sum();
    }
}

Measured memory_bytes: 37844
package main

import (
	"fmt"
)

func main() {
	var (
		a string
		count = 0
	)

	fmt.Scan(&a)
	
	for i := 0; i < len(a); i++ {
		if a[i] == '1' {
			count++
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 512
import java.util.*;


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

        int N = sc.nextInt();        

        int a[] = new int[N];
        
        for(int i = 0; i < N ;i++){
                a[i] = sc.nextInt();
        }

        int     sum  = 0;        
        int average  = 0;
        
        for(int i = 0;i < N;i++){
             sum += a[i];
        }
        
        double avg =  Math.round((double)sum/N);
        
        int cost  = 0;           
        for(int i = 0;i < N;i++){
            cost += Math.pow((a[i] - avg),2);
        }
        
        System.out.println(cost);
                
    }                                       
}

Measured memory_bytes: 23764
# ABC070D - Transit Tree Path
import sys

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)


def dfs(v: int, p: int, G: "List[List[int]]", dist: "List[int]") -> None:
    d = dist[v]
    for u, c in G[v]:  # search vertices available from v recursively
        if u != p:  # p: parent
            dist[u] += d + c  # dist(K, v) + dist(v, u) == d + c
            dfs(u, v, G, dist)


def main():
    global G, dist
    N = int(input())
    E = tuple(tuple(map(int, input().split())) for _ in range(N - 1))
    Q, K = tuple(map(int, input().split()))
    X = tuple(tuple(map(int, input().split())) for _ in range(Q))
    G = [[] for _ in range(N + 1)]  # graph, N+1: 1-idx
    for v, u, c in E:  # construct a graph
        G[v] += [(u, c)]
        G[u] += [(v, c)]
    dist = [0] * (N + 1)  # distance from vertex K to i
    dfs(K, -1, G, dist)
    ans = [dist[x] + dist[y] for x, y in X]
    print(*ans, sep="\n")


if __name__ == "__main__":
    main()

Measured memory_bytes: 162628
# pragma GCC optimize("O3")
# include <bits/stdc++.h>
# define maxn 100005
# define ll long long
# define clock (clock() * 1000.0 / CLOCKS_PER_SEC)
# define rc(s) return cout << s,0
# define _ ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
# define db(x) cerr << #x << " = " << x << '\n'
# define pb push_back
# define mp make_pair
# define sz(x) (int)((x).size())
# define int ll
using namespace std;

int n,x,y,d[1 << 17],p[1 << 17],sz[1 << 17];
vector<int>vec[1 << 17];

void dfs(int nod,int par)
{
    sz[nod] = 1;
    d[nod] = d[par] + 1;
    for(auto it : vec[nod])
    {
        if(it != par)
        {
            p[it] = nod;
            dfs(it,nod);
            sz[nod] += sz[it];
        }
    }
}



int32_t main(){_
    //freopen("input","r",stdin);
    cin >> n;
    for(int i = 1;i < n;i++)
    {
        cin >> x >> y;
        vec[x].pb(y);
        vec[y].pb(x);
    }
    dfs(1,0);
    x = d[n] - d[1];
    y = n;
    for(int i = 1;i < (x + 1) / 2;i++) y = p[y];
    int s = sz[y];
    s -= d[n] - d[y] + 1;
    int f = n - sz[y];
    f -= d[p[y]] - d[1] + 1;
    if(x % 2 == 0) f++;
    for(int i = 1;i;i++)
    {
        if(i & 1)
        {
            if(f) f--;
            else rc("Snuke");
        }
        else
        {
            if(s) s--;
            else rc("Fennec");
        }
    }
}


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

int main(){
	for(int i=0;;i++){
		int a,b;
		cin >> a >> b;
		if(a==0 && b==0)break;
		if(a>b)cout << b << " " << a << endl;
		else cout << a << " " << b << endl;
	}
	return 0;
}

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

using namespace std;
using ll = long long;

#define INF (1LL << 60)
#define MOD 1000000007

#define REP(i,m,n) for(ll (i)=(m),i##_len=(n);(i)<(i##_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define _PR(x) cout << (x) << endl
#define _PS(x) cout << (x) << " "
#define SZ(x) ((int)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back

int main()
{
    string C;
    cin >> C;
    _PR((char)(C[0]+1));

    return 0;
}

/*



*/

Measured memory_bytes: 256
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <numeric>
#include <iomanip>
#define M_PI acos(-1)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1000000007;
const int MAX_V = 201;
int now = 0;

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

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

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

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
struct edge {
	int t;
	edge(int _t) : t(_t) {}
};
bool use[100010];


vector<edge> te[100010];
vector<edge> fe[100010];
int d[100100];
ll rec(int num) {
	if (num == 0) return 0;
	return rec(num - 1) + num;
}
ll gcd(int a, int b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

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

void Solve() {
	
	ll n;
	cin >> n;
	ll a[100010];
	for (size_t i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	sort(a, a + n);
	ll si = 0;
	ll res = n;
	int ma = -1;
	for (size_t i = 0; i < n; i++)
	{
		if (si == 0) {
			si = a[i];
			continue;
		}

		if (a[i] > si * 2) {
			ma = i;
		}
		si = si + a[i];
	}
	if(ma >= 0)
		res -= ma;
	cout << res << endl;
}


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



Measured memory_bytes: 6784
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<set> 
using namespace std;
int tmp[1000];
long long mp[300][300];
int f[300][300];
int main(){
	int n=0,m,r;
	scanf("%d%d%d",&n,&m,&r);
	for(register int i=1;i<=r;i++){
		scanf("%d",&tmp[i]);
	}
	sort(tmp+1,tmp+1+r);
	memset(mp,127/3,sizeof(mp));
	for(register int i=1;i<=m;i++){
		int x,y,z;
		scanf("%d%d%d",&x,&y,&z);
		mp[x][y]=mp[y][x]=z;
	}
	//for(register int i=1;i<=n;i++)mp[i][i]=0;
	for(register int k=1;k<=n;k++){
		for(register int i=1;i<=n;i++)if(i!=k)
			for(register int j=1;j<=n;j++)if(j!=i&&j!=k){
				mp[i][j]=min(mp[i][k]+mp[k][j],mp[i][j]);
			}
	}
	long long ans=21474836471LL;
	do{
		int w=tmp[1];
		long long te=0;
		for(register int i=2;i<=r;i++)te+=mp[w][tmp[i]],w=tmp[i];
		ans=min(ans,te);
	}while(next_permutation(tmp+1,tmp+1+r));
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 896
//In the name of Allah :)
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 2e5 + 10;
long long a[MAXN];
long long n , k , ans = 0;
bool mark[MAXN];
long long tmp[MAXN] , h[MAXN];

void dfs2(int v){
        k--;
        if(k == 0){
                ans = v;
                return;
        }
        dfs2(a[v]);
}


void dfs(int v , int p){
        if(mark[v]){
                k = tmp[p];
                k %= (h[p] - h[v] + 1);
                if(k == 0){
                        ans = p;
                        return;
                }
                if(k == 1){
                        ans = v;
                        return;
                }
                k++;
                dfs2(p);
                return;
        }
        mark[v] = 1;
        h[v] = h[p] + 1;
        k--;
        tmp[v] = k;
        if(k == 0){
                ans = v;
                return;
        }
        dfs(a[v] , v);
}



int main(){
	ios_base::sync_with_stdio(NULL);cin.tie(nullptr);cout.tie(nullptr);
        cin >> n >> k;
        k++;
        for(int i = 1 ; i <= n ; i++){
                cin >> a[i];
        }
        dfs(1 , 0);
        cout << ans << "\n";



}


Measured memory_bytes: 8544