akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define erorp(x) cout<<#x<<"={"<<(x.F)<<" , "<<x.S<<"}"<<endl;
#define print(v,r) f(i,0,r) cout<<v[i]<<" "; cout<<endl;
#define is_bit(x,y) (x%(1<<(y+1))>=(1<<y))
#define eror(x) cout<<#x<<'='<<(x)<<endl;
#define f_(i,a,b) for(int i=a;i>=b;i--)
#define Gett(x,y) scanf("%d%d",&x,&y);
#define f(i,a,b) for(int i=a;i<b;i++)
#define get(x) scanf("%I64d",&x);
#define All(x) x.begin(),x.end()
#define gett(x) scanf("%d",&x);
#define Add(x,y) x=(x+y)%p
#define maxm(a,b) a=max(a,b)
#define minm(a,b) a=min(a,b)
#define lst(x) x[x.size()-1]
#define sz(x) int(x.size())
#define mp make_pair
#define ll long long
#define pb push_back
#define S second
#define F first
 
const int N=2e5+99,K=103;

int n,m,u,v,p,c,t[2],h[N],mark[N];
ll ans;
vector<int> g[N];

void dfs(int x){
    mark[x]=1;
    f(i,0,g[x].size())
        if(mark[g[x][i]] && h[x]==h[g[x][i]])
            c=1;
    f(i,0,g[x].size())
        if(!mark[g[x][i]])
            h[g[x][i]]=h[x]^1,dfs(g[x][i]);
}
int main(){
    cin>>n>>m;
    p=n;
    f(i,0,m){
        Gett(u,v);
        g[u].pb(v);
        g[v].pb(u);
    }
    f(i,1,n+1)
        if(!mark[i]){
            if(sz(g[i])){
                c=0;
                dfs(i);
                t[c]++;
            }
            else ans+=p*2-1,p--;
        }
    ans+=1ll*(t[0]+t[1])*(t[0]+t[1])+1ll*t[0]*t[0];
    cout<<ans;
}

Measured memory_bytes: 16100
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	long long q,h,s,d,p1,p2,p3,p4,mn,n;
	cin>>q>>h>>s>>d;
	cin>>n;
		p1 = n*q*4;
		p2 = n*h*2;
		p3 = n*s;
		p4 = n/2*d;
		mn = min(p1,min(p2,min(p3,p4)));
		if (mn == p4 and n%2>0){
			mn+=(min(q*4,min(h*2,s)));
		}
		cout<<mn<<endl;
}

Measured memory_bytes: 256
from collections import deque

k=int(input())

lunlun=deque(i for i in range(1,10))
for _ in range(k-1):
  p=lunlun.popleft()
  if p%10!=0:
    lunlun.append(10*p+p%10-1)
  lunlun.append(10*p+p%10)
  if p%10!=9:
    lunlun.append(10*p+p%10+1)
print(lunlun.popleft())

Measured memory_bytes: 18972
//Daniel Grzegorzewski
#include <bits/stdc++.h>

#define MP make_pair
#define PB push_back
#define ST first
#define ND second
#define int long long

using namespace std;

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef long long LL;

void init_ios()
{
     ios_base::sync_with_stdio(0);
     cin.tie(0);
}

const int MOD = (int)1e9 + 7;
const int N = 2*(int)1e5 + 10;

int n, m, a, b, sil[N], odw[N];

int fpow(int x, int y)
{
	if (y == 0)
		return 1;
	if (y%2 == 1)
		return (x*fpow(x, y-1))%MOD;
	int res = fpow(x, y/2);
	return (res*res)%MOD;
}

int C(int x, int y)
{
	return (((sil[x]*odw[y])%MOD)*odw[x-y])%MOD;
}

signed main()
{
    init_ios();
    cin >> n >> m >> a >> b;
    sil[0] = odw[0] = 1;
    for (int i = 1; i < N-5; ++i) {
    	sil[i] = (i*sil[i-1])%MOD;
    	odw[i] = fpow(sil[i], MOD-2);
    }
    int res = 0;
    for (int i = 1; i <= n-a; ++i) {
    	res = (res+(C(i+b-2, i-1)*C(n+m-i-b-1, m-b-1))%MOD)%MOD;
    }
    cout<<res<<"\n";
}

Measured memory_bytes: 3328
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

