def test_read_boolean(self): reader = tc.Reader("true") flag = reader.next("boolean") self.assertEqual(flag, True) reader = tc.Reader("false") flag = reader.next("boolean") self.assertEqual(flag, False)
def test_read_string_error(self): reader = tc.Reader('"Eddard Stark') with self.assertRaises(tc.ReadError): name = reader.next("String") reader = tc.Reader('Eddard Stark"') with self.assertRaises(tc.ReadError): name = reader.next("String")
def main(): import topcoder as tc with open(sys.argv[1], "r") as fi: input = fi.read() reader = tc.Reader(input) d = reader.next("int[]") result = RandomPancakeStackDiv2.expectedDeliciousness(d) with open(sys.argv[2], "w") as fo: fo.write(tc.write(result, "double"))
def main(): import topcoder as tc with open(sys.argv[1], "r") as fi: input = fi.read() reader = tc.Reader(input) s = reader.next("String") result = Ropestring.makerope(s) with open(sys.argv[2], "w") as fo: fo.write(tc.write(result, "String"))
def main(): import topcoder as tc with open(sys.argv[1], "r") as fi: input = fi.read() reader = tc.Reader(input) ciphertext = reader.next("long") result = Hexspeak.decode(ciphertext) with open(sys.argv[2], "w") as fo: fo.write(tc.write(result, "String"))
def main(): import topcoder as tc with open(sys.argv[1], "r") as fi: input = fi.read() reader = tc.Reader(input) b = reader.next("int[]") result = DivisibleSetDiv2.isPossible(b) with open(sys.argv[2], "w") as fo: fo.write(tc.write(result, "String"))
def main(): import topcoder as tc with open(sys.argv[1], "r") as fi: input = fi.read() reader = tc.Reader(input) a = reader.next("int[]") result = PrivateD2party.getsz(a) with open(sys.argv[2], "w") as fo: fo.write(tc.write(result, "int"))
def main(): import topcoder as tc with open(sys.argv[1], "r") as fi: input = fi.read() reader = tc.Reader(input) S = reader.next("long") result = LastDigit.findX(S) with open(sys.argv[2], "w") as fo: fo.write(tc.write(result, "long"))
def main(): import topcoder as tc with open(sys.argv[1], "r") as fi: input = fi.read() reader = tc.Reader(input) floor = reader.next("String[]") result = ChessFloor.minimumChanges(floor) with open(sys.argv[2], "w") as fo: fo.write(tc.write(result, "int"))
def main(): import topcoder as tc with open(sys.argv[1], "r") as fi: input = fi.read() reader = tc.Reader(input) keys = reader.next("int[]") result = Xylophone.countKeys(keys) with open(sys.argv[2], "w") as fo: fo.write(tc.write(result, "int"))
def main(): import topcoder as tc with open(sys.argv[1], "r") as fi: input = fi.read() reader = tc.Reader(input) board = reader.next("String[]") result = XMarksTheSpot.countArea(board) with open(sys.argv[2], "w") as fo: fo.write(tc.write(result, "int"))
def main(): import topcoder as tc with open(sys.argv[1], "r") as fi: input = fi.read() reader = tc.Reader(input) s = reader.next("String") result = SquareScoresDiv2.getscore(s) with open(sys.argv[2], "w") as fo: fo.write(tc.write(result, "int"))
def main(): import topcoder as tc with open(sys.argv[1], "r") as fi: input = fi.read() reader = tc.Reader(input) x = reader.next("int[]") result = MutaliskEasy.minimalAttacks(x) with open(sys.argv[2], "w") as fo: fo.write(tc.write(result, "int"))
def main(): import topcoder as tc with open(sys.argv[1], "r") as fi: input = fi.read() reader = tc.Reader(input) w = reader.next("int[]") result = BearDartsDiv2.count(w) with open(sys.argv[2], "w") as fo: fo.write(tc.write(result, "long"))
def main(): import topcoder as tc with open(sys.argv[1], "r") as fi: input = fi.read() reader = tc.Reader(input) s = reader.next("String") result = RepeatStringEasy.maximalLength(s) with open(sys.argv[2], "w") as fo: fo.write(tc.write(result, "int"))
def main(): import topcoder as tc with open(sys.argv[1], "r") as fi: input = fi.read() reader = tc.Reader(input) board = reader.next("String[]") result = EightRooks.isCorrect(board) with open(sys.argv[2], "w") as fo: fo.write(tc.write(result, "String"))
def main(): import topcoder as tc with open(sys.argv[1], "r") as fi: input = fi.read() reader = tc.Reader(input) N = reader.next("int") result = PageNumbers.getCounts(N) with open(sys.argv[2], "w") as fo: fo.write(tc.write(result, "int[]"))
def main(): import topcoder as tc with open(sys.argv[1], "r") as fi: input = fi.read() reader = tc.Reader(input) a = reader.next("int[]") result = CombiningSlimes.maxMascots(a) with open(sys.argv[2], "w") as fo: fo.write(tc.write(result, "int"))
def main(): import topcoder as tc with open(sys.argv[1], "r") as fi: input = fi.read() reader = tc.Reader(input) name = reader.next("String") result = Initials.getInitials(name) with open(sys.argv[2], "w") as fo: fo.write(tc.write(result, "String"))
def main(): import topcoder as tc with open(sys.argv[1], "r") as fi: input = fi.read() reader = tc.Reader(input) board = reader.next("String[]") result = FallingSand.simulate(board) with open(sys.argv[2], "w") as fo: fo.write(tc.write(result, "String[]"))
def main(): import topcoder as tc with open(sys.argv[1], "r") as fi: input = fi.read() reader = tc.Reader(input) field = reader.next("String[]") result = BuildingRoads.destroyRocks(field) with open(sys.argv[2], "w") as fo: fo.write(tc.write(result, "int"))
def main(): import topcoder as tc with open(sys.argv[1], "r") as fi: input = fi.read() reader = tc.Reader(input) board = reader.next("String[]") result = BichromeBoard.ableToDraw(board) with open(sys.argv[2], "w") as fo: fo.write(tc.write(result, "String"))
def main(): import topcoder as tc with open(sys.argv[1], "r") as fi: input = fi.read() reader = tc.Reader(input) p = reader.next("int[]") reader.next() x = reader.next("int[]") result = SubtreeSum.getSum(p, x) with open(sys.argv[2], "w") as fo: fo.write(tc.write(result, "int"))
def main(): import topcoder as tc with open(sys.argv[1], "r") as fi: input = fi.read() reader = tc.Reader(input) initial = reader.next("String") reader.next() target = reader.next("String") result = ABBA.canObtain(initial, target) with open(sys.argv[2], "w") as fo: fo.write(tc.write(result, "String"))
def main(): import topcoder as tc with open(sys.argv[1], "r") as fi: input = fi.read() reader = tc.Reader(input) s = reader.next("String") reader.next() k = reader.next("int") result = Drbalance.lesscng(s, k) with open(sys.argv[2], "w") as fo: fo.write(tc.write(result, "int"))
def main(): import topcoder as tc with open(sys.argv[1], "r") as fi: input = fi.read() reader = tc.Reader(input) s = reader.next("String") reader.next() k = reader.next("int") result = CorruptedMessage.reconstructMessage(s, k) with open(sys.argv[2], "w") as fo: fo.write(tc.write(result, "String"))
def main(): import topcoder as tc with open(sys.argv[1], "r") as fi: input = fi.read() reader = tc.Reader(input) a = reader.next("int[]") reader.next() b = reader.next("int[]") result = Cdgame.rescount(a, b) with open(sys.argv[2], "w") as fo: fo.write(tc.write(result, "int"))
def main(): import topcoder as tc with open(sys.argv[1], "r") as fi: input = fi.read() reader = tc.Reader(input) s = reader.next("String") reader.next() t = reader.next("String") result = InfiniteString.equal(s, t) with open(sys.argv[2], "w") as fo: fo.write(tc.write(result, "String"))
def main(): import topcoder as tc with open(sys.argv[1], "r") as fi: input = fi.read() reader = tc.Reader(input) s = reader.next("String") reader.next() k = reader.next("int") result = Cyclemin.bestmod(s, k) with open(sys.argv[2], "w") as fo: fo.write(tc.write(result, "String"))
def main(): import topcoder as tc with open(sys.argv[1], "r") as fi: input = fi.read() reader = tc.Reader(input) h = reader.next("int[]") reader.next() s = reader.next("String[]") result = LiveConcert.maxHappiness(h, s) with open(sys.argv[2], "w") as fo: fo.write(tc.write(result, "int"))