codeparrot/codecomplex huggingface dataset:
// Problem: 105_B. Dark Assembly
// Time complexity: np
import java.io.*;
import java.util.*;

public class B {

    int n, k, a;
    int[] b, l;

    double best;

    double calc(int i, int r, int c, double p) {
        if (i == n) {
            if (c <= n / 2) {
                p *= 1.0 * a / (a + r);
            }
            return p;
        } else {
            return calc(i + 1, r, c + 1, p * l[i] / 10.0) + calc(i + 1, r + b[i], c, p * (10 - l[i]) / 10.0);
        }
    }

    void go(int i, int k) {
        if (i == n) {
            double p = calc(0, 0, 0, 1.0);
            if (p > best) best = p;
        } else {
            for (int c = 0; c <= k && l[i] + c <= 10; ++c) {
                l[i] += c;
                go(i + 1, k - c);
                l[i] -= c;
            }
        }
    }

    void solve() throws IOException {
        in("__std"); out("__std");

        n = readInt();
        k = readInt();
        a = readInt();
        b = new int[n];
        l = new int[n];
        for (int i = 0; i < n; ++i) {
            b[i] = readInt();
            l[i] = readInt() / 10;
        }

        go(0, k);

        println("%.10f", best);

        exit();
    }

    void in(String name) throws IOException {
        if (name.equals("__std")) {
            in = new BufferedReader(new InputStreamReader(System.in));
        } else {
            in = new BufferedReader(new FileReader(name));
        }
    }

    void out(String name) throws IOException {
        if (name.equals("__std")) {
            out = new PrintWriter(System.out);
        } else {
            out = new PrintWriter(name);
        }
    }

    void exit() {
        out.close();
        System.exit(0);
    }

    int readInt() throws IOException {
        return Integer.parseInt(readToken());
    }

    long readLong() throws IOException {
        return Long.parseLong(readToken());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readToken());
    }

    String readLine() throws IOException {
        st = null;
        return in.readLine();
    }

    String readToken() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

    boolean eof() throws IOException {
        return !in.ready();
    }

    void print(String format, Object ... args) {
        out.println(new Formatter().format(format, args));
    }

    void println(String format, Object ... args) {
        out.println(new Formatter().format(format, args));
    }

    void print(Object value) {
        out.print(value);
    }

    void println(Object value) {
        out.println(value);
    }

    void println() {
        out.println();
    }

    StringTokenizer st;

    BufferedReader in;
    PrintWriter out;

    public static void main(String[] args) throws IOException {
        new B().solve();
    }
}
// Problem: 105_B. Dark Assembly
// Time complexity: np
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.Arrays;
import java.util.Comparator;

public class Main {
	private static StreamTokenizer in;
	private static PrintWriter out;
	static {
		in = new StreamTokenizer(new BufferedReader(new InputStreamReader(
				System.in)));
		out = new PrintWriter(System.out);
	}

	private static int nextInt() throws Exception {
		in.nextToken();
		return (int) in.nval;
	}

	private static double nextDouble() throws Exception {
		in.nextToken();
		return in.nval;
	}

	private static String nextString() throws Exception {
		in.nextToken();
		return in.sval;
	}

