akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;  
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define Rep(i, a, b) for(ll i = a; i <= b; i++)
#define repr(i, a, b) for(ll i = b-1; i >= a; i--)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
using ll = long long;
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
const double pi = acos(-1.0);
// const ll MOD = 1e9 + 7;
// const ll INF = 1LL << 60;
#define pp pair<ll, pair<ll, ll>> 
#define fi first
#define se second

////////////////////////////////////////////////////////

const ll MOD = 998244353;

const int MAX = 510000;

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

ll n, m, k;
ll d[200010];

// テーブルを作る前処理
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;
}

void init(){
    ll a = 1;
    rep(i, 0, n){
        d[i] = a;
        a *= m-1;
        a %= MOD;
    }
}

ll f(ll k){
    ll ret = m * COM(n-1, k);
    ret %= MOD;
    ret *= d[n-1-k];
    ret %= MOD;
    return ret;
}

int main() {
    COMinit();

    cin >> n >> m >> k;

    init();
    
    ll ans = 0;
    Rep(i, 0, k){
        ans += f(i);
        ans %= MOD;
    }

    co(ans);

    return 0;
}
 
 


Measured memory_bytes: 17056
import java.util.*

val sc = Scanner(System.`in`)
val N = sc.nextInt()
val T = sc.nextInt()
val A = sc.nextInt()

fun main(args: Array<String>) {
    var key = 0
    var value = Double.MAX_VALUE

    for (i in 1..N) {
        val h = sc.nextInt()
        val tmp = Math.abs(A - (T - h * 0.006))
        if (value > tmp) {
            key = i
            value = tmp
        }
    }
    println(key)
}


Measured memory_bytes: 31260
#include <iostream>
#include <string>
#include <cstring>
using namespace std;

const int MOD = 1000000007;
string S;

void add(long long &a, long long b) {
  a += b;
  if (a >= MOD) a -= MOD;
}

long long dp[210000][5];

int main() {
  cin >> S;
  memset(dp, 0, sizeof(dp));
  dp[0][0] = 1;
  for (int i = 0; i < S.size(); ++i) {
	for (int j = 0; j < 5; ++j) {
	  if (S[i] != '?') add(dp[i+1][j], dp[i][j]);
	  else add(dp[i+1][j], dp[i][j] * 3 % MOD);
	}
	if (S[i] == 'A' || S[i] == '?') add(dp[i+1][1], dp[i][0]);
	if (S[i] == 'B' || S[i] == '?') add(dp[i+1][2], dp[i][1]);
	if (S[i] == 'C' || S[i] == '?') add(dp[i+1][3], dp[i][2]);  
  }
  cout << dp[S.size()][3] << endl;
}


Measured memory_bytes: 8704
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
using namespace std;
#define rep(N) for(int i=0;i<N;i++)
#define rep2(N1,N2) for(int i=0;i<N1;i++)for(int j=0;j<N2;j++)
#define rep3(N1,N2,N3)for(int i=0;i<N1;i++)for(int j=0;j<N2;j++)for(int k=0;k<N3;k++)
#define For(i,N) for(int i=0;i<N;i++)
#define ll long long int
void yn(bool b) {
	if (b)printf("yes\n");
	else printf("no\n");
}

void Yn(bool b) {
	if (b)printf("Yes\n");
	else printf("No\n");
}

void YN(bool b) {
	if (b)printf("YES\n");
	else printf("NO\n");
}

int ctoi(char c) {
	return c - '0';
}


int main() {
	ll N, K;
	cin >> N >> K;
	vector<ll>d(K);
	vector<vector<ll>>A(K);
	vector<ll>B(N, 1);
	rep(K) {
		cin >> d[i];
		A[i].resize(d[i]);
		For(j, d[i]) {
			cin >> A[i][j];
			B[A[i][j]-1] = 0;
		}
	}
	ll c = 0;
	rep(N) {
		c += B[i];
	}
	cout << c;
}

Measured memory_bytes: 3708
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;

int main(void)
{
    int a, b;
    cin >> a >> b;

    printf("%d %d %.16f\n", a / b, a % b, (double)a / b);
    //cout << a / b << " " << a % b << " " << (double)a / b << endl;
}


Measured memory_bytes: 3200
#C
import math
a, b, h, m = map(int, input().split())

def yo(a, b, c):
    #辺a,b 角c
    # print(pow(a, 2), pow(b, 2), 2 * a * b * math.cos(c))
    tmp = pow(a, 2) + pow(b, 2) - 2 * a * b * math.cos(c)
    return pow(tmp, 0.5)
ss = (h / 12 + m / 720) * 2 * math.pi
ls = m / 60 * 2 * math.pi
# print(ss, ls, min(abs(ls - ss), 2*math.pi - abs(ls - ss)))
ans = yo(a, b, min(abs(ls - ss), 2*math.pi - abs(ls - ss)))
print(ans)


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

