import math, string, itertools, fractions, heapq, collections, re, array, bisect, random


class FoxAndVacation:
    def maxCities(self, total, d)¥¨¨¨:
        current = 0;
        count = 0
        for d in sorted(d):
            current += d
            if current > total:
                return count
            count += 1
        return count

# BEGIN KAWIGIEDIT TESTING
# Generated by KawigiEdit-pf 2.3.0
import sys
import time


def KawigiEdit_RunTest(testNum, p0, p1, hasAnswer, p2):
    sys.stdout.write(str("Test ") + str(testNum) + str(": [") + str(p0) + str(",") + str("{"))
    for i in range(len(p1)):
        if (i > 0):
            sys.stdout.write(str(","))

        sys.stdout.write(str(p1[i]))

    sys.stdout.write(str("}"))
    print(str("]"))
    obj = FoxAndVacation()
    startTime = time.clock()
    answer = obj.maxCities(p0, p1)
    endTime = time.clock()
    res = True
    print(str("Time: ") + str((endTime - startTime)) + str(" seconds"))
    if (hasAnswer):
        print(str("Desired answer:"))
        print(str("\t") + str(p2))

    print(str("Your answer:"))
    print(str("\t") + str(answer))
    if (hasAnswer):
        res = answer == p2

    if (not res):
        print(str("DOESN'T MATCH!!!!"))
    elif ((endTime - startTime) >= 2):
        print(str("FAIL the timeout"))
        res = False
    elif (hasAnswer):
        print(str("Match :-)"))
    else:
        print(str("OK, but is it right?"))

    print(str(""))
    return res


all_right = True
tests_disabled = False


# ----- test 0 -----
disabled = False
p0 = 5
p1 = (2, 2, 2)
p2 = 2
all_right = (disabled or KawigiEdit_RunTest(0, p0, p1, True, p2) ) and all_right
tests_disabled = tests_disabled or disabled
# ------------------

# ----- test 1 -----
disabled = False
p0 = 5
p1 = (5, 6, 1)
p2 = 1
all_right = (disabled or KawigiEdit_RunTest(1, p0, p1, True, p2) ) and all_right
tests_disabled = tests_disabled or disabled
# ------------------

# ----- test 2 -----
disabled = False
p0 = 5
p1 = (6, 6, 6)
p2 = 0
all_right = (disabled or KawigiEdit_RunTest(2, p0, p1, True, p2) ) and all_right
tests_disabled = tests_disabled or disabled
# ------------------

# ----- test 3 -----
disabled = False
p0 = 6
p1 = (1, 1, 1, 1, 1)
p2 = 5
all_right = (disabled or KawigiEdit_RunTest(3, p0, p1, True, p2) ) and all_right
tests_disabled = tests_disabled or disabled
# ------------------

# ----- test 4 -----
disabled = False
p0 = 10
p1 = (7, 1, 5, 6, 1, 3, 4)
p2 = 4
all_right = (disabled or KawigiEdit_RunTest(4, p0, p1, True, p2) ) and all_right
tests_disabled = tests_disabled or disabled
# ------------------

# ----- test 5 -----
disabled = False
p0 = 50
p1 = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)
p2 = 9
all_right = (disabled or KawigiEdit_RunTest(5, p0, p1, True, p2) ) and all_right
tests_disabled = tests_disabled or disabled
# ------------------

# ----- test 6 -----
disabled = False
p0 = 21
p1 = (14, 2, 16, 9, 9, 5, 5, 23, 25, 20, 8, 25, 6, 12, 3, 2, 4, 5, 10, 14, 19, 12, 25, 15, 14)
p2 = 6
all_right = (disabled or KawigiEdit_RunTest(6, p0, p1, True, p2) ) and all_right
tests_disabled = tests_disabled or disabled
# ------------------

if (all_right):
    if (tests_disabled):
        print(str("You're a stud (but some test cases were disabled)!"))
    else:
        print(str("You're a stud (at least on given cases)!"))

else:
    print(str("Some of the test cases had errors."))

# END KAWIGIEDIT TESTING
# Powered by KawigiEdit-pf 2.3.0!