	public static void main(String[] args) throws Exception {
		int n = nextInt(), k = nextInt(), A = nextInt(), r = n + k - 1;
		int[][] s = new int[n][];
		for (int i = 0; i < n; i++) {
			s[i] = new int[] { nextInt(), nextInt() };
		}
		double max = 0;
		int[] prb = new int[n];
		for (int u = (1 << r); u >= 0; u--) {
			// проверим на n-1 единичек
			int ones = 0;
			for (int i = 0; i < r; i++) {
				if ((u & (1 << i)) != 0) {
					ones++;
				}
			}
			if (ones != n - 1) {
				continue;
			}
			// проверили. расставляем массив
			ones = 0;
			int p = 0;
			for (int i = 0; i < r; i++) {
				if ((u & (1 << i)) == 0) {
					ones++;
				} else {
					prb[p] = ones * 10;
					p++;
					ones = 0;
				}
			}
			prb[p] = ones * 10;
			p++;
			ones = 0;
			double sum = 0;
			for (int i = 0; i < n; i++) {
				if (prb[i] > 100 - s[i][1])
					prb[i] = 100 - s[i][1];
				s[i][1] = prb[i] + s[i][1];
			}
			for (int i = (1 << n) - 1; i >= 0; i--) {
				double prob = 1;
				int lvl = 0;
				int kill = 0;
				for (int j = 0; j < n; j++) {
					if ((i & (1 << j)) != 0) {
						prob *= s[j][1] / 100.0;
						kill--;
					} else {
						lvl += s[j][0];
						prob *= (1 - s[j][1] / 100.0);
						kill++;
					}
				}
				if (kill >= 0) {
					sum += prob * ((double) A / (A + lvl));
				} else {
					sum += prob;
				}
			}
			for (int i = 0; i < n; i++) {
				s[i][1] = -prb[i] + s[i][1];
			}
			max = Math.max(max, sum);
		}
		out.println(max);
		out.flush();
	}
}
// Problem: 105_B. Dark Assembly
// Time complexity: np
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;


public class ProblemB {
	public static int _gnum;
	public static int _cnum;
	public static int _needs;
	public static int _level;
	
	public static double _maxans = 0;
	
	public static double votedfs(int[][] grl, int g, int votes) {
		if (votes >= _needs) {
			return 1.0d;
		}
		if (g >= _gnum) {
			return 0.0d;
		}
		double agrees = (double)grl[g][1] / 100;
		return agrees * votedfs(grl, g+1, votes+1) + (1.0d - agrees) * votedfs(grl, g+1, votes);
	}
	
	public static double battledfs(int[][] grl, int g, int votes, int levels) {
		if (votes >= _needs) {
			return 0.0d;
		}
		if (g >= _gnum) {
			return (double)_level / (_level + levels);
		}
		double agrees = (double)grl[g][1] / 100;
		return agrees * battledfs(grl, g+1, votes+1, levels) + (1.0d - agrees) * battledfs(grl, g+1, votes, levels + grl[g][0]);
	}
	
	public static void candydfs(int[][] grl, int g, int n) {
		if (g >= _gnum) {
			double na = votedfs(grl, 0, 0) + battledfs(grl, 0, 0, 0);
			_maxans = Math.max(_maxans, na);
			return;
		}
		
		int rem = grl[g][1];
		candydfs(grl, g+1, n);
		for (int i = 1 ; i <= n ; i++) {
			if (grl[g][1] < 100) {
				grl[g][1] += 10;
				candydfs(grl, g+1, n-i);
			}
		}
		grl[g][1] = rem;
	}
	
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        String[] d = line.split(" ");
        int gnum = Integer.valueOf(d[0]);
        int cnum = Integer.valueOf(d[1]);
        int level = Integer.valueOf(d[2]);
        _gnum = gnum;
        _cnum = cnum;
        _needs = (gnum + 1) / 2;
        if (gnum % 2 == 0) {
        	_needs += 1;
        }
        _level = level;
        
        int[][] grl = new int[gnum][2];
        for (int g = 0 ; g < gnum ; g++) {
        	line = br.readLine();
        	String[] gg = line.split(" ");
        	grl[g][0] = Integer.valueOf(gg[0]);
        	grl[g][1] = Integer.valueOf(gg[1]);
        }
        
        for (int a = 0 ; a < gnum ; a++) {
            for (int b = 0 ; b < gnum - 1 ; b++) {
            	if (grl[b][1] < grl[b+1][1]) {
            		int tmp = grl[b][0];
            		grl[b][0] = grl[b+1][0];
            		grl[b+1][0] = tmp;
            		tmp = grl[b][1];
            		grl[b][1] = grl[b+1][1];
            		grl[b+1][1] = tmp;
            	}
            } 	
        }
        
        int ag = 0;
        int xnum = cnum;
        for (int g = 0 ; g < gnum ; g++) {
        	int needs = (100 - grl[g][1]) / 10;
        	int roy = 0;
        	if (needs <= xnum) {
        		xnum -= needs;
        		roy = 100;
        	} else {
        		roy = grl[g][1] + xnum * 10;
        		xnum = 0;
        	}
        	if (roy >= 100) {
        		ag++;
        	}
        }
        if (ag >= _needs) {
        	System.out.println(1.0);
        	return;
        }
        