template <int MOD_> struct modnum {
	static constexpr int MOD = MOD_;
	static_assert(MOD_ > 0, "MOD must be positive");

private:
	using ll = long long;

	int v;

	static int minv(int a, int m) {
		a %= m;
		assert(a);
		return a == 1 ? 1 : int(m - ll(minv(m, a)) * ll(m) / a);
	}

public:

	modnum() : v(0) {}
	modnum(ll v_) : v(int(v_ % MOD)) { if (v < 0) v += MOD; }
	explicit operator int() const { return v; }
	friend std::ostream& operator << (std::ostream& out, const modnum& n) { return out << int(n); }
	friend std::istream& operator >> (std::istream& in, modnum& n) { ll v_; in >> v_; n = modnum(v_); return in; }

	friend bool operator == (const modnum& a, const modnum& b) { return a.v == b.v; }
	friend bool operator != (const modnum& a, const modnum& b) { return a.v != b.v; }

	modnum inv() const {
		modnum res;
		res.v = minv(v, MOD);
		return res;
	}
	friend modnum inv(const modnum& m) { return m.inv(); }
	modnum neg() const {
		modnum res;
		res.v = v ? MOD-v : 0;
		return res;
	}
	friend modnum neg(const modnum& m) { return m.neg(); }

	modnum operator- () const {
		return neg();
	}
	modnum operator+ () const {
		return modnum(*this);
	}

	modnum& operator ++ () {
		v ++;
		if (v == MOD) v = 0;
		return *this;
	}
	modnum& operator -- () {
		if (v == 0) v = MOD;
		v --;
		return *this;
	}
	modnum& operator += (const modnum& o) {
		v += o.v;
		if (v >= MOD) v -= MOD;
		return *this;
	}
	modnum& operator -= (const modnum& o) {
		v -= o.v;
		if (v < 0) v += MOD;
		return *this;
	}
	modnum& operator *= (const modnum& o) {
		v = int(ll(v) * ll(o.v) % MOD);
		return *this;
	}
	modnum& operator /= (const modnum& o) {
		return *this *= o.inv();
	}

	friend modnum operator ++ (modnum& a, int) { modnum r = a; ++a; return r; }
	friend modnum operator -- (modnum& a, int) { modnum r = a; --a; return r; }
	friend modnum operator + (const modnum& a, const modnum& b) { return modnum(a) += b; }
	friend modnum operator - (const modnum& a, const modnum& b) { return modnum(a) -= b; }
	friend modnum operator * (const modnum& a, const modnum& b) { return modnum(a) *= b; }
	friend modnum operator / (const modnum& a, const modnum& b) { return modnum(a) /= b; }
};

template <typename T> T pow(T a, long long b) {
	assert(b >= 0);
	T r = 1; while (b) { if (b & 1) r *= a; b >>= 1; a *= a; } return r;
}

using num = modnum<int(1e9)+7>;

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int N; cin >> N;

	num ans = pow(num(2), N) - 1;

	for (int z = 0; z < 2; z++) {
		int A; cin >> A;
		num numer = 1, denom = 1;
		for (int i = 0; i < A; i++) {
			numer *= N-i;
			denom *= i+1;
		}
		ans -= numer / denom;
	}
	cout << ans << '\n';

	return 0;
}


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