template<int Modulo = MOD> struct Mint {
	Int val;
	constexpr Mint(Int v = 0) noexcept : val(v% Modulo) {
		if (val < 0) v += Modulo;
	}
	constexpr int getmod() { return Modulo; }
	constexpr Mint operator - () const noexcept { return val ? Modulo - val : 0; }
	constexpr Mint operator + (const Mint& r) const noexcept { return Mint(*this) += r; }
	constexpr Mint operator - (const Mint& r) const noexcept { return Mint(*this) -= r; }
	constexpr Mint operator * (const Mint& r) const noexcept { return Mint(*this) *= r; }
	constexpr Mint operator / (const Mint& r) const noexcept { return Mint(*this) /= r; }
	constexpr Mint& operator += (const Mint& r) noexcept {
		val += r.val;
		if (val >= Modulo) val -= Modulo;
		return *this;
	}
	constexpr Mint& operator -= (const Mint& r) noexcept {
		val -= r.val;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr Mint& operator *= (const Mint& r) noexcept {
		val = val * r.val % Modulo;
		return *this;
	}
	constexpr Mint& operator /= (const Mint& r) noexcept {
		Int a = r.val, b = Modulo, u = 1, v = 0;
		while (b) {
			Int t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		val = val * u % Modulo;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr bool operator == (const Mint& r) const noexcept {
		return this->val == r.val;
	}
	constexpr bool operator != (const Mint& r) const noexcept {
		return this->val != r.val;
	}
	friend ostream& operator << (ostream& os, const Mint<Modulo>& x) noexcept {
		return os << x.val;
	}
	friend istream& operator >> (istream& is, Mint<Modulo>& x) noexcept {
		Int tmp; is >> tmp;
		x = Mint<Modulo>(tmp);
		return is;
	}
	friend constexpr Mint<Modulo> modpow(const Mint<Modulo>& a, Int n) noexcept {
		Mint res(1), tmp = a;
		while (n > 0) {
			if (n & 1) res *= tmp;
			tmp *= tmp;
			n >>= 1;
		}
		return res;
	}
};

using mint = Mint<>;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int N;
	cin >> N;

	vector<Int> A(N);
	for (Int i = 0; i < N; i++) {
		cin >> A[i];
	}

	mint ans = 0;
	Int cnt0, cnt1;//各桁に0と1が何個ずつ出てくるか
	for (Int i = 0; i < 61; i++) {//2^i桁目
		cnt0 = 0;
		cnt1 = 0;
		for (Int j = 0; j < N; j++) {
			if (A[j]&(1LL<<i)) {
				cnt1++;
			}
			else {
				cnt0++;
			}
		}


		ans += (mint)(1LL << i) * cnt1 * cnt0;
	}

	cout << ans << "\n";
}


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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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

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; }

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

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

  ll N, K;
  cin >> N >> K;
  vector<pair<ll, ll>> vec(N);

  ll a, b;
  for(int i = 0; i < N; i++){
    cin >> a >> b;
    vec[i] = make_pair(a, b);
  }

  sort(vec.begin(), vec.end());

  ll cnt = 0;
  for(int i = 0; i < N; i++){
    cnt += vec[i].second;
    
    if(cnt >= K){
      cout << vec[i].first << endl;
      break;
    }
  }


  return 0;
}


Measured memory_bytes: 1792
a = input().split()
b = int(a[0])
c = int(a[1])
if c == 0:
    print(b)
    
else:
    d = [int(i) for i in input().split()]
    e = sorted(d)


    f = int(e[0]-1)
    g = int(e[-1]+1)


    h = int(g-f)

    X = []
    for I in range(int(h+1)):
        J = int(f+I)
        if e.count(J) == 0:
            X.append(J)

    Y = len(X)
    H = []
    for S in range(Y):
        Q = X[S]
        if Q>=b:
            g = Q-b
            H.append(g)
        elif Q<=b:
            g = b-Q
            H.append(g)
    
    P = sorted(H)
    F = P[0]
    O = H.index(F)


    print(X[O])

Measured memory_bytes: 9200
#include <bits/stdc++.h>
        using namespace std;
   #define int long long
const int MAX = 510000;
const int MOD = 1000000007;


     signed main(){
int n;
cin>>n;
int a[n+1];
for(int i=0;i<n+1;i++)cin>>a[i];
if(n==0){
     if(a[0]==1)cout<<1<<endl;
     else cout<<-1<<endl;
     return 0;
}
if(a[0]!=0){
     cout<<-1<<endl;
     return 0;
}
int ans=0,x[n+1];x[0]=1;
for(int i=1;i<n+1;i++){
    x[i]=min(MOD*MOD,x[i-1]*2-a[i]);
    if(x[i]<0){
         cout<<-1<<endl;
         return 0;
    }
}
int t=0;
for(int i=n;i>=0;i--){
     ans+=a[i]+t;
     
   if(i!=0){
        
 t=min(x[i-1],(t+a[i]));
   }
}
cout<<ans<<endl;


 }

 


 






    





      

        


Measured memory_bytes: 5184
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007,mod2 = 998244353;

int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};

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 INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}

bool is_prime[1000010];

int f[10010];

