content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
print("Enter the name of the file along with it's extension:-") a=str(input()) if('.py' in a): print("The extension of the file is : python") else: print("The extension of the file is not python")
print("Enter the name of the file along with it's extension:-") a = str(input()) if '.py' in a: print('The extension of the file is : python') else: print('The extension of the file is not python')
# -*- coding: utf-8 -*- # (C) Wu Dong, 2018 # All rights reserved __author__ = 'Wu Dong <[email protected]>' __time__ = '2018/9/6 11:07'
__author__ = 'Wu Dong <[email protected]>' __time__ = '2018/9/6 11:07'
# ABC167B - Easy Linear Programming def main(): # input A, B, C, K = map(int, input().split()) # compute kotae = A+(K-A)*0-(K-A-B) # output print(kotae) if __name__ == '__main__': main()
def main(): (a, b, c, k) = map(int, input().split()) kotae = A + (K - A) * 0 - (K - A - B) print(kotae) if __name__ == '__main__': main()
def lin(): print('-'*20) lin() def msg(m): lin() print(m) lin() msg('SISTEMA') def s(a,b): print(a+b) s(2,3) def cont(*num): for v in num: print(v,end=' ') print('\nfim') cont(2,3,7) def dobra(lst): pos = 0 while pos < len(lst): lst[pos] *= 2 pos += 1 valores = [6,4,5,8,2,7] dobra(valores) print(valores) def soma(*val): s = 0 for num in val: s += num print(s) soma(3,6,4)
def lin(): print('-' * 20) lin() def msg(m): lin() print(m) lin() msg('SISTEMA') def s(a, b): print(a + b) s(2, 3) def cont(*num): for v in num: print(v, end=' ') print('\nfim') cont(2, 3, 7) def dobra(lst): pos = 0 while pos < len(lst): lst[pos] *= 2 pos += 1 valores = [6, 4, 5, 8, 2, 7] dobra(valores) print(valores) def soma(*val): s = 0 for num in val: s += num print(s) soma(3, 6, 4)
inst = set() with open('tools/write_bytecode.py') as file: for line in file: if line.strip().startswith('#'): continue if '$' in line: instruction = line.split('$')[1].strip() print(instruction) inst.add(instruction.split()[0].strip().replace('32', '').replace('64', '')) # print(len(inst)) # print((inst))
inst = set() with open('tools/write_bytecode.py') as file: for line in file: if line.strip().startswith('#'): continue if '$' in line: instruction = line.split('$')[1].strip() print(instruction) inst.add(instruction.split()[0].strip().replace('32', '').replace('64', ''))
################################################################ # compareTools.py # # Defines how nodes and edges are compared. # Usable by other packages such as smallGraph # # Author: H. Mouchere, Oct. 2013 # Copyright (c) 2013-2014 Richard Zanibbi and Harold Mouchere ################################################################ def generateListErr(ab,ba): listErr = [] if len(ab) == 0: ab = ['_'] if len(ba) == 0: ba = ['_'] for c1 in ab: for c2 in ba: listErr.append((c1,c2)) return listErr def defaultMetric(labelList1, labelList2): #new way but with 1 label per node diff = set(labelList1) ^ (set(labelList2)) # symetric diff if len(diff) == 0: return (0,[]) else: ab = diff&set(labelList1) ba = diff&set(labelList2) cost = max(len(ab),len(ba) ) return (cost,generateListErr(ab,ba)) synonym = {'X':'x','\\times':'x', 'P':'p', 'O':'o','C':'c', '\\prime':'COMMA'} def synonymMetric(labelList1, labelList2): def replace(x): if x in synonym.keys(): return synonym[x] else: return x a = map(replace, labelList1) b = map(replace, labelList2) diff = set(a) ^ (set(b)) # symetric diff if len(diff) == 0: return (0,[]) else: ab = diff&set(a) ba = diff&set(b) cost = max(len(ab),len(ba) ) return (cost,generateListErr(ab,ba)) ignoredLabelSet = set([]) selectedLabelSet = set([]) def filteredMetric(labelList1, labelList2): labelS1 = set(labelList1) - ignoredLabelSet # removing the ignored labels labelS2 = set(labelList2) - ignoredLabelSet # removing the ignored labels if len(selectedLabelSet) > 0: labelS1 &= selectedLabelSet # keep only the selected labels labelS2 &= selectedLabelSet # keep only the selected labels return defaultMetric(labelS1,labelS2) # no error if at least one symbol is OK def intersectMetric(labelList1, labelList2): #new way but with 1 label per node inter = set(labelList1) & (set(labelList2)) # symetric diff if len(inter) > 0: return (0,[]) else: ab = set(labelList1)-inter ba = set(labelList2)-inter return (1,generateListErr(ab,ba)) cmpNodes = defaultMetric cmpEdges = defaultMetric
def generate_list_err(ab, ba): list_err = [] if len(ab) == 0: ab = ['_'] if len(ba) == 0: ba = ['_'] for c1 in ab: for c2 in ba: listErr.append((c1, c2)) return listErr def default_metric(labelList1, labelList2): diff = set(labelList1) ^ set(labelList2) if len(diff) == 0: return (0, []) else: ab = diff & set(labelList1) ba = diff & set(labelList2) cost = max(len(ab), len(ba)) return (cost, generate_list_err(ab, ba)) synonym = {'X': 'x', '\\times': 'x', 'P': 'p', 'O': 'o', 'C': 'c', '\\prime': 'COMMA'} def synonym_metric(labelList1, labelList2): def replace(x): if x in synonym.keys(): return synonym[x] else: return x a = map(replace, labelList1) b = map(replace, labelList2) diff = set(a) ^ set(b) if len(diff) == 0: return (0, []) else: ab = diff & set(a) ba = diff & set(b) cost = max(len(ab), len(ba)) return (cost, generate_list_err(ab, ba)) ignored_label_set = set([]) selected_label_set = set([]) def filtered_metric(labelList1, labelList2): label_s1 = set(labelList1) - ignoredLabelSet label_s2 = set(labelList2) - ignoredLabelSet if len(selectedLabelSet) > 0: label_s1 &= selectedLabelSet label_s2 &= selectedLabelSet return default_metric(labelS1, labelS2) def intersect_metric(labelList1, labelList2): inter = set(labelList1) & set(labelList2) if len(inter) > 0: return (0, []) else: ab = set(labelList1) - inter ba = set(labelList2) - inter return (1, generate_list_err(ab, ba)) cmp_nodes = defaultMetric cmp_edges = defaultMetric
# -*- coding: utf-8 -*- def main(): n = int(input()) s = list() t = list() for i in range(n): si, ti = map(str, input().split()) s.append(si) t.append(int(ti)) x = input() index = s.index(x) print(sum(t[index + 1:])) if __name__ == '__main__': main()
def main(): n = int(input()) s = list() t = list() for i in range(n): (si, ti) = map(str, input().split()) s.append(si) t.append(int(ti)) x = input() index = s.index(x) print(sum(t[index + 1:])) if __name__ == '__main__': main()
### Alternating Characters - Solution def alternatingCharacters(): q = int(input()) while q: s = input() del_count = 0 for i in range(len(s)-1): if s[i] == s[i+1]: del_count += 1 print(del_count) q -= 1 alternatingCharacters()
def alternating_characters(): q = int(input()) while q: s = input() del_count = 0 for i in range(len(s) - 1): if s[i] == s[i + 1]: del_count += 1 print(del_count) q -= 1 alternating_characters()
class FileWarning(Exception): def __init__(self, file, message, *args, **kwargs): file.warn(message, *args, **kwargs) super().__init__(message % args) class FileError(Exception): def __init__(self, file, message, *args, **kwargs): file.error(message, *args, **kwargs) super().__init__(message % args) class FileCritical(Exception): def __init__(self, file, message, *args, **kwargs): file.critical(message, *args, **kwargs) super().__init__(message % args)
class Filewarning(Exception): def __init__(self, file, message, *args, **kwargs): file.warn(message, *args, **kwargs) super().__init__(message % args) class Fileerror(Exception): def __init__(self, file, message, *args, **kwargs): file.error(message, *args, **kwargs) super().__init__(message % args) class Filecritical(Exception): def __init__(self, file, message, *args, **kwargs): file.critical(message, *args, **kwargs) super().__init__(message % args)
class RenderedView(object): def __init__(self, view_file: str, data): self.view_file = view_file self.data = data
class Renderedview(object): def __init__(self, view_file: str, data): self.view_file = view_file self.data = data
# PART 1 def game_of_cups(starting_sequence,num_of_moves,min_cup=None,max_cup=None): # create a "linked list" dict cups = { starting_sequence[i] : starting_sequence[i+1] for i in range(len(starting_sequence)-1) } cups[starting_sequence[-1]] = starting_sequence[0] # current_cup = starting_sequence[0] max_cup = max_cup or max(starting_sequence) min_cup = min_cup or min(starting_sequence) for _ in range(num_of_moves): # cups to move are 3 ones after the current cups_to_move = ( first := cups[current_cup], second := cups[first], third := cups[second] ) # selects next current cup next_current_cup = cups[third] # destination is 1 less than current # if it's in the next 3 cups, it's 1 less than that, etc. # if it gets less than min, it loops back to max destination = current_cup - 1 while destination in cups_to_move or destination<min_cup: destination -= 1 if destination<min_cup: destination = max_cup # moves 3 cups after destination # by relinking destination to 1st cup # & third cup to cup after destination cup_after_destination = cups[destination] cups[destination] = first cups[third] = cup_after_destination # relinks current cup to next current cup cups[current_cup] = next_current_cup current_cup = next_current_cup return cups def collect_result(cups_dict): output_string = "" next_cup = cups_dict[1] while next_cup!=1: output_string += str(next_cup) next_cup = cups_dict[next_cup] return output_string # PART 2 def hyper_game_of_cups(starting_sequence): min_cup = min(starting_sequence) max_cup = max(starting_sequence) filled_starting_sequence = starting_sequence + list(range(max_cup+1,1_000_000+1)) return game_of_cups(filled_starting_sequence,10_000_000,min_cup,1_000_000) def hyper_collect_result(cups_dict): first = cups_dict[1] second = cups_dict[first] return first * second
def game_of_cups(starting_sequence, num_of_moves, min_cup=None, max_cup=None): cups = {starting_sequence[i]: starting_sequence[i + 1] for i in range(len(starting_sequence) - 1)} cups[starting_sequence[-1]] = starting_sequence[0] current_cup = starting_sequence[0] max_cup = max_cup or max(starting_sequence) min_cup = min_cup or min(starting_sequence) for _ in range(num_of_moves): cups_to_move = ((first := cups[current_cup]), (second := cups[first]), (third := cups[second])) next_current_cup = cups[third] destination = current_cup - 1 while destination in cups_to_move or destination < min_cup: destination -= 1 if destination < min_cup: destination = max_cup cup_after_destination = cups[destination] cups[destination] = first cups[third] = cup_after_destination cups[current_cup] = next_current_cup current_cup = next_current_cup return cups def collect_result(cups_dict): output_string = '' next_cup = cups_dict[1] while next_cup != 1: output_string += str(next_cup) next_cup = cups_dict[next_cup] return output_string def hyper_game_of_cups(starting_sequence): min_cup = min(starting_sequence) max_cup = max(starting_sequence) filled_starting_sequence = starting_sequence + list(range(max_cup + 1, 1000000 + 1)) return game_of_cups(filled_starting_sequence, 10000000, min_cup, 1000000) def hyper_collect_result(cups_dict): first = cups_dict[1] second = cups_dict[first] return first * second
txt = 'asdf;lkajsdf,as;lfkja' for i in txt: txt = txt[1:] if i == ",": break print(txt)
txt = 'asdf;lkajsdf,as;lfkja' for i in txt: txt = txt[1:] if i == ',': break print(txt)
class HashTable: def __init__(self): self.size = 11 self.slots = [None] * self.size self.data = [None] * self.size def put(self, key, data): hashvalue = self.hashfunction(key, len(self.slots)) if self.slots[hashvalue] == None: self.slots[hashvalue] = key self.data[hashvalue] = data else: if self.slots[hashvalue] == key: self.data[hashvalue] = data # replace else: nextslot = self.rehash(hashvalue, len(self.slots)) while self.slots[nextslot] != None and self.slots[nextslot] != key: naxtslot = self.rehash(hashvalue, len(self.slots)) if self.slots[nextslot] == None: self.slots[nextslot] = key self.data[nextslot] = data else: self.data[nextslot] = data #replace def hashfunction(self, key, size): return key%size def rehash(self, oldhash, size): return (oldhash+1)%size def get(self, key): startslot = self.hashfunction(key, len(self.slots)) found = False stop = False data = None while self.slots[startslot] != None and not found and not stop: if self.slots[startslot] == key: found = True data = self.data[startslot] else: position = self.rehash(startslot, len(self.size)) if self.slots[startslot] == self.slots[position]: stop = True return data def __getitem__(self, key): return self.get(key) def __setitem__(self, key, data): return self.put(key, data) if __name__ == "__main__": H = HashTable() H[12] = 'Dasha' print(H[12], 'H') print(H)
class Hashtable: def __init__(self): self.size = 11 self.slots = [None] * self.size self.data = [None] * self.size def put(self, key, data): hashvalue = self.hashfunction(key, len(self.slots)) if self.slots[hashvalue] == None: self.slots[hashvalue] = key self.data[hashvalue] = data elif self.slots[hashvalue] == key: self.data[hashvalue] = data else: nextslot = self.rehash(hashvalue, len(self.slots)) while self.slots[nextslot] != None and self.slots[nextslot] != key: naxtslot = self.rehash(hashvalue, len(self.slots)) if self.slots[nextslot] == None: self.slots[nextslot] = key self.data[nextslot] = data else: self.data[nextslot] = data def hashfunction(self, key, size): return key % size def rehash(self, oldhash, size): return (oldhash + 1) % size def get(self, key): startslot = self.hashfunction(key, len(self.slots)) found = False stop = False data = None while self.slots[startslot] != None and (not found) and (not stop): if self.slots[startslot] == key: found = True data = self.data[startslot] else: position = self.rehash(startslot, len(self.size)) if self.slots[startslot] == self.slots[position]: stop = True return data def __getitem__(self, key): return self.get(key) def __setitem__(self, key, data): return self.put(key, data) if __name__ == '__main__': h = hash_table() H[12] = 'Dasha' print(H[12], 'H') print(H)
description = 'Email and SMS notifiers' group = 'lowlevel' devices = dict( email = device('nicos.devices.notifiers.Mailer', mailserver = 'mailhost.frm2.tum.de', sender = '[email protected]', copies = [ ('[email protected]', 'all'), ('[email protected]', 'all'), ('[email protected]', 'all'), ('[email protected]', 'all'), ], subject = '[KWS-1]', ), smser = device('nicos.devices.notifiers.SMSer', server = 'triton.admin.frm2', receivers = [], ), )
description = 'Email and SMS notifiers' group = 'lowlevel' devices = dict(email=device('nicos.devices.notifiers.Mailer', mailserver='mailhost.frm2.tum.de', sender='[email protected]', copies=[('[email protected]', 'all'), ('[email protected]', 'all'), ('[email protected]', 'all'), ('[email protected]', 'all')], subject='[KWS-1]'), smser=device('nicos.devices.notifiers.SMSer', server='triton.admin.frm2', receivers=[]))
print("Welcome to the rollercoaster!") height = int(input("What is your height in cm? ")) if height > 120: print("you can ride the rollercoaster!") age = int(input("What is your age? ")) if age <= 18: print("$7") else: print("$12") else: print("no")
print('Welcome to the rollercoaster!') height = int(input('What is your height in cm? ')) if height > 120: print('you can ride the rollercoaster!') age = int(input('What is your age? ')) if age <= 18: print('$7') else: print('$12') else: print('no')
# "Config.py" # - config file for ConfigGUI.py # This is Python, therefore this is a comment # NOTE: variable names cannot start with '__' ECGColumn = True HRColumn = False PeakColumn = True RRColumn = True SeparateECGFile = True TCP_Host = "localhost" TCP_Port = 1000 TCPtimeout = 3 TimeColumn = True UDPConnectTimeout = 1 UDPReceiveTimeout = 5 UDP_ClientIP = "localhost" UDP_ClientPort = 1001 UDP_ServerIP = "localhost" UDP_ServerPort = 1003 UDPtimeout = 1 askConfirm = False askSend = False clientAskConfirm = False debugPrinter = True debugRepetitions = False debugRun = False filePath = "F:/Project/mwilson/Code/ECG_soft/RTHRV_Faros/LSL_tests/WILMA_Rest3_Game3_Rest3_run64_2016_05_26__14_54_45_#ECG.txt" hexDebugPrinter = False ignoreTCP = True liveWindowTime = 3 noNetwork = True noPlot = False plot_rate = 10 procWindowTime = 3 processing_rate = 5 rate = 64 recDebugPrinter = False runName = "WILMA" simpleSTOP = False valDebugPrinter = True writeOutput = True write_header = True write_type = "txt"
ecg_column = True hr_column = False peak_column = True rr_column = True separate_ecg_file = True tcp__host = 'localhost' tcp__port = 1000 tc_ptimeout = 3 time_column = True udp_connect_timeout = 1 udp_receive_timeout = 5 udp__client_ip = 'localhost' udp__client_port = 1001 udp__server_ip = 'localhost' udp__server_port = 1003 ud_ptimeout = 1 ask_confirm = False ask_send = False client_ask_confirm = False debug_printer = True debug_repetitions = False debug_run = False file_path = 'F:/Project/mwilson/Code/ECG_soft/RTHRV_Faros/LSL_tests/WILMA_Rest3_Game3_Rest3_run64_2016_05_26__14_54_45_#ECG.txt' hex_debug_printer = False ignore_tcp = True live_window_time = 3 no_network = True no_plot = False plot_rate = 10 proc_window_time = 3 processing_rate = 5 rate = 64 rec_debug_printer = False run_name = 'WILMA' simple_stop = False val_debug_printer = True write_output = True write_header = True write_type = 'txt'
hidden_dim = 128 dilation = [1,2,4,8,16,32,64,128,256,512] sample_rate = 16000 timestep = 6080 is_training = True use_mulaw = True batch_size = 1 num_epochs = 10000 save_dir = './logdir' test_data = 'test.wav'
hidden_dim = 128 dilation = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512] sample_rate = 16000 timestep = 6080 is_training = True use_mulaw = True batch_size = 1 num_epochs = 10000 save_dir = './logdir' test_data = 'test.wav'
# This file provides an object for version numbers. class Version: def __init__(self, major: int, minor: int=0, patch: int=0, tag: str=""): self.major = major self.minor = minor self.patch = patch self.tag = tag def __repr__(self): return "Version(" + str(self.major) + ", " + str(self.minor) + ", " + str(self.patch) + ", \"" + self.tag + "\")" def __str__(self): return str(self.major) + "." + str(self.minor) + (("." + str(self.patch)) if ((self.patch != 0) or self.tag != "") else "") + (self.tag if (self.tag != "") else "") def __len__(self): if self.tag == "": if self.patch == 0: if self.minor == 0: return 1 else: return 2 else: return 3 else: return 4 def __int__(self): return self.major #def __float__(self): # return self.major + (self.minor / (10 ** len(self.minor))) def __eq__(self, o): if type(o) == str: if len(o.split(".")) == 3: try: return ((int(o.split(".")[0]) == self.major) and (int(o.split(".")[1]) == self.minor) and (int(o.split(".")[2]) == self.patch)) except ValueError: return NotImplemented except: raise elif len(o.split(".")) == 2: try: return ((int(o.split(".")[0]) == self.major) and (int(o.split(".")[1]) == self.minor)) except ValueError: return NotImplemented except: raise elif len(o.split(".")) == 1: try: return (int(o.split(".")[0]) == self.major) except ValueError: return NotImplemented except: raise else: return NotImplemented elif type(o) == int: if (self.minor == 0) and (self.patch == 0): return (self.major == o) else: return NotImplemented elif type(o) == float: if (self.patch == 0): return (float(self) == o) else: return NotImplemented elif type(o) == Version: return (self.major == o.major) and (self.minor == o.minor) and (self.patch == o.patch) else: return NotImplemented def __lt__(self, o): if type(o) == str: if len(o.split(".")) == 1: try: return (int(o.split(".")[0]) < self.major) except ValueError: return NotImplemented except: raise else: return NotImplemented elif type(o) == int: if (self.minor == 0) and (self.patch == 0): return (self.major < o) else: return NotImplemented elif type(o) == Version: if (self.major < o.major): return True elif (self.major == o.major): if (self.minor < o.minor): return True elif (self.minor == o.minor): if (self.patch < o.patch): return True else: return False else: return False else: return False else: return NotImplemented def __le__(self, o): hold = (self < o) hold2 = (self == o) if (hold == NotImplemented) or (hold2 == NotImplemented): return NotImplemented else: return (hold or hold2) def __gt__(self, o): hold = (self <= o) if hold == NotImplemented: return NotImplemented else: return not hold def __ge__(self, o): hold = (self < o) if hold == NotImplemented: return NotImplemented else: return not hold def __iter__(self): if self.tag == "": for i in (self.major, self.minor, self.patch): yield i else: for i in (self.major, self.minor, self.patch, self.tag): yield i def asdict(self): return {"major": self.major, "minor": self.minor, "patch": self.patch, "tag": self.tag} __version__ = Version(1, 1, 1)
class Version: def __init__(self, major: int, minor: int=0, patch: int=0, tag: str=''): self.major = major self.minor = minor self.patch = patch self.tag = tag def __repr__(self): return 'Version(' + str(self.major) + ', ' + str(self.minor) + ', ' + str(self.patch) + ', "' + self.tag + '")' def __str__(self): return str(self.major) + '.' + str(self.minor) + ('.' + str(self.patch) if self.patch != 0 or self.tag != '' else '') + (self.tag if self.tag != '' else '') def __len__(self): if self.tag == '': if self.patch == 0: if self.minor == 0: return 1 else: return 2 else: return 3 else: return 4 def __int__(self): return self.major def __eq__(self, o): if type(o) == str: if len(o.split('.')) == 3: try: return int(o.split('.')[0]) == self.major and int(o.split('.')[1]) == self.minor and (int(o.split('.')[2]) == self.patch) except ValueError: return NotImplemented except: raise elif len(o.split('.')) == 2: try: return int(o.split('.')[0]) == self.major and int(o.split('.')[1]) == self.minor except ValueError: return NotImplemented except: raise elif len(o.split('.')) == 1: try: return int(o.split('.')[0]) == self.major except ValueError: return NotImplemented except: raise else: return NotImplemented elif type(o) == int: if self.minor == 0 and self.patch == 0: return self.major == o else: return NotImplemented elif type(o) == float: if self.patch == 0: return float(self) == o else: return NotImplemented elif type(o) == Version: return self.major == o.major and self.minor == o.minor and (self.patch == o.patch) else: return NotImplemented def __lt__(self, o): if type(o) == str: if len(o.split('.')) == 1: try: return int(o.split('.')[0]) < self.major except ValueError: return NotImplemented except: raise else: return NotImplemented elif type(o) == int: if self.minor == 0 and self.patch == 0: return self.major < o else: return NotImplemented elif type(o) == Version: if self.major < o.major: return True elif self.major == o.major: if self.minor < o.minor: return True elif self.minor == o.minor: if self.patch < o.patch: return True else: return False else: return False else: return False else: return NotImplemented def __le__(self, o): hold = self < o hold2 = self == o if hold == NotImplemented or hold2 == NotImplemented: return NotImplemented else: return hold or hold2 def __gt__(self, o): hold = self <= o if hold == NotImplemented: return NotImplemented else: return not hold def __ge__(self, o): hold = self < o if hold == NotImplemented: return NotImplemented else: return not hold def __iter__(self): if self.tag == '': for i in (self.major, self.minor, self.patch): yield i else: for i in (self.major, self.minor, self.patch, self.tag): yield i def asdict(self): return {'major': self.major, 'minor': self.minor, 'patch': self.patch, 'tag': self.tag} __version__ = version(1, 1, 1)
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def levelOrderBottom(self, root: TreeNode) -> List[List[int]]: self.result = [] self.wft([root]) return self.result def wft(self, nodes): newNodes = [] values = [] for n in nodes: if n is not None: values.append(n.val) newNodes += [n.left, n.right] if len(values) != 0: self.result = [values] + self.result self.wft(newNodes)
class Solution: def level_order_bottom(self, root: TreeNode) -> List[List[int]]: self.result = [] self.wft([root]) return self.result def wft(self, nodes): new_nodes = [] values = [] for n in nodes: if n is not None: values.append(n.val) new_nodes += [n.left, n.right] if len(values) != 0: self.result = [values] + self.result self.wft(newNodes)
class airQuality: def __init__(self, bus): self.iaq = 0 self.bus = bus self.address = 0x5A self.datablock = 9 self.data = 0 def read(self): data = self.bus.read_i2c_block_data(self.address, 0x00, self.datablock) #WIP # Convert the data #if( eco2 !=0 ) *eco2 = (buf[0]<<8) + (buf[1]<<0); #if( stat !=0 ) *stat = ( num==IAQCORE_SIZE ? 0 : IAQCORE_STAT_I2CERR ) + (buf[2]<<0); // Add I2C status to chip status #if( resist!=0 ) *resist= ((uint32_t)buf[3]<<24) + ((uint32_t)buf[4]<<16) + ((uint32_t)buf[5]<<8) + ((uint32_t)buf[6]<<0); #if( etvoc !=0 ) *etvoc = (buf[7]<<8) + (buf[8]<<0); # Output data to screen #Print values, interpret as datasheet #Based on maarten's ESP project #https://github.com/maarten-pennings/iAQcore/blob/master/src/iAQcore.cpp
class Airquality: def __init__(self, bus): self.iaq = 0 self.bus = bus self.address = 90 self.datablock = 9 self.data = 0 def read(self): data = self.bus.read_i2c_block_data(self.address, 0, self.datablock)
#You are given a list of n-1 integers and these integers are in the range of 1 to n. #There are no duplicates in the list. #One of the integers is missing in the list. Write an efficient code to find the missing integer ar=[ 1, 2, 4, 5, 6 ] def missing_(a): print("l",l) for i in range(1,l+2): if(i not in a): return(i) print(missing_(ar))
ar = [1, 2, 4, 5, 6] def missing_(a): print('l', l) for i in range(1, l + 2): if i not in a: return i print(missing_(ar))
print('Enter a text and when finished press Enter twice: ') text = '' while True: line = input() if line: text += line + '\n ' else: break def wc(text): n_words = len(text.split(' ')) - 1 n_lines = len(text.split('\n')) - 1 n_characters = len(text) - 2*n_lines print(f'Characters in text - {n_characters}') print(f'Words in text - {n_words}') print(f'Lines in text - {n_lines}') wc(text)
print('Enter a text and when finished press Enter twice: ') text = '' while True: line = input() if line: text += line + '\n ' else: break def wc(text): n_words = len(text.split(' ')) - 1 n_lines = len(text.split('\n')) - 1 n_characters = len(text) - 2 * n_lines print(f'Characters in text - {n_characters}') print(f'Words in text - {n_words}') print(f'Lines in text - {n_lines}') wc(text)
def sample_anchors_pre(df, n_samples= 256, neg_ratio= 0.5): ''' Sample total of n samples across both BG and FG classes. If one of the classes have less samples than n/2, we will sample from majority class to make up for short. Args: df with column named labels_anchors, containing 1 for foreground and 0 for background n_samples: number of samples to take in total. default 256, so 128 BG and 128 FG. neg_ratio: 1/2 ''' n_fg = int((1-neg_ratio) * n_samples) n_bg = int(neg_ratio * n_samples) fg_list = [x for x in df['labels_anchors'] if x == 1] bg_list = [x for x in df['labels_anchors'] if x == 0] # check if we have excessive positive samples if len(fg_list) > n_fg: # mark excessive samples as -1 (ignore) ignore_index = fg_list[n_bg:] df.loc[ignore_index, "labels_anchors"] = -1 # sample background examples if we don't have enough positive examples to match the anchor batch size if len(fg_list) < n_fg: diff = n_fg - len(fg_list) # add remaining to background examples n_bg += diff # check if we have excessive background samples if len(bg_list) > n_bg: # mark excessive samples as -1 (ignore) ignore_index = fg_list[n_bg:] df.loc[ignore_index, "labels_anchors"] = -1
def sample_anchors_pre(df, n_samples=256, neg_ratio=0.5): """ Sample total of n samples across both BG and FG classes. If one of the classes have less samples than n/2, we will sample from majority class to make up for short. Args: df with column named labels_anchors, containing 1 for foreground and 0 for background n_samples: number of samples to take in total. default 256, so 128 BG and 128 FG. neg_ratio: 1/2 """ n_fg = int((1 - neg_ratio) * n_samples) n_bg = int(neg_ratio * n_samples) fg_list = [x for x in df['labels_anchors'] if x == 1] bg_list = [x for x in df['labels_anchors'] if x == 0] if len(fg_list) > n_fg: ignore_index = fg_list[n_bg:] df.loc[ignore_index, 'labels_anchors'] = -1 if len(fg_list) < n_fg: diff = n_fg - len(fg_list) n_bg += diff if len(bg_list) > n_bg: ignore_index = fg_list[n_bg:] df.loc[ignore_index, 'labels_anchors'] = -1
ansOut = [] coin = [10, 50, 100, 500] while True: price = int(input()) if price == 0: break cash = list(map(int, input().split())) sumCash = sum(c * n for c, n in zip(coin, cash)) change = sumCash - price changeCoins = [(change % 50) // 10, (change % 100) // 50, (change % 500) // 100, change // 500] out = [] for i in range(4): if cash[i] > changeCoins[i]: out.append('{} {}'.format(coin[i], cash[i] - changeCoins[i])) ansOut.append('\n'.join(out)) print('\n\n'.join(ansOut))
ans_out = [] coin = [10, 50, 100, 500] while True: price = int(input()) if price == 0: break cash = list(map(int, input().split())) sum_cash = sum((c * n for (c, n) in zip(coin, cash))) change = sumCash - price change_coins = [change % 50 // 10, change % 100 // 50, change % 500 // 100, change // 500] out = [] for i in range(4): if cash[i] > changeCoins[i]: out.append('{} {}'.format(coin[i], cash[i] - changeCoins[i])) ansOut.append('\n'.join(out)) print('\n\n'.join(ansOut))
def isBalanced(expr): if len(expr)%2!=0: return False opening=set('([{') match=set([ ('(',')'), ('[',']'), ('{','}') ]) stack=[] for char in expr: if char in opening: stack.append(char) else: if len(stack)==0: return False lastOpen=stack.pop() if (lastOpen, char) not in match: return False return len(stack)==0
def is_balanced(expr): if len(expr) % 2 != 0: return False opening = set('([{') match = set([('(', ')'), ('[', ']'), ('{', '}')]) stack = [] for char in expr: if char in opening: stack.append(char) else: if len(stack) == 0: return False last_open = stack.pop() if (lastOpen, char) not in match: return False return len(stack) == 0
class Solution: def mySqrt(self, x: int) -> int: left, right = 0, x while left <= right: mid = left + (right - left) // 2 square = mid ** 2 if square <= x: left = mid + 1 elif square > x : right = mid -1 return left-1 # n : the number of input value ## Time Complexity: O( log n ) # # The overhead in time is the upper-bound of binary search, which is of O( log n ). ## Space Complexity: O( 1 ) # # The overhead in space is the variable for mathematical computation, which is of O( 1 ) def test_bench(): test_data = [0, 1, 80, 63, 48 ] # expected output: ''' 0 1 8 7 6 ''' for n in test_data: print( Solution().mySqrt(n) ) return if __name__ == '__main__': test_bench()
class Solution: def my_sqrt(self, x: int) -> int: (left, right) = (0, x) while left <= right: mid = left + (right - left) // 2 square = mid ** 2 if square <= x: left = mid + 1 elif square > x: right = mid - 1 return left - 1 def test_bench(): test_data = [0, 1, 80, 63, 48] '\n 0\n 1\n 8\n 7\n 6\n ' for n in test_data: print(solution().mySqrt(n)) return if __name__ == '__main__': test_bench()
In [18]: my_list = [27, "11-13-2017", 84.98, 5] In [19]: store27 = salesReceipt._make(my_list) In [20]: print(store27) salesReceipt(storeID=27, saleDate='11-13-2017', saleAmount=84.98, totalGuests=5)
In[18]: my_list = [27, '11-13-2017', 84.98, 5] In[19]: store27 = salesReceipt._make(my_list) In[20]: print(store27) sales_receipt(storeID=27, saleDate='11-13-2017', saleAmount=84.98, totalGuests=5)
adj_list_moo = {4: [5], 6: [5], 5: [7], 7: []} def dfs_topsort(graph): # recursive dfs with L = [] # additional list for order of nodes color = { u : "white" for u in graph } found_cycle = [False] for u in graph: if color[u] == "white": dfs_visit(graph, u, color, L, found_cycle) if found_cycle[0]: break if found_cycle[0]: # if there is a cycle, L = [] # then return an empty list L.reverse() # reverse the list return L # L contains the topological sort def dfs_visit(graph, u, color, L, found_cycle): if found_cycle[0]: return color[u] = "gray" for v in graph[u]: if color[v] == "gray": found_cycle[0] = True return if color[v] == "white": dfs_visit(graph, v, color, L, found_cycle) color[u] = "black" # when we're done with u, L.append(u) # add u to list (reverse it later!) def has_hamiltonian(adj_list): graph_sorted = dfs_topsort(adj_list) print(graph_sorted) for i in range(0, len(graph_sorted) - 1): cur_node = graph_sorted[i] next_node = graph_sorted[i + 1] if next_node not in adj_list[cur_node]: return False return True print(has_hamiltonian(adj_list_moo))
adj_list_moo = {4: [5], 6: [5], 5: [7], 7: []} def dfs_topsort(graph): l = [] color = {u: 'white' for u in graph} found_cycle = [False] for u in graph: if color[u] == 'white': dfs_visit(graph, u, color, L, found_cycle) if found_cycle[0]: break if found_cycle[0]: l = [] L.reverse() return L def dfs_visit(graph, u, color, L, found_cycle): if found_cycle[0]: return color[u] = 'gray' for v in graph[u]: if color[v] == 'gray': found_cycle[0] = True return if color[v] == 'white': dfs_visit(graph, v, color, L, found_cycle) color[u] = 'black' L.append(u) def has_hamiltonian(adj_list): graph_sorted = dfs_topsort(adj_list) print(graph_sorted) for i in range(0, len(graph_sorted) - 1): cur_node = graph_sorted[i] next_node = graph_sorted[i + 1] if next_node not in adj_list[cur_node]: return False return True print(has_hamiltonian(adj_list_moo))
#!/usr/bin/env python3 flags = ['QCTF{e51f2dad87875d76fb081f2b467535ef}', 'QCTF{c89a4b8b181ea0e7666dc8bf93b34779}', 'QCTF{50b59ef5ba8ca7650323b96119507a98}', 'QCTF{fb1c1b7f76e5ca22411fcee3d024ff46}', 'QCTF{4909e8138219a1f5f166e6e06e057cbc}', 'QCTF{649d0b63d4bd82a9af7af03ba46838d3}', 'QCTF{af043650dc65acce4e001425bacbd3f2}', 'QCTF{8e4225e08e6ec2ec1808b6212e8fd813}', 'QCTF{31b1951f567876b0ad957c250402e3e2}', 'QCTF{959f2b0d3fcd298adc4c63fed56c1c5b}', 'QCTF{3a05bfaa08b653a8b9fc085ebd089f62}', 'QCTF{20d739e7472dcf27e77ffb4be40fd3e5}', 'QCTF{eb35b55b59653643a2e625d8826bc84b}', 'QCTF{311e4b1943c17659b9ded0a3e0f57b2b}', 'QCTF{040eaadc3df6ae0ecb33a404f8e03453}', 'QCTF{84801c28a6619841c425f4c13b867a32}', 'QCTF{ab56c77c46c40354e2f38559c034f348}', 'QCTF{f1f9e7257150d40ce3f481aa44517757}', 'QCTF{9d45092f74d5e74772c9e08a7c25690f}', 'QCTF{f0310ec009bdf2c487d7c149b767078b}', 'QCTF{00bc89904ed8ebffc430ca0f64a0467c}', 'QCTF{7984fbee8ea7d5f0e07c36803e2aacc5}', 'QCTF{0088ba127fb34ffa22023757734ad619}', 'QCTF{97589ca529c64e79a73824e9335c3905}', 'QCTF{30dfe9e4228863f2e9c45508753a9c84}', 'QCTF{a12aa8fdacf39cdf8d031ebb1141ade5}', 'QCTF{3114013f1aea003dc644cd686be073f7}', 'QCTF{c959542546b08485d4c76c6df9034c32}', 'QCTF{4fa407b4fe6f3be4afec15c10e5b60b5}', 'QCTF{b8bac3402e1ae6e42353eb0dbb6e1187}', 'QCTF{71ea738f80df88fe27c7952ee0a08fe9}', 'QCTF{52ef2660af4c18564e75e0421e7be56e}', 'QCTF{41088927caebd4c35d6a5c8c45876ae5}', 'QCTF{90afac1d3e10fa71d8d554c6584cc157}', 'QCTF{6c4f93cd891d991a5f6d21baee73b1a8}', 'QCTF{2fb6f9546cd09b2406f9b9aa0045b4b7}', 'QCTF{1aa150bac71e54372ca54ca412c11f40}', 'QCTF{e0a712bf6d89c9871e833bd936aac979}', 'QCTF{de50d0d2811dd9cb41a633a2f250b680}', 'QCTF{0bb67bdba8a748ddd1968ac66cf5c075}', 'QCTF{661133e4774d75ab7534f967dfe1b78c}', 'QCTF{7edf018896320cf9599a5c13fb3af3a8}', 'QCTF{c976ef4b78ae682d4b854a04f620fb0f}', 'QCTF{4b5436f5f3d9ac23473d4dca41a4dd63}', 'QCTF{d1947ab453f3922436adda4a6716d409}', 'QCTF{162ac50561fae2f9cd40c36e09e24705}', 'QCTF{80fca1b74687d4c0b11313dcf040bbf6}', 'QCTF{f65e11eddbf3cad560ebd96ba4f92461}', 'QCTF{c3b916d43e70181a655b4463ef945661}', 'QCTF{e19df794949bd9d80eef3cb4172dea31}', 'QCTF{a3a759941a10450905b0852b003a82c7}', 'QCTF{533705986a35606e97807ee37ab2c863}', 'QCTF{8aef26a1028de761735a39b27752b9c4}', 'QCTF{70926ffcaf4ff487d0d99fbdf0c78834}', 'QCTF{530cfc0e08a756dcf0f90c2d67c33b40}', 'QCTF{96a2c9e6ca7d6668399c6985d5d2458c}', 'QCTF{6a256384fb72333455da5b04d8495fbe}', 'QCTF{633febe4ec366bc11da19dff3e931521}', 'QCTF{66d6674fec3c7a14cf5c3af6cd467b8e}', 'QCTF{29bfba8ec4e44a5cc33fd099bdb0316b}', 'QCTF{45f3d7645b685042e7e68ad0d309fcec}', 'QCTF{94afe993a0028625d2a22de5c88293e1}', 'QCTF{d272dc01edf11d10730a64cd22827335}', 'QCTF{623cd04ddaccfc4a0d1523bc27bc32ae}', 'QCTF{bf6a6af3f83259e2f66d9b3fce376dce}', 'QCTF{91c134d6a9cd7699ec3a3b5f85a583f0}', 'QCTF{6c85e3fb56c89d62d5fe9e3d27e4a5aa}', 'QCTF{7e4164b2bb4afa5c25682bc4a8c53e66}', 'QCTF{5bc3631a6896269fe77c6bdaf9d27c78}', 'QCTF{6e1b9877716685cac3d549e865a7c85b}', 'QCTF{28fd1487a42cd3e45c98f9876e3c6728}', 'QCTF{6805c31e2276a8daa8826852ca2b0b83}', 'QCTF{2b121dafdfb150cd369e8720b59d82f7}', 'QCTF{ec31421b9f66116a02ca6b773c993358}', 'QCTF{558186ebec8b8653bb18933d198c3ece}', 'QCTF{267b5a5f8bb98b7342148c6106eb2d2c}', 'QCTF{aa38fe9f4141311d709346ead027b507}', 'QCTF{f66f66413048d100ee15c570ac585b13}', 'QCTF{7491e7cd71d16bc2446f3bcf0c92ad2d}', 'QCTF{054c7ac021fbe87042832f8c7bad3a43}', 'QCTF{0fb5425a7fcce56802da00e476347823}', 'QCTF{5299eb9d08eee8fb3f864b999806e88e}', 'QCTF{44c0b9528001db285e167339f84c7e2d}', 'QCTF{397f79c2fedb5281d5ee6662091cbf32}', 'QCTF{741bc53922594cd54deba4c2da166ba5}', 'QCTF{21e2d583596bccdafec4644614841a30}', 'QCTF{61117cdba7b47d2b0b782ebb887b37c9}', 'QCTF{690e749a4c3cc43ca6e9568e48a85f34}', 'QCTF{cf6152c25f81266612090ac7698c10cc}', 'QCTF{56133fb27d94c097e448cd6c54604241}', 'QCTF{9ada31f4d1ee3665867ac40cd576547f}', 'QCTF{fc726ff171101080f64f0a2b06f62264}', 'QCTF{d7dad3c2d7da424d112e3f5685bc3a84}', 'QCTF{71d3e6428dcfc74e4002ed3ad26ed639}', 'QCTF{a0122c5fb3937c487285d0e3051d2d32}', 'QCTF{d456e533f3e963940f17adeb2a898c1f}', 'QCTF{fda977c62519b775fd52b33b7ee3c59d}', 'QCTF{85bb44511da219a6f20706dc232a5036}', 'QCTF{67a79a883ba2bf8eb1905817db7c5455}', 'QCTF{e86fbd286f9a5e507f977fce01d8f546}', 'QCTF{2df725e5277ae0cda2e1b62c670200bb}', 'QCTF{04249a31c87f0bbba3c5d658f8534424}', 'QCTF{9a28f64f49d9e0e3cbd4b9be7d70c389}', 'QCTF{842bb11fa6d69059b8c151a54c2c97f5}', 'QCTF{d426e9a1daa917b243579c1f8fdf8388}', 'QCTF{b8bbd65882ce11f20637d2d66e69c605}', 'QCTF{06756225de4f362c80ecf2aa11e1cf3b}', 'QCTF{0848575c514d3b762f06a8e93dabf370}', 'QCTF{4e9c1a7d8e588a65ef640fed086f417f}', 'QCTF{a52e79bcba9b01a7a07f24b226c12848}', 'QCTF{3d18d085b0e51c6a02daaed5a759930f}', 'QCTF{779194626871433c31f7812157d3b8cb}', 'QCTF{3c3c5107ed05970963fa016b6d6be7eb}', 'QCTF{aa05136c8c46d67cdfc69f47d18aa51b}', 'QCTF{1e85348d600b9019b216f2515beb0945}', 'QCTF{0349bdc14f7ff8b7052c9eb4db1e5a21}', 'QCTF{30dcbb8b9c67edacb4bbed10cb07cc07}', 'QCTF{5b09db09bfaf3a02dc17bfd8771bae8f}', 'QCTF{6e7d07f9c31357ed68590bc24a2ece08}', 'QCTF{d46e9b29270c59845095d97ef9337e95}', 'QCTF{ec118d128f18ca77e0c67d7e66409a7f}', 'QCTF{626af7a6c7005d23b960a02ce128273c}', 'QCTF{05d11133f11f7ea1fa9f009af57f5a57}', 'QCTF{28d876b112787b2ee599929c1f9de7b6}', 'QCTF{100187062f58e52a3b8bd79170b65f8d}', 'QCTF{8b5c6fb2ba52a12763d64631c63ad01c}', 'QCTF{07ffbf77145fd46dc5b19c7464f8e94a}', 'QCTF{8f86963b93b526c663bc51a403a41165}', 'QCTF{eadb09f8f6afc668c3c03976693a7c9e}', 'QCTF{93ddbf8e42e6b4d136bae5d3f1158d70}', 'QCTF{a809ecbc8776a603744cf537e9b71329}', 'QCTF{b75aaea7fabc8f889dc74944c6a4e3c0}', 'QCTF{a416acd8208ccd0f2df531f33d2b6cbe}', 'QCTF{8597e9700045b0dee3fe0a4a2f751af1}', 'QCTF{729f67a65769222200269d1c3efe50f6}', 'QCTF{21f4a9b77d313354bb0951949f559efb}', 'QCTF{6a9d138c62a731982c21a0951cac751f}', 'QCTF{b2a353a1231651b2373e0f4f9863d67c}', 'QCTF{6b8646481367974201ad3763ac09f01b}', 'QCTF{4733d8e51be03a5e7e1421fcb9461946}', 'QCTF{d5671bfab2e102d6ef436310cea556e5}', 'QCTF{fe0dc7f1ad3e3ab1804ac552b5a1014e}', 'QCTF{cd04131fb76d78b75ad4ad3dc241c078}', 'QCTF{b0c3b58624595631a928614c481ef803}', 'QCTF{c3677adad49d8c7b58adcd8d1f41fd8e}', 'QCTF{24dd83a9fa8249b194a53b73f3e12ae8}', 'QCTF{1324a272b619f33ba6c906cd1241cb9a}', 'QCTF{8c4818398ff7e32749c55b19ef965e6e}', 'QCTF{8ee7652cd55d983b708494d85cdba5f2}', 'QCTF{f5601c9718694cfdb754eeb160e77c66}', 'QCTF{4bc1ee7c77ab31f93c314c9cee197d59}', 'QCTF{dfa5bf7ee0a60998035561854ed84677}', 'QCTF{91ff0390d23c0bc1f98d9b19f95cbf93}', 'QCTF{df1135299838932c7b99e8bde9ad8cee}', 'QCTF{056c0210269af051143085248957b3d5}', 'QCTF{6fc42ebaae905d9787d39ad2790b61a5}', 'QCTF{3556c554530023aa02c98a2640a8bacb}', 'QCTF{50a7a712e483aeb523eb00a3a3a4cac6}', 'QCTF{118206c65e16c8314c390914f4a1e59b}', 'QCTF{d456ee30a2399e16f992f9ac2a433d24}', 'QCTF{30a9fb0469aee8878738fa99b7aec8cb}', 'QCTF{b8e518cf71866653f21f4ac241c82d76}', 'QCTF{63117b1c93ec4ff2debd0b0753bb1eb3}', 'QCTF{5665a9accc75c6a1f1882a857c8bbe38}', 'QCTF{565c5a9ece2c891371311c9b0913ddb1}', 'QCTF{8de1cc37b69d6f40bfa2c00fd9e48028}', 'QCTF{50acfa0e810ef4f1cf81462fc77aa8e8}', 'QCTF{33ac115dda168b4eef1a7dc035031e2b}', 'QCTF{e78911a8fc02ed099996bd8e9721dc8d}', 'QCTF{dfe2b8379694a980a3794fd3ce5e61fe}', 'QCTF{eee7da02d350b537783ecead890dd540}', 'QCTF{2aad8accd248b7ca47ae29d5e11f7975}', 'QCTF{8e480455d1e43048616831a59e51fc84}', 'QCTF{986cbb4487b1a8a91ad1827a97bda900}', 'QCTF{48d538cd70bc824dd494562842a24c1b}', 'QCTF{17fa5c186d0bb555c17c7b61f50d0fee}', 'QCTF{9aa99fd3e183fab6071715fb95f2e533}', 'QCTF{58b7096db82c5c7d9ec829abe0a016f3}', 'QCTF{30464a8db4b8f0ae8dc49e8734ed66cb}', 'QCTF{83655c6bd0619b6454ceb273de2d369f}', 'QCTF{72d81a3037fbc8c015bcb0adb87df0db}', 'QCTF{c62bece5781ab571b6ead773f950578c}', 'QCTF{ccd16df0466399ce0424e0102e8bf207}', 'QCTF{9cf7d5815e5bdfccadbb77ffedffa159}', 'QCTF{5ea628391c00c852a73c1a248325cc36}', 'QCTF{8d1daaf1742890409c76c7e5c7496e74}', 'QCTF{19258fe7a929318e6a6c841b54376ea7}', 'QCTF{dc0f86d1e9c1dc1ac4bd4ecad118496b}', 'QCTF{a1a10660a9e023db4803963d0163f915}', 'QCTF{76bdb8507907572d7bba4e53c66b7c94}', 'QCTF{daa9cc55d45641b647449f5a0f4b8431}', 'QCTF{bfa029f704d1f2e81ee9f1ff125d9208}', 'QCTF{356ff001060180459cef071fe033a5f5}', 'QCTF{2b5288c1aad44a9412fcd6bb27dcea7a}', 'QCTF{44172306ed32d70629eace8b445fd894}', 'QCTF{8783ab2b9bc9a89d60c00c715c87c92e}', 'QCTF{a0351089fc58958fb27e55af695bb35e}', 'QCTF{c0de87abadd65ee4e2dba80de610e50a}', 'QCTF{c99b6e9bb5fce478cdc6bca666679c4a}', 'QCTF{0397b5cb327fcc1d94d7edb0f6e1ec15}', 'QCTF{9479a5ca5aef08cacde956246fa2edd3}', 'QCTF{2063acf3a9fd072febe2575151c670cb}', 'QCTF{d6ed4333159c278d22c5527c2a3da633}', 'QCTF{08a811c51b0f0173f0edef63d8326378}', 'QCTF{65dbdc8a0e1b52a07e59248a2e9e456b}', 'QCTF{573a7f0ce4d2cf3e08d452c743fee1ce}', 'QCTF{435089a171f209a66a966e377dba9501}', 'QCTF{81f7f819f6b71eb7720fad3d16dc2373}', 'QCTF{be50a207baaa5e3a491ef7aaeb245abf}', 'QCTF{a996d4647adbc12a69165587a08346e9}', 'QCTF{999d36dee80b90eec6a580cd1f344a08}', 'QCTF{3da3e486913a793a1317da22d8a9a29e}', 'QCTF{809e95f98ba199180cd860ba41d62c5c}', 'QCTF{67524c5080a8b674dcf064494ef7c70f}', 'QCTF{cefcc52f59a484f62b7ba7e62e88e06f}', 'QCTF{241cdfbf606848c9f67589bf2f269206}', 'QCTF{efc924775d7b859411f3bf5a61e85a07}', 'QCTF{63b4e85e20331f52a187318ba2edfd7a}', 'QCTF{a65f5925508331f0b8deda5f67781bc5}', 'QCTF{356ed7e0ab149db06806cc0e6ca6fd5f}', 'QCTF{304d3a7970cf4717dccf3dffbed06874}', 'QCTF{99a747c8723a889bdea5e4f283c20df7}', 'QCTF{c8d7f74205797b602d25852caad49fb1}', 'QCTF{b9248c3a252601dd106d9c0462a9bab7}', 'QCTF{ea86b2a12458a6990d5bae35a73168a0}', 'QCTF{1ca4ecbf8f4ea2d0e2b832c44746ec3b}', 'QCTF{59ee4bf3aedc20d469e788486a9ead6c}', 'QCTF{73720bdd5a424570e5be571021dc4fb8}', 'QCTF{8c04511bedfe9f8c388e4d2f8aba1be5}', 'QCTF{98e34760371fa91407546ba8ac379c09}', 'QCTF{d33cb59a700fb8521a8cb5471048e15e}', 'QCTF{09d317a825132c255ea11c1f41aab1f3}', 'QCTF{a3850a970f2330d1ff6d704061967318}', 'QCTF{93ad167555f15f0901b729f488fc7720}', 'QCTF{61fd9c59cfe8c20d90649bec48424ea1}', 'QCTF{bedf1e7e966f54474931e8cfd141a6ca}', 'QCTF{5ad8a1ce7ec8ab9cdc05553cfd306382}', 'QCTF{3320b3f0490d0949786a894b7f621746}', 'QCTF{57d1dc2f73193dca32535a48650b3a66}', 'QCTF{5c48d6bbfd4fb91d63f21cbe99ece20b}', 'QCTF{2cacdb709e0c230b54e732829b514f92}', 'QCTF{079d0cf77acaebbdbbe8037a35bba5d7}', 'QCTF{d87badd74be817e6acb63d64ecc05ac8}', 'QCTF{f67dffa3ee05d9f096b45c37895d7629}', 'QCTF{1bf708a5a3c9ef47ca7eb8138a052d1b}', 'QCTF{1adf18338f26d19b22f63a4e8eec6e91}', 'QCTF{870d781a223a9112cbb2fb5548e10906}', 'QCTF{8851c98297c5a74ac40cf59875186bd8}', 'QCTF{f83377875176bed6b33e06e9896edded}', 'QCTF{1715727cbb24140bacd2838fc0199bc4}', 'QCTF{c77578152cc09addb4751158bccc7fea}', 'QCTF{7155fb7eb62e6c78ddf3ec44375d3fa9}', 'QCTF{57214d23681056a6596f75372e5cd41b}', 'QCTF{92dcab5e2109673b56d7dc07897055bd}', 'QCTF{131bb9ead4a7d0eb7d2f5540f4929c2d}', 'QCTF{e436dc01fa926f4e48f6920c69c2f54c}', 'QCTF{4b7d2c9245bd28d9c783863ab43202be}', 'QCTF{e23e27790ea55f3093b40d7fdf21b821}', 'QCTF{93e2f15ce929e3d6508543d4378735c3}', 'QCTF{0a18798c331b7f4b4dd14fad01ca3b1f}', 'QCTF{cde9927b04feeaa0f876cecb9e0268e3}', 'QCTF{ba6c8af3c6e58b74438dbf6a04c13258}', 'QCTF{72212e5eb60e430f6ff39f8c2d1ba70d}', 'QCTF{3912316e516adab7e9dfbe5e32c2e8cc}', 'QCTF{960dce50df3f583043cddf4b86b20217}', 'QCTF{6cd9ea76bf5a071ab53053a485c0911a}', 'QCTF{36300e6a9421da59e6fdeefffd64bd50}', 'QCTF{5c3e73a3187dc242b8b538cae5a37e6f}', 'QCTF{9744c67d417a22b7fe1733a54bb0e344}', 'QCTF{28d249578bf8facdf7240b860c4f3ae0}', 'QCTF{a1e9913a8b4b75dd095db103f0287079}', 'QCTF{c4f0f3deafa52c3314fd4542a634933c}', 'QCTF{35a39749f9bea6c90a45fd3e8cc88ca5}', 'QCTF{755cb7e40752b07ed04b12c59b9ce656}', 'QCTF{89e8208c492574de6735b0b5fbe471f5}', 'QCTF{a242f710bd67754b594969a449119434}', 'QCTF{26ded88b4d6b4d9278148de9c911cfb6}', 'QCTF{b6ac8ca7cfd8f3dc075f5f086def5ea2}', 'QCTF{27bb11fe3208f50caafe37b0bd90f070}', 'QCTF{5f058bf0d3991227b49980b9e226c548}', 'QCTF{9fb934712199835ad48f097e5adedbf1}', 'QCTF{8acd08daa256cda637666543042d8d04}', 'QCTF{f19749ece3b079f28397fc6dafc7c5f8}', 'QCTF{8df2b36bc88bdd6419312a3b1e918ac4}', 'QCTF{3f853785bb79075c902c1fcb86b72db8}', 'QCTF{26950b99d1de657f1840f3b1efd117f9}', 'QCTF{57a0747d5a0e9d621b15efc07c721c47}', 'QCTF{164847eb1667c64c70d835cdfa2fed13}', 'QCTF{aeb04f7e9be0e8fb15ec608e93abf7c6}', 'QCTF{f65a2292ea6c9f731fde36f5f92403dc}', 'QCTF{9cff82f318a13f072dadb63e47a16823}', 'QCTF{6a0a50e5f4b8a5878ec6e5e32b8aa4f3}', 'QCTF{9439eb494febbcb498417bab268786f3}', 'QCTF{68a4215f9d77de4875958d2129b98c3e}', 'QCTF{bf83c9d150ed6777d6f2b5581ce75bf1}', 'QCTF{7c6530f3d07598d62a3566173f2cc4a1}', 'QCTF{9dd20e6699b5c69f432914b0196b5b17}', 'QCTF{3a675c1934b1f44b5b73bfd8cee887b9}', 'QCTF{b5e67c6f319acdfed3c47a280f871c7e}', 'QCTF{b88dad61f68da779fad66fa4442eb337}', 'QCTF{3af8a9807a6d0e4b50c1687c07c1d891}', 'QCTF{e78168930647856b94840ce84fab26b4}', 'QCTF{ab88b2ea7e66dd35bdff4d03a15d3dc1}', 'QCTF{78e20f8707184aea4227c98107c95fdb}', 'QCTF{f1b279cc0839c830e07f6e73bb9654fe}', 'QCTF{71fc41f44593348bb1e4a0938526f0f9}', 'QCTF{f8b9207f02330a7d9a762ab4c1cace2b}', 'QCTF{12efdafbe2e29645abc3296178891ed6}', 'QCTF{c5d813b31a0534341a1c4b64e554c488}', 'QCTF{1a63a760f782eecf21234c815b5748bf}', 'QCTF{b6dee11cd1b0382986738826a5c04d7a}', 'QCTF{0d0d99976206194e426b95873720a440}', 'QCTF{d4030405263f8eec80a3855ba066eb76}', 'QCTF{c249cd1f9f86aa5ff2fe0e94da247578}', 'QCTF{ba8adfd031159e41cbfb26193b2aeee1}', 'QCTF{14dc10f84625fc031dd5cdad7b6a82af}', 'QCTF{be7c2d83d34846ece6fe5f25f0700f74}', 'QCTF{d7f1d87ad0386f695cd022617bf134d8}', 'QCTF{6a3a915957dbcd817876854902f30a6a}', 'QCTF{4663ffd40db950abddb4d09122eb1dcd}', 'QCTF{f72c028fdfeb0c42e3d311295ac42ff2}', 'QCTF{901b065b0d0569f161f0ba7f1cc711bc}', 'QCTF{8f707798947c3335d685d7e3b761c2c4}', 'QCTF{746ffa1fc14609d13dde8d540c5d402a}', 'QCTF{1b92b1e84712dd9084dea96e9f67c659}', 'QCTF{2d8976f6ef6da5b843823940660be68a}', 'QCTF{d1e00391c9bd7c2ecc2b19e6d177e4af}', 'QCTF{cea54a59af20fdfa06c8e8357fec663d}', 'QCTF{1f2b8d5fceea39243fa966d638efc92e}', 'QCTF{0f6faa584c642fc21879f4358fdfb01c}', 'QCTF{acac74237614850fbfbd97410013daa2}', 'QCTF{57fce704c2dbdb5e3034b67a7984bb0c}', 'QCTF{e20bc6c0a13114f7fd29ad9661a946e9}', 'QCTF{92c4dfc79749e9310b7ab64c3d9780d0}', 'QCTF{c6a49485ff92a292f0ae9fca4b1f3314}', 'QCTF{be0f0be2f0fb165a16a62aee2dcd0258}', 'QCTF{052fcc31b1b26484fe9da51fb89ba34d}', 'QCTF{b156eb9c86c03d0fae3c883f5b317dcb}', 'QCTF{ff83da3b5ca61495d0acd623dc2d796e}', 'QCTF{3fce7a6ba38ed1a381dae3686919c902}', 'QCTF{889591a0a7d29579546adaad1d0b5b86}', 'QCTF{9c378d9aa63fca7d5f7f275a9566f264}', 'QCTF{e32a672a6673bc56d8b109952403aae9}', 'QCTF{bc6a3a213102b2dc5f946d5655026352}', 'QCTF{30d04471a675aeeec45b8f6143085f46}', 'QCTF{3b4d06e0c2cd20a177fa277bbbc0a1a2}', 'QCTF{bdf4879a061a3a751f91ece53657a53e}', 'QCTF{d8721fc7d32499aa692b04d7eacc8624}', 'QCTF{09d3580e9431327fbf4ccc53efb0a970}', 'QCTF{814356913a352dfe15b851e52cc55c0d}', 'QCTF{cd9de5c50a3ffb20ea08cb083004252c}', 'QCTF{79de86d819cfc03ac6b98fbc29fac36d}', 'QCTF{63663214499a85208c4f7dc529c05ea5}', 'QCTF{171798109c343a3303020f0a24259e5e}', 'QCTF{611a9181a1f7c45c6c715e494bccd1b9}', 'QCTF{da4e7cc4b461aaedd1bfc45533723b8a}', 'QCTF{2ea7d755b255a6f5376d22f8113a2cfa}', 'QCTF{2a741c8199e13853f8195613ef037ced}', 'QCTF{1b66523f2b665c3dfea91aece42273d3}', 'QCTF{42a46422d8faa1ec3e768580b2dec713}', 'QCTF{ca9d7ac177d049416354a0fbd76a89b9}', 'QCTF{9bb379b6c775b738069ae0ab7accf2dd}', 'QCTF{bacec59ecbc809f7ab27a9169500883a}', 'QCTF{0ef59b9a33046aa124bb87df30934714}', 'QCTF{1b646109ed4bfa30f29d6666b2090701}', 'QCTF{65727e2ba028dc6e9ac572ed6a6ebc6f}', 'QCTF{784c261a9f564d4387d035ce57b05e3e}', 'QCTF{e68fb87f2cad4a3da5799fc982ec82ff}', 'QCTF{ba003b186368bf16c19c71332a95efee}', 'QCTF{6d695ed5a0c2d04722716210b5bcfda6}', 'QCTF{7eb1c12dc09b138a1d7e40058fa7a04a}', 'QCTF{64a545320b2928f88b6c6c27f34d2e3c}', 'QCTF{8cdf05aeb3fa5bb07157db87d2b45755}', 'QCTF{48f8e1742b60e1734f6580ab654f9b6f}', 'QCTF{fb14f2533750f7849b071c9a286c9529}', 'QCTF{47f7996ec34bf04863272d7fc36a1eb1}', 'QCTF{919f49d2f324ae91956c3d97b727c24a}', 'QCTF{336f9d8d23fbb50810c1c0b549ad13bf}', 'QCTF{b316f48f8ed4443a117b7a8752d062cb}', 'QCTF{ea5818adad537c87ddb9ce339c0bbb84}', 'QCTF{d510dfbd781d15b674c63489f55191b2}', 'QCTF{df1d534fcc36d5049b5b607499a74f75}', 'QCTF{2781aa19764810125b745b001dd09090}', 'QCTF{0920b2f44311ed5239e8c2d90c991417}', 'QCTF{da22adea508dc7d5bc9ec5cd5378ef20}', 'QCTF{30f69464f59bf44cba73e6430591acb9}', 'QCTF{2239ffe2985776b1d459a729035e6105}', 'QCTF{07a3846e68534b08abec6761492dfd7c}', 'QCTF{2876a617fcb9d33b1a457e2a1f22982b}', 'QCTF{76471463a11b3f5830d6c98bdc188410}', 'QCTF{64b115efe8a4acaab08f40e83d174953}', 'QCTF{2b9fece3ca12493fa34027cfe34a827d}', 'QCTF{72ceded3364700e5a163cd1fa809f2b5}', 'QCTF{a52ab44fe70adc1964442347fe0bc389}', 'QCTF{ffb4560d742fd8dae61edda32628d5d9}', 'QCTF{fe274231e80419937813cbd55441f8b5}', 'QCTF{38ec71804dca70480b9714ae809bf843}', 'QCTF{2876bb27e398963331099a10e9c1b5b1}', 'QCTF{c8eacb1f0f7ea7a130fe97aa903bc52d}', 'QCTF{91d895637bf21849d8ac97072d9aa66c}', 'QCTF{487a3428ab723d4e9bca30342180612a}', 'QCTF{0ca2e9a4b4fb5298b84a2ae097303615}', 'QCTF{1017c0fad5211fa1a8bd05e2c12e1ab5}', 'QCTF{0772fc3bb68132cc47fc6a26bb23a2eb}', 'QCTF{54808c739cc835327ba82b17dda37765}', 'QCTF{5ba1b7f137a0a269d77db75c1609d015}', 'QCTF{3f59447502e3ccd8db93f57f6b64a869}', 'QCTF{3d33a10890e1797b3518f2032228ef97}', 'QCTF{538226c6e2932fb2c0890fa660707081}', 'QCTF{03dea04fa6f9bf11854a62f92f95028c}', 'QCTF{7ebbc2f97c8e02947eb7537e6e35bf4d}', 'QCTF{7fabc82da5e59469a31d6ae73b0ba8dd}', 'QCTF{99d11087195ac95f9a4bf220346c7ae8}', 'QCTF{6ba3b8dff5b591a308616a485802eb1a}', 'QCTF{73e10bd2e77da35988a91f2b39ba4032}', 'QCTF{d41e8b2244e4e72a04f5229bc61e0a4a}', 'QCTF{1f1c22d0e0dcf0d73b5562f604805060}', 'QCTF{e45fba7380d70df6de5353f6bd1326df}', 'QCTF{c4eb636d6329e437d2ece74b439d905b}', 'QCTF{166f03d5b2a6172ebdfe62790d40ea08}', 'QCTF{c9e2d3fed043ae7ff086944ddb92a595}', 'QCTF{c3683790714524bf741f442cf6f75816}', 'QCTF{c3552856294a7c882abe5bfeb08d40b3}', 'QCTF{2028f8e09d41c758c78b5f1bff9a7730}', 'QCTF{7b28486de1bf56b716f77ab14ac1dc2f}', 'QCTF{e445025dcc35e0f7ad5ffc4c1f736857}', 'QCTF{c977b87449d7461cd45ec2b076754b77}', 'QCTF{9626d8f7759943dedefedffc96ac2489}', 'QCTF{52af66f7f1005968a3057ca76c69b488}', 'QCTF{f7791cfb47893204998bc864a0454767}', 'QCTF{c1325f2049b792f8330ab51d8012138a}', 'QCTF{e6e088ba12752fb97aadaa34ab41b118}', 'QCTF{41051ffcbd702005b7f5c4bae392bb4a}', 'QCTF{58bfe4a9f82ae56f4fab8f2d57470f2f}', 'QCTF{a0ac496ce45f06890c045235eb2547a7}', 'QCTF{0c22482b6a4533ba449d4ec1762494ba}', 'QCTF{4466193f2c65c5d072ecb82277657780}', 'QCTF{43689b43469374eb768fb5d4269be92a}', 'QCTF{e31ff94e5ee5638e7b3c0cde3c2b50dd}', 'QCTF{4cc47b59341b7f0112ba8f4dbdda527c}', 'QCTF{e11501e1bb7da841a2c715eafedccb55}', 'QCTF{6acd2208d0d86fcb796cf8264973fee6}', 'QCTF{d8ee1b7b2772d6aea857929d10fbca8e}', 'QCTF{8c27329ebfdef6480d0c60393a573137}', 'QCTF{b9f5190eb71ca8203f60e2a1a6a652af}', 'QCTF{7e5aa6d503c4c2c944a8148fdf633694}', 'QCTF{9ddcb0e99371e60bbb6cbcae87899fc5}', 'QCTF{e7e75d8e6a4789ea242ece7be93bfc89}', 'QCTF{86546326f5bf721792154c91ede0656d}', 'QCTF{6d36f257d24ee06cc402c3b125d5eaa7}'] def check(attempt, context): if attempt.answer == flags[attempt.participant.id % len(flags)]: return Checked(True) if attempt.answer in flags: return CheckedPlagiarist(False, flags.index(attempt.answer)) return Checked(False)
flags = ['QCTF{e51f2dad87875d76fb081f2b467535ef}', 'QCTF{c89a4b8b181ea0e7666dc8bf93b34779}', 'QCTF{50b59ef5ba8ca7650323b96119507a98}', 'QCTF{fb1c1b7f76e5ca22411fcee3d024ff46}', 'QCTF{4909e8138219a1f5f166e6e06e057cbc}', 'QCTF{649d0b63d4bd82a9af7af03ba46838d3}', 'QCTF{af043650dc65acce4e001425bacbd3f2}', 'QCTF{8e4225e08e6ec2ec1808b6212e8fd813}', 'QCTF{31b1951f567876b0ad957c250402e3e2}', 'QCTF{959f2b0d3fcd298adc4c63fed56c1c5b}', 'QCTF{3a05bfaa08b653a8b9fc085ebd089f62}', 'QCTF{20d739e7472dcf27e77ffb4be40fd3e5}', 'QCTF{eb35b55b59653643a2e625d8826bc84b}', 'QCTF{311e4b1943c17659b9ded0a3e0f57b2b}', 'QCTF{040eaadc3df6ae0ecb33a404f8e03453}', 'QCTF{84801c28a6619841c425f4c13b867a32}', 'QCTF{ab56c77c46c40354e2f38559c034f348}', 'QCTF{f1f9e7257150d40ce3f481aa44517757}', 'QCTF{9d45092f74d5e74772c9e08a7c25690f}', 'QCTF{f0310ec009bdf2c487d7c149b767078b}', 'QCTF{00bc89904ed8ebffc430ca0f64a0467c}', 'QCTF{7984fbee8ea7d5f0e07c36803e2aacc5}', 'QCTF{0088ba127fb34ffa22023757734ad619}', 'QCTF{97589ca529c64e79a73824e9335c3905}', 'QCTF{30dfe9e4228863f2e9c45508753a9c84}', 'QCTF{a12aa8fdacf39cdf8d031ebb1141ade5}', 'QCTF{3114013f1aea003dc644cd686be073f7}', 'QCTF{c959542546b08485d4c76c6df9034c32}', 'QCTF{4fa407b4fe6f3be4afec15c10e5b60b5}', 'QCTF{b8bac3402e1ae6e42353eb0dbb6e1187}', 'QCTF{71ea738f80df88fe27c7952ee0a08fe9}', 'QCTF{52ef2660af4c18564e75e0421e7be56e}', 'QCTF{41088927caebd4c35d6a5c8c45876ae5}', 'QCTF{90afac1d3e10fa71d8d554c6584cc157}', 'QCTF{6c4f93cd891d991a5f6d21baee73b1a8}', 'QCTF{2fb6f9546cd09b2406f9b9aa0045b4b7}', 'QCTF{1aa150bac71e54372ca54ca412c11f40}', 'QCTF{e0a712bf6d89c9871e833bd936aac979}', 'QCTF{de50d0d2811dd9cb41a633a2f250b680}', 'QCTF{0bb67bdba8a748ddd1968ac66cf5c075}', 'QCTF{661133e4774d75ab7534f967dfe1b78c}', 'QCTF{7edf018896320cf9599a5c13fb3af3a8}', 'QCTF{c976ef4b78ae682d4b854a04f620fb0f}', 'QCTF{4b5436f5f3d9ac23473d4dca41a4dd63}', 'QCTF{d1947ab453f3922436adda4a6716d409}', 'QCTF{162ac50561fae2f9cd40c36e09e24705}', 'QCTF{80fca1b74687d4c0b11313dcf040bbf6}', 'QCTF{f65e11eddbf3cad560ebd96ba4f92461}', 'QCTF{c3b916d43e70181a655b4463ef945661}', 'QCTF{e19df794949bd9d80eef3cb4172dea31}', 'QCTF{a3a759941a10450905b0852b003a82c7}', 'QCTF{533705986a35606e97807ee37ab2c863}', 'QCTF{8aef26a1028de761735a39b27752b9c4}', 'QCTF{70926ffcaf4ff487d0d99fbdf0c78834}', 'QCTF{530cfc0e08a756dcf0f90c2d67c33b40}', 'QCTF{96a2c9e6ca7d6668399c6985d5d2458c}', 'QCTF{6a256384fb72333455da5b04d8495fbe}', 'QCTF{633febe4ec366bc11da19dff3e931521}', 'QCTF{66d6674fec3c7a14cf5c3af6cd467b8e}', 'QCTF{29bfba8ec4e44a5cc33fd099bdb0316b}', 'QCTF{45f3d7645b685042e7e68ad0d309fcec}', 'QCTF{94afe993a0028625d2a22de5c88293e1}', 'QCTF{d272dc01edf11d10730a64cd22827335}', 'QCTF{623cd04ddaccfc4a0d1523bc27bc32ae}', 'QCTF{bf6a6af3f83259e2f66d9b3fce376dce}', 'QCTF{91c134d6a9cd7699ec3a3b5f85a583f0}', 'QCTF{6c85e3fb56c89d62d5fe9e3d27e4a5aa}', 'QCTF{7e4164b2bb4afa5c25682bc4a8c53e66}', 'QCTF{5bc3631a6896269fe77c6bdaf9d27c78}', 'QCTF{6e1b9877716685cac3d549e865a7c85b}', 'QCTF{28fd1487a42cd3e45c98f9876e3c6728}', 'QCTF{6805c31e2276a8daa8826852ca2b0b83}', 'QCTF{2b121dafdfb150cd369e8720b59d82f7}', 'QCTF{ec31421b9f66116a02ca6b773c993358}', 'QCTF{558186ebec8b8653bb18933d198c3ece}', 'QCTF{267b5a5f8bb98b7342148c6106eb2d2c}', 'QCTF{aa38fe9f4141311d709346ead027b507}', 'QCTF{f66f66413048d100ee15c570ac585b13}', 'QCTF{7491e7cd71d16bc2446f3bcf0c92ad2d}', 'QCTF{054c7ac021fbe87042832f8c7bad3a43}', 'QCTF{0fb5425a7fcce56802da00e476347823}', 'QCTF{5299eb9d08eee8fb3f864b999806e88e}', 'QCTF{44c0b9528001db285e167339f84c7e2d}', 'QCTF{397f79c2fedb5281d5ee6662091cbf32}', 'QCTF{741bc53922594cd54deba4c2da166ba5}', 'QCTF{21e2d583596bccdafec4644614841a30}', 'QCTF{61117cdba7b47d2b0b782ebb887b37c9}', 'QCTF{690e749a4c3cc43ca6e9568e48a85f34}', 'QCTF{cf6152c25f81266612090ac7698c10cc}', 'QCTF{56133fb27d94c097e448cd6c54604241}', 'QCTF{9ada31f4d1ee3665867ac40cd576547f}', 'QCTF{fc726ff171101080f64f0a2b06f62264}', 'QCTF{d7dad3c2d7da424d112e3f5685bc3a84}', 'QCTF{71d3e6428dcfc74e4002ed3ad26ed639}', 'QCTF{a0122c5fb3937c487285d0e3051d2d32}', 'QCTF{d456e533f3e963940f17adeb2a898c1f}', 'QCTF{fda977c62519b775fd52b33b7ee3c59d}', 'QCTF{85bb44511da219a6f20706dc232a5036}', 'QCTF{67a79a883ba2bf8eb1905817db7c5455}', 'QCTF{e86fbd286f9a5e507f977fce01d8f546}', 'QCTF{2df725e5277ae0cda2e1b62c670200bb}', 'QCTF{04249a31c87f0bbba3c5d658f8534424}', 'QCTF{9a28f64f49d9e0e3cbd4b9be7d70c389}', 'QCTF{842bb11fa6d69059b8c151a54c2c97f5}', 'QCTF{d426e9a1daa917b243579c1f8fdf8388}', 'QCTF{b8bbd65882ce11f20637d2d66e69c605}', 'QCTF{06756225de4f362c80ecf2aa11e1cf3b}', 'QCTF{0848575c514d3b762f06a8e93dabf370}', 'QCTF{4e9c1a7d8e588a65ef640fed086f417f}', 'QCTF{a52e79bcba9b01a7a07f24b226c12848}', 'QCTF{3d18d085b0e51c6a02daaed5a759930f}', 'QCTF{779194626871433c31f7812157d3b8cb}', 'QCTF{3c3c5107ed05970963fa016b6d6be7eb}', 'QCTF{aa05136c8c46d67cdfc69f47d18aa51b}', 'QCTF{1e85348d600b9019b216f2515beb0945}', 'QCTF{0349bdc14f7ff8b7052c9eb4db1e5a21}', 'QCTF{30dcbb8b9c67edacb4bbed10cb07cc07}', 'QCTF{5b09db09bfaf3a02dc17bfd8771bae8f}', 'QCTF{6e7d07f9c31357ed68590bc24a2ece08}', 'QCTF{d46e9b29270c59845095d97ef9337e95}', 'QCTF{ec118d128f18ca77e0c67d7e66409a7f}', 'QCTF{626af7a6c7005d23b960a02ce128273c}', 'QCTF{05d11133f11f7ea1fa9f009af57f5a57}', 'QCTF{28d876b112787b2ee599929c1f9de7b6}', 'QCTF{100187062f58e52a3b8bd79170b65f8d}', 'QCTF{8b5c6fb2ba52a12763d64631c63ad01c}', 'QCTF{07ffbf77145fd46dc5b19c7464f8e94a}', 'QCTF{8f86963b93b526c663bc51a403a41165}', 'QCTF{eadb09f8f6afc668c3c03976693a7c9e}', 'QCTF{93ddbf8e42e6b4d136bae5d3f1158d70}', 'QCTF{a809ecbc8776a603744cf537e9b71329}', 'QCTF{b75aaea7fabc8f889dc74944c6a4e3c0}', 'QCTF{a416acd8208ccd0f2df531f33d2b6cbe}', 'QCTF{8597e9700045b0dee3fe0a4a2f751af1}', 'QCTF{729f67a65769222200269d1c3efe50f6}', 'QCTF{21f4a9b77d313354bb0951949f559efb}', 'QCTF{6a9d138c62a731982c21a0951cac751f}', 'QCTF{b2a353a1231651b2373e0f4f9863d67c}', 'QCTF{6b8646481367974201ad3763ac09f01b}', 'QCTF{4733d8e51be03a5e7e1421fcb9461946}', 'QCTF{d5671bfab2e102d6ef436310cea556e5}', 'QCTF{fe0dc7f1ad3e3ab1804ac552b5a1014e}', 'QCTF{cd04131fb76d78b75ad4ad3dc241c078}', 'QCTF{b0c3b58624595631a928614c481ef803}', 'QCTF{c3677adad49d8c7b58adcd8d1f41fd8e}', 'QCTF{24dd83a9fa8249b194a53b73f3e12ae8}', 'QCTF{1324a272b619f33ba6c906cd1241cb9a}', 'QCTF{8c4818398ff7e32749c55b19ef965e6e}', 'QCTF{8ee7652cd55d983b708494d85cdba5f2}', 'QCTF{f5601c9718694cfdb754eeb160e77c66}', 'QCTF{4bc1ee7c77ab31f93c314c9cee197d59}', 'QCTF{dfa5bf7ee0a60998035561854ed84677}', 'QCTF{91ff0390d23c0bc1f98d9b19f95cbf93}', 'QCTF{df1135299838932c7b99e8bde9ad8cee}', 'QCTF{056c0210269af051143085248957b3d5}', 'QCTF{6fc42ebaae905d9787d39ad2790b61a5}', 'QCTF{3556c554530023aa02c98a2640a8bacb}', 'QCTF{50a7a712e483aeb523eb00a3a3a4cac6}', 'QCTF{118206c65e16c8314c390914f4a1e59b}', 'QCTF{d456ee30a2399e16f992f9ac2a433d24}', 'QCTF{30a9fb0469aee8878738fa99b7aec8cb}', 'QCTF{b8e518cf71866653f21f4ac241c82d76}', 'QCTF{63117b1c93ec4ff2debd0b0753bb1eb3}', 'QCTF{5665a9accc75c6a1f1882a857c8bbe38}', 'QCTF{565c5a9ece2c891371311c9b0913ddb1}', 'QCTF{8de1cc37b69d6f40bfa2c00fd9e48028}', 'QCTF{50acfa0e810ef4f1cf81462fc77aa8e8}', 'QCTF{33ac115dda168b4eef1a7dc035031e2b}', 'QCTF{e78911a8fc02ed099996bd8e9721dc8d}', 'QCTF{dfe2b8379694a980a3794fd3ce5e61fe}', 'QCTF{eee7da02d350b537783ecead890dd540}', 'QCTF{2aad8accd248b7ca47ae29d5e11f7975}', 'QCTF{8e480455d1e43048616831a59e51fc84}', 'QCTF{986cbb4487b1a8a91ad1827a97bda900}', 'QCTF{48d538cd70bc824dd494562842a24c1b}', 'QCTF{17fa5c186d0bb555c17c7b61f50d0fee}', 'QCTF{9aa99fd3e183fab6071715fb95f2e533}', 'QCTF{58b7096db82c5c7d9ec829abe0a016f3}', 'QCTF{30464a8db4b8f0ae8dc49e8734ed66cb}', 'QCTF{83655c6bd0619b6454ceb273de2d369f}', 'QCTF{72d81a3037fbc8c015bcb0adb87df0db}', 'QCTF{c62bece5781ab571b6ead773f950578c}', 'QCTF{ccd16df0466399ce0424e0102e8bf207}', 'QCTF{9cf7d5815e5bdfccadbb77ffedffa159}', 'QCTF{5ea628391c00c852a73c1a248325cc36}', 'QCTF{8d1daaf1742890409c76c7e5c7496e74}', 'QCTF{19258fe7a929318e6a6c841b54376ea7}', 'QCTF{dc0f86d1e9c1dc1ac4bd4ecad118496b}', 'QCTF{a1a10660a9e023db4803963d0163f915}', 'QCTF{76bdb8507907572d7bba4e53c66b7c94}', 'QCTF{daa9cc55d45641b647449f5a0f4b8431}', 'QCTF{bfa029f704d1f2e81ee9f1ff125d9208}', 'QCTF{356ff001060180459cef071fe033a5f5}', 'QCTF{2b5288c1aad44a9412fcd6bb27dcea7a}', 'QCTF{44172306ed32d70629eace8b445fd894}', 'QCTF{8783ab2b9bc9a89d60c00c715c87c92e}', 'QCTF{a0351089fc58958fb27e55af695bb35e}', 'QCTF{c0de87abadd65ee4e2dba80de610e50a}', 'QCTF{c99b6e9bb5fce478cdc6bca666679c4a}', 'QCTF{0397b5cb327fcc1d94d7edb0f6e1ec15}', 'QCTF{9479a5ca5aef08cacde956246fa2edd3}', 'QCTF{2063acf3a9fd072febe2575151c670cb}', 'QCTF{d6ed4333159c278d22c5527c2a3da633}', 'QCTF{08a811c51b0f0173f0edef63d8326378}', 'QCTF{65dbdc8a0e1b52a07e59248a2e9e456b}', 'QCTF{573a7f0ce4d2cf3e08d452c743fee1ce}', 'QCTF{435089a171f209a66a966e377dba9501}', 'QCTF{81f7f819f6b71eb7720fad3d16dc2373}', 'QCTF{be50a207baaa5e3a491ef7aaeb245abf}', 'QCTF{a996d4647adbc12a69165587a08346e9}', 'QCTF{999d36dee80b90eec6a580cd1f344a08}', 'QCTF{3da3e486913a793a1317da22d8a9a29e}', 'QCTF{809e95f98ba199180cd860ba41d62c5c}', 'QCTF{67524c5080a8b674dcf064494ef7c70f}', 'QCTF{cefcc52f59a484f62b7ba7e62e88e06f}', 'QCTF{241cdfbf606848c9f67589bf2f269206}', 'QCTF{efc924775d7b859411f3bf5a61e85a07}', 'QCTF{63b4e85e20331f52a187318ba2edfd7a}', 'QCTF{a65f5925508331f0b8deda5f67781bc5}', 'QCTF{356ed7e0ab149db06806cc0e6ca6fd5f}', 'QCTF{304d3a7970cf4717dccf3dffbed06874}', 'QCTF{99a747c8723a889bdea5e4f283c20df7}', 'QCTF{c8d7f74205797b602d25852caad49fb1}', 'QCTF{b9248c3a252601dd106d9c0462a9bab7}', 'QCTF{ea86b2a12458a6990d5bae35a73168a0}', 'QCTF{1ca4ecbf8f4ea2d0e2b832c44746ec3b}', 'QCTF{59ee4bf3aedc20d469e788486a9ead6c}', 'QCTF{73720bdd5a424570e5be571021dc4fb8}', 'QCTF{8c04511bedfe9f8c388e4d2f8aba1be5}', 'QCTF{98e34760371fa91407546ba8ac379c09}', 'QCTF{d33cb59a700fb8521a8cb5471048e15e}', 'QCTF{09d317a825132c255ea11c1f41aab1f3}', 'QCTF{a3850a970f2330d1ff6d704061967318}', 'QCTF{93ad167555f15f0901b729f488fc7720}', 'QCTF{61fd9c59cfe8c20d90649bec48424ea1}', 'QCTF{bedf1e7e966f54474931e8cfd141a6ca}', 'QCTF{5ad8a1ce7ec8ab9cdc05553cfd306382}', 'QCTF{3320b3f0490d0949786a894b7f621746}', 'QCTF{57d1dc2f73193dca32535a48650b3a66}', 'QCTF{5c48d6bbfd4fb91d63f21cbe99ece20b}', 'QCTF{2cacdb709e0c230b54e732829b514f92}', 'QCTF{079d0cf77acaebbdbbe8037a35bba5d7}', 'QCTF{d87badd74be817e6acb63d64ecc05ac8}', 'QCTF{f67dffa3ee05d9f096b45c37895d7629}', 'QCTF{1bf708a5a3c9ef47ca7eb8138a052d1b}', 'QCTF{1adf18338f26d19b22f63a4e8eec6e91}', 'QCTF{870d781a223a9112cbb2fb5548e10906}', 'QCTF{8851c98297c5a74ac40cf59875186bd8}', 'QCTF{f83377875176bed6b33e06e9896edded}', 'QCTF{1715727cbb24140bacd2838fc0199bc4}', 'QCTF{c77578152cc09addb4751158bccc7fea}', 'QCTF{7155fb7eb62e6c78ddf3ec44375d3fa9}', 'QCTF{57214d23681056a6596f75372e5cd41b}', 'QCTF{92dcab5e2109673b56d7dc07897055bd}', 'QCTF{131bb9ead4a7d0eb7d2f5540f4929c2d}', 'QCTF{e436dc01fa926f4e48f6920c69c2f54c}', 'QCTF{4b7d2c9245bd28d9c783863ab43202be}', 'QCTF{e23e27790ea55f3093b40d7fdf21b821}', 'QCTF{93e2f15ce929e3d6508543d4378735c3}', 'QCTF{0a18798c331b7f4b4dd14fad01ca3b1f}', 'QCTF{cde9927b04feeaa0f876cecb9e0268e3}', 'QCTF{ba6c8af3c6e58b74438dbf6a04c13258}', 'QCTF{72212e5eb60e430f6ff39f8c2d1ba70d}', 'QCTF{3912316e516adab7e9dfbe5e32c2e8cc}', 'QCTF{960dce50df3f583043cddf4b86b20217}', 'QCTF{6cd9ea76bf5a071ab53053a485c0911a}', 'QCTF{36300e6a9421da59e6fdeefffd64bd50}', 'QCTF{5c3e73a3187dc242b8b538cae5a37e6f}', 'QCTF{9744c67d417a22b7fe1733a54bb0e344}', 'QCTF{28d249578bf8facdf7240b860c4f3ae0}', 'QCTF{a1e9913a8b4b75dd095db103f0287079}', 'QCTF{c4f0f3deafa52c3314fd4542a634933c}', 'QCTF{35a39749f9bea6c90a45fd3e8cc88ca5}', 'QCTF{755cb7e40752b07ed04b12c59b9ce656}', 'QCTF{89e8208c492574de6735b0b5fbe471f5}', 'QCTF{a242f710bd67754b594969a449119434}', 'QCTF{26ded88b4d6b4d9278148de9c911cfb6}', 'QCTF{b6ac8ca7cfd8f3dc075f5f086def5ea2}', 'QCTF{27bb11fe3208f50caafe37b0bd90f070}', 'QCTF{5f058bf0d3991227b49980b9e226c548}', 'QCTF{9fb934712199835ad48f097e5adedbf1}', 'QCTF{8acd08daa256cda637666543042d8d04}', 'QCTF{f19749ece3b079f28397fc6dafc7c5f8}', 'QCTF{8df2b36bc88bdd6419312a3b1e918ac4}', 'QCTF{3f853785bb79075c902c1fcb86b72db8}', 'QCTF{26950b99d1de657f1840f3b1efd117f9}', 'QCTF{57a0747d5a0e9d621b15efc07c721c47}', 'QCTF{164847eb1667c64c70d835cdfa2fed13}', 'QCTF{aeb04f7e9be0e8fb15ec608e93abf7c6}', 'QCTF{f65a2292ea6c9f731fde36f5f92403dc}', 'QCTF{9cff82f318a13f072dadb63e47a16823}', 'QCTF{6a0a50e5f4b8a5878ec6e5e32b8aa4f3}', 'QCTF{9439eb494febbcb498417bab268786f3}', 'QCTF{68a4215f9d77de4875958d2129b98c3e}', 'QCTF{bf83c9d150ed6777d6f2b5581ce75bf1}', 'QCTF{7c6530f3d07598d62a3566173f2cc4a1}', 'QCTF{9dd20e6699b5c69f432914b0196b5b17}', 'QCTF{3a675c1934b1f44b5b73bfd8cee887b9}', 'QCTF{b5e67c6f319acdfed3c47a280f871c7e}', 'QCTF{b88dad61f68da779fad66fa4442eb337}', 'QCTF{3af8a9807a6d0e4b50c1687c07c1d891}', 'QCTF{e78168930647856b94840ce84fab26b4}', 'QCTF{ab88b2ea7e66dd35bdff4d03a15d3dc1}', 'QCTF{78e20f8707184aea4227c98107c95fdb}', 'QCTF{f1b279cc0839c830e07f6e73bb9654fe}', 'QCTF{71fc41f44593348bb1e4a0938526f0f9}', 'QCTF{f8b9207f02330a7d9a762ab4c1cace2b}', 'QCTF{12efdafbe2e29645abc3296178891ed6}', 'QCTF{c5d813b31a0534341a1c4b64e554c488}', 'QCTF{1a63a760f782eecf21234c815b5748bf}', 'QCTF{b6dee11cd1b0382986738826a5c04d7a}', 'QCTF{0d0d99976206194e426b95873720a440}', 'QCTF{d4030405263f8eec80a3855ba066eb76}', 'QCTF{c249cd1f9f86aa5ff2fe0e94da247578}', 'QCTF{ba8adfd031159e41cbfb26193b2aeee1}', 'QCTF{14dc10f84625fc031dd5cdad7b6a82af}', 'QCTF{be7c2d83d34846ece6fe5f25f0700f74}', 'QCTF{d7f1d87ad0386f695cd022617bf134d8}', 'QCTF{6a3a915957dbcd817876854902f30a6a}', 'QCTF{4663ffd40db950abddb4d09122eb1dcd}', 'QCTF{f72c028fdfeb0c42e3d311295ac42ff2}', 'QCTF{901b065b0d0569f161f0ba7f1cc711bc}', 'QCTF{8f707798947c3335d685d7e3b761c2c4}', 'QCTF{746ffa1fc14609d13dde8d540c5d402a}', 'QCTF{1b92b1e84712dd9084dea96e9f67c659}', 'QCTF{2d8976f6ef6da5b843823940660be68a}', 'QCTF{d1e00391c9bd7c2ecc2b19e6d177e4af}', 'QCTF{cea54a59af20fdfa06c8e8357fec663d}', 'QCTF{1f2b8d5fceea39243fa966d638efc92e}', 'QCTF{0f6faa584c642fc21879f4358fdfb01c}', 'QCTF{acac74237614850fbfbd97410013daa2}', 'QCTF{57fce704c2dbdb5e3034b67a7984bb0c}', 'QCTF{e20bc6c0a13114f7fd29ad9661a946e9}', 'QCTF{92c4dfc79749e9310b7ab64c3d9780d0}', 'QCTF{c6a49485ff92a292f0ae9fca4b1f3314}', 'QCTF{be0f0be2f0fb165a16a62aee2dcd0258}', 'QCTF{052fcc31b1b26484fe9da51fb89ba34d}', 'QCTF{b156eb9c86c03d0fae3c883f5b317dcb}', 'QCTF{ff83da3b5ca61495d0acd623dc2d796e}', 'QCTF{3fce7a6ba38ed1a381dae3686919c902}', 'QCTF{889591a0a7d29579546adaad1d0b5b86}', 'QCTF{9c378d9aa63fca7d5f7f275a9566f264}', 'QCTF{e32a672a6673bc56d8b109952403aae9}', 'QCTF{bc6a3a213102b2dc5f946d5655026352}', 'QCTF{30d04471a675aeeec45b8f6143085f46}', 'QCTF{3b4d06e0c2cd20a177fa277bbbc0a1a2}', 'QCTF{bdf4879a061a3a751f91ece53657a53e}', 'QCTF{d8721fc7d32499aa692b04d7eacc8624}', 'QCTF{09d3580e9431327fbf4ccc53efb0a970}', 'QCTF{814356913a352dfe15b851e52cc55c0d}', 'QCTF{cd9de5c50a3ffb20ea08cb083004252c}', 'QCTF{79de86d819cfc03ac6b98fbc29fac36d}', 'QCTF{63663214499a85208c4f7dc529c05ea5}', 'QCTF{171798109c343a3303020f0a24259e5e}', 'QCTF{611a9181a1f7c45c6c715e494bccd1b9}', 'QCTF{da4e7cc4b461aaedd1bfc45533723b8a}', 'QCTF{2ea7d755b255a6f5376d22f8113a2cfa}', 'QCTF{2a741c8199e13853f8195613ef037ced}', 'QCTF{1b66523f2b665c3dfea91aece42273d3}', 'QCTF{42a46422d8faa1ec3e768580b2dec713}', 'QCTF{ca9d7ac177d049416354a0fbd76a89b9}', 'QCTF{9bb379b6c775b738069ae0ab7accf2dd}', 'QCTF{bacec59ecbc809f7ab27a9169500883a}', 'QCTF{0ef59b9a33046aa124bb87df30934714}', 'QCTF{1b646109ed4bfa30f29d6666b2090701}', 'QCTF{65727e2ba028dc6e9ac572ed6a6ebc6f}', 'QCTF{784c261a9f564d4387d035ce57b05e3e}', 'QCTF{e68fb87f2cad4a3da5799fc982ec82ff}', 'QCTF{ba003b186368bf16c19c71332a95efee}', 'QCTF{6d695ed5a0c2d04722716210b5bcfda6}', 'QCTF{7eb1c12dc09b138a1d7e40058fa7a04a}', 'QCTF{64a545320b2928f88b6c6c27f34d2e3c}', 'QCTF{8cdf05aeb3fa5bb07157db87d2b45755}', 'QCTF{48f8e1742b60e1734f6580ab654f9b6f}', 'QCTF{fb14f2533750f7849b071c9a286c9529}', 'QCTF{47f7996ec34bf04863272d7fc36a1eb1}', 'QCTF{919f49d2f324ae91956c3d97b727c24a}', 'QCTF{336f9d8d23fbb50810c1c0b549ad13bf}', 'QCTF{b316f48f8ed4443a117b7a8752d062cb}', 'QCTF{ea5818adad537c87ddb9ce339c0bbb84}', 'QCTF{d510dfbd781d15b674c63489f55191b2}', 'QCTF{df1d534fcc36d5049b5b607499a74f75}', 'QCTF{2781aa19764810125b745b001dd09090}', 'QCTF{0920b2f44311ed5239e8c2d90c991417}', 'QCTF{da22adea508dc7d5bc9ec5cd5378ef20}', 'QCTF{30f69464f59bf44cba73e6430591acb9}', 'QCTF{2239ffe2985776b1d459a729035e6105}', 'QCTF{07a3846e68534b08abec6761492dfd7c}', 'QCTF{2876a617fcb9d33b1a457e2a1f22982b}', 'QCTF{76471463a11b3f5830d6c98bdc188410}', 'QCTF{64b115efe8a4acaab08f40e83d174953}', 'QCTF{2b9fece3ca12493fa34027cfe34a827d}', 'QCTF{72ceded3364700e5a163cd1fa809f2b5}', 'QCTF{a52ab44fe70adc1964442347fe0bc389}', 'QCTF{ffb4560d742fd8dae61edda32628d5d9}', 'QCTF{fe274231e80419937813cbd55441f8b5}', 'QCTF{38ec71804dca70480b9714ae809bf843}', 'QCTF{2876bb27e398963331099a10e9c1b5b1}', 'QCTF{c8eacb1f0f7ea7a130fe97aa903bc52d}', 'QCTF{91d895637bf21849d8ac97072d9aa66c}', 'QCTF{487a3428ab723d4e9bca30342180612a}', 'QCTF{0ca2e9a4b4fb5298b84a2ae097303615}', 'QCTF{1017c0fad5211fa1a8bd05e2c12e1ab5}', 'QCTF{0772fc3bb68132cc47fc6a26bb23a2eb}', 'QCTF{54808c739cc835327ba82b17dda37765}', 'QCTF{5ba1b7f137a0a269d77db75c1609d015}', 'QCTF{3f59447502e3ccd8db93f57f6b64a869}', 'QCTF{3d33a10890e1797b3518f2032228ef97}', 'QCTF{538226c6e2932fb2c0890fa660707081}', 'QCTF{03dea04fa6f9bf11854a62f92f95028c}', 'QCTF{7ebbc2f97c8e02947eb7537e6e35bf4d}', 'QCTF{7fabc82da5e59469a31d6ae73b0ba8dd}', 'QCTF{99d11087195ac95f9a4bf220346c7ae8}', 'QCTF{6ba3b8dff5b591a308616a485802eb1a}', 'QCTF{73e10bd2e77da35988a91f2b39ba4032}', 'QCTF{d41e8b2244e4e72a04f5229bc61e0a4a}', 'QCTF{1f1c22d0e0dcf0d73b5562f604805060}', 'QCTF{e45fba7380d70df6de5353f6bd1326df}', 'QCTF{c4eb636d6329e437d2ece74b439d905b}', 'QCTF{166f03d5b2a6172ebdfe62790d40ea08}', 'QCTF{c9e2d3fed043ae7ff086944ddb92a595}', 'QCTF{c3683790714524bf741f442cf6f75816}', 'QCTF{c3552856294a7c882abe5bfeb08d40b3}', 'QCTF{2028f8e09d41c758c78b5f1bff9a7730}', 'QCTF{7b28486de1bf56b716f77ab14ac1dc2f}', 'QCTF{e445025dcc35e0f7ad5ffc4c1f736857}', 'QCTF{c977b87449d7461cd45ec2b076754b77}', 'QCTF{9626d8f7759943dedefedffc96ac2489}', 'QCTF{52af66f7f1005968a3057ca76c69b488}', 'QCTF{f7791cfb47893204998bc864a0454767}', 'QCTF{c1325f2049b792f8330ab51d8012138a}', 'QCTF{e6e088ba12752fb97aadaa34ab41b118}', 'QCTF{41051ffcbd702005b7f5c4bae392bb4a}', 'QCTF{58bfe4a9f82ae56f4fab8f2d57470f2f}', 'QCTF{a0ac496ce45f06890c045235eb2547a7}', 'QCTF{0c22482b6a4533ba449d4ec1762494ba}', 'QCTF{4466193f2c65c5d072ecb82277657780}', 'QCTF{43689b43469374eb768fb5d4269be92a}', 'QCTF{e31ff94e5ee5638e7b3c0cde3c2b50dd}', 'QCTF{4cc47b59341b7f0112ba8f4dbdda527c}', 'QCTF{e11501e1bb7da841a2c715eafedccb55}', 'QCTF{6acd2208d0d86fcb796cf8264973fee6}', 'QCTF{d8ee1b7b2772d6aea857929d10fbca8e}', 'QCTF{8c27329ebfdef6480d0c60393a573137}', 'QCTF{b9f5190eb71ca8203f60e2a1a6a652af}', 'QCTF{7e5aa6d503c4c2c944a8148fdf633694}', 'QCTF{9ddcb0e99371e60bbb6cbcae87899fc5}', 'QCTF{e7e75d8e6a4789ea242ece7be93bfc89}', 'QCTF{86546326f5bf721792154c91ede0656d}', 'QCTF{6d36f257d24ee06cc402c3b125d5eaa7}'] def check(attempt, context): if attempt.answer == flags[attempt.participant.id % len(flags)]: return checked(True) if attempt.answer in flags: return checked_plagiarist(False, flags.index(attempt.answer)) return checked(False)
#!/usr/bin/python3.5 def fib(n: int): fibs = [1, 1] for _ in range(max(n-2, 0)): fibs.append(fibs[-1] + fibs[-2]) return fibs[n-1] print("%s" % fib(38))
def fib(n: int): fibs = [1, 1] for _ in range(max(n - 2, 0)): fibs.append(fibs[-1] + fibs[-2]) return fibs[n - 1] print('%s' % fib(38))
# coding=utf8 class Error(Exception): pass class TitleRequiredError(Error): pass class TextRequiredError(Error): pass class APITokenRequiredError(Error): pass class GetImageRequestError(Error): pass class ImageUploadHTTPError(Error): pass class FileTypeNotSupported(Error): pass class TelegraphUnknownError(Error): pass class TelegraphPageSaveFailed(Error): # reason is unknown pass class TelegraphContentTooBigError(Error): def __init__(self, message): message += ". Max size is 64kb including markup" super(Error, TelegraphError).__init__(self, message) class TelegraphFloodWaitError(Error): def __init__(self, message): super(Error, TelegraphError).__init__(self, message) self.FLOOD_WAIT_IN_SECONDS = int(message.split('FLOOD_WAIT_')[1]) class TelegraphError(Error): def __init__(self, message): if 'Unknown error' in message: raise TelegraphUnknownError(message) elif 'Content is too big' in message: raise TelegraphContentTooBigError(message) elif 'FLOOD_WAIT_' in message: raise TelegraphFloodWaitError(message) elif 'PAGE_SAVE_FAILED' in message: raise TelegraphPageSaveFailed(message) else: super(Error, TelegraphError).__init__(self, message)
class Error(Exception): pass class Titlerequirederror(Error): pass class Textrequirederror(Error): pass class Apitokenrequirederror(Error): pass class Getimagerequesterror(Error): pass class Imageuploadhttperror(Error): pass class Filetypenotsupported(Error): pass class Telegraphunknownerror(Error): pass class Telegraphpagesavefailed(Error): pass class Telegraphcontenttoobigerror(Error): def __init__(self, message): message += '. Max size is 64kb including markup' super(Error, TelegraphError).__init__(self, message) class Telegraphfloodwaiterror(Error): def __init__(self, message): super(Error, TelegraphError).__init__(self, message) self.FLOOD_WAIT_IN_SECONDS = int(message.split('FLOOD_WAIT_')[1]) class Telegrapherror(Error): def __init__(self, message): if 'Unknown error' in message: raise telegraph_unknown_error(message) elif 'Content is too big' in message: raise telegraph_content_too_big_error(message) elif 'FLOOD_WAIT_' in message: raise telegraph_flood_wait_error(message) elif 'PAGE_SAVE_FAILED' in message: raise telegraph_page_save_failed(message) else: super(Error, TelegraphError).__init__(self, message)
class Tree(object): def __init__(self): self.children = [] self.metadata = [] def add_child(self, leaf): self.children.append(leaf) def add_metadata(self, metadata): self.metadata.append(metadata) def sum_metadata(self): metasum = sum(self.metadata) for c in self.children: metasum += c.sum_metadata() return metasum def sum_tree(self): child_count = len(self.children) if child_count > 0: metasum = 0 for x in self.metadata: if 0 < x <= child_count: metasum += self.children[x - 1].sum_tree() else: metasum = self.sum_metadata() return metasum class Datapump(object): def __init__(self, data): self.data = data self.point = 0 def __iter__(self): return self def __next__(self): if self.point < len(self.data): res, self.point = self.data[self.point], self.point + 1 return res else: raise StopIteration() def next(self): return self.__next__() def parse_tree(tree_data): leaf = Tree() children = tree_data.next() metadata = tree_data.next() for _ in range(children): leaf.add_child(parse_tree(tree_data)) for _ in range(metadata): leaf.add_metadata(tree_data.next()) return leaf def memory_maneuver_part_1(inp): datapump = Datapump([int(i) for i in inp[0].split()]) tree = parse_tree(datapump) return tree.sum_metadata() def memory_maneuver_part_2(inp): datapump = Datapump([int(i) for i in inp[0].split()]) tree = parse_tree(datapump) return tree.sum_tree() if __name__ == '__main__': with open('input.txt') as license_file: license_lines = license_file.read().splitlines(keepends=False) print(f'Day 8, part 1: {memory_maneuver_part_1(license_lines)}') print(f'Day 8, part 2: {memory_maneuver_part_2(license_lines)}') # Day 8, part 1: 45618 # Day 8, part 2: 22306
class Tree(object): def __init__(self): self.children = [] self.metadata = [] def add_child(self, leaf): self.children.append(leaf) def add_metadata(self, metadata): self.metadata.append(metadata) def sum_metadata(self): metasum = sum(self.metadata) for c in self.children: metasum += c.sum_metadata() return metasum def sum_tree(self): child_count = len(self.children) if child_count > 0: metasum = 0 for x in self.metadata: if 0 < x <= child_count: metasum += self.children[x - 1].sum_tree() else: metasum = self.sum_metadata() return metasum class Datapump(object): def __init__(self, data): self.data = data self.point = 0 def __iter__(self): return self def __next__(self): if self.point < len(self.data): (res, self.point) = (self.data[self.point], self.point + 1) return res else: raise stop_iteration() def next(self): return self.__next__() def parse_tree(tree_data): leaf = tree() children = tree_data.next() metadata = tree_data.next() for _ in range(children): leaf.add_child(parse_tree(tree_data)) for _ in range(metadata): leaf.add_metadata(tree_data.next()) return leaf def memory_maneuver_part_1(inp): datapump = datapump([int(i) for i in inp[0].split()]) tree = parse_tree(datapump) return tree.sum_metadata() def memory_maneuver_part_2(inp): datapump = datapump([int(i) for i in inp[0].split()]) tree = parse_tree(datapump) return tree.sum_tree() if __name__ == '__main__': with open('input.txt') as license_file: license_lines = license_file.read().splitlines(keepends=False) print(f'Day 8, part 1: {memory_maneuver_part_1(license_lines)}') print(f'Day 8, part 2: {memory_maneuver_part_2(license_lines)}')
print("RENTAL MOBIL ABCD") print("-------------------------------") #Input nama = input("Masukkan Nama Anda : ") umur = int(input("Masukkan Umur Anda : ")) if umur < 18: print("Maaf", nama, "anda belum bisa meminjam kendaraan") else: ktp = int(input("Masukkan Nomor KTP Anda : ")) k_mobil = input("Kategori Mobil [4/6/8 orang] : ") if k_mobil == "4" : kapasitasmobil = "4 orang" harga = 300000 elif k_mobil == "6" : kapasitasmobil = "6 orang" harga = 350000 else: kapasitasmobil = "8 orang" harga = 500000 jam = int(input("Masukkan Durasi Peminjaman (dalam hari): ")) if jam > 6: diskon = (jam*harga)*0.1 else: diskon = 0 total = (jam*harga) print("-------------------------------") print("RENTAL MOBIL ABCD") print("-------------------------------") print("Masukkan Nama Anda : "+str(nama)) print("Masukkan Umur Anda : "+str(umur)) print("Masukkan Nomor KTP Anda : "+str(ktp)) print("Kapasitas Mobil : "+str(k_mobil)) print("Harga : ",+(harga)) print("Potongan yang didapat : ",+(diskon)) print("-------------------------------") print("Total Bayar : ",+(total))
print('RENTAL MOBIL ABCD') print('-------------------------------') nama = input('Masukkan Nama Anda : ') umur = int(input('Masukkan Umur Anda : ')) if umur < 18: print('Maaf', nama, 'anda belum bisa meminjam kendaraan') else: ktp = int(input('Masukkan Nomor KTP Anda : ')) k_mobil = input('Kategori Mobil [4/6/8 orang] : ') if k_mobil == '4': kapasitasmobil = '4 orang' harga = 300000 elif k_mobil == '6': kapasitasmobil = '6 orang' harga = 350000 else: kapasitasmobil = '8 orang' harga = 500000 jam = int(input('Masukkan Durasi Peminjaman (dalam hari): ')) if jam > 6: diskon = jam * harga * 0.1 else: diskon = 0 total = jam * harga print('-------------------------------') print('RENTAL MOBIL ABCD') print('-------------------------------') print('Masukkan Nama Anda : ' + str(nama)) print('Masukkan Umur Anda : ' + str(umur)) print('Masukkan Nomor KTP Anda : ' + str(ktp)) print('Kapasitas Mobil : ' + str(k_mobil)) print('Harga : ', +harga) print('Potongan yang didapat : ', +diskon) print('-------------------------------') print('Total Bayar : ', +total)
def func_that_raises(): raise ValueError('Error message') def func_no_catch(): func_that_raises()
def func_that_raises(): raise value_error('Error message') def func_no_catch(): func_that_raises()
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2016-2017 JiNong Inc. All right reserved. # __title__ = 'python-pyjns' __version__ = '0.40' __author__ = 'Kim, JoonYong' __email__ = '[email protected]' __copyright__ = 'Copyright 2016-2017 JiNong Inc.'
__title__ = 'python-pyjns' __version__ = '0.40' __author__ = 'Kim, JoonYong' __email__ = '[email protected]' __copyright__ = 'Copyright 2016-2017 JiNong Inc.'
extensions = [ "cogs.help", "cogs.game_punishments.ban", "cogs.game_punishments.kick", "cogs.game_punishments.unban", "cogs.game_punishments.warn", "cogs.settings.setchannel", "cogs.verification.verify" ]
extensions = ['cogs.help', 'cogs.game_punishments.ban', 'cogs.game_punishments.kick', 'cogs.game_punishments.unban', 'cogs.game_punishments.warn', 'cogs.settings.setchannel', 'cogs.verification.verify']
def __getitem__(self,idx): if idx < self.lastIndex: return self.myArray[idx] else: raise LookupError('index out of bounds') def __setitem__(self,idx,val): if idx < self.lastIndex: self.myArray[idx] = val else: raise LookupError('index out of bounds')
def __getitem__(self, idx): if idx < self.lastIndex: return self.myArray[idx] else: raise lookup_error('index out of bounds') def __setitem__(self, idx, val): if idx < self.lastIndex: self.myArray[idx] = val else: raise lookup_error('index out of bounds')
__author__ = "Amane Katagiri" __contact__ = "[email protected]" __copyright__ = "Copyright (C) 2016 Amane Katagiri" __credits__ = "" __date__ = "2016-12-07" __license__ = "MIT License" __version__ = "0.1.0"
__author__ = 'Amane Katagiri' __contact__ = '[email protected]' __copyright__ = 'Copyright (C) 2016 Amane Katagiri' __credits__ = '' __date__ = '2016-12-07' __license__ = 'MIT License' __version__ = '0.1.0'
example_dict = {} for idx in range(0, 10): example_dict[idx] = idx for key, value in example_dict.items(): formmating = f'key is {key}, value is {value}' print(formmating)
example_dict = {} for idx in range(0, 10): example_dict[idx] = idx for (key, value) in example_dict.items(): formmating = f'key is {key}, value is {value}' print(formmating)
def minimumSwaps(arr): a = dict(enumerate(arr,1)) b = {v:k for k,v in a.items()} count = 0 for i in a: x = a[i] if x!=i: y = b[i] a[y] = x b[x] = y count+=1 return count n = int(input()) arr = list(map(int,input().split())) print(minimumSwaps(arr))
def minimum_swaps(arr): a = dict(enumerate(arr, 1)) b = {v: k for (k, v) in a.items()} count = 0 for i in a: x = a[i] if x != i: y = b[i] a[y] = x b[x] = y count += 1 return count n = int(input()) arr = list(map(int, input().split())) print(minimum_swaps(arr))
def extract_characters(*file): with open("file3.txt") as f: while True: c = f.read(1) if not c: break print(c) extract_characters('file3.txt')
def extract_characters(*file): with open('file3.txt') as f: while True: c = f.read(1) if not c: break print(c) extract_characters('file3.txt')
class MTUError(Exception): pass class MACError(Exception): pass class IPv4AddressError(Exception): pass
class Mtuerror(Exception): pass class Macerror(Exception): pass class Ipv4Addresserror(Exception): pass
def cyclesort(lst): for i in range(len(lst)): if i != lst[i]: n = i while 1: tmp = lst[int(n)] if n != i: lst[int(n)] = last_value lst.log() else: lst[int(n)] = None lst.log() last_value = tmp n = last_value if n == i: lst[int(n)] = last_value lst.log() break
def cyclesort(lst): for i in range(len(lst)): if i != lst[i]: n = i while 1: tmp = lst[int(n)] if n != i: lst[int(n)] = last_value lst.log() else: lst[int(n)] = None lst.log() last_value = tmp n = last_value if n == i: lst[int(n)] = last_value lst.log() break
# game model # - holds global game properties class Game(): def __init__(self, config): self.config = config self.pygame = config.pygame self.screen = self.pygame.display.set_mode( ( self.config.SCREEN_PX_WIDTH, self.config.SCREEN_PX_HEIGHT ) ) self.clock = self.pygame.time.Clock() self.running = True self.restart = True self.updated = [] def initialize(self): self.running = True self.restart = True def get_running(self): return self.running def set_running(self, val): self.running = val def get_restart(self): return self.restart def set_restart(self, val): self.restart = val def init_display(self): self.pygame.display.update()
class Game: def __init__(self, config): self.config = config self.pygame = config.pygame self.screen = self.pygame.display.set_mode((self.config.SCREEN_PX_WIDTH, self.config.SCREEN_PX_HEIGHT)) self.clock = self.pygame.time.Clock() self.running = True self.restart = True self.updated = [] def initialize(self): self.running = True self.restart = True def get_running(self): return self.running def set_running(self, val): self.running = val def get_restart(self): return self.restart def set_restart(self, val): self.restart = val def init_display(self): self.pygame.display.update()
lexicon_dataset = { 'direction': 'north south east west down up left right back', 'verb': 'go stop kill eat', 'stop': 'the in of from at it', 'noun': 'door bear princess cabinet' } def scan(sentence): result = [] words = sentence.split(' ') for word in words: if word.isnumeric(): word = int(word) tuple = (find_word_type(str(word)), word) result.append(tuple) return result def find_word_type(word): if word.isnumeric(): return 'number' for type in lexicon_dataset.keys(): if word in lexicon_dataset[type]: return type return 'error'
lexicon_dataset = {'direction': 'north south east west down up left right back', 'verb': 'go stop kill eat', 'stop': 'the in of from at it', 'noun': 'door bear princess cabinet'} def scan(sentence): result = [] words = sentence.split(' ') for word in words: if word.isnumeric(): word = int(word) tuple = (find_word_type(str(word)), word) result.append(tuple) return result def find_word_type(word): if word.isnumeric(): return 'number' for type in lexicon_dataset.keys(): if word in lexicon_dataset[type]: return type return 'error'
# # PHASE: unused deps checker # # DOCUMENT THIS # load( "@io_bazel_rules_scala//scala/private:rule_impls.bzl", "get_unused_dependency_checker_mode", ) def phase_unused_deps_checker(ctx, p): return get_unused_dependency_checker_mode(ctx)
load('@io_bazel_rules_scala//scala/private:rule_impls.bzl', 'get_unused_dependency_checker_mode') def phase_unused_deps_checker(ctx, p): return get_unused_dependency_checker_mode(ctx)
def merge_sorted_arr(left, right): i = 0 j = 0 new_arr = [] while j < len(right) and i < len(left): if left[i] < right[j]: new_arr.append(left[i]) i += 1 elif right[j] <= left[i]: new_arr.append(right[j]) j += 1 while i < len(left): new_arr.append(left[i]) i += 1 while j < len(right): new_arr.append(right[j]) j += 1 return new_arr def merge_sort(arr): if len(arr) <= 2: return arr pivot = len(arr) // 2 left = merge_sort(arr[:pivot]) right = merge_sort(arr[pivot:]) return merge_sorted_arr(left, right) if __name__ == "__main__": assert merge_sorted_arr([1, 3, 5], [2, 4, 12]) == [1, 2, 3, 4, 5, 12] assert merge_sort([1, 3, 4, 5, 0, 2, 19, 6, 29]) == sorted([1, 3, 4, 5, 0, 2, 19, 6, 29])
def merge_sorted_arr(left, right): i = 0 j = 0 new_arr = [] while j < len(right) and i < len(left): if left[i] < right[j]: new_arr.append(left[i]) i += 1 elif right[j] <= left[i]: new_arr.append(right[j]) j += 1 while i < len(left): new_arr.append(left[i]) i += 1 while j < len(right): new_arr.append(right[j]) j += 1 return new_arr def merge_sort(arr): if len(arr) <= 2: return arr pivot = len(arr) // 2 left = merge_sort(arr[:pivot]) right = merge_sort(arr[pivot:]) return merge_sorted_arr(left, right) if __name__ == '__main__': assert merge_sorted_arr([1, 3, 5], [2, 4, 12]) == [1, 2, 3, 4, 5, 12] assert merge_sort([1, 3, 4, 5, 0, 2, 19, 6, 29]) == sorted([1, 3, 4, 5, 0, 2, 19, 6, 29])
{ "targets": [ { "target_name" : "libtracer", "type" : "static_library", "sources" : [ "./libtracer/basic.observer.cpp", "./libtracer/simple.tracer/simple.tracer.cpp", "./libtracer/annotated.tracer/TrackingExecutor.cpp", "./libtracer/annotated.tracer/BitMap.cpp", "./libtracer/annotated.tracer/annotated.tracer.cpp" ], "include_dirs": [ "./include", "./river.format/include", "<!(echo $RIVER_SDK_DIR)/include/" ], "conditions": [ ["OS==\"linux\"", { "cflags": [ "-g", "-m32", "-std=c++11", "-D__cdecl=''", "-D__stdcall=''" ] } ] ] } ] }
{'targets': [{'target_name': 'libtracer', 'type': 'static_library', 'sources': ['./libtracer/basic.observer.cpp', './libtracer/simple.tracer/simple.tracer.cpp', './libtracer/annotated.tracer/TrackingExecutor.cpp', './libtracer/annotated.tracer/BitMap.cpp', './libtracer/annotated.tracer/annotated.tracer.cpp'], 'include_dirs': ['./include', './river.format/include', '<!(echo $RIVER_SDK_DIR)/include/'], 'conditions': [['OS=="linux"', {'cflags': ['-g', '-m32', '-std=c++11', "-D__cdecl=''", "-D__stdcall=''"]}]]}]}
pet1 = {'name': 'mr.bubbles', "type":'dog', "owner" : 'joe'} pet2 = {'name': 'spot', "type":'cat', "owner" : 'bob'} pet3 = {'name': 'chester', "type":'horse', "owner" : 'chloe'} pets = [pet1, pet2, pet3] for pet in pets: print(pet['name'], pet['type'], pet['owner'])
pet1 = {'name': 'mr.bubbles', 'type': 'dog', 'owner': 'joe'} pet2 = {'name': 'spot', 'type': 'cat', 'owner': 'bob'} pet3 = {'name': 'chester', 'type': 'horse', 'owner': 'chloe'} pets = [pet1, pet2, pet3] for pet in pets: print(pet['name'], pet['type'], pet['owner'])
''' Author: ZHAO Zinan Created: 10. March 2019 1005. Maximize Sum Of Array After K Negations ''' class Solution: def largestSumAfterKNegations(self, A: List[int], K: int) -> int: A.sort() for index, a in enumerate(A): if a <= 0: if K > 0: A[index] = -a K -= 1 if K == 0 or a == 0: return sum(A) else: break A.sort(reverse = True) K = K%2 while(K): A[-K] = -A[-K] K -= 1 return sum(A)
""" Author: ZHAO Zinan Created: 10. March 2019 1005. Maximize Sum Of Array After K Negations """ class Solution: def largest_sum_after_k_negations(self, A: List[int], K: int) -> int: A.sort() for (index, a) in enumerate(A): if a <= 0: if K > 0: A[index] = -a k -= 1 if K == 0 or a == 0: return sum(A) else: break A.sort(reverse=True) k = K % 2 while K: A[-K] = -A[-K] k -= 1 return sum(A)
def main(): N, M = map(int, input().split()) a = list(map(int, input().split())) A = a[-1] def is_ok(mid): last = a[0] count = 1 for i in range(1,N): if a[i] - last >= mid: count += 1 last = a[i] if count >= M: res = True else: res = False return res def bisect(ng, ok): while (abs(ok - ng) > 1): mid = (ok + ng) // 2 if is_ok(mid): ok = mid else: ng = mid return ok ans = bisect(A, 0) print(ans) if __name__=='__main__': main()
def main(): (n, m) = map(int, input().split()) a = list(map(int, input().split())) a = a[-1] def is_ok(mid): last = a[0] count = 1 for i in range(1, N): if a[i] - last >= mid: count += 1 last = a[i] if count >= M: res = True else: res = False return res def bisect(ng, ok): while abs(ok - ng) > 1: mid = (ok + ng) // 2 if is_ok(mid): ok = mid else: ng = mid return ok ans = bisect(A, 0) print(ans) if __name__ == '__main__': main()
class AddOperation: def soma(self, number1, number2): return number1 + number2
class Addoperation: def soma(self, number1, number2): return number1 + number2
GOOGLE_SHEET_URL = ( "https://sheets.googleapis.com/v4/spreadsheets/{sheet_id}/values/{table_name}" ) LOGGING_DICT = { "version": 1, "disable_existing_loggers": False, "formatters": {"standard": {"format": "%(message)s"}}, "handlers": { "file": { "level": "INFO", "class": "logging.handlers.RotatingFileHandler", "filename": "app.log", "maxBytes": 1024 * 1024 * 5, "backupCount": 5, "formatter": "standard", }, "console": { "level": "INFO", "class": "logging.StreamHandler", "stream": "ext://sys.stdout", "formatter": "standard", }, }, "loggers": {}, "root": {"handlers": ["file"], "level": "INFO"}, }
google_sheet_url = 'https://sheets.googleapis.com/v4/spreadsheets/{sheet_id}/values/{table_name}' logging_dict = {'version': 1, 'disable_existing_loggers': False, 'formatters': {'standard': {'format': '%(message)s'}}, 'handlers': {'file': {'level': 'INFO', 'class': 'logging.handlers.RotatingFileHandler', 'filename': 'app.log', 'maxBytes': 1024 * 1024 * 5, 'backupCount': 5, 'formatter': 'standard'}, 'console': {'level': 'INFO', 'class': 'logging.StreamHandler', 'stream': 'ext://sys.stdout', 'formatter': 'standard'}}, 'loggers': {}, 'root': {'handlers': ['file'], 'level': 'INFO'}}
N = int(input()) A = [int(x) for x in input().split()] for i in range(N): for j in range(i, N): A[i], A[j] = A[j], A[i] if sorted(A) == A: print("YES") quit() A[i], A[j] = A[j], A[i] print("NO")
n = int(input()) a = [int(x) for x in input().split()] for i in range(N): for j in range(i, N): (A[i], A[j]) = (A[j], A[i]) if sorted(A) == A: print('YES') quit() (A[i], A[j]) = (A[j], A[i]) print('NO')
def add_time(start, duration, start_day = ""): new_time = "" #24h_hours = 0 # If a user added a starting day, correct the input to be lower if start_day: start_day = start_day.lower() if start_day == 'monday': start_day_num = 0 elif start_day == 'tuesday': start_day_num = 1 elif start_day == 'wednesday': start_day_num = 2 elif start_day == 'thursday': start_day_num = 3 elif start_day == 'friday': start_day_num = 4 elif start_day == 'saturday': start_day_num = 5 elif start_day == 'sunday': start_day_num = 6 else: start_day_num = -1 #segmenting out the starting time into hours, mins and the AM or PM AM_PM = start.split()[1].upper() start_hours = (start.split()[0]).split(':')[0] start_mins = (start.split()[0]).split(':')[1] duration_hours = duration.split(':')[0] duration_mins = duration.split(':')[1] mins_24h = int(start_mins) + int(duration_mins) # Total any multiples of 60 in the mins section over to hours, add 12 hours if we start in the PM (to convert to the 24h time) and add the duration hours hours_24h = int(start_hours) + (12 * (1 if AM_PM == 'PM' else 0)) + (mins_24h//60) + int(duration_hours) #print("hours" + str(hours_24h)) #after adding the excess mins to the hours, make the mins equal to only the leftover mins mins_24h = mins_24h%60 #print("mins" + str(mins_24h)) #make a days count for the "days later" section days_24h = hours_24h//24 #print("mins" + str(days_24h)) #make the hours 24h equal to the remaining hours after removing the number of days hours_24h = hours_24h%24 #convert the 24h back into 12h display AM_PM_12h = ("PM" if hours_24h >= 12 else "AM") hours_12h = ((hours_24h - 12) if AM_PM_12h == "PM" else hours_24h) #account for edge case of midnight if hours_12h == 0: hours_12h += 12 mins_12h = mins_24h #construct time part of new_time new_time = str(hours_12h) + ":" + str(mins_12h).rjust(2,"0") + " " + AM_PM_12h #add the days past to the day it currently is and remove the multiples of 7 from the total to get the remaining value and thus what day it currently is. convert to string. if start_day_num >= 0: end_day_num_12h = ((start_day_num + days_24h)%7) if end_day_num_12h == 0: new_time += ", " + "Monday" elif end_day_num_12h == 1: new_time += ", " + "Tuesday" elif end_day_num_12h == 2: new_time += ", " + "wednesday" elif end_day_num_12h == 3: new_time += ", " + "Thursday" elif end_day_num_12h == 4: new_time += ", " + "Friday" elif end_day_num_12h == 5: new_time += ", " + "Saturday" elif end_day_num_12h == 6: new_time += ", " + "Sunday" #append next day/days later information if days_24h == 1: new_time += " (next day)" elif days_24h > 1: new_time += " (" + str(days_24h) + " days later)" return new_time
def add_time(start, duration, start_day=''): new_time = '' if start_day: start_day = start_day.lower() if start_day == 'monday': start_day_num = 0 elif start_day == 'tuesday': start_day_num = 1 elif start_day == 'wednesday': start_day_num = 2 elif start_day == 'thursday': start_day_num = 3 elif start_day == 'friday': start_day_num = 4 elif start_day == 'saturday': start_day_num = 5 elif start_day == 'sunday': start_day_num = 6 else: start_day_num = -1 am_pm = start.split()[1].upper() start_hours = start.split()[0].split(':')[0] start_mins = start.split()[0].split(':')[1] duration_hours = duration.split(':')[0] duration_mins = duration.split(':')[1] mins_24h = int(start_mins) + int(duration_mins) hours_24h = int(start_hours) + 12 * (1 if AM_PM == 'PM' else 0) + mins_24h // 60 + int(duration_hours) mins_24h = mins_24h % 60 days_24h = hours_24h // 24 hours_24h = hours_24h % 24 am_pm_12h = 'PM' if hours_24h >= 12 else 'AM' hours_12h = hours_24h - 12 if AM_PM_12h == 'PM' else hours_24h if hours_12h == 0: hours_12h += 12 mins_12h = mins_24h new_time = str(hours_12h) + ':' + str(mins_12h).rjust(2, '0') + ' ' + AM_PM_12h if start_day_num >= 0: end_day_num_12h = (start_day_num + days_24h) % 7 if end_day_num_12h == 0: new_time += ', ' + 'Monday' elif end_day_num_12h == 1: new_time += ', ' + 'Tuesday' elif end_day_num_12h == 2: new_time += ', ' + 'wednesday' elif end_day_num_12h == 3: new_time += ', ' + 'Thursday' elif end_day_num_12h == 4: new_time += ', ' + 'Friday' elif end_day_num_12h == 5: new_time += ', ' + 'Saturday' elif end_day_num_12h == 6: new_time += ', ' + 'Sunday' if days_24h == 1: new_time += ' (next day)' elif days_24h > 1: new_time += ' (' + str(days_24h) + ' days later)' return new_time
n1 = 36 n2 = 14 m = max(n1, n2) lcm = n1 * n2 rng = range(m, n1*n2+1) for i in rng: if i % n1 == 0 and i % n2 == 0: print("The lcm is " + str(i)) break
n1 = 36 n2 = 14 m = max(n1, n2) lcm = n1 * n2 rng = range(m, n1 * n2 + 1) for i in rng: if i % n1 == 0 and i % n2 == 0: print('The lcm is ' + str(i)) break
# take linear julia list of lists and convert to julia array format execfile('../pyprgs/in_out_line.py') execfile('../pyprgs/in_out_csv.py') dat1 = lin.reader("../poets/results_poets/cross_validation/EC1.dat") dat2 = lin.reader("../poets/results_poets/cross_validation/EC2.dat") dat3 = lin.reader("../poets/results_poets/cross_validation/EC3.dat") dat4 = lin.reader("../poets/results_poets/cross_validation/EC4.dat") dat5 = lin.reader("../poets/results_poets/cross_validation/EC5.dat") dat6 = lin.reader("../poets/results_poets/cross_validation/EC6.dat") dat7 = lin.reader("../poets/results_poets/cross_validation/EC7.dat") dat8 = lin.reader("../poets/results_poets/cross_validation/EC8.dat") dat9 = lin.reader("../poets/results_poets/cross_validation/EC9.dat") dat10 = lin.reader("../poets/results_poets/cross_validation/EC10.dat") dat11 = lin.reader("../poets/results_poets/cross_validation/EC11.dat") # map X1 (size e.g. 772) to x1 within x2 from X2 (size 11) def julia_listlist_to_array(dat): dat_new = [[],[],[],[],[],[],[],[],[],[],[]] # number of objectives (x2space) counter = 0 for LINE in dat: if LINE.count('[') == 1: counter = 0 dat_new[counter].append(LINE.replace('[','').replace(']','')) counter = counter + 1 outlines = [] for LIST in dat_new: outlines.append('\t'.join(LIST)) return outlines outlines = julia_listlist_to_array(dat1) lin.writer("../poets/results_poets/cross_validation/EC1_jl_array.dat",outlines) outlines = julia_listlist_to_array(dat2) lin.writer("../poets/results_poets/cross_validation/EC2_jl_array.dat",outlines) outlines = julia_listlist_to_array(dat3) lin.writer("../poets/results_poets/cross_validation/EC3_jl_array.dat",outlines) outlines = julia_listlist_to_array(dat4) lin.writer("../poets/results_poets/cross_validation/EC4_jl_array.dat",outlines) outlines = julia_listlist_to_array(dat5) lin.writer("../poets/results_poets/cross_validation/EC5_jl_array.dat",outlines) outlines = julia_listlist_to_array(dat6) lin.writer("../poets/results_poets/cross_validation/EC6_jl_array.dat",outlines) outlines = julia_listlist_to_array(dat7) lin.writer("../poets/results_poets/cross_validation/EC7_jl_array.dat",outlines) outlines = julia_listlist_to_array(dat8) lin.writer("../poets/results_poets/cross_validation/EC8_jl_array.dat",outlines) outlines = julia_listlist_to_array(dat9) lin.writer("../poets/results_poets/cross_validation/EC9_jl_array.dat",outlines) outlines = julia_listlist_to_array(dat10) lin.writer("../poets/results_poets/cross_validation/EC10_jl_array.dat",outlines) outlines = julia_listlist_to_array(dat11) lin.writer("../poets/results_poets/cross_validation/EC11_jl_array.dat",outlines) # need to reformat random as well datr = lin.reader("../poets/results_poets/random_set/EC.dat") outlines = julia_listlist_to_array(datr) lin.writer("../poets/results_poets/random_set/EC_jl_array.dat",outlines) datrf = lin.reader("../poets/results_poets/random_set/EC_full.dat") outlines = julia_listlist_to_array(datrf) lin.writer("../poets/results_poets/random_set/EC_full_jl_array.dat",outlines) #for line in dat: # dat_new.append([float(string.replace('[' ,'').replace(']','')) for string in line]) #datx = lin.reader("../poets/results_poets/cross_validation/fold_pop_obj_1/EC.dat")
execfile('../pyprgs/in_out_line.py') execfile('../pyprgs/in_out_csv.py') dat1 = lin.reader('../poets/results_poets/cross_validation/EC1.dat') dat2 = lin.reader('../poets/results_poets/cross_validation/EC2.dat') dat3 = lin.reader('../poets/results_poets/cross_validation/EC3.dat') dat4 = lin.reader('../poets/results_poets/cross_validation/EC4.dat') dat5 = lin.reader('../poets/results_poets/cross_validation/EC5.dat') dat6 = lin.reader('../poets/results_poets/cross_validation/EC6.dat') dat7 = lin.reader('../poets/results_poets/cross_validation/EC7.dat') dat8 = lin.reader('../poets/results_poets/cross_validation/EC8.dat') dat9 = lin.reader('../poets/results_poets/cross_validation/EC9.dat') dat10 = lin.reader('../poets/results_poets/cross_validation/EC10.dat') dat11 = lin.reader('../poets/results_poets/cross_validation/EC11.dat') def julia_listlist_to_array(dat): dat_new = [[], [], [], [], [], [], [], [], [], [], []] counter = 0 for line in dat: if LINE.count('[') == 1: counter = 0 dat_new[counter].append(LINE.replace('[', '').replace(']', '')) counter = counter + 1 outlines = [] for list in dat_new: outlines.append('\t'.join(LIST)) return outlines outlines = julia_listlist_to_array(dat1) lin.writer('../poets/results_poets/cross_validation/EC1_jl_array.dat', outlines) outlines = julia_listlist_to_array(dat2) lin.writer('../poets/results_poets/cross_validation/EC2_jl_array.dat', outlines) outlines = julia_listlist_to_array(dat3) lin.writer('../poets/results_poets/cross_validation/EC3_jl_array.dat', outlines) outlines = julia_listlist_to_array(dat4) lin.writer('../poets/results_poets/cross_validation/EC4_jl_array.dat', outlines) outlines = julia_listlist_to_array(dat5) lin.writer('../poets/results_poets/cross_validation/EC5_jl_array.dat', outlines) outlines = julia_listlist_to_array(dat6) lin.writer('../poets/results_poets/cross_validation/EC6_jl_array.dat', outlines) outlines = julia_listlist_to_array(dat7) lin.writer('../poets/results_poets/cross_validation/EC7_jl_array.dat', outlines) outlines = julia_listlist_to_array(dat8) lin.writer('../poets/results_poets/cross_validation/EC8_jl_array.dat', outlines) outlines = julia_listlist_to_array(dat9) lin.writer('../poets/results_poets/cross_validation/EC9_jl_array.dat', outlines) outlines = julia_listlist_to_array(dat10) lin.writer('../poets/results_poets/cross_validation/EC10_jl_array.dat', outlines) outlines = julia_listlist_to_array(dat11) lin.writer('../poets/results_poets/cross_validation/EC11_jl_array.dat', outlines) datr = lin.reader('../poets/results_poets/random_set/EC.dat') outlines = julia_listlist_to_array(datr) lin.writer('../poets/results_poets/random_set/EC_jl_array.dat', outlines) datrf = lin.reader('../poets/results_poets/random_set/EC_full.dat') outlines = julia_listlist_to_array(datrf) lin.writer('../poets/results_poets/random_set/EC_full_jl_array.dat', outlines)
# Quick Sort # Randomize Pivot to avoid worst case, currently pivot is last element def quickSort(A, si, ei): if si < ei: pi = partition(A, si, ei) quickSort(A, si, pi-1) quickSort(A, pi+1, ei) # Partition # Utility function for partitioning the array(used in quick sort) def partition(A, si, ei): x = A[ei] # x is pivot, last element i = (si-1) for j in range(si, ei): if A[j] <= x: i += 1 A[i], A[j] = A[j], A[i] A[i+1], A[ei] = A[ei], A[i+1] return i+1 #'Alternate Implementation' # Warning --> As this function returns the array itself, assign it to some # variable while calling. Example--> sorted_arr=quicksort(arr) # Quick sort def quicksort(arr): if len(arr) <= 1: return arr pivot = arr[len(arr) / 2] left = [x for x in arr if x < pivot] middle = [x for x in arr if x == pivot] right = [x for x in arr if x > pivot] return quicksort(left) + middle + quicksort(right)
def quick_sort(A, si, ei): if si < ei: pi = partition(A, si, ei) quick_sort(A, si, pi - 1) quick_sort(A, pi + 1, ei) def partition(A, si, ei): x = A[ei] i = si - 1 for j in range(si, ei): if A[j] <= x: i += 1 (A[i], A[j]) = (A[j], A[i]) (A[i + 1], A[ei]) = (A[ei], A[i + 1]) return i + 1 def quicksort(arr): if len(arr) <= 1: return arr pivot = arr[len(arr) / 2] left = [x for x in arr if x < pivot] middle = [x for x in arr if x == pivot] right = [x for x in arr if x > pivot] return quicksort(left) + middle + quicksort(right)
class Proxy(): proxies = [] # Will contain proxies [ip, port] #### adding proxy information so as not to get blocked so fast def getProxyList(self): # Retrieve latest proxies url = 'https://www.sslproxies.org/' header = {'User-Agent': str(ua.random)} response = requests.get(url, headers=header) soup = BeautifulSoup(response.text, 'lxml') proxies_table = soup.find(id='proxylisttable') try: # Save proxies in the array for row in proxies_table.tbody.find_all('tr'): self.proxies.append({ 'ip': row.find_all('td')[0].string, 'port': row.find_all('td')[1].string }) except: print("error in getting proxy from ssl proxies") return proxies def getProxyList2(self,proxies): # Retrieve latest proxies try: url = 'http://list.proxylistplus.com/SSL-List-1' header = {'User-Agent': str(ua.random)} response = requests.get(url, headers=header) soup = BeautifulSoup(response.text, 'lxml') proxies_table = soup.find("table", {"class": "bg"}) #print(proxies_table) # Save proxies in the array for row in proxies_table.find_all("tr", {"class": "cells"}): google = row.find_all('td')[5].string if google == "yes": #print(row.find_all('td')[1].string) self.proxies.append({ 'ip': row.find_all('td')[1].string, 'port': row.find_all('td')[2].string }) except: print("broken") # Choose a random proxy try: url = 'http://list.proxylistplus.com/SSL-List-2' header = {'User-Agent': str(ua.random)} response = requests.get(url, headers=header) soup = BeautifulSoup(response.text, 'lxml') proxies_table = soup.find("table", {"class": "bg"}) # print(proxies_table) # Save proxies in the array for row in proxies_table.find_all("tr", {"class": "cells"}): google = row.find_all('td')[5].string if google == "yes": #print(row.find_all('td')[1].string) self.proxies.append({ 'ip': row.find_all('td')[1].string, 'port': row.find_all('td')[2].string }) except: print("broken") return proxies def getProxy(self): proxies = self.getProxyList() proxies = self.getProxyList2(proxies) proxy = random.choice(proxies) return proxy #### end proxy info added by ML
class Proxy: proxies = [] def get_proxy_list(self): url = 'https://www.sslproxies.org/' header = {'User-Agent': str(ua.random)} response = requests.get(url, headers=header) soup = beautiful_soup(response.text, 'lxml') proxies_table = soup.find(id='proxylisttable') try: for row in proxies_table.tbody.find_all('tr'): self.proxies.append({'ip': row.find_all('td')[0].string, 'port': row.find_all('td')[1].string}) except: print('error in getting proxy from ssl proxies') return proxies def get_proxy_list2(self, proxies): try: url = 'http://list.proxylistplus.com/SSL-List-1' header = {'User-Agent': str(ua.random)} response = requests.get(url, headers=header) soup = beautiful_soup(response.text, 'lxml') proxies_table = soup.find('table', {'class': 'bg'}) for row in proxies_table.find_all('tr', {'class': 'cells'}): google = row.find_all('td')[5].string if google == 'yes': self.proxies.append({'ip': row.find_all('td')[1].string, 'port': row.find_all('td')[2].string}) except: print('broken') try: url = 'http://list.proxylistplus.com/SSL-List-2' header = {'User-Agent': str(ua.random)} response = requests.get(url, headers=header) soup = beautiful_soup(response.text, 'lxml') proxies_table = soup.find('table', {'class': 'bg'}) for row in proxies_table.find_all('tr', {'class': 'cells'}): google = row.find_all('td')[5].string if google == 'yes': self.proxies.append({'ip': row.find_all('td')[1].string, 'port': row.find_all('td')[2].string}) except: print('broken') return proxies def get_proxy(self): proxies = self.getProxyList() proxies = self.getProxyList2(proxies) proxy = random.choice(proxies) return proxy
file = open("nomes.txt", "r") lines = file.readlines() title = lines[0] names = title.strip().split(",") print(names) for i in lines[1:]: aux = i.strip().split(",") print('{}{:>5}{:>8}'.format(aux[0], aux[1], aux[2]))
file = open('nomes.txt', 'r') lines = file.readlines() title = lines[0] names = title.strip().split(',') print(names) for i in lines[1:]: aux = i.strip().split(',') print('{}{:>5}{:>8}'.format(aux[0], aux[1], aux[2]))
x = 50 def funk(): global x print("x je ", x) x = 2 print("Promjena globalne vrijednost promjeljive x na ", x) funk() print("Vrijednost promjeljive x sada je ", x)
x = 50 def funk(): global x print('x je ', x) x = 2 print('Promjena globalne vrijednost promjeljive x na ', x) funk() print('Vrijednost promjeljive x sada je ', x)
# Each new term in the Fibonacci sequence is generated by adding # the previous two terms. By starting with 1 and 2, the first 10 # terms will be: # # 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... # # By considering the terms in the Fibonacci sequence whose values # do not exceed four million, find the sum of the even-valued terms. def fib_sum(limit): return fib_calc(limit,0,1,0) def fib_calc(limit, a, b, accum): if b > limit: return accum else: if b % 2 == 0: accum += b return fib_calc(limit, b, (a+b), accum) if __name__ == "__main__": print(fib_sum(4000000))
def fib_sum(limit): return fib_calc(limit, 0, 1, 0) def fib_calc(limit, a, b, accum): if b > limit: return accum else: if b % 2 == 0: accum += b return fib_calc(limit, b, a + b, accum) if __name__ == '__main__': print(fib_sum(4000000))
def load(h): return ({'abbr': 0, 'code': 0, 'title': 'Gregorian'}, {'abbr': 1, 'code': 1, 'title': '360-day'}, {'abbr': 2, 'code': 2, 'title': '365-day'}, {'abbr': 3, 'code': 3, 'title': 'Proleptic Gregorian'}, {'abbr': None, 'code': 255, 'title': 'Missing'})
def load(h): return ({'abbr': 0, 'code': 0, 'title': 'Gregorian'}, {'abbr': 1, 'code': 1, 'title': '360-day'}, {'abbr': 2, 'code': 2, 'title': '365-day'}, {'abbr': 3, 'code': 3, 'title': 'Proleptic Gregorian'}, {'abbr': None, 'code': 255, 'title': 'Missing'})
# # PySNMP MIB module ZXR10-VSWITCH-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZXR10-VSWITCH-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:42:32 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueSizeConstraint, ValueRangeConstraint, ConstraintsIntersection, SingleValueConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsIntersection", "SingleValueConstraint", "ConstraintsUnion") EntryStatus, = mibBuilder.importSymbols("RMON-MIB", "EntryStatus") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") ModuleIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter64, ObjectIdentity, Unsigned32, iso, MibIdentifier, IpAddress, NotificationType, Integer32, TimeTicks, Counter32, Gauge32, Bits, enterprises = mibBuilder.importSymbols("SNMPv2-SMI", "ModuleIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter64", "ObjectIdentity", "Unsigned32", "iso", "MibIdentifier", "IpAddress", "NotificationType", "Integer32", "TimeTicks", "Counter32", "Gauge32", "Bits", "enterprises") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") zte = MibIdentifier((1, 3, 6, 1, 4, 1, 3902)) zxr10 = MibIdentifier((1, 3, 6, 1, 4, 1, 3902, 3)) zxr10protocol = MibIdentifier((1, 3, 6, 1, 4, 1, 3902, 3, 101)) zxr10vswitch = ModuleIdentity((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4)) if mibBuilder.loadTexts: zxr10vswitch.setLastUpdated('0408031136Z') if mibBuilder.loadTexts: zxr10vswitch.setOrganization('ZXR10 ROS OAM group') class DisplayString(OctetString): pass class VsiwtchTransMode(Integer32): subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2)) namedValues = NamedValues(("ip", 0), ("vlan", 1), ("mix", 2)) class VsiwtchVlanDirection(Integer32): subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1)) namedValues = NamedValues(("intoout", 0), ("both", 1)) zxr10vswitchIfTable = MibTable((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 1), ) if mibBuilder.loadTexts: zxr10vswitchIfTable.setStatus('current') zxr10vswitchIfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 1, 1), ).setIndexNames((0, "ZXR10-VSWITCH-MIB", "zxr10vsiwtchIfIndex")) if mibBuilder.loadTexts: zxr10vswitchIfEntry.setStatus('current') zxr10vsiwtchIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zxr10vsiwtchIfIndex.setStatus('current') zxr10vswitchIfType = MibTableColumn((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 1, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zxr10vswitchIfType.setStatus('current') zxr10vswitchIfTransType = MibTableColumn((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 1, 1, 3), VsiwtchTransMode()).setMaxAccess("readonly") if mibBuilder.loadTexts: zxr10vswitchIfTransType.setStatus('current') zxr10vswitchIfStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 1, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zxr10vswitchIfStatus.setStatus('current') zxr10vswitchIfAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 1, 1, 5), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: zxr10vswitchIfAddr.setStatus('current') zxr10vswitchIfDesc = MibTableColumn((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 1, 1, 6), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readcreate") if mibBuilder.loadTexts: zxr10vswitchIfDesc.setStatus('current') zxr10vswitchIfTableLastchange = MibScalar((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 2), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: zxr10vswitchIfTableLastchange.setStatus('current') zxr10vswitchVlanTable = MibTable((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 3), ) if mibBuilder.loadTexts: zxr10vswitchVlanTable.setStatus('current') zxr10vsiwtchVlanEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 3, 1), ).setIndexNames((0, "ZXR10-VSWITCH-MIB", "zxr10vswitchVlanIngressIfIndex"), (0, "ZXR10-VSWITCH-MIB", "zxr10vswitchVlanIngressExtVlanid")) if mibBuilder.loadTexts: zxr10vsiwtchVlanEntry.setStatus('current') zxr10vswitchVlanIngressExtVlanid = MibTableColumn((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 3, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zxr10vswitchVlanIngressExtVlanid.setStatus('current') zxr10vswitchVlanIngressIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 3, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zxr10vswitchVlanIngressIfIndex.setStatus('current') zxr10vswitchVlanIngressIntVlanid = MibTableColumn((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 3, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zxr10vswitchVlanIngressIntVlanid.setStatus('current') zxr10vswitchVlanEgressExtVlanid = MibTableColumn((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 3, 1, 4), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: zxr10vswitchVlanEgressExtVlanid.setStatus('current') zxr10vswitchVlanEgressIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 3, 1, 5), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: zxr10vswitchVlanEgressIfIndex.setStatus('current') zxr10vswitchVlanEgressIntVlanid = MibTableColumn((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 3, 1, 6), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zxr10vswitchVlanEgressIntVlanid.setStatus('current') zxr10vswitchVlanVlanidRange = MibTableColumn((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 3, 1, 7), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: zxr10vswitchVlanVlanidRange.setStatus('current') zxr10vswitchVlandDirection = MibTableColumn((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 3, 1, 8), VsiwtchVlanDirection()).setMaxAccess("readwrite") if mibBuilder.loadTexts: zxr10vswitchVlandDirection.setStatus('current') zxr10vswitchVlanRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 3, 1, 9), EntryStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: zxr10vswitchVlanRowStatus.setStatus('current') zxr10vswitchVlanDesc = MibTableColumn((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 3, 1, 10), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: zxr10vswitchVlanDesc.setStatus('current') zxr10vswitchVlanTableLastchange = MibScalar((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 4), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: zxr10vswitchVlanTableLastchange.setStatus('current') mibBuilder.exportSymbols("ZXR10-VSWITCH-MIB", zxr10vswitchVlanTable=zxr10vswitchVlanTable, zxr10vswitchVlandDirection=zxr10vswitchVlandDirection, VsiwtchTransMode=VsiwtchTransMode, zxr10vsiwtchIfIndex=zxr10vsiwtchIfIndex, zxr10vswitchIfTableLastchange=zxr10vswitchIfTableLastchange, zxr10vswitchVlanEgressExtVlanid=zxr10vswitchVlanEgressExtVlanid, zxr10vswitchIfStatus=zxr10vswitchIfStatus, zxr10vswitchIfDesc=zxr10vswitchIfDesc, DisplayString=DisplayString, zxr10vswitchIfTransType=zxr10vswitchIfTransType, zte=zte, zxr10vswitchVlanEgressIntVlanid=zxr10vswitchVlanEgressIntVlanid, zxr10vswitch=zxr10vswitch, zxr10vswitchVlanIngressIntVlanid=zxr10vswitchVlanIngressIntVlanid, zxr10vswitchVlanDesc=zxr10vswitchVlanDesc, zxr10vswitchVlanTableLastchange=zxr10vswitchVlanTableLastchange, zxr10vswitchVlanRowStatus=zxr10vswitchVlanRowStatus, zxr10vswitchVlanVlanidRange=zxr10vswitchVlanVlanidRange, VsiwtchVlanDirection=VsiwtchVlanDirection, zxr10protocol=zxr10protocol, zxr10vswitchVlanEgressIfIndex=zxr10vswitchVlanEgressIfIndex, zxr10vswitchIfType=zxr10vswitchIfType, zxr10vswitchIfEntry=zxr10vswitchIfEntry, zxr10vswitchIfAddr=zxr10vswitchIfAddr, zxr10vswitchIfTable=zxr10vswitchIfTable, zxr10=zxr10, PYSNMP_MODULE_ID=zxr10vswitch, zxr10vswitchVlanIngressExtVlanid=zxr10vswitchVlanIngressExtVlanid, zxr10vswitchVlanIngressIfIndex=zxr10vswitchVlanIngressIfIndex, zxr10vsiwtchVlanEntry=zxr10vsiwtchVlanEntry)
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, value_range_constraint, constraints_intersection, single_value_constraint, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueSizeConstraint', 'ValueRangeConstraint', 'ConstraintsIntersection', 'SingleValueConstraint', 'ConstraintsUnion') (entry_status,) = mibBuilder.importSymbols('RMON-MIB', 'EntryStatus') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (module_identity, mib_scalar, mib_table, mib_table_row, mib_table_column, counter64, object_identity, unsigned32, iso, mib_identifier, ip_address, notification_type, integer32, time_ticks, counter32, gauge32, bits, enterprises) = mibBuilder.importSymbols('SNMPv2-SMI', 'ModuleIdentity', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Counter64', 'ObjectIdentity', 'Unsigned32', 'iso', 'MibIdentifier', 'IpAddress', 'NotificationType', 'Integer32', 'TimeTicks', 'Counter32', 'Gauge32', 'Bits', 'enterprises') (display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention') zte = mib_identifier((1, 3, 6, 1, 4, 1, 3902)) zxr10 = mib_identifier((1, 3, 6, 1, 4, 1, 3902, 3)) zxr10protocol = mib_identifier((1, 3, 6, 1, 4, 1, 3902, 3, 101)) zxr10vswitch = module_identity((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4)) if mibBuilder.loadTexts: zxr10vswitch.setLastUpdated('0408031136Z') if mibBuilder.loadTexts: zxr10vswitch.setOrganization('ZXR10 ROS OAM group') class Displaystring(OctetString): pass class Vsiwtchtransmode(Integer32): subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(0, 1, 2)) named_values = named_values(('ip', 0), ('vlan', 1), ('mix', 2)) class Vsiwtchvlandirection(Integer32): subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(0, 1)) named_values = named_values(('intoout', 0), ('both', 1)) zxr10vswitch_if_table = mib_table((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 1)) if mibBuilder.loadTexts: zxr10vswitchIfTable.setStatus('current') zxr10vswitch_if_entry = mib_table_row((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 1, 1)).setIndexNames((0, 'ZXR10-VSWITCH-MIB', 'zxr10vsiwtchIfIndex')) if mibBuilder.loadTexts: zxr10vswitchIfEntry.setStatus('current') zxr10vsiwtch_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 1, 1, 1), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: zxr10vsiwtchIfIndex.setStatus('current') zxr10vswitch_if_type = mib_table_column((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 1, 1, 2), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: zxr10vswitchIfType.setStatus('current') zxr10vswitch_if_trans_type = mib_table_column((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 1, 1, 3), vsiwtch_trans_mode()).setMaxAccess('readonly') if mibBuilder.loadTexts: zxr10vswitchIfTransType.setStatus('current') zxr10vswitch_if_status = mib_table_column((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 1, 1, 4), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: zxr10vswitchIfStatus.setStatus('current') zxr10vswitch_if_addr = mib_table_column((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 1, 1, 5), ip_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: zxr10vswitchIfAddr.setStatus('current') zxr10vswitch_if_desc = mib_table_column((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 1, 1, 6), display_string().subtype(subtypeSpec=value_size_constraint(0, 64))).setMaxAccess('readcreate') if mibBuilder.loadTexts: zxr10vswitchIfDesc.setStatus('current') zxr10vswitch_if_table_lastchange = mib_scalar((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 2), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: zxr10vswitchIfTableLastchange.setStatus('current') zxr10vswitch_vlan_table = mib_table((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 3)) if mibBuilder.loadTexts: zxr10vswitchVlanTable.setStatus('current') zxr10vsiwtch_vlan_entry = mib_table_row((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 3, 1)).setIndexNames((0, 'ZXR10-VSWITCH-MIB', 'zxr10vswitchVlanIngressIfIndex'), (0, 'ZXR10-VSWITCH-MIB', 'zxr10vswitchVlanIngressExtVlanid')) if mibBuilder.loadTexts: zxr10vsiwtchVlanEntry.setStatus('current') zxr10vswitch_vlan_ingress_ext_vlanid = mib_table_column((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 3, 1, 1), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: zxr10vswitchVlanIngressExtVlanid.setStatus('current') zxr10vswitch_vlan_ingress_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 3, 1, 2), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: zxr10vswitchVlanIngressIfIndex.setStatus('current') zxr10vswitch_vlan_ingress_int_vlanid = mib_table_column((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 3, 1, 3), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: zxr10vswitchVlanIngressIntVlanid.setStatus('current') zxr10vswitch_vlan_egress_ext_vlanid = mib_table_column((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 3, 1, 4), integer32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: zxr10vswitchVlanEgressExtVlanid.setStatus('current') zxr10vswitch_vlan_egress_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 3, 1, 5), integer32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: zxr10vswitchVlanEgressIfIndex.setStatus('current') zxr10vswitch_vlan_egress_int_vlanid = mib_table_column((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 3, 1, 6), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: zxr10vswitchVlanEgressIntVlanid.setStatus('current') zxr10vswitch_vlan_vlanid_range = mib_table_column((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 3, 1, 7), integer32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: zxr10vswitchVlanVlanidRange.setStatus('current') zxr10vswitch_vland_direction = mib_table_column((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 3, 1, 8), vsiwtch_vlan_direction()).setMaxAccess('readwrite') if mibBuilder.loadTexts: zxr10vswitchVlandDirection.setStatus('current') zxr10vswitch_vlan_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 3, 1, 9), entry_status()).setMaxAccess('readwrite') if mibBuilder.loadTexts: zxr10vswitchVlanRowStatus.setStatus('current') zxr10vswitch_vlan_desc = mib_table_column((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 3, 1, 10), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: zxr10vswitchVlanDesc.setStatus('current') zxr10vswitch_vlan_table_lastchange = mib_scalar((1, 3, 6, 1, 4, 1, 3902, 3, 101, 4, 4), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: zxr10vswitchVlanTableLastchange.setStatus('current') mibBuilder.exportSymbols('ZXR10-VSWITCH-MIB', zxr10vswitchVlanTable=zxr10vswitchVlanTable, zxr10vswitchVlandDirection=zxr10vswitchVlandDirection, VsiwtchTransMode=VsiwtchTransMode, zxr10vsiwtchIfIndex=zxr10vsiwtchIfIndex, zxr10vswitchIfTableLastchange=zxr10vswitchIfTableLastchange, zxr10vswitchVlanEgressExtVlanid=zxr10vswitchVlanEgressExtVlanid, zxr10vswitchIfStatus=zxr10vswitchIfStatus, zxr10vswitchIfDesc=zxr10vswitchIfDesc, DisplayString=DisplayString, zxr10vswitchIfTransType=zxr10vswitchIfTransType, zte=zte, zxr10vswitchVlanEgressIntVlanid=zxr10vswitchVlanEgressIntVlanid, zxr10vswitch=zxr10vswitch, zxr10vswitchVlanIngressIntVlanid=zxr10vswitchVlanIngressIntVlanid, zxr10vswitchVlanDesc=zxr10vswitchVlanDesc, zxr10vswitchVlanTableLastchange=zxr10vswitchVlanTableLastchange, zxr10vswitchVlanRowStatus=zxr10vswitchVlanRowStatus, zxr10vswitchVlanVlanidRange=zxr10vswitchVlanVlanidRange, VsiwtchVlanDirection=VsiwtchVlanDirection, zxr10protocol=zxr10protocol, zxr10vswitchVlanEgressIfIndex=zxr10vswitchVlanEgressIfIndex, zxr10vswitchIfType=zxr10vswitchIfType, zxr10vswitchIfEntry=zxr10vswitchIfEntry, zxr10vswitchIfAddr=zxr10vswitchIfAddr, zxr10vswitchIfTable=zxr10vswitchIfTable, zxr10=zxr10, PYSNMP_MODULE_ID=zxr10vswitch, zxr10vswitchVlanIngressExtVlanid=zxr10vswitchVlanIngressExtVlanid, zxr10vswitchVlanIngressIfIndex=zxr10vswitchVlanIngressIfIndex, zxr10vsiwtchVlanEntry=zxr10vsiwtchVlanEntry)
del_items(0x80122A40) SetType(0x80122A40, "struct Creds CreditsTitle[6]") del_items(0x80122BE8) SetType(0x80122BE8, "struct Creds CreditsSubTitle[28]") del_items(0x80123084) SetType(0x80123084, "struct Creds CreditsText[35]") del_items(0x8012319C) SetType(0x8012319C, "int CreditsTable[224]") del_items(0x801243BC) SetType(0x801243BC, "struct DIRENTRY card_dir[16][2]") del_items(0x801248BC) SetType(0x801248BC, "struct file_header card_header[16][2]") del_items(0x801242E0) SetType(0x801242E0, "struct sjis sjis_table[37]") del_items(0x801297BC) SetType(0x801297BC, "unsigned char save_buffer[106496]") del_items(0x80129724) SetType(0x80129724, "struct FeTable McLoadGameMenu") del_items(0x80129704) SetType(0x80129704, "char *CharFileList[5]") del_items(0x80129718) SetType(0x80129718, "char *Classes[3]") del_items(0x80129740) SetType(0x80129740, "struct FeTable McLoadCharMenu") del_items(0x8012975C) SetType(0x8012975C, "struct FeTable McLoadCard1Menu") del_items(0x80129778) SetType(0x80129778, "struct FeTable McLoadCard2Menu")
del_items(2148674112) set_type(2148674112, 'struct Creds CreditsTitle[6]') del_items(2148674536) set_type(2148674536, 'struct Creds CreditsSubTitle[28]') del_items(2148675716) set_type(2148675716, 'struct Creds CreditsText[35]') del_items(2148675996) set_type(2148675996, 'int CreditsTable[224]') del_items(2148680636) set_type(2148680636, 'struct DIRENTRY card_dir[16][2]') del_items(2148681916) set_type(2148681916, 'struct file_header card_header[16][2]') del_items(2148680416) set_type(2148680416, 'struct sjis sjis_table[37]') del_items(2148702140) set_type(2148702140, 'unsigned char save_buffer[106496]') del_items(2148701988) set_type(2148701988, 'struct FeTable McLoadGameMenu') del_items(2148701956) set_type(2148701956, 'char *CharFileList[5]') del_items(2148701976) set_type(2148701976, 'char *Classes[3]') del_items(2148702016) set_type(2148702016, 'struct FeTable McLoadCharMenu') del_items(2148702044) set_type(2148702044, 'struct FeTable McLoadCard1Menu') del_items(2148702072) set_type(2148702072, 'struct FeTable McLoadCard2Menu')
has_high_income = True has_good_credit = True has_criminal_record = False if has_high_income and has_good_credit: print("Eligible for loan") if has_high_income or has_good_credit: print("Eligible for consultation") if has_good_credit and not has_criminal_record: print("Eligible for credit card")
has_high_income = True has_good_credit = True has_criminal_record = False if has_high_income and has_good_credit: print('Eligible for loan') if has_high_income or has_good_credit: print('Eligible for consultation') if has_good_credit and (not has_criminal_record): print('Eligible for credit card')
#1 def print_factors(n): #2 for i in range(1, n+1): #3 if n % i == 0: print(i) #4 number = int(input("Enter a number : ")) #5 print("The factors for {} are : ".format(number)) print_factors(number)
def print_factors(n): for i in range(1, n + 1): if n % i == 0: print(i) number = int(input('Enter a number : ')) print('The factors for {} are : '.format(number)) print_factors(number)
# Min Heap implementation def swap(h, i, j): h[i], h[j] = h[j], h[i] def _min_heap_sift_up(h, k): while k//2 >= 0: if h[k] < h[k//2]: swap(h, k, k//2) k = k//2 else: break def _min_heap_sift_down(h, k): last = len(h)-1 while (2*k+1) < last: child = 2*k+1 if child < last and h[child+1] < h[child]: child = child+1 if h[child] > h[k]: break swap(h, child, k) k = child def min_heap_heapify(h): for k in range(len(h)//2, 0, -1): _min_heap_sift_up(h, k) def min_heap_insert(h, key): h.append(key) k = len(h)-1 print("appended", k, key, h) _min_heap_sift_up(h, k) print("appended", k, key, h) def min_heap_getmin(h): if len(h) == 0: return None return h[0] def min_heap_deletemin(h): if len(h) == 0: return None last = len(h)-1 first = 0 min = h[0] swap(h, first, last) h.pop() print("deleted", min, h) _min_heap_sift_down(h, 0) print("deleted", min, h) return min # Min heap usage #a = ['s', 'o', 'r', 't', 'e', 'x', 'a', 'm', 'p', 'l', 'e'] a = [1, -1, 0, 3, 9, 8, 3] print(a) min_heap_heapify(a) print("Heapified", a) min_heap_insert(a, 2) print(a) min_heap_insert(a, 0) print(a) min_heap_insert(a, -1) print(min_heap_getmin(a)) print(a) min_heap_deletemin(a) print(a) min_heap_deletemin(a) print(a) min_heap_deletemin(a) print(a)
def swap(h, i, j): (h[i], h[j]) = (h[j], h[i]) def _min_heap_sift_up(h, k): while k // 2 >= 0: if h[k] < h[k // 2]: swap(h, k, k // 2) k = k // 2 else: break def _min_heap_sift_down(h, k): last = len(h) - 1 while 2 * k + 1 < last: child = 2 * k + 1 if child < last and h[child + 1] < h[child]: child = child + 1 if h[child] > h[k]: break swap(h, child, k) k = child def min_heap_heapify(h): for k in range(len(h) // 2, 0, -1): _min_heap_sift_up(h, k) def min_heap_insert(h, key): h.append(key) k = len(h) - 1 print('appended', k, key, h) _min_heap_sift_up(h, k) print('appended', k, key, h) def min_heap_getmin(h): if len(h) == 0: return None return h[0] def min_heap_deletemin(h): if len(h) == 0: return None last = len(h) - 1 first = 0 min = h[0] swap(h, first, last) h.pop() print('deleted', min, h) _min_heap_sift_down(h, 0) print('deleted', min, h) return min a = [1, -1, 0, 3, 9, 8, 3] print(a) min_heap_heapify(a) print('Heapified', a) min_heap_insert(a, 2) print(a) min_heap_insert(a, 0) print(a) min_heap_insert(a, -1) print(min_heap_getmin(a)) print(a) min_heap_deletemin(a) print(a) min_heap_deletemin(a) print(a) min_heap_deletemin(a) print(a)
{ "targets": [ { "target_name": "node-cursor", "sources": [ "node-cursor.cc" ] } ] }
{'targets': [{'target_name': 'node-cursor', 'sources': ['node-cursor.cc']}]}
def solution(coins, amount): coins = sorted(coins) minCoins = [0] * (amount + 1) for k in range(1, amount+1): minCoins[k] = amount + 1 i = 0 while i < len(coins) and coins[i] <= k: minCoins[k] = min(minCoins[k], minCoins[k - coins[i]] + 1) i += 1 if minCoins[amount] == amount + 1: return -1 else: return minCoins[amount] coins = [2, 4, 8, 16] amount = 100 print(solution(coins, amount))
def solution(coins, amount): coins = sorted(coins) min_coins = [0] * (amount + 1) for k in range(1, amount + 1): minCoins[k] = amount + 1 i = 0 while i < len(coins) and coins[i] <= k: minCoins[k] = min(minCoins[k], minCoins[k - coins[i]] + 1) i += 1 if minCoins[amount] == amount + 1: return -1 else: return minCoins[amount] coins = [2, 4, 8, 16] amount = 100 print(solution(coins, amount))
class Node: def __init__(self, value, _next=None): self._value = value self._next = _next def __str__(self): return f'{self._value}' def __repr__(self): return f'<Node | Val: {self._value} | Next: {self._next}>'
class Node: def __init__(self, value, _next=None): self._value = value self._next = _next def __str__(self): return f'{self._value}' def __repr__(self): return f'<Node | Val: {self._value} | Next: {self._next}>'
# Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place. # click to show follow up. # Follow up: # Did you use extra space? # A straight forward solution using O(mn) space is probably a bad idea. # A simple improvement uses O(m + n) space, but still not the best solution. # Could you devise a constant space solution? class Solution: # @param {integer[][]} matrix # @return {void} Do not return anything, modify matrix in-place instead. def setZeroes(self, matrix): fr = fc = False for i in xrange(len(matrix)): for j in xrange(len(matrix[0])): if matrix[i][j] == 0: matrix[i][0] = matrix[0][j] = 0 if i == 0: fr = True if j == 0: fc = True for j in xrange(1, len(matrix[0])): if matrix[0][j] == 0: for i in xrange(1, len(matrix)): matrix[i][j] = 0 for i in xrange(1, len(matrix)): if matrix[i][0] == 0: for j in xrange(1, len(matrix[0])): matrix[i][j] = 0 if fr: for j in xrange(len(matrix[0])): matrix[0][j] = 0 if fc: for i in xrange(len(matrix)): matrix[i][0] = 0 # for test # return matrix
class Solution: def set_zeroes(self, matrix): fr = fc = False for i in xrange(len(matrix)): for j in xrange(len(matrix[0])): if matrix[i][j] == 0: matrix[i][0] = matrix[0][j] = 0 if i == 0: fr = True if j == 0: fc = True for j in xrange(1, len(matrix[0])): if matrix[0][j] == 0: for i in xrange(1, len(matrix)): matrix[i][j] = 0 for i in xrange(1, len(matrix)): if matrix[i][0] == 0: for j in xrange(1, len(matrix[0])): matrix[i][j] = 0 if fr: for j in xrange(len(matrix[0])): matrix[0][j] = 0 if fc: for i in xrange(len(matrix)): matrix[i][0] = 0
x=input('enter str1') y=input('enter str2') a=[] b=[];c=[];max=-1 for i in range(len(x)+1): for j in range(i+1,len(x)+1): a.append(x[i:j]) for i in range(len(y)+1): for j in range(i+1,len(y)+1): b.append(y[i:j]) for i in range(len(a)): for j in range(len(b)): if a[i]==b[j]: if len(a[i])>max: max=len(a[i]) c=a[i] print(c)
x = input('enter str1') y = input('enter str2') a = [] b = [] c = [] max = -1 for i in range(len(x) + 1): for j in range(i + 1, len(x) + 1): a.append(x[i:j]) for i in range(len(y) + 1): for j in range(i + 1, len(y) + 1): b.append(y[i:j]) for i in range(len(a)): for j in range(len(b)): if a[i] == b[j]: if len(a[i]) > max: max = len(a[i]) c = a[i] print(c)
altitude = int(input("CURRENT ALTITUDE:")) if altitude <=1000: print("You can land the plan") elif altitude > 1000 and altitude < 5000: print("Come down to 1000") else: print("Turn around")
altitude = int(input('CURRENT ALTITUDE:')) if altitude <= 1000: print('You can land the plan') elif altitude > 1000 and altitude < 5000: print('Come down to 1000') else: print('Turn around')
class Solution: def myPow(self, x: float, n: int) -> float: ''' x^n = x^2 ^ (n//2) if n is even x^n = x * x^2 ^ (n//2) is n is odd ''' if n == 0: return 1 result = self.myPow(x*x, abs(n) //2) if n % 2: result *= x if n < 0: return 1/result return result
class Solution: def my_pow(self, x: float, n: int) -> float: """ x^n = x^2 ^ (n//2) if n is even x^n = x * x^2 ^ (n//2) is n is odd """ if n == 0: return 1 result = self.myPow(x * x, abs(n) // 2) if n % 2: result *= x if n < 0: return 1 / result return result
# -*- coding: utf-8 -*- class Solution: def reversePrefix(self, word: str, ch: str) -> str: return ''.join(reversed(word[:word.find(ch) + 1])) + word[word.find(ch) + 1:] if __name__ == '__main__': solution = Solution() assert 'dcbaefd' == solution.reversePrefix('abcdefd', 'd') assert 'zxyxxe' == solution.reversePrefix('xyxzxe', 'z') assert 'abcd' == solution.reversePrefix('abcd', 'z')
class Solution: def reverse_prefix(self, word: str, ch: str) -> str: return ''.join(reversed(word[:word.find(ch) + 1])) + word[word.find(ch) + 1:] if __name__ == '__main__': solution = solution() assert 'dcbaefd' == solution.reversePrefix('abcdefd', 'd') assert 'zxyxxe' == solution.reversePrefix('xyxzxe', 'z') assert 'abcd' == solution.reversePrefix('abcd', 'z')
#!/usr/bin/env python3 def mysteryAlgorithm(lst): for i in range(1,len(lst)): while i > 0 and lst[i-1] > lst[i]: lst[i], lst[i-1] = lst[i-1], lst[i] i -= 1 return lst print(mysteryAlgorithm([6, 4, 3, 8, 5]))
def mystery_algorithm(lst): for i in range(1, len(lst)): while i > 0 and lst[i - 1] > lst[i]: (lst[i], lst[i - 1]) = (lst[i - 1], lst[i]) i -= 1 return lst print(mystery_algorithm([6, 4, 3, 8, 5]))
''' practice qusestion from chapter 1 Module 5 of IBM Digital Nation Courses by Aashik J Krishnan/Aash Gates ''' x = 10 y ="ten" #step 1 temp = x #temp variable now holds the value of x #step 2 x = y #the variable x now holds the value of y #step 3 y = temp # y now holds the value of temp which is the orginal value of x print (x) print (y) print (temp) #end of the Program
""" practice qusestion from chapter 1 Module 5 of IBM Digital Nation Courses by Aashik J Krishnan/Aash Gates """ x = 10 y = 'ten' temp = x x = y y = temp print(x) print(y) print(temp)
# # @lc app=leetcode id=541 lang=python3 # # [541] Reverse String II # # https://leetcode.com/problems/reverse-string-ii/description/ # # algorithms # Easy (49.66%) # Total Accepted: 117.1K # Total Submissions: 235.8K # Testcase Example: '"abcdefg"\n2' # # Given a string s and an integer k, reverse the first k characters for every # 2k characters counting from the start of the string. # # If there are fewer than k characters left, reverse all of them. If there are # less than 2k but greater than or equal to k characters, then reverse the # first k characters and left the other as original. # # # Example 1: # Input: s = "abcdefg", k = 2 # Output: "bacdfeg" # Example 2: # Input: s = "abcd", k = 2 # Output: "bacd" # # # Constraints: # # # 1 <= s.length <= 10^4 # s consists of only lowercase English letters. # 1 <= k <= 10^4 # # # class Solution: def reverseStr(self, s: str, k: int) -> str: if len(s) < k: return self.reverseAllStr(s) elif len(s) >= k and len(s) < 2 * k: return self.reverseAllStr(s[:k]) + s[k:] else: return self.reverseAllStr(s[:k]) + s[k:2*k] + self.reverseStr(s[2*k:], k) def reverseAllStr(self, s: str): return s[::-1]
class Solution: def reverse_str(self, s: str, k: int) -> str: if len(s) < k: return self.reverseAllStr(s) elif len(s) >= k and len(s) < 2 * k: return self.reverseAllStr(s[:k]) + s[k:] else: return self.reverseAllStr(s[:k]) + s[k:2 * k] + self.reverseStr(s[2 * k:], k) def reverse_all_str(self, s: str): return s[::-1]
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- # pylint: disable=line-too-long def load_command_table(self, _): with self.command_group("approle", is_preview=True) as g: g.custom_command("list", "list_app_roles") g.custom_command("assignment list", "list_role_assignments") g.custom_command("assignment add", "add_role_assignment") g.custom_command("assignment remove", "remove_role_assignment")
def load_command_table(self, _): with self.command_group('approle', is_preview=True) as g: g.custom_command('list', 'list_app_roles') g.custom_command('assignment list', 'list_role_assignments') g.custom_command('assignment add', 'add_role_assignment') g.custom_command('assignment remove', 'remove_role_assignment')
''' Url: https://www.hackerrank.com/challenges/write-a-function/problem Name: Write a function ''' def is_leap(year): ''' For this reason, not every four years is a leap year. The rule is that if the year is divisible by 100 and not divisible by 400, leap year is skipped. The year 2000 was a leap year, for example, but the years 1700, 1800, and 1900 were not. The next time a leap year will be skipped is the year 2100 ''' if year % 100 == 0 and year % 400 != 0: return False return True if year % 4 == 0 else False year = int(input()) print(is_leap(year))
""" Url: https://www.hackerrank.com/challenges/write-a-function/problem Name: Write a function """ def is_leap(year): """ For this reason, not every four years is a leap year. The rule is that if the year is divisible by 100 and not divisible by 400, leap year is skipped. The year 2000 was a leap year, for example, but the years 1700, 1800, and 1900 were not. The next time a leap year will be skipped is the year 2100 """ if year % 100 == 0 and year % 400 != 0: return False return True if year % 4 == 0 else False year = int(input()) print(is_leap(year))
class Solution: def findJudge(self, N: int, trust: List[List[int]]) -> int: E = len(trust) if E < N - 1: return -1 trustScore = [0] * N for a, b in trust: trustScore[a - 1] -= 1 trustScore[b - 1] += 1 for index, t in enumerate(trustScore, 1): if t == N - 1: return index return -1
class Solution: def find_judge(self, N: int, trust: List[List[int]]) -> int: e = len(trust) if E < N - 1: return -1 trust_score = [0] * N for (a, b) in trust: trustScore[a - 1] -= 1 trustScore[b - 1] += 1 for (index, t) in enumerate(trustScore, 1): if t == N - 1: return index return -1
line = '-'*39 bases = '|' + ' ' + 'decimal' + ' ' + '|' + ' ' + 'octal' + ' ' + '|' + ' ' + 'Hexadecimal' + ' ' + '|' blankNum1 = '|' + ' '*6 + '{0}' + ' '*4 + '|' + ' '*4 + '{1}' + ' '*4 + '|' + ' '*7 + '{2}' + ' '*7 + '|' blankNum2 = '|' + ' '*6 + '{0}' + ' '*4 + '|' + ' '*3 + '{1}' + ' '*4 + '|' + ' '*7 + '{2}' + ' '*7 + '|' blankNum3 = '|' + ' '*5 + '{0}' + ' '*4 + '|' + ' '*3 + '{1}' + ' '*4 + '|' + ' '*7 + '{2}' + ' '*7 + '|' print(line) print(bases) print(line) for k in range(8): print(blankNum1.format(k, oct(k)[2:], hex(k)[2:])) for k in range(8,10): print(blankNum2.format(k, oct(k)[2:], hex(k)[2:].upper())) for k in range(10,16): print(blankNum3.format(k, oct(k)[2:], hex(k)[2:].upper())) print(line)
line = '-' * 39 bases = '|' + ' ' + 'decimal' + ' ' + '|' + ' ' + 'octal' + ' ' + '|' + ' ' + 'Hexadecimal' + ' ' + '|' blank_num1 = '|' + ' ' * 6 + '{0}' + ' ' * 4 + '|' + ' ' * 4 + '{1}' + ' ' * 4 + '|' + ' ' * 7 + '{2}' + ' ' * 7 + '|' blank_num2 = '|' + ' ' * 6 + '{0}' + ' ' * 4 + '|' + ' ' * 3 + '{1}' + ' ' * 4 + '|' + ' ' * 7 + '{2}' + ' ' * 7 + '|' blank_num3 = '|' + ' ' * 5 + '{0}' + ' ' * 4 + '|' + ' ' * 3 + '{1}' + ' ' * 4 + '|' + ' ' * 7 + '{2}' + ' ' * 7 + '|' print(line) print(bases) print(line) for k in range(8): print(blankNum1.format(k, oct(k)[2:], hex(k)[2:])) for k in range(8, 10): print(blankNum2.format(k, oct(k)[2:], hex(k)[2:].upper())) for k in range(10, 16): print(blankNum3.format(k, oct(k)[2:], hex(k)[2:].upper())) print(line)
def dfs(u, graph, visited): visited.add(u) for v in graph[u]: if v not in visited: dfs(v, graph, visited) def count_dfs(u, graph, visited=None, depth=0): if visited is None: visited = set() visited.add(u) res = 1 for v, count in graph[u]: if v not in visited: x = count_dfs(v, graph, visited, depth + 1) res += int(count) * x visited.remove(u) return res def parse_rule(rule): rule = rule[:-1] rule_bag, insides = rule.split(' bags contain ') if insides == 'no other bags.': insides = [] else: insides = insides[:-1].split(', ') insides = [tuple(bag.split()[:-1]) for bag in insides] return rule_bag, insides def base_graph(rules): bags = set() for bag, insides in rules: bags.add(bag) for count, spec, color in insides: other_bag = f'{spec} {color}' bags.add(other_bag) return {bag: set() for bag in bags} def inward_graph(rules): graph = base_graph(rules) for bag, insides in rules: for count, spec, color in insides: other_bag = f'{spec} {color}' graph[other_bag].add(bag) return graph def outward_graph(rules): graph = base_graph(rules) for bag, insides in rules: for count, spec, color in insides: other_bag = f'{spec} {color}' graph[bag].add((other_bag, count)) return graph if __name__ == '__main__': with open('input.txt') as input_file: rules = [parse_rule(line) for line in input_file] graph = outward_graph(rules) print(count_dfs('shiny gold', graph) - 1)
def dfs(u, graph, visited): visited.add(u) for v in graph[u]: if v not in visited: dfs(v, graph, visited) def count_dfs(u, graph, visited=None, depth=0): if visited is None: visited = set() visited.add(u) res = 1 for (v, count) in graph[u]: if v not in visited: x = count_dfs(v, graph, visited, depth + 1) res += int(count) * x visited.remove(u) return res def parse_rule(rule): rule = rule[:-1] (rule_bag, insides) = rule.split(' bags contain ') if insides == 'no other bags.': insides = [] else: insides = insides[:-1].split(', ') insides = [tuple(bag.split()[:-1]) for bag in insides] return (rule_bag, insides) def base_graph(rules): bags = set() for (bag, insides) in rules: bags.add(bag) for (count, spec, color) in insides: other_bag = f'{spec} {color}' bags.add(other_bag) return {bag: set() for bag in bags} def inward_graph(rules): graph = base_graph(rules) for (bag, insides) in rules: for (count, spec, color) in insides: other_bag = f'{spec} {color}' graph[other_bag].add(bag) return graph def outward_graph(rules): graph = base_graph(rules) for (bag, insides) in rules: for (count, spec, color) in insides: other_bag = f'{spec} {color}' graph[bag].add((other_bag, count)) return graph if __name__ == '__main__': with open('input.txt') as input_file: rules = [parse_rule(line) for line in input_file] graph = outward_graph(rules) print(count_dfs('shiny gold', graph) - 1)
def selection_sort(arr): for num in range(0, len(arr)): min_position = num for i in range(num, len(arr)): if arr[i] < arr[min_position]: min_position = i temp = arr[num] arr[num] = arr[min_position] arr[min_position] = temp arr = [6, 3, 8, 5, 2, 7, 4, 1] print(f'Unordered: {arr}') selection_sort(arr) print(f'Ordered: {arr}')
def selection_sort(arr): for num in range(0, len(arr)): min_position = num for i in range(num, len(arr)): if arr[i] < arr[min_position]: min_position = i temp = arr[num] arr[num] = arr[min_position] arr[min_position] = temp arr = [6, 3, 8, 5, 2, 7, 4, 1] print(f'Unordered: {arr}') selection_sort(arr) print(f'Ordered: {arr}')
print('<AMO FAZER EXERCICIO NO URI>') print('< AMO FAZER EXERCICIO NO URI>') print('<AMO FAZER EXERCICIO >') print('<AMO FAZER EXERCICIO NO URI>') print('<AMO FAZER EXERCICIO NO URI >') print('<AMO FAZER EXERCICIO NO URI>') print('< AMO FAZER EXERCICIO >') print('<AMO FAZER EXERCICIO >')
print('<AMO FAZER EXERCICIO NO URI>') print('< AMO FAZER EXERCICIO NO URI>') print('<AMO FAZER EXERCICIO >') print('<AMO FAZER EXERCICIO NO URI>') print('<AMO FAZER EXERCICIO NO URI >') print('<AMO FAZER EXERCICIO NO URI>') print('< AMO FAZER EXERCICIO >') print('<AMO FAZER EXERCICIO >')
class Solution: def flipAndInvertImage(self, image: List[List[int]]) -> List[List[int]]: for idx in range(len(image)): image[idx] = list(reversed(image[idx])) image[idx] = [1 if b == 0 else 0 for b in image[idx]] return image
class Solution: def flip_and_invert_image(self, image: List[List[int]]) -> List[List[int]]: for idx in range(len(image)): image[idx] = list(reversed(image[idx])) image[idx] = [1 if b == 0 else 0 for b in image[idx]] return image
WINSTRIDE = (8, 8) PADDING = (8, 8) SCALE = 1.15 MIN_NEIGHBORS = 5 OVERLAP_NMS = 0.9
winstride = (8, 8) padding = (8, 8) scale = 1.15 min_neighbors = 5 overlap_nms = 0.9
index_definition = { "name": "id", "field_type": "int", "index_type": "hash", "is_pk": True, "is_array": False, "is_dense": False, "is_sparse": False, "collate_mode": "none", "sort_order_letters": "", "expire_after": 0, "config": { }, "json_paths": [ "id" ] } updated_index_definition = { "name": "id", "field_type": "int64", "index_type": "hash", "is_pk": True, "is_array": False, "is_dense": False, "is_sparse": False, "collate_mode": "none", "sort_order_letters": "", "expire_after": 0, "config": { }, "json_paths": [ "id_new" ] } special_namespaces = [{"name": "#namespaces"}, {"name": "#memstats"}, {"name": "#perfstats"}, {"name": "#config"}, {"name": "#queriesperfstats"}, {"name": "#activitystats"}, {"name": "#clientsstats"}] special_namespaces_cluster = [{"name": "#namespaces"}, {"name": "#memstats"}, {"name": "#perfstats"}, {"name": "#config"}, {"name": "#queriesperfstats"}, {"name": "#activitystats"}, {"name": "#clientsstats"}, {"name": "#replicationstats"}] item_definition = {'id': 100, 'val': "testval"}
index_definition = {'name': 'id', 'field_type': 'int', 'index_type': 'hash', 'is_pk': True, 'is_array': False, 'is_dense': False, 'is_sparse': False, 'collate_mode': 'none', 'sort_order_letters': '', 'expire_after': 0, 'config': {}, 'json_paths': ['id']} updated_index_definition = {'name': 'id', 'field_type': 'int64', 'index_type': 'hash', 'is_pk': True, 'is_array': False, 'is_dense': False, 'is_sparse': False, 'collate_mode': 'none', 'sort_order_letters': '', 'expire_after': 0, 'config': {}, 'json_paths': ['id_new']} special_namespaces = [{'name': '#namespaces'}, {'name': '#memstats'}, {'name': '#perfstats'}, {'name': '#config'}, {'name': '#queriesperfstats'}, {'name': '#activitystats'}, {'name': '#clientsstats'}] special_namespaces_cluster = [{'name': '#namespaces'}, {'name': '#memstats'}, {'name': '#perfstats'}, {'name': '#config'}, {'name': '#queriesperfstats'}, {'name': '#activitystats'}, {'name': '#clientsstats'}, {'name': '#replicationstats'}] item_definition = {'id': 100, 'val': 'testval'}
def fac(n): if n==1 or n==0: return 1 else: return n*fac(n-1) print(fac(10))
def fac(n): if n == 1 or n == 0: return 1 else: return n * fac(n - 1) print(fac(10))
#-------------------------------------------------------------------# # Returns the value of the given card #-------------------------------------------------------------------# def get_value(card): value = card[0:len(card)-1] return int(value) #-------------------------------------------------------------------# # Returns the suit of the given card #-------------------------------------------------------------------# def get_suit(card): suit = card[len(card)-1:] return suit #-------------------------------------------------------------------# # Returns a tuple of all the cards in dealerCard that have the # given suit #-------------------------------------------------------------------# def get_cards_of_same_suit(suit, dealerCards): cardsOfSameSuit = tuple() # assign to empty tuple for c in dealerCards: if get_suit(c) == suit: if cardsOfSameSuit == tuple(): cardsOfSameSuit = (c,) else: cardsOfSameSuit = cardsOfSameSuit + (c,) return cardsOfSameSuit #-------------------------------------------------------------------# # This function can be called in three different ways: # # 1) You can call it with 1 argument (e.g. dealerCards) which # returns the lowest value card in dealerCards, regardless of suit # and any value restrictions. Here is an example function call: # # lowest = get_lowest_card(dealerCards) # # 2) You can call it with 2 arguments (e.g. dealerCards, oppSuit) # which returns the lowest value card in dealerCards of a given suit, # regardless of any value restrictions. If no cards of that suit # exist, an an empty string ("") is returned. Here is an example # function call: # # lowest = get_lowest_card(dealerCards, oppSuit) # # 3) You can call it with 3 arguments (e.g. dealerCards, oppSuit, # oppValue) which returns the lowest value card in dealerCards of # a given suit that has a value > oppValue. If no such card exists, # an empty string ("") is returned. Here is an example function call: # # lowest = get_lowest_card(dealerCards, oppSuit, oppValue) # #-------------------------------------------------------------------# def get_lowest_card(dealerCards, oppSuit="", oppValue=0): lowestSoFar = "" if oppSuit == "": cards = dealerCards else: cards = get_cards_of_same_suit(oppSuit, dealerCards) for c in cards: value = get_value(c) suit = get_suit(c) if value > oppValue: if lowestSoFar == "" or value < get_value(lowestSoFar): lowestSoFar = c return lowestSoFar #-------------------------------------------------------------------# # Returns the dealers card to play #-------------------------------------------------------------------# def get_dealer_play(cardsInTuple): # set oppLeadCard to the first card in cardsInTuple oppLeadCard = cardsInTuple[0] # set oppSuit to suit of oppLeadCard; use get_suit(oppLeadCard) oppSuit = get_suit(oppLeadCard) # set oppValue to value of oppLeadCard; use get_value(oppLeadCard) oppValue = get_value(oppLeadCard) # set dealerCards to the last 5 cards of cardsInTuple dealerCards = cardsInTuple[1:] # get the lowest valued card in the dealer hand that is the same # suit as the oppSuit and has value greater than oppValue. if such # a card does NOT exist, lowest gets assigned "" lowest = get_lowest_card(dealerCards, oppSuit, oppValue) # if lowest is not "" (i.e. lowest stores a card) if lowest != "": print(lowest) else: lowestSuit = get_lowest_card(dealerCards, oppSuit) lowestCard = get_lowest_card(dealerCards) if lowestSuit == "": print(lowestCard) elif lowestCard != "": print(lowestSuit) #-------------------------------------------------------------------# # -- Main Section #-------------------------------------------------------------------# # read in user input as string, such as: "5D 2D 6H 9D 10D 6H" cardsInString = input() # place cards in tuple, such as: ("5D", "2D", "6H", "9D", "10D", "6H") cardsInTuple = tuple(cardsInString.split()) # The first card in cardsInTuple represents the opponents lead card # and the remaining five cards represent the dealer cards. This tuple # is passed to get_dealer_play() to help determine which card # the dealar should play next. dealerPlayCard = get_dealer_play(cardsInTuple) # diplay the dealer card to play #print(dealerPlayCard)
def get_value(card): value = card[0:len(card) - 1] return int(value) def get_suit(card): suit = card[len(card) - 1:] return suit def get_cards_of_same_suit(suit, dealerCards): cards_of_same_suit = tuple() for c in dealerCards: if get_suit(c) == suit: if cardsOfSameSuit == tuple(): cards_of_same_suit = (c,) else: cards_of_same_suit = cardsOfSameSuit + (c,) return cardsOfSameSuit def get_lowest_card(dealerCards, oppSuit='', oppValue=0): lowest_so_far = '' if oppSuit == '': cards = dealerCards else: cards = get_cards_of_same_suit(oppSuit, dealerCards) for c in cards: value = get_value(c) suit = get_suit(c) if value > oppValue: if lowestSoFar == '' or value < get_value(lowestSoFar): lowest_so_far = c return lowestSoFar def get_dealer_play(cardsInTuple): opp_lead_card = cardsInTuple[0] opp_suit = get_suit(oppLeadCard) opp_value = get_value(oppLeadCard) dealer_cards = cardsInTuple[1:] lowest = get_lowest_card(dealerCards, oppSuit, oppValue) if lowest != '': print(lowest) else: lowest_suit = get_lowest_card(dealerCards, oppSuit) lowest_card = get_lowest_card(dealerCards) if lowestSuit == '': print(lowestCard) elif lowestCard != '': print(lowestSuit) cards_in_string = input() cards_in_tuple = tuple(cardsInString.split()) dealer_play_card = get_dealer_play(cardsInTuple)
# we prompt the user for the code. # enters beginning meter reading # Enters ending meter reading. # we compute the gallons of water as a 10th of the gotten gallons. # we print out the bill meant to be paid the user def bill_calculator(code, gallons): if code == "r": bill = 5.00 + (gallons * 0.0005) return round(bill, 2) elif code == "c": if gallons <= 4000000: bill = 1000.00 return round(bill, 2) else: first_half = 1000.00 sec_half = (gallons - 4000000) * 0.00025 summed_bill = first_half + sec_half return round(summed_bill, 2) elif code == "i": if gallons <= 10000000: bill = 1000.00 return round(bill, 2) elif 4000000 < gallons < 10000000: bill = 2000.00 return round(bill, 2) elif gallons > 10000000: first_half = 2000.00 sec_half = (gallons - 10000000) * 0.00025 summed_bill = first_half + sec_half return round(summed_bill, 2) while True: # promp the user for the code. list_codes = ['r', 'c', 'i'] customer_code = input("\nEnter customer code:") if len(customer_code) > 0 and customer_code.lower() in list_codes: cus_code = customer_code.lower() begin_exact = 0 end_exact = 0 while True: begin_r = input("\nEnter Beginning meter reading:") if len(begin_r) > 0 and begin_r.isnumeric() and 0 < int(begin_r) < 999999999: begin_exact = int(begin_r) break else: print("Enter valid input or meter reading!") continue while True: end_r = input("\nEnter End meter reading:") if len(end_r) > 0 and end_r.isnumeric() and 0 < int(end_r) < 999999999: end_exact = int(end_r) break else: print("Enter valid input or meter reading!") continue gallons = (end_exact - begin_exact) / 10 customer_bill = bill_calculator(cus_code, gallons) print("\nCustomer Code:", cus_code) print("Beginning meter reading:", begin_exact) print("Ending meter reading:", end_exact) print("Gallons of water used:", str(gallons)) print("Amount billed:$" + str(customer_bill)) else: print("Please enter a valid customer code!") continue
def bill_calculator(code, gallons): if code == 'r': bill = 5.0 + gallons * 0.0005 return round(bill, 2) elif code == 'c': if gallons <= 4000000: bill = 1000.0 return round(bill, 2) else: first_half = 1000.0 sec_half = (gallons - 4000000) * 0.00025 summed_bill = first_half + sec_half return round(summed_bill, 2) elif code == 'i': if gallons <= 10000000: bill = 1000.0 return round(bill, 2) elif 4000000 < gallons < 10000000: bill = 2000.0 return round(bill, 2) elif gallons > 10000000: first_half = 2000.0 sec_half = (gallons - 10000000) * 0.00025 summed_bill = first_half + sec_half return round(summed_bill, 2) while True: list_codes = ['r', 'c', 'i'] customer_code = input('\nEnter customer code:') if len(customer_code) > 0 and customer_code.lower() in list_codes: cus_code = customer_code.lower() begin_exact = 0 end_exact = 0 while True: begin_r = input('\nEnter Beginning meter reading:') if len(begin_r) > 0 and begin_r.isnumeric() and (0 < int(begin_r) < 999999999): begin_exact = int(begin_r) break else: print('Enter valid input or meter reading!') continue while True: end_r = input('\nEnter End meter reading:') if len(end_r) > 0 and end_r.isnumeric() and (0 < int(end_r) < 999999999): end_exact = int(end_r) break else: print('Enter valid input or meter reading!') continue gallons = (end_exact - begin_exact) / 10 customer_bill = bill_calculator(cus_code, gallons) print('\nCustomer Code:', cus_code) print('Beginning meter reading:', begin_exact) print('Ending meter reading:', end_exact) print('Gallons of water used:', str(gallons)) print('Amount billed:$' + str(customer_bill)) else: print('Please enter a valid customer code!') continue
''' exceptions.py: exceptions defined by textform Authors ------- Michael Hucka <[email protected]> -- Caltech Library Copyright --------- Copyright (c) 2020 by the California Institute of Technology. This code is open-source software released under a 3-clause BSD license. Please see the file "LICENSE" for more information. ''' # Base class. # ............................................................................. # The base class makes it possible to use a single test to distinguish between # exceptions generated by Documentarist code and exceptions generated by # something else. class DocumentaristException(Exception): '''Base class for Documentarist exceptions.''' pass # Exception classes. # ............................................................................. class CannotProceed(DocumentaristException): '''A recognizable condition caused an early exit from the program.''' pass class UserCancelled(DocumentaristException): '''The user elected to cancel/quit the program.''' pass class CorruptedContent(DocumentaristException): '''Content corruption has been detected.''' pass class InternalError(DocumentaristException): '''Unrecoverable problem involving textform itself.''' pass
""" exceptions.py: exceptions defined by textform Authors ------- Michael Hucka <[email protected]> -- Caltech Library Copyright --------- Copyright (c) 2020 by the California Institute of Technology. This code is open-source software released under a 3-clause BSD license. Please see the file "LICENSE" for more information. """ class Documentaristexception(Exception): """Base class for Documentarist exceptions.""" pass class Cannotproceed(DocumentaristException): """A recognizable condition caused an early exit from the program.""" pass class Usercancelled(DocumentaristException): """The user elected to cancel/quit the program.""" pass class Corruptedcontent(DocumentaristException): """Content corruption has been detected.""" pass class Internalerror(DocumentaristException): """Unrecoverable problem involving textform itself.""" pass
#Written for Python 3.4.2 data = [line.rstrip('\n') for line in open("input.txt")] blacklist = ["ab", "cd", "pq", "xy"] vowels = ['a', 'e', 'i', 'o', 'u'] def contains(string, samples): for sample in samples: if string.find(sample) > -1: return True return False def isNicePart1(string): if contains(string, blacklist): return False vowelcount = 0 for vowel in vowels: vowelcount += string.count(vowel) if vowelcount < 3: return False for i in range(len(string)-1): if string[i] == string[i+1]: return True return False def isNicePart2(string): for i in range(len(string)-3): pair = string[i]+string[i+1] if string.find(pair, i+2) > -1: for j in range(len(string)-2): if string[j] == string[j+2]: return True return False return False nicePart1Count = 0 nicePart2Count = 0 for string in data: if isNicePart1(string): nicePart1Count += 1 if isNicePart2(string): nicePart2Count += 1 print(nicePart1Count) print(nicePart2Count) #Test cases part1 ##print(isNicePart1("ugknbfddgicrmopn"), True) ##print(isNicePart1("aaa"), True) ##print(isNicePart1("jchzalrnumimnmhp"), False) ##print(isNicePart1("haegwjzuvuyypxyu"), False) ##print(isNicePart1("dvszwmarrgswjxmb"), False) #Test cases part1 ##print(isNicePart2("qjhvhtzxzqqjkmpb"), True) ##print(isNicePart2("xxyxx"), True) ##print(isNicePart2("uurcxstgmygtbstg"), False) ##print(isNicePart2("ieodomkazucvgmuy"), False)
data = [line.rstrip('\n') for line in open('input.txt')] blacklist = ['ab', 'cd', 'pq', 'xy'] vowels = ['a', 'e', 'i', 'o', 'u'] def contains(string, samples): for sample in samples: if string.find(sample) > -1: return True return False def is_nice_part1(string): if contains(string, blacklist): return False vowelcount = 0 for vowel in vowels: vowelcount += string.count(vowel) if vowelcount < 3: return False for i in range(len(string) - 1): if string[i] == string[i + 1]: return True return False def is_nice_part2(string): for i in range(len(string) - 3): pair = string[i] + string[i + 1] if string.find(pair, i + 2) > -1: for j in range(len(string) - 2): if string[j] == string[j + 2]: return True return False return False nice_part1_count = 0 nice_part2_count = 0 for string in data: if is_nice_part1(string): nice_part1_count += 1 if is_nice_part2(string): nice_part2_count += 1 print(nicePart1Count) print(nicePart2Count)
class MyStr(str): def __format__(self, *args, **kwargs): print("my format") return str.__format__(self, *args, **kwargs) def __mod__(self, *args, **kwargs): print("mod") return str.__mod__(self, *args, **kwargs) if __name__ == "__main__": ms = MyStr("- %s - {} -") print(ms.format("test")) print(ms % "test")
class Mystr(str): def __format__(self, *args, **kwargs): print('my format') return str.__format__(self, *args, **kwargs) def __mod__(self, *args, **kwargs): print('mod') return str.__mod__(self, *args, **kwargs) if __name__ == '__main__': ms = my_str('- %s - {} -') print(ms.format('test')) print(ms % 'test')
# # AGENT # Sanjin # # STRATEGY # This agent always defects, if the opponent defected too often. Otherwise it cooperates. # def getGameLength(history): return history.shape[1] def getChoice(snitch): return "tell truth" if snitch else "stay silent" def strategy(history, memory): if getGameLength(history) == 0: return getChoice(False), None average = sum(history[1]) / history.shape[1] snitch = average <= 0.3 # Defect if the opponent defected > 30% of times return getChoice(snitch), None
def get_game_length(history): return history.shape[1] def get_choice(snitch): return 'tell truth' if snitch else 'stay silent' def strategy(history, memory): if get_game_length(history) == 0: return (get_choice(False), None) average = sum(history[1]) / history.shape[1] snitch = average <= 0.3 return (get_choice(snitch), None)
VERSION = (0, 1) YFANTASY_MAIN = 'yfantasy' def get_package_version(): return '%s.%s' % (VERSION[0], VERSION[1])
version = (0, 1) yfantasy_main = 'yfantasy' def get_package_version(): return '%s.%s' % (VERSION[0], VERSION[1])
nums = [] with open("day1_input", "r") as f: for line in f: nums.append(int(line)) # part 1 # for numA in nums: # for numB in nums: # # find two entries that sum to 2020: # if (numA + numB == 2020): # print(numA, numB) # # their product is: # print(numA * numB) # part 2 for numA in nums: for numB in nums: for numC in nums: # find two entries that sum to 2020: if (numA + numB + numC == 2020): print(numA, numB, numC) # their product is: print(numA * numB * numC)
nums = [] with open('day1_input', 'r') as f: for line in f: nums.append(int(line)) for num_a in nums: for num_b in nums: for num_c in nums: if numA + numB + numC == 2020: print(numA, numB, numC) print(numA * numB * numC)
text = input("Enter A sentence: ") bad_words = [BADWORDSHERE] for words in bad_words: if words in text: text_length = len(words) hide_word = "*" * text_length text = text.replace(words, hide_word) print(text)
text = input('Enter A sentence: ') bad_words = [BADWORDSHERE] for words in bad_words: if words in text: text_length = len(words) hide_word = '*' * text_length text = text.replace(words, hide_word) print(text)
Clock.clear() # controll ####################################################### Clock.bpm = 120 Scale.default = Scale.chromatic Root.default = 0 p1 >> keys( [4,6,11,13,16,18,23,25] ,dur=[0.25] ,oct=4 ,vibdepth=0.3 ,vib=0.01 ) p2 >> blip( [4,6,11,13,15,16,18,23,25] ,dur=[0.25] ,oct=3 ,sus=2 ,vibdepth=0.3 ,vib=0.01 ,amp=0.35 ) p3 >> bass( [(11,16),[(11,16,18),(11,16,23)]] ,dur=[3.5] ,oct=6 ,sus=6 ,vibdepth=0.1 ,vib=0.01 ,amp=0.25 ) p4 >> bell( [23,22,18,13,11,6] ,dur=[0.25,0.25,0.25,0.25,0.25,0.25,4] ,oct=6 ,vibdepth=0.2 ,vib=0.01 ,amp=0.125 ) p5 >> swell( [(11,6),(11,16),[(11,20),(16,23)]] ,dur=[1.25] ,amp=0.5 ,vib=4, vibdepth=0.01 ,oct=6 ,sus=1.5 ,chop=3, coarse=0) p6 >> pasha( [-1,6,11,(4,1,11)] ,dur=[1,1,rest(0.5),1.5] ,vibdepth=0.3 ,vib=0.21 ,amp=0.15 ,sus=[0.25,2] ,oct=3 ) Clock.clear() print(Samples) print(SynthDefs)
Clock.clear() Clock.bpm = 120 Scale.default = Scale.chromatic Root.default = 0 p1 >> keys([4, 6, 11, 13, 16, 18, 23, 25], dur=[0.25], oct=4, vibdepth=0.3, vib=0.01) p2 >> blip([4, 6, 11, 13, 15, 16, 18, 23, 25], dur=[0.25], oct=3, sus=2, vibdepth=0.3, vib=0.01, amp=0.35) p3 >> bass([(11, 16), [(11, 16, 18), (11, 16, 23)]], dur=[3.5], oct=6, sus=6, vibdepth=0.1, vib=0.01, amp=0.25) p4 >> bell([23, 22, 18, 13, 11, 6], dur=[0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 4], oct=6, vibdepth=0.2, vib=0.01, amp=0.125) p5 >> swell([(11, 6), (11, 16), [(11, 20), (16, 23)]], dur=[1.25], amp=0.5, vib=4, vibdepth=0.01, oct=6, sus=1.5, chop=3, coarse=0) p6 >> pasha([-1, 6, 11, (4, 1, 11)], dur=[1, 1, rest(0.5), 1.5], vibdepth=0.3, vib=0.21, amp=0.15, sus=[0.25, 2], oct=3) Clock.clear() print(Samples) print(SynthDefs)