        candydfs(grl, 0, _cnum);
        
        System.out.println(_maxans);
        br.close();
	}
}
// Problem: 105_B. Dark Assembly
// Time complexity: np
import java.io.*;
import java.util.*;

public class TemnayaAssambleya implements Runnable {
	public static void main(String[] args) {
		new Thread(new TemnayaAssambleya()).run();
	}

	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	StringTokenizer in;
	PrintWriter out = new PrintWriter(System.out);

	public String nextToken() throws IOException {
		while (in == null || !in.hasMoreTokens()) {
			in = new StringTokenizer(br.readLine());
		}

		return in.nextToken();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

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

	int[] l;
	int[] ln;
	int[] pw;
	int[] p;
	int A;
	double max = 0;

	public void gen(int n, int k) {
		if (n == 0) {
			n = p.length;
			p[0] = k;
			for (int i = 0; i < n; i++) {
				ln[i] = l[i] + p[i] * 10;
				if (ln[i] > 100)
					ln[i] = 100;
			}

			double ans = 0;
			for (int mask = 0; mask < 1 << n; mask++) {
				int z = 0;
				double pos = 1;
				int power = 0;
				for (int i = 0; i < n; i++) {
					if ((mask & (1 << i)) > 0) {
						z++;
						pos *= ln[i] * 1. / 100;
					} else {
						pos *= (100 - ln[i]) * 1. / 100;
						power += pw[i];
					}
				}

				if (z > n / 2) {
					ans += pos;
				} else {
					ans += pos * A / (A + power);
				}
			}
			
			max = Math.max(ans, max);
			return;
		}

		for (int i = 0; i <= Math.min(k, 10 - l[n] / 10); i++) {
			p[n] = i;
			gen(n - 1, k - i);
		}
	}

	public void solve() throws IOException {
		int n = nextInt();
		int k = nextInt();
		A = nextInt();

		p = new int[n];
		pw = new int[n];
		l = new int[n];
		ln = new int[n];

		for (int i = 0; i < n; i++) {
			pw[i] = nextInt();
			l[i] = nextInt();
		}

		gen(n - 1, k);
		out.println(max);
	}

	public void run() {
		try {
			solve();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
}
// Problem: 105_B. Dark Assembly
// Time complexity: np
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;

public class B implements Runnable {

    int a;
    int[] b;
    int[] l;

    public void solve() throws IOException {
        int n = in.nextInt();
        int k = in.nextInt();
        a = in.nextInt();
        b = new int[n];
        l = new int[n];
        for ( int i = 0; i < n; i ++ ) {
            b[i] = in.nextInt();
            l[i] = in.nextInt();
        }
        out.println( best( 0, k ));
    }

    double best( int cur, int left ) {
        double r = 0.0;
        if ( cur < l.length ) {
            for ( int i = 0; i <= left && l[cur] + 10 * i <= 100; i ++ ) {
                l[cur] += i * 10;
                r = Math.max( r, best( cur + 1, left - i ) );
                l[cur] -= i * 10;
            }
        } else {
            for ( int m = 0; m < ( 1 << l.length ); m ++ ) {
                int sum = 0;
                double p = 1.0;
                int pro = 0;
                for ( int i = 0; i < l.length; i ++ ) {
                    if ( ( m & ( 1 << i ) ) == 0 ) {
                        p *= 1.0 - l[i] * 0.01;
                        sum += b[i];
                    } else {
                        p *= l[i] * 0.01;
                        pro ++;
                    }
                }
                if ( pro * 2 > l.length ) {
                    r += p;
                } else {
                    r += ( p * a ) / ( a + sum );
                }
            }
        }
        return r;
    }

    public Scanner in;

    public PrintWriter out;

    B() throws IOException {
        in = new Scanner(System.in);
        // in = new StreamTokenizer( new InputStreamReader( System.in ) );
        out = new PrintWriter(System.out);
    }

//    int nextInt() throws IOException {
//        in.nextToken();
//        return ( int ) in.nval;
//    }

    void check(boolean f, String msg) {
        if (!f) {
            out.close();
            throw new RuntimeException(msg);
        }
    }

    void close() throws IOException {
        out.close();
    }

    public void run() {
        try {
            solve();
            close();
        } catch (Exception e) {
            e.printStackTrace(out);
            out.flush();
            throw new RuntimeException(e);
        }
    }

    public static void main(String[] args) throws IOException {
        new Thread(new B()).start();
    }
}
// Problem: 105_B. Dark Assembly
// Time complexity: np


import java.util.Scanner;

public class B {
    static int n;
    static double A;
    static int[] L;
    static int[] B;
    static double max = 0;

    public static void rec(int index, int k) {
        if (k < 0)
            return;
        if (index == n) {
            double prob = 0;
            for (int i = 0; i < (1 << n); i++) {
                double b = 0;
                double temp = 1.0;
                for (int j = 0; j < n; j++) {
                    if (L[j] > 100)
                        return;
                    if ((i & (1 << j)) == 0) {
                        b += B[j];
                        temp *= (100 - L[j]) / 100.0;
                    } else
                        temp *= L[j] / 100.0;
                }
                if (Integer.bitCount(i) * 2 <= n)
                    temp *= A / (A + b);
                prob += temp;

            }
            max = Math.max(max, prob);
            return;
        }
        L[index] += 10;
        rec(index, k - 1);
        L[index] -= 10;
        rec(index + 1, k);
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        int k = in.nextInt();
        A = in.nextDouble();
        B = new int[n];
        L = new int[n];
        for (int i = 0; i < n; i++) {
            B[i] = in.nextInt();
            L[i] = in.nextInt();
        }
        rec(0, k);
        System.out.println(max);
    }
}
// Problem: 105_B. Dark Assembly
// Time complexity: np
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Locale;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.Map.Entry;

public class Solution implements Runnable {

	public static void main(String[] args) {
		(new Thread(new Solution())).start();
	}
	
	BufferedReader in;
	PrintWriter out;
	StringTokenizer st;
	
	String nextToken() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			String r = in.readLine();
			if (r == null) return null;
			st = new StringTokenizer(r);
		}
		return st.nextToken();
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
	
	int n;
	int[] b, l;
	double ans;
	int[] sw;
	int a;
	
	void sol() {
		for (int i = 0; i < n; i++) l[i] += sw[i] * 10;
		double yes = 0;
		for (int q = 0; q < (1 << n); q++) {
			double p = 1;
			int bb = 0;
			int cnt = 0;
			for (int i = 0; i < n; i++) {
				if ((q & (1 << i)) == 0) {
					p *= (1.0 - (double)l[i] / 100);
					bb += b[i];
				} else {
					p *= 1.0 * (double)l[i] / 100;
					cnt++;
				}
			}
			if (cnt > n / 2) {
				yes += p;
			} else {
				yes += p * (double)a / (double)(a + bb); 
			}
		}
		if (ans < yes) ans = yes;
		for (int i = 0; i < n; i++) l[i] -= sw[i] * 10;
	}
	
	void rek(int i, int k) {
		if (i == n) sol(); else {
			for (int q = 0; q <= k && l[i] + q * 10 <= 100; q++) {
				sw[i] = q;
				rek(i + 1, k - q);
			}
		}
	}
	
	void solve() throws Exception {
		n = nextInt();
		int k = nextInt();
		a = nextInt();
		b = new int[n];
		l = new int[n];
		sw = new int[n];
		for (int i = 0; i < n; i++) {
			b[i] = nextInt();
			l[i] = nextInt();
		}
		rek(0, k);
		out.printf("%.10f", ans);
	}

	public void run() {
		Locale.setDefault(Locale.UK);
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
//			in = new BufferedReader(new FileReader("knights.in"));
//			out = new PrintWriter("knights.out");
			solve();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		} finally {
			out.flush();
		}
	}

}
// Problem: 105_B. Dark Assembly
// Time complexity: np
import java.io.*;
import java.util.*;

public class B {

    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;
    