int main()
{
	int N;
	cin >> N;
	vector<int>A(N);
	int i, j, k, l, m, sum,ans;
	for (i = 0; i < N; i++) {
		cin >> A[i];
	}
	ans = 1;
	sum = 0;
	sort(A.begin(), A.end());
	k = A[0];
	for (i = 0; i < N; i++) {
		if (A[i] != A[0] && A[i] != A[0] + 1) {
			ans = 0;
			break;
		}
		if (A[i] == A[0]) {
			sum++;
		}
	}
	k = A[0] + 1;
	if (ans == 0) {
		cout << "No" << endl;
	}
	else if (sum == N) {
		if (N >= 2 * A[0]||A[0]==N-1) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	else {
		if (k >= N - k) {
			if (N - sum >= N - k + 1 && N - sum <= 2 * (N - k)) {
				cout << "Yes" << endl;
			}
			else {
				cout << "No" << endl;
			}
		}
		else {
			if (N - sum >= N - k + 1 && N - sum <= 2 * N) {
				cout << "Yes" << endl;
			}
			else {
				cout << "No" << endl;
			}
		}
	}
    return 0;
}



Measured memory_bytes: 640
lines = $stdin.read

array = lines.split("\n")

n = array[0].split(" ")[0].to_i
q = array[0].split(" ")[1].to_i

it = -1
id = Array.new(n){it+=1}
sn = Array.new(id)

def root(i, id)
  while i != id[i] do
    i = id[i]
  end
  i
end

# find, check if p and q has the same root
def same?(p, q, id)
  root(p, id) == root(q, id)
end

# union, to merge components containing p and q
# set id of p's root to the id of q's root
def unite(p, q, id)
  i = root(p, id)
  j = root(q, id)
  id[i] = j
end

for i in 1..q
  com = array[i].split(" ")[0]
  x   = array[i].split(" ")[1].to_i
  y   = array[i].split(" ")[2].to_i

  if com == '0'
    # unite(4,3) id[4] = 3, 4?????????3?????????
    unite(x, y, id)
  else
    # same
    puts same?(x, y, id) ? "1" : "0"
  end
end

Measured memory_bytes: 16648
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define vll vector<ll>
#define vvll vector<vll>
#define mll map<ll,ll>
#define f(i,m,n) for(i=m;i<n;i++)
#define ee endl
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define take(v,n) for(i=0;i<n;i++) cin>>v[i];
#define NO() cout<<"IMPOSSIBLE"<<endl
#define YES() cout<<"Yes"<<endl
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sot(v) sort(v.begin(),v.end());
#define mod 1000000007;  
bool isPrime(int n) 
{ 
    // Corner cases 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
  
    // This is checked so that we can skip  
    // middle five numbers in below loop 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}

ll powe(ll x, ll y){
    ll res = 1;
    while (y > 0){
        if (y & 1) res = res*x;
        y = y>>1;
        x = x*x;
    }
    return res;
}

void solve()
{
    ll i,j,n,k,m,w,q;
    string s1;
    string s2;
    cin>>s1>>s2;
    n=s1.length();
    m=s2.length();
    ll ans=n,cnt;
    for(i=0;i<=n-m;i++)
    {
        cnt=0;
        for(j=0;j<m;j++)
        {
            if(s1[i+j]==s2[j]) continue;
            cnt++;
        }
        ans=min(ans,cnt);
    }
    cout<<ans<<ee;
}
int main() {
    fast;
    ll i,j,l,k,t,n;
    t=1;
    for(i=1;i<=t;i++)
    {
        // cout<<"Case #"<<i<<": ";
        solve();
    }
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
int main(){
  const int mod = 1000000007;
  int n, m; cin >> n >> m;
  vector<string> a(n); for(auto & i : a) cin >> i;
  vector<vector<int> > f(n, vector<int>(m, 0));
  f[0][0] = 1;
  for(int i = 0; i < n; i++){
    for(int j = 0; j < m; j++){
      if(f[i][j]){
        if(i + 1 < n && a[i + 1][j] != '#'){
          f[i + 1][j] += f[i][j];
          if(f[i + 1][j] >= mod) f[i + 1][j] -= mod;
        }
        if(j + 1 < m && a[i][j + 1] != '#'){
          f[i][j + 1] += f[i][j];
          if(f[i][j + 1] >= mod) f[i][j + 1] -= mod;
        }
      }
    }
  }
  cout << f[n - 1][m - 1] << endl;
  return 0;
}

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

int min;
int num;
int map[20];

void check(int pos , int *pair){
  int i;

  for(i=0;i<4;i++)pair[i] = 0;

  if(pos%4 != 3){
    if(map[pos] == map[pos+1])pair[0] = pos + 1;
  }
  
  if(pos < 16){
    if(pos%4 != 0){
      if(map[pos] == map[pos+3])pair[1] = pos + 3;
    }
    
    if(map[pos] == map[pos+4])pair[2] = pos + 4;
    
    if(pos%4 != 3){
      if(map[pos] == map[pos+5])pair[3] = pos + 5;
    }
  }

}

void pick(int pos,int pair){
  int i;
  int c;

  map[pos] = 0;
  map[pair] = 0;
  c = 0;
  for(i=0;i<num-2;i++){
    if(!map[i+c]){
      c++;
      if(i+c == pair)c++;
    }
    if(c)map[i]  =  map[i+c];
  }

  map[num-1] = 0;
  map[num-2] = 0;

}

void recover(int pos, int pair,int value){
  int i;
  int c;

  c = 2;
  for(i=num-1;i>pos;i--){
    if(i == pair){
      map[i] = value;
      c--;
    }else map[i] = map[i-c];
  }
  map[pos] = value;

}

int patience(void){
  int i,j;
  int pair[4];
  int value;
  int tmp;

  if(min == 0)return 0;
  if(min > num)min = num;

  for(i=0;i<num;i++){

    check(i,pair);
    value = map[i];

    for(j=0;j<4;j++){
      if(pair[j]){
	pick(i,pair[j]);
	num -= 2;

	tmp = patience();
	if(min > tmp)min = tmp;

	num += 2;
	recover(i,pair[j],value);
      }
    }
    
  }

  return min;
}

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

  scanf("%d",&n);

  for(i=0;i<n;i++){

    for(j=0;j<20;j++)scanf("%d ",&map[j]);

    min = 20;
    num = 20;

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

  }

  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>
#include<queue>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define dump(a) cout << a << endl; 

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

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}

/**
* @fn
* 自然数について、桁数を求める
*/
Int getDigit(Int num) {
	return (Int)(log10(num)) + 1;
}


int get2Digit(Int num) {
	int cnt = 0;
	while (num > 0) {
		if (num % 2 != 0) {
			return cnt;
		}
		cnt++;
		num /= 2;
	}
}

long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b < 1) return -1;
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0; true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

void ansYes(bool a) {
	if (a == true) cout << "Yes" << endl;
	else cout << "No" << endl;
}

void ansYES(bool a) {
	if (a == true) cout << "YES" << endl;
	else cout << "NO" << endl;
}


Int euclidean_gcd(Int a, Int b) {
	while (true) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

typedef pair<int, int> pai;


//ここまでライブラリ
//ここから本文
int main() {
	string gomi, a;
	cin >> gomi >> a >> gomi;
	cout << "A" << a.at(0) << "C" << endl;
}

Measured memory_bytes: 256
/**
 _____      _ _              ______     
/  ___|    (_|_)             |  _  \    
\ `--. _ __ _ _  __ _ _ __   | | | |___ 
 `--. \ '__| | |/ _` | '_ \  | | | / _ \
/\__/ / |  | | | (_| | | | | | |/ /  __/
\____/|_|  |_| |\__,_|_| |_| |___/ \___|
            _/ |                         
           |__/                          
All Required Header Files ********/
#include <bits/stdc++.h>  
using 		namespace 		std;
using 		lli= 			long long  int;
using 		ulli= 			unsigned long long int;
using 		ld= 			long double;
int main() {
	
	ios_base::sync_with_stdio(false);cout.tie(0);cin.tie(0);
	
	lli n,m;
	cin>>n>>m;
	ld a[n],sum=0;
	for(lli i=0;i<n;i++) {
		cin>>a[i];
		sum+=a[i];
	}
	sort(a,a+n);
	reverse(a,a+n);
	ld k=sum/(m*4);
	if(a[m-1]>=k)
	cout<<"Yes";
	else
	cout<<"No";
	
	
	
	return 0;
}


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

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

int main(){
  string s;
  cin >> s;
  if(s[0]==s[1]||s[1]==s[2]||s[2]==s[3]){
    cout << "Bad" << endl;
  } else {
    cout << "Good" << endl;
  }
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#define ll long long
using namespace std;
int main(){
    int n,m;
    cin>>n>>m;
    vector<int> memo(m,0);
    for(int i=0;i<n;i++){
        int k;
        cin>>k;
        for(int j=0;j<k;j++){
            int a;
            cin>>a;
            memo[a-1]+=1;
        }
    }
    int sum=0;
    for(int i=0;i<m;i++){
        if(n==memo[i]){
            sum++;
        }
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int
main(int argc, char *argv[])
{
  int a, b;
  scanf("%d %d", &a, &b);
  
  if((a != 1 && b != 1 && a < b) || (a > 1 && b == 1)) printf("Bob\n");
  else if((a != 1 && b != 1 && b < a) || (b > 1 && a == 1)) printf("Alice\n");
  else printf("Draw\n");
  
  return 0;
}


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

void solve()
{
    ll a, b, d; char c;

    cin >> a >> b >> c >> d;

    b = b*100 + d;

    cout << (ll) a*b/100 << endl;
}


int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll t;
    solve();
    return 0;
}


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

int main(){
    ios::sync_with_stdio(false);    cin.tie(NULL);  cout.tie(NULL);
    int n, k;   cin >> n >> k;
    vector<int> vec(n), dp(200003, 0);    //map<int, int> mp;
    for(int i=0;n>i;i++){
        cin >> vec[i];
        //mp[vec[i]]++;
        dp[vec[i]]++;
    }
    for(int i=1;k>=i;i++){
        if(dp[i]){
            continue;
        }
        for(int v : vec){
            dp[i+v]=1;
        }
    }
    if(dp[k]){
        cout << "First";    return 0;
    }
    cout << "Second";
}

Measured memory_bytes: 1024
use proconio::{fastout, input};
#[allow(unused_mut)]
#[fastout]
fn main() {
    input! {
        n: usize,
        v: [usize; n]
    }
    let mut v: Vec<usize> = v;
    v.sort();
    let mut res1 = v
        .iter()
        .skip(1)
        .fold(v[0] as f64, |sum, &i| (sum + i as f64) / 2.);
    println!("{:.12}", res1);
}


Measured memory_bytes: 2192
#include <iostream>

int main(){
   int ml[4] = {250, 500, 1000, 2000};
   int price[4];
   for(int i=0; i<4; ++i){
      int p;
      std::cin >> p;
      price[i] = p;
      for(int j=0; j<i; ++j){
	 int factor = ml[i] / ml[j];
	 if(price[i]>price[j]*factor){
	    price[i] = price[j]*factor;
	 }
      }
   }
   long long N;
   std::cin >> N;
   N *= 1000;

   long long sum = 0;
   for(int i=3; i>=0; --i){
      sum += N/ml[i] * price[i];
      N -= N/ml[i] * ml[i];
   }
   std::cout << sum << std::endl;
   return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
#define M 1e9+7
int main(void){
    int n;cin >> n;
    vector<int> v(n);//v[i] := 人数の差の絶対値がi人といった人の数
    for(int i=0;i<n;i++){
        int tmp;
        cin >> tmp;
        if(tmp%2 == n%2){cout<<0<<endl;return 0;}
        v[tmp]++;
    }
    bool flag=true;
    //nが奇数ならv[0]は1人,v[2n]は2人
    if(n%2==1){
        if(v[0]!=1){flag=false;}
        for(int i=2;i<n;i+=2)if(v[i]!=2)flag=false;
    }
    //nが偶数ならv[2n+1]は2人
    if(n%2==0){
        for(int i=1;i<n;i+=2)if(v[i]!=2)flag=false;
    }
    if(!flag){cout<<0<<endl;return 0;}
    long long ans=1;
    for(int i=0;i<n/2;i++){
        ans*=2;
        ans%=(long)M;
    }
    cout << ans << endl;   
}

Measured memory_bytes: 640
def calc(A,B,C,D):
    while A > 0 and C > 0:
        C = C - B
        if C <= 0:
            return 'Yes'
        A = A - D
        if A <= 0:
            return 'No'

(A,B,C,D) = tuple([int(s) for s in input().split()])
print(calc(A,B,C,D))


Measured memory_bytes: 61676
#include <cstdio>
#include <iostream>
#define rep(i,a,n) for(int i=a; i<n; i++)
using namespace std;

char board[110][10010];
int N, M;
int cnt_col[10010][2];
int imos[10010][2];

int main() {
  scanf("%d%d", &N, &M);
  for(int i=0; i<M; i++) {
    for(int j=0; j<N; j++) {
      cin >> board[i][j];
      if(board[i][j] == 'W') cnt_col[j][0]++;
      else cnt_col[j][1]++;
    }
  }

  rep(i,0,N) rep(j,0,2) imos[i+1][j] = imos[i][j] + cnt_col[i][j];

  int mi = 1 << 30, idx = 0;
  rep(i,0,N+1) {
    int lw = imos[i][0], le = imos[i][1];
    int rw = imos[N][0] - lw, re = imos[N][1] - le;

    // printf("idx = %d, lw = %d, le = %d, rw = %d, re = %d\n", i, lw, le, rw, re);
    int error = le + rw;
    if(mi > error) {
      mi = error;
      idx = i;
    }
  }
  printf("%d %d\n", idx, idx+1);   
  return 0;
}

Measured memory_bytes: 4336
#include <bits/stdc++.h>
 
using namespace std;
 
//#define MD 1
#define MD 1000000007
 
int main(){
    int x;
    cin>>x;
    long long int ans=0;
    if(x==1){
        cout<<1<<endl;
        return 0;
    }
    
    
    for(int i=2;i<x;i++){
        long long int tmp=i;
         while(tmp<=x){
            tmp*=i;
         }
        if(tmp>x){
            tmp/=i;
        }
        if(tmp>i){
            ans=max(ans,tmp);
        }
    }
    
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
using namespace std;

int main()
{
    int n,two=1;
    cin>>n;
    REP(i,8)
    {
        if(two>n)break;
        two*=2;
    }
    cout<<two/2<<endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int maxN = 1000;
	static int maxM = 2000;
	static int n;
	static int m;
	static long INF = Long.MAX_VALUE/2;
	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			// input
			n = in.nextInt();
			m = in.nextInt();

			long[] d = new long[n];
			Edge[] edges = new Edge[m];

			for (int i = 0; i < m; i++) {
				int a = in.nextInt()-1;
				int b = in.nextInt()-1;
				long c = in.nextLong();
				edges[i] = new Edge(a, b, -c);
			}

			Arrays.fill(d, INF);

			d[0] = 0;

			boolean[] isNegative = new boolean[n];

			for (int now = 0; now < n; now++) {
				for (int j = 0; j < m; j++) {
					int u = edges[j].from;
					int v = edges[j].to;
					long c = edges[j].cost;
					if (d[u] + c < d[v]) {
						d[v] = d[u] + c;
						if (now == n-1) {
							isNegative[v] = true;
						}
					}
				}
			}

			if (isNegative[n-1]) {
				out.println("inf");
			} else {
				out.println(-d[n-1]);
			}


		}
	}

	static class Edge {
		int from;
		int to;
		long cost;

		public Edge(int from, int toNodeNum, long weight) {
			this.from = from;
			this.to = toNodeNum;
			this.cost = weight;
		}
	}

	static class ArrayUtils {
		public static Map<Integer, Integer> getCountMap(int[] array) {
			Map<Integer, Integer> map = new TreeMap<>();
			for (int x : array)
				map.merge(x, 1, Integer::sum);
			return map;
		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

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

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}


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

class vec2d {
public:
  double x,y;
  void set(double x=0.0,double y=0.0) {
    this->x = x;
    this->y = y;
  }
};
double cross(vec2d A,vec2d B) {
  return (A.x*B.y - B.x*A.y);
}
bool is_paralles(vec2d A,vec2d B) {
  if(fabs(cross(A,B)) < 1e-12) return true;
  return false;
}

int main() {
  int n; cin >> n;
  for(int i=0;i<n;i++) {
    vec2d AB,CD;
    double x1,y1,x2,y2,x3,y3,x4,y4;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    AB.set(x2-x1,y2-y1);
    CD.set(x4-x3,y4-y3);
    if(is_paralles(AB,CD)) {
      cout << "YES" << endl;
    }
    else {
      cout << "NO" << endl;
    }
  }
}

Measured memory_bytes: 1224
import math


def resolve():
    import sys
    input = sys.stdin.readline
    # row = [int(x) for x in input().rstrip().split(" ")]
    n = int(input().rstrip())
    k = int(input().rstrip())
    x_list = [int(x) for x in input().rstrip().split(" ")]

    distance = 0
    for x in x_list:
        distance += (x if x < abs(k-x) else abs(k-x)) * 2


    print(distance)

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 9124
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() (int, error) {
	return strconv.Atoi(nextString())
}

func nextFloat64() (float64, error) {
	return strconv.ParseFloat(nextString(), 64)
}

func stringifyArray(arr []int) string {
	return strings.TrimRight(fmt.Sprintf("%+v", arr)[1:], "]")
}

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

	for {
		h, _ := nextInt()
		w, _ := nextInt()

		if h == 0 || w == 0 {
			break
		}

		rectStr := ""
		for i := 0; i < h; i++ {
			for j := 0; j < w; j++ {
				if (i+j)%2 == 0 {
					rectStr += "#"
				} else {
					rectStr += "."
				}
			}
			rectStr += "\n"
		}
		fmt.Println(rectStr)
	}
}



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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define sz(v) (int)v.size()
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
const char EOL = '\n';

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int a, b;
    cin >> a >> b;
    int ans = 0;
    if (a == 1 && b == 1) {
        cout << 1000000 << EOL;
        return;
    }
    if (a == 1) {
        ans += 300000;
    } else if (a == 2) {
        ans += 200000;
    } else if (a == 3) {
        ans += 100000;
    }
    if (b == 1) {
        ans += 300000;
    } else if (b == 2) {
        ans += 200000;
    } else if (b == 3) {
        ans += 100000;
    }
    cout << ans << EOL;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define BUGAVOID(x) x
#define rep(...) BUGAVOID(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define sz(c) (int)(c.size())
#define all(c) c.begin(),c.end()
#define ms(a,v) memset(a,v,sizeof(a))
#define mp make_pair
#define write(x) cout<<(x)<<endl
using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; }return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; }return 0; }
inline ll pow2(const int n) { return 1ll << n; }
const int INF = 1 << 28; const ll LINF = 1ll << 60;
const int MAX = 1e5 + 5; const int MOD = 1e9 + 7; const double EPS = 1e-6;
const int dy[4] = { 0,1,0,-1 }; const int dx[4] = { 1,0,-1,0 };
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;
// 1. 問題よくよめえええええええええええええええええええええええええ
// 2. intオーバーフロー << * + あたり
// 3. 落ち着け

int N, Q, K;
vector<vector<pair<int, ll>>> graph;
vector<ll> distK;
vector<ll> ans;

ll dfs(const int v, const int from) {
    if (distK[v] != LINF) return distK[v];

    ll dist = LINF;
    for (const auto& e : graph[v]) {
        if (e.first == from) continue;
        else if (e.first == K) {
            dist = e.second;
            break;
        }
        else {
            chmin(dist, dfs(e.first, v) + e.second);
        }
    }

    if (dist != LINF) distK[v] = dist;
    return dist;
}

int main() {
    cin >> N;
    graph.resize(N);
    rep(i, N - 1) {
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        graph[a].emplace_back(b, c);
        graph[b].emplace_back(a, c);
    }

    distK.resize(N, LINF);
    ans.reserve(Q);

    cin >> Q >> K;
    K--;
    rep(i, Q) {
        int x, y;
        cin >> x >> y;
        x--; y--;

        ans.emplace_back(dfs(x, x) + dfs(y, y));
    }

    rep(i, Q) write(ans[i]);
}

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

#define sz 3
int A[sz][sz];

int main()
{
    for(int i=0; i<sz; i++){
        for(int j=0; j<sz; j++){
            cin>>A[i][j];
        }
    }
    int N;
    cin >> N;
    set<int> numbers;
    for(int i=0; i<N; i++){
        int b;
        cin>>b;
        numbers.insert(b);
    }

    for(int i=0; i<sz; i++){
        for(int j=0; j<sz; j++){
            if(numbers.find(A[i][j])!=numbers.end()){
                A[i][j] = -1;
            }
        }
    }
    int ans = -1;
    for(int i=0; i<sz; i++){
        if(A[i][0] == -1 && A[i][1] == -1 && A[i][2] == -1){ans = 1;}
        if(A[0][i] == -1 && A[1][i] == -1 && A[2][i] == -1){ans = 1;}
    }
    if(A[0][0] == -1 && A[1][1] == -1 && A[2][2] == -1){ans = 1;}
    if(A[0][2] == -1 && A[1][1] == -1 && A[2][0] == -1){ans = 1;}
    if(ans == 1){
        cout<<"Yes\n";
    }
    else{
        cout<<"No\n";
    }
    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = [0] * n
for i in range(n - 1, -1, -1):
    j = 2
    c = 0
    while (i + 1) * j <= n:
        c += b[(i + 1) * j - 1]
        j += 1
    b[i] = 0 if (c % 2 == a[i]) else 1
print(sum(b))
for i in range(len(b)):
    if b[i]:
        print(i + 1, end = ' ')

Measured memory_bytes: 7148
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <bits/stdc++.h>
#define ll long long
#define mx(x,y) x>y?x:y
#define mn(x,y) x<y?x:y
#define _e putchar(' ')
#define _v putchar('\n')
using namespace std;
char c;
void r(int &a){
	a=0;
	while((c=getchar())<48);
	while(c>47) a=a*10+c-48,c=getchar();
}
int n,a,b,now,sum,ans;
int main ()
{
	r(n),r(a),r(b);
	for(int i=1;i<=n;i++){
		sum=0;
		now=i;
		while(now){
			sum+=now%10;
			now/=10;
		}
		if(sum>=a&&sum<=b)
		    ans+=i;
	}
	printf("%d\n",ans);
	return 0;
}



Measured memory_bytes: 256
macro_rules! get {
      ($t:ty) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.trim().parse::<$t>().unwrap()
          }
      };
      ($($t:ty),*) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              let mut iter = line.split_whitespace();
              (
                  $(iter.next().unwrap().parse::<$t>().unwrap(),)*
              )
          }
      };
      ($t:ty; $n:expr) => {
          (0..$n).map(|_|
              get!($t)
          ).collect::<Vec<_>>()
      };
      ($($t:ty),*; $n:expr) => {
          (0..$n).map(|_|
              get!($($t),*)
          ).collect::<Vec<_>>()
      };
      ($t:ty ;;) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.split_whitespace()
                  .map(|t| t.parse::<$t>().unwrap())
                  .collect::<Vec<_>>()
          }
      };
      ($t:ty ;; $n:expr) => {
          (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
      };
}

