akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n,x;
	cin>>n>>x;
	long long a[n+1],temp=0;
	for(int i=0;i<n;i++){
	 	cin>>a[i];
	 	temp+=a[i];
	}
	sort(a,a+n);
	if(temp==x)cout<<n<<"\n";
	else if(temp<x)cout<<n-1<<"\n";
	else{
		int cnt=0;
	 	for(int i=0;i<n;i++){
			if(x>=a[i]){
				cnt++;
				x-=a[i];
			}
			else if(x<a[i])break;
			if(x<=0)break;
		}
		cout<<cnt<<"\n";
	}
	
	return 0;
}


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

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define FORR(i, a, b) for(int i = (a); i > (b); --i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef priority_queue<int> PQ;
typedef priority_queue<int, V, greater<int>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

ll N;
vector<char> S, tmp;

int main() {
    cin >> N;
    S.resize(N * N);
    tmp.resize(N * N);
    REP(i, N) REP(j, N) { cin >> S[i * N + j]; }
    ll ans = 0;
    REP(k, N) {
        REP(i, N) REP(j, N) { tmp[i * N + j] = S[i * N + (j + k) % N]; }
        bool judge = true;
        REP(i, N) REP(j, N) {
            if(tmp[i * N + j] != tmp[j * N + i]) {
                judge = false;
                break;
            }
        }
        if(judge) ans += N;
    }
    cout << ans << "\n";
    return 0;
}

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

int main(void)
{
    string S;
    cin >> S;
    int count[26] = {0};

    for( int i = 0; i < S.length(); i++ ){
        for( int j = 0; j < 26; j++){
            if( S[i] == 'a' + j) count[j]++;
        }
    }
    for( int i = 0; i < 26; i++){
        if(count[i] > 1){
            cout << "no";
            return 0;
        }
    }
    cout << "yes";
    return 0;
}

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

using namespace std;

int
main(void){
	int n, c; cin >> n >> c;
	vector<string> vec(n);
	for(int i = 0; i < n; i++) cin >> vec[i];
	sort(vec.begin(), vec.end());
	for(int i = 0; i < n; i++) cout << vec[i];
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main
{

    public static void main(String[] args)
    {
        Scanner scan = new Scanner(System.in);
        int c1 = scan.nextInt();
        int c5 = scan.nextInt();
        int c10 = scan.nextInt();
        int c50 = scan.nextInt();
        int c100 = scan.nextInt();
        int c500 = scan.nextInt();
        if ((c1 * 1 + c5 * 5 + c10 * 10 + c50 * 50 + c100 * 100 + c500 * 500) >= 1000) {

            System.out.println("1");

        } else {
            System.out.println("0");
        }

    }
}



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

using namespace std;

int main() {
    int N, K;
    cin >> N >> K;

    vector<long long> a(N);
    vector<long long> tmp_a(N);
    long long money = 0;
    long long min_money = 15000000000;
    vector<int> digit;
    long long current_max_height;
    int count = 0;

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

    // どのビルを高くしてどのビルをそのままにするか全探索
    for(int biti = 0; biti < (1<<(N-1)); biti++) {
        tmp_a = a;
        money = 0;
        digit = {};

        // 高くするビルを格納
        for(int i = 0; i < N-1; i++) {
            if(biti & (1<<i)) {
                digit.push_back(i);
            }
        }

        // 選んだビルを高くして金額を計算
        for(int i : digit) {
            current_max_height = *max_element(tmp_a.begin(), tmp_a.begin() + (i+1));
            if(tmp_a[i+1] <= current_max_height) {
                money += current_max_height - tmp_a[i+1] + 1;
                tmp_a[i+1] = current_max_height + 1;
            }
        }

        // 左から見えるビルの数を数える
        count = 1;
        for(int i = 1; i < N; i++) {
            current_max_height = *max_element(tmp_a.begin(), tmp_a.begin() + i);
            if(tmp_a[i] > current_max_height) {
                count++;
            }
        }

        // 左から見えるビルがK個なら金額の結果を最小値の候補にする
        if(count == K) {
            min_money = min(min_money, money);
        }
    }

    cout << min_money << endl;
	return 0;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n,k;
	int ans=INF;
	cin >>n>>k;
	Vi h(n);
	rep(i,n){
		cin>>h[i];
	}
	sort(all(h));
	for(int i=0;i<=n-k;i++){
		chmin(ans,h[i+k-1]-h[i]);
	//	cout<<ans<<endl;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define gcd(m,n) __gcd(m,n)
#define lcm(m,n) m*(n/gcd(m,n))
#define fast std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pi acos(-1.0)
#define endl '\n'
#define MOD 1000000007
#define ull unsigned long long
#define ll long long
#define ld long double
#define pb push_back
#define dbg(x) cout << #x << "  " << x << endl;
 
ll power(ll base, ll exp) 
{ll res=1;while(exp>0) {if(exp%2==1) res=(res*base);base=(base*base);exp/=2;}return res;}
ll mod(ll a, ll b) {return (a % b + b) % b;}
using namespace std;

int main()
{
	fast;
	string s; cin>>s; if(s[2] == s[3] && s[4] == s[5]) cout << "Yes" << endl; else cout << "No" << endl;
	return 0;
}

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

int main(int argc, char const *argv[])
{
        char n[3];
    cin>>n;
    for(int i=0;i<3;i++){
        if(n[i]=='9'){
            n[i]='1';
        }
        else{
            n[i]='9';
        }
    }
    cout<<n<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);
static const int INF = 1e9+7;
//debug 
#ifdef _DEBUG
#define debug(var)  do{cout << #var << " :";view(var);}while(0)
#else
#define debug(...)
#endif
template<typename T> void view(T e){cout << e << endl;}
template<typename T> void view(const vector<T>& v){for(const auto& e : v){ cout << e << " "; } cout << endl;}
template<typename T> void view(const vector<vector<T> >& vv){ for(const auto& v : vv){ view(v); } }


int main(){
  int n;
  cin >> n;

  ll ans = 0;

  for(int a = 1; a < n; a++){
    for(int b = 1; a * b < n; b++){
      ans++;
    }
  }

  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3632
//by The_One_Solver
#include<bits/stdc++.h>
using namespace std;
long long  n,m,c,arr[10001],a,b,d;
int main()
{
  for(int i=0;i<3;i++)cin>>arr[i];
  cin>>m;
  c=m%2;
  a=arr[1]+arr[2];
  b=arr[0]+arr[2];
  if(c)cout<<a-b;
  else cout<<arr[0]-arr[1];
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string a, b;
	cin >> a >> b;
	if(a.size()!=b.size())
	{
		cout<<"No"<<endl;
		return 0;
	}
	for(int j=0;j<a.size();j++)
	{
		char to=a[a.size()-1];
		for(int i=a.size()-2;i>=0;i--)a[i+1]=a[i];
		a[0]=to;
		if(a==b)
		{
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}


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

signed main(){

  string s; cin >> s;
  stack<int> s1;
  stack< pair<int,int> > s2;
  for(int i = 0; i < s.size(); i++){
    if(s[i] == '\\'){
      s1.push(i);
    }
    if(s[i] == '/' && !s1.empty()){
      int j = s1.top(); s1.pop();
      int s = i-j;
      while(!s2.empty() && s2.top().first > j){
        s += s2.top().second; s2.pop();
      }
      s2.push({j,s});
    }
  }

  int sum = 0;
  vector<int> vec;
  for(; !s2.empty();){
    sum += s2.top().second;
    vec.push_back(s2.top().second); s2.pop();
  }
  reverse(vec.begin(),vec.end());
  cout << sum << endl;
  if(vec.size() == 0){cout << 0 << endl; return 0;}
  cout << vec.size() << " ";
  for(int i = 0; i < vec.size(); i++){
    if(i == vec.size()-1) cout << vec[i] << endl;
    else cout << vec[i] << " ";
  }

  return 0;
}



Measured memory_bytes: 3352
import java.util.Scanner;
import java.util.TreeSet;

public class Main {
	public static void main(String[] args){
		int i, n, m, a, b;
		TreeSet<Integer> setA = new TreeSet<Integer>();
		TreeSet<Integer> setB = new TreeSet<Integer>();
		TreeSet<Integer> setC = new TreeSet<Integer>();
		try (Scanner sc = new Scanner(System.in)) {
			n = sc.nextInt();
			for(i = 0; i < n; i++) {
				a = sc.nextInt();
				setA.add(a);
			}
			m = sc.nextInt();
			for(i = 0; i < m; i++) {
				b = sc.nextInt();
				setB.add(b);
			}
			setC.addAll(setA);
			setA.removeAll(setB);
			setB.removeAll(setC);
			setA.addAll(setB);
			for(int output : setA) {
				System.out.println(output);
			}
		}
	}
}



Measured memory_bytes: 205052
# include <bits/stdc++.h>
typedef long long lint;
using namespace std;

lint gcd(lint x, lint y) {
  if(x == 0) { return y; }
  else { return gcd(y%x,x); }
}

lint lcm(lint x, lint y) { return x/gcd(x,y)*y; }

lint C(lint n, lint k) {
  if(n == k) { return 1; }
  else if(n < k) { return 0; }
  else if(k == 0) { return 1; }
  else if(k == 1) { return n; }
  else return C(n-1,k-1) + C(n-1,k);
}


int main() {
  lint n,m; cin >> n >> m;
  if(n >= m/2) { cout << m/2 << endl; }
  else { cout << (2*n+m)/4 << endl; }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main()
{
  int n;
  cin >> n;
  
  int d[n];
  string s[n];
  int p[n];
  rep(i,n){
    cin >> s[i] >> p[i];
    d[i] = i+1;
  }
  
  for(int i = 0; i < n; i++){
    for(int j = n-1; j > i; j--){
      if(s[j] < s[j-1]){
        string tmps = s[j];
        s[j] = s[j-1];
        s[j-1] = tmps;
        
        int tmpi = p[j];
        p[j] = p[j-1];
        p[j-1] = tmpi;
        
        int tmpd = d[j];
        d[j] = d[j-1];
        d[j-1] = tmpd;
      }
    }
  }
  
   for(int i = 0; i < n; i++){
    for(int j = n-1; j > i; j--){
      if(s[j] == s[j-1] && p[j] > p[j-1]){
        string tmps = s[j];
        s[j] = s[j-1];
        s[j-1] = tmps;
        
        int tmpi = p[j];
        p[j] = p[j-1];
        p[j-1] = tmpi;
        
        int tmpd = d[j];
        d[j] = d[j-1];
        d[j-1] = tmpd;
      }
    }
  }
  
  rep(i,n){
    cout << d[i] << endl;
  }
  
}

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

int main() {
	int n, d, x = 0, m, k = 1, cnt = 0;

	cin >> n >> d >> x;

	for (int i = 1;i <= n;i++) {
		cin >> m;
		for (k = 1; k <= d; k = k + m)
			cnt = cnt + 1;
	}

	cout << cnt + x;

	cin >> n;
	return 0;

}

Measured memory_bytes: 256
n,k = [int(i) for i in input().split()]

A = [int(i) for i in range(1,n+1)]
for _ in range(k):
	d = int(input())
	a = [int(i) for i in input().split()]
	for j in a:
		if j in A: A.remove(j) 
print(len(A))

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

int main(){

	string a,b;

	cin >> a >> b;

	int c;

	c = stoi(a + b);

	double d;

	d=sqrt(c);

	if (d - floor(d) ==0)  cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;

}

Measured memory_bytes: 384
/**********************************************************************
   File hoge.cpp
   Author  harunaya
   Date   2020-04-29(Wed)
   note   
**********************************************************************/

#include <bits/stdc++.h>
using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  int k = (a + b) / 2;
  // kの存在条件は(a+b)が偶数であること
  if ((a + b) % 2 == 0){
    cout << k << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }

}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
//#include <intrin.h>

#define fore(i,a,b) for(int i = a; i < (b); i++)
#define fr(i,a,b) for(int i = a - 1; i >= b; i--)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define N 300005
#define inf (ll)2e18
#define EPS 1e-12
#define mod 1000000007LL
#define __builtin_popcount(x) __popcnt(x)

using namespace std;

typedef long long ll;

inline void solve()
{
	string s;
	cin >> s;
	cout << (s == "ARC" ? "ABC" : "ARC");
}

int main()
{
	fast;
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int q = 1;
	//cin >> q;
	fore(t, 0, q)
	{
		solve();
		cout << '\n';
	}
}

Measured memory_bytes: 3640
#![allow(non_snake_case)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!(
        n: usize,
        mut l: [isize; n],
    );
    l.sort();
    // println!("{:?}", l);
    let mut count = 0;
    for i in 0..(n-2) {
        let a = l[i];
        for j in (i+1)..(n-1) {
            let b = l[j];
            let wa = a+b;
            for k in (j+1)..n {
                if l[k] < wa {
                    count += 1;
                }
            }
        }
    }
    println!("{}", count);
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>

int main(){

	int num, limit;

	while(std::cin >> num >> limit){
		if(num == 0 && limit == 0)
			break;

		std::vector<int> price;
		int sum_price = 0;
		//input
		for(int i = 0; i < num; ++i){
			int buf;
			std::cin >> buf;
			sum_price += buf;
			price.push_back(buf);
		}
		//sort
		std::sort(price.begin(),price.end(),std::greater<int>());
		//discount
		int discount = 0;
		int in_bag = 0;
		for(auto itr = price.begin(); itr != price.end(); ++itr){
			++in_bag;
			if(in_bag == limit){
				discount += *itr;
				in_bag = 0;
			}
		}

		std::cout << sum_price - discount << std::endl;
	}
	return 0;
}
	

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

a = ([1,3,5,7,8,10,12])
b = ([4,6,9,11])
c = ([2])


if x in a and y in a:
    print("Yes")
elif x in b and y in b:
    print("Yes")
elif x in c and y in c:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aryssoncf
 */



// Taken from: https://github.com/bqi343/USACO/blob/master/Implementations/content/contest/templateShort.cpp

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ull> vul;
typedef vector<ll> vl;
typedef vector<pii> vpii;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i,0,a)
#define ROF(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i, a) ROF(i,0,a)
#define trav(a, x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

#define mp make_pair
#define pb push_back
#define f first
#define s second

const int MOD = 1e9 + 7; // 998244353; // = (119<<23)+1
const int MX = 2e5 + 5;

template<class T>
bool ckmin(T &a, const T &b) {
    return a > b ? a = b, 1 : 0;
}

template<class T>
bool ckmax(T &a, const T &b) {
    return a < b ? a = b, 1 : 0;
}

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


//
// Created by aryssoncf on 28/10/2019.
//

#include <type_traits>


#include <iterator>
#include <utility>

template<typename T>
constexpr auto hasBegin(int) -> decltype(std::begin(std::declval<T>()), true) {
    return true;
}

constexpr bool hasBegin(...) {
    return false;
}

template<typename T>
using IsContainer = std::integral_constant<bool, hasBegin<T>(0)>;


#ifndef JHELPER_EXAMPLE_PROJECT_IO_HPP
#define JHELPER_EXAMPLE_PROJECT_IO_HPP

#endif //JHELPER_EXAMPLE_PROJECT_IO_HPP

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

template<typename T, typename U>
std::istream &operator>>(std::istream &is, std::pair<T, U> &p) {
    is >> p.first;
    is >> p.second;
    return is;
}

template<class X, class Y>
std::ostream &operator<<(std::ostream &os, std::pair<X, Y> const &p) {
    return os << p.first << " " << p.second;
}

template<class Ch, class Tr, class Container>
std::basic_ostream<Ch, Tr> &operator<<(std::basic_ostream<Ch, Tr> &os, Container const &x) {
    bool first = true;
    for (auto &y : x) {
        if (first) {
            first = false;
        } else {
            os << " ";
        }
        os << y;
    }
    return os;
}

using namespace std;

class BPaintingBallsWithAtCoDeer {
public:
    void solve(std::istream &in, std::ostream &out) {
        int n, k;
        in >> n >> k;
        int res = 1;
        FOR(i, 0, n) {
            res *= k - (i > 0);
        }
        out << res << '\n';
    }

    void setup() {}
};


int main() {
    std::ios_base::sync_with_stdio(false);
    BPaintingBallsWithAtCoDeer solver;
    solver.setup();
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    in.tie(nullptr);
    out << std::fixed;
    out.precision(20);
    solver.solve(in, out);
    return 0;
}


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

int main(){
    int n,a,b;
    cin >> n >> a >> b;
    cout << min(a*n,b) << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
#define re return
#define all(a) a.begin(),a.end()
#define int long long
using namespace std;
const int dx[4]={-1,1,0,0};
const int dy[4]={0,0,-1,1};
vector<int>v[200005];
int vis[200005];
int dfs(int now){
	vis[now]=1;
	int num=1;
	for (int i : v[now])
		if (!vis[i])
			num+=dfs(i);
	re num;
}
signed main()
{
	int n,m;
	cin>>n>>m;
	while (m--){
		int a,b;
		cin>>a>>b;
		a--, b--;
		v[a].pb(b);
		v[b].pb(a);
	}
	int ans=0;
	for (int i=0;i<n;i++){
		if (!vis[i])
			ans=max(ans,dfs(i));
	}
	cout<<ans;
	re 0;
}


Measured memory_bytes: 25384
s = str(input())
result = []

for i in range(len(s)):
    if(i%2==0):
        odd = any((s[i]== x for x in ['R','U','D']))
        result.append(odd)
    else:
        even = any((s[i]== x for x in ['L','U','D']))
        result.append(even)

if(all(result)):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3060
#include <iostream>
#include <cstring>
#include <cmath>
#include <queue>
#include <cstdio>
#include <algorithm>
#include <vector>
#define LL long long
#define rg register
using namespace std;
const int MAXN=5000;
int N,ans;

template<typename T>inline void in(T &a){
	T ch=getchar(),p=1;
	for(a=0;!isdigit(ch);ch=getchar()) if(ch=='-') p=-1;
	for(;isdigit(ch);ch=getchar()) a=a*10+ch-'0';
	a*=p;
}

template<typename T>inline void print(T x){
	if(x<0) putchar('-'),x=-x;
	if(x>9) print(x/10);
	putchar(x%10+'0');
}

int main(){
	in(N);
	
	while(N){
		int now=N%10;
		if(now==2) ans++;
		N/=10;
	}
	
	print(ans),puts("");
	
	fclose(stdin);
	fclose(stdout);
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<set>
using namespace std;

typedef long long ll;

ll A,B;
ll pw2[100];
set<int> cnt;
set<int>::iterator it;

int main(){

    pw2[0]=1ll;
    for(int i=1;i<=60;i++) pw2[i]=(ll)2ll*pw2[i-1];
    scanf("%lld%lld",&A,&B);
    swap(A,B);
    int d,k;
    for(d=60;d>=0;d--){
        if((A&pw2[d])!=(B&pw2[d])) break;
        if(A&pw2[d]){
            A^=pw2[d];
            B^=pw2[d];
        }
    }
    if(A==B) return puts("1"),0;
    for(k=d-1;k>=0;k--)
        if(A&pw2[k]) break;
    ll x=B,y=pw2[d]+pw2[k+1]-1;
    ll u=pw2[d]+B,v=pw2[d+1]-1;
    ll ans=y-x+1;
    if(u>y) ans+=v-u+1;
    else if(u<=y&&v>y) ans+=v-y;
    printf("%lld",ans);

    fclose(stdin);
    fclose(stdout);
}


Measured memory_bytes: 256
#include <cstdio>

int main() {
	int a, b, c, d, n, cnt = 0;
	while (scanf("%d", &n) != EOF) {
		cnt = 0;
		for (a = 0; a <= 9; a++) {
			for (b = 0; b <= 9; b++) {
				for (c = 0; c <= 9; c++) {
					for (d = 0; d <= 9; d++) {
						if ((a + b + c + d) == n)cnt++;
					}
				}
			}
		}
		printf("%d\n",cnt);
	}
	return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int v[101],ans[1000001],cc=1,k;
int main(){
	int n,a,b,c,d;
	cin>>n;
	r(i,(n*(n-1))/2){
		cin>>a>>b>>c>>d;
		a--,b--;
		if(c==d)v[a]++,v[b]++;
		else if(c>d)v[a]+=3;
		else v[b]+=3;
	}
	vector<int>p;
	r(i,n)p.push_back(v[i]);
	sort(p.begin(),p.end(),greater<int>());
	r(i,n){
		if(!i)ans[p[i]]=cc,k++;
		else{
			if(p[i]!=p[i-1])cc+=k,k=0;
			ans[p[i]]=cc,k++;
		}
	}
	r(i,n)cout<<ans[v[i]]<<endl;
}

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

using namespace std;

const int OO = 1e9;
const double EPS = 1e-9;

#define ndl cout << '\n'
#define sz(v) int(v.size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define present(a, x) (a.find(x) != a.end())
#ifdef LOCAL
#define db(...) ({cout << "> Line " << __LINE__  \
		<< ": "; _db(#__VA_ARGS__, __VA_ARGS__);})
#define RNG() rng()
#else
#define db(...) true
#define RNG() true
#endif

template<class T>
void _db(const char *dbStr, T e) {
	cout << dbStr << " = " << e << endl;
}
template<class T, class... L>
void _db(const char *dbStr, T e, L... r) {
  while(*dbStr != ',') cout << *dbStr++;
  cout << " = " << e << ','; _db(dbStr + 1, r...);
}
template<class S, class T>
ostream& operator<<(ostream& o, const map<S, T>& v) {
	o << "["; int i = 0;
	for (const pair<S, T>& pr : v) o << (!i++ ? "" : ", ") << "{"
	<< pr.fs << " : " << pr.sc << "}"; return o << "]";
}
template<template <class, class...> class S, class T, class... L>
ostream& operator<<(ostream& o, const S<T, L...>& v) {
	o << "["; int i = 0;
	for (const auto& e : v) o << (!i++ ? "" : ", ") << e;
	return o << "]";
}
template<class S, class T>
ostream& operator<<(ostream& o, const pair<S, T>& pr) {
	return o << "(" << pr.fs << ", " << pr.sc << ")";
}
ostream& operator<<(ostream& o, const string& s) {
	for (const char& c : s) o << c;
	return o;
}

template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = VV<V<T>>;
using ll = long long;
using pii = pair<int, int>;
using vi = V<int>;
using vii = V<pii>;
using vvi = VV<int>;
using mii = map<int, int>;
using umii = unordered_map<int, int>;
using si = set<int>;
using usi = unordered_set<int>;

int N;
V<vii> adj;
vi ans;

void dfs(int u, int p, int pc) {
	int curr = 1;
	for (auto& pr : adj[u]) {
		int v = pr.fs, id = pr.sc;
		if (v == p)
			continue;
		if (curr == pc)
			++curr;

		ans[id] = curr;
		dfs(v, u, curr);

		++curr;
	}
}

int main() {
	#ifdef LOCAL
	auto stTime = clock();
//	freopen("in.txt", "r", stdin);
	mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
	#endif
	ios::sync_with_stdio(false);
	cout.precision(10);
	cin.tie(0);

	cin >> N;

	adj.assign(N + 1, vii());
	ans.assign(N, 0);

	int mx = 0;

	for (int i = 1; i <= N - 1; ++i) {
		int a, b;
		cin >> a >> b;

		adj[a].pb(mp(b, i));
		adj[b].pb(mp(a, i));

		mx = max(mx, sz(adj[a]));
		mx = max(mx, sz(adj[b]));

	}


	dfs(1, -1, -1);

	cout << mx << '\n';

	for (int i = 1; i <= N - 1; ++i) {
		cout << ans[i] << '\n';
	}


	#ifdef LOCAL
	cout << "\n\n\nExecution time: " <<
		(clock() - stTime) * 1e3 / CLOCKS_PER_SEC << " ms" << endl;
	#endif
    return 0;
}


Measured memory_bytes: 8320
while True:
    X, Y = map(int, raw_input().split())
    if (X, Y) == (0, 0):
        break
    grid = [map(int, raw_input().split()) for _ in xrange(Y)] + [[0] * X]
    D = (((-1, 1), (0, 1), (1, 1)), (), ((0, 2),))
    dp = [[1] * X] + [[0] * X for _ in xrange(Y+2)]
    for y in xrange(Y-1):
        for x in xrange(X):
            for dx, dy in D[grid[y][x]]:
                nx, ny = x + dx, y + dy
                if nx < 0 or X <= nx or y < 0 or Y+1 <= ny:
                    continue
                if grid[ny][nx] == 2 and nx != x:
                    continue
                dp[ny][nx] += dp[y][x]
    print sum(sum(dp[y][x] for x in xrange(X) if grid[y][x] != 1) for y in xrange(Y-1, Y+1))

Measured memory_bytes: 4288
#include <stdio.h>

const int N = 2e5 + 1;

int main()
{
  int arr[N];
  memset(arr, 0, sizeof arr);
  int n, i, x;
  if(scanf("%d", &n)) {
    for(i = 1; i < n; ++i) {
      if(scanf("%d", &x))
      	arr[x]++;
    }
  }
  for(int i = 1; i <= n; ++i) {
    printf("%d\n", arr[i]);
  }
  return 0;
}


Measured memory_bytes: 2504
n, y = map(int, input().split())
s, t, u = -1, -1, -1
for i in range(n+1):
    for j in range(n-i+1):
        if 10000 * i + 5000 * j + 1000 * (n-i-j) == y:
            s,t,u = i, j, n-i-j
            break
print(s,t,u)


Measured memory_bytes: 2940
h,n=map(int,input().split())
maA=0
inf=float("inf")
L=[]
for i in range(n):
   a,b=map(int,input().split())
   maA=max(maA,a)
   L.append((a,b))

dp=[inf]*(h+maA+1)
dp[0]=0
for i in range(h):
   for a,b in L:
       dp[i+a]=min(dp[i+a],dp[i]+b)
print(min(dp[h:]))

Measured memory_bytes: 43548
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		int n, s[], i;
		double ave, a, ans;
		Scanner sc = new Scanner(System.in);
		while (true) {
			ave = 0.0;
			a = 0.0;
			n = sc.nextInt();
			if (n == 0) {
				break;
			}
			s = new int[n];
			for (i = 0; i < n; ++i) {
				s[i] = sc.nextInt();
				ave += s[i];
			}
			ave /= (double) n;
			for (i = 0; i < n; ++i) {
				a += (s[i] - ave) * (s[i] - ave);
			}
			a /= (double) n;
			ans = Math.sqrt(a);
			System.out.println(ans);
		}
		sc.close();
	}
}



Measured memory_bytes: 31200
import java.io.*; 
import java.util.*; 

public class Main{ 
	
	static class FastReader{ 
		BufferedReader br; 
		StringTokenizer st; 

		public FastReader() 
		{ 
			br = new BufferedReader(new
					InputStreamReader(System.in)); 
		} 

		String next() 
		{ 
			while (st == null || !st.hasMoreElements()) 
			{ 
				try
				{ 
					st = new StringTokenizer(br.readLine()); 
				} 
				catch (IOException e) 
				{ 
					e.printStackTrace(); 
				} 
			} 
			return st.nextToken(); 
		} 

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

		long nextLong() 
		{ 
			return Long.parseLong(next()); 
		} 

		double nextDouble() 
		{ 
			return Double.parseDouble(next()); 
		} 

		String nextLine() 
		{ 
			String str = ""; 
			try
			{ 
				str = br.readLine(); 
			} 
			catch (IOException e) 
			{ 
				e.printStackTrace(); 
			} 
			return str; 
		} 
	}

	public static void main(String[] args) 
	{ 
        FastReader sc = new FastReader(); 
        //PrintWriter out = new PrintWriter(System.out); 

        int n = sc.nextInt();
        int max = 302;
       	double[][][] dp = new double[max+5][max+5][max+5];

        int cnt1=0, cnt2=0, cnt3=0;
        for(int i=1;i<=n;i++){
        	int arr = sc.nextInt();
        	if(arr==1) cnt1++;
        	else if(arr==2) cnt2++;
        	else cnt3++;
		}
        
        for(int k=0;k<max;k++){
        	for(int j=0;j<max;j++){
	        	for(int i=0;i<max;i++){
	        		if(i==0 && j==0 && k==0)
        				continue;
        			if(i+j+k >= max)
        				continue;

        			dp[i][j][k] = (1.0*n)/(i+j+k); 
        			
        			if(i>0)
        				dp[i][j][k] += dp[i-1][j][k]*((1.0*i)/(i + j + k)); 
        			
        			if(j>0)
        				dp[i][j][k] += dp[i+1][j-1][k]*((1.0*j)/(i + j + k)); 
        			
        			if(k>0)
        				dp[i][j][k] += dp[i][j+1][k-1]*((1.0*k)/(i + j + k)); 
        		}
        	}
        }
        
        System.out.println( dp[cnt1][cnt2][cnt3] );
	}
}


Measured memory_bytes: 302036
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <sstream>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define mod 1000000007
#define eps 1e-6
#define ll long long
#define INF 0x3f3f3f3f
#define MEM(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define mk make_pair
#define pi pair<int, int>
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define per(i,a,b) for(int i=a;i>=(b);--i)
using namespace std;
int dt[][2]= {{1,0},{-1,0},{0,1},{0,-1},{0,0}};
//typedef pair<int, int> P;
//priority_queue<int, vector<int>, greater<int> > q;
int main()
{
   IOS;
   int k,a,b;
   cin >> k >> a >> b;
   if(a%k==0||b%k==0){
      cout<<"OK";
      return 0;
   }
   if(a==b && a%k==0){
      cout<<"OK";
      return 0;
   }
   if(b/k-a/k>=1) cout<<"OK";
   else cout<<"NG";
}


Measured memory_bytes: 3652
#include<stdio.h>
#include<algorithm>
using namespace std;
const int maxn=5000+10;
int a[maxn];
bool cmp(int x,int y){
    return x>y;
}
int main(){
    int n,k;
    while(scanf("%d%d",&n,&k)!=EOF){
        int sum=0,j=0;
        for(int i=0;i<n;i++){
            int x;
            scanf("%d",&x);
            if(x<k) {sum+=x;a[j++]=x;}
        }
        if(sum<k){
            printf("%d\n",j); continue;
        }
        sort(a,a+j,cmp);
        int minx=k-a[0];
        int sumx,ii=0;
        for(;;){
            sumx=0;
            int ij=0;
            if(minx==a[j]) break;
            if(ii>j) break;
            //printf("%d\n",minx);
            while(sumx<k&&ij+ii<j){
                if(sumx+a[ii+ij]<k) {sumx+=a[ij+ii]; }
                else if(sumx+a[ii+ij]==k) {if(minx>a[ii+ij])minx=a[ii+ij];}
                ij++;
            }
            ii++;
        }
        int xx=0;
        for(int i=0;i<j;i++){
            if(a[i]<minx) xx++;
        }
        printf("%d\n",xx);
    }
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
using namespace std;
const long long MOD = 1e9+7;
long long modinv(long long a,long long MOD){
    long long k = MOD-2;
    long long p = 1;
    while(k>0){
        if(k%2==1) p*=a;
        k/=2;
        a*=a;
        a%=MOD;
        p%=MOD;
    }
    return p;
}
int main(){
    long long h,w,a,b;
    cin >> h >> w >> a >> b;
    long long fac[2*max(h,w)+1];
    fac[0]=1;
    for(int i = 0;i<2*max(h,w);i++){
        fac[i+1]=fac[i]*(i+1);
        fac[i+1]%=MOD;
    }
    long long ans = 0;
    long long tmp,tmp2;
    for(int i = 0;i<h-a;i++){
        tmp = fac[b+i-1];
        tmp*=modinv(fac[b-1],MOD);
        tmp%=MOD;
        tmp*=modinv(fac[i],MOD);
        tmp%=MOD;
        tmp2 = fac[w+h-b-2-i];
        tmp2*=modinv(fac[w-b-1],MOD);
        tmp2%=MOD;
        tmp2*=modinv(fac[h-i-1],MOD);
        tmp2%=MOD;
        ans+=((tmp*tmp2)%MOD);
        ans%=MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
n = input()
l = len(n)
if n[-1] == "2" or n[-1] == "4" or n[-1] == "5" or n[-1] == "7" or n[-1] == "9":
    print("hon")
elif n[-1] == "6" or n[-1] == "0" or n[-1] == "1" or n[-1] == "8":
    print("pon")
else:
    print("bon")

Measured memory_bytes: 9152
#include<algorithm>
#include<iostream>
#include<functional>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
  int w,a,b;
  cin>>w>>a>>b;
  int c,d;
  c=a+w;
  d=b+w;
  if(b<=c and a<=b)
    cout<<0<<endl;
  else if(a<=d and b<a)
    cout<<0<<endl;
  else
    cout<<min(abs(c-b),abs(a-d))<<endl;
}

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

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

    string st;
    cin >> st;
    if (st.size() == 1) {
        cout << "YES" << endl;
        return 0;
    }
    vi cnt(3, 0);

    rep(i, st.size()) {
        cnt[st[i] - 'a']++;
    }

    int tmp = min(cnt[0], min(cnt[1], cnt[2]));
    rep(i, 3) {
        cnt[i] -= tmp;
        //cout << cnt[i] << endl;
    }

    rep(i, 3) {
        if (1 < cnt[i]) {
            cout << "NO" << endl;
            return 0;
        }
    }
    /*
    if (cnt[0] == cnt[2] && cnt[1] == 1) {
        cout << "NO" << endl;
    } else {
        cout << "YES" << endl;
    }
    */
    cout << "YES" << endl;



    return 0;
}


Measured memory_bytes: 512
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define all(a) (a).begin(), (a).end()
#define mp make_pair
#define pb push_back
#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)

void YES() { cout << "YES" << endl; }
void NO() { cout << "NO" << endl; }
void Yes() { cout << "Yes" << endl; }
void No() { cout << "No" << endl; }
void yes() { cout << "yes" << endl; }
void no() { cout << "no" << endl; }
void Taka() { cout << "Takahashi" << endl; }
void Aoki() { cout << "Aoki" << endl; }
void digit(int d) { cout << fixed << setprecision(d); }
void IOup() { cin.tie(0); ios::sync_with_stdio(false); }

int main() {
	string s[3];
	for (int i = 0; i < 3; ++i) {
		cin >> s[i];
		cout << s[i][i];
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

typedef pair<int, int> P;
typedef pair<P, P> PP;
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H, W;
    cin >> H >> W;
    int a[510][510];
    rep(i, H) {
        rep(j, W) {
            cin >> a[i][j];
        }
    }
    vector<PP> v;
    rep(i, H) {
        rep(j, W - 1) {
            if(a[i][j] % 2 == 1) {
                a[i][j]--;
                a[i][j + 1]++;
                v.push_back({{i, j}, {i, j + 1}});
            }
        }
    }
    rep(i, H - 1) {
        if(a[i][W - 1] % 2 == 1) {
            a[i][W - 1]--;
            a[i + 1][W - 1]++;
            v.push_back({{i, W - 1}, {i + 1, W - 1}});
        }
    }
    cout << v.size() << endl;
    for(auto& e: v) {
        cout << e.first.first + 1 << " ";
        cout << e.first.second + 1 << " ";
        cout << e.second.first + 1 << " ";
        cout << e.second.second + 1<< endl;
    }
    

    return 0;
}


Measured memory_bytes: 6316
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

ll N;
ll X,D;

map<ll,vector<pair<ll,ll>>> M;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>X>>D;
	
	if(D==0) {
		if(X==0) cout<<1<<endl;
		else cout<<(N+1)<<endl;
		return;
	}
	
	if(D<0) {
		X+=(N-1)*D;
		D=-D;
	}
	
	ll tot=D*N*(N-1)/2;
	FOR(i,N+1) {
		ll ma=D*N*i-D*i*(i+1)/2;
		ll mi=D*i*(i-1)/2;
		
		ll lef=X*i-X*(N-i)+mi-(tot-mi);
		ll ri=X*i-X*(N-i)+ma-(tot-ma)+2*D;
		ll cat=(lef%(2*D)+2*D)%(2*D);
		assert((ri-lef)%(2*D)==0);
		M[cat].push_back({lef,ri});
	}
	
	ll ret=0;
	FORR(m,M) {
		vector<pair<ll,ll>> V=m.second;
		sort(ALL(V));
		ll L=-1LL<<62,R=L;
		FORR(v,V) {
			if(v.first<=R) {
				R=max(R,v.second);
			}
			else {
				ret+=(R-L)/(2*D);
				L=v.first;
				R=v.second;
			}
		}
		ret+=(R-L)/(2*D);
	}
	cout<<ret<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 22144
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
using namespace std;

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)

typedef long long ll;
double solve(double d1,double x,int n){
  double d[4];
  d[0]=d1;d[1]=d1+x;d[2]=d[1]+x;d[3]=d[2]+x;
  
  if(n==1) return (d[0]+d[1])/2;
  double nd1 = ((d[2]+d[1]+d[0]+d[2]+((2*n-2)*d[0]))/(2*n));
  double nx = (2*n+4) * x / (2*n);
  double p = (2*d1+(2*n-1)*x) / 2 ;
  // cout << p << " "<< nd1 <<" "<< nx << "\n";
  return p +  solve(nd1,nx,n-1);

}

int main(){
  int N,D1,X;
  cin >> N >> D1 >> X;
  double x = (double) X;
  double d1 = (double) D1;
  
  printf("%26.15lf\n",solve(d1,x,N));
  return 0;
}


Measured memory_bytes: 6656
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
#include <map>
using namespace std;

typedef long long ll;
const ll inf = 1e15;

int main() {
    ll n,k;
    scanf("%lld %lld",&n,&k);
    vector<ll> h(n,0);
    for (int i = 0; i < n; i++) scanf("%lld",&h[i]);
    sort(h.begin(),h.end());
    ll ans = 0;
    for (int i = n - 1; i >= 0; i--) {
        if (k > 0) k--;
        else ans += h[i];
    }
    printf("%lld\n",ans);
}

Measured memory_bytes: 1792
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

fn f(r: u32, s: u32, p: u32, cv: &Vec<char>) -> u32 {
    let mut ret = 0;

    if cv[0] == 'r' {
        ret += p;
    } else if cv[0] == 's' {
        ret += r;
    } else {
        ret += s;
    }
    let mut skip = true;

    for i in 1..cv.len() {
        if cv[i - 1] == cv[i] && skip {
            skip = false;
        } else {
            if cv[i] == 'r' {
                ret += p;
            } else if cv[i] == 's' {
                ret += r;
            } else {
                ret += s;
            }
            skip = true;
        }
    }

    ret
}

fn main() {
    let nk: Vec<usize> = read_vec();
    let n = nk[0];
    let k = nk[1];
    let rsp: Vec<u32> = read_vec();
    let r = rsp[0];
    let s = rsp[1];
    let p = rsp[2];
    let t: String = read();
    let cv: Vec<char> = t.chars().collect();

    let mut mat: Vec<Vec<char>> = vec![vec![]; k];

    for i in 0..n {
        let c = cv[i];
        mat[i % k].push(c);
    }

    /*
    for i in 0..k {
        println!("{:?}", mat[i]);
    }
    */

    let mut ans = 0;

    for i in 0..k {
        ans += f(r, s, p, &mat[i]);
    }

    println!("{}", ans);
}


Measured memory_bytes: 10492
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define ar array
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());



signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);

  
  int n;
  cin >> n;
  int x[n+1],y[n+1],h[n+1];
  bool all = true;
  for(int i=1;i<=n;i++){
    cin >> x[i] >> y[i] >> h[i];
    all&=(h[i]==0);
  }

  for(int cx = 0; cx<= 100;cx++){
    for(int cy = 0;cy <= 100;cy++){
      set<int> s;
      bool flag = true;
      for(int i=1;i<=n;i++){
        if(h[i]>0){
          int H = h[i] + abs(cx-x[i]) + abs(cy-y[i]);
          // if(H>0)
          s.insert(H);
          // else flag = false;
        }
      }
      if(s.size()==1){

        int H = *s.begin();
        for(int i=1;i<=n;i++){
          if(!h[i]){
            if(H-abs(cx-x[i])-abs(cy-y[i])>0)flag = false;
          }
        }

        if(flag){
          cout << cx << " " << cy << " " << *s.begin() << endl;
          return 0;
        }
      }
    }
  }

return 0;
}
///....


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <complex>
#include <fstream>
#include <cmath>

using namespace std;

int main(void){
    char c; cin >> c;
    if(c=='a' || c=='e' || c=='i' || c=='o' || c=='u' ){
        cout << "vowel" << endl;
    }else{
        cout << "consonant" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <ratio>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;
template<class T> using v = vector<T>;
template<class T, class U> using p = pair<T, U>;

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

template<class T> T read() { T x{}; cin >> x; return x; }
template<class T> v<T> read(int N){ v<T> x(N); REP(i, N) cin >> x[i]; return x; }

template<class T>
void write(const T &x){ cout << x << endl; }
void write(double x){ printf("%.15f\n", x); }

const ull MOD = 1000'000'007;

const ll NMAX = (ll)1e5 + 10;
ll dp[NMAX][3] = {};

int main(){
    ll N = read<ll>();
    v<ll> a(N), b(N), c(N);
    REP(i, N){ cin >> a[i] >> b[i] >> c[i]; }
    
    for(ll n = 0; n < N; ++n){
        dp[n+1][0] = max(dp[n][1] + a[n], dp[n][2] + a[n]);
        dp[n+1][1] = max(dp[n][0] + b[n], dp[n][2] + b[n]);
        dp[n+1][2] = max(dp[n][0] + c[n], dp[n][1] + c[n]);
        
    }
    write(max(max(dp[N][0], dp[N][1]), dp[N][2]));
}



Measured memory_bytes: 4992