int main() {
    int n,ans = 0;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        if(i%2 == 0 && a %2 == 1) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
import scala.io.StdIn.readLine

object Main extends App {

  val N:Int = readLine().toInt

  if (N == 1) {
    println("Hello World")
  } else if (N == 2) {
    val A = readLine().toInt
    val B = readLine().toInt
    println( A + B)
  }

}


Measured memory_bytes: 25412
#include <iostream>
#include <stdio.h>
using namespace std;

int main(){
    string S;
    cin >> S;
    char x = '?';
    long long m = 1000000007;
    int N = S.size();
    
    long long A[N+1][13];

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

    A[0][0] = 1;

    for(int i = 0; i < N; i++){
        for(int j = 0; j < 13; j++){
            if(S[i] == x){
                for(int k = 0; k < 10; k++){
                    A[i+1][(10*j+k)%13] += A[i][j];
                }
            }
            else{
                int k = S[i] - '0';
                A[i+1][(10*j+k)%13] += A[i][j];
            }
        } 
        for(int l = 0; l < 13; l++){
            A[i+1][l] %= m;
        }
    }
    cout << A[N][5] << endl;
}

Measured memory_bytes: 10624
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using Graph=vector<vector<int>>;
#define MAX 5100000
#define MOD 1000000007

long long modpow(long long a,long long n,long long mod){
  long long res=1;
  while(n>0){
    if(n&1){       //nのbitと...00001を比較  nが2で割り切れるならtrue
      res=(res*a)%mod;
    }
    a=(a*a)%mod;
    n>>=1;
  }
  return res;
}

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


ll gcd(ll a,ll b){
  while(a%b!=0){
    ll tmp=a%b;
    a=b;
    b=tmp;
  }
  return b;
}

int main(){
  ll N,K;
  cin>>N>>K;
  ll ans=0;
  vector<ll> number(K+1);
  for(ll i=K;i>0;i--){
    ll A=K/i;
    ll count=modpow(A,N,MOD);
    for(ll j=2;i*j<=K;j++){
      count+=MOD-number.at(i*j);
      count%=MOD;
    }
    number.at(i)=count;
    ans+=i*count%MOD;
    ans%=MOD;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 4052
S=str(input())
S=S.replace('eraser','1')
S=S.replace('erase','2')
S=S.replace('dreamer','3')
S=S.replace('dream','4')
S=S.replace('1','')
S=S.replace('2','')
S=S.replace('3','')
S=S.replace('4','')
if len(S)==0:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3188
#include <algorithm>
#include <bitset>
#include <cassert>
#include <deque>
#include <fstream>
#include <iostream>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <sstream>
#include <stdio.h>
#include <string>
#include <vector>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define POW(n) ((n) * (n))
#define ALL(a) (a).begin(), (a).end()
#define dump(v) (cerr << #v << ": " << v << endl)
#define cerr                                                                   \
  if (true)                                                                    \
  cerr

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<unsigned long long> vull;
typedef pair<ll, ll> pii;

// ll n = to_T<ll>("114514")
template <class T> T to_T(const string &s) {
  istringstream is(s);
  T res;
  is >> res;
  return res;
}
template <class T> string to_s(const T &a) {
  ostringstream os;
  os << a;
  return os.str();
}

void solve(long long N, long long K, vector<long long> a, vector<long long> b) {
  std::vector<pii> v;
  REP(i, N) { v.push_back(pii(a[i], b[i])); }
  sort(ALL(v));

  ll base = 0;

  REP(i, N) {
    base += v[i].second;
    if (K <= base) {
      cout << v[i].first << endl;
      return;
    }
  }
}

int main() {
  ios::sync_with_stdio(false);
  long long K;
  long long N;
  cin >> N;
  vector<long long> b(N - 1 + 1);
  vector<long long> a(N - 1 + 1);
  cin >> K;
  for (int i = 0; i <= N - 1; i++) {
    cin >> a[i];
    cin >> b[i];
  }
  solve(N, K, a, b);
  return 0;
}


Measured memory_bytes: 5620
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int D = sc.nextInt();
		int X = sc.nextInt();
		int[] A = nextIntArray(sc, N);

		sc.close();

		int s = 0;
		for (int j = 1; j <= D; j++) {
			for (int i = 0; i < N; i++) {
				if (j == 1 || (j - 1) % A[i] == 0) {
					s++;
				}
			}
		}

		out.println(s + X);

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}

	@SuppressWarnings("unused")
	private int[] nextIntArray(Scanner sc, int n) {
		int[] result = new int[n];
		for (int i = 0; i < n; i++) {
			result[i] = sc.nextInt();
		}
		return result;
	}
}


Measured memory_bytes: 21844
n = int(input())
p = [int(i) for i in input().split()]
ans = 0
for i in range(1, n-1):
    if max(p[i-1], p[i], p[i+1]) != p[i] and min(p[i-1], p[i], p[i+1]) != p[i]:
        ans += 1

print(ans)

Measured memory_bytes: 3060
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	static final PrintStream out = System.out;
	static final Scanner sc = new Scanner(System.in);
	static final long Mod = 1000_000_007L;
	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
		System.exit(0);
	}

	void solve() {
		int a = nextInt();
		String s = next();

		out.println(a < 3200?"red":s);
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)a[i] = nextInt();
		return a;
	}
	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)a[i] = nextLong();
		return a;
	}
	public int nextInt() {
		return Integer.parseInt(next());
	}
	public long nextLong() {
		return Long.parseLong(next());
	}
	public String next() {
		return sc.next();
	}


}

Measured memory_bytes: 21588
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
using namespace std;

#define File freopen("in.txt","r",stdin);
#define ll long long

const int mINF = 0x80000000;
const int INF = 0x3f3f3f3f;
const int maxn = 100000 + 10;

char s[110000];
char a[20];

int main()
{
    scanf("%s", s);
    int len = strlen(s);
    int flag = 1;
    int i;
    int p = 0;
    while(1) {



        memset(a, 0, sizeof(a));
        for(i = 0; i < 11 && p + i < len; i++) {
            a[i] = s[p + i];
        }
        a[i] = '\0';
        if(strcmp(a, "dreameraser") == 0 ) {
            p += 11;
            continue;
        } else {
            memset(a, 0, sizeof(a));
            for(i = 0; i < 10 && p + i < len; i++) {
                a[i] = s[p + i];
            }
            a[i] = '\0';
            if(strcmp(a, "dreamerase") == 0 ) {
                p += 10;
                continue;
            } else {
                memset(a, 0, sizeof(a));
                for(i = 0; i < 7 && p + i < len; i++) {
                    a[i] = s[p + i];
                }
                a[i] = '\0';
                if(strcmp(a, "dreamer") == 0) {
                    p += 7;
                    continue;
                } else {
                    memset(a, 0, sizeof(a));
                    for(i = 0; i < 5 && p + i < len; i++) {
                        a[i] = s[p + i];
                    }
                    a[i] = '\0';
                    if(strcmp(a, "dream") == 0) {
                        p += 5;
                        continue;
                    } else {
                        memset(a, 0, sizeof(a));
                        for(i = 0; i < 6 && p + i < len; i++) {
                            a[i] = s[p + i];
                        }
                        a[i] = '\0';
                        if(strcmp(a, "eraser") == 0 ) {
                            p += 6;
                            continue;
                        }
                        else{
                            memset(a, 0, sizeof(a));
                            for(i = 0; i < 5 && p + i < len; i++) {
                                a[i] = s[p + i];
                            }
                            a[i] = '\0';
                            if(strcmp(a, "dream") == 0 || strcmp(a, "erase") == 0) {
                                p += 5;
                                continue;
                            }
                        }
                    }
                }
            }
        }

        if(p != len) {
            flag = 0;
            break;
        } else {
            break;
        }
    }

    if(flag) {
        puts("YES");
    } else {
        puts("NO");
    }

    return 0;
}




Measured memory_bytes: 384
<?php
    # 整数の入力
    fscanf(STDIN, "%d",$a );

    for ($i = 1; $i <= $a; $i++) {
        if( strlen((string)$i) % 2 == 1) {
          $ans += 1;
        }
    }
	
    # 出力
    echo ($ans)."\n";
    ?>