    int[] level;
    int[] loyal;
    double ans;
    int n, k, plLev, needVotes;
    
    double check() {
        
        //System.err.println(Arrays.toString(loyal));
        double res = 0;
        for (int mask = 0; mask < (1 << n); mask++) {
            double prob = 1;
            int vote = 0;
            int kill = 0;
            for (int i = 0; i < n; i++) 
                if (((mask >> i) & 1) == 1) {
                    prob *= loyal[i] / 100.0;
                    vote++;
                }
                else {
                    prob *= 1 - loyal[i] / 100.0;
                    kill += level[i];
                }
            if (vote >= needVotes)
                res += prob;
            else
                res += prob * plLev / (kill + plLev);
        }
        
        return res;
    }
    
    void go(int ind, int candy) {
        if (ind == n) {
            ans = Math.max(ans, check());
            return;
        }
        
        for (int i = 0; i <= candy; i++) {
            loyal[ind] += 10 * i;
            if (loyal[ind] > 100) {
                loyal[ind] -= 10 * i;
                break;
            }
            go(ind + 1, candy - i);
            loyal[ind] -= 10 * i;
        }
        
    }
    

    void solve() throws IOException {
        
        n = nextInt();
        k = nextInt();
        plLev = nextInt();
        needVotes = n / 2 + 1;
        ans = 0;
        
        level = new int[n];
        loyal = new int[n];
        
        for (int i = 0; i < n; i++) {
            level[i] = nextInt();
            loyal[i] = nextInt();
        }
        
        go(0, k);
        
        out.printf("%.12f", ans);
    }