fn main() {
    // 入力
    let (N, H, W) = get!(i64, i64, i64);
    let AB = get!(i64, i64; N);

    let mut ans = 0;
    for (a, b) in AB {
        ans += if a >= H && b >= W {
            1
        } else {
            0
        };
    }

    // 出力
    println!("{}", ans);
}

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

int main() {
  int a,b,c; 
  cin >> a>>b>>c;
  if(a+b+1>=c){
    cout<<b+c<<endl;
  }
  else{
    cout<<a+b+b+1<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using P = pair<ll, ll>;
const long double PI = acos(-1.0L);
ll GCD(ll a, ll b) { return b?GCD(b, a%b):a; }
ll LCM(ll a, ll b) { return a/GCD(a, b)*b; }

const int INF = 1e9;

int n, m;
vector< vector<int> > G(110, vector<int>(110, INF));

int main() {
    cin >> n >> m;
    for(int i = 0; i < m; ++i) {
        int a, b, c; cin >> a >> b >> c;
        a--; b--;
        G[a][b] = c;
        G[b][a] = c;
    }
    for(int i = 0; i < n; ++i) G[i][i] = 0;
    vector< vector<int> > Gsub = G;

    for(int k = 0; k < n; ++k) {
        for(int i = 0; i < n; ++i) {
            for(int j = 0; j < n; ++j) {
                chmin(G[i][j], G[i][k]+G[k][j]);
            }
        }
    }

    int cnt = 0;
    for(int i = 0; i < n; ++i) {
        for(int j = 0; j < n; ++j) {
            if(Gsub[i][j] != INF) {
                if(G[i][j] != Gsub[i][j]) cnt++;
            }
        }
    }
    cout << cnt/2 << endl;
}

Measured memory_bytes: 3732
function main(arg) {
    const A = parseInt( arg.split(/\s/)[0] );
    const B = parseInt( arg.split(/\s/)[1] );
    var ans = (A+B)/2;
    if(ans==parseInt(ans)){
        console.log(ans);
    }else{
        console.log("IMPOSSIBLE");
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 21064
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
int main()
{
    string s;
    cin>>s;
    if(s.at(3)==s.at(2) && s.at(4)==s.at(5))
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;
    return 0;
    
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace CSharp
{
    class Program
    {
        static void Main()
        {
            var input = Console.ReadLine().Split().Select(long.Parse).ToArray();
            var N = input[0];
            var A = input[1];
            var B = input[2];

            var result = N / (A + B) * A + Math.Min(A, N % (A + B));
            Console.WriteLine(result);
        }
    }
}


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

public class Main
{

	public static void main(String[] args) throws IOException
	{
		// TODO 自動生成されたメソッド・スタブ
		String str[] = input(3);
		int a = Integer.parseInt(str[0]);
		int b = Integer.parseInt(str[1]);
		int c = Integer.parseInt(str[2]);
		int d;
		if(a > b)
		{
			d = b;
			b = a;
			a = d;
		}
		if(a > c)
		{
			d = c;
			c = a;
			a = d;
		}
		if(b > c)
		{
			d = c;
			c = b;
			b = d;
		}
		System.out.println(a + " " + b + " " + c);
	}

	public static String[] input(int Num) throws IOException
	{
		String str[] = new String[Num];
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str2 = br.readLine();
		int j = 0;
		for(int i = 0; i < Num; i++)
		{
			if(i < Num - 1)
			{
				str[i] = str2.substring(j, str2.indexOf(" ", j));
				j = str2.indexOf(" ", j) + 1;
			}
			else
			{
				str[i] = str2.substring(j);
			}
		}
		return str;
	}

}



Measured memory_bytes: 24192
/*
    なせば大抵なんとかなる！
*/

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <limits.h>
#include <float.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iterator>
#include <vector>
#include <map>
#include <utility>
#define LLU unsigned long long int
#define LL long long int
using namespace std;
#define Lfmax DBL_MAX
#define LLUmax ULLONG_MAX
#define LLmax LLONG_MAX
#define dmax INT_MAX
#define vd vector<int>
#define vLL vector<long long int>
#define vLLU vector<unsigned long long int>
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define debug printf("asd\n")
#define debugd(a) printf("--%d\n",a)
#define debugdd(a,b) printf("--%d %d\n",a,b)
#define debugarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i]);printf("\n")
#define newline printf("\n")
#define forin(a,b,c) for(int a=b ; a<c ; a++)
#define forineq(a,b,c) for(int a=b ; a<=c ; a++)
#define forde(a,b,c) for(int a=b ; a>=c ; a--)
#define UPC(oo) (oo>='A' && oo<='Z')
#define LWC(oo) (oo>='a' && oo<='z')
#define DGT(oo) (oo>='0' && oo<='9')
#define UPCVOC(oo) (oo=='A' || oo=='E' || oo=='I' || oo=='U' || oo=='O')
#define LWCVOC(oo) (oo=='a' || oo=='e' || oo=='i' || oo=='u' || oo=='o')

inline void scd(int &a){scanf("%d",&a);}
inline void scdd(int &a,int &b){scanf("%d %d",&a,&b);}
inline void sctd(int &a,int &b,int &c){scanf("%d %d %d",&a,&b,&c);}
inline void sctlld(LL &a,LL &b,LL &c){scanf("%I64d %I64d %I64d",&a,&b,&c);}
inline void scdlld(LL &a,LL &b){scanf("%I64d %I64d",&a,&b);}
inline void sclld(LL &a){scanf("%I64d",&a);}

inline void prd(int a){printf("%d",a);};
inline void prdd(int a,int b){printf("%d %d",a,b);};
inline void prtd(int a, int b, int c){printf("%d %d %d",a,b,c);};
inline void prtlld(LL a, LL b, LL c){printf("%I64d %I64d %I64d",a,b,c);};
inline void prdlld(LL a, LL b){printf("%I64d %I64d",a,b);};
inline void prlld(LL a){printf("%I64d",a);};

#define scarrd(a,b) for(int index=0 ; index<b ; index++)scanf("%d",&a[index])
#define prarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i])
#define iniarr(a,b) for(int i=0 ; i<b ;i++)a[i]=0
#define arr(a,b) int *a=(int *)malloc(b*sizeof(int))
#define llarr(a,b) long long int *a=(long long int *)malloc(b*sizeof(long long int))
#define st(a,b) char *a=(char *)malloc(b*sizeof(char))
#define grav 9.8
#define pi 3.14159265
#define INF 20010301310

int main()
{
	int a,b;
	scdd(a,b);
	int d[a+2];
	iniarr(d,a+2);
	int x,y;
	forin(i,0,b)
	{
		scdd(x,y);
		x--;
		y--;
		d[x]++;
		d[y]++;
	}
	forin(i,0,a)
	{
		prd(d[i]);
		newline;
	}
	return 0;
}


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

int main(){
    int k,n;
    cin>>k>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    a.push_back(a[0]+k);
    int l=0;
    for(int i=0;i<n;i++){
        l=max(l,a[i+1]-a[i]);
    }
    int ans=k-l;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1920
//#include <bits/stdc++.h>
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>

using namespace std;
using ll=long long;
using intpair=pair<int,int>;
using intpv=vector<intpair>;
using llpair=pair<ll,ll>;
using llpv=vector<llpair>;
using intvec=vector<int>;
using llvec=vector<ll>;
using intq=queue<int>;
using llq=queue<ll>;
using intmat=vector<intvec>;
using llmat=vector<llvec>;
using pairmat=vector<llpv>;

template<typename T>
using matrix=vector<vector<T>>;
template<typename T>
using pque=priority_queue<T>;
template<typename T>
using lpque=priority_queue<T,vector<T>,greater<T>>;

#define PI 3.141592653589793
#define INTINF 1<<30
#define LLINF 1LL<<60
#define MPRIME 1000000007
#define MPRIME9 998244353

#define pushb push_back
#define fi first
#define se second

#define setpr fixed<<setprecision(15)
#define all(name) name.begin(),name.end()
#define rall(name) name.rbegin(),name.rend()
#define gsort(vbeg,vend) sort(vbeg,vend,greater<>())
#define init(v,size) v.resize(size); for(auto &a__: v) cin>>a__
#define matin(mat,H,W) for(int i__=0; i__<H; i__++)for(int j__=0; j__<W; j__++) cin>>mat[i__][j__]
#define out(n) cout<<n<<endl

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

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

template<class T> inline void outmat(T& a, int y, int x) {
	for(int i=0; i<y; i++) {
		for(int j=0; j<x; j++) cout<<a[i][j]<<" ";
		cout<<endl;
	}
}

ll GCD(ll a, ll b) { //最大公約数
	if(a==0||b==0) return 0;
	if(a<b) swap(a,b);
	ll tmp = a%b;
	while(tmp!=0) {
		a = b;
		b = tmp;
		tmp = a%b;
	}
	return b;
}

ll binpow(ll a, ll ex, ll p) { //繰り返し二乗法
	ll result=1;
	while(ex>0) {
		if(ex&1) result=result*a%p;
		ex>>=1;
		a=a*a%p;
	}
	return result;
}

ll Fact(ll x, ll p) { //階乗
	ll f=1;
	for(ll i=2; i<=x; i++) {
		f*=i;
		f%=p;
	}
	return f;
}

ll nPr(ll n, ll r) {
	if(n<r) return 0;

	ll result=1LL;
	for(ll i=0; i<r; i++) result*=n-i;
	return result;
}

ll nPrP(ll n, ll r, ll p) { // mod pにおけるnPr
	if(n<r) return 0;

	ll result=1LL;
	for(int i=0; i<r; i++) {
		result*=n-i;
		result%=p;
	}
	return result;
}

ll nCr(ll n, ll r) {
	if (n == r) { return 1; }
	if (r > n) { return 0; }

	if (r > n / 2) { r = n - r; }

	if (n == 0) { return 0; }
	if (r == 0) { return 1; }
	if (r == 1) { return n; }

	double result = 1;
	for (double i = 1; i <= r; i++) {
		result *= (n - i + 1) / i;
	}

	return (ll)result;
}

int DigitNum(ll n) { //桁数
	int digit=0;
	ll div=1LL;
	while(n/div) {
		digit++;
		div*=10;
	}
	return digit;
}

bool Palind(string s) { //回文判定
	return s == string(s.rbegin(), s.rend());
}


double n,m,d;

void input() {
	cin>>n>>m>>d;
}

void solve() {
	double D;
	if(d) D=2.*(n-d)/n/n;
	else  D=1/n;

	cout<<setpr<<(m-1)*D<<endl;
}

int main() {
	while(1) {
		input();
		solve();
		break;
	}
}


Measured memory_bytes: 256
// Hail god Yato
 
#include <bits/stdc++.h> 
using namespace std;
 
#define add(x) accumulate(x)
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end() 
#define rep(i, a, b) for (int i=a; i<(b); i++)
#define hs ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef vector<pll> vpll;
const ll mod = 1000000007;
const ll INF = 1e18;
const ll MAX = 100001;
//
//
                void solve(){
                        ll n;
                        cin>>n;
                        vll vec(n);
                        rep(i,0,n)
                                cin>>vec[i];
                        ll dp[n+1][2]; // 0 means don't include present 1 means including the current index
                        dp[1][0] = vec[0];
                        dp[1][1] = vec[1];
                        dp[0][0] = 0;
                        dp[0][1] = 0;
                        rep(i,2,n){
                                if(i&1){
                                        dp[i][1] = vec[i] + dp[i-1][0];
                                        dp[i][0] = vec[i-1] + dp[i-2][0];
                                }
                                else{
                                        dp[i][0] = max(dp[i-1][1], dp[i-1][0]);
                                        dp[i][1] = vec[i] + max(dp[i-2][0], dp[i-2][1]);
                                        // dp[i] = max(dp[i-2][1] + vec[i], vec[i-1] + dp[i-2][0]);
                                }
                                // cout<<dp[i][0]<<" "<<dp[i][1]<<'\n';
                        }
                        cout<<max(dp[n-1][0], dp[n-1][1]);
                }
                int main(){ 
                        hs;
                        ll t;
                        t=1;
                        // cin>>t;
                        for (int i=1; i<=t; i++){
                                //cout<<"Case #"<<i<<": ";
                                solve();
                         }
        return 0; 
}         


Measured memory_bytes: 7956
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.HashMap;
import java.util.NoSuchElementException;
import java.util.Queue;

public class Main {
	HashMap<String,Integer> map;
	int[] d = {1,-1,4,-4};
	public void solve() {
		Queue<String> q = new ArrayDeque<String>();
		map = new HashMap<String,Integer>();
		map.put("01234567", 0);
		q.add("01234567");
		while(q.size() > 0){
			String x = q.poll();
			int index = x.indexOf("0");
			for(int i = 0;i < 4;i++){
				int z = index + d[i];
				if(i == 1 && index % 4 == 0)continue;
				if(i == 0 && index % 4 == 3)continue;
				if(z < 0 || z >= 8)continue;
				char[] ch = x.toCharArray();
				char tmp1 = ch[index];
				ch[index] = ch[z];
				ch[z] = tmp1;
				String s = String.valueOf(ch);
				if(map.containsKey(s))continue;
				map.put(s,map.get(x) + 1);
				q.add(s);
			}
		}
		while(hasNext()){
			StringBuilder sb = new StringBuilder();
			for(int i = 0;i < 8;i++){
				sb.append(next());
			}
			out.println(map.get(sb.toString()));
		}
	}

	public static void main(String[] args) {
		out.flush();
		new Main().solve();
		out.close();
	}

	/* Input */
	private static final InputStream in = System.in;
	private static final PrintWriter out = new PrintWriter(System.out);
	private final byte[] buffer = new byte[2048];
	private int p = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (p < buflen)
			return true;
		p = 0;
		try {
			buflen = in.read(buffer);
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (buflen <= 0)
			return false;
		return true;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrint(buffer[p])) {
			p++;
		}
		return hasNextByte();
	}

	private boolean isPrint(int ch) {
		if (ch >= '!' && ch <= '~')
			return true;
		return false;
	}

	private int nextByte() {
		if (!hasNextByte())
			return -1;
		return buffer[p++];
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = -1;
		while (isPrint((b = nextByte()))) {
			sb.appendCodePoint(b);
		}
		return sb.toString();
	}

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

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

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

Measured memory_bytes: 33276