Measured memory_bytes: 3700
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
using namespace std;

template<typename T>
void showVector(vector<T> a){
    int s = a.size();
    for(int i=0; i<s; i++){
        cout << i << " : " << a[i] << endl;
    }
}

int main(){
    int X, Y, A, B, C;
    int i;
    cin >> X >> Y >> A >> B >> C;
    vector<long> p(A);
    vector<long> q(B);
    vector<long> r(C);
    for(i=0; i<A; i++)
        cin >> p[i];
    for(i=0; i<B; i++)
        cin >> q[i];
    for(i=0; i<C; i++)
        cin >> r[i];
    sort(p.begin(), p.end(), std::greater<long>());
    sort(q.begin(), q.end(), std::greater<long>());
    sort(r.begin(), r.end(), std::greater<long>());
    p.erase(p.begin() + X, p.end());
    p.insert(p.end(), q.begin(), q.begin() + Y);
    p.insert(p.end(), r.begin(), r.end());
    sort(p.begin(), p.end(), std::greater<long>());
    //showVector(p);
    cout << accumulate(p.begin(), p.begin() + X + Y, 0LL) << endl;
    return 0;
}


Measured memory_bytes: 6000
#include "bits/stdc++.h"
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


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    string O = "CODEFESTIVAL2016";
    int ans = 0;
    rep(i, 16) {
        if (S[i] != O[i]) ans++;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <map>
#include <cmath>

using namespace std;

#define int long long

int gcd(int a, int b) {
    if(b == 0) return a;
    return gcd(b, a % b); 
}

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

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

    cout << lcm(a, b) << endl;
    return 0;
}

Measured memory_bytes: 256
S=input()
N=len(S)
from collections import defaultdict
O=[defaultdict(int) for i in range(N+1)]
O[0][5]=1
mod=10**9+7
for i in range(N):
    for o in O[i].keys():
        if S[N-1-i]!='?':
            n=int(S[N-1-i])
            for j in range(10):
                x=13*j+o
                if x%10==n:
                    O[i+1][x//10]=O[i][o]
                    break
        else:
            for j in range(10):
                x=13*j+o
                O[i+1][x//10]=(O[i+1][x//10]+O[i][o])%mod
print(O[N][0])

Measured memory_bytes: 139912
n = int(input())
a_list = [int(i) for i in input().split()]

c = 0
for i in range(len(a_list)) :
    if ((i+1) % 2 == 0) :
        continue

    if (a_list[i] % 2 == 1) :
        c += 1

print(c)

Measured memory_bytes: 9168
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	final int MOD = 998244353;
	final int MAX = Integer.MAX_VALUE;
	final long LMAX = Long.MAX_VALUE;
	int len = 200001;


	void doIt() {
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int D = sc.nextInt();
		while(true) {
			C -= B;
			if(C <= 0) {
				System.out.println("Yes");
				return;
			}
			A -= D;
			if(A <= 0) {
				System.out.println("No");
				return;
			}
		}
	}

	public static void main(String[] args) {
		new Main().doIt();
	}
}


Measured memory_bytes: 35648
#include <bits/stdc++.h>
#include <string>
using namespace std;
int main()
{
    string s;
    for (int i = 0; i < 19; i++)
    {
        char c;
        cin >> c;
        if (c == ',')
        {
            s += ' ';
        }
        else
        {
            s += c;
        }
    }
    cout << s << endl;

    return 0;
}

Measured memory_bytes: 3580
import numpy as np
INF=10**20
N,M,S,T=[int(a) for a in input().split(" ")]
UVAB=[[int(a) for a in input().split(" ")] for i in range(M)]

def dijkstra(S, N, paths):
    from heapq import heappush,heappop
    q=[(0,S)]
    shortest=[INF]*N
    shortest[S]=0
    while len(q)>0:
        d0, src=heappop(q)
        if d0>shortest[src]:
            continue
        for dst, d1 in paths[src]:
            if d0+d1<shortest[dst]:
                shortest[dst]=d0+d1
                heappush(q, (d0+d1, dst))
    return np.array(shortest)

paths_yn=[[] for _ in range(N)]
paths_sn=[[] for _ in range(N)]
for u,v,a,b in UVAB:
    paths_yn[u-1].append((v-1,a))
    paths_yn[v-1].append((u-1,a))
    paths_sn[u-1].append((v-1,b))
    paths_sn[v-1].append((u-1,b))
shortest_yn = dijkstra(S-1, N, paths_yn)
shortest_sn = dijkstra(T-1, N, paths_sn)

totals = 10**15-(shortest_yn+shortest_sn)
for a in np.maximum.accumulate(totals[::-1])[::-1]:
    print(int(a))


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

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll n, m;
  ll a, b;
  cin >> n >> m;
  UnionFind root(n);
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    root.unite(a - 1, b - 1);
  }
  int cnt=0;
  for(int i = 0; i < n; i++) {  
    if(!root.same(0,i)) {
      root.unite(0, i);
      cnt++;
    }
  }

    cout << cnt << endl;
  return 0;
}
 

Measured memory_bytes: 3772
n = list(map(int,input().split()))
m = list(map(int,input().split()))

m.sort(reverse=True)
kyori = []
for x in range(n[1]-1):
    kyori.append(m[x]-m[x+1])

kyori.append((m[len(m)-1]+n[0])-m[0])
print(sum(kyori)-max(kyori))

Measured memory_bytes: 86140
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <set>
#include <string>
#include <vector>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define FORSTEP(i, start, end, step) for (int i = start; i < end; i += step)
#define ALL(a) a.begin(), a.end()
typedef long long ll;
using namespace std;

int N, A, B, C;
int l[10], v[10];
int MP = 1E9;