52e068363d7be5b5f24517064265a4ce739e5654
import math, string, itertools, fractions, heapq, collections, re, array, bisect, random


class FoxAndVacation:
    def maxCities(self, total, d)¥¨¨¨:
        current = 0;
        count = 0
        for d in sorted(d):
            current += d
            if current > total:
                return count
            count += 1
        return count

# BEGIN KAWIGIEDIT TESTING
# Generated by KawigiEdit-pf 2.3.0
import sys
import time


def KawigiEdit_RunTest(testNum, p0, p1, hasAnswer, p2):
    sys.stdout.write(str("Test ") + str(testNum) + str(": [") + str(p0) + str(",") + str("{"))
    for i in range(len(p1)):
        if (i > 0):
            sys.stdout.write(str(","))

        sys.stdout.write(str(p1[i]))

    sys.stdout.write(str("}"))
    print(str("]"))
    obj = FoxAndVacation()
    startTime = time.clock()
    answer = obj.maxCities(p0, p1)
    endTime = time.clock()
    res = True
    print(str("Time: ") + str((endTime - startTime)) + str(" seconds"))
    if (hasAnswer):
        print(str("Desired answer:"))
        print(str("\t") + str(p2))

    print(str("Your answer:"))
    print(str("\t") + str(answer))
    if (hasAnswer):
        res = answer == p2

    if (not res):
        print(str("DOESN'T MATCH!!!!"))
    elif ((endTime - startTime) >= 2):
        print(str("FAIL the timeout"))
        res = False
    elif (hasAnswer):
        print(str("Match :-)"))
    else:
        print(str("OK, but is it right?"))

    print(str(""))
    return res


all_right = True
tests_disabled = False


# ----- test 0 -----
disabled = False
p0 = 5
p1 = (2, 2, 2)
p2 = 2
all_right = (disabled or KawigiEdit_RunTest(0, p0, p1, True, p2) ) and all_right
tests_disabled = tests_disabled or disabled
# ------------------

# ----- test 1 -----
disabled = False
p0 = 5
p1 = (5, 6, 1)
p2 = 1
all_right = (disabled or KawigiEdit_RunTest(1, p0, p1, True, p2) ) and all_right
tests_disabled = tests_disabled or disabled
# ------------------

# ----- test 2 -----
disabled = False
p0 = 5
p1 = (6, 6, 6)
p2 = 0
all_right = (disabled or KawigiEdit_RunTest(2, p0, p1, True, p2) ) and all_right
tests_disabled = tests_disabled or disabled
# ------------------

# ----- test 3 -----
disabled = False
p0 = 6
p1 = (1, 1, 1, 1, 1)
p2 = 5
all_right = (disabled or KawigiEdit_RunTest(3, p0, p1, True, p2) ) and all_right
tests_disabled = tests_disabled or disabled
# ------------------

# ----- test 4 -----
disabled = False
p0 = 10
p1 = (7, 1, 5, 6, 1, 3, 4)
p2 = 4
all_right = (disabled or KawigiEdit_RunTest(4, p0, p1, True, p2) ) and all_right
tests_disabled = tests_disabled or disabled
# ------------------

# ----- test 5 -----
disabled = False
p0 = 50
p1 = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)
p2 = 9
all_right = (disabled or KawigiEdit_RunTest(5, p0, p1, True, p2) ) and all_right
tests_disabled = tests_disabled or disabled
# ------------------

# ----- test 6 -----
disabled = False
p0 = 21
p1 = (14, 2, 16, 9, 9, 5, 5, 23, 25, 20, 8, 25, 6, 12, 3, 2, 4, 5, 10, 14, 19, 12, 25, 15, 14)
p2 = 6
all_right = (disabled or KawigiEdit_RunTest(6, p0, p1, True, p2) ) and all_right
tests_disabled = tests_disabled or disabled
# ------------------

if (all_right):
    if (tests_disabled):
        print(str("You're a stud (but some test cases were disabled)!"))
    else:
        print(str("You're a stud (at least on given cases)!"))

else:
    print(str("Some of the test cases had errors."))

# END KAWIGIEDIT TESTING
# Powered by KawigiEdit-pf 2.3.0!