    void inp() throws IOException {
        Locale.setDefault(Locale.US);
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

    public static void main(String[] args) throws IOException {
        new B().inp();
    }

    String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return "0";
            }
        }
        return st.nextToken();
    }

    String nextString() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return "0";
            }
        }
        return st.nextToken("\n");
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

}
// Problem: 105_B. Dark Assembly
// Time complexity: np
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class B{
    public static void main(String[] args) throws Exception{
        new B().run();
    }

    double ans = 0;
    int n, candy, A, half;

    void run() throws Exception{
        Scanner sc = new Scanner(System.in);
        //BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
        // only sc.readLine() is available
        n = sc.nextInt();
        candy = sc.nextInt();
        A = sc.nextInt();
        half = n/2;
        //int[] level = new int[n];
        //int[] loyal = new int[n];
        S[] ss = new S[n];
        for(int i = 0; i < n; i++){
            ss[i] = new S(sc.nextInt(), sc.nextInt());
        }
        Arrays.sort(ss);
        int need = 0;
        for(int i = n-1; i >= n-half-1; i--)
            need += (100-ss[i].loyal)/10;
        if(need <= candy){
            System.out.println(1.0);
            return;
        }
        tra(ss, 0, candy);
        /*
        while(candy > 0){
            int ind = 0;
            for(int i = 1; i < n; i++)
                if(ss[i].loyal < 100 && ss[ind].level < ss[i].level)
                    ind = i;
            ss[ind].loyal += 10;
            ss[ind].loyal = min(100, ss[ind].loyal);
            candy--;
        }
        */
        System.out.printf("%.10f\n", ans);
    }

    void tra(S[] ss, int pos, int rest){
        if(pos == n){
            double sum = 0;
            int lim = 1<<n;
            for(int m = 0; m < lim; m++){
                int app = Integer.bitCount(m);
                double p = 1;
                int B = 0;
                for(int i = 0; i < n; i++){
                    if(((m>>i) & 1) == 1){
                        p = p * ss[i].loyal / 100;
                    }else{
                        p = p * (100 - ss[i].loyal) / 100;
                        B += ss[i].level;
                    }
                }
                if(app > half)sum += p;
                else{
                    sum += p * A / (A+B);
                }
            }
            ans = max(ans, sum);
            return;
        }
        for(int i = 0; i <= rest; i++){
            int old = ss[pos].loyal;
            int nl = ss[pos].loyal + i * 10;
            if(nl > 100)break;
            ss[pos].loyal = nl;
            tra(ss, pos+1, rest-i);
            ss[pos].loyal = old;
        }
    }
}

class S implements Comparable<S>{
    int level, loyal;
    S(int a, int b){
        level = a;
        loyal = b;
    }
    public int compareTo(S s){
        return this.loyal - s.loyal;
    }
}