void calc() {
    int a = 0, b = 0, c = 0, mp = 0;
    bool af = false, bf = false, cf = false;

    REP(i, N) {
        if (v[i] == 1) {
            a += l[i];
            if (af)
                mp += 10;
            af = true;
        }
        if (v[i] == 2) {
            b += l[i];
            if (bf)
                mp += 10;
            bf = true;
        }
        if (v[i] == 3) {
            c += l[i];
            if (cf)
                mp += 10;
            cf = true;
        }
    }
    mp += abs(A - a) + abs(B - b) + abs(C - c);
    if (a == 0 || b == 0 || c == 0)
        mp = 1E9;
    MP = min(MP, mp);
}

void dfs(int depth) {
    if (depth == N) {
        calc();
        depth = 0;
    } else {
        REP(i, 4) {
            v[depth] = i;
            dfs(depth + 1);
        }
    }
}

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

    cin >> N >> A >> B >> C;
    REP(i, N) cin >> l[i];

    dfs(0);
    cout << MP << endl;
    return 0;
}

Measured memory_bytes: 256
x, y = map(int, input().split())
n = (4*x-y)/2
m = (y-2*x)/2
if y%2 ==1:
  print("No")
else:
  if n <0 or m <0:
    print("No")
  else:
    if n+m==x and 2*n+4*m==y:
      print("Yes")
    else:
      print("No")

Measured memory_bytes: 9188
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N, L ;
    cin  >> N >> L;
    int sum = 0;
    int  mi = INT_MAX;
    int memo;
    for(int i = 1; i <= N; i++){
        int taste = L + i-1;
        sum += taste;
        if(mi > abs(sum - (sum - taste))){
            mi = abs(sum - (sum - taste));
            memo = taste;
        }
        // mi = min(mi, abs(sum - (sum - taste)));
        // cout << mi << endl;
    }
    // cout << sum <<  endl;
    cout << sum - memo  << endl;
    // cout << endl;

}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <unordered_set>
#include <unordered_map>

using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for (int i=(int)(b); i<(int)(e); i++)
#define ALL(x) (x).begin(), (x).end()

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

int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;

  int r = 0;
  REP (i, n) {
    int x;
    cin >> x;
    r += isPrime(x);
  }
  cout << r << endl;
  
  return 0;
}

Measured memory_bytes: 3144
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> // for less
#include <iostream>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;

#define pf(n) cout << n << endl
#define ps() cout <<" ";
#define sf(n) cin >> n
#define in(i,n) for (int i = 0; i < n; i++)
#define vi vector<int>
#define vp vector<pair<int, int>>
#define graph vector< vector<int> >
#define vs vector<string>
#define mn -
#define pls +
#define mod %
#define E =
#define EE ==
#define le <=
#define ge <=
int mx=9999999;
/**  '' "\n" - ^ **/

class Template{
    public:
    void yes()
    {
        cout<<"Yes\n";
    }

    void No()
    {
        cout<<"No\n";
    }
    void YES()
    {
        cout<<"YES\n";
    }

    void NO()
    {
        cout<<"NO\n";
    }

    void Case(int i,int n)
    {
        cout<<"Case:"<<i<<" "<<n<<endl;
    }
    /**  '' "\n" x ^ **/
    /** printf("\n") */
};
int main() {

    //ios::sync_with_stdio(false);
    //cin.tie(0);
    //Template root;
    int a,b,c;
    cin>>a>>b>>c;
    swap(a,b);
    swap(a,c);
    cout<<a;ps();cout<<b;ps();cout<<c;
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
b=a
ans1=ans2=0
sign=1
total=0
for i in range(n):
    total+=a[i]
    if total*sign<=0:
        k=abs(total-sign)
        ans1+=k
        total=sign
    sign*=-1
sign=-1
total=0
for i in range(n):
    total+=b[i]
    if total*sign<=0:
        k=abs(total-sign)
        ans2+=k
        total=sign
    sign*=-1
print(min(ans1,ans2))


Measured memory_bytes: 14468
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = pow(10, 9) + 7;
//const int MOD = 998244353;
//const int MOD = ;
int mod(int A, int M) {return (A % M + M) % M;}
const int INF = 1LL << 60;
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string abc = "abcdefghijklmnopqrstuvwxyz";
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
int myctoi(char C) {return C - 48;}
char myitoc(int N) {return '0' + N;}

signed main()
{
  int N;
  cin >> N;
  vector<int> d(N);
  for (int i = 0; i < N; i++)
  {
    cin >> d.at(i);
  }
  
  sort(d.begin(), d.end());

  int ans = d.at(N / 2) - d.at(N / 2 - 1);

  cout << ans << endl;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define each(a,x) for(auto a : (x))
#define all(a) (a).begin(),(a).end()
#define chmin(a,b) ((a) = min((a),(b)))
#define chmax(a,b) ((a) = max((a),(b)))
#define in_range(x,l,r) ((l)<=(x) && (x)<(r))
#define printvec(a) rep(i,a) cout << a[i] << " \n"[i+1==(a).size()];
#define fs first
#define sc second
#define em emplace
#define eb emplace_back
#define sz size()
#define MP make_pair
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;

const ll INF = 1e8;
const D EPS = 1e-8;
const ll MOD = 1e9+7;

int main(){
  ll n, a, b;
  cin >> n >> a >> b;

  if ( (b-a)%2 == 0) {
    cout << (b-a) / 2 << endl;
  } else {
  cout << min( (b+a-1) / 2, (2 * n - b - a + 1) / 2) << endl;
  }
}


Measured memory_bytes: 256
import sys
if sys.platform == 'ios':
	sys.stdin = open('input_file.txt')

c = [list(map(int,input().split())) for i in range(3)]

ans = 0

for i in range(max(max(c))+1):
	#print(i)
	a0 = i
	b0 = c[0][0]-a0
	b1 = c[0][1]-a0
	b2 = c[0][2]-a0	
	a1 = c[1][0]-b0	
	a2 = c[2][0]-b0
	
	if c[1][1]==a1+b1 and c[1][2]==a1+b2 and c[2][1]==a2+b1 and c[2][2]==a2+b2:
		ans = ans +1
		break

print('Yes' if ans !=0 else 'No')


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

int dp[100];

//最大公約数
int gcd(int x, int y){
  if(x % y == 0) return 1;
  return gcd(y, x % y);
}
//最小公倍数
int lcm(int x, int y){
  return x * y / gcd(x, y);
}
//フィボナッチ数列
//配列dpを-1で初期化する
int fib(int n){
  if(n == 0 || n == 1) return dp[n] = 1;
  if(dp[n] != -1) return dp[n];
  return dp[n] = fib(n - 1) + fib(n - 2);
}
//階乗計算(factorial)
int fact(int n){
  if(n = 1) return 1;
  return n * fact(n - 1);
}
//累乗計算(Exponentiation)
//x**y
ll expo(int x, int y){
  ll ans = 1;
  rep(i, y){
    ans *= x;
  }
  return ans;
}
//桁数
int keta(ll x){
  if(x == 0) return 1;
  int res = 0;
  while(x){
    x /= 10;
    res++;
  }
  return res;
}


int main(){
  int n;
  cin >> n;
  vector<int> p(n);
  rep(i, n) cin >> p[i];

  int ans = 0;

  REP(i, n-1){
    if(p[i-1] <= p[i] && p[i] <= p[i+1]) ans ++;
    else if(p[i+1] <= p[i] && p[i] <= p[i-1]) ans ++;
  }
  cout << ans << endl;
}


/*





















*/


Measured memory_bytes: 256
import math
from collections import Counter
N,A,B = [int(a) for a in raw_input().strip().split()]
S = raw_input().strip()

passed = 0
foreign = 1
result = []
y = 'Yes'
n = 'No'

for Si in S:
  if Si == 'a':
    if passed < A+B:
      result.append(y)
      passed += 1
    else:
      result.append(n)
  elif Si == 'b':
    if passed < A+B and foreign <= B:
      result.append(y)
      passed += 1
      foreign += 1
    else:
      result.append(n)
  else:
    result.append(n)

print "\n".join(result)


Measured memory_bytes: 4608
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
using namespace std;
using ll = long long;

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

    int p[10][10] = {};
    for (int i = 1; i <= n; i++) {
        int t = i;
        int t0 = t % 10;
        if (t0 == 0) continue;

        while (t >= 10) t /= 10;
        int t1 = t;
        p[t1][t0]++;
    }

    ll r = 0;
    for (int i = 1; i < 10; i++) {
        for (int j = 1; j < 10; j++) {
            r += (ll)p[i][j] * p[j][i];
        }
    }

    cout << r << endl;

    //1桁の同じ数なら 0で終わる数は使えない 1桁と2桁以上のペアもあるか

    return 0;
}

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

int n;
struct Edge{
  int to,id;
};
vector<vector<Edge> > g;
vector<int> ans;

void dfs(int v,int c=-1,int p=-1){
  int k=1;
  rep(i,g[v].size()){
      int u=g[v][i].to;
      if (u==p)continue;
      if (k==c)++k;
      ans[g[v][i].id]=k;++k;
      dfs(u,k-1,v);
  }
}

int main() {
  cin >> n;
  g.resize(n);
  rep(i,n-1){
    int a,b;
    cin >> a >> b;
    a--;b--;
    g[a].push_back((Edge){b,i});
    g[b].push_back((Edge){a,i});
  }
  ans.resize(n);
  dfs(0);
  int mx=0;
  rep(i,n-1){
    mx=max(mx,int(g[i].size()));
  }
  cout << mx << endl;
  rep(i,n-1){
    cout << ans[i] << endl;
  }
  
  return 0;
}



Measured memory_bytes: 8320
from numpy import*
n,a=open(0)
n=int(n)
a=cumsum(int64([0]+a.split()))
dp=zeros((n,n+1),'i8')
for k in range(1,n):
  for l in range(n-k):
    r=l+k+1
    dp[l,r]=amin(dp[l,l+1:r]+dp[l+1:r,r],0)+a[r]-a[l]
print(dp[0,n])

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

int main(){
  int n;
  //string a, b, c, d;
  cin >> n;//a >> b >> c >> d;
  //cin >> s;
  if(n<=999)cout << "ABC" << endl;
  //else if(abs(a-b)<=d&&abs(b-c)<=d)cout << "Yes" << endl;
  else cout << "ABD" << endl;
  
  return 0;
}


Measured memory_bytes: 256
n,m,c = map(int,input().split())
b = list(map(int,input().split()))
a = [list(map(int,input().split())) for i in range(n)]
cnt = 0
for i in range(n):
    ans = c
    for j in range(m):
        ans += b[j]*a[i][j]
    if ans >0: cnt+= 1
print(cnt)


Measured memory_bytes: 2940
import java.util.*;
 
public class Main{
 
  public static void main(String args[])
  {
   
    Scanner sc = new Scanner(System.in);
    
    int n = sc.nextInt();
    
    int a[]  =  new int[n];
    
    for(int i=0;i<n;i++)
    {
     a[i]  = sc.nextInt(); 
    }
    
    int count =0;
    
    for(int i=0 ;i<n ;i=i+2)
    {
     if(a[i] %2==1)
     {
      count++; 
     }
    }
    
    System.out.println(count);
    
  }
  
  
  
}

Measured memory_bytes: 35592
/* https://codeforces.com/contest/1360/problem/H */
#include<bits/stdc++.h>

using namespace std;
using ll = long long;
using vs = vector<string>;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vpi = vector<pair<int, int>>;
using vpl = vector<pair<ll, ll>>;
using ld = double;

#define f first
#define s second 
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define pb push_back
#define	lb lower_bound
#define	ub upper_bound
#define	sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()
#define ins insert

const int MAX = INT_MAX;

int main() {
	
	int N;
	cin>>N;
	map<string, int> cnt;
	for (int i = 0;i < N;++i) {
		string s;
		cin>>s;
		cnt[s] += 1;
	}

	cout<<"AC"<<" x "<<cnt["AC"]<<endl;
	cout<<"WA"<<" x "<<cnt["WA"]<<endl;
	cout<<"TLE"<<" x "<<cnt["TLE"]<<endl;
	cout<<"RE"<<" x "<<cnt["RE"]<<endl;
	return 0;
}


Measured memory_bytes: 3632
N, Q = map(int, input().split())
S = input()
#ACのCのところに1を立てる部分和列
X = [0] * N
for i in range(1,N):
  if S[i-1:i+1] == 'AC':
    X[i] = X[i-1] + 1
  else:
    X[i] = X[i-1]

# Query
for i in range(Q):
  l,r = map(int, input().split())
  l,r = l-1, r-1
  if l > 0 and X[l] != X[l-1]:
    print(max(X[r] - X[l-1] - 1,0))
  elif l > 0:
    print(X[r] - X[l-1])
  else:
    print(X[r])
    
#print(X)

Measured memory_bytes: 6140
N, K = map(int, input().split())
S = list(input())

if S[K - 1] == 'A':
    S[K - 1] = 'a'
elif S[K - 1] == 'B':
    S[K - 1] = 'b'
elif S[K - 1] == 'C':
    S[K - 1] = 'c'
print(''.join(S))


Measured memory_bytes: 3060
#include <stdio.h>

int main(){
    double a,b,c,d,e,f;
    double x,y;
    
    while (scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f) != EOF) {
        x=(c*e-b*f)/(a*e-b*d);
        y=(c*d-a*f)/(b*d-a*e);
        if(-0.0005<x && x<=0)
            x=0;
        if(-0.0005<y && y<=0)
            y=0;
        printf("%.3f %.3f\n",x,y);
    }
    
    return 0;
}

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

void prime_factorize(ll N,map<ll,ll> &res) {
    for (ll a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        ll ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res[a]=ex;
    }

    // 最後に残った数について
    if (N != 1) res[N]=1;
}

int main(){
    ll n,p; cin >> n >> p;
    ll ans = 1;
    map<ll,ll> mp;
    prime_factorize(p,mp);
    for(auto itr=mp.begin();itr!=mp.end();++itr){
        //cout << itr->first << ' ' << itr->second << endl;
        ll res = (itr->second)/n;
        rep(i,res) ans*=itr->first;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,cost;
  	cin>>n;
  	int a[n],dp[n];
  	for (int i=0;i<n;i++) dp[i]=1000000000;
  	for (int i=0;i<n;i++) cin>>a[i];
  	if(n>2) dp[0]=0;
  	else { cout<<abs(a[1]-a[0]); return 0; }
  	for (int i=0;i<n;i++)
  	{
  	    for (int j:{i+1,i+2})
  	    {
  	        if(j<n)
  	            dp[j]=min(dp[j],dp[i]+abs(a[j]-a[i]));
  	    }
  	}
  	cout<<dp[n-1]<<endl;
    return 0;
}

Measured memory_bytes: 1024
using System;
using System.ComponentModel;
using System.IO;

namespace Contest
{
    class Scanner
    {
        public Scanner()
        {
            _stream = new StreamReader(Console.OpenStandardInput());
            _pos = 0;
            _line = new string[0];
            _separator = ' ';
        }

        private char _separator;
        private StreamReader _stream;
        private int _pos;
        private string[] _line;

        #region get a element

        public string Next()
        {
            if (_pos >= _line.Length)
            {
                _line = _stream.ReadLine().Split(_separator);
                _pos = 0;
            }

            return _line[_pos++];
        }

        public int NextInt()
        {
            return int.Parse(Next());
        }

        public long NextLong()
        {
            return long.Parse(Next());
        }

        public double NextDouble()
        {
            return double.Parse(Next());
        }

        #endregion

        #region convert array

        private int[] ToIntArray(string[] array)
        {
            var result = new int[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                result[i] = int.Parse(array[i]);
            }

            return result;
        }

        private long[] ToLongArray(string[] array)
        {
            var result = new long[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                result[i] = long.Parse(array[i]);
            }

            return result;
        }

        private double[] ToDoubleArray(string[] array)
        {
            var result = new double[array.Length];
            for (int i = 0; i < array.Length; i++)
            {
                result[i] = double.Parse(array[i]);
            }

            return result;
        }

        #endregion

        #region get array

        public string[] Array()
        {
            if (_pos >= _line.Length)
                _line = _stream.ReadLine().Split(_separator);

            _pos = _line.Length;
            return _line;
        }

        public int[] IntArray()
        {
            return ToIntArray(Array());
        }

        public long[] LongArray()
        {
            return ToLongArray(Array());
        }

        public double[] DoubleArray()
        {
            return ToDoubleArray(Array());
        }

        #endregion
    }

    class Program
    {

        public void Solve()
        {
            var sc = new Scanner();
            int n = sc.NextInt();
            int m = sc.NextInt();
            int d = sc.NextInt();
            double a;
            if (d == 0)
            {
                a = 1;
            }
            else
            {
                double aa = 2 * d;
                double bb = (n - 2 * d) * 2;
                a = (aa + bb) / n;

            }
            Console.WriteLine(a / n * (m - 1));
        }

        static void Main(string[] args) => new Program().Solve();
    }
}


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

int main() {
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;
	string res = "";
	for (int i = sy; i < ty; i++) {
		res += 'U';
	}
	for (int i = sx; i < tx; i++) {
		res += 'R';
	}
	for (int i = sy; i < ty; i++) {
		res += 'D';
	}
	for (int i = sx; i < tx; i++) {
		res += 'L';
	}
	res += 'L';
	for (int i = sy; i < ty + 1; i++) {
		res += 'U';
	}
	for (int i = sx; i < tx + 1; i++) {
		res += 'R';
	}
	res += 'D';
	res += 'R';
	for (int i = sy; i < ty + 1; i++) {
		res += 'D';
	}
	for (int i = sx; i < tx + 1; i++) {
		res += 'L';
	}
	res += 'U';
	cout << res;
	return 0;
}

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

int main() {
  int N; cin >> N;
  int B[N-1]; for (int i = 0; i < N-1; i++) cin >> B[i];
  int sum = 0;
  for (int i = 0; i < N; i++) {
    if (i == 0) sum += B[0];
    else if (i == N-1) sum += B[i-1];
    else sum += min(B[i-1], B[i]);
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

int main(){
  ll A, B, C;
  cin >> A >> B >> C;

  if(A + B >= C)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define BUFSIZE 1000000007
typedef long long ll;
int N,K;
ll rem=0;

ll Sum(ll num){
    ll sum1,sum2 = 0;
    if(num == N+2)
        return 0;
    sum1 = num*(num-1)/2;
    sum2 = num*(2*(N-num+1)+(num-1))/2;
    rem += sum2 - sum1 + 1;
    rem %= BUFSIZE;
    Sum(num+1);
    return 0;
}

int main(void){
    scanf("%d",&N);
    scanf("%d",&K);
    Sum(K);
    printf("%lld",rem);
}


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

#pragma warning(disable:4996)
using namespace std;
using ld =long double;

string st;
int a=0;
struct game {
	shared_ptr<game>l;
	shared_ptr<game>r;

	char name;

	game(char a) :name(a){

	}
	game():name('A') {

	}
};

game get_game() {
	game now_game;
	if (st[a] == '[') {
		a++;
		auto l_game=make_shared<game>(get_game());
		assert(st[a]=='-');
		a++;
		auto r_game=make_shared<game>(get_game());
		assert(st[a]==']');
		a++;
		now_game.l=l_game;
		now_game.r=r_game;
		return now_game;
	}
	else {
		now_game.name=st[a];
		a++;
		return now_game;
	}
}

int dfs(game g,const map<char,int>&mp) {
	if (g.name == 'A') {
		auto l=dfs(*g.l,mp);
		auto r=dfs(*g.r,mp);

		if (l == 0 && r) {
			return r-1;
		}
		else if (r == 0 && l) {
			return l-1;
		}
		else {
			return 100;
		}
	}
	else {
		if ((mp.find(g.name))->second==0) {
			return 0;
		}
		else {
			auto x=mp.find(g.name);
			
			return mp.find(g.name)->second;
		}
	}
}


int main() {
	cin>>st;
	map<char,int>mp;
	string line;
	getline(cin,line);
	while (getline(cin, line)) {
		char name=line[0];
		int k=stoi(line.substr(2));

		mp[name]=k;
	}
	game g=get_game();
	int ok=dfs(g,mp);
	if(ok==0)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
 	return 0;
}


Measured memory_bytes: 3232
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<int,int> pii;
#define int ll
#define fi first
#define se second
#define Sort(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/4
#define INTINF INT_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
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;}
/*----------------------------------------------------------------*/
// int MOD = 998244353;
int MOD = 1000000007;

/*----------------------------------------------------------------*/
signed main(){
	
	int n;
	cin >> n;
	// set<int> ans;
	vll ans1;
	// n-1の約数
	if(n-1 >= 2)ans1.pb(n-1);
	for(int i = 2;i*i <= n-1;i++){
		if((n-1)%i == 0){
			if(i != (n-1)/i)ans1.pb(i);
			ans1.pb((n-1)/i);
		}
	}
	vll ans2;
	for(int i = 2;i*i <= n;i++){
		if(n%i == 0){
			ans2.pb(i);
		}
	}
	int cnt = 1;
	for(auto k:ans2){
		int N = n;
		while(N >= k){
			if(N%k == 0){
				N /= k;
			}else{
				N %= k;
			}
		}
		if(N == 1)cnt++;
	}
	cout << cnt + ans1.size() << endl;
	// cerr << cnt << endl;
	// cerr << ans1.size() << endl;
	// cerr << ans2.size() << endl;
	// debug_vec(ans1);

	

	
	return 0;
}
/*----------------------------------------------------------------*/

// g++ -std=c++14 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2018-quala.contest.atcoder.jp/tasks/code_festival_2018_quala_c
// rm -r -f test;oj dl https://pakencamp-2019-day3.contest.atcoder.jp/tasks/pakencamp_2019_day3_c
// rm -r -f test;oj dl https://abc161.contest.atcoder.jp/tasks/abc161_a

Measured memory_bytes: 256
import sys
import time
import math
import itertools as it
def inpl():
    return list(map(int, input().split()))
st = time.perf_counter()
# ------------------------------

S = input()
ans = 0
st1 = ''
st2 = ''
for s in S:
	st2 += s
	if st2 != st1:
		ans += 1
		st1 = st2
		st2 = ''
print(ans)

# ------------------------------
ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr)


Measured memory_bytes: 9308
package main

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

//=====I/O=====

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func scanInt() int {
	sc.Scan()
	a,_ := strconv.Atoi(sc.Text())
	return a
}

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ { res[i] = scanInt() }
	return res
}

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

func printInts(a ...int) {
	for i, e := range a {
		fmt.Fprint(wr, e)
		if i != len(a)-1 { fmt.Fprint(wr, " ") }
	}
	fmt.Fprintln(wr)
	wr.Flush()
}

//=====main=====

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

	a, b, k := int64(scanInt()), int64(scanInt()), int64(scanInt())

	if a >= k {
		fmt.Println(a-k, b)
	} else {
		if a+b >= k {
			fmt.Println(0, b-k+a)
		} else {
			fmt.Println(0, 0)
		}
	}
}


Measured memory_bytes: 640