content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def get_next_sparse(num): str_bin = str(bin(num))[2:] new_str_bin = "" prev_digit = None flag = False for i, digit in enumerate(str_bin): if digit == '1' and prev_digit == '1': flag = True if flag: new_str_bin += '0' * (len(str_bin) - i) break else: new_str_bin += digit prev_digit = digit if flag: if new_str_bin[0] == '1': new_str_bin = '10' + new_str_bin[1:] else: new_str_bin = '1' + new_str_bin new_num = int(new_str_bin, base=2) return new_num # Tests assert get_next_sparse(21) == 21 assert get_next_sparse(25) == 32 assert get_next_sparse(255) == 256
def get_next_sparse(num): str_bin = str(bin(num))[2:] new_str_bin = '' prev_digit = None flag = False for (i, digit) in enumerate(str_bin): if digit == '1' and prev_digit == '1': flag = True if flag: new_str_bin += '0' * (len(str_bin) - i) break else: new_str_bin += digit prev_digit = digit if flag: if new_str_bin[0] == '1': new_str_bin = '10' + new_str_bin[1:] else: new_str_bin = '1' + new_str_bin new_num = int(new_str_bin, base=2) return new_num assert get_next_sparse(21) == 21 assert get_next_sparse(25) == 32 assert get_next_sparse(255) == 256
__author__ = 'mcxiaoke' def gen(): for i in range(4): yield i gene=gen() print(type(gene)) print(gene.next()) print(gene.next()) print(gene.next()) re=iter(range(10)) try: #for i in range(5): for i in range(20): print(re.next()) except StopIteration as e: print('here is the end: ',i) else: print("next") finally: print("finally") print('hahahah')
__author__ = 'mcxiaoke' def gen(): for i in range(4): yield i gene = gen() print(type(gene)) print(gene.next()) print(gene.next()) print(gene.next()) re = iter(range(10)) try: for i in range(20): print(re.next()) except StopIteration as e: print('here is the end: ', i) else: print('next') finally: print('finally') print('hahahah')
l = list(range(101)) def even(i): return i % 2 == 0 print(list(filter(even, l))) def fake_filter(function, list): list_new=[] for n in list: if function(n) is True: list_new.append(n) return list_new print(fake_filter(even, l))
l = list(range(101)) def even(i): return i % 2 == 0 print(list(filter(even, l))) def fake_filter(function, list): list_new = [] for n in list: if function(n) is True: list_new.append(n) return list_new print(fake_filter(even, l))
# # PySNMP MIB module BCCUSTOM-OPR-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BCCUSTOM-OPR-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:36:29 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) # ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsIntersection, SingleValueConstraint, ValueSizeConstraint, ConstraintsUnion, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsUnion", "ValueRangeConstraint") fcSwitch, = mibBuilder.importSymbols("Brocade-REG-MIB", "fcSwitch") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") Unsigned32, Bits, ModuleIdentity, Counter32, Gauge32, MibIdentifier, TimeTicks, iso, Integer32, Counter64, IpAddress, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, NotificationType = mibBuilder.importSymbols("SNMPv2-SMI", "Unsigned32", "Bits", "ModuleIdentity", "Counter32", "Gauge32", "MibIdentifier", "TimeTicks", "iso", "Integer32", "Counter64", "IpAddress", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "NotificationType") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") bcCustomOperation = ModuleIdentity((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 52)) bcCustomOperation.setRevisions(('2011-12-19 10:30',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: bcCustomOperation.setRevisionsDescriptions(('Initial version of this module.',)) if mibBuilder.loadTexts: bcCustomOperation.setLastUpdated('200807291830Z') if mibBuilder.loadTexts: bcCustomOperation.setOrganization('Brocade Communications Systems, Inc.') if mibBuilder.loadTexts: bcCustomOperation.setContactInfo('Customer Support Group Brocade Communications Systems, 120 Holger Way, San Jose, CA 95134 U.S.A Tel: +1-408-333-6061 Email: support@Brocade.COM WEB: www.brocade.com.') if mibBuilder.loadTexts: bcCustomOperation.setDescription('The MIB module is to get the details of T8000 Embedded switch. copyright (c) 2011-2018 Brocade Communications Systems, Inc. All rights reserved.') hwinfospsaveCmd = ObjectIdentity((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 52, 1)) if mibBuilder.loadTexts: hwinfospsaveCmd.setStatus('current') if mibBuilder.loadTexts: hwinfospsaveCmd.setDescription('The OID subtree for supportsave operation.') hwinfospsaveSet = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 52, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 1024))).setMaxAccess("readwrite") if mibBuilder.loadTexts: hwinfospsaveSet.setStatus('current') if mibBuilder.loadTexts: hwinfospsaveSet.setDescription("Parameter required for FC switch to execute supportsave operation: FTP Server IP Type: IPV4/IPV6 Server IP address: IP address of FTP server FTP User: FTP server username to login FTP Code: password of FTP server Command: which is executed on the FC switch board. Filename: The name of info package after command executed. Used: Trigger 'supportsave' command when received a trap of FC switch work abnormally.") hwinfospsaveGet = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 52, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3))).clone(namedValues=NamedValues(("success", 0), ("ftperror", 1), ("progressing", 2), ("systemerror", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: hwinfospsaveGet.setStatus('current') if mibBuilder.loadTexts: hwinfospsaveGet.setDescription('Get the state how the triggered Command executed. Command: which is executed on the FC switch board. Used: Get state of Hwinfospsaveget execute. 0x0: command execute success ,file already transferred to FTP server 0x1: FTP server connect Error 0x2: progressing 0x3: System Error.') hwUpdateFilecmd = ObjectIdentity((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 52, 2)) if mibBuilder.loadTexts: hwUpdateFilecmd.setStatus('current') if mibBuilder.loadTexts: hwUpdateFilecmd.setDescription('The OID subtree for Firmware download operation.') hwUpdateFile = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 52, 2, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 1024))).setMaxAccess("readwrite") if mibBuilder.loadTexts: hwUpdateFile.setStatus('current') if mibBuilder.loadTexts: hwUpdateFile.setDescription("Does Firmware upgrade of the FC switch. Use a space between each attribute separated. 1.The type, the current must be IPV4 2.ftp Host ip 3.ftp User name 4.ftp Password 5.The upgrade of the software loaded, you can bear with the path. Example: 'IPV4 172.16.128.1 user password xcbf.cc'") hwUpdateFileInfo = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 52, 2, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 1024))).setMaxAccess("readonly") if mibBuilder.loadTexts: hwUpdateFileInfo.setStatus('current') if mibBuilder.loadTexts: hwUpdateFileInfo.setDescription("For getting firmware upgrade and progress status. Format is 1. INT32 iStatus 'Update state' 2. UINT8 ucResv[2] 'Reserved' Example: 1. Success - Firmwaredownload completed successfully 2. Inprogress - Firmwaredownload is going on 3. Another Firmware download in progress - When another download is going on 4. Invalid URI - Input URI is in incorrect format 5. Failure - Firmwaredownload is failed") hwSoftwareVersion = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 52, 2, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 4096))).setMaxAccess("readonly") if mibBuilder.loadTexts: hwSoftwareVersion.setStatus('current') if mibBuilder.loadTexts: hwSoftwareVersion.setDescription("Software firmware version information. Format is 1. UINT32 hwSoftwareVersionNum 'The number of software' 'Version of the software structure' 2. UINT8 ucNameLen 'Software name length' 3. char ucName[ucNameLen] 'Software Name' Example (XCBC board) are as follows 00.00.00.02. --- The number of software 03. --- The length of the current version of the software (Firmware 1) 32.31.38. --- The current version of the software 218 (Firmware 1) 03. --- The length of the current version of the software (Firmware 2) 32.31.38. --- The current version of the software 218 (Firmware 2") mibBuilder.exportSymbols("BCCUSTOM-OPR-MIB", hwinfospsaveGet=hwinfospsaveGet, hwinfospsaveSet=hwinfospsaveSet, bcCustomOperation=bcCustomOperation, hwinfospsaveCmd=hwinfospsaveCmd, hwUpdateFileInfo=hwUpdateFileInfo, PYSNMP_MODULE_ID=bcCustomOperation, hwUpdateFile=hwUpdateFile, hwUpdateFilecmd=hwUpdateFilecmd, hwSoftwareVersion=hwSoftwareVersion)
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, single_value_constraint, value_size_constraint, constraints_union, value_range_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsIntersection', 'SingleValueConstraint', 'ValueSizeConstraint', 'ConstraintsUnion', 'ValueRangeConstraint') (fc_switch,) = mibBuilder.importSymbols('Brocade-REG-MIB', 'fcSwitch') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (unsigned32, bits, module_identity, counter32, gauge32, mib_identifier, time_ticks, iso, integer32, counter64, ip_address, mib_scalar, mib_table, mib_table_row, mib_table_column, object_identity, notification_type) = mibBuilder.importSymbols('SNMPv2-SMI', 'Unsigned32', 'Bits', 'ModuleIdentity', 'Counter32', 'Gauge32', 'MibIdentifier', 'TimeTicks', 'iso', 'Integer32', 'Counter64', 'IpAddress', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'ObjectIdentity', 'NotificationType') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') bc_custom_operation = module_identity((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 52)) bcCustomOperation.setRevisions(('2011-12-19 10:30',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: bcCustomOperation.setRevisionsDescriptions(('Initial version of this module.',)) if mibBuilder.loadTexts: bcCustomOperation.setLastUpdated('200807291830Z') if mibBuilder.loadTexts: bcCustomOperation.setOrganization('Brocade Communications Systems, Inc.') if mibBuilder.loadTexts: bcCustomOperation.setContactInfo('Customer Support Group Brocade Communications Systems, 120 Holger Way, San Jose, CA 95134 U.S.A Tel: +1-408-333-6061 Email: support@Brocade.COM WEB: www.brocade.com.') if mibBuilder.loadTexts: bcCustomOperation.setDescription('The MIB module is to get the details of T8000 Embedded switch. copyright (c) 2011-2018 Brocade Communications Systems, Inc. All rights reserved.') hwinfospsave_cmd = object_identity((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 52, 1)) if mibBuilder.loadTexts: hwinfospsaveCmd.setStatus('current') if mibBuilder.loadTexts: hwinfospsaveCmd.setDescription('The OID subtree for supportsave operation.') hwinfospsave_set = mib_scalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 52, 1, 1), octet_string().subtype(subtypeSpec=value_size_constraint(0, 1024))).setMaxAccess('readwrite') if mibBuilder.loadTexts: hwinfospsaveSet.setStatus('current') if mibBuilder.loadTexts: hwinfospsaveSet.setDescription("Parameter required for FC switch to execute supportsave operation: FTP Server IP Type: IPV4/IPV6 Server IP address: IP address of FTP server FTP User: FTP server username to login FTP Code: password of FTP server Command: which is executed on the FC switch board. Filename: The name of info package after command executed. Used: Trigger 'supportsave' command when received a trap of FC switch work abnormally.") hwinfospsave_get = mib_scalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 52, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3))).clone(namedValues=named_values(('success', 0), ('ftperror', 1), ('progressing', 2), ('systemerror', 3)))).setMaxAccess('readonly') if mibBuilder.loadTexts: hwinfospsaveGet.setStatus('current') if mibBuilder.loadTexts: hwinfospsaveGet.setDescription('Get the state how the triggered Command executed. Command: which is executed on the FC switch board. Used: Get state of Hwinfospsaveget execute. 0x0: command execute success ,file already transferred to FTP server 0x1: FTP server connect Error 0x2: progressing 0x3: System Error.') hw_update_filecmd = object_identity((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 52, 2)) if mibBuilder.loadTexts: hwUpdateFilecmd.setStatus('current') if mibBuilder.loadTexts: hwUpdateFilecmd.setDescription('The OID subtree for Firmware download operation.') hw_update_file = mib_scalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 52, 2, 1), octet_string().subtype(subtypeSpec=value_size_constraint(0, 1024))).setMaxAccess('readwrite') if mibBuilder.loadTexts: hwUpdateFile.setStatus('current') if mibBuilder.loadTexts: hwUpdateFile.setDescription("Does Firmware upgrade of the FC switch. Use a space between each attribute separated. 1.The type, the current must be IPV4 2.ftp Host ip 3.ftp User name 4.ftp Password 5.The upgrade of the software loaded, you can bear with the path. Example: 'IPV4 172.16.128.1 user password xcbf.cc'") hw_update_file_info = mib_scalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 52, 2, 2), octet_string().subtype(subtypeSpec=value_size_constraint(0, 1024))).setMaxAccess('readonly') if mibBuilder.loadTexts: hwUpdateFileInfo.setStatus('current') if mibBuilder.loadTexts: hwUpdateFileInfo.setDescription("For getting firmware upgrade and progress status. Format is 1. INT32 iStatus 'Update state' 2. UINT8 ucResv[2] 'Reserved' Example: 1. Success - Firmwaredownload completed successfully 2. Inprogress - Firmwaredownload is going on 3. Another Firmware download in progress - When another download is going on 4. Invalid URI - Input URI is in incorrect format 5. Failure - Firmwaredownload is failed") hw_software_version = mib_scalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 52, 2, 3), octet_string().subtype(subtypeSpec=value_size_constraint(0, 4096))).setMaxAccess('readonly') if mibBuilder.loadTexts: hwSoftwareVersion.setStatus('current') if mibBuilder.loadTexts: hwSoftwareVersion.setDescription("Software firmware version information. Format is 1. UINT32 hwSoftwareVersionNum 'The number of software' 'Version of the software structure' 2. UINT8 ucNameLen 'Software name length' 3. char ucName[ucNameLen] 'Software Name' Example (XCBC board) are as follows 00.00.00.02. --- The number of software 03. --- The length of the current version of the software (Firmware 1) 32.31.38. --- The current version of the software 218 (Firmware 1) 03. --- The length of the current version of the software (Firmware 2) 32.31.38. --- The current version of the software 218 (Firmware 2") mibBuilder.exportSymbols('BCCUSTOM-OPR-MIB', hwinfospsaveGet=hwinfospsaveGet, hwinfospsaveSet=hwinfospsaveSet, bcCustomOperation=bcCustomOperation, hwinfospsaveCmd=hwinfospsaveCmd, hwUpdateFileInfo=hwUpdateFileInfo, PYSNMP_MODULE_ID=bcCustomOperation, hwUpdateFile=hwUpdateFile, hwUpdateFilecmd=hwUpdateFilecmd, hwSoftwareVersion=hwSoftwareVersion)
def findDecision(obj): #obj[0]: Driving_to, obj[1]: Passanger, obj[2]: Weather, obj[3]: Temperature, obj[4]: Time, obj[5]: Coupon, obj[6]: Coupon_validity, obj[7]: Gender, obj[8]: Age, obj[9]: Maritalstatus, obj[10]: Children, obj[11]: Education, obj[12]: Occupation, obj[13]: Income, obj[14]: Bar, obj[15]: Coffeehouse, obj[16]: Restaurantlessthan20, obj[17]: Restaurant20to50, obj[18]: Direction_same, obj[19]: Distance # {"feature": "Coupon", "instances": 85, "metric_value": 0.9465, "depth": 1} if obj[5]>0: # {"feature": "Occupation", "instances": 69, "metric_value": 0.8281, "depth": 2} if obj[12]<=6: # {"feature": "Age", "instances": 40, "metric_value": 0.6098, "depth": 3} if obj[8]<=2: # {"feature": "Maritalstatus", "instances": 22, "metric_value": 0.2668, "depth": 4} if obj[9]<=1: return 'True' elif obj[9]>1: return 'False' else: return 'False' elif obj[8]>2: # {"feature": "Restaurant20to50", "instances": 18, "metric_value": 0.8524, "depth": 4} if obj[17]<=1.0: # {"feature": "Income", "instances": 12, "metric_value": 0.9799, "depth": 5} if obj[13]>2: # {"feature": "Gender", "instances": 10, "metric_value": 0.8813, "depth": 6} if obj[7]<=0: # {"feature": "Bar", "instances": 6, "metric_value": 1.0, "depth": 7} if obj[14]<=1.0: # {"feature": "Passanger", "instances": 4, "metric_value": 0.8113, "depth": 8} if obj[1]>0: return 'False' elif obj[1]<=0: return 'True' else: return 'True' elif obj[14]>1.0: return 'True' else: return 'True' elif obj[7]>0: return 'True' else: return 'True' elif obj[13]<=2: return 'False' else: return 'False' elif obj[17]>1.0: return 'True' else: return 'True' else: return 'True' elif obj[12]>6: # {"feature": "Distance", "instances": 29, "metric_value": 0.9784, "depth": 3} if obj[19]<=2: # {"feature": "Weather", "instances": 26, "metric_value": 0.9306, "depth": 4} if obj[2]<=0: # {"feature": "Direction_same", "instances": 22, "metric_value": 0.976, "depth": 5} if obj[18]<=0: # {"feature": "Driving_to", "instances": 18, "metric_value": 1.0, "depth": 6} if obj[0]<=0: # {"feature": "Time", "instances": 11, "metric_value": 0.8454, "depth": 7} if obj[4]>2: # {"feature": "Bar", "instances": 7, "metric_value": 0.9852, "depth": 8} if obj[14]<=1.0: # {"feature": "Income", "instances": 5, "metric_value": 0.971, "depth": 9} if obj[13]>2: # {"feature": "Passanger", "instances": 3, "metric_value": 0.9183, "depth": 10} if obj[1]>1: # {"feature": "Temperature", "instances": 2, "metric_value": 1.0, "depth": 11} if obj[3]<=80: # {"feature": "Coupon_validity", "instances": 2, "metric_value": 1.0, "depth": 12} if obj[6]<=0: # {"feature": "Gender", "instances": 2, "metric_value": 1.0, "depth": 13} if obj[7]<=1: # {"feature": "Age", "instances": 2, "metric_value": 1.0, "depth": 14} if obj[8]<=4: # {"feature": "Maritalstatus", "instances": 2, "metric_value": 1.0, "depth": 15} if obj[9]<=0: # {"feature": "Children", "instances": 2, "metric_value": 1.0, "depth": 16} if obj[10]<=0: # {"feature": "Education", "instances": 2, "metric_value": 1.0, "depth": 17} if obj[11]<=0: # {"feature": "Coffeehouse", "instances": 2, "metric_value": 1.0, "depth": 18} if obj[15]<=4.0: # {"feature": "Restaurantlessthan20", "instances": 2, "metric_value": 1.0, "depth": 19} if obj[16]<=2.0: # {"feature": "Restaurant20to50", "instances": 2, "metric_value": 1.0, "depth": 20} if obj[17]<=2.0: return 'True' else: return 'True' else: return 'True' else: return 'True' else: return 'True' else: return 'True' else: return 'True' else: return 'True' else: return 'True' else: return 'True' else: return 'True' elif obj[1]<=1: return 'True' else: return 'True' elif obj[13]<=2: return 'False' else: return 'False' elif obj[14]>1.0: return 'True' else: return 'True' elif obj[4]<=2: return 'True' else: return 'True' elif obj[0]>0: # {"feature": "Restaurantlessthan20", "instances": 7, "metric_value": 0.5917, "depth": 7} if obj[16]>1.0: return 'False' elif obj[16]<=1.0: return 'True' else: return 'True' else: return 'False' elif obj[18]>0: return 'True' else: return 'True' elif obj[2]>0: return 'True' else: return 'True' elif obj[19]>2: return 'False' else: return 'False' else: return 'True' elif obj[5]<=0: # {"feature": "Education", "instances": 16, "metric_value": 0.6962, "depth": 2} if obj[11]<=3: return 'False' elif obj[11]>3: # {"feature": "Age", "instances": 4, "metric_value": 0.8113, "depth": 3} if obj[8]>1: return 'True' elif obj[8]<=1: return 'False' else: return 'False' else: return 'True' else: return 'False'
def find_decision(obj): if obj[5] > 0: if obj[12] <= 6: if obj[8] <= 2: if obj[9] <= 1: return 'True' elif obj[9] > 1: return 'False' else: return 'False' elif obj[8] > 2: if obj[17] <= 1.0: if obj[13] > 2: if obj[7] <= 0: if obj[14] <= 1.0: if obj[1] > 0: return 'False' elif obj[1] <= 0: return 'True' else: return 'True' elif obj[14] > 1.0: return 'True' else: return 'True' elif obj[7] > 0: return 'True' else: return 'True' elif obj[13] <= 2: return 'False' else: return 'False' elif obj[17] > 1.0: return 'True' else: return 'True' else: return 'True' elif obj[12] > 6: if obj[19] <= 2: if obj[2] <= 0: if obj[18] <= 0: if obj[0] <= 0: if obj[4] > 2: if obj[14] <= 1.0: if obj[13] > 2: if obj[1] > 1: if obj[3] <= 80: if obj[6] <= 0: if obj[7] <= 1: if obj[8] <= 4: if obj[9] <= 0: if obj[10] <= 0: if obj[11] <= 0: if obj[15] <= 4.0: if obj[16] <= 2.0: if obj[17] <= 2.0: return 'True' else: return 'True' else: return 'True' else: return 'True' else: return 'True' else: return 'True' else: return 'True' else: return 'True' else: return 'True' else: return 'True' else: return 'True' elif obj[1] <= 1: return 'True' else: return 'True' elif obj[13] <= 2: return 'False' else: return 'False' elif obj[14] > 1.0: return 'True' else: return 'True' elif obj[4] <= 2: return 'True' else: return 'True' elif obj[0] > 0: if obj[16] > 1.0: return 'False' elif obj[16] <= 1.0: return 'True' else: return 'True' else: return 'False' elif obj[18] > 0: return 'True' else: return 'True' elif obj[2] > 0: return 'True' else: return 'True' elif obj[19] > 2: return 'False' else: return 'False' else: return 'True' elif obj[5] <= 0: if obj[11] <= 3: return 'False' elif obj[11] > 3: if obj[8] > 1: return 'True' elif obj[8] <= 1: return 'False' else: return 'False' else: return 'True' else: return 'False'
class PyraFaceMapper: @staticmethod def is_face_twist(original_move: str) -> bool: return (len(original_move) >= 2 and original_move[1] == 'w') or \ (len(original_move) >= 3 and original_move[0] == '2' and original_move[2] == 'w') @staticmethod def convert_vertex_twist_to_face_twist(original_move: str) -> str: ''' Given a vertex twist X, translate it to a face twist followed by a vertex-based rotation For example, U becomes Dw [U], and U' becomes Dw' [U'] Given a face twist, keep it after checking validity For example, Dw' stays as Dw' ''' vertex_face_map = { "U": "Dw", "R": "Lw", "L": "Rw", "B": "Fw", "u": "2Dw", "r": "2Lw", "l": "2Rw", "b": "2Fw" } accepted_directions = ["", "'", "2", "2'", "'2"] accepted_faces = vertex_face_map.values() if PyraFaceMapper.is_face_twist(original_move): # e.g. if the original move is Dw2 or 2Fw2', etc., # the move should be left unchanged but verified wide_move_char_index = original_move.find('w') if wide_move_char_index < 0: raise Exception("Invalid move entered: " + original_move) move_direction = original_move[wide_move_char_index + 1:] face_move = original_move[:wide_move_char_index + 1] if face_move not in accepted_faces: raise Exception("Invalid move entered: " + original_move) final_face_move = original_move else: # e.g. if the original move is u', # the face move with the direction is 2Dw', # and the following_rotation is [U'] vertex_move_tip = original_move[:1] move_direction = original_move[1:] tmp_move = vertex_face_map.get(vertex_move_tip) if tmp_move is None: raise Exception("Invalid move entered: " + original_move) face_move = tmp_move face_move_with_direction = face_move + move_direction final_face_move = face_move_with_direction + \ " " + "[" + original_move.upper() + "]" if move_direction not in accepted_directions: raise Exception("Invalid move direction detected") return final_face_move
class Pyrafacemapper: @staticmethod def is_face_twist(original_move: str) -> bool: return len(original_move) >= 2 and original_move[1] == 'w' or (len(original_move) >= 3 and original_move[0] == '2' and (original_move[2] == 'w')) @staticmethod def convert_vertex_twist_to_face_twist(original_move: str) -> str: """ Given a vertex twist X, translate it to a face twist followed by a vertex-based rotation For example, U becomes Dw [U], and U' becomes Dw' [U'] Given a face twist, keep it after checking validity For example, Dw' stays as Dw' """ vertex_face_map = {'U': 'Dw', 'R': 'Lw', 'L': 'Rw', 'B': 'Fw', 'u': '2Dw', 'r': '2Lw', 'l': '2Rw', 'b': '2Fw'} accepted_directions = ['', "'", '2', "2'", "'2"] accepted_faces = vertex_face_map.values() if PyraFaceMapper.is_face_twist(original_move): wide_move_char_index = original_move.find('w') if wide_move_char_index < 0: raise exception('Invalid move entered: ' + original_move) move_direction = original_move[wide_move_char_index + 1:] face_move = original_move[:wide_move_char_index + 1] if face_move not in accepted_faces: raise exception('Invalid move entered: ' + original_move) final_face_move = original_move else: vertex_move_tip = original_move[:1] move_direction = original_move[1:] tmp_move = vertex_face_map.get(vertex_move_tip) if tmp_move is None: raise exception('Invalid move entered: ' + original_move) face_move = tmp_move face_move_with_direction = face_move + move_direction final_face_move = face_move_with_direction + ' ' + '[' + original_move.upper() + ']' if move_direction not in accepted_directions: raise exception('Invalid move direction detected') return final_face_move
class TestGenerate(unittest.TestCase): def test_generate_bin(self): M = [1, 1, 1, 3, 3, 3, 5, 5, 5, 5, 2, 6] ctrl = [0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 0, 3] self.assertTrue(np.array_equal(ctrl, generate_bin(M, 3))) M = np.array([0.1, 3.0, 0.0, 1.2, 2.5, 1.7, 2]) ctrl = [0, 3, 0, 1, 2, 1, 2] self.assertTrue(np.array_equal(ctrl, generate_bin(M, 3))) def test_choose_rows_where(self): M = [[1,2,3], [2,3,4], [3,4,5]] col_names = ['heigh','weight', 'age'] lables= [0,0,1] M = diogenes.utils.cast_list_of_list_to_sa( M, col_names=col_names) arguments = [{'func': val_eq, 'col_name': 'heigh', 'vals': 1}, {'func': val_lt, 'col_name': 'weight', 'vals': 3}, {'func': val_between, 'col_name': 'age', 'vals': (3, 4)}] res = choose_rows_where( M, arguments, 'eq_to_stuff') ctrl = np.array( [(1, 2, 3, True), (2, 3, 4, False), (3, 4, 5, False)], dtype=[('heigh', '<i8'), ('weight', '<i8'), ('age', '<i8'), ('eq_to_stuff', '?')]) self.assertTrue(np.array_equal(res, ctrl)) def test_combine_cols(self): M = np.array( [(0, 1, 2), (3, 4, 5), (6, 7, 8)], dtype=[('f0', float), ('f1', float), ('f2', float)]) ctrl = np.array( [(0, 1, 2, 1, 1.5), (3, 4, 5, 7, 4.5), (6, 7, 8, 13, 7.5)], dtype=[('f0', float), ('f1', float), ('f2', float), ('sum', float), ('avg', float)]) M = combine_cols(M, combine_sum, ('f0', 'f1'), 'sum') M = combine_cols(M, combine_mean, ('f1', 'f2'), 'avg') self.assertTrue(np.array_equal(M, ctrl)) def test_normalize(self): col = np.array([-2, -1, 0, 1, 2]) res, mean, stddev = normalize(col, return_fit=True) self.assertTrue(np.allclose(np.std(res), 1.0)) self.assertTrue(np.allclose(np.mean(res), 0.0)) col = np.arange(10) res = normalize(col, mean=mean, stddev=stddev) self.assertTrue(np.allclose(res, (col - mean) / stddev)) def test_distance_from_point(self): # Coords according to https://tools.wmflabs.org/geohack/ # Paris lat_origin = 48.8567 lng_origin = 2.3508 # New York, Beijing, Jerusalem lat_col = [40.7127, 39.9167, 31.7833] lng_col = [-74.0059, 116.3833, 35.2167] # According to http://www.movable-type.co.uk/scripts/latlong.html # (Rounds to nearest km) ctrl = np.array([5837, 8215, 3331]) res = distance_from_point(lat_origin, lng_origin, lat_col, lng_col) # get it right within 1km self.assertTrue(np.allclose(ctrl, res, atol=1, rtol=0)) if __name__ == '__main__': unittest.main()
class Testgenerate(unittest.TestCase): def test_generate_bin(self): m = [1, 1, 1, 3, 3, 3, 5, 5, 5, 5, 2, 6] ctrl = [0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 0, 3] self.assertTrue(np.array_equal(ctrl, generate_bin(M, 3))) m = np.array([0.1, 3.0, 0.0, 1.2, 2.5, 1.7, 2]) ctrl = [0, 3, 0, 1, 2, 1, 2] self.assertTrue(np.array_equal(ctrl, generate_bin(M, 3))) def test_choose_rows_where(self): m = [[1, 2, 3], [2, 3, 4], [3, 4, 5]] col_names = ['heigh', 'weight', 'age'] lables = [0, 0, 1] m = diogenes.utils.cast_list_of_list_to_sa(M, col_names=col_names) arguments = [{'func': val_eq, 'col_name': 'heigh', 'vals': 1}, {'func': val_lt, 'col_name': 'weight', 'vals': 3}, {'func': val_between, 'col_name': 'age', 'vals': (3, 4)}] res = choose_rows_where(M, arguments, 'eq_to_stuff') ctrl = np.array([(1, 2, 3, True), (2, 3, 4, False), (3, 4, 5, False)], dtype=[('heigh', '<i8'), ('weight', '<i8'), ('age', '<i8'), ('eq_to_stuff', '?')]) self.assertTrue(np.array_equal(res, ctrl)) def test_combine_cols(self): m = np.array([(0, 1, 2), (3, 4, 5), (6, 7, 8)], dtype=[('f0', float), ('f1', float), ('f2', float)]) ctrl = np.array([(0, 1, 2, 1, 1.5), (3, 4, 5, 7, 4.5), (6, 7, 8, 13, 7.5)], dtype=[('f0', float), ('f1', float), ('f2', float), ('sum', float), ('avg', float)]) m = combine_cols(M, combine_sum, ('f0', 'f1'), 'sum') m = combine_cols(M, combine_mean, ('f1', 'f2'), 'avg') self.assertTrue(np.array_equal(M, ctrl)) def test_normalize(self): col = np.array([-2, -1, 0, 1, 2]) (res, mean, stddev) = normalize(col, return_fit=True) self.assertTrue(np.allclose(np.std(res), 1.0)) self.assertTrue(np.allclose(np.mean(res), 0.0)) col = np.arange(10) res = normalize(col, mean=mean, stddev=stddev) self.assertTrue(np.allclose(res, (col - mean) / stddev)) def test_distance_from_point(self): lat_origin = 48.8567 lng_origin = 2.3508 lat_col = [40.7127, 39.9167, 31.7833] lng_col = [-74.0059, 116.3833, 35.2167] ctrl = np.array([5837, 8215, 3331]) res = distance_from_point(lat_origin, lng_origin, lat_col, lng_col) self.assertTrue(np.allclose(ctrl, res, atol=1, rtol=0)) if __name__ == '__main__': unittest.main()
def test_admin_peers(web3, skip_if_testrpc): skip_if_testrpc(web3) assert web3.admin.peers == []
def test_admin_peers(web3, skip_if_testrpc): skip_if_testrpc(web3) assert web3.admin.peers == []
''' LeetCode Q.1170 Compare Strings by Frequency of the Smallest Character ''' def numSmallerByFrequency(queries, words): def bin_search(arr, t): l = 0 r = len(arr)-1 while l <= r: mid = (l+r)//2 if l == r: if arr[mid] > t: return len(arr) - mid elif arr[mid] == t: return len(arr) - mid - 1 else: break if (arr[mid] <= t and arr[mid+1] > t): return len(arr) - mid-1 if (arr[mid-1] <= t and arr[mid] > t): return len(arr) - mid elif arr[mid] <= t: l = mid+1 else: r = mid-1 return 0 def f(s): smallest = min(s) return s.count(smallest) arr1 = [f(i) for i in queries] arr2 = sorted([f(i) for i in words]) ans = [0] * len(arr1) for ind, i in enumerate(arr1): ans[ind] = bin_search(arr2, i) return ans if __name__ == '__main__': queries = ["cbd"] words = ["zaaaz"] print(numSmallerByFrequency(queries, words))
""" LeetCode Q.1170 Compare Strings by Frequency of the Smallest Character """ def num_smaller_by_frequency(queries, words): def bin_search(arr, t): l = 0 r = len(arr) - 1 while l <= r: mid = (l + r) // 2 if l == r: if arr[mid] > t: return len(arr) - mid elif arr[mid] == t: return len(arr) - mid - 1 else: break if arr[mid] <= t and arr[mid + 1] > t: return len(arr) - mid - 1 if arr[mid - 1] <= t and arr[mid] > t: return len(arr) - mid elif arr[mid] <= t: l = mid + 1 else: r = mid - 1 return 0 def f(s): smallest = min(s) return s.count(smallest) arr1 = [f(i) for i in queries] arr2 = sorted([f(i) for i in words]) ans = [0] * len(arr1) for (ind, i) in enumerate(arr1): ans[ind] = bin_search(arr2, i) return ans if __name__ == '__main__': queries = ['cbd'] words = ['zaaaz'] print(num_smaller_by_frequency(queries, words))
#!/usr/bin/env python prod = 0 for a in range(1, 1001): for b in range(a + 1, 1001): c = 1000 - a - b if a**2 + b**2 == c**2: prod = a * b * c break if prod != 0: break print(prod)
prod = 0 for a in range(1, 1001): for b in range(a + 1, 1001): c = 1000 - a - b if a ** 2 + b ** 2 == c ** 2: prod = a * b * c break if prod != 0: break print(prod)
d = list(map(int, input().split())) d.sort() if d[0] == d[1] and d[1] == d[2]: print(10000 + d[0] * 1000) elif d[0] == d[1]: print(1000 + d[0] * 100) elif d[1] == d[2]: print(1000 + d[1] * 100) else: print(100 * d[2])
d = list(map(int, input().split())) d.sort() if d[0] == d[1] and d[1] == d[2]: print(10000 + d[0] * 1000) elif d[0] == d[1]: print(1000 + d[0] * 100) elif d[1] == d[2]: print(1000 + d[1] * 100) else: print(100 * d[2])
# Aggregate all `python` rules to one loadable file load(":python_proto_compile.bzl", _python_proto_compile="python_proto_compile") load(":python_grpc_compile.bzl", _python_grpc_compile="python_grpc_compile") load(":python_grpclib_compile.bzl", _python_grpclib_compile="python_grpclib_compile") load(":python_proto_library.bzl", _python_proto_library="python_proto_library") load(":python_grpc_library.bzl", _python_grpc_library="python_grpc_library") load(":python_grpclib_library.bzl", _python_grpclib_library="python_grpclib_library") python_proto_compile = _python_proto_compile python_grpc_compile = _python_grpc_compile python_grpclib_compile = _python_grpclib_compile python_proto_library = _python_proto_library python_grpc_library = _python_grpc_library python_grpclib_library = _python_grpclib_library # Aliases py_grpc_compile = _python_grpc_compile py_grpc_library = _python_grpc_library py_grpclib_compile = _python_grpclib_compile py_grpclib_library = _python_grpclib_library py_proto_compile = _python_proto_compile py_proto_library = _python_proto_library
load(':python_proto_compile.bzl', _python_proto_compile='python_proto_compile') load(':python_grpc_compile.bzl', _python_grpc_compile='python_grpc_compile') load(':python_grpclib_compile.bzl', _python_grpclib_compile='python_grpclib_compile') load(':python_proto_library.bzl', _python_proto_library='python_proto_library') load(':python_grpc_library.bzl', _python_grpc_library='python_grpc_library') load(':python_grpclib_library.bzl', _python_grpclib_library='python_grpclib_library') python_proto_compile = _python_proto_compile python_grpc_compile = _python_grpc_compile python_grpclib_compile = _python_grpclib_compile python_proto_library = _python_proto_library python_grpc_library = _python_grpc_library python_grpclib_library = _python_grpclib_library py_grpc_compile = _python_grpc_compile py_grpc_library = _python_grpc_library py_grpclib_compile = _python_grpclib_compile py_grpclib_library = _python_grpclib_library py_proto_compile = _python_proto_compile py_proto_library = _python_proto_library
def initFont(name, w, h): # -> fontId imagep = Image.open(name) ix = imagep.size[0] iy = imagep.size[1] image = imagep.tobytes("raw", "RGBX", 0, -1) tid = texture_init(image, ix, iy) col_count = ix // w row_count = iy // h return { #'tid':tid, 'col':col_count, 'row':row_count, 'w':w, 'h':h, 'width':ix, 'height':iy, } def font_coord_to_tex_coord(fid, x, y): w = fid['w'] + 1 h = fid['h'] + 1 width = fid['width'] height = fid['height'] s, t = x, y x *= w y *= h x = x/width y = 1.0 - y/height s = (s+1) * w t = (t+1) * w s = s/width t = 1.0 - t/height return x, t, s, y def say_2dfont(font_id, msg): tid = font_id['tid'] col = font_id['col'] glColor3f(1.0, 1.0, 1.0) glDisable(GL_BLEND) glEnable(GL_TEXTURE_2D) glBindTexture(GL_TEXTURE_2D, tid) glLoadIdentity() glTranslatef(50.0, 50.0, -0.1) x = window_width x /= 30 y = x left = -40.0 for char in msg: code = ord(char) - ord('a') xx = code % col yy = code // col a, b, s, t = font_coord_to_tex_coord(font_id, xx, yy) #print(msg, char, code, x, a,b,s,t) glBegin(GL_QUADS) glTexCoord2f(a, b) glVertex3f(left-x, -y, 0.0) glTexCoord2f(a, t) glVertex3f(left - x, y, 0.0) glTexCoord2f(s, t) glVertex3f(left + x, y, 0.0) glTexCoord2f(s, b) glVertex3f(left + x, -y, 0.0) glEnd() left += 10
def init_font(name, w, h): imagep = Image.open(name) ix = imagep.size[0] iy = imagep.size[1] image = imagep.tobytes('raw', 'RGBX', 0, -1) tid = texture_init(image, ix, iy) col_count = ix // w row_count = iy // h return {'col': col_count, 'row': row_count, 'w': w, 'h': h, 'width': ix, 'height': iy} def font_coord_to_tex_coord(fid, x, y): w = fid['w'] + 1 h = fid['h'] + 1 width = fid['width'] height = fid['height'] (s, t) = (x, y) x *= w y *= h x = x / width y = 1.0 - y / height s = (s + 1) * w t = (t + 1) * w s = s / width t = 1.0 - t / height return (x, t, s, y) def say_2dfont(font_id, msg): tid = font_id['tid'] col = font_id['col'] gl_color3f(1.0, 1.0, 1.0) gl_disable(GL_BLEND) gl_enable(GL_TEXTURE_2D) gl_bind_texture(GL_TEXTURE_2D, tid) gl_load_identity() gl_translatef(50.0, 50.0, -0.1) x = window_width x /= 30 y = x left = -40.0 for char in msg: code = ord(char) - ord('a') xx = code % col yy = code // col (a, b, s, t) = font_coord_to_tex_coord(font_id, xx, yy) gl_begin(GL_QUADS) gl_tex_coord2f(a, b) gl_vertex3f(left - x, -y, 0.0) gl_tex_coord2f(a, t) gl_vertex3f(left - x, y, 0.0) gl_tex_coord2f(s, t) gl_vertex3f(left + x, y, 0.0) gl_tex_coord2f(s, b) gl_vertex3f(left + x, -y, 0.0) gl_end() left += 10
# Returns length of LCS for X[0..m-1], Y[0..n-1] def longest_common_subsequence(X, Y): X_length = len(X) Y_length = len(Y) L = [[0 for x in range(Y_length + 1)] for x in range(X_length + 1)] # Following steps build L[m+1][n+1] in bottom up fashion. Note # that L[i][j] contains length of LCS of X[0..i-1] and Y[0..j-1] for i in range(X_length + 1): for j in range(Y_length + 1): if i == 0 or j == 0: L[i][j] = 0 elif X[i - 1] == Y[j - 1]: L[i][j] = L[i - 1][j - 1] + 1 else: L[i][j] = max(L[i - 1][j], L[i][j - 1]) # Following code is used to print LCS index = L[X_length][Y_length] # Create a character array to store the lcs string lcs = [""] * (index + 1) lcs[index] = "" # Start from the right-most-bottom-most corner and # one by one store characters in lcs[] i = X_length j = Y_length while i > 0 and j > 0: # If current character in X[] and Y are same, then # current character is part of LCS if X[i - 1] == Y[j - 1]: lcs[index - 1] = X[i - 1] i -= 1 j -= 1 index -= 1 # If not same, then find the larger of two and # go in the direction of larger value elif L[i - 1][j] > L[i][j - 1]: i -= 1 else: j -= 1 # print("LCS of " + X + " and " + Y + " is " + "".join(lcs)) return "".join(lcs) # Test X = "ACCAEF" Y = "CCAACCF" longest_common_subsequence(X, Y)
def longest_common_subsequence(X, Y): x_length = len(X) y_length = len(Y) l = [[0 for x in range(Y_length + 1)] for x in range(X_length + 1)] for i in range(X_length + 1): for j in range(Y_length + 1): if i == 0 or j == 0: L[i][j] = 0 elif X[i - 1] == Y[j - 1]: L[i][j] = L[i - 1][j - 1] + 1 else: L[i][j] = max(L[i - 1][j], L[i][j - 1]) index = L[X_length][Y_length] lcs = [''] * (index + 1) lcs[index] = '' i = X_length j = Y_length while i > 0 and j > 0: if X[i - 1] == Y[j - 1]: lcs[index - 1] = X[i - 1] i -= 1 j -= 1 index -= 1 elif L[i - 1][j] > L[i][j - 1]: i -= 1 else: j -= 1 return ''.join(lcs) x = 'ACCAEF' y = 'CCAACCF' longest_common_subsequence(X, Y)
__all__ = ['directories', 'load_wfcorrection', 'mosaic_tools', 'wise_flux_correction']
__all__ = ['directories', 'load_wfcorrection', 'mosaic_tools', 'wise_flux_correction']
dirfrom = open(r"C:\Users\emurphy24\Documents\GitHub\WoordleCalculator\dictfrom.txt", "r", encoding="utf-8") dirlist = [] for line in dirfrom: line = line.strip() dirlist.append(line) print(len(dirlist)) dirfrom.close() dirto = open(r"C:\Users\emurphy24\Documents\GitHub\WoordleCalculator\fiveletterdir", "a", encoding="utf-8") for i in dirlist: if len(i) == 5 and i.isalpha(): dirto.write(i + "\n")
dirfrom = open('C:\\Users\\emurphy24\\Documents\\GitHub\\WoordleCalculator\\dictfrom.txt', 'r', encoding='utf-8') dirlist = [] for line in dirfrom: line = line.strip() dirlist.append(line) print(len(dirlist)) dirfrom.close() dirto = open('C:\\Users\\emurphy24\\Documents\\GitHub\\WoordleCalculator\\fiveletterdir', 'a', encoding='utf-8') for i in dirlist: if len(i) == 5 and i.isalpha(): dirto.write(i + '\n')
# Advent of Code Day 12 # https://adventofcode.com/2020/day/12 def heading_to_dir(heading): if heading == 0: return "N" elif heading == 90: return "E" elif heading == 180: return "S" elif heading == 270: return "W" def rotate_waypoint(old_north, old_east, degrees): # degrees in increments of 90, pos or neg new_north = old_north new_east = old_east degrees = (degrees + 360) % 360 # make the movement positive for turns in range(degrees // 90): old_north = new_north old_east = new_east new_north = -1 * old_east new_east = old_north return new_north, new_east def test_rotate_waypoint(): north, east = rotate_waypoint(10, 4, 90) assert north == -4 and east == 10 north, east = rotate_waypoint(10, 4, 180) assert north == -10 and east == -4 north, east = rotate_waypoint(10, 4, 270) assert north == 4 and east == -10 north, east = rotate_waypoint(10, 4, 360) assert north == 10 and east == 4 north, east = rotate_waypoint(10, 4, -90) assert north == 4 and east == -10 north, east = rotate_waypoint(10, 4, -180) assert north == -10 and east == -4 north, east = rotate_waypoint(10, 4, -270) assert north == -4 and east == 10 if __name__ == "__main__": filepath = ".\\AdventOfCode\\2020\\day12-input.txt" with open(filepath) as f: instructions = [line.strip() for line in f] # print(instructions) part1_instr = instructions.copy() # state state_north = 0 state_east = 0 state_heading = 90 for ins in part1_instr: command = ins[0] value = int(ins[1:]) if command == "N": state_north += value elif command == "S": state_north -= value elif command == "E": state_east += value elif command == "W": state_east -= value elif command == "F": part1_instr.append(heading_to_dir(state_heading) + str(value)) elif command == "L": state_heading = (state_heading - value) % 360 elif command == "R": state_heading = (state_heading + value) % 360 # print(f"North: {state_north} East: {state_east} Heading:{state_heading}") print(f"Part 1: {abs(state_north) + abs(state_east)}") # Part 2 part2_instr = instructions.copy() # state state_north = 0 state_east = 0 # state_heading = 90 waypoint_north = 1 waypoint_east = 10 for ins in part2_instr: command = ins[0] value = int(ins[1:]) if command == "N": waypoint_north += value elif command == "S": waypoint_north -= value elif command == "E": waypoint_east += value elif command == "W": waypoint_east -= value elif command == "F": state_north += waypoint_north * value state_east += waypoint_east * value elif command == "L": waypoint_north, waypoint_east = rotate_waypoint( waypoint_north, waypoint_east, -1 * value ) elif command == "R": waypoint_north, waypoint_east = rotate_waypoint( waypoint_north, waypoint_east, value ) # print(f"North: {state_north} East: {state_east} Heading:{state_heading}") print(f"Part 2: {abs(state_north) + abs(state_east)}") # 6276 too low
def heading_to_dir(heading): if heading == 0: return 'N' elif heading == 90: return 'E' elif heading == 180: return 'S' elif heading == 270: return 'W' def rotate_waypoint(old_north, old_east, degrees): new_north = old_north new_east = old_east degrees = (degrees + 360) % 360 for turns in range(degrees // 90): old_north = new_north old_east = new_east new_north = -1 * old_east new_east = old_north return (new_north, new_east) def test_rotate_waypoint(): (north, east) = rotate_waypoint(10, 4, 90) assert north == -4 and east == 10 (north, east) = rotate_waypoint(10, 4, 180) assert north == -10 and east == -4 (north, east) = rotate_waypoint(10, 4, 270) assert north == 4 and east == -10 (north, east) = rotate_waypoint(10, 4, 360) assert north == 10 and east == 4 (north, east) = rotate_waypoint(10, 4, -90) assert north == 4 and east == -10 (north, east) = rotate_waypoint(10, 4, -180) assert north == -10 and east == -4 (north, east) = rotate_waypoint(10, 4, -270) assert north == -4 and east == 10 if __name__ == '__main__': filepath = '.\\AdventOfCode\\2020\\day12-input.txt' with open(filepath) as f: instructions = [line.strip() for line in f] part1_instr = instructions.copy() state_north = 0 state_east = 0 state_heading = 90 for ins in part1_instr: command = ins[0] value = int(ins[1:]) if command == 'N': state_north += value elif command == 'S': state_north -= value elif command == 'E': state_east += value elif command == 'W': state_east -= value elif command == 'F': part1_instr.append(heading_to_dir(state_heading) + str(value)) elif command == 'L': state_heading = (state_heading - value) % 360 elif command == 'R': state_heading = (state_heading + value) % 360 print(f'Part 1: {abs(state_north) + abs(state_east)}') part2_instr = instructions.copy() state_north = 0 state_east = 0 waypoint_north = 1 waypoint_east = 10 for ins in part2_instr: command = ins[0] value = int(ins[1:]) if command == 'N': waypoint_north += value elif command == 'S': waypoint_north -= value elif command == 'E': waypoint_east += value elif command == 'W': waypoint_east -= value elif command == 'F': state_north += waypoint_north * value state_east += waypoint_east * value elif command == 'L': (waypoint_north, waypoint_east) = rotate_waypoint(waypoint_north, waypoint_east, -1 * value) elif command == 'R': (waypoint_north, waypoint_east) = rotate_waypoint(waypoint_north, waypoint_east, value) print(f'Part 2: {abs(state_north) + abs(state_east)}')
''' input: 123 -123 120 0 1534236469 Output 321 -321 21 0 0 ''' class Solution: def reverse(self, x: int) -> int: range_value = 2**31 val = x; output = "" if x < 0: output += "-" val = abs(val) while True: dig = val%10 val = int(val/10) output += str(dig) if val == 0: break val = int(output) # print(output) if -range_value <= val <= range_value - 1: return val else: return 0
""" input: 123 -123 120 0 1534236469 Output 321 -321 21 0 0 """ class Solution: def reverse(self, x: int) -> int: range_value = 2 ** 31 val = x output = '' if x < 0: output += '-' val = abs(val) while True: dig = val % 10 val = int(val / 10) output += str(dig) if val == 0: break val = int(output) if -range_value <= val <= range_value - 1: return val else: return 0
# Dragon sm.setSpeakerID(1013001) sm.sendNext("You, who is destined to be a Dragon Master... You have finally arrived.") sm.sendNext("Go and fulfill your duties as the Dragon Master...") #todo effects sm.warp(100030100, 0) sm.dispose()
sm.setSpeakerID(1013001) sm.sendNext('You, who is destined to be a Dragon Master... You have finally arrived.') sm.sendNext('Go and fulfill your duties as the Dragon Master...') sm.warp(100030100, 0) sm.dispose()
def foo(): pass def bar(): pass def boing(): pass
def foo(): pass def bar(): pass def boing(): pass
dict_month = {"A": 1, "B": 2, "C": 3, "D": 4, "E": 5, "F": 6, "G": 7, "H": 8, "I": 9, "J": 10, "K": 11, "L": 12, "M": 1, "N": 2, "O": 3, "P": 4, "Q": 5, "R": 6, "S": 7, "T": 8, "U": 9, "V": 10, "W": 11, "X": 12} dict_is_call = {"A": True, "B": True, "C": True, "D": True, "E": True, "F": True, "G": True, "H": True, "I": True, "J": True, "K": True, "L": True, "M": False, "N": False, "O": False, "P": False, "Q": False, "R": False, "S": False, "T": False, "U": False, "V": False, "W": False, "X": False} def get_option_info_from_ticker(ticker, equity_length=3): asset = ticker[:equity_length] exp_month_code = ticker[equity_length] month = dict_month[exp_month_code] is_call = dict_is_call[exp_month_code] day = int(ticker[equity_length + 1:equity_length + 3]) year = int(ticker[equity_length + 3:equity_length + 5]) + 2000 K = int(ticker[equity_length + 5:-2]) / 100 country = ticker[-1] return asset, is_call, month, day, year, K, country
dict_month = {'A': 1, 'B': 2, 'C': 3, 'D': 4, 'E': 5, 'F': 6, 'G': 7, 'H': 8, 'I': 9, 'J': 10, 'K': 11, 'L': 12, 'M': 1, 'N': 2, 'O': 3, 'P': 4, 'Q': 5, 'R': 6, 'S': 7, 'T': 8, 'U': 9, 'V': 10, 'W': 11, 'X': 12} dict_is_call = {'A': True, 'B': True, 'C': True, 'D': True, 'E': True, 'F': True, 'G': True, 'H': True, 'I': True, 'J': True, 'K': True, 'L': True, 'M': False, 'N': False, 'O': False, 'P': False, 'Q': False, 'R': False, 'S': False, 'T': False, 'U': False, 'V': False, 'W': False, 'X': False} def get_option_info_from_ticker(ticker, equity_length=3): asset = ticker[:equity_length] exp_month_code = ticker[equity_length] month = dict_month[exp_month_code] is_call = dict_is_call[exp_month_code] day = int(ticker[equity_length + 1:equity_length + 3]) year = int(ticker[equity_length + 3:equity_length + 5]) + 2000 k = int(ticker[equity_length + 5:-2]) / 100 country = ticker[-1] return (asset, is_call, month, day, year, K, country)
#python 3 debug = False def from_input(): m = int(input()) idx_matrix = [] for _ in range(m): row = list(map(float, input().split())) idx_matrix.append(row) return idx_matrix def to_str(x): return list(map(lambda a: format(a, '.6f'), x)) def gauss(matrix): if len(matrix) == 0: return [] size = len(matrix[0]) - 1 size_rows = len(matrix) used_columns = [False] * size used_rows = [False] * size_rows def makePivot(selectedRow, selectedColumn): used_rows[selectedRow] = True used_columns[selectedColumn] = True def leftMostNonZeroInNonPivotRow(): if False not in used_rows: return False initialRow = used_rows.index(False) for row in range(initialRow, size_rows): for column in range(size): if matrix[row][column] != 0 and column < size: used_rows[row] = True return (row, column) return False def swapRowToTopOfNonPivotRow(selectedRow): if False not in used_rows: return topNonPivotRow = used_rows.index(False) if topNonPivotRow < selectedRow: matrix[topNonPivotRow], matrix[selectedRow] = matrix[selectedRow], matrix[topNonPivotRow] selectedRow = topNonPivotRow def rescaleToMakePivotOne(selectedRow, selectedColumn): pivot = matrix[selectedRow][selectedColumn] matrix[selectedRow] = [elem/pivot for elem in matrix[selectedRow]] def substractToMakeOtherRowsZero(selectedRow, selectedColumn): for row in range(size_rows): if row != selectedRow: times = matrix[row][selectedColumn] matrix[row] = [i - (times * j) for i, j in zip(matrix[row], matrix[selectedRow])] while False in used_rows and False in used_columns: selectedRow, selectedColumn = leftMostNonZeroInNonPivotRow() swapRowToTopOfNonPivotRow(selectedRow) makePivot(selectedRow, selectedColumn) rescaleToMakePivotOne(selectedRow, selectedColumn) substractToMakeOtherRowsZero(selectedRow, selectedColumn) res = [matrix[row][-1] for row in range(size_rows)] for i in range(len(res)): if res[i] == -0.0: res[i] = 0.0 return to_str(res) def test(): def run(data, expected, f=gauss): result = f(data) if result != expected: raise Exception("Expected %s, Actual: %s" % (expected, result)) run([[1.0, 1.0, 3.0], [2.0, 3.0, 7.0]], ["2.000000", "1.000000"]) run([[1.0, 1.0]], ["1.000000"]) run([], []) run([[5.0, -5.0, -1.0], [-1.0, -2.0, -1.0]], ["0.200000", "0.400000"]) run([[1.0, 0.0, 0.0, 0.0, 1.0], [0.0, 1.0, 0.0, 0.0, 5.0], [0.0, 0.0, 1.0, 0.0, 4.0], [0.0, 0.0, 0.0, 1.0, 3.0]], ["1.000000", "5.000000", "4.000000", "3.000000"]) run([ [2.0, 4.0, -2.0, 0.0, -2.0], [-1.0, -2.0, 1.0, -2.0, -1.0], [2.0, 2.0, 0.0, 2.0, 0.0]], ["-1.000000", "1.000000", "0.000000"]) print("Tests passed") if __name__ == '__main__': if debug: test() else: s = gauss(from_input()) print(" ".join(s))
debug = False def from_input(): m = int(input()) idx_matrix = [] for _ in range(m): row = list(map(float, input().split())) idx_matrix.append(row) return idx_matrix def to_str(x): return list(map(lambda a: format(a, '.6f'), x)) def gauss(matrix): if len(matrix) == 0: return [] size = len(matrix[0]) - 1 size_rows = len(matrix) used_columns = [False] * size used_rows = [False] * size_rows def make_pivot(selectedRow, selectedColumn): used_rows[selectedRow] = True used_columns[selectedColumn] = True def left_most_non_zero_in_non_pivot_row(): if False not in used_rows: return False initial_row = used_rows.index(False) for row in range(initialRow, size_rows): for column in range(size): if matrix[row][column] != 0 and column < size: used_rows[row] = True return (row, column) return False def swap_row_to_top_of_non_pivot_row(selectedRow): if False not in used_rows: return top_non_pivot_row = used_rows.index(False) if topNonPivotRow < selectedRow: (matrix[topNonPivotRow], matrix[selectedRow]) = (matrix[selectedRow], matrix[topNonPivotRow]) selected_row = topNonPivotRow def rescale_to_make_pivot_one(selectedRow, selectedColumn): pivot = matrix[selectedRow][selectedColumn] matrix[selectedRow] = [elem / pivot for elem in matrix[selectedRow]] def substract_to_make_other_rows_zero(selectedRow, selectedColumn): for row in range(size_rows): if row != selectedRow: times = matrix[row][selectedColumn] matrix[row] = [i - times * j for (i, j) in zip(matrix[row], matrix[selectedRow])] while False in used_rows and False in used_columns: (selected_row, selected_column) = left_most_non_zero_in_non_pivot_row() swap_row_to_top_of_non_pivot_row(selectedRow) make_pivot(selectedRow, selectedColumn) rescale_to_make_pivot_one(selectedRow, selectedColumn) substract_to_make_other_rows_zero(selectedRow, selectedColumn) res = [matrix[row][-1] for row in range(size_rows)] for i in range(len(res)): if res[i] == -0.0: res[i] = 0.0 return to_str(res) def test(): def run(data, expected, f=gauss): result = f(data) if result != expected: raise exception('Expected %s, Actual: %s' % (expected, result)) run([[1.0, 1.0, 3.0], [2.0, 3.0, 7.0]], ['2.000000', '1.000000']) run([[1.0, 1.0]], ['1.000000']) run([], []) run([[5.0, -5.0, -1.0], [-1.0, -2.0, -1.0]], ['0.200000', '0.400000']) run([[1.0, 0.0, 0.0, 0.0, 1.0], [0.0, 1.0, 0.0, 0.0, 5.0], [0.0, 0.0, 1.0, 0.0, 4.0], [0.0, 0.0, 0.0, 1.0, 3.0]], ['1.000000', '5.000000', '4.000000', '3.000000']) run([[2.0, 4.0, -2.0, 0.0, -2.0], [-1.0, -2.0, 1.0, -2.0, -1.0], [2.0, 2.0, 0.0, 2.0, 0.0]], ['-1.000000', '1.000000', '0.000000']) print('Tests passed') if __name__ == '__main__': if debug: test() else: s = gauss(from_input()) print(' '.join(s))
class Dog: kind = 'canine' # tricks = [] def __init__(self, name): self.name = name self.tricks = [] def add_trick(self, trick): self.tricks.append(trick) my_dog = Dog('Carl') my_dog.add_trick('roll over') another_dog = Dog('Max') another_dog.add_trick('play dead') print(my_dog.name, my_dog.kind, my_dog.tricks) print(another_dog.name, another_dog.kind, another_dog.tricks)
class Dog: kind = 'canine' def __init__(self, name): self.name = name self.tricks = [] def add_trick(self, trick): self.tricks.append(trick) my_dog = dog('Carl') my_dog.add_trick('roll over') another_dog = dog('Max') another_dog.add_trick('play dead') print(my_dog.name, my_dog.kind, my_dog.tricks) print(another_dog.name, another_dog.kind, another_dog.tricks)
# reverse the order of the items in an array lista_unu = [1, 2, 3, 4, 5] def Reverse(list): list.reverse() return list print(Reverse(lista_unu)) # number of occurrences lista_doi = [1, 1, 1, 1, 4, 4, 6, 7, 9, 9, 9, 3] def NumberOfOccu(var, list): occ = 0 for i in list: if i == var: occ += 1 return occ var = 6 print(NumberOfOccu(var, lista_doi)) # number of words string = "numaram cate cuvinte avem in propozitia asta " def Words(string): words = 1 for i in range(len(string)-1): if string[i] == " " and string[i+1] != " ": words += 1 return words print(Words(string))
lista_unu = [1, 2, 3, 4, 5] def reverse(list): list.reverse() return list print(reverse(lista_unu)) lista_doi = [1, 1, 1, 1, 4, 4, 6, 7, 9, 9, 9, 3] def number_of_occu(var, list): occ = 0 for i in list: if i == var: occ += 1 return occ var = 6 print(number_of_occu(var, lista_doi)) string = 'numaram cate cuvinte avem in propozitia asta ' def words(string): words = 1 for i in range(len(string) - 1): if string[i] == ' ' and string[i + 1] != ' ': words += 1 return words print(words(string))
# # PySNMP MIB module DLINK-PORT-SECURITY-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DLINK-PORT-SECURITY-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:35:02 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, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueRangeConstraint, ConstraintsIntersection, ValueSizeConstraint, SingleValueConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ConstraintsIntersection", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsUnion") dlink_common_mgmt, = mibBuilder.importSymbols("DLINK-ID-REC-MIB", "dlink-common-mgmt") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") Integer32, IpAddress, ObjectIdentity, NotificationType, ModuleIdentity, MibIdentifier, iso, Gauge32, Counter32, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter64, Bits, Unsigned32, TimeTicks = mibBuilder.importSymbols("SNMPv2-SMI", "Integer32", "IpAddress", "ObjectIdentity", "NotificationType", "ModuleIdentity", "MibIdentifier", "iso", "Gauge32", "Counter32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter64", "Bits", "Unsigned32", "TimeTicks") MacAddress, DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "MacAddress", "DisplayString", "TextualConvention") swPortSecMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 171, 12, 63)) if mibBuilder.loadTexts: swPortSecMIB.setLastUpdated('1210161030Z') if mibBuilder.loadTexts: swPortSecMIB.setOrganization('D-Link Corp.') swPortSecCtrl = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 12, 63, 1)) swPortSecInfo = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 12, 63, 2)) swPortSecMgmt = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 12, 63, 3)) swPortSecTrapLogState = MibScalar((1, 3, 6, 1, 4, 1, 171, 12, 63, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swPortSecTrapLogState.setStatus('current') swPortSecSysMaxLernAddr = MibScalar((1, 3, 6, 1, 4, 1, 171, 12, 63, 1, 2), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swPortSecSysMaxLernAddr.setStatus('current') swPortSecTrapState = MibScalar((1, 3, 6, 1, 4, 1, 171, 12, 63, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swPortSecTrapState.setStatus('current') swPortSecLogState = MibScalar((1, 3, 6, 1, 4, 1, 171, 12, 63, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swPortSecLogState.setStatus('current') swPortSecMgmtByPort = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 1)) swPortSecPortTable = MibTable((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 1, 1), ) if mibBuilder.loadTexts: swPortSecPortTable.setStatus('current') swPortSecPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 1, 1, 1), ).setIndexNames((0, "DLINK-PORT-SECURITY-MIB", "swPortSecPortIndex")) if mibBuilder.loadTexts: swPortSecPortEntry.setStatus('current') swPortSecPortIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 1, 1, 1, 1), Integer32()) if mibBuilder.loadTexts: swPortSecPortIndex.setStatus('current') swPortSecPortMaxLernAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 1, 1, 1, 2), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swPortSecPortMaxLernAddr.setStatus('current') swPortSecPortLockAddrMode = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 1, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("permanent", 1), ("deleteOnTimeout", 2), ("deleteOnReset", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swPortSecPortLockAddrMode.setStatus('current') swPortSecPortAdmState = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 1, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swPortSecPortAdmState.setStatus('current') swPortSecPortClearCtrl = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 1, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("other", 1), ("start", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swPortSecPortClearCtrl.setStatus('current') swPortSecPortViolationAction = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 1, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("drop", 1), ("shutdown", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swPortSecPortViolationAction.setStatus('current') swPortSecMgmtByVLAN = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 2)) swPortSecVLANTable = MibTable((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 2, 1), ) if mibBuilder.loadTexts: swPortSecVLANTable.setStatus('current') swPortSecVLANEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 2, 1, 1), ).setIndexNames((0, "DLINK-PORT-SECURITY-MIB", "swPortSecVLANID")) if mibBuilder.loadTexts: swPortSecVLANEntry.setStatus('current') swPortSecVLANID = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 2, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 4094))) if mibBuilder.loadTexts: swPortSecVLANID.setStatus('current') swPortSecVLANMaxLernAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 2, 1, 1, 2), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swPortSecVLANMaxLernAddr.setStatus('current') swPortSecVLANClearCtrl = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 2, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("other", 1), ("start", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swPortSecVLANClearCtrl.setStatus('current') swPortSecMgmtByVLANOnPort = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 3)) swPortSecVLANOnPortTable = MibTable((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 3, 1), ) if mibBuilder.loadTexts: swPortSecVLANOnPortTable.setStatus('current') swPortSecVLANOnPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 3, 1, 1), ).setIndexNames((0, "DLINK-PORT-SECURITY-MIB", "swPortSecPortIndex"), (0, "DLINK-PORT-SECURITY-MIB", "swPortSecVLANID")) if mibBuilder.loadTexts: swPortSecVLANOnPortEntry.setStatus('current') swPortSecVLANOnPortMaxLernAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 3, 1, 1, 1), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swPortSecVLANOnPortMaxLernAddr.setStatus('current') swPortSecVLANOnPortAddCtrl = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 3, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("other", 1), ("add", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swPortSecVLANOnPortAddCtrl.setStatus('current') swPortSecMgmtByVLANOnPortClearCtrl = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 3, 2)) swPortSecMgmtByVLANOnPortClearPort = MibScalar((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 3, 2, 1), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swPortSecMgmtByVLANOnPortClearPort.setStatus('current') swPortSecMgmtByVLANOnPortClearVID = MibScalar((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 3, 2, 2), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swPortSecMgmtByVLANOnPortClearVID.setStatus('current') swPortSecMgmtByVLANOnPortClearAction = MibScalar((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 3, 2, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("other", 1), ("start", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swPortSecMgmtByVLANOnPortClearAction.setStatus('current') swPortSecEntriesTable = MibTable((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 4), ) if mibBuilder.loadTexts: swPortSecEntriesTable.setStatus('current') swPortSecEntriesEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 4, 1), ).setIndexNames((0, "DLINK-PORT-SECURITY-MIB", "swPortSecMac"), (0, "DLINK-PORT-SECURITY-MIB", "swPortSecVID")) if mibBuilder.loadTexts: swPortSecEntriesEntry.setStatus('current') swPortSecMac = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 4, 1, 1), MacAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: swPortSecMac.setStatus('current') swPortSecVID = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 4, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 4094))).setMaxAccess("readonly") if mibBuilder.loadTexts: swPortSecVID.setStatus('current') swPortSecPort = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 4, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swPortSecPort.setStatus('current') swPortSecDelCtrl = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 4, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("other", 1), ("start", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swPortSecDelCtrl.setStatus('current') mibBuilder.exportSymbols("DLINK-PORT-SECURITY-MIB", swPortSecDelCtrl=swPortSecDelCtrl, swPortSecVLANOnPortEntry=swPortSecVLANOnPortEntry, swPortSecVLANEntry=swPortSecVLANEntry, swPortSecPortClearCtrl=swPortSecPortClearCtrl, swPortSecPort=swPortSecPort, swPortSecTrapState=swPortSecTrapState, swPortSecMgmtByVLANOnPortClearPort=swPortSecMgmtByVLANOnPortClearPort, swPortSecMgmtByVLANOnPortClearAction=swPortSecMgmtByVLANOnPortClearAction, swPortSecPortLockAddrMode=swPortSecPortLockAddrMode, swPortSecCtrl=swPortSecCtrl, swPortSecLogState=swPortSecLogState, swPortSecVLANID=swPortSecVLANID, swPortSecVLANOnPortMaxLernAddr=swPortSecVLANOnPortMaxLernAddr, swPortSecMIB=swPortSecMIB, swPortSecPortViolationAction=swPortSecPortViolationAction, swPortSecMgmtByVLANOnPortClearVID=swPortSecMgmtByVLANOnPortClearVID, swPortSecVLANMaxLernAddr=swPortSecVLANMaxLernAddr, swPortSecPortAdmState=swPortSecPortAdmState, swPortSecMgmtByVLAN=swPortSecMgmtByVLAN, swPortSecPortTable=swPortSecPortTable, swPortSecMac=swPortSecMac, swPortSecEntriesTable=swPortSecEntriesTable, swPortSecSysMaxLernAddr=swPortSecSysMaxLernAddr, swPortSecVLANTable=swPortSecVLANTable, swPortSecMgmt=swPortSecMgmt, swPortSecVLANOnPortTable=swPortSecVLANOnPortTable, swPortSecTrapLogState=swPortSecTrapLogState, swPortSecVLANClearCtrl=swPortSecVLANClearCtrl, swPortSecVID=swPortSecVID, swPortSecMgmtByVLANOnPortClearCtrl=swPortSecMgmtByVLANOnPortClearCtrl, swPortSecEntriesEntry=swPortSecEntriesEntry, swPortSecPortMaxLernAddr=swPortSecPortMaxLernAddr, swPortSecPortEntry=swPortSecPortEntry, swPortSecInfo=swPortSecInfo, swPortSecPortIndex=swPortSecPortIndex, swPortSecMgmtByPort=swPortSecMgmtByPort, swPortSecVLANOnPortAddCtrl=swPortSecVLANOnPortAddCtrl, PYSNMP_MODULE_ID=swPortSecMIB, swPortSecMgmtByVLANOnPort=swPortSecMgmtByVLANOnPort)
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_intersection, value_size_constraint, single_value_constraint, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'ConstraintsIntersection', 'ValueSizeConstraint', 'SingleValueConstraint', 'ConstraintsUnion') (dlink_common_mgmt,) = mibBuilder.importSymbols('DLINK-ID-REC-MIB', 'dlink-common-mgmt') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (integer32, ip_address, object_identity, notification_type, module_identity, mib_identifier, iso, gauge32, counter32, mib_scalar, mib_table, mib_table_row, mib_table_column, counter64, bits, unsigned32, time_ticks) = mibBuilder.importSymbols('SNMPv2-SMI', 'Integer32', 'IpAddress', 'ObjectIdentity', 'NotificationType', 'ModuleIdentity', 'MibIdentifier', 'iso', 'Gauge32', 'Counter32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Counter64', 'Bits', 'Unsigned32', 'TimeTicks') (mac_address, display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'MacAddress', 'DisplayString', 'TextualConvention') sw_port_sec_mib = module_identity((1, 3, 6, 1, 4, 1, 171, 12, 63)) if mibBuilder.loadTexts: swPortSecMIB.setLastUpdated('1210161030Z') if mibBuilder.loadTexts: swPortSecMIB.setOrganization('D-Link Corp.') sw_port_sec_ctrl = mib_identifier((1, 3, 6, 1, 4, 1, 171, 12, 63, 1)) sw_port_sec_info = mib_identifier((1, 3, 6, 1, 4, 1, 171, 12, 63, 2)) sw_port_sec_mgmt = mib_identifier((1, 3, 6, 1, 4, 1, 171, 12, 63, 3)) sw_port_sec_trap_log_state = mib_scalar((1, 3, 6, 1, 4, 1, 171, 12, 63, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: swPortSecTrapLogState.setStatus('current') sw_port_sec_sys_max_lern_addr = mib_scalar((1, 3, 6, 1, 4, 1, 171, 12, 63, 1, 2), integer32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: swPortSecSysMaxLernAddr.setStatus('current') sw_port_sec_trap_state = mib_scalar((1, 3, 6, 1, 4, 1, 171, 12, 63, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: swPortSecTrapState.setStatus('current') sw_port_sec_log_state = mib_scalar((1, 3, 6, 1, 4, 1, 171, 12, 63, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: swPortSecLogState.setStatus('current') sw_port_sec_mgmt_by_port = mib_identifier((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 1)) sw_port_sec_port_table = mib_table((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 1, 1)) if mibBuilder.loadTexts: swPortSecPortTable.setStatus('current') sw_port_sec_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 1, 1, 1)).setIndexNames((0, 'DLINK-PORT-SECURITY-MIB', 'swPortSecPortIndex')) if mibBuilder.loadTexts: swPortSecPortEntry.setStatus('current') sw_port_sec_port_index = mib_table_column((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 1, 1, 1, 1), integer32()) if mibBuilder.loadTexts: swPortSecPortIndex.setStatus('current') sw_port_sec_port_max_lern_addr = mib_table_column((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 1, 1, 1, 2), integer32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: swPortSecPortMaxLernAddr.setStatus('current') sw_port_sec_port_lock_addr_mode = mib_table_column((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 1, 1, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('permanent', 1), ('deleteOnTimeout', 2), ('deleteOnReset', 3)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: swPortSecPortLockAddrMode.setStatus('current') sw_port_sec_port_adm_state = mib_table_column((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 1, 1, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: swPortSecPortAdmState.setStatus('current') sw_port_sec_port_clear_ctrl = mib_table_column((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 1, 1, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('other', 1), ('start', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: swPortSecPortClearCtrl.setStatus('current') sw_port_sec_port_violation_action = mib_table_column((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 1, 1, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('drop', 1), ('shutdown', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: swPortSecPortViolationAction.setStatus('current') sw_port_sec_mgmt_by_vlan = mib_identifier((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 2)) sw_port_sec_vlan_table = mib_table((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 2, 1)) if mibBuilder.loadTexts: swPortSecVLANTable.setStatus('current') sw_port_sec_vlan_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 2, 1, 1)).setIndexNames((0, 'DLINK-PORT-SECURITY-MIB', 'swPortSecVLANID')) if mibBuilder.loadTexts: swPortSecVLANEntry.setStatus('current') sw_port_sec_vlanid = mib_table_column((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 2, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 4094))) if mibBuilder.loadTexts: swPortSecVLANID.setStatus('current') sw_port_sec_vlan_max_lern_addr = mib_table_column((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 2, 1, 1, 2), integer32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: swPortSecVLANMaxLernAddr.setStatus('current') sw_port_sec_vlan_clear_ctrl = mib_table_column((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 2, 1, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('other', 1), ('start', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: swPortSecVLANClearCtrl.setStatus('current') sw_port_sec_mgmt_by_vlan_on_port = mib_identifier((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 3)) sw_port_sec_vlan_on_port_table = mib_table((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 3, 1)) if mibBuilder.loadTexts: swPortSecVLANOnPortTable.setStatus('current') sw_port_sec_vlan_on_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 3, 1, 1)).setIndexNames((0, 'DLINK-PORT-SECURITY-MIB', 'swPortSecPortIndex'), (0, 'DLINK-PORT-SECURITY-MIB', 'swPortSecVLANID')) if mibBuilder.loadTexts: swPortSecVLANOnPortEntry.setStatus('current') sw_port_sec_vlan_on_port_max_lern_addr = mib_table_column((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 3, 1, 1, 1), integer32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: swPortSecVLANOnPortMaxLernAddr.setStatus('current') sw_port_sec_vlan_on_port_add_ctrl = mib_table_column((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 3, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('other', 1), ('add', 2)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swPortSecVLANOnPortAddCtrl.setStatus('current') sw_port_sec_mgmt_by_vlan_on_port_clear_ctrl = mib_identifier((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 3, 2)) sw_port_sec_mgmt_by_vlan_on_port_clear_port = mib_scalar((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 3, 2, 1), integer32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: swPortSecMgmtByVLANOnPortClearPort.setStatus('current') sw_port_sec_mgmt_by_vlan_on_port_clear_vid = mib_scalar((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 3, 2, 2), integer32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: swPortSecMgmtByVLANOnPortClearVID.setStatus('current') sw_port_sec_mgmt_by_vlan_on_port_clear_action = mib_scalar((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 3, 2, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('other', 1), ('start', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: swPortSecMgmtByVLANOnPortClearAction.setStatus('current') sw_port_sec_entries_table = mib_table((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 4)) if mibBuilder.loadTexts: swPortSecEntriesTable.setStatus('current') sw_port_sec_entries_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 4, 1)).setIndexNames((0, 'DLINK-PORT-SECURITY-MIB', 'swPortSecMac'), (0, 'DLINK-PORT-SECURITY-MIB', 'swPortSecVID')) if mibBuilder.loadTexts: swPortSecEntriesEntry.setStatus('current') sw_port_sec_mac = mib_table_column((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 4, 1, 1), mac_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: swPortSecMac.setStatus('current') sw_port_sec_vid = mib_table_column((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 4, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 4094))).setMaxAccess('readonly') if mibBuilder.loadTexts: swPortSecVID.setStatus('current') sw_port_sec_port = mib_table_column((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 4, 1, 3), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: swPortSecPort.setStatus('current') sw_port_sec_del_ctrl = mib_table_column((1, 3, 6, 1, 4, 1, 171, 12, 63, 3, 4, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('other', 1), ('start', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: swPortSecDelCtrl.setStatus('current') mibBuilder.exportSymbols('DLINK-PORT-SECURITY-MIB', swPortSecDelCtrl=swPortSecDelCtrl, swPortSecVLANOnPortEntry=swPortSecVLANOnPortEntry, swPortSecVLANEntry=swPortSecVLANEntry, swPortSecPortClearCtrl=swPortSecPortClearCtrl, swPortSecPort=swPortSecPort, swPortSecTrapState=swPortSecTrapState, swPortSecMgmtByVLANOnPortClearPort=swPortSecMgmtByVLANOnPortClearPort, swPortSecMgmtByVLANOnPortClearAction=swPortSecMgmtByVLANOnPortClearAction, swPortSecPortLockAddrMode=swPortSecPortLockAddrMode, swPortSecCtrl=swPortSecCtrl, swPortSecLogState=swPortSecLogState, swPortSecVLANID=swPortSecVLANID, swPortSecVLANOnPortMaxLernAddr=swPortSecVLANOnPortMaxLernAddr, swPortSecMIB=swPortSecMIB, swPortSecPortViolationAction=swPortSecPortViolationAction, swPortSecMgmtByVLANOnPortClearVID=swPortSecMgmtByVLANOnPortClearVID, swPortSecVLANMaxLernAddr=swPortSecVLANMaxLernAddr, swPortSecPortAdmState=swPortSecPortAdmState, swPortSecMgmtByVLAN=swPortSecMgmtByVLAN, swPortSecPortTable=swPortSecPortTable, swPortSecMac=swPortSecMac, swPortSecEntriesTable=swPortSecEntriesTable, swPortSecSysMaxLernAddr=swPortSecSysMaxLernAddr, swPortSecVLANTable=swPortSecVLANTable, swPortSecMgmt=swPortSecMgmt, swPortSecVLANOnPortTable=swPortSecVLANOnPortTable, swPortSecTrapLogState=swPortSecTrapLogState, swPortSecVLANClearCtrl=swPortSecVLANClearCtrl, swPortSecVID=swPortSecVID, swPortSecMgmtByVLANOnPortClearCtrl=swPortSecMgmtByVLANOnPortClearCtrl, swPortSecEntriesEntry=swPortSecEntriesEntry, swPortSecPortMaxLernAddr=swPortSecPortMaxLernAddr, swPortSecPortEntry=swPortSecPortEntry, swPortSecInfo=swPortSecInfo, swPortSecPortIndex=swPortSecPortIndex, swPortSecMgmtByPort=swPortSecMgmtByPort, swPortSecVLANOnPortAddCtrl=swPortSecVLANOnPortAddCtrl, PYSNMP_MODULE_ID=swPortSecMIB, swPortSecMgmtByVLANOnPort=swPortSecMgmtByVLANOnPort)
class Node: def __init__(self): self.data=None self.next=None class Linked_List(Node): def __init__(self): self.start=None def Create(self): while True: newnode=Node() newnode.data=int(input("Enter data part : ")) if self.start==None: self.start=newnode current=newnode else: current.next=newnode current=newnode char=input("DO YOU WANT TO ENTER MORE NODES? : ") if char in ('n','N'): break def Display(self): ptr=self.start print("\n\nDATA IS AS FOLLOWS : \n") while ptr!=None: print(ptr.data,end=' ') ptr=ptr.next print() def Reverse(self,ptr): if ptr==None: return self.Reverse(ptr.next) print(ptr.data) l1=Linked_List() l1.Create() l1.Display() l1.Reverse(l1.start)
class Node: def __init__(self): self.data = None self.next = None class Linked_List(Node): def __init__(self): self.start = None def create(self): while True: newnode = node() newnode.data = int(input('Enter data part : ')) if self.start == None: self.start = newnode current = newnode else: current.next = newnode current = newnode char = input('DO YOU WANT TO ENTER MORE NODES? : ') if char in ('n', 'N'): break def display(self): ptr = self.start print('\n\nDATA IS AS FOLLOWS : \n') while ptr != None: print(ptr.data, end=' ') ptr = ptr.next print() def reverse(self, ptr): if ptr == None: return self.Reverse(ptr.next) print(ptr.data) l1 = linked__list() l1.Create() l1.Display() l1.Reverse(l1.start)
# ------------------- # Universal Exception # ------------------- class FontPartsError(Exception): pass
class Fontpartserror(Exception): pass
for i in range(2,10): flag=0 s=0 for j in range(2,i//2+1): if i%j==0: flag=1 break if flag==0: s+=i print('prime',i,s)
for i in range(2, 10): flag = 0 s = 0 for j in range(2, i // 2 + 1): if i % j == 0: flag = 1 break if flag == 0: s += i print('prime', i, s)
class RoadmapNode: def __init__(self, id, config): self.id = id self.config = config self.neighbors = [] def get_config(self): return self.config def get_id(self): return self.id ''' Add another RoadmapNode as neighbor. ''' def add_neighbor(self, node): self.neighbors.append(node) def get_neighbors(self): return self.neighbors def __len__(self): return 3 def __getitem__(self, i): return self.config[i] def __repr__(self): return 'Item({}, {})'.format(self.config[0], self.config[1])
class Roadmapnode: def __init__(self, id, config): self.id = id self.config = config self.neighbors = [] def get_config(self): return self.config def get_id(self): return self.id ' Add another RoadmapNode as neighbor. ' def add_neighbor(self, node): self.neighbors.append(node) def get_neighbors(self): return self.neighbors def __len__(self): return 3 def __getitem__(self, i): return self.config[i] def __repr__(self): return 'Item({}, {})'.format(self.config[0], self.config[1])
model_source = 'bert-base-chinese' max_len = 512 num_workers = 2 batch_size = 32 # for training manual_seed = 1313 exp_name = 'bert_detection' train_json = 'data/aishell3_train.json' valid_json = 'data/aishell3_valid.json' lr = 5e-5 val_interval = 100 num_iter = 10000
model_source = 'bert-base-chinese' max_len = 512 num_workers = 2 batch_size = 32 manual_seed = 1313 exp_name = 'bert_detection' train_json = 'data/aishell3_train.json' valid_json = 'data/aishell3_valid.json' lr = 5e-05 val_interval = 100 num_iter = 10000
#!/usr/bin/env python # coding: utf-8 def sort_blocks(): # First, we load the current README into memory with open('README.md', 'r', encoding='UTF8') as read_me_file: read_me = read_me_file.read() # Separating the 'table of contents' from the contents (blocks) table_of_contents = ''.join(read_me.split('- - -')[0]) blocks = ''.join(read_me.split('- - -')[1]).split('\n# ') for i in range(len(blocks)): if i == 0: blocks[i] = blocks[i] + '\n' else: blocks[i] = '# ' + blocks[i] + '\n' # Sorting the libraries inner_blocks = sorted(blocks[0].split('##')) for i in range(1, len(inner_blocks)): if inner_blocks[i][0] != '#': inner_blocks[i] = '##' + inner_blocks[i] inner_blocks = ''.join(inner_blocks) # Replacing the non-sorted libraries by the sorted ones and gathering all at the final_README file blocks[0] = inner_blocks final_README = table_of_contents + '- - -' + ''.join(blocks) with open('README.md', 'w+', encoding='UTF8') as sorted_file: sorted_file.write(final_README) def main(): # First, we load the current README into memory as an array of lines with open('README.md', 'r', encoding='UTF8') as read_me_file: read_me = read_me_file.readlines() # Then we cluster the lines together as blocks # Each block represents a collection of lines that should be sorted # This was done by assuming only links ([...](...)) are meant to be sorted # Clustering is done by indentation blocks = [] last_indent = None for line in read_me: s_line = line.lstrip() indent = len(line) - len(s_line) if s_line.startswith('-'): if indent == last_indent: blocks[-1].append(line) else: blocks.append([line]) last_indent = indent else: blocks.append([line]) last_indent = None with open('README.md', 'w+', encoding='UTF8') as sorted_file: # Then all of the blocks are sorted individually blocks = [ ''.join(sorted(block, key=str.lower)) for block in blocks ] # And the result is written back to README.md sorted_file.write(''.join(blocks)) # Then we call the sorting method sort_blocks() if __name__ == "__main__": main()
def sort_blocks(): with open('README.md', 'r', encoding='UTF8') as read_me_file: read_me = read_me_file.read() table_of_contents = ''.join(read_me.split('- - -')[0]) blocks = ''.join(read_me.split('- - -')[1]).split('\n# ') for i in range(len(blocks)): if i == 0: blocks[i] = blocks[i] + '\n' else: blocks[i] = '# ' + blocks[i] + '\n' inner_blocks = sorted(blocks[0].split('##')) for i in range(1, len(inner_blocks)): if inner_blocks[i][0] != '#': inner_blocks[i] = '##' + inner_blocks[i] inner_blocks = ''.join(inner_blocks) blocks[0] = inner_blocks final_readme = table_of_contents + '- - -' + ''.join(blocks) with open('README.md', 'w+', encoding='UTF8') as sorted_file: sorted_file.write(final_README) def main(): with open('README.md', 'r', encoding='UTF8') as read_me_file: read_me = read_me_file.readlines() blocks = [] last_indent = None for line in read_me: s_line = line.lstrip() indent = len(line) - len(s_line) if s_line.startswith('-'): if indent == last_indent: blocks[-1].append(line) else: blocks.append([line]) last_indent = indent else: blocks.append([line]) last_indent = None with open('README.md', 'w+', encoding='UTF8') as sorted_file: blocks = [''.join(sorted(block, key=str.lower)) for block in blocks] sorted_file.write(''.join(blocks)) sort_blocks() if __name__ == '__main__': main()
for i in range(int(input())): s = input().split() if 'not' in s: print('Real Fancy') else: print('regularly fancy')
for i in range(int(input())): s = input().split() if 'not' in s: print('Real Fancy') else: print('regularly fancy')
input = [ "17-19 p: pwpzpfbrcpppjppbmppp", "10-11 b: bbbbbbbbbbbj", "17-19 c: ccccccccccfrcctcccjc", "8-10 k: kkkkkkkfkkks", "13-14 l: lvllvllllslllv", "8-9 n: nhhcnnnknnqnb", "1-3 d: pdbdfbws", "5-6 v: vvvgvb", "7-8 x: gxcxtwbl", "2-15 r: xlgrwqpcsqtrvfrrt", "9-14 l: glnldlllllllln", "2-3 r: vxnw", "8-9 g: gfggczgkgggjgg", "4-5 d: ddddh", "6-9 t: zttttbhbttttftd", "3-6 k: kkkzwnmv", "2-7 w: sgmvplwwjx", "11-13 h: hhhvhhhhhhvhh", "9-10 f: mhfdfffffmlffsfvts", "17-18 l: llllllllllllllllrzl", "4-5 c: crcccccccvc", "9-12 q: qqqqqpqrqqlcq", "7-8 n: nnnnnndn", "3-5 f: ffqnfpffhf", "3-4 j: djpj", "17-18 q: qqqqqqqmqqsqqqqqjq", "8-15 j: bjmjbbqfjjrgjgfkjj", "2-11 d: xdgdmxgwzdpdxdhjwd", "8-9 p: bppppppmp", "10-11 t: ttttttttttb", "5-8 v: vhxvfcsvvxjvvvpgwdv", "9-17 q: mqqqqqqqqqjvqqqqzlq", "1-2 t: tptbbn", "9-11 q: gqqqqqqfwqqqq", "8-9 h: hsdsfkgphxglmsjndhh", "2-3 z: mzgz", "4-16 n: nxnsqmrnnnpfvnfnb", "1-3 r: rbzcrkjrqrrnjxj", "1-5 c: ccccccq", "4-11 m: mmmgmmmmmmm", "8-9 z: zlzvzzzpzz", "1-18 h: xzqhmkzhhrtxpljptbc", "3-4 p: pbpg", "16-20 j: jrfjjzjjjrjjgvjkzjjj", "6-9 t: ctdtthtlttttpt", "3-4 h: mfhj", "5-10 t: tgtxttqhtl", "1-3 w: fwgw", "6-7 q: qvqlrqp", "12-13 m: mmmmmmmmrmmmplm", "12-14 r: rrrrhrrrrrrrrbrc", "4-6 b: ljzbqgwxcdmdjfbcwd", "7-10 g: gggggggmgpg", "2-3 c: mbcc", "7-8 k: kbkkkktkckc", "7-8 p: pppppppbp", "5-8 w: twwwwwwgvvwvdttmh", "13-17 p: ppppfppppppppppppp", "8-12 x: xxxcxxxbjxxxxk", "9-18 b: hhbbqcbbbsblbgpwbbhf", "6-8 h: hhhhfhhchhjhhch", "7-11 g: ggtnwvcdgctkrggxj", "5-8 k: kknhndzm", "4-5 z: zzznz", "2-4 p: pbtp", "16-18 r: rrrrtrrrrrrrrrrhrr", "15-16 r: rhrrrrrrrrrrrrrx", "7-10 l: lllklmhxzlxcdljz", "7-8 q: qqpwsqqb", "9-13 k: qkknkkxlzkrkkkkkpk", "4-8 h: wlrhfbth", "6-8 q: vppqqqgntfqqgqq", "19-20 g: ggggggggggggggggggfg", "4-5 m: shmzmsdm", "3-4 k: kkhkk", "4-7 b: cbsqkcpnkcfzhmpvfvgz", "18-19 l: lllllllnllltdlwgllxl", "14-15 z: zztzzzthdzzzzzn", "9-10 s: ksssbsssstss", "2-10 t: mltjpttttthpttttz", "3-9 n: pqnpfxgfnzqxv", "7-11 d: ndddddhdddddddd", "11-13 v: vkvbwrchzvhhvpc", "13-15 l: llllllllllllllll", "10-13 c: ccclwbcbccbxvcrdzctc", "8-9 w: klvwtwwwbwhww", "2-4 j: mnmb", "10-14 w: wwwmwwwwwwwwlnwsw", "14-17 x: xxxxxxxxxxxxxlxxkxx", "3-7 r: bxrqzxsrfmclfdrqrtpf", "7-14 b: bbbbqbbbbbbbbbbbbbb", "7-13 p: wwvhwdprjxppwnhsbp", "2-3 h: hqhh", "8-11 n: nnnnnnnjcnn", "5-12 l: cwzxlpvwlsfjqrgk", "3-5 v: vvphwvv", "5-16 d: dpdrdfdrhwdrrqdqxd", "14-18 z: zzzzzzzzzzzzzzzzzkzz", "2-5 h: hcjlh", "12-13 w: wwwwwwwwwbwlw", "15-16 c: ccccccccccccccxc", "4-7 b: lbbsbbwhb", "2-5 z: qtwmzhzmwqw", "5-6 d: drjddc", "7-9 q: qqqqjqqfdqq", "14-15 r: rvrqrrrrrwsrrmrrd", "16-17 h: hhhhhhhhhhhhhhhhlh", "10-16 f: fvhgfzffchmffgfff", "3-7 q: qcqlvdvgrqtqcq", "7-9 x: xxsxxrxxpsx", "3-10 h: hjhjthhrthcdhhhhxz", "15-16 t: tttttttztwbwptjt", "3-5 x: xrlxqx", "3-4 b: bbbp", "1-4 n: jnhnndn", "3-6 c: ccccfm", "7-8 v: tvtvdvspvvv", "6-8 l: lljlllgsglcsw", "2-13 h: jhzzcgpxhbgqsbwhf", "17-18 j: jjjjjjjjjjjjjjjjhc", "2-3 c: ctcchxklnbrqc", "3-14 w: wwcwwwwwwwcwww", "1-3 k: kcxf", "9-14 t: ttttkttlnttmtttt", "2-4 x: xkxxqzxvck", "5-6 h: dgmxghjxjnhs", "4-12 f: fvhlffxnfjhfffqxfcf", "1-10 b: pfsbflbbkbqk", "8-9 s: qzkfszjss", "1-14 m: mmmmmsmmxmqmmmmmmmm", "11-13 w: nsgwwwwwwpbwvwww", "2-15 t: sprsbpztsznslst", "3-4 d: tqscgnrjxrqdwqd", "5-17 x: xqrzxxxxfxzxrzxxxw", "8-9 m: mkmhmgdmq", "6-8 q: qqqqqqqxq", "2-5 m: mmmmmf", "4-13 v: gvvvsvfmmmvvx", "13-16 t: ttttttttgtvtwttntt", "8-16 c: ccccccczccccccccc", "10-11 b: bbbbbbkbbvbbbbb", "1-12 n: pnnnnbnhnnbng", "5-6 b: qbbbbb", "4-6 z: zzzzzvjzzznxdzx", "2-3 p: dwxqpjp", "4-6 w: wwwxwq", "2-3 x: pvpdh", "5-8 n: pqnnkncnnfnnnnnn", "10-12 w: drqwwxrwwkwwwswwl", "2-4 g: rbggfslgjqqhj", "9-19 r: pzxhrcfrrrqjqfkhrhjz", "3-6 n: rngtnnnnn", "4-14 t: tttttttttttftgttttht", "6-8 q: qqdtqqmrgqcqqqqc", "3-14 t: tttnttttttttqk", "9-10 w: qqwcjzwgjnqdrdxwjwl", "10-12 t: tthtthtktvtttt", "2-7 v: vzvvvvv", "5-17 p: zzpsmpgpprdmhxprsvs", "8-9 t: ttttttvnt", "4-8 v: vvvfvvvvvvvvvvv", "7-15 h: cwkhdzmththzjnh", "7-9 v: vjvlwzvvmv", "1-2 c: hchw", "7-8 f: ffpfffsfqf", "5-8 s: xlssskszb", "2-15 x: fxzpbvqzmkxvtlljjrg", "1-3 s: hsss", "7-14 m: xmmtmmmgmrmmxzmxm", "10-13 z: dnzztzzzzzfszxzczg", "3-8 h: rhthhnhh", "6-9 g: hbggggggggbg", "13-15 z: zzzzpzbzzzzzfzzz", "5-15 l: llllwlllllllllll", "3-5 m: dhmmm", "2-13 h: hrrhgqhhnhkhhhhb", "1-5 p: kpppp", "2-13 m: fmqjmrzhskzwdnt", "7-8 q: bqxvzqqsjpqqqq", "2-13 d: ddhdddddddddbddddd", "5-9 s: nhkmxssqsjssjs", "2-11 b: vlrtxpzkqwb", "6-7 q: qqqqqcq", "7-9 n: nnnnnknnmgn", "3-9 n: qfkxknwnn", "15-16 d: dddddddddddddddgd", "12-13 h: hhhhhhhhhjmvhhh", "3-4 w: tbfw", "8-9 f: fkffbfhtf", "2-4 q: qjsqqf", "2-11 t: ttttpdgtlxhtx", "7-10 k: dkkkkkkkkh", "6-7 c: hccccxcgv", "6-7 j: sjcbfmj", "1-2 w: vtrwjcgndvwx", "12-13 m: mmmcmmmmmmmms", "3-7 h: hhhhhhw", "9-13 g: gghgwgrrkgcgg", "12-13 g: gggggggggggfgggg", "13-16 s: sssssssfsssssszb", "2-17 p: pbpmpmwpnqppppppphbd", "2-9 c: cmrcwfnjcdcxccccrzc", "8-12 j: jvjjjcjxjjdqjjjr", "6-9 m: mgjxmcfdm", "2-5 l: klmxlx", "2-10 x: jvxwxpxrxx", "2-3 r: rrzrp", "2-12 v: cbfrnctdmzwvlbvjmdgg", "2-9 r: wrbrrrrzm", "12-13 h: fhsbhhhhhhhwhhhhhh", "5-8 d: ddhqdddddp", "4-5 l: djnlnlllbl", "2-9 t: tdtgttddtwwj", "16-20 t: tttttttttttttttttttt", "5-8 z: zzzszzzmszz", "8-13 d: dddddddbdzwddd", "9-10 z: zzztzzzhzxgz", "10-12 p: wppcppxpppgpppzr", "4-5 w: wkwtwwzww", "3-9 m: dmmmrmmmm", "1-4 g: gvmr", "8-9 d: frxndpdzwd", "17-20 q: qqqqqqnqqqqqqqqqhqqq", "7-13 w: pwfwwrwwwkwww", "3-5 q: qqpqw", "11-13 p: pplpppppppppb", "4-12 g: glggjmsggggjrgbgm", "3-7 p: cfphqrxpsgthp", "12-15 f: gfnrhffgftnbggfwtbp", "16-18 p: pppppppppppppppppm", "3-4 l: lllzn", "1-2 d: dddd", "8-12 n: nnnnxnnhnnnn", "2-4 z: zzzzz", "1-4 s: sssms", "2-4 h: hghhh", "1-10 l: nhtnzhdtmslxqskf", "5-13 j: bpzjjrrqzndjtw", "1-2 x: xxchn", "1-16 v: vjvrxvdbdnvvkzvg", "9-10 b: xbvzbbmfmbqbbvbbrb", "8-12 k: ktnkfbgkkkkbkmkk", "7-9 h: hhhhhhwhh", "16-17 g: sgggmggggggggggvggg", "3-10 q: qmlqqqqqqq", "11-14 h: hhhxhhhhhchhwkh", "9-14 f: kqwqcftkfdxgmsd", "12-13 p: pppppppppppph", "7-8 f: dkfnjfff", "5-6 f: jtfrrfxckhfmfffszggg", "6-8 n: jzhpkszn", "8-10 c: cccccnckcxmrchjc", "14-15 d: dddjdjdddddddpp", "8-10 f: cfshmqfffwtffltfzff", "3-4 b: bdbq", "2-6 b: cfqkbtvmn", "15-16 z: zgzzqzjhzzmnzkzvzz", "4-6 r: krrrrlm", "3-6 c: dcczrfr", "8-9 s: ssssssfws", "11-12 s: mssssssssssq", "1-2 r: zrznpmzrs", "10-11 k: kkkkkkkkkfk", "3-9 k: kbkkkkgkk", "1-4 w: lwwtw", "3-4 t: ttkt", "2-3 m: htvmjk", "2-4 p: mdpp", "10-17 s: ssssssssssssssssws", "1-2 m: gmmc", "5-9 d: dddbvjkdd", "5-8 z: tmnfplzz", "7-14 s: ssssssssssssstkss", "2-7 q: gqbcxnqcvszwbxqkz", "6-17 b: btbxlbbbbbbbbbvtbkd", "6-9 l: lllllllld", "11-12 q: nqqjjrhgxgqp", "6-9 n: nlnnfnnjb", "13-17 x: xnxxxxxxxxbdbxxrc", "5-13 w: wwtwrwzwwwqfwtkwtwbw", "5-10 g: gggxbgmgrgggggg", "13-16 h: mhhhhmshhchhhhhl", "2-3 f: flff", "2-4 k: kkhr", "2-6 m: mmmqmml", "6-7 p: ppppppp", "2-6 k: ksktkkk", "2-4 m: gkml", "5-6 h: hhvqhjz", "2-5 h: hkhqhfh", "3-4 z: zzglz", "2-3 f: zhfn", "10-11 m: mmzmmmmmmfmm", "3-13 d: ddwzdmmddmddz", "1-2 h: hvkhm", "4-5 n: nnnnb", "5-7 f: fjppbffffz", "2-4 g: tmlp", "15-16 q: bqfvqqqcptqqzqqx", "18-19 g: lpgqgcgsdtngfddbggnp", "3-5 z: kjzkq", "1-6 q: qjkqqzqq", "3-4 m: bpmmjgmmfmj", "2-5 k: jkvkz", "11-14 q: qqqbjqqqqqgqqq", "6-17 q: bfqqtlqqfjgqtqtqs", "5-16 s: ssdzfbsdhsszspssvs", "1-7 n: nhnvmhb", "4-5 b: hbbrk", "9-14 f: fffbffkfftcfnfgf", "1-3 n: nznxndpb", "3-4 k: qkktw", "3-8 r: rrprrgrrr", "2-5 l: sqmllls", "6-7 n: njnknvnnpvlbnx", "3-5 t: hbrtmcttt", "5-9 j: fjjnjcgjhnkcpqjbc", "2-4 l: jllx", "7-8 d: dddddndd", "3-6 t: gtsttjnt", "9-11 m: cbmgjlqcbsmllm", "1-2 l: vllfcckl", "10-11 p: ppppzppppplp", "2-4 m: slzmmrw", "3-8 h: bhhgmpbs", "7-14 t: tttttthttttttttt", "1-3 r: rrvvrrprwrfrcr", "5-15 w: gwbhwjwwwkswcsww", "2-5 v: zvtls", "1-4 v: vsvv", "10-15 z: zzzzzzzzzztrjzr", "3-5 v: vvvjhdvv", "3-12 s: wqssnmdlwlws", "2-3 r: djrftptcrskpzrz", "1-3 p: nbppgkmfnjp", "17-18 w: wwwwwwwwtwwwwwwwrw", "2-5 l: xqntklqlt", "2-5 g: gtkggghcvgl", "18-19 z: zzzzzzgzzzzzzzzzzztz", "16-17 x: xxcxxwxxblpxzkfxzj", "15-19 f: frffffstcwffccffffff", "3-4 n: npnm", "2-3 d: zvddd", "7-9 x: xzxxctxxl", "13-14 s: hhsxbzssdtssfss", "4-5 m: vbpmhmrmvrjnmhlsbmm", "3-6 z: zzzzzwdzzzzzzzzzz", "18-19 g: gggggggggggggggggng", "14-15 x: fxxjxxxxxxmxxwxxnxb", "10-12 m: xmmmmfmdmmkh", "3-4 b: bbgbgb", "11-13 c: cclcccbcxcccqcczc", "10-17 w: wwwwwwwswwwwwwnwpw", "5-7 l: blllqll", "4-10 n: nnnnnnnnntn", "9-10 z: fzzztzczwzzgkzzn", "4-5 x: gxjhxbxxx", "3-6 p: plhxppk", "10-19 p: mpgpmxdvqphrcckpvqw", "3-14 p: kfdwtqxpstpcfpgcfmp", "2-6 k: gnxkkkjrzkknskmpbsj", "8-10 l: lzllklldplllzl", "16-17 n: nnnsnnnnnnnnpnnjnnn", "1-14 c: kccccccccgccccc", "2-11 s: lsqghkzwsgsbdmgq", "6-7 p: pcpgqrcpqpptpm", "1-11 h: lhhhhhhhhqhhxbhhfhhh", "11-12 r: rrhjrbrrvrrrrdrrr", "5-8 c: cccccwck", "6-8 w: wwwwwwwb", "12-15 n: htvxnnhvnpnnknnhnt", "1-2 c: jcct", "2-10 v: vsvvvvvvvvv", "4-5 x: xhxtx", "3-4 f: ffxf", "5-8 v: wprmvflppqwvwfwpkq", "5-7 n: znnnnnxblcrn", "8-9 n: zljnjjbnn", "10-11 m: mzwkrvmzrdc", "3-7 h: hxkhfhcqhr", "6-13 j: vhcmljdxwkqnfcvmjjb", "1-6 g: gvgggthkr", "6-10 l: bldnllklkllllclslm", "6-7 g: gggggng", "1-4 x: xxxxxpnsv", "15-16 q: qqqqqsqqqqqqqqqbq", "6-7 q: qnqqqdqqq", "5-6 p: ppppspppp", "3-5 k: kkskkk", "1-2 j: jrjjjjj", "8-9 d: ddpzdlldmddhdhdd", "5-8 t: ttsljtnt", "2-4 w: qwwmwwhwwwwwwww", "6-8 c: clcccccv", "1-8 f: ffbfqfpfbfb", "5-13 r: rrrrkrrrrrrrrr", "15-18 v: vvvvvvvvjvvvvvvvvvvv", "7-8 r: xjwxkzqrrxr", "7-10 d: kddddddddbddd", "1-8 k: kkkkkkkkk", "4-6 q: rhdkjsqjqvzqcpsnq", "1-2 t: tdtt", "5-6 l: lllwlh", "3-5 f: pdzfff", "7-8 s: qsswssks", "3-5 d: dcdddd", "1-12 r: rvlrrrwdtkrcxffr", "2-7 d: rddcdlqtnffbdd", "5-9 t: phmtdzfjtdb", "9-12 x: jxxxxxxxxxxcx", "14-16 c: fcclccccmcnccwccqccv", "4-5 p: zxpzk", "15-19 t: ttttttttttttfkttttl", "5-10 k: kdmjgkkkkkblkvkkkk", "6-15 q: wqgmcqcmcjlgxkqrdstw", "6-7 r: rrrrrrr", "2-6 n: ksnnnnnzn", "16-17 g: ggggggggggggggghgg", "11-13 k: nsgkkkkzckxtkn", "2-5 q: jqvkqm", "2-10 q: lpqqmqlqqqqqtqqw", "10-20 k: dkztkkkkshkkkkkkkkdk", "4-7 d: fddddxd", "3-5 v: vvvvs", "7-9 b: bbbbbbrzb", "4-14 z: nbnzkbxbwhqpjsdlzz", "3-14 x: xxvxxxnxxxxxxxdxktxx", "7-9 z: qqpzzxzvsgzfzdzz", "14-15 c: ccccccccccccccmc", "11-12 k: kkkkkkkkkskv", "15-16 d: ddddddddddddddddd", "6-8 x: xkjhxwgxxzxxnzwxcxk", "2-6 t: tmwttc", "7-8 w: jwcwwwql", "5-14 d: jdpddtkddrdddpq", "9-14 t: mwctmnjxmztckt", "4-8 l: llnlxlmjn", "3-6 s: sssskvk", "4-8 c: ccchcrctczt", "4-6 s: wssnlsnsss", "8-18 s: sfkssssbswshsvshms", "6-7 b: bbkbcffmwblcmp", "8-15 w: fwwmswcwwhlwjwvtlq", "2-9 n: wnnnnmqhdpsnzn", "1-7 x: xkzzxpz", "5-8 x: txxxxmlxkrxsxzsx", "7-10 t: lchndztdttgk", "1-2 q: tqqq", "1-9 z: nzzzzzzzz", "1-2 l: djfmfwpnjclt", "2-6 x: xxxxxmxxs", "2-4 p: ppcv", "4-10 d: dddpddddddd", "8-11 n: nnnnnnnxnnnn", "17-18 v: vvvvnvtvvvjvvvvvzzvv", "5-8 h: hhhhhhhfhh", "9-16 v: vvvvvvvbvvvvsvtq", "3-4 r: hrhrrtrgrr", "11-17 g: mvgggwggggggwggxw", "3-6 r: rrnrrgrrrr", "8-10 n: rgjntnrmkn", "6-7 f: sffftmm", "4-5 b: bbddn", "4-9 d: cdrbqddsqqpzkdd", "9-17 n: nnnnnnnnrnnnnnnnjn", "1-4 n: knnn", "15-16 k: kkkhkkkkkkkkkkkv", "15-17 v: jkrddvtmgfqvqvvxk", "10-16 j: jjjjjjjjgpsjhjjljjj", "9-10 d: jdndwddvdrhndddd", "5-7 x: bxxxxwmcb", "5-7 r: mlrrdsrrrnrgwrrq", "14-17 h: hhhlhhhhhhhhhhhhm", "1-12 n: zpnwtpnnnnxzm", "11-19 k: ccktkhkwthkkklkvhkmk", "6-14 s: sfssxsscssgssqhsnssl", "17-18 g: ggdgggggggggfgggrggg", "4-13 k: dwddvztkhjnzk", "17-19 k: kkkkkkkkkkkkkkkkkkx", "5-8 q: qmqzqqqqqqqqqcqq", "2-4 q: vqqqqhxd", "1-13 c: fjccqcmrcjxgccdvbzr", "8-12 h: hkhhhhhhhvhhch", "4-10 w: jmwfwxwwkwwcnbwwftrc", "8-11 f: fffffffbffdf", "12-18 b: bbbbbbbbbbbcbbbbbbb", "2-8 k: rdwwjvrkcs", "13-14 p: pppphpnppppphpppp", "1-3 d: nddddddddddd", "5-8 m: mmfdkmnfmqm", "2-9 x: xjgwxxxxxl", "1-2 v: vhvsvv", "11-17 r: tlrgrrrrrwrzrrrrsrr", "1-7 c: lcclcvgk", "3-5 s: slnkss", "3-4 w: hqwbw", "11-19 l: lfxllllllldlllllllq", "4-5 t: tttbt", "10-12 g: gggggggggsgfg", "6-8 k: kkmkkkkmk", "10-11 q: qqqqqqpqqpsqd", "5-17 k: pxwkmdxkskthkkkkn", "14-16 m: mmmmmmmmmmmmmpmmmmmm", "14-15 k: kkkkkkkkkjkkkkt", "13-14 c: ccccccdccccccccccccc", "1-2 v: gvmqqnkpln", "4-6 k: lwkkkjgwkkk", "1-12 h: mhhthhghhhhhhhhh", "6-7 t: ptxtwtg", "3-9 j: zsjkcjlzj", "5-8 q: cpzhqfhvsjx", "5-11 s: ssbsskssgssdss", "4-12 t: ltkttnzdvxttllttt", "4-5 j: jjfjh", "4-5 r: rrrprjdtrfr", "4-8 d: ccwqskmd", "2-9 p: npzptdhsxxpkpk", "6-17 x: cxnxxpmxxxxhxxfhxxxx", "1-7 q: nqqzqnqqqf", "15-17 v: vvvvmkvjvwvscvvvv", "12-16 d: mddddbdddjddxddbd", "3-7 f: fxpfffff", "6-7 d: dgdwrddwhprchmvdr", "5-17 h: whhphdbxzwcdhhshwkkh", "5-7 f: ffffffjw", "10-12 s: grcsbsnssbfs", "6-10 z: zzzzzrzzzzzjz", "14-15 m: kdmmcmmmmmdmldm", "6-7 m: mcxmmcmm", "5-6 l: lmlllrlw", "3-16 q: qqwqqqqcmqqqqqxqbqq", "14-16 p: pppzspppppnppbppwwpp", "10-12 q: qqqqqqqqqqqqqq", "1-5 j: rjkjvjj", "3-9 d: fhqwddjrdzpkgdkd", "2-4 v: vlvw", "1-4 w: qwcww", "6-12 r: rhhzkrzhrwrxrkvrcbmr", "3-5 t: xxbtr", "5-6 x: xxxpxx", "2-5 q: qhqqq", "8-16 n: nnnnnknnnnnnnnnt", "8-10 g: gdzvghxcnbq", "4-19 m: rgmmbqmljmzswbkpkcn", "8-12 g: ggggggmhggrgbtghg", "13-15 t: ttttttttttttttxttt", "1-3 n: nntn", "3-4 h: hhxh", "6-7 f: ffffffbf", "2-3 t: bgtt", "7-9 n: nnnnnnjnn", "2-4 j: ljgj", "12-15 c: ccccdcccccccccfccc", "4-9 s: wssssssqlcssz", "1-2 z: ljzjgcvg", "6-7 q: qqqqqqs", "1-6 d: xpddgd", "4-14 f: ffffffffdzfffmf", "13-14 r: rrrrrrrrrrrrwrrr", "6-7 r: rrrcgbrrr", "9-15 b: lkkbbbbhbsbgxpgpbb", "3-4 f: qzfzwnffv", "4-14 m: rkksnmbgjmqmmmc", "8-13 n: fjnbrnnnqnnnnn", "13-17 h: hhhhhhchhhhhhhhhz", "8-9 n: rbtknnmpng", "1-6 c: qgtfhqtjkw", "2-8 m: wzfmmmmmflmdk", "5-7 v: cnvvvvvvv", "10-15 n: nxnnnjnsnnnnngnnknrt", "12-13 d: ddjddddddddddddd", "4-5 n: jncnnh", "6-10 z: zzzznbzzzczzl", "4-5 s: bsjsv", "9-11 g: hvkccbpfxkg", "1-2 b: bbqb", "7-16 l: lllllllllllllllplll", "1-5 l: llllml", "3-4 f: fmsf", "2-4 g: tgshjbgg", "2-7 h: vlzzhhhhhphhf", "8-9 p: pnpppppqh", "9-11 w: wrxlwdtwnwwtqwpwxgw", "8-10 m: mmmmmmmnmm", "1-5 p: dpnpppzpp", "3-5 l: bllflklcmp", "11-19 j: jkjjjvmjjjkjljjjjfj", "6-9 k: kkkkkkkbkk", "2-4 r: njprlsrmtr", "9-10 d: dxhdddddfdd", "3-8 z: dmrqpzwzghmznc", "2-8 r: tlgqwxcrdpj", "10-11 z: zzzzzzzzzzhz", "1-10 q: qqqqqqqqqsqqqqqqqq", "2-4 x: xrwxx", "10-11 s: zssssssssfz", "3-9 z: rszsgfzzz", "6-13 x: zsxwxxqtgxvbcxxbn", "10-16 s: smsssgssshsspwxsq", "1-2 g: ngqgc", "4-8 l: xllllngb", "4-7 h: rhhhhhghbm", "1-7 v: vqvslhm", "2-7 z: jjfmnmz", "1-10 v: vvvvvvvvvqv", "11-13 g: ggpgrgggggggggg", "3-6 p: tpgqnpphpl", "1-3 d: sddddd", "8-9 g: gggggggvg", "2-6 w: wtvwnw", "1-4 m: kmmwm", "3-4 h: mhvh", "1-4 h: cnjhxvhkdch", "7-8 w: wwwwwfwww", "6-9 r: rlrrrgrrr", "2-4 h: lggh", "10-11 q: qqqqqqqqqlh", "4-5 l: llllgl", "13-16 k: kmffmjbzrpprcdkxglk", "1-3 f: ffpf", "19-20 n: nnnnnnnbnnnnnnnnnnnv", "3-7 h: hhpmhjhwdhzhm", "1-5 k: hlkkrkzkf", "2-4 s: sssxssssssssssssssss", "12-13 d: dddgdddddqndtdkd", "3-14 c: cccczvcxchccccclctcl", "2-5 b: mbgbb", "6-8 j: jjtrtbsjnj", "5-6 s: sssqsk", "8-16 l: lfrlllllctllqxrpllll", "6-12 g: grxlwlnggxvg", "16-17 j: jjjjjjjjjjjjjjjjp", "6-10 q: nqmzqflbhqqb", "12-19 j: jjjjjjwjjjjkjjjjjjgt", "8-10 s: sscssssssp", "11-12 s: ssssssssssds", "2-5 n: hswqnqldwwbbmnnrnht", "4-7 p: ztpvbqpwsxrgrkp", "3-9 h: hhlhhcjrkhwnhq", "10-12 k: kkkkkkkkklkwk", "14-15 w: wwwwwvwwwwkwwqwnw", "16-20 b: bbbbbbbbbbbbbbbhbbbt", "2-5 t: tttttftttttt", "3-12 l: qswhtwvnfmfwn", "11-12 b: bbbbbbbbbjgvbbbbbbz", "8-13 w: wwwwtwwvwwwww", "5-6 f: kgjfhfffv", "7-17 g: qpxgkvgttkhxjhzxnv", "2-3 n: rhffpsqknv", "2-10 p: pkpppppppppp", "3-15 p: rnpqjpgmcpgzkxcppk", "12-13 d: nhdddldxdddddndpdddj", "14-16 h: hhhhhhhhhhhhhbrhhhhh", "4-9 r: rpzrcnrrrlx", "2-14 f: ffffzfzffffffjfff", "1-9 s: snhfksssxssss", "1-14 n: bnnnnnnnnlnnnn", "2-3 c: cwtccc", "10-12 k: kkkkkkkkcskkkdkk", "2-5 r: qrqsrkrk", "3-11 k: nlkqkszttxk", "2-3 d: vqdgpwnjprgsgsdrxwk", "7-12 k: hkkkkkkdkkkrk", "6-8 r: smmfvtxrhzvnrj", "8-10 l: llrllllllmll", "5-10 l: bpwgqlnktt", "4-6 f: flfvjfff", "13-14 b: bbbbbbbbbbfbqzzb", "5-6 m: rmhmqmkmtkmjnmvdx", "10-16 j: jtjjjjjjjdkjgjjjj", "3-4 c: cpcc", "10-11 v: vxgbfvqftvmc", "5-12 n: knqlnbhdphpw", "7-13 r: rrrrrtrrrrrrrrr", "4-7 n: nbnnffkjnwpqnhvqnr", "4-13 r: htrkdwrcmcndrxngd", "1-8 h: dhhhhjhdxhh", "4-8 b: bbbcbbbg", "1-7 b: zqpzzqbfbwbwcbbbp", "6-7 l: jlhllllmljvl", "9-11 w: hwpwlcwkwcwjgkt", "14-17 m: mmmmmmmmmmmmmmmmjm", "6-11 r: rrrrrbrrrrr", "1-6 c: fccxxc", "14-15 j: jjkjjjbjjjfjjljfjj", "15-17 q: qqqqqqqqvqqjqqqqz", "11-14 j: qjjsjjjjjjcjjjj", "11-13 m: mfhjhnsshfxmmm", "6-9 z: wrsjtzzzj", "6-19 b: lbkksbnggbcdpffqjxbb", "1-5 w: wwwwwww", "3-5 h: htdhh", "5-15 n: nlfdnkvknxgbqlw", "3-4 z: pzrz", "7-9 h: hhslhhkhhhhh", "11-13 n: wqnrnbnnlnjnd", "15-17 f: ffsfffffffffffbfff", "1-2 m: pmmt", "8-9 z: zzzzzzzmzz", "2-12 q: qqftqqqklxjc", "12-13 p: pppppppppppbp", "8-9 q: qqqqxqqlqqqqq", "3-5 m: mhmfbq", "3-5 j: ckpkjjf", "7-11 k: kgkkkkkkkkkkkk", "2-3 n: pnnnnmmnkl", "1-6 l: lnvqjlflmp", "3-14 t: nhzvstnltttdftt", "2-3 s: hsrscsz", "9-12 b: bbdbbbsbbjbgb", "1-10 h: mlkcgnrkwhpgwjvflhgx", "5-7 p: spnpmppwp", "2-3 h: hrhh", "8-11 g: fggsggqhgpg", "5-8 n: nsxnvnlpnvn", "9-11 f: fvffffjfffrcfff", "6-9 q: qqqpzqmqpstrk", "8-12 v: vmvvvvpzvrvvv", "2-4 x: cnbx", "3-5 h: hhqrhhh", "6-13 t: ttttttttttttltvttt", "2-4 v: zqvvgrxwtw", "6-8 v: vdbvvfjv", "16-19 g: gggggggggggggggjggg", "4-6 m: mmwmstmpmj", "1-11 b: bnxzhlbbgbpdvp", "7-16 n: txfjncnhsxgbjvhh", "5-8 m: mmtvmkmvfkmzmpmd", "3-6 g: ggjgggg", "8-12 l: lslllglqcnlwlll", "2-4 l: llpqjdwxq", "6-7 b: bbbbbvb", "6-12 b: bbbnbbbbbkrq", "17-18 s: msfggsssfsrdvssssdr", "3-5 m: mmmmb", "4-7 g: ggrwgbgggg", "5-6 z: zzzzjpz", "1-3 l: mrvclxrpvgnrl", "11-13 g: gggjgggggggbgg", "1-6 q: qqqqqjqqqz", "3-5 d: dndnpzdmqcjrdgd", "8-11 g: gggggggbggqggggggg", "1-7 k: dkkkkkfkkkkkkrk", "3-9 p: slbxznfwvjpnj", "12-14 t: kbthtttfttrttt", "3-6 x: xxbxxkxx", "4-5 z: zzzdz", "6-13 c: ccbcjccpcnscqc", "11-14 x: xxxgmnxxxxfxhx", "2-4 b: gjbrwk", "3-4 l: bwmlzldj", "10-13 d: qdcxdbrdrdddkdnddd", "7-9 d: dddflddbwnmddd", "12-14 f: rkgdfbdkqhnfsqjltntx", "5-14 x: xxxxxxxxxxxxxxx", "8-18 r: rrrrrrrlrrrrrrrrrr", "1-19 q: qqqqqqqqqqqqqqqqqqdq", "7-11 c: kscqhtcccctprbc", "3-5 h: dchjkntfhrbmmkkjpnh", "2-9 l: lllllllln", "1-6 c: sqczzcnkpwrcgvctlrc", "6-16 f: wcnppfpffjxpthhfxf", "16-17 x: xxxxcxxxrxsfxxpxfq", "7-9 q: qqqqqqqqt", "4-6 h: hxhhkgg", "12-20 v: pwvzsxtvvslvfxhvcvtz", "12-17 k: tkkkkkkkcfktknkkkk", "2-3 b: bpqr", "4-5 m: mhppm", "4-9 g: jrgxgqjqgrrpj", "7-12 h: hhswhqwhhqhhhlhtkhzw", "5-19 l: llllhlllllllllllllll", "2-3 n: mqncngfps", "6-15 q: qqqqqnhqqqqqqqtqq", "1-8 k: kfkkkkkkr", "5-10 f: pmpffbdkfpffgffcf", "3-8 b: bbsbcbbb", "9-12 h: hwhhhxhshhhhhc", "1-5 r: nhcrrbrrrj", "2-4 q: qqqsq", "13-17 h: lrlngvrhpsdmhkhzt", "8-17 m: rmmmmmmlmmmmqmsmmqm", "4-8 n: njnsnkjkhnkgblg", "9-10 d: pdwdkgcdrdzqdd", "3-4 p: pppp", "10-12 j: zcjjjjqwjrjj", "1-9 d: mddgrxsdk", "2-4 v: gsvvjv", "5-7 h: hhhbbhjh", "15-16 w: wwjwwwwwwwwwwwbw", "8-10 b: cbczjdpbkhdbkpbztn", "7-10 z: skfvjzzxzt", "15-16 m: mmmmmmrmjzxmmmbtmmm", "2-6 j: rjjgqb", "4-16 d: dptndnvddgtpqdddd", "7-8 j: jjhjjjbd", "2-3 w: bwdr", "4-6 g: jgngnmgggfpgcn", "2-3 p: ppkp", "7-8 m: mmmmmmnm", "5-6 l: lfllln", "3-4 r: rrrm", "6-7 s: ssssssss", "4-15 g: kdtgzznwrczjzgx", "11-12 w: jhwwrwwpwwwmwwfwgww", "13-15 w: wwwwcjjwwwwwgwwwwwf", "4-11 f: fffxffffffff", "3-7 g: ggggggpg", "3-10 m: mmnmmmmmmm", "9-11 h: hfhhhqhhhchhhwh", "4-5 j: jjqjq", "13-14 x: jmxnxbjrklnvxtn", "5-6 f: zzkqnzchtfnvffqd", "4-8 j: cxcjvfjjkjz", "8-14 s: sssssswnrsssscsss", "6-12 t: dftrtdvtxttt", "3-4 p: ppmp", "1-5 z: zzgszfrg", "1-8 g: wbgwggdgtswrlllj", "2-4 f: fffpf", "16-17 t: tttrktsmtmpttttttnt", "6-11 m: mqsxmmtfthmfwn", "2-3 c: mcbs", "1-3 j: xmjj", "15-16 j: jtjjjjjjjjjjjjjxj", "6-8 k: kkrkktckk", "9-11 l: ltlllllsllmlz", "17-18 s: sxmssqtjrhmzhssssk", "9-13 k: kkkkkkkkkkkkkkkhk", "6-9 g: kpnhsggmqklvtttgcxvl", "5-7 z: vzrxbmzzwglvczz", "4-10 k: khkkdkkckkkkkzkk", "2-6 q: qsqqnqq", "1-3 x: qxsxxxx", "10-14 x: xxzxxtxxxjcxxx", "4-6 z: dzzzvz", "1-2 c: cccv", "9-12 h: hhhhhhhhhhhc", "13-15 z: zzgzzzzzzmzzqzzkzz", "3-6 h: pgvjdhtpmthbz", "10-13 x: mxqbxxwxxxhxfrxxchxx", "2-5 b: qbbmpzrzkcjqqwbj", "3-14 q: ltxhrqqqqzfqqq", "6-10 j: jjjjprjkqj", "9-15 c: dsncxxlqwvzccwc", "12-16 m: nxrmdgmmxmscmhnm", "4-5 p: ppppthp", "10-13 d: ddddddddddddb", "2-6 x: bxkwbtsx", "5-7 j: jjjjqjjjjjj", "8-10 d: wzdddddtdddd", "6-9 z: dlzzzzzvwz", "2-3 h: hhhh", "11-13 t: ttttjtttttttxtt", "4-5 s: sdbps", "2-10 x: dcmxxxlxxhgxftrjbp", "9-15 h: hhhhhhhzjzhwhrkhh", "2-6 f: ftxhffff", "4-5 k: kkfrkwnbkkh", "3-5 m: mmdmm", "5-10 z: znvxzzldzvhqztr", "7-8 r: rrrrrrcr", "14-16 k: kkkkkkvkkkkkkbkk", "4-10 x: cxsxzxxxxxxxxn", "12-13 s: ssssssssssssss", "7-9 s: sswssssshs", "1-3 c: ncccrc", "7-9 r: rrrwrrtwr", "13-14 v: vvvvvvvvvvvvnv", "4-6 k: bkkkkx", "7-10 r: rrrrrrrrrrrrr", "7-8 l: llllllzll", "3-11 v: vqvvmnkvvswgkqvmvd", "8-10 c: cccccdcccm", "1-9 s: sssksqsshsj", "5-8 c: cccchmcccc", "5-6 h: hsqhhghrhk", "4-5 z: czzzrzlzn", "2-4 f: fzfffj", "14-17 p: pppppppppppppppmpp", "4-5 x: ldqxq", "12-16 g: gtgggggggggpgggggt", "13-14 v: zfbmrhphzmrvqv", "6-10 p: ppppppppphppkp", "10-12 l: xlllklllllkwlcl", "4-6 v: qvbvgdw", "6-12 q: qqqsqlqqqqqq", "3-5 s: rssgpssnb", "1-2 g: gzlpcmbsmgrq", "2-9 w: lpmbmfvpwggfvmzmmw", "4-6 n: nqtfzz", "3-4 f: fftf", "13-17 n: nnnznkgmnnnnpnngnfn", "8-10 p: ppppxppppppppprppsp", "10-12 g: ggnggkggggcvg", "3-8 l: lxrcbjnddcbpg", "6-7 q: qkjqfqqdkkkqrqqqc", "5-8 p: wpbpmpwpfsblpplmpp", "2-7 n: bbrtwnhhttntqhnr", "1-2 p: pcdxzjwmnkfjkpbj", "1-15 n: nnnnnnnnnnnnnnznn", "18-20 s: ssmsssssssssssssrssw", "1-12 h: vhxhmhhhhhhhd", "3-7 r: qkkvhvr", "3-5 k: xkpkkkzbtwkv", "2-4 z: zfzz", "1-2 t: ktttt", "2-3 p: pbwp", "2-4 j: ljjj", "14-15 t: pzpcktthttfttttt", "3-4 n: nwnj", "8-10 l: lzllllllln", "1-12 q: qqqqqqqqqqqqq", "6-12 z: xxltbzrpwzzmw", "15-16 q: qqqqqqqqqqqvqqqjq", "4-5 r: rhmrkrd", "7-10 r: rrrrrrlrrrrrr", "16-18 t: ttttwttttttttttttn", "9-17 m: bmmmmmmzmmpmmhmrw", "9-13 r: rrxfrrxrrrrrrr", "13-18 p: ppdxprpqppbpppprpz", "5-8 p: rprmpfpxgjphfktszplp", "5-7 h: hhhhhhnh", "3-7 h: rwhpshznhhh", "9-10 x: xwxzbrxxgxrxxdxxs", "6-7 h: hvhhhhng", "5-6 b: bbbbwhbb", "4-5 g: gbgggg", "3-9 g: gsbggghggpgdgg", "1-3 r: rxrhh", "3-4 c: rccn", "4-8 z: zpzzznzzzwz", "14-17 b: bbbbbbbbbbbbbbbbbzb", "2-4 w: rwvwrdn", "3-6 p: pfpsgp", "2-12 p: zpwkjpppbppjrppknh", "5-9 t: tmttgtttn", "2-3 v: wvvcv", "3-5 h: bnbhhtjhk", "15-17 f: tffwftdskgfxgfffpk", "16-17 h: hphhhhdhhhhhxhhhrhh", "7-8 d: ddddddtnd", "9-20 t: tqttttttttttttttbttw", "1-11 v: vxcgzvvvkrlqvg", "2-6 r: ghrbwrtfksqkxx", "8-10 w: wwwswwwmvwww", "4-10 m: mqmmmtmmfq", "2-3 g: gkgtgv", "9-11 w: wwwwsqwwpwwxrwww", "3-4 w: zwxwtcscwmwmndcw", "8-9 q: xsqqqqzxfqfv", "2-4 w: wwhh", "9-18 d: ddddddhddddddddddq", "3-4 s: sssjsvs", "15-16 p: wphpxpppppppppppppvp", "10-12 t: qftttqhtvttt", "1-2 b: vbfxqgbzrktjm", "3-4 k: lkkr", "9-11 d: dddddkdqdttddd", "9-11 m: mwngbfmhmcvwx", "2-5 b: scbxbb", "6-9 z: zzzzzzzzzzz", "1-3 z: zzvhz", "5-7 x: xxxxxxkxx", "1-5 s: ssscshss", "1-7 s: csrfvfsqjss", "16-17 k: fwdkkkckkkkrrkkck", "3-4 h: hhhs", "4-8 w: wwwswwwx", "1-10 f: fffskffsdfcfvfff", "7-15 r: rrrrrrrrrrrrrrxr", "1-2 k: kvxbzdcnsqrskhmx", "2-4 s: wbvsfs", "2-7 q: rbgqpqdq", "15-16 f: fffffffffffffffq", "1-3 c: bccpkm", "5-11 g: fsvgthpglgg", "3-5 f: ffffwf", "5-16 j: djmwqfxsbzwjdwtj", "3-4 p: pprpp", "5-6 n: nhnnwj", "8-12 s: tssssssrsssksss", "5-8 p: pppppppppppp", "10-15 w: wgfwwcwtmwwgwpwwh", "12-15 l: lllllllllllplll", "1-8 c: ccccqccd", "3-4 z: zzzvzkzgc", "2-10 h: swwbtfkvfhrjztdzx", "2-7 z: zhbzkzlzz", "2-9 q: ddqdqpkcjqkfgqtcjqq", "9-10 l: lllmllkltlll", "2-3 n: ngwn", "2-3 r: rrnr", "5-10 n: ltnnnknnvcnnn", "7-9 p: jtpptpllpj", "2-5 s: slssssszssssssss", "16-17 d: dddddddddddddddlp", "2-5 q: bbwqqbkmdhqmjhn", "7-10 m: qmpgmmsmmmmkmmkj", "4-7 g: vczggdgbgxgg", ]
input = ['17-19 p: pwpzpfbrcpppjppbmppp', '10-11 b: bbbbbbbbbbbj', '17-19 c: ccccccccccfrcctcccjc', '8-10 k: kkkkkkkfkkks', '13-14 l: lvllvllllslllv', '8-9 n: nhhcnnnknnqnb', '1-3 d: pdbdfbws', '5-6 v: vvvgvb', '7-8 x: gxcxtwbl', '2-15 r: xlgrwqpcsqtrvfrrt', '9-14 l: glnldlllllllln', '2-3 r: vxnw', '8-9 g: gfggczgkgggjgg', '4-5 d: ddddh', '6-9 t: zttttbhbttttftd', '3-6 k: kkkzwnmv', '2-7 w: sgmvplwwjx', '11-13 h: hhhvhhhhhhvhh', '9-10 f: mhfdfffffmlffsfvts', '17-18 l: llllllllllllllllrzl', '4-5 c: crcccccccvc', '9-12 q: qqqqqpqrqqlcq', '7-8 n: nnnnnndn', '3-5 f: ffqnfpffhf', '3-4 j: djpj', '17-18 q: qqqqqqqmqqsqqqqqjq', '8-15 j: bjmjbbqfjjrgjgfkjj', '2-11 d: xdgdmxgwzdpdxdhjwd', '8-9 p: bppppppmp', '10-11 t: ttttttttttb', '5-8 v: vhxvfcsvvxjvvvpgwdv', '9-17 q: mqqqqqqqqqjvqqqqzlq', '1-2 t: tptbbn', '9-11 q: gqqqqqqfwqqqq', '8-9 h: hsdsfkgphxglmsjndhh', '2-3 z: mzgz', '4-16 n: nxnsqmrnnnpfvnfnb', '1-3 r: rbzcrkjrqrrnjxj', '1-5 c: ccccccq', '4-11 m: mmmgmmmmmmm', '8-9 z: zlzvzzzpzz', '1-18 h: xzqhmkzhhrtxpljptbc', '3-4 p: pbpg', '16-20 j: jrfjjzjjjrjjgvjkzjjj', '6-9 t: ctdtthtlttttpt', '3-4 h: mfhj', '5-10 t: tgtxttqhtl', '1-3 w: fwgw', '6-7 q: qvqlrqp', '12-13 m: mmmmmmmmrmmmplm', '12-14 r: rrrrhrrrrrrrrbrc', '4-6 b: ljzbqgwxcdmdjfbcwd', '7-10 g: gggggggmgpg', '2-3 c: mbcc', '7-8 k: kbkkkktkckc', '7-8 p: pppppppbp', '5-8 w: twwwwwwgvvwvdttmh', '13-17 p: ppppfppppppppppppp', '8-12 x: xxxcxxxbjxxxxk', '9-18 b: hhbbqcbbbsblbgpwbbhf', '6-8 h: hhhhfhhchhjhhch', '7-11 g: ggtnwvcdgctkrggxj', '5-8 k: kknhndzm', '4-5 z: zzznz', '2-4 p: pbtp', '16-18 r: rrrrtrrrrrrrrrrhrr', '15-16 r: rhrrrrrrrrrrrrrx', '7-10 l: lllklmhxzlxcdljz', '7-8 q: qqpwsqqb', '9-13 k: qkknkkxlzkrkkkkkpk', '4-8 h: wlrhfbth', '6-8 q: vppqqqgntfqqgqq', '19-20 g: ggggggggggggggggggfg', '4-5 m: shmzmsdm', '3-4 k: kkhkk', '4-7 b: cbsqkcpnkcfzhmpvfvgz', '18-19 l: lllllllnllltdlwgllxl', '14-15 z: zztzzzthdzzzzzn', '9-10 s: ksssbsssstss', '2-10 t: mltjpttttthpttttz', '3-9 n: pqnpfxgfnzqxv', '7-11 d: ndddddhdddddddd', '11-13 v: vkvbwrchzvhhvpc', '13-15 l: llllllllllllllll', '10-13 c: ccclwbcbccbxvcrdzctc', '8-9 w: klvwtwwwbwhww', '2-4 j: mnmb', '10-14 w: wwwmwwwwwwwwlnwsw', '14-17 x: xxxxxxxxxxxxxlxxkxx', '3-7 r: bxrqzxsrfmclfdrqrtpf', '7-14 b: bbbbqbbbbbbbbbbbbbb', '7-13 p: wwvhwdprjxppwnhsbp', '2-3 h: hqhh', '8-11 n: nnnnnnnjcnn', '5-12 l: cwzxlpvwlsfjqrgk', '3-5 v: vvphwvv', '5-16 d: dpdrdfdrhwdrrqdqxd', '14-18 z: zzzzzzzzzzzzzzzzzkzz', '2-5 h: hcjlh', '12-13 w: wwwwwwwwwbwlw', '15-16 c: ccccccccccccccxc', '4-7 b: lbbsbbwhb', '2-5 z: qtwmzhzmwqw', '5-6 d: drjddc', '7-9 q: qqqqjqqfdqq', '14-15 r: rvrqrrrrrwsrrmrrd', '16-17 h: hhhhhhhhhhhhhhhhlh', '10-16 f: fvhgfzffchmffgfff', '3-7 q: qcqlvdvgrqtqcq', '7-9 x: xxsxxrxxpsx', '3-10 h: hjhjthhrthcdhhhhxz', '15-16 t: tttttttztwbwptjt', '3-5 x: xrlxqx', '3-4 b: bbbp', '1-4 n: jnhnndn', '3-6 c: ccccfm', '7-8 v: tvtvdvspvvv', '6-8 l: lljlllgsglcsw', '2-13 h: jhzzcgpxhbgqsbwhf', '17-18 j: jjjjjjjjjjjjjjjjhc', '2-3 c: ctcchxklnbrqc', '3-14 w: wwcwwwwwwwcwww', '1-3 k: kcxf', '9-14 t: ttttkttlnttmtttt', '2-4 x: xkxxqzxvck', '5-6 h: dgmxghjxjnhs', '4-12 f: fvhlffxnfjhfffqxfcf', '1-10 b: pfsbflbbkbqk', '8-9 s: qzkfszjss', '1-14 m: mmmmmsmmxmqmmmmmmmm', '11-13 w: nsgwwwwwwpbwvwww', '2-15 t: sprsbpztsznslst', '3-4 d: tqscgnrjxrqdwqd', '5-17 x: xqrzxxxxfxzxrzxxxw', '8-9 m: mkmhmgdmq', '6-8 q: qqqqqqqxq', '2-5 m: mmmmmf', '4-13 v: gvvvsvfmmmvvx', '13-16 t: ttttttttgtvtwttntt', '8-16 c: ccccccczccccccccc', '10-11 b: bbbbbbkbbvbbbbb', '1-12 n: pnnnnbnhnnbng', '5-6 b: qbbbbb', '4-6 z: zzzzzvjzzznxdzx', '2-3 p: dwxqpjp', '4-6 w: wwwxwq', '2-3 x: pvpdh', '5-8 n: pqnnkncnnfnnnnnn', '10-12 w: drqwwxrwwkwwwswwl', '2-4 g: rbggfslgjqqhj', '9-19 r: pzxhrcfrrrqjqfkhrhjz', '3-6 n: rngtnnnnn', '4-14 t: tttttttttttftgttttht', '6-8 q: qqdtqqmrgqcqqqqc', '3-14 t: tttnttttttttqk', '9-10 w: qqwcjzwgjnqdrdxwjwl', '10-12 t: tthtthtktvtttt', '2-7 v: vzvvvvv', '5-17 p: zzpsmpgpprdmhxprsvs', '8-9 t: ttttttvnt', '4-8 v: vvvfvvvvvvvvvvv', '7-15 h: cwkhdzmththzjnh', '7-9 v: vjvlwzvvmv', '1-2 c: hchw', '7-8 f: ffpfffsfqf', '5-8 s: xlssskszb', '2-15 x: fxzpbvqzmkxvtlljjrg', '1-3 s: hsss', '7-14 m: xmmtmmmgmrmmxzmxm', '10-13 z: dnzztzzzzzfszxzczg', '3-8 h: rhthhnhh', '6-9 g: hbggggggggbg', '13-15 z: zzzzpzbzzzzzfzzz', '5-15 l: llllwlllllllllll', '3-5 m: dhmmm', '2-13 h: hrrhgqhhnhkhhhhb', '1-5 p: kpppp', '2-13 m: fmqjmrzhskzwdnt', '7-8 q: bqxvzqqsjpqqqq', '2-13 d: ddhdddddddddbddddd', '5-9 s: nhkmxssqsjssjs', '2-11 b: vlrtxpzkqwb', '6-7 q: qqqqqcq', '7-9 n: nnnnnknnmgn', '3-9 n: qfkxknwnn', '15-16 d: dddddddddddddddgd', '12-13 h: hhhhhhhhhjmvhhh', '3-4 w: tbfw', '8-9 f: fkffbfhtf', '2-4 q: qjsqqf', '2-11 t: ttttpdgtlxhtx', '7-10 k: dkkkkkkkkh', '6-7 c: hccccxcgv', '6-7 j: sjcbfmj', '1-2 w: vtrwjcgndvwx', '12-13 m: mmmcmmmmmmmms', '3-7 h: hhhhhhw', '9-13 g: gghgwgrrkgcgg', '12-13 g: gggggggggggfgggg', '13-16 s: sssssssfsssssszb', '2-17 p: pbpmpmwpnqppppppphbd', '2-9 c: cmrcwfnjcdcxccccrzc', '8-12 j: jvjjjcjxjjdqjjjr', '6-9 m: mgjxmcfdm', '2-5 l: klmxlx', '2-10 x: jvxwxpxrxx', '2-3 r: rrzrp', '2-12 v: cbfrnctdmzwvlbvjmdgg', '2-9 r: wrbrrrrzm', '12-13 h: fhsbhhhhhhhwhhhhhh', '5-8 d: ddhqdddddp', '4-5 l: djnlnlllbl', '2-9 t: tdtgttddtwwj', '16-20 t: tttttttttttttttttttt', '5-8 z: zzzszzzmszz', '8-13 d: dddddddbdzwddd', '9-10 z: zzztzzzhzxgz', '10-12 p: wppcppxpppgpppzr', '4-5 w: wkwtwwzww', '3-9 m: dmmmrmmmm', '1-4 g: gvmr', '8-9 d: frxndpdzwd', '17-20 q: qqqqqqnqqqqqqqqqhqqq', '7-13 w: pwfwwrwwwkwww', '3-5 q: qqpqw', '11-13 p: pplpppppppppb', '4-12 g: glggjmsggggjrgbgm', '3-7 p: cfphqrxpsgthp', '12-15 f: gfnrhffgftnbggfwtbp', '16-18 p: pppppppppppppppppm', '3-4 l: lllzn', '1-2 d: dddd', '8-12 n: nnnnxnnhnnnn', '2-4 z: zzzzz', '1-4 s: sssms', '2-4 h: hghhh', '1-10 l: nhtnzhdtmslxqskf', '5-13 j: bpzjjrrqzndjtw', '1-2 x: xxchn', '1-16 v: vjvrxvdbdnvvkzvg', '9-10 b: xbvzbbmfmbqbbvbbrb', '8-12 k: ktnkfbgkkkkbkmkk', '7-9 h: hhhhhhwhh', '16-17 g: sgggmggggggggggvggg', '3-10 q: qmlqqqqqqq', '11-14 h: hhhxhhhhhchhwkh', '9-14 f: kqwqcftkfdxgmsd', '12-13 p: pppppppppppph', '7-8 f: dkfnjfff', '5-6 f: jtfrrfxckhfmfffszggg', '6-8 n: jzhpkszn', '8-10 c: cccccnckcxmrchjc', '14-15 d: dddjdjdddddddpp', '8-10 f: cfshmqfffwtffltfzff', '3-4 b: bdbq', '2-6 b: cfqkbtvmn', '15-16 z: zgzzqzjhzzmnzkzvzz', '4-6 r: krrrrlm', '3-6 c: dcczrfr', '8-9 s: ssssssfws', '11-12 s: mssssssssssq', '1-2 r: zrznpmzrs', '10-11 k: kkkkkkkkkfk', '3-9 k: kbkkkkgkk', '1-4 w: lwwtw', '3-4 t: ttkt', '2-3 m: htvmjk', '2-4 p: mdpp', '10-17 s: ssssssssssssssssws', '1-2 m: gmmc', '5-9 d: dddbvjkdd', '5-8 z: tmnfplzz', '7-14 s: ssssssssssssstkss', '2-7 q: gqbcxnqcvszwbxqkz', '6-17 b: btbxlbbbbbbbbbvtbkd', '6-9 l: lllllllld', '11-12 q: nqqjjrhgxgqp', '6-9 n: nlnnfnnjb', '13-17 x: xnxxxxxxxxbdbxxrc', '5-13 w: wwtwrwzwwwqfwtkwtwbw', '5-10 g: gggxbgmgrgggggg', '13-16 h: mhhhhmshhchhhhhl', '2-3 f: flff', '2-4 k: kkhr', '2-6 m: mmmqmml', '6-7 p: ppppppp', '2-6 k: ksktkkk', '2-4 m: gkml', '5-6 h: hhvqhjz', '2-5 h: hkhqhfh', '3-4 z: zzglz', '2-3 f: zhfn', '10-11 m: mmzmmmmmmfmm', '3-13 d: ddwzdmmddmddz', '1-2 h: hvkhm', '4-5 n: nnnnb', '5-7 f: fjppbffffz', '2-4 g: tmlp', '15-16 q: bqfvqqqcptqqzqqx', '18-19 g: lpgqgcgsdtngfddbggnp', '3-5 z: kjzkq', '1-6 q: qjkqqzqq', '3-4 m: bpmmjgmmfmj', '2-5 k: jkvkz', '11-14 q: qqqbjqqqqqgqqq', '6-17 q: bfqqtlqqfjgqtqtqs', '5-16 s: ssdzfbsdhsszspssvs', '1-7 n: nhnvmhb', '4-5 b: hbbrk', '9-14 f: fffbffkfftcfnfgf', '1-3 n: nznxndpb', '3-4 k: qkktw', '3-8 r: rrprrgrrr', '2-5 l: sqmllls', '6-7 n: njnknvnnpvlbnx', '3-5 t: hbrtmcttt', '5-9 j: fjjnjcgjhnkcpqjbc', '2-4 l: jllx', '7-8 d: dddddndd', '3-6 t: gtsttjnt', '9-11 m: cbmgjlqcbsmllm', '1-2 l: vllfcckl', '10-11 p: ppppzppppplp', '2-4 m: slzmmrw', '3-8 h: bhhgmpbs', '7-14 t: tttttthttttttttt', '1-3 r: rrvvrrprwrfrcr', '5-15 w: gwbhwjwwwkswcsww', '2-5 v: zvtls', '1-4 v: vsvv', '10-15 z: zzzzzzzzzztrjzr', '3-5 v: vvvjhdvv', '3-12 s: wqssnmdlwlws', '2-3 r: djrftptcrskpzrz', '1-3 p: nbppgkmfnjp', '17-18 w: wwwwwwwwtwwwwwwwrw', '2-5 l: xqntklqlt', '2-5 g: gtkggghcvgl', '18-19 z: zzzzzzgzzzzzzzzzzztz', '16-17 x: xxcxxwxxblpxzkfxzj', '15-19 f: frffffstcwffccffffff', '3-4 n: npnm', '2-3 d: zvddd', '7-9 x: xzxxctxxl', '13-14 s: hhsxbzssdtssfss', '4-5 m: vbpmhmrmvrjnmhlsbmm', '3-6 z: zzzzzwdzzzzzzzzzz', '18-19 g: gggggggggggggggggng', '14-15 x: fxxjxxxxxxmxxwxxnxb', '10-12 m: xmmmmfmdmmkh', '3-4 b: bbgbgb', '11-13 c: cclcccbcxcccqcczc', '10-17 w: wwwwwwwswwwwwwnwpw', '5-7 l: blllqll', '4-10 n: nnnnnnnnntn', '9-10 z: fzzztzczwzzgkzzn', '4-5 x: gxjhxbxxx', '3-6 p: plhxppk', '10-19 p: mpgpmxdvqphrcckpvqw', '3-14 p: kfdwtqxpstpcfpgcfmp', '2-6 k: gnxkkkjrzkknskmpbsj', '8-10 l: lzllklldplllzl', '16-17 n: nnnsnnnnnnnnpnnjnnn', '1-14 c: kccccccccgccccc', '2-11 s: lsqghkzwsgsbdmgq', '6-7 p: pcpgqrcpqpptpm', '1-11 h: lhhhhhhhhqhhxbhhfhhh', '11-12 r: rrhjrbrrvrrrrdrrr', '5-8 c: cccccwck', '6-8 w: wwwwwwwb', '12-15 n: htvxnnhvnpnnknnhnt', '1-2 c: jcct', '2-10 v: vsvvvvvvvvv', '4-5 x: xhxtx', '3-4 f: ffxf', '5-8 v: wprmvflppqwvwfwpkq', '5-7 n: znnnnnxblcrn', '8-9 n: zljnjjbnn', '10-11 m: mzwkrvmzrdc', '3-7 h: hxkhfhcqhr', '6-13 j: vhcmljdxwkqnfcvmjjb', '1-6 g: gvgggthkr', '6-10 l: bldnllklkllllclslm', '6-7 g: gggggng', '1-4 x: xxxxxpnsv', '15-16 q: qqqqqsqqqqqqqqqbq', '6-7 q: qnqqqdqqq', '5-6 p: ppppspppp', '3-5 k: kkskkk', '1-2 j: jrjjjjj', '8-9 d: ddpzdlldmddhdhdd', '5-8 t: ttsljtnt', '2-4 w: qwwmwwhwwwwwwww', '6-8 c: clcccccv', '1-8 f: ffbfqfpfbfb', '5-13 r: rrrrkrrrrrrrrr', '15-18 v: vvvvvvvvjvvvvvvvvvvv', '7-8 r: xjwxkzqrrxr', '7-10 d: kddddddddbddd', '1-8 k: kkkkkkkkk', '4-6 q: rhdkjsqjqvzqcpsnq', '1-2 t: tdtt', '5-6 l: lllwlh', '3-5 f: pdzfff', '7-8 s: qsswssks', '3-5 d: dcdddd', '1-12 r: rvlrrrwdtkrcxffr', '2-7 d: rddcdlqtnffbdd', '5-9 t: phmtdzfjtdb', '9-12 x: jxxxxxxxxxxcx', '14-16 c: fcclccccmcnccwccqccv', '4-5 p: zxpzk', '15-19 t: ttttttttttttfkttttl', '5-10 k: kdmjgkkkkkblkvkkkk', '6-15 q: wqgmcqcmcjlgxkqrdstw', '6-7 r: rrrrrrr', '2-6 n: ksnnnnnzn', '16-17 g: ggggggggggggggghgg', '11-13 k: nsgkkkkzckxtkn', '2-5 q: jqvkqm', '2-10 q: lpqqmqlqqqqqtqqw', '10-20 k: dkztkkkkshkkkkkkkkdk', '4-7 d: fddddxd', '3-5 v: vvvvs', '7-9 b: bbbbbbrzb', '4-14 z: nbnzkbxbwhqpjsdlzz', '3-14 x: xxvxxxnxxxxxxxdxktxx', '7-9 z: qqpzzxzvsgzfzdzz', '14-15 c: ccccccccccccccmc', '11-12 k: kkkkkkkkkskv', '15-16 d: ddddddddddddddddd', '6-8 x: xkjhxwgxxzxxnzwxcxk', '2-6 t: tmwttc', '7-8 w: jwcwwwql', '5-14 d: jdpddtkddrdddpq', '9-14 t: mwctmnjxmztckt', '4-8 l: llnlxlmjn', '3-6 s: sssskvk', '4-8 c: ccchcrctczt', '4-6 s: wssnlsnsss', '8-18 s: sfkssssbswshsvshms', '6-7 b: bbkbcffmwblcmp', '8-15 w: fwwmswcwwhlwjwvtlq', '2-9 n: wnnnnmqhdpsnzn', '1-7 x: xkzzxpz', '5-8 x: txxxxmlxkrxsxzsx', '7-10 t: lchndztdttgk', '1-2 q: tqqq', '1-9 z: nzzzzzzzz', '1-2 l: djfmfwpnjclt', '2-6 x: xxxxxmxxs', '2-4 p: ppcv', '4-10 d: dddpddddddd', '8-11 n: nnnnnnnxnnnn', '17-18 v: vvvvnvtvvvjvvvvvzzvv', '5-8 h: hhhhhhhfhh', '9-16 v: vvvvvvvbvvvvsvtq', '3-4 r: hrhrrtrgrr', '11-17 g: mvgggwggggggwggxw', '3-6 r: rrnrrgrrrr', '8-10 n: rgjntnrmkn', '6-7 f: sffftmm', '4-5 b: bbddn', '4-9 d: cdrbqddsqqpzkdd', '9-17 n: nnnnnnnnrnnnnnnnjn', '1-4 n: knnn', '15-16 k: kkkhkkkkkkkkkkkv', '15-17 v: jkrddvtmgfqvqvvxk', '10-16 j: jjjjjjjjgpsjhjjljjj', '9-10 d: jdndwddvdrhndddd', '5-7 x: bxxxxwmcb', '5-7 r: mlrrdsrrrnrgwrrq', '14-17 h: hhhlhhhhhhhhhhhhm', '1-12 n: zpnwtpnnnnxzm', '11-19 k: ccktkhkwthkkklkvhkmk', '6-14 s: sfssxsscssgssqhsnssl', '17-18 g: ggdgggggggggfgggrggg', '4-13 k: dwddvztkhjnzk', '17-19 k: kkkkkkkkkkkkkkkkkkx', '5-8 q: qmqzqqqqqqqqqcqq', '2-4 q: vqqqqhxd', '1-13 c: fjccqcmrcjxgccdvbzr', '8-12 h: hkhhhhhhhvhhch', '4-10 w: jmwfwxwwkwwcnbwwftrc', '8-11 f: fffffffbffdf', '12-18 b: bbbbbbbbbbbcbbbbbbb', '2-8 k: rdwwjvrkcs', '13-14 p: pppphpnppppphpppp', '1-3 d: nddddddddddd', '5-8 m: mmfdkmnfmqm', '2-9 x: xjgwxxxxxl', '1-2 v: vhvsvv', '11-17 r: tlrgrrrrrwrzrrrrsrr', '1-7 c: lcclcvgk', '3-5 s: slnkss', '3-4 w: hqwbw', '11-19 l: lfxllllllldlllllllq', '4-5 t: tttbt', '10-12 g: gggggggggsgfg', '6-8 k: kkmkkkkmk', '10-11 q: qqqqqqpqqpsqd', '5-17 k: pxwkmdxkskthkkkkn', '14-16 m: mmmmmmmmmmmmmpmmmmmm', '14-15 k: kkkkkkkkkjkkkkt', '13-14 c: ccccccdccccccccccccc', '1-2 v: gvmqqnkpln', '4-6 k: lwkkkjgwkkk', '1-12 h: mhhthhghhhhhhhhh', '6-7 t: ptxtwtg', '3-9 j: zsjkcjlzj', '5-8 q: cpzhqfhvsjx', '5-11 s: ssbsskssgssdss', '4-12 t: ltkttnzdvxttllttt', '4-5 j: jjfjh', '4-5 r: rrrprjdtrfr', '4-8 d: ccwqskmd', '2-9 p: npzptdhsxxpkpk', '6-17 x: cxnxxpmxxxxhxxfhxxxx', '1-7 q: nqqzqnqqqf', '15-17 v: vvvvmkvjvwvscvvvv', '12-16 d: mddddbdddjddxddbd', '3-7 f: fxpfffff', '6-7 d: dgdwrddwhprchmvdr', '5-17 h: whhphdbxzwcdhhshwkkh', '5-7 f: ffffffjw', '10-12 s: grcsbsnssbfs', '6-10 z: zzzzzrzzzzzjz', '14-15 m: kdmmcmmmmmdmldm', '6-7 m: mcxmmcmm', '5-6 l: lmlllrlw', '3-16 q: qqwqqqqcmqqqqqxqbqq', '14-16 p: pppzspppppnppbppwwpp', '10-12 q: qqqqqqqqqqqqqq', '1-5 j: rjkjvjj', '3-9 d: fhqwddjrdzpkgdkd', '2-4 v: vlvw', '1-4 w: qwcww', '6-12 r: rhhzkrzhrwrxrkvrcbmr', '3-5 t: xxbtr', '5-6 x: xxxpxx', '2-5 q: qhqqq', '8-16 n: nnnnnknnnnnnnnnt', '8-10 g: gdzvghxcnbq', '4-19 m: rgmmbqmljmzswbkpkcn', '8-12 g: ggggggmhggrgbtghg', '13-15 t: ttttttttttttttxttt', '1-3 n: nntn', '3-4 h: hhxh', '6-7 f: ffffffbf', '2-3 t: bgtt', '7-9 n: nnnnnnjnn', '2-4 j: ljgj', '12-15 c: ccccdcccccccccfccc', '4-9 s: wssssssqlcssz', '1-2 z: ljzjgcvg', '6-7 q: qqqqqqs', '1-6 d: xpddgd', '4-14 f: ffffffffdzfffmf', '13-14 r: rrrrrrrrrrrrwrrr', '6-7 r: rrrcgbrrr', '9-15 b: lkkbbbbhbsbgxpgpbb', '3-4 f: qzfzwnffv', '4-14 m: rkksnmbgjmqmmmc', '8-13 n: fjnbrnnnqnnnnn', '13-17 h: hhhhhhchhhhhhhhhz', '8-9 n: rbtknnmpng', '1-6 c: qgtfhqtjkw', '2-8 m: wzfmmmmmflmdk', '5-7 v: cnvvvvvvv', '10-15 n: nxnnnjnsnnnnngnnknrt', '12-13 d: ddjddddddddddddd', '4-5 n: jncnnh', '6-10 z: zzzznbzzzczzl', '4-5 s: bsjsv', '9-11 g: hvkccbpfxkg', '1-2 b: bbqb', '7-16 l: lllllllllllllllplll', '1-5 l: llllml', '3-4 f: fmsf', '2-4 g: tgshjbgg', '2-7 h: vlzzhhhhhphhf', '8-9 p: pnpppppqh', '9-11 w: wrxlwdtwnwwtqwpwxgw', '8-10 m: mmmmmmmnmm', '1-5 p: dpnpppzpp', '3-5 l: bllflklcmp', '11-19 j: jkjjjvmjjjkjljjjjfj', '6-9 k: kkkkkkkbkk', '2-4 r: njprlsrmtr', '9-10 d: dxhdddddfdd', '3-8 z: dmrqpzwzghmznc', '2-8 r: tlgqwxcrdpj', '10-11 z: zzzzzzzzzzhz', '1-10 q: qqqqqqqqqsqqqqqqqq', '2-4 x: xrwxx', '10-11 s: zssssssssfz', '3-9 z: rszsgfzzz', '6-13 x: zsxwxxqtgxvbcxxbn', '10-16 s: smsssgssshsspwxsq', '1-2 g: ngqgc', '4-8 l: xllllngb', '4-7 h: rhhhhhghbm', '1-7 v: vqvslhm', '2-7 z: jjfmnmz', '1-10 v: vvvvvvvvvqv', '11-13 g: ggpgrgggggggggg', '3-6 p: tpgqnpphpl', '1-3 d: sddddd', '8-9 g: gggggggvg', '2-6 w: wtvwnw', '1-4 m: kmmwm', '3-4 h: mhvh', '1-4 h: cnjhxvhkdch', '7-8 w: wwwwwfwww', '6-9 r: rlrrrgrrr', '2-4 h: lggh', '10-11 q: qqqqqqqqqlh', '4-5 l: llllgl', '13-16 k: kmffmjbzrpprcdkxglk', '1-3 f: ffpf', '19-20 n: nnnnnnnbnnnnnnnnnnnv', '3-7 h: hhpmhjhwdhzhm', '1-5 k: hlkkrkzkf', '2-4 s: sssxssssssssssssssss', '12-13 d: dddgdddddqndtdkd', '3-14 c: cccczvcxchccccclctcl', '2-5 b: mbgbb', '6-8 j: jjtrtbsjnj', '5-6 s: sssqsk', '8-16 l: lfrlllllctllqxrpllll', '6-12 g: grxlwlnggxvg', '16-17 j: jjjjjjjjjjjjjjjjp', '6-10 q: nqmzqflbhqqb', '12-19 j: jjjjjjwjjjjkjjjjjjgt', '8-10 s: sscssssssp', '11-12 s: ssssssssssds', '2-5 n: hswqnqldwwbbmnnrnht', '4-7 p: ztpvbqpwsxrgrkp', '3-9 h: hhlhhcjrkhwnhq', '10-12 k: kkkkkkkkklkwk', '14-15 w: wwwwwvwwwwkwwqwnw', '16-20 b: bbbbbbbbbbbbbbbhbbbt', '2-5 t: tttttftttttt', '3-12 l: qswhtwvnfmfwn', '11-12 b: bbbbbbbbbjgvbbbbbbz', '8-13 w: wwwwtwwvwwwww', '5-6 f: kgjfhfffv', '7-17 g: qpxgkvgttkhxjhzxnv', '2-3 n: rhffpsqknv', '2-10 p: pkpppppppppp', '3-15 p: rnpqjpgmcpgzkxcppk', '12-13 d: nhdddldxdddddndpdddj', '14-16 h: hhhhhhhhhhhhhbrhhhhh', '4-9 r: rpzrcnrrrlx', '2-14 f: ffffzfzffffffjfff', '1-9 s: snhfksssxssss', '1-14 n: bnnnnnnnnlnnnn', '2-3 c: cwtccc', '10-12 k: kkkkkkkkcskkkdkk', '2-5 r: qrqsrkrk', '3-11 k: nlkqkszttxk', '2-3 d: vqdgpwnjprgsgsdrxwk', '7-12 k: hkkkkkkdkkkrk', '6-8 r: smmfvtxrhzvnrj', '8-10 l: llrllllllmll', '5-10 l: bpwgqlnktt', '4-6 f: flfvjfff', '13-14 b: bbbbbbbbbbfbqzzb', '5-6 m: rmhmqmkmtkmjnmvdx', '10-16 j: jtjjjjjjjdkjgjjjj', '3-4 c: cpcc', '10-11 v: vxgbfvqftvmc', '5-12 n: knqlnbhdphpw', '7-13 r: rrrrrtrrrrrrrrr', '4-7 n: nbnnffkjnwpqnhvqnr', '4-13 r: htrkdwrcmcndrxngd', '1-8 h: dhhhhjhdxhh', '4-8 b: bbbcbbbg', '1-7 b: zqpzzqbfbwbwcbbbp', '6-7 l: jlhllllmljvl', '9-11 w: hwpwlcwkwcwjgkt', '14-17 m: mmmmmmmmmmmmmmmmjm', '6-11 r: rrrrrbrrrrr', '1-6 c: fccxxc', '14-15 j: jjkjjjbjjjfjjljfjj', '15-17 q: qqqqqqqqvqqjqqqqz', '11-14 j: qjjsjjjjjjcjjjj', '11-13 m: mfhjhnsshfxmmm', '6-9 z: wrsjtzzzj', '6-19 b: lbkksbnggbcdpffqjxbb', '1-5 w: wwwwwww', '3-5 h: htdhh', '5-15 n: nlfdnkvknxgbqlw', '3-4 z: pzrz', '7-9 h: hhslhhkhhhhh', '11-13 n: wqnrnbnnlnjnd', '15-17 f: ffsfffffffffffbfff', '1-2 m: pmmt', '8-9 z: zzzzzzzmzz', '2-12 q: qqftqqqklxjc', '12-13 p: pppppppppppbp', '8-9 q: qqqqxqqlqqqqq', '3-5 m: mhmfbq', '3-5 j: ckpkjjf', '7-11 k: kgkkkkkkkkkkkk', '2-3 n: pnnnnmmnkl', '1-6 l: lnvqjlflmp', '3-14 t: nhzvstnltttdftt', '2-3 s: hsrscsz', '9-12 b: bbdbbbsbbjbgb', '1-10 h: mlkcgnrkwhpgwjvflhgx', '5-7 p: spnpmppwp', '2-3 h: hrhh', '8-11 g: fggsggqhgpg', '5-8 n: nsxnvnlpnvn', '9-11 f: fvffffjfffrcfff', '6-9 q: qqqpzqmqpstrk', '8-12 v: vmvvvvpzvrvvv', '2-4 x: cnbx', '3-5 h: hhqrhhh', '6-13 t: ttttttttttttltvttt', '2-4 v: zqvvgrxwtw', '6-8 v: vdbvvfjv', '16-19 g: gggggggggggggggjggg', '4-6 m: mmwmstmpmj', '1-11 b: bnxzhlbbgbpdvp', '7-16 n: txfjncnhsxgbjvhh', '5-8 m: mmtvmkmvfkmzmpmd', '3-6 g: ggjgggg', '8-12 l: lslllglqcnlwlll', '2-4 l: llpqjdwxq', '6-7 b: bbbbbvb', '6-12 b: bbbnbbbbbkrq', '17-18 s: msfggsssfsrdvssssdr', '3-5 m: mmmmb', '4-7 g: ggrwgbgggg', '5-6 z: zzzzjpz', '1-3 l: mrvclxrpvgnrl', '11-13 g: gggjgggggggbgg', '1-6 q: qqqqqjqqqz', '3-5 d: dndnpzdmqcjrdgd', '8-11 g: gggggggbggqggggggg', '1-7 k: dkkkkkfkkkkkkrk', '3-9 p: slbxznfwvjpnj', '12-14 t: kbthtttfttrttt', '3-6 x: xxbxxkxx', '4-5 z: zzzdz', '6-13 c: ccbcjccpcnscqc', '11-14 x: xxxgmnxxxxfxhx', '2-4 b: gjbrwk', '3-4 l: bwmlzldj', '10-13 d: qdcxdbrdrdddkdnddd', '7-9 d: dddflddbwnmddd', '12-14 f: rkgdfbdkqhnfsqjltntx', '5-14 x: xxxxxxxxxxxxxxx', '8-18 r: rrrrrrrlrrrrrrrrrr', '1-19 q: qqqqqqqqqqqqqqqqqqdq', '7-11 c: kscqhtcccctprbc', '3-5 h: dchjkntfhrbmmkkjpnh', '2-9 l: lllllllln', '1-6 c: sqczzcnkpwrcgvctlrc', '6-16 f: wcnppfpffjxpthhfxf', '16-17 x: xxxxcxxxrxsfxxpxfq', '7-9 q: qqqqqqqqt', '4-6 h: hxhhkgg', '12-20 v: pwvzsxtvvslvfxhvcvtz', '12-17 k: tkkkkkkkcfktknkkkk', '2-3 b: bpqr', '4-5 m: mhppm', '4-9 g: jrgxgqjqgrrpj', '7-12 h: hhswhqwhhqhhhlhtkhzw', '5-19 l: llllhlllllllllllllll', '2-3 n: mqncngfps', '6-15 q: qqqqqnhqqqqqqqtqq', '1-8 k: kfkkkkkkr', '5-10 f: pmpffbdkfpffgffcf', '3-8 b: bbsbcbbb', '9-12 h: hwhhhxhshhhhhc', '1-5 r: nhcrrbrrrj', '2-4 q: qqqsq', '13-17 h: lrlngvrhpsdmhkhzt', '8-17 m: rmmmmmmlmmmmqmsmmqm', '4-8 n: njnsnkjkhnkgblg', '9-10 d: pdwdkgcdrdzqdd', '3-4 p: pppp', '10-12 j: zcjjjjqwjrjj', '1-9 d: mddgrxsdk', '2-4 v: gsvvjv', '5-7 h: hhhbbhjh', '15-16 w: wwjwwwwwwwwwwwbw', '8-10 b: cbczjdpbkhdbkpbztn', '7-10 z: skfvjzzxzt', '15-16 m: mmmmmmrmjzxmmmbtmmm', '2-6 j: rjjgqb', '4-16 d: dptndnvddgtpqdddd', '7-8 j: jjhjjjbd', '2-3 w: bwdr', '4-6 g: jgngnmgggfpgcn', '2-3 p: ppkp', '7-8 m: mmmmmmnm', '5-6 l: lfllln', '3-4 r: rrrm', '6-7 s: ssssssss', '4-15 g: kdtgzznwrczjzgx', '11-12 w: jhwwrwwpwwwmwwfwgww', '13-15 w: wwwwcjjwwwwwgwwwwwf', '4-11 f: fffxffffffff', '3-7 g: ggggggpg', '3-10 m: mmnmmmmmmm', '9-11 h: hfhhhqhhhchhhwh', '4-5 j: jjqjq', '13-14 x: jmxnxbjrklnvxtn', '5-6 f: zzkqnzchtfnvffqd', '4-8 j: cxcjvfjjkjz', '8-14 s: sssssswnrsssscsss', '6-12 t: dftrtdvtxttt', '3-4 p: ppmp', '1-5 z: zzgszfrg', '1-8 g: wbgwggdgtswrlllj', '2-4 f: fffpf', '16-17 t: tttrktsmtmpttttttnt', '6-11 m: mqsxmmtfthmfwn', '2-3 c: mcbs', '1-3 j: xmjj', '15-16 j: jtjjjjjjjjjjjjjxj', '6-8 k: kkrkktckk', '9-11 l: ltlllllsllmlz', '17-18 s: sxmssqtjrhmzhssssk', '9-13 k: kkkkkkkkkkkkkkkhk', '6-9 g: kpnhsggmqklvtttgcxvl', '5-7 z: vzrxbmzzwglvczz', '4-10 k: khkkdkkckkkkkzkk', '2-6 q: qsqqnqq', '1-3 x: qxsxxxx', '10-14 x: xxzxxtxxxjcxxx', '4-6 z: dzzzvz', '1-2 c: cccv', '9-12 h: hhhhhhhhhhhc', '13-15 z: zzgzzzzzzmzzqzzkzz', '3-6 h: pgvjdhtpmthbz', '10-13 x: mxqbxxwxxxhxfrxxchxx', '2-5 b: qbbmpzrzkcjqqwbj', '3-14 q: ltxhrqqqqzfqqq', '6-10 j: jjjjprjkqj', '9-15 c: dsncxxlqwvzccwc', '12-16 m: nxrmdgmmxmscmhnm', '4-5 p: ppppthp', '10-13 d: ddddddddddddb', '2-6 x: bxkwbtsx', '5-7 j: jjjjqjjjjjj', '8-10 d: wzdddddtdddd', '6-9 z: dlzzzzzvwz', '2-3 h: hhhh', '11-13 t: ttttjtttttttxtt', '4-5 s: sdbps', '2-10 x: dcmxxxlxxhgxftrjbp', '9-15 h: hhhhhhhzjzhwhrkhh', '2-6 f: ftxhffff', '4-5 k: kkfrkwnbkkh', '3-5 m: mmdmm', '5-10 z: znvxzzldzvhqztr', '7-8 r: rrrrrrcr', '14-16 k: kkkkkkvkkkkkkbkk', '4-10 x: cxsxzxxxxxxxxn', '12-13 s: ssssssssssssss', '7-9 s: sswssssshs', '1-3 c: ncccrc', '7-9 r: rrrwrrtwr', '13-14 v: vvvvvvvvvvvvnv', '4-6 k: bkkkkx', '7-10 r: rrrrrrrrrrrrr', '7-8 l: llllllzll', '3-11 v: vqvvmnkvvswgkqvmvd', '8-10 c: cccccdcccm', '1-9 s: sssksqsshsj', '5-8 c: cccchmcccc', '5-6 h: hsqhhghrhk', '4-5 z: czzzrzlzn', '2-4 f: fzfffj', '14-17 p: pppppppppppppppmpp', '4-5 x: ldqxq', '12-16 g: gtgggggggggpgggggt', '13-14 v: zfbmrhphzmrvqv', '6-10 p: ppppppppphppkp', '10-12 l: xlllklllllkwlcl', '4-6 v: qvbvgdw', '6-12 q: qqqsqlqqqqqq', '3-5 s: rssgpssnb', '1-2 g: gzlpcmbsmgrq', '2-9 w: lpmbmfvpwggfvmzmmw', '4-6 n: nqtfzz', '3-4 f: fftf', '13-17 n: nnnznkgmnnnnpnngnfn', '8-10 p: ppppxppppppppprppsp', '10-12 g: ggnggkggggcvg', '3-8 l: lxrcbjnddcbpg', '6-7 q: qkjqfqqdkkkqrqqqc', '5-8 p: wpbpmpwpfsblpplmpp', '2-7 n: bbrtwnhhttntqhnr', '1-2 p: pcdxzjwmnkfjkpbj', '1-15 n: nnnnnnnnnnnnnnznn', '18-20 s: ssmsssssssssssssrssw', '1-12 h: vhxhmhhhhhhhd', '3-7 r: qkkvhvr', '3-5 k: xkpkkkzbtwkv', '2-4 z: zfzz', '1-2 t: ktttt', '2-3 p: pbwp', '2-4 j: ljjj', '14-15 t: pzpcktthttfttttt', '3-4 n: nwnj', '8-10 l: lzllllllln', '1-12 q: qqqqqqqqqqqqq', '6-12 z: xxltbzrpwzzmw', '15-16 q: qqqqqqqqqqqvqqqjq', '4-5 r: rhmrkrd', '7-10 r: rrrrrrlrrrrrr', '16-18 t: ttttwttttttttttttn', '9-17 m: bmmmmmmzmmpmmhmrw', '9-13 r: rrxfrrxrrrrrrr', '13-18 p: ppdxprpqppbpppprpz', '5-8 p: rprmpfpxgjphfktszplp', '5-7 h: hhhhhhnh', '3-7 h: rwhpshznhhh', '9-10 x: xwxzbrxxgxrxxdxxs', '6-7 h: hvhhhhng', '5-6 b: bbbbwhbb', '4-5 g: gbgggg', '3-9 g: gsbggghggpgdgg', '1-3 r: rxrhh', '3-4 c: rccn', '4-8 z: zpzzznzzzwz', '14-17 b: bbbbbbbbbbbbbbbbbzb', '2-4 w: rwvwrdn', '3-6 p: pfpsgp', '2-12 p: zpwkjpppbppjrppknh', '5-9 t: tmttgtttn', '2-3 v: wvvcv', '3-5 h: bnbhhtjhk', '15-17 f: tffwftdskgfxgfffpk', '16-17 h: hphhhhdhhhhhxhhhrhh', '7-8 d: ddddddtnd', '9-20 t: tqttttttttttttttbttw', '1-11 v: vxcgzvvvkrlqvg', '2-6 r: ghrbwrtfksqkxx', '8-10 w: wwwswwwmvwww', '4-10 m: mqmmmtmmfq', '2-3 g: gkgtgv', '9-11 w: wwwwsqwwpwwxrwww', '3-4 w: zwxwtcscwmwmndcw', '8-9 q: xsqqqqzxfqfv', '2-4 w: wwhh', '9-18 d: ddddddhddddddddddq', '3-4 s: sssjsvs', '15-16 p: wphpxpppppppppppppvp', '10-12 t: qftttqhtvttt', '1-2 b: vbfxqgbzrktjm', '3-4 k: lkkr', '9-11 d: dddddkdqdttddd', '9-11 m: mwngbfmhmcvwx', '2-5 b: scbxbb', '6-9 z: zzzzzzzzzzz', '1-3 z: zzvhz', '5-7 x: xxxxxxkxx', '1-5 s: ssscshss', '1-7 s: csrfvfsqjss', '16-17 k: fwdkkkckkkkrrkkck', '3-4 h: hhhs', '4-8 w: wwwswwwx', '1-10 f: fffskffsdfcfvfff', '7-15 r: rrrrrrrrrrrrrrxr', '1-2 k: kvxbzdcnsqrskhmx', '2-4 s: wbvsfs', '2-7 q: rbgqpqdq', '15-16 f: fffffffffffffffq', '1-3 c: bccpkm', '5-11 g: fsvgthpglgg', '3-5 f: ffffwf', '5-16 j: djmwqfxsbzwjdwtj', '3-4 p: pprpp', '5-6 n: nhnnwj', '8-12 s: tssssssrsssksss', '5-8 p: pppppppppppp', '10-15 w: wgfwwcwtmwwgwpwwh', '12-15 l: lllllllllllplll', '1-8 c: ccccqccd', '3-4 z: zzzvzkzgc', '2-10 h: swwbtfkvfhrjztdzx', '2-7 z: zhbzkzlzz', '2-9 q: ddqdqpkcjqkfgqtcjqq', '9-10 l: lllmllkltlll', '2-3 n: ngwn', '2-3 r: rrnr', '5-10 n: ltnnnknnvcnnn', '7-9 p: jtpptpllpj', '2-5 s: slssssszssssssss', '16-17 d: dddddddddddddddlp', '2-5 q: bbwqqbkmdhqmjhn', '7-10 m: qmpgmmsmmmmkmmkj', '4-7 g: vczggdgbgxgg']
QUEUES_KEY = 'rq:queues' WORKERS_KEY = 'rq:workers' SUSPENDED_KEY = 'rq:suspended' QUEUE_NAMESPACE_PREFIX = 'rq:queue:' JOB_NAMESPACE_PREFIX = 'rq:job:' def queue_key_from_name(name): return QUEUE_NAMESPACE_PREFIX + name def queue_name_from_key(key): assert key.startswith(QUEUE_NAMESPACE_PREFIX) return key[len(QUEUE_NAMESPACE_PREFIX):] def job_id_from_key(key): assert key.startswith(JOB_NAMESPACE_PREFIX) return key[len(JOB_NAMESPACE_PREFIX):] def job_key_from_id(job_id): return JOB_NAMESPACE_PREFIX + job_id def children_key_from_id(job_id): return 'rq:job:{0}:children'.format(job_id) def parents_key_from_id(job_id): return 'rq:job:{0}:parents'.format(job_id) def started_registry_key_from_name(name): return 'rq:wip:{0}'.format(name) def finished_registry_key_from_name(name): return 'rq:finished:{0}'.format(name) def deferred_registry_key_from_name(name): return 'rq:deferred:{0}'.format(name) def worker_key_from_name(name): return 'rq:worker:{0}'.format(name)
queues_key = 'rq:queues' workers_key = 'rq:workers' suspended_key = 'rq:suspended' queue_namespace_prefix = 'rq:queue:' job_namespace_prefix = 'rq:job:' def queue_key_from_name(name): return QUEUE_NAMESPACE_PREFIX + name def queue_name_from_key(key): assert key.startswith(QUEUE_NAMESPACE_PREFIX) return key[len(QUEUE_NAMESPACE_PREFIX):] def job_id_from_key(key): assert key.startswith(JOB_NAMESPACE_PREFIX) return key[len(JOB_NAMESPACE_PREFIX):] def job_key_from_id(job_id): return JOB_NAMESPACE_PREFIX + job_id def children_key_from_id(job_id): return 'rq:job:{0}:children'.format(job_id) def parents_key_from_id(job_id): return 'rq:job:{0}:parents'.format(job_id) def started_registry_key_from_name(name): return 'rq:wip:{0}'.format(name) def finished_registry_key_from_name(name): return 'rq:finished:{0}'.format(name) def deferred_registry_key_from_name(name): return 'rq:deferred:{0}'.format(name) def worker_key_from_name(name): return 'rq:worker:{0}'.format(name)
class Solution: def search(self, nums: List[int], target: int) -> int: if not nums: return -1 left, right = 0, len(nums) - 1 while left <= right: m = (left + right) // 2 if nums[m] == target: return m if nums[m] >= nums[left]: if nums[left] <= target < nums[m]: right = m - 1 else: left = m + 1 else: if nums[m] < target <= nums[right]: left = m + 1 else: right = m - 1 return -1
class Solution: def search(self, nums: List[int], target: int) -> int: if not nums: return -1 (left, right) = (0, len(nums) - 1) while left <= right: m = (left + right) // 2 if nums[m] == target: return m if nums[m] >= nums[left]: if nums[left] <= target < nums[m]: right = m - 1 else: left = m + 1 elif nums[m] < target <= nums[right]: left = m + 1 else: right = m - 1 return -1
# Write your solution for 1.3 here! n= 0 i= 0 while n <= 10000: i = i + 1 n = n + i print(i)
n = 0 i = 0 while n <= 10000: i = i + 1 n = n + i print(i)
## ## Intro to Git, Python, and Programming Basics (bypassing XML) ## # going over some git basics # git --version # git help # Pull down a repo from somewhere # git clone <url> # git branches; discussed to some degree; means of doing changes off to side without affecting core code # then we can merge this stuff in as needed # git remote -v # origin git@github.com:russellpope/devnet-express-dc.git (fetch) # origin git@github.com:russellpope/devnet-express-dc.git (push) # lets us know where we're pulling stuff from and where we make a push to # origin in this case is an alias # git pull # Pulls the latest changes for the selected branch # python -V or python --version # note you can do this with py3 in a virtualenv or python3 --version # python YOURSCRIPT.py # Some python bits of note: # indentation defining scopes (WHITESPACE CHARACTER IS IMPORTANT) # i.e. spaces and tabs are different things # # Sample below; illustrates white spaces print("Hellworld!") num = 1 if num < 1: print(f"I'm less than {num}!") print("goodbye cruel world!") # note the 'if' condition will never execute # editorial note: I used an f string because I wanted to print("Helloworld!") num = 1 print(f"Value is: {num}") print("Value is: " + str(num)) print("Value is:", num) if num < 1: print(f"I'm less than {num}!") elif num == 1: print(f"I'm {num}") else: print(f"{num} is something else!") # # tried to transcribe his example before he switched sides # I hate his variable names because they look like java stuff # goes through an excercise of running python from CLI # walking through his interpreter stuff # ran the below with expected output: # >>> print("Hello World! How are you?") # Hello World! How are you? # to exit python interpreter # >>> quit() # # talks about running scripts # unix prompt below: # #python your_script_here.py # Covers the "shebang" line # #!/usr/bin/python # or you could do this which he may not cover # #!/usr/bin/env python # This will actually use whatever python interpreter is defined in the environment var # Scopes, operators, conditiona statemments # Parsing JSOn with python sample_json = { "first_name" : "Mike", "last_name" : "Maas" } # data structure # nice thing about it is that it maps to python dictionaries pretty nicely # collections of key/value pairs enclosed in {} # Can also have values be ordered lists of values # or even ordered lists of key value pairs sample_json_with_array = [{"first_name" : "Mike","last_name" : "Maas"}, {"first_name" : "Brett","last_name" : "Tiller"}] # provided a more complex data structure to describe a donut to showcase the sorts of embedded stuff you can do ## ## # REST APIs ## ## # two major types of web services: REST or SOAP # # Commonly used in industry # R in rest is Representational not resourcing # Representation State Transfer # Give me a look at a thing # Here's what the thing should look like now! # Typically over HTTP # Several REST methods; # GET - go get some information # POST - Create a new thing with this information # PUT - Update an existing thing with this information # DELETE - Delete/destroy the thing # These typically go to different URLs # Lots of ways to authenticate; varies from API to API # Basic HTTP - Username/Password # Different status codes # 200 "Everything is fine! Here's your data" # 201 "I got the thing you asked me to do okay!" # 4XX "You screwed up!" # 5XX "I screwed up!" # Headers; important to define ESPECIALLY WHEN POSTing or PUTing # Body; used in POST/PUT for updates # Using Spark API as starting point # talking about OAUTH token; Spark makes it easy to retrieve # Request/response; i.e. Get rooms and it responds with a list of rooms # Example shows a GET to a regular URL
print('Hellworld!') num = 1 if num < 1: print(f"I'm less than {num}!") print('goodbye cruel world!') print('Helloworld!') num = 1 print(f'Value is: {num}') print('Value is: ' + str(num)) print('Value is:', num) if num < 1: print(f"I'm less than {num}!") elif num == 1: print(f"I'm {num}") else: print(f'{num} is something else!') sample_json = {'first_name': 'Mike', 'last_name': 'Maas'} sample_json_with_array = [{'first_name': 'Mike', 'last_name': 'Maas'}, {'first_name': 'Brett', 'last_name': 'Tiller'}]
# # liberator:configuration.py # # The Initial Developer of the Original Code is # Minh Minh <hnimminh at[@] outlook dot[.] com> # Portions created by the Initial Developer are Copyright (C) the Initial Developer. # All Rights Reserved. # #----------------------------------------------------------------------------------------------------- # GLOBAL CONFIGURATION FILES #----------------------------------------------------------------------------------------------------- _APPLICATION = 'LIBRESBC' _DESCRIPTION = 'Open Source Session Border Controller for Large-Scale Voice Infrastructures' _SWVERSION = '0.5.7' #----------------------------------------------------------------------------------------------------- # REDIS ENDPOINT #----------------------------------------------------------------------------------------------------- REDIS_HOST = '{{redis.host}}' REDIS_PORT = {{redis.port}} REDIS_DB = {{redis.database}} REDIS_PASSWORD = {{ ('%s')|format(redis.password)|to_json if redis.password else 'None' }} SCAN_COUNT = 1000 REDIS_TIMEOUT = 5 #----------------------------------------------------------------------------------------------------- # VOICE ATTRIBUTE #----------------------------------------------------------------------------------------------------- SWCODECS = ['ALAW', 'ULAW', 'OPUS', 'G729', 'AMR', 'AMR-WB'] _BUILTIN_ACLS_ = ['rfc1918.auto', 'nat.auto', 'localnet.auto', 'loopback.auto'] #----------------------------------------------------------------------------------------------------- # SERVER PROPERTIES #----------------------------------------------------------------------------------------------------- NODEID = '{{nodeid}}' CLUSTERS = { 'name': 'defaultname', 'members': [NODEID], "rtp_start_port": 0, "rtp_end_port": 0, "max_calls_per_second": 0, "max_concurrent_calls": 0 } #----------------------------------------------------------------------------------------------------- CHANGE_CFG_CHANNEL = 'CHANGE_CFG_CHANNEL' SECURITY_CHANNEL = 'SECURITY_CHANNEL' NODEID_CHANNEL = f'{NODEID.upper()}_CHANNEL' #----------------------------------------------------------------------------------------------------- # CALL ENGINE EVENT SOCKET #----------------------------------------------------------------------------------------------------- ESL_HOST = '127.0.0.1' ESL_PORT = 8021 # LOG DIRECTORY LOGDIR = '/var/log/libresbc' #----------------------------------------------------------------------------------------------------- # HTTPCDR DATA #----------------------------------------------------------------------------------------------------- HTTPCDR_ENDPOINTS = {{httpcdr.endpoints if httpcdr else 'None'}}
_application = 'LIBRESBC' _description = 'Open Source Session Border Controller for Large-Scale Voice Infrastructures' _swversion = '0.5.7' redis_host = '{{redis.host}}' redis_port = {{redis.port}} redis_db = {{redis.database}} redis_password = {{'%s' | format(redis.password) | to_json if redis.password else 'None'}} scan_count = 1000 redis_timeout = 5 swcodecs = ['ALAW', 'ULAW', 'OPUS', 'G729', 'AMR', 'AMR-WB'] _builtin_acls_ = ['rfc1918.auto', 'nat.auto', 'localnet.auto', 'loopback.auto'] nodeid = '{{nodeid}}' clusters = {'name': 'defaultname', 'members': [NODEID], 'rtp_start_port': 0, 'rtp_end_port': 0, 'max_calls_per_second': 0, 'max_concurrent_calls': 0} change_cfg_channel = 'CHANGE_CFG_CHANNEL' security_channel = 'SECURITY_CHANNEL' nodeid_channel = f'{NODEID.upper()}_CHANNEL' esl_host = '127.0.0.1' esl_port = 8021 logdir = '/var/log/libresbc' httpcdr_endpoints = {{httpcdr.endpoints if httpcdr else 'None'}}
#9 type c str1=input('Enter the 1st String: ') str2=input('Enter the 2st String: ') if str1<str2: print(str2) else: l=len(str1) for x in range(l//2): print(' '*x+str1[x]+' '*(l-(2*(x+1)))+str1[-(x+1)])
str1 = input('Enter the 1st String: ') str2 = input('Enter the 2st String: ') if str1 < str2: print(str2) else: l = len(str1) for x in range(l // 2): print(' ' * x + str1[x] + ' ' * (l - 2 * (x + 1)) + str1[-(x + 1)])
__title__ = 'freeproxies' __description__ = 'Free proxies for humans' __url__ = 'https://github.com/iamkamleshrangi/freeproxies' __version__ = '0.0.1' __author__ = 'Kamlesh Kumar Rangi' __author_email__ = 'iamkamleshrangi@gmail.com' __license__ = 'GPL v3' __copyright__ = 'Copyright 2020 Kamlesh Kumar Rangi'
__title__ = 'freeproxies' __description__ = 'Free proxies for humans' __url__ = 'https://github.com/iamkamleshrangi/freeproxies' __version__ = '0.0.1' __author__ = 'Kamlesh Kumar Rangi' __author_email__ = 'iamkamleshrangi@gmail.com' __license__ = 'GPL v3' __copyright__ = 'Copyright 2020 Kamlesh Kumar Rangi'
# Sensor classes class SensCalPoly: # Polynomial calibration curve class def __init__(self, id, signalMin, signalMax, *args): self.id = id self.coeffs = [] for arg in args: self.coeffs.append(arg) self.signalMin = signalMin self.signalMax = signalMax def setCoeffs(self, *args): self.coeffs = [] for arg in args: self.coeffs.append(arg) def setId(self, id): self.id = id def getId(self): return self.id def applyCal(self, signal): if self.signalMin <= signal and signal <= self.signalMax: calSignal = 0 degree = 0 for coeff in self.coeffs: calSignal += coeff * signal ** degree degree += 1 return calSignal else: return -1 class ADistSens: def __init__(self, id, analog, aPin, calObj): self.id = id self.analog = analog[aPin] self.aPin = aPin self.cal = calObj def setCal(self, calObj): self.cal = calObj def getObstDist(self): return self.cal.applyCal(self.analog) def hasObst(self, distMin, distMax): obstDist = self.getObstDist() if obstDist != -1 and distMin <= obstDist and obstDist <= distMax: return True else: return False class DProxSens: def __init__(self, id, analog, aPin): self.id = id self.analog = analog[aPin] self.aPin = aPin def hasObst(self): if self.analog < 1023: return True else: return False
class Senscalpoly: def __init__(self, id, signalMin, signalMax, *args): self.id = id self.coeffs = [] for arg in args: self.coeffs.append(arg) self.signalMin = signalMin self.signalMax = signalMax def set_coeffs(self, *args): self.coeffs = [] for arg in args: self.coeffs.append(arg) def set_id(self, id): self.id = id def get_id(self): return self.id def apply_cal(self, signal): if self.signalMin <= signal and signal <= self.signalMax: cal_signal = 0 degree = 0 for coeff in self.coeffs: cal_signal += coeff * signal ** degree degree += 1 return calSignal else: return -1 class Adistsens: def __init__(self, id, analog, aPin, calObj): self.id = id self.analog = analog[aPin] self.aPin = aPin self.cal = calObj def set_cal(self, calObj): self.cal = calObj def get_obst_dist(self): return self.cal.applyCal(self.analog) def has_obst(self, distMin, distMax): obst_dist = self.getObstDist() if obstDist != -1 and distMin <= obstDist and (obstDist <= distMax): return True else: return False class Dproxsens: def __init__(self, id, analog, aPin): self.id = id self.analog = analog[aPin] self.aPin = aPin def has_obst(self): if self.analog < 1023: return True else: return False
num = 50 flag = True for i in range(2, num-1): if(num % i == 0): flag = False break if(flag == True): print("Prime number.") if(flag == False): print("Not a prime number.")
num = 50 flag = True for i in range(2, num - 1): if num % i == 0: flag = False break if flag == True: print('Prime number.') if flag == False: print('Not a prime number.')
# This program is used to make a fibonacci sequence in a certain terms def fibonacci(term) : n1 = 0 n2 = 1 if(term <= 0) : print("Please, print with positive integer") elif(term == 1) : print(n1) else : print(n1) print(n2) count = 1 while(count <= term-2) : n_update = n1 + n2 # Update number n1 = n2 n2 = n_update print(n2) count += 1 input_number = int(input("How many terms? ")) fibonacci(input_number)
def fibonacci(term): n1 = 0 n2 = 1 if term <= 0: print('Please, print with positive integer') elif term == 1: print(n1) else: print(n1) print(n2) count = 1 while count <= term - 2: n_update = n1 + n2 n1 = n2 n2 = n_update print(n2) count += 1 input_number = int(input('How many terms? ')) fibonacci(input_number)
# uncompyle6 version 3.2.0 # Python bytecode 2.4 (62061) # Decompiled from: Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)] # Embedded file name: otp.distributed.PotentialShard class PotentialShard: __module__ = __name__ def __init__(self, id): self.id = id self.name = None self.population = 0 self.welcomeValleyPopulation = 0 self.active = 1 self.available = 1 return
class Potentialshard: __module__ = __name__ def __init__(self, id): self.id = id self.name = None self.population = 0 self.welcomeValleyPopulation = 0 self.active = 1 self.available = 1 return
class Move: def __init__(self, start_row, start_column, end_row, end_column): self.start_row = start_row self.start_column = start_column self.end_row = end_row self.end_column = end_column
class Move: def __init__(self, start_row, start_column, end_row, end_column): self.start_row = start_row self.start_column = start_column self.end_row = end_row self.end_column = end_column
'''This file holds the version of the project, according to Jira''' # starting ml modelling __version__ = '0.2.4'
"""This file holds the version of the project, according to Jira""" __version__ = '0.2.4'
#LeetCode problem 572: Subtree of Another Tree # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def isSubtree(self, s: TreeNode, t: TreeNode) -> bool: res1=[] res2=[] res1=self.getInorder(s,res1) res2=self.getInorder(t,res2) s1='' for i in range(len(res1)): s1+=res1[i] s2='' for i in range(len(res2)): s2+=res2[i] print(s1,s2) return s2 in s1 def getInorder(self, root:TreeNode,res): if root is None: res.append("null") return if root.left is None: res.append("lnull") elif root.right is None: res.append("rnull") self.getInorder(root.left,res) res.append(str(root.val)) self.getInorder(root.right,res) return res
class Solution: def is_subtree(self, s: TreeNode, t: TreeNode) -> bool: res1 = [] res2 = [] res1 = self.getInorder(s, res1) res2 = self.getInorder(t, res2) s1 = '' for i in range(len(res1)): s1 += res1[i] s2 = '' for i in range(len(res2)): s2 += res2[i] print(s1, s2) return s2 in s1 def get_inorder(self, root: TreeNode, res): if root is None: res.append('null') return if root.left is None: res.append('lnull') elif root.right is None: res.append('rnull') self.getInorder(root.left, res) res.append(str(root.val)) self.getInorder(root.right, res) return res
characterMapSean = { "sean_base_001": "sean_base_001", # Auto: Edited "sean_base_y_001": "", # Auto: Deleted "sean_ex_001_001": "sean_ex_001_001", # Auto: Edited "sean_ex_002_001": "sean_ex_002_001", # Auto: Edited "sean_ex_003_001": "sean_ex_003_001", # Auto: Edited "sean_ex_004_001": "sean_ex_004_001", # Auto: Edited "sean_ex_005_001": "sean_ex_005_001", # Auto: Edited "sean_ex_006_001": "sean_ex_006_001", # Auto: Edited "sean_ex_007_001": "sean_ex_007_001", # Auto: Edited "sean_ex_008_001": "sean_ex_008_001", # Auto: Edited "sean_ex_009_001": "sean_ex_009_001", # Auto: Edited "sean_ex_010_001": "sean_ex_010_001", # Auto: Edited "sean_ex_011_001": "sean_ex_011_001", # Auto: Edited "sean_ex_012_001": "sean_ex_012_001", # Auto: Edited "sean_ex_013_001": "", # Auto: Deleted "sean_ex_014_001": "", # Auto: Deleted "sean_ex_y_001_001": "", # Auto: Deleted "sean_ex_y_002_001": "", # Auto: Deleted "sean_ex_y_003_001": "", # Auto: Deleted "sean_ex_y_004_001": "", # Auto: Deleted "sean_ex_y_005_001": "", # Auto: Deleted "sean_ex_y_006_001": "", # Auto: Deleted "sean_ex_y_007_001": "", # Auto: Deleted "sean_ex_y_008_001": "", # Auto: Deleted "sean_ex_y_009_001": "", # Auto: Deleted "sean_ex_y_010_001": "", # Auto: Deleted "sean_ex_y_011_001": "", # Auto: Deleted "sean_ex_y_012_001": "", # Auto: Deleted "sean_ex_y_013_001": "", # Auto: Deleted "sean_ex_y_014_001": "", # Auto: Deleted }
character_map_sean = {'sean_base_001': 'sean_base_001', 'sean_base_y_001': '', 'sean_ex_001_001': 'sean_ex_001_001', 'sean_ex_002_001': 'sean_ex_002_001', 'sean_ex_003_001': 'sean_ex_003_001', 'sean_ex_004_001': 'sean_ex_004_001', 'sean_ex_005_001': 'sean_ex_005_001', 'sean_ex_006_001': 'sean_ex_006_001', 'sean_ex_007_001': 'sean_ex_007_001', 'sean_ex_008_001': 'sean_ex_008_001', 'sean_ex_009_001': 'sean_ex_009_001', 'sean_ex_010_001': 'sean_ex_010_001', 'sean_ex_011_001': 'sean_ex_011_001', 'sean_ex_012_001': 'sean_ex_012_001', 'sean_ex_013_001': '', 'sean_ex_014_001': '', 'sean_ex_y_001_001': '', 'sean_ex_y_002_001': '', 'sean_ex_y_003_001': '', 'sean_ex_y_004_001': '', 'sean_ex_y_005_001': '', 'sean_ex_y_006_001': '', 'sean_ex_y_007_001': '', 'sean_ex_y_008_001': '', 'sean_ex_y_009_001': '', 'sean_ex_y_010_001': '', 'sean_ex_y_011_001': '', 'sean_ex_y_012_001': '', 'sean_ex_y_013_001': '', 'sean_ex_y_014_001': ''}
def getMinimumCost(k, c): n = len(c) x = n // k price = 0 for i in range(1 , x + 1): for _ in range(k): max_c = max(c) price += max_c * i c.remove(max_c) for j in c: price += j * (i + 1) return price print(getMinimumCost(3 , [2, 5 , 6]))
def get_minimum_cost(k, c): n = len(c) x = n // k price = 0 for i in range(1, x + 1): for _ in range(k): max_c = max(c) price += max_c * i c.remove(max_c) for j in c: price += j * (i + 1) return price print(get_minimum_cost(3, [2, 5, 6]))
PATH = "path" SRC_PATH = "src_path" CONFIG_PATH = "config_path" USERNAME = "username" EMAIL = "email" ASSUMPTIONS_PATH = "ass_path" NOTES_PATH = "notes_path" TODOS_PATH = "todos_path" CONFIG_FILENAME = "config.json" ASSUMPTIONS_DIRNAME = "assumptions" NOTES_DIRNAME = "notes" TODOS_DIRNAME = "todos" INITIALIZED_FLAG = "initialized"
path = 'path' src_path = 'src_path' config_path = 'config_path' username = 'username' email = 'email' assumptions_path = 'ass_path' notes_path = 'notes_path' todos_path = 'todos_path' config_filename = 'config.json' assumptions_dirname = 'assumptions' notes_dirname = 'notes' todos_dirname = 'todos' initialized_flag = 'initialized'
# sender, recipent and mail subject sender = 'sender@mail.com' recipent = 'recipent@mail.com' subject = 'New public IP address' # SMTP url and port smtpServer = 'smtp.mail.com:587' # credentials for your mail account username = 'sender@mail.com' password = 'password'
sender = 'sender@mail.com' recipent = 'recipent@mail.com' subject = 'New public IP address' smtp_server = 'smtp.mail.com:587' username = 'sender@mail.com' password = 'password'
pizzas = ['Popcorn Shrimp Pizza ', 'Surf&Turf Pizza', 'BBQ Sausage Pizza'] for pizza in pizzas: print("I like " + pizza) print("I really love pizza!")
pizzas = ['Popcorn Shrimp Pizza ', 'Surf&Turf Pizza', 'BBQ Sausage Pizza'] for pizza in pizzas: print('I like ' + pizza) print('I really love pizza!')
class Solution: def combinationSum(self, candidates, target): # candidates.sort() # dp = [[[]]] + [[] for i in range(target)] # for i in range(1, target + 1): # for number in candidates: # if number > i: # break # for L in dp[i - number]: # if not L or number >= L[-1]: # dp[i] = dp[i] + [L + [number]] # return dp[target] res = [] candidates.sort() def dfs(remain, stack): if not remain: res.append(stack) return for item in candidates: if item > remain: break elif not stack or item >= stack[-1]: dfs(remain - item, stack + [item]) dfs(target, []) return res
class Solution: def combination_sum(self, candidates, target): res = [] candidates.sort() def dfs(remain, stack): if not remain: res.append(stack) return for item in candidates: if item > remain: break elif not stack or item >= stack[-1]: dfs(remain - item, stack + [item]) dfs(target, []) return res
# OpenWeatherMap API Key api_key_owm= "b80fd2ed7964ad60c921362b393b0613" # Google API Key api_key_g = "YOUR KEY HERE!"
api_key_owm = 'b80fd2ed7964ad60c921362b393b0613' api_key_g = 'YOUR KEY HERE!'
# demonstrate template string functions def main(): # Usual string formatting with format() str1 = "You're watching {0} by {1}".format("Advanced Python", "Joe Marini") print(str1) # TODO: create a template with placeholders # TODO: use the substitute method with keyword arguments # TODO: use the substitute method with a dictionary if __name__ == "__main__": main()
def main(): str1 = "You're watching {0} by {1}".format('Advanced Python', 'Joe Marini') print(str1) if __name__ == '__main__': main()
def test_devices(spotify_user_auth): assert spotify_user_auth.devices() def test_recently_played_tracks(spotify_user_auth): assert spotify_user_auth.recently_played_tracks() def test_play_album(spotify_user_auth, reise_reise_album_id): assert spotify_user_auth.play(album_id=reise_reise_album_id) is not None def test_play_single_track(spotify_user_auth, them_bones_track_id): assert spotify_user_auth.play(track_ids=them_bones_track_id) is not None assert spotify_user_auth.pause() is not None def test_play_multiple_tracks( spotify_user_auth, them_bones_track_id, cover_me_track_id ): assert ( spotify_user_auth.play(track_ids=[them_bones_track_id, cover_me_track_id]) is not None ) assert spotify_user_auth.pause() is not None def test_play_artist(spotify_user_auth, depeche_mode_artist_id): assert spotify_user_auth.play(artist_id=depeche_mode_artist_id) is not None assert spotify_user_auth.pause() is not None def test_play_with_no_args(spotify_user_auth): assert spotify_user_auth.play() is not None def test_currently_playing(spotify_user_auth): assert spotify_user_auth.currently_playing() def test_currently_playing_info(spotify_user_auth): assert spotify_user_auth.currently_playing_info() def test_next(spotify_user_auth): assert spotify_user_auth.next() is not None def test_previous(spotify_user_auth): assert spotify_user_auth.previous() is not None def test_repeat(spotify_user_auth): assert spotify_user_auth.repeat() is not None def test_shuffle(spotify_user_auth): assert spotify_user_auth.shuffle() is not None def test_seek(spotify_user_auth): assert spotify_user_auth.seek(10000) is not None # 10 seconds def test_volume(spotify_user_auth): assert spotify_user_auth.volume(72) is not None assert spotify_user_auth.volume(32) is not None def test_pause(spotify_user_auth): assert spotify_user_auth.pause() is not None def test_queue(spotify_user_auth, them_bones_track_id): assert spotify_user_auth.queue(them_bones_track_id) is not None
def test_devices(spotify_user_auth): assert spotify_user_auth.devices() def test_recently_played_tracks(spotify_user_auth): assert spotify_user_auth.recently_played_tracks() def test_play_album(spotify_user_auth, reise_reise_album_id): assert spotify_user_auth.play(album_id=reise_reise_album_id) is not None def test_play_single_track(spotify_user_auth, them_bones_track_id): assert spotify_user_auth.play(track_ids=them_bones_track_id) is not None assert spotify_user_auth.pause() is not None def test_play_multiple_tracks(spotify_user_auth, them_bones_track_id, cover_me_track_id): assert spotify_user_auth.play(track_ids=[them_bones_track_id, cover_me_track_id]) is not None assert spotify_user_auth.pause() is not None def test_play_artist(spotify_user_auth, depeche_mode_artist_id): assert spotify_user_auth.play(artist_id=depeche_mode_artist_id) is not None assert spotify_user_auth.pause() is not None def test_play_with_no_args(spotify_user_auth): assert spotify_user_auth.play() is not None def test_currently_playing(spotify_user_auth): assert spotify_user_auth.currently_playing() def test_currently_playing_info(spotify_user_auth): assert spotify_user_auth.currently_playing_info() def test_next(spotify_user_auth): assert spotify_user_auth.next() is not None def test_previous(spotify_user_auth): assert spotify_user_auth.previous() is not None def test_repeat(spotify_user_auth): assert spotify_user_auth.repeat() is not None def test_shuffle(spotify_user_auth): assert spotify_user_auth.shuffle() is not None def test_seek(spotify_user_auth): assert spotify_user_auth.seek(10000) is not None def test_volume(spotify_user_auth): assert spotify_user_auth.volume(72) is not None assert spotify_user_auth.volume(32) is not None def test_pause(spotify_user_auth): assert spotify_user_auth.pause() is not None def test_queue(spotify_user_auth, them_bones_track_id): assert spotify_user_auth.queue(them_bones_track_id) is not None
# O(log n) def binary_search(items, item): bottom = 0 top = len(items) - 1 while bottom <= top: middle = int((bottom + top) / 2) guess = items[middle] if guess == item: return middle if guess > item: top = middle - 1 else: bottom = middle + 1 return None items = [1,29,30,40,57,72,100] print(binary_search(items, 30)) print(binary_search(items, 404))
def binary_search(items, item): bottom = 0 top = len(items) - 1 while bottom <= top: middle = int((bottom + top) / 2) guess = items[middle] if guess == item: return middle if guess > item: top = middle - 1 else: bottom = middle + 1 return None items = [1, 29, 30, 40, 57, 72, 100] print(binary_search(items, 30)) print(binary_search(items, 404))
class Solution: # One Liner (Accepted + Top Voted), O(n) time and space def getConcatenation(self, nums: List[int]) -> List[int]: return nums + nums # Extend (Sample), O(n) time and space def getConcatenation(self, nums: List[int]) -> List[int]: ans = nums ans.extend(nums) return ans
class Solution: def get_concatenation(self, nums: List[int]) -> List[int]: return nums + nums def get_concatenation(self, nums: List[int]) -> List[int]: ans = nums ans.extend(nums) return ans
def challenge_to_string(scheme, params): s = scheme for name, value in params.items(): s += ' {}="{}"'.format(name, value.replace('\\', '\\\\').replace('"', '\\"')) return s class WWWAuthenticateMiddleware: def __init__(self, get_response): self.get_response = get_response def __call__(self, request): request.auth_challenges = [] response = self.get_response(request) for i, challenge in enumerate(request.auth_challenges): whatever = 'WWW-Authenticate' + str(i) response._headers[whatever] = ('WWW-Authenticate', challenge_to_string(*challenge)) return response
def challenge_to_string(scheme, params): s = scheme for (name, value) in params.items(): s += ' {}="{}"'.format(name, value.replace('\\', '\\\\').replace('"', '\\"')) return s class Wwwauthenticatemiddleware: def __init__(self, get_response): self.get_response = get_response def __call__(self, request): request.auth_challenges = [] response = self.get_response(request) for (i, challenge) in enumerate(request.auth_challenges): whatever = 'WWW-Authenticate' + str(i) response._headers[whatever] = ('WWW-Authenticate', challenge_to_string(*challenge)) return response
URL_HOST_FILES = [ # "https://adaway.org/hosts.txt", "http://winhelp2002.mvps.org/hosts.txt", "http://hosts-file.net/ad_servers.txt", "http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext", "http://someonewhocares.org/hosts/hosts", ]
url_host_files = ['http://winhelp2002.mvps.org/hosts.txt', 'http://hosts-file.net/ad_servers.txt', 'http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext', 'http://someonewhocares.org/hosts/hosts']
songs = ["Like a Rolling Stone", "Satisfaction", "Imagine", "What's Going On", "Respect", "Good Vibrations"] playcounts = [78, 29, 44, 21, 89, 5] plays = {key:value for key, value in zip(songs, playcounts)} print(plays) plays["Purple Haze"] = 1 plays["Respect"] = 94 library = {"The Best Songs": plays, "Sunday Feelings": {}} print(library)
songs = ['Like a Rolling Stone', 'Satisfaction', 'Imagine', "What's Going On", 'Respect', 'Good Vibrations'] playcounts = [78, 29, 44, 21, 89, 5] plays = {key: value for (key, value) in zip(songs, playcounts)} print(plays) plays['Purple Haze'] = 1 plays['Respect'] = 94 library = {'The Best Songs': plays, 'Sunday Feelings': {}} print(library)
#count the no. of same string and print for ex wwwwrrrig will be w4r3ig def countnsay(s): n = len(s) say = "" cur = "" count = 1 for i in range(n-1): curr = s[i] nxt = s[i+1] if curr == nxt: count +=1 elif(count>1): cur+=curr say+=(str(curr)+str(count)) count = 1 else: cur+=curr say+=str(curr) cur += curr say+=(str(s[n-1])+str(count)) print(cur) print(say) s = "wwwwaaadexxxxxx" countnsay(s)
def countnsay(s): n = len(s) say = '' cur = '' count = 1 for i in range(n - 1): curr = s[i] nxt = s[i + 1] if curr == nxt: count += 1 elif count > 1: cur += curr say += str(curr) + str(count) count = 1 else: cur += curr say += str(curr) cur += curr say += str(s[n - 1]) + str(count) print(cur) print(say) s = 'wwwwaaadexxxxxx' countnsay(s)
# Index of practices ''' Part I - List 1) Create a empty list 2) Append to list 2.1) One bye One 2.2) By '*' 2.3) By extend() 2.4) By for 3) Joint 2 lists 4) Lenth a list 5) Pick out from list 5.1) Pick 1 ( By [index] ) 5.2) Pick by for 5.3) If exist ( By 'in') 6) Delete in list 6.1) Delete one 6.2) Empty a list ( By 'clear()') Part II - Operaters of List max() min() len() ------ list( seq ) --------- sort() index() copy() Part III - Tuple 1) Create a tuple 2) Joint 2 tuples 3) Lenth a tuple 4) Pick out from tuple 5) Delete a tuple Part IV - Operaters of List max() min() len() ------ tuple(seq) '''
""" Part I - List 1) Create a empty list 2) Append to list 2.1) One bye One 2.2) By '*' 2.3) By extend() 2.4) By for 3) Joint 2 lists 4) Lenth a list 5) Pick out from list 5.1) Pick 1 ( By [index] ) 5.2) Pick by for 5.3) If exist ( By 'in') 6) Delete in list 6.1) Delete one 6.2) Empty a list ( By 'clear()') Part II - Operaters of List max() min() len() ------ list( seq ) --------- sort() index() copy() Part III - Tuple 1) Create a tuple 2) Joint 2 tuples 3) Lenth a tuple 4) Pick out from tuple 5) Delete a tuple Part IV - Operaters of List max() min() len() ------ tuple(seq) """
N = int(input()) M = [] for i in range(N): x, y = [int(x) for x in input().split()] M.append([x, y]) areatotal = 0 for i in range(N): if i != 0: for j in range(i, -1, -1): if M[i][0] > M[j][0]: menorx = M[j][0] if M[i][1] > M[j][1]: menory = M[j][1] for j in range(i, -1, -1): try: if menorx < M[j][0] < M[i][0]: menorx = M[j][0] except: if menory < M[j][1] < M[i][1]: menory = M[j][1] try: if menory < M[j][1] < M[i][1]: menory = M[j][1] except: if menorx < M[j][0] < M[i][0]: menorx = M[j][0] areamenor = 0 try: areamenor += menorx * M[i][1] except: sla = 0 try: areamenor += menory * M[i][0] except: sla = 0 areaquad = M[i][0] * M[i][1] - areamenor else: areaquad = M[i][0] * M[i][1] areatotal += areaquad print(areatotal)
n = int(input()) m = [] for i in range(N): (x, y) = [int(x) for x in input().split()] M.append([x, y]) areatotal = 0 for i in range(N): if i != 0: for j in range(i, -1, -1): if M[i][0] > M[j][0]: menorx = M[j][0] if M[i][1] > M[j][1]: menory = M[j][1] for j in range(i, -1, -1): try: if menorx < M[j][0] < M[i][0]: menorx = M[j][0] except: if menory < M[j][1] < M[i][1]: menory = M[j][1] try: if menory < M[j][1] < M[i][1]: menory = M[j][1] except: if menorx < M[j][0] < M[i][0]: menorx = M[j][0] areamenor = 0 try: areamenor += menorx * M[i][1] except: sla = 0 try: areamenor += menory * M[i][0] except: sla = 0 areaquad = M[i][0] * M[i][1] - areamenor else: areaquad = M[i][0] * M[i][1] areatotal += areaquad print(areatotal)
def distance(s1, s2): d = 0 l1 = list(s1) l2 = list(s2) for i in range(len(l1)): if l2.count(l1[i]) == 0: d += 1 continue l2_index = l2.index(l1[i], i) l2_distance = l2_index - i if l2_distance > 0: l2.pop(l2_distance) d += l2_distance return d if __name__ == '__main__': print(distance('biting', 'sitting')) # 2
def distance(s1, s2): d = 0 l1 = list(s1) l2 = list(s2) for i in range(len(l1)): if l2.count(l1[i]) == 0: d += 1 continue l2_index = l2.index(l1[i], i) l2_distance = l2_index - i if l2_distance > 0: l2.pop(l2_distance) d += l2_distance return d if __name__ == '__main__': print(distance('biting', 'sitting'))
def main(): a = [1, 2, 3] print(a[0]) print(a[1]) print(a[2]) a.append(4) print(a[3]) a += [5, 6, 7] a = a + [8, 9, 10] print(a[4]) print(a[-1]) if __name__ == '__main__': main()
def main(): a = [1, 2, 3] print(a[0]) print(a[1]) print(a[2]) a.append(4) print(a[3]) a += [5, 6, 7] a = a + [8, 9, 10] print(a[4]) print(a[-1]) if __name__ == '__main__': main()
# set comprehension odd_number_set = { x for x in range(10) if x % 2 == 1 } # expected output: ''' {1, 3, 5, 7, 9} ''' print( odd_number_set )
odd_number_set = {x for x in range(10) if x % 2 == 1} '\n{1, 3, 5, 7, 9}\n' print(odd_number_set)
class Solution: def lengthOfLongestSubstring(self, s: str) -> int: longest = 0 longestSub = "" for char in s: if char not in longestSub: longestSub += char else: while char in longestSub: longestSub = longestSub[1:] longestSub += char if len(longestSub) > longest: longest = len(longestSub) return longest
class Solution: def length_of_longest_substring(self, s: str) -> int: longest = 0 longest_sub = '' for char in s: if char not in longestSub: longest_sub += char else: while char in longestSub: longest_sub = longestSub[1:] longest_sub += char if len(longestSub) > longest: longest = len(longestSub) return longest
n = int(input()) k_lst = [int(input()) for _ in range(n)] k_lst.sort(reverse=True) cnt = 1 for i in range(n-1): if k_lst[i] == k_lst[i+1]: continue if k_lst[i] > k_lst[i+1]: cnt += 1 print(cnt)
n = int(input()) k_lst = [int(input()) for _ in range(n)] k_lst.sort(reverse=True) cnt = 1 for i in range(n - 1): if k_lst[i] == k_lst[i + 1]: continue if k_lst[i] > k_lst[i + 1]: cnt += 1 print(cnt)
N = int(input()) A = {} for i in range(N): A[i] = [] for j in range(int(input())): A[i].append([int(n) for n in input().split()])
n = int(input()) a = {} for i in range(N): A[i] = [] for j in range(int(input())): A[i].append([int(n) for n in input().split()])
# -*- coding: utf-8 -*- # Digital Ocean api urls ACCOUNT_INFO = 'account/' ACTION_LIST = 'actions/' DOMAIN_LIST = 'domains/' DROPLETS = 'droplets/' IMAGES = 'images/' KEYS = 'account/keys/' REGIONS = 'regions/' SIZES = 'sizes/'
account_info = 'account/' action_list = 'actions/' domain_list = 'domains/' droplets = 'droplets/' images = 'images/' keys = 'account/keys/' regions = 'regions/' sizes = 'sizes/'
class MissingUserDatabaseURLError(Exception): def __init__(self): self.message = 'Users database URL is not provided' super().__init__(self.message)
class Missinguserdatabaseurlerror(Exception): def __init__(self): self.message = 'Users database URL is not provided' super().__init__(self.message)
# -*- coding: utf-8 -*- __author__ = 'Aaron Bassett' __email__ = 'engineering@getadministrate.com' __version__ = '0.14.0'
__author__ = 'Aaron Bassett' __email__ = 'engineering@getadministrate.com' __version__ = '0.14.0'
# Copyright 2016 Srinivas Venkattaramanujam (author: Srinivas Venkattaramanujam) # Licensed under the Apache License, Version 2.0 (the "License") # Until we have a config file class Config: TRAIN_FEATS = '/speech1/DIT_PROJ/srini/TIMIT/s5/working_dir/train_90/feats.scp' TRAIN_ALIGNMENTS = '/speech1/DIT_PROJ/srini/TIMIT/s5/working_dir/labels/train/ali_tr.scp' CV_FEATS = '/speech1/DIT_PROJ/srini/TIMIT/s5/working_dir/cv_10/feats.scp' CV_ALIGNMENTS = '/speech1/DIT_PROJ/srini/TIMIT/s5/working_dir/labels/train/ali_cv.scp' TEST_FEATS = '/speech1/DIT_PROJ/srini/TIMIT/s5/working_dir/test/feats.scp'
class Config: train_feats = '/speech1/DIT_PROJ/srini/TIMIT/s5/working_dir/train_90/feats.scp' train_alignments = '/speech1/DIT_PROJ/srini/TIMIT/s5/working_dir/labels/train/ali_tr.scp' cv_feats = '/speech1/DIT_PROJ/srini/TIMIT/s5/working_dir/cv_10/feats.scp' cv_alignments = '/speech1/DIT_PROJ/srini/TIMIT/s5/working_dir/labels/train/ali_cv.scp' test_feats = '/speech1/DIT_PROJ/srini/TIMIT/s5/working_dir/test/feats.scp'
#! /root/anaconda3/bin/python t = (1, 2, 3, 4, 5) del t try: print(t) except NameError: print(NameError)
t = (1, 2, 3, 4, 5) del t try: print(t) except NameError: print(NameError)
# -*- coding:utf-8 -*- ''' @Author: yanwii @Date: 2018-08-16 15:18:52 ''' class BatchManager(object): def __init__(self, batch_size=1): self.batch_size = batch_size self.data = [] self.batch_data = [] self.head_vocab = {"unk":0} self.tail_vocab = {"unk":0} self.relation_vocab = {"unk":0} self.load_data() self.prepare_batch() def add_vocab(self, word, vocab={}): if word not in vocab: vocab[word] = len(vocab.keys()) return vocab[word] def load_data(self): with open("data/train") as fopen: lines = fopen.readlines() for line in lines: head, tail, relation = line.strip().split(",") h_v = self.add_vocab(head, self.head_vocab) t_v = self.add_vocab(tail, self.tail_vocab) r_v = self.add_vocab(relation, self.relation_vocab) self.data.append([[h_v], [t_v], [r_v]]) self.head_vocab_size = len(self.head_vocab) + 1 self.tail_vocab_size = len(self.tail_vocab) + 1 self.relation_vocab_size = len(self.relation_vocab) + 1 def prepare_batch(self): index = 0 while True: if index + self.batch_size >= len(self.data): data = self.data[-self.batch_size:] self.batch_data.append(data) break else: data = self.data[index:index+self.batch_size] index += self.batch_size self.batch_data.append(data) def iteration(self): idx = 0 while True: yield self.batch_data[idx] idx += 1 if idx > len(self.batch_data)-1: idx = 0 def get_batch(self): for data in self.batch_data: yield data
""" @Author: yanwii @Date: 2018-08-16 15:18:52 """ class Batchmanager(object): def __init__(self, batch_size=1): self.batch_size = batch_size self.data = [] self.batch_data = [] self.head_vocab = {'unk': 0} self.tail_vocab = {'unk': 0} self.relation_vocab = {'unk': 0} self.load_data() self.prepare_batch() def add_vocab(self, word, vocab={}): if word not in vocab: vocab[word] = len(vocab.keys()) return vocab[word] def load_data(self): with open('data/train') as fopen: lines = fopen.readlines() for line in lines: (head, tail, relation) = line.strip().split(',') h_v = self.add_vocab(head, self.head_vocab) t_v = self.add_vocab(tail, self.tail_vocab) r_v = self.add_vocab(relation, self.relation_vocab) self.data.append([[h_v], [t_v], [r_v]]) self.head_vocab_size = len(self.head_vocab) + 1 self.tail_vocab_size = len(self.tail_vocab) + 1 self.relation_vocab_size = len(self.relation_vocab) + 1 def prepare_batch(self): index = 0 while True: if index + self.batch_size >= len(self.data): data = self.data[-self.batch_size:] self.batch_data.append(data) break else: data = self.data[index:index + self.batch_size] index += self.batch_size self.batch_data.append(data) def iteration(self): idx = 0 while True: yield self.batch_data[idx] idx += 1 if idx > len(self.batch_data) - 1: idx = 0 def get_batch(self): for data in self.batch_data: yield data
def parse(d): return ( ([frozenset(c) for c in g.split()] for g in l.split("|")) for l in d.split("\n") ) def aoc(data): return sum(len(d) in (2, 3, 4, 7) for _, b in parse(data) for d in b)
def parse(d): return (([frozenset(c) for c in g.split()] for g in l.split('|')) for l in d.split('\n')) def aoc(data): return sum((len(d) in (2, 3, 4, 7) for (_, b) in parse(data) for d in b))
# AND : both need to be TRUE # has_high_income = True # has_good_credit = False # if has_high_income and has_good_credit: # print('Eligible for loan') # OR : at least one needs to be TRUE has_high_income = False has_good_credit = True if has_high_income or has_good_credit: print('Eligible for loan') # NOT : has_good_credit = True has_criminal_record = False if has_good_credit and not has_criminal_record: print('Eligible for loan!') # EXAMPLE weight = input('What is your weight? ') weight_type = input('(L)bs or (K)g ') if weight_type.upper() == 'L': converted_weight = int(weight) * .45 print(f'Your {weight}lbs equals {converted_weight} kilos.') if weight_type.upper() == 'K': converted_weight = int(weight) / .45 print(f'Your {weight}kg equals {converted_weight} pounds.')
has_high_income = False has_good_credit = True if has_high_income or has_good_credit: print('Eligible for loan') has_good_credit = True has_criminal_record = False if has_good_credit and (not has_criminal_record): print('Eligible for loan!') weight = input('What is your weight? ') weight_type = input('(L)bs or (K)g ') if weight_type.upper() == 'L': converted_weight = int(weight) * 0.45 print(f'Your {weight}lbs equals {converted_weight} kilos.') if weight_type.upper() == 'K': converted_weight = int(weight) / 0.45 print(f'Your {weight}kg equals {converted_weight} pounds.')
class Presenter: def __init__(self): pass @staticmethod def date_slashes_as_dashes(date_str): if date_str.find("/") == -1: return date_str else: mdy = date_str.split("/") return mdy[2] + "-" + mdy[0] + "-" + mdy[1] @staticmethod def value_without_symbols(value_str): return value_str.replace("$", "").replace(",", "").replace(")", "").replace("(", "-") @staticmethod def decimal_as_percentage(percent_fraction): return str(round(100 * percent_fraction, 1)) + "%"
class Presenter: def __init__(self): pass @staticmethod def date_slashes_as_dashes(date_str): if date_str.find('/') == -1: return date_str else: mdy = date_str.split('/') return mdy[2] + '-' + mdy[0] + '-' + mdy[1] @staticmethod def value_without_symbols(value_str): return value_str.replace('$', '').replace(',', '').replace(')', '').replace('(', '-') @staticmethod def decimal_as_percentage(percent_fraction): return str(round(100 * percent_fraction, 1)) + '%'
# see: numpy.core.overrides def set_module(module): def decorator(func): if module is not None: func.__module__ = module return func return decorator
def set_module(module): def decorator(func): if module is not None: func.__module__ = module return func return decorator
# # PySNMP MIB module Unisphere-Data-DS3-CONF (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Unisphere-Data-DS3-CONF # Produced by pysmi-0.3.4 at Mon Apr 29 21:23:40 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") ConstraintsUnion, ValueRangeConstraint, ConstraintsIntersection, ValueSizeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueRangeConstraint", "ConstraintsIntersection", "ValueSizeConstraint", "SingleValueConstraint") dsx3FarEndConfigEntry, dsx3TotalEntry, dsx3FarEndCurrentEntry, dsx3SendCode, dsx3IntervalEntry, dsx3CurrentEntry, dsx3ConfigEntry, dsx3FracEntry, dsx3FarEndTotalEntry, dsx3FarEndIntervalEntry = mibBuilder.importSymbols("RFC1407-MIB", "dsx3FarEndConfigEntry", "dsx3TotalEntry", "dsx3FarEndCurrentEntry", "dsx3SendCode", "dsx3IntervalEntry", "dsx3CurrentEntry", "dsx3ConfigEntry", "dsx3FracEntry", "dsx3FarEndTotalEntry", "dsx3FarEndIntervalEntry") NotificationGroup, AgentCapabilities, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "AgentCapabilities", "ModuleCompliance") iso, ObjectIdentity, Gauge32, Counter32, Unsigned32, IpAddress, Bits, Integer32, ModuleIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter64, MibIdentifier, TimeTicks, NotificationType = mibBuilder.importSymbols("SNMPv2-SMI", "iso", "ObjectIdentity", "Gauge32", "Counter32", "Unsigned32", "IpAddress", "Bits", "Integer32", "ModuleIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter64", "MibIdentifier", "TimeTicks", "NotificationType") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") usDataAgents, = mibBuilder.importSymbols("Unisphere-Data-Agents", "usDataAgents") usdDs3Group2, usdDs3Group, usdDs3Group4, usdDs3FarEndGroup, usdDs3Group5, usdDs3Group3 = mibBuilder.importSymbols("Unisphere-Data-DS3-MIB", "usdDs3Group2", "usdDs3Group", "usdDs3Group4", "usdDs3FarEndGroup", "usdDs3Group5", "usdDs3Group3") usdDs3Agent = ModuleIdentity((1, 3, 6, 1, 4, 1, 4874, 5, 2, 11)) usdDs3Agent.setRevisions(('2002-08-27 18:48', '2001-04-18 19:41',)) if mibBuilder.loadTexts: usdDs3Agent.setLastUpdated('200208271848Z') if mibBuilder.loadTexts: usdDs3Agent.setOrganization('Unisphere Networks, Inc.') usdDs3AgentV1 = AgentCapabilities((1, 3, 6, 1, 4, 1, 4874, 5, 2, 11, 1)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usdDs3AgentV1 = usdDs3AgentV1.setProductRelease('Version 1 of the DS3 component of the Unisphere Routing Switch SNMP\n agent. This version of the DS3 component was supported in the Unisphere\n RX 1.0 system release.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usdDs3AgentV1 = usdDs3AgentV1.setStatus('obsolete') usdDs3AgentV2 = AgentCapabilities((1, 3, 6, 1, 4, 1, 4874, 5, 2, 11, 2)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usdDs3AgentV2 = usdDs3AgentV2.setProductRelease('Version 2 of the DS3 component of the Unisphere Routing Switch SNMP\n agent. This version of the DS3 component was supported in the Unisphere\n RX 1.1 thru RX 2.5 system releases.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usdDs3AgentV2 = usdDs3AgentV2.setStatus('obsolete') usdDs3AgentV3 = AgentCapabilities((1, 3, 6, 1, 4, 1, 4874, 5, 2, 11, 3)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usdDs3AgentV3 = usdDs3AgentV3.setProductRelease('Version 3 of the DS3 component of the Unisphere Routing Switch SNMP\n agent. This version of the DS3 component was supported in the Unisphere\n RX 2.6 thru RX 2.9 system releases.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usdDs3AgentV3 = usdDs3AgentV3.setStatus('obsolete') usdDs3AgentV4 = AgentCapabilities((1, 3, 6, 1, 4, 1, 4874, 5, 2, 11, 4)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usdDs3AgentV4 = usdDs3AgentV4.setProductRelease('Version 4 of the DS3 component of the Unisphere Routing Switch SNMP\n agent. This version of the DS3 component was supported in the Unisphere\n RX 3.x system releases.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usdDs3AgentV4 = usdDs3AgentV4.setStatus('obsolete') usdDs3AgentV5 = AgentCapabilities((1, 3, 6, 1, 4, 1, 4874, 5, 2, 11, 5)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usdDs3AgentV5 = usdDs3AgentV5.setProductRelease('Version 5 of the DS3 component of the Unisphere Routing Switch SNMP\n agent. This version of the DS3 component is supported in the Unisphere\n RX 4.0 and subsequent system releases.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usdDs3AgentV5 = usdDs3AgentV5.setStatus('current') mibBuilder.exportSymbols("Unisphere-Data-DS3-CONF", PYSNMP_MODULE_ID=usdDs3Agent, usdDs3AgentV4=usdDs3AgentV4, usdDs3AgentV3=usdDs3AgentV3, usdDs3Agent=usdDs3Agent, usdDs3AgentV2=usdDs3AgentV2, usdDs3AgentV5=usdDs3AgentV5, usdDs3AgentV1=usdDs3AgentV1)
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_range_constraint, constraints_intersection, value_size_constraint, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'ValueRangeConstraint', 'ConstraintsIntersection', 'ValueSizeConstraint', 'SingleValueConstraint') (dsx3_far_end_config_entry, dsx3_total_entry, dsx3_far_end_current_entry, dsx3_send_code, dsx3_interval_entry, dsx3_current_entry, dsx3_config_entry, dsx3_frac_entry, dsx3_far_end_total_entry, dsx3_far_end_interval_entry) = mibBuilder.importSymbols('RFC1407-MIB', 'dsx3FarEndConfigEntry', 'dsx3TotalEntry', 'dsx3FarEndCurrentEntry', 'dsx3SendCode', 'dsx3IntervalEntry', 'dsx3CurrentEntry', 'dsx3ConfigEntry', 'dsx3FracEntry', 'dsx3FarEndTotalEntry', 'dsx3FarEndIntervalEntry') (notification_group, agent_capabilities, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'AgentCapabilities', 'ModuleCompliance') (iso, object_identity, gauge32, counter32, unsigned32, ip_address, bits, integer32, module_identity, mib_scalar, mib_table, mib_table_row, mib_table_column, counter64, mib_identifier, time_ticks, notification_type) = mibBuilder.importSymbols('SNMPv2-SMI', 'iso', 'ObjectIdentity', 'Gauge32', 'Counter32', 'Unsigned32', 'IpAddress', 'Bits', 'Integer32', 'ModuleIdentity', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Counter64', 'MibIdentifier', 'TimeTicks', 'NotificationType') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') (us_data_agents,) = mibBuilder.importSymbols('Unisphere-Data-Agents', 'usDataAgents') (usd_ds3_group2, usd_ds3_group, usd_ds3_group4, usd_ds3_far_end_group, usd_ds3_group5, usd_ds3_group3) = mibBuilder.importSymbols('Unisphere-Data-DS3-MIB', 'usdDs3Group2', 'usdDs3Group', 'usdDs3Group4', 'usdDs3FarEndGroup', 'usdDs3Group5', 'usdDs3Group3') usd_ds3_agent = module_identity((1, 3, 6, 1, 4, 1, 4874, 5, 2, 11)) usdDs3Agent.setRevisions(('2002-08-27 18:48', '2001-04-18 19:41')) if mibBuilder.loadTexts: usdDs3Agent.setLastUpdated('200208271848Z') if mibBuilder.loadTexts: usdDs3Agent.setOrganization('Unisphere Networks, Inc.') usd_ds3_agent_v1 = agent_capabilities((1, 3, 6, 1, 4, 1, 4874, 5, 2, 11, 1)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usd_ds3_agent_v1 = usdDs3AgentV1.setProductRelease('Version 1 of the DS3 component of the Unisphere Routing Switch SNMP\n agent. This version of the DS3 component was supported in the Unisphere\n RX 1.0 system release.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usd_ds3_agent_v1 = usdDs3AgentV1.setStatus('obsolete') usd_ds3_agent_v2 = agent_capabilities((1, 3, 6, 1, 4, 1, 4874, 5, 2, 11, 2)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usd_ds3_agent_v2 = usdDs3AgentV2.setProductRelease('Version 2 of the DS3 component of the Unisphere Routing Switch SNMP\n agent. This version of the DS3 component was supported in the Unisphere\n RX 1.1 thru RX 2.5 system releases.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usd_ds3_agent_v2 = usdDs3AgentV2.setStatus('obsolete') usd_ds3_agent_v3 = agent_capabilities((1, 3, 6, 1, 4, 1, 4874, 5, 2, 11, 3)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usd_ds3_agent_v3 = usdDs3AgentV3.setProductRelease('Version 3 of the DS3 component of the Unisphere Routing Switch SNMP\n agent. This version of the DS3 component was supported in the Unisphere\n RX 2.6 thru RX 2.9 system releases.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usd_ds3_agent_v3 = usdDs3AgentV3.setStatus('obsolete') usd_ds3_agent_v4 = agent_capabilities((1, 3, 6, 1, 4, 1, 4874, 5, 2, 11, 4)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usd_ds3_agent_v4 = usdDs3AgentV4.setProductRelease('Version 4 of the DS3 component of the Unisphere Routing Switch SNMP\n agent. This version of the DS3 component was supported in the Unisphere\n RX 3.x system releases.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usd_ds3_agent_v4 = usdDs3AgentV4.setStatus('obsolete') usd_ds3_agent_v5 = agent_capabilities((1, 3, 6, 1, 4, 1, 4874, 5, 2, 11, 5)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usd_ds3_agent_v5 = usdDs3AgentV5.setProductRelease('Version 5 of the DS3 component of the Unisphere Routing Switch SNMP\n agent. This version of the DS3 component is supported in the Unisphere\n RX 4.0 and subsequent system releases.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): usd_ds3_agent_v5 = usdDs3AgentV5.setStatus('current') mibBuilder.exportSymbols('Unisphere-Data-DS3-CONF', PYSNMP_MODULE_ID=usdDs3Agent, usdDs3AgentV4=usdDs3AgentV4, usdDs3AgentV3=usdDs3AgentV3, usdDs3Agent=usdDs3Agent, usdDs3AgentV2=usdDs3AgentV2, usdDs3AgentV5=usdDs3AgentV5, usdDs3AgentV1=usdDs3AgentV1)
while True: try: a = ord(input()[:1]) except EOFError: break b = ord(input()[:1]) print((b-a+26) % 26)
while True: try: a = ord(input()[:1]) except EOFError: break b = ord(input()[:1]) print((b - a + 26) % 26)
# program to count the numbers of occurrences of characters in the given string and store them in a dictionary string = input("Enter a string: ") d = {} for i in string: if i not in d.keys(): d[i] = 1 else: d[i] += 1 print(d)
string = input('Enter a string: ') d = {} for i in string: if i not in d.keys(): d[i] = 1 else: d[i] += 1 print(d)
class Config(object): ''' Each environment will be a class that inherits from the main class config Configurations that will be the same across all environment will go into config, while configuration that are specific to an environment will go into the relevant environment below ''' SECRET_KEY = "My$uper$ecretKey4Now" SERVER_TIME_ZONE = "Africa/Johannesburg" DEFAULT_DATETIME_FORMAT = "%Y-%m-%d %H:%M:%S" class Production(Config): FLASK_ENV = 'production' PRODUCTION = True class Testing(Config): FLASK_ENV = 'testing' TESTING = True class Development(Config): FLASK_ENV = 'development' DEBUG = True
class Config(object): """ Each environment will be a class that inherits from the main class config Configurations that will be the same across all environment will go into config, while configuration that are specific to an environment will go into the relevant environment below """ secret_key = 'My$uper$ecretKey4Now' server_time_zone = 'Africa/Johannesburg' default_datetime_format = '%Y-%m-%d %H:%M:%S' class Production(Config): flask_env = 'production' production = True class Testing(Config): flask_env = 'testing' testing = True class Development(Config): flask_env = 'development' debug = True
collected_data = { "form_id": "2", "name": "Test", "client_id": "11", "form_element_templates": [ {"name": "Full name", "value": "john doe"}, {"name": "Gender", "value": "male"}, {"name": "Country", "value": "morocco"}, ], } form_element_field = { "id": "2", "name": "test", "form_element_fields": [ { "id": "101", "form_element_template_id": "7", "form_id": "2", "form_element_template": { "id": "7", "name": "Gender", "form_element_type_id": "19", "form_element_type": { "id": "19", "name": "checkbox", }, "form_element_list_values": [ { "id": "12", "form_element_template_id": "7", "filled_form_id": "null", "value": "male", }, { "id": "13", "form_element_template_id": "7", "filled_form_id": "null", "value": "female", }, ], }, }, { "id": "102", "form_element_template_id": "8", "form_id": "2", "form_element_template": { "id": "8", "name": "Full name", "form_element_type_id": "20", "form_element_type": { "id": "20", "name": "text", "form_element_template_id": "8", }, "form_element_list_values": [], }, }, ], } filled_form_for_update = [ { "id": "87", "form_element_template_id": "7", "client_id": "11", "value": "null", "selected_list_values": [ { "id": "300", "form_element_list_values_id": "12", "filled_form_id": "87", "form_element_list_value": { "id": "12", "form_element_template_id": "7", "value": "male", }, } ], "form_element_template": { "id": "7", "name": "Gender", "form_element_type_id": "19", "form_element_type": { "id": "19", "name": "checkbox", }, "form_element_list_values": [ { "id": "12", "form_element_template_id": "7", "filled_form_id": "null", "value": "male", }, { "id": "13", "form_element_template_id": "7", "filled_form_id": "null", "value": "female", }, ], }, }, { "id": "82", "form_element_template_id": "8", "client_id": "11", "value": "jone doe", "selected_list_values": [], "form_element_template": { "id": "8", "name": "Full name", "form_element_type_id": "20", "form_element_type": { "id": "20", "name": "text", }, "form_element_list_values": [], }, }, ]
collected_data = {'form_id': '2', 'name': 'Test', 'client_id': '11', 'form_element_templates': [{'name': 'Full name', 'value': 'john doe'}, {'name': 'Gender', 'value': 'male'}, {'name': 'Country', 'value': 'morocco'}]} form_element_field = {'id': '2', 'name': 'test', 'form_element_fields': [{'id': '101', 'form_element_template_id': '7', 'form_id': '2', 'form_element_template': {'id': '7', 'name': 'Gender', 'form_element_type_id': '19', 'form_element_type': {'id': '19', 'name': 'checkbox'}, 'form_element_list_values': [{'id': '12', 'form_element_template_id': '7', 'filled_form_id': 'null', 'value': 'male'}, {'id': '13', 'form_element_template_id': '7', 'filled_form_id': 'null', 'value': 'female'}]}}, {'id': '102', 'form_element_template_id': '8', 'form_id': '2', 'form_element_template': {'id': '8', 'name': 'Full name', 'form_element_type_id': '20', 'form_element_type': {'id': '20', 'name': 'text', 'form_element_template_id': '8'}, 'form_element_list_values': []}}]} filled_form_for_update = [{'id': '87', 'form_element_template_id': '7', 'client_id': '11', 'value': 'null', 'selected_list_values': [{'id': '300', 'form_element_list_values_id': '12', 'filled_form_id': '87', 'form_element_list_value': {'id': '12', 'form_element_template_id': '7', 'value': 'male'}}], 'form_element_template': {'id': '7', 'name': 'Gender', 'form_element_type_id': '19', 'form_element_type': {'id': '19', 'name': 'checkbox'}, 'form_element_list_values': [{'id': '12', 'form_element_template_id': '7', 'filled_form_id': 'null', 'value': 'male'}, {'id': '13', 'form_element_template_id': '7', 'filled_form_id': 'null', 'value': 'female'}]}}, {'id': '82', 'form_element_template_id': '8', 'client_id': '11', 'value': 'jone doe', 'selected_list_values': [], 'form_element_template': {'id': '8', 'name': 'Full name', 'form_element_type_id': '20', 'form_element_type': {'id': '20', 'name': 'text'}, 'form_element_list_values': []}}]
#!/usr/bin pypy3 # ------------------------ Simplest form of learning ------------------------ weight = .5 input = .5 target = .8 step_amount = .001 # <= How much to move weights each iteration for iteration in range(1101) : # <= repeat the learning many times so that # error can keep getting smaller prediction = input * weight error = (prediction - target) ** 2 print(f"Error: {round(error, 3)} prediction: {round(prediction, 3)}") # Try up up_prediction = input * (weight + step_amount) up_error = (target - up_prediction) ** 2 # Try down down_prediction = input * (weight - step_amount) down_error = (target - down_prediction) ** 2 if (down_error < up_error) : weight = weight - step_amount if (down_error > up_error) : weight += step_amount # $ pypy3 error-update-advance.py # Error: 0.301 Prediction:0.25 # Error: 0.301 Prediction:0.250 # ........................... # Error: 0.0 prediction: 0.798 # Error: 0.0 prediction: 0.799 # Error: 0.0 prediction: 0.799 # Error: 0.0 prediction: 0.8
weight = 0.5 input = 0.5 target = 0.8 step_amount = 0.001 for iteration in range(1101): prediction = input * weight error = (prediction - target) ** 2 print(f'Error: {round(error, 3)} prediction: {round(prediction, 3)}') up_prediction = input * (weight + step_amount) up_error = (target - up_prediction) ** 2 down_prediction = input * (weight - step_amount) down_error = (target - down_prediction) ** 2 if down_error < up_error: weight = weight - step_amount if down_error > up_error: weight += step_amount
# AWS GENERAL SETTINGS: AWS_REGION = "us-east-1" AWS_PROFILE = "default" # The same profile used by your AWS CLI installation SSH_KEY_NAME = "key.pem" # Expected to be in ~/.ssh AWS_BUCKET = "dummybucket" # EC2 AND ECS INFORMATION: ECS_CLUSTER = "default_cluster" # SQS QUEUE INFORMATION: SQS_DEAD_LETTER_QUEUE = "arn:aws:sqs:us-east-1:XXXXXXXXXXXX:DeadMessages" # SNS INFORMATION: MONITOR_SNS = "arn:aws:sns:us-east-1:XXXXXXXXXXXX:Monitor"
aws_region = 'us-east-1' aws_profile = 'default' ssh_key_name = 'key.pem' aws_bucket = 'dummybucket' ecs_cluster = 'default_cluster' sqs_dead_letter_queue = 'arn:aws:sqs:us-east-1:XXXXXXXXXXXX:DeadMessages' monitor_sns = 'arn:aws:sns:us-east-1:XXXXXXXXXXXX:Monitor'
inp = open('input_d18.txt').read() xl = len(inp)-1 yl = 400000 tiles = [[False for _ in range(xl)] for _ in range(yl)] # True if trap def get_tile(x,y): if x < 0 or x >= xl or y < 0 or y >= yl: return False return tiles[y][x] def is_trap(x,y): left,center,right = get_tile(x-1,y-1),get_tile(x,y-1),get_tile(x+1,y-1) if left and center and not right: return True if center and right and not left: return True if left and not right and not center: return True if right and not left and not center: return True return False count = 0 for x in range(xl): tiles[0][x] = (True if inp[x] == '^' else False) if inp[x] == '.': count += 1 for y in range(1,yl): for x in range(xl): tiles[y][x] = is_trap(x,y) if not tiles[y][x]: count += 1 # for y in range(yl): # for x in range(xl): # if not tiles[y][x]: # count += 1 print(count)
inp = open('input_d18.txt').read() xl = len(inp) - 1 yl = 400000 tiles = [[False for _ in range(xl)] for _ in range(yl)] def get_tile(x, y): if x < 0 or x >= xl or y < 0 or (y >= yl): return False return tiles[y][x] def is_trap(x, y): (left, center, right) = (get_tile(x - 1, y - 1), get_tile(x, y - 1), get_tile(x + 1, y - 1)) if left and center and (not right): return True if center and right and (not left): return True if left and (not right) and (not center): return True if right and (not left) and (not center): return True return False count = 0 for x in range(xl): tiles[0][x] = True if inp[x] == '^' else False if inp[x] == '.': count += 1 for y in range(1, yl): for x in range(xl): tiles[y][x] = is_trap(x, y) if not tiles[y][x]: count += 1 print(count)
# # PySNMP MIB module MERU-CONFIG-STATICSTATION-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MERU-CONFIG-STATICSTATION-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:01:15 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, ConstraintsUnion, ConstraintsIntersection, ValueRangeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsUnion", "ConstraintsIntersection", "ValueRangeConstraint", "SingleValueConstraint") Ipv6Address, = mibBuilder.importSymbols("IPV6-TC", "Ipv6Address") mwConfiguration, = mibBuilder.importSymbols("MERU-SMI", "mwConfiguration") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") MibIdentifier, enterprises, TimeTicks, Integer32, ModuleIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, IpAddress, Counter64, Counter32, ObjectIdentity, iso, Bits, Gauge32, Unsigned32, NotificationType = mibBuilder.importSymbols("SNMPv2-SMI", "MibIdentifier", "enterprises", "TimeTicks", "Integer32", "ModuleIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "IpAddress", "Counter64", "Counter32", "ObjectIdentity", "iso", "Bits", "Gauge32", "Unsigned32", "NotificationType") TimeStamp, TextualConvention, TruthValue, DateAndTime, RowStatus, MacAddress, TimeInterval, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TimeStamp", "TextualConvention", "TruthValue", "DateAndTime", "RowStatus", "MacAddress", "TimeInterval", "DisplayString") mwConfigStaticStation = ModuleIdentity((1, 3, 6, 1, 4, 1, 15983, 1, 1, 4, 16)) if mibBuilder.loadTexts: mwConfigStaticStation.setLastUpdated('200506050000Z') if mibBuilder.loadTexts: mwConfigStaticStation.setOrganization('Meru Networks') mwStaticStationTable = MibTable((1, 3, 6, 1, 4, 1, 15983, 1, 1, 4, 16, 1), ) if mibBuilder.loadTexts: mwStaticStationTable.setStatus('current') mwStaticStationEntry = MibTableRow((1, 3, 6, 1, 4, 1, 15983, 1, 1, 4, 16, 1, 1), ).setIndexNames((0, "MERU-CONFIG-STATICSTATION-MIB", "mwStaticStationTableIndex")) if mibBuilder.loadTexts: mwStaticStationEntry.setStatus('current') mwStaticStationTableIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 15983, 1, 1, 4, 16, 1, 1, 1), Integer32()) if mibBuilder.loadTexts: mwStaticStationTableIndex.setStatus('current') mwStaticStationIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 15983, 1, 1, 4, 16, 1, 1, 2), IpAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: mwStaticStationIpAddress.setStatus('current') mwStaticStationMacAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 15983, 1, 1, 4, 16, 1, 1, 3), MacAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: mwStaticStationMacAddress.setStatus('current') mwStaticStationRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 15983, 1, 1, 4, 16, 1, 1, 4), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: mwStaticStationRowStatus.setStatus('current') mibBuilder.exportSymbols("MERU-CONFIG-STATICSTATION-MIB", mwStaticStationEntry=mwStaticStationEntry, mwStaticStationTableIndex=mwStaticStationTableIndex, mwStaticStationRowStatus=mwStaticStationRowStatus, mwConfigStaticStation=mwConfigStaticStation, mwStaticStationMacAddress=mwStaticStationMacAddress, PYSNMP_MODULE_ID=mwConfigStaticStation, mwStaticStationTable=mwStaticStationTable, mwStaticStationIpAddress=mwStaticStationIpAddress)
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_union, constraints_intersection, value_range_constraint, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueSizeConstraint', 'ConstraintsUnion', 'ConstraintsIntersection', 'ValueRangeConstraint', 'SingleValueConstraint') (ipv6_address,) = mibBuilder.importSymbols('IPV6-TC', 'Ipv6Address') (mw_configuration,) = mibBuilder.importSymbols('MERU-SMI', 'mwConfiguration') (module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup') (mib_identifier, enterprises, time_ticks, integer32, module_identity, mib_scalar, mib_table, mib_table_row, mib_table_column, ip_address, counter64, counter32, object_identity, iso, bits, gauge32, unsigned32, notification_type) = mibBuilder.importSymbols('SNMPv2-SMI', 'MibIdentifier', 'enterprises', 'TimeTicks', 'Integer32', 'ModuleIdentity', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'IpAddress', 'Counter64', 'Counter32', 'ObjectIdentity', 'iso', 'Bits', 'Gauge32', 'Unsigned32', 'NotificationType') (time_stamp, textual_convention, truth_value, date_and_time, row_status, mac_address, time_interval, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TimeStamp', 'TextualConvention', 'TruthValue', 'DateAndTime', 'RowStatus', 'MacAddress', 'TimeInterval', 'DisplayString') mw_config_static_station = module_identity((1, 3, 6, 1, 4, 1, 15983, 1, 1, 4, 16)) if mibBuilder.loadTexts: mwConfigStaticStation.setLastUpdated('200506050000Z') if mibBuilder.loadTexts: mwConfigStaticStation.setOrganization('Meru Networks') mw_static_station_table = mib_table((1, 3, 6, 1, 4, 1, 15983, 1, 1, 4, 16, 1)) if mibBuilder.loadTexts: mwStaticStationTable.setStatus('current') mw_static_station_entry = mib_table_row((1, 3, 6, 1, 4, 1, 15983, 1, 1, 4, 16, 1, 1)).setIndexNames((0, 'MERU-CONFIG-STATICSTATION-MIB', 'mwStaticStationTableIndex')) if mibBuilder.loadTexts: mwStaticStationEntry.setStatus('current') mw_static_station_table_index = mib_table_column((1, 3, 6, 1, 4, 1, 15983, 1, 1, 4, 16, 1, 1, 1), integer32()) if mibBuilder.loadTexts: mwStaticStationTableIndex.setStatus('current') mw_static_station_ip_address = mib_table_column((1, 3, 6, 1, 4, 1, 15983, 1, 1, 4, 16, 1, 1, 2), ip_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: mwStaticStationIpAddress.setStatus('current') mw_static_station_mac_address = mib_table_column((1, 3, 6, 1, 4, 1, 15983, 1, 1, 4, 16, 1, 1, 3), mac_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: mwStaticStationMacAddress.setStatus('current') mw_static_station_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 15983, 1, 1, 4, 16, 1, 1, 4), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: mwStaticStationRowStatus.setStatus('current') mibBuilder.exportSymbols('MERU-CONFIG-STATICSTATION-MIB', mwStaticStationEntry=mwStaticStationEntry, mwStaticStationTableIndex=mwStaticStationTableIndex, mwStaticStationRowStatus=mwStaticStationRowStatus, mwConfigStaticStation=mwConfigStaticStation, mwStaticStationMacAddress=mwStaticStationMacAddress, PYSNMP_MODULE_ID=mwConfigStaticStation, mwStaticStationTable=mwStaticStationTable, mwStaticStationIpAddress=mwStaticStationIpAddress)
def f8(n): m = n sum = 0 while m!=0: x = m%10 sum = sum + x**3 m = m//10 if sum == n: print(n, " is an Armstrong number") else: print(n, " is not an Armstrong number") f8(153) f8(125)
def f8(n): m = n sum = 0 while m != 0: x = m % 10 sum = sum + x ** 3 m = m // 10 if sum == n: print(n, ' is an Armstrong number') else: print(n, ' is not an Armstrong number') f8(153) f8(125)
# Define the number of memory threads MEMORY_THREAD_NUM = 4 # Define the number of ebs threads EBS_THREAD_NUM = 4 # Define the number of proxy worker threads PROXY_THREAD_NUM = 4 # Number of tiers MIN_TIER = 1 MAX_TIER = 2 # Define port offset SERVER_PORT = 6560 NODE_JOIN_BASE_PORT = 6660 NODE_DEPART_BASE_PORT = 6760 SELF_DEPART_BASE_PORT = 6860 REPLICATION_FACTOR_BASE_PORT = 6960 REQUEST_PULLING_BASE_PORT = 6460 GOSSIP_BASE_PORT = 7060 REPLICATION_FACTOR_CHANGE_BASE_PORT = 7160 # used by proxies SEED_BASE_PORT = 6560 NOTIFY_BASE_PORT = 6660 KEY_ADDRESS_BASE_PORT = 6760 # used by monitoring nodes DEPART_DONE_BASE_PORT = 6760 LATENCY_REPORT_BASE_PORT = 6860 # used by benchmark threads COMMAND_BASE_PORT = 6560 class Thread(): def __init__(self, ip, tid): self.ip = ip self.tid = tid self._base = 'tcp://*:' self._ip_base = 'tcp://' + self.ip + ':' def get_ip(self): return self.ip def get_tid(self): return self.tid class UserThread(Thread): def get_request_pull_connect_addr(self): return self._ip_base + str(self.tid + REQUEST_PULLING_BASE_PORT) def get_request_pull_bind_addr(self): return self._base + str(self.tid + REQUEST_PULLING_BASE_PORT) def get_key_address_connect_addr(self): return self._ip_base + str(self.tid + KEY_ADDRESS_BASE_PORT) def get_key_address_bind_addr(self): return self._base + str(self.tid + KEY_ADDRESS_BASE_PORT) class ProxyThread(Thread): def get_key_address_connect_addr(self): return self._ip_base + str(self.tid + KEY_ADDRESS_BASE_PORT) def key_address_bind_addr(self): return self._base + str(self.tid + KEY_ADDRESS_BASE_PORT)
memory_thread_num = 4 ebs_thread_num = 4 proxy_thread_num = 4 min_tier = 1 max_tier = 2 server_port = 6560 node_join_base_port = 6660 node_depart_base_port = 6760 self_depart_base_port = 6860 replication_factor_base_port = 6960 request_pulling_base_port = 6460 gossip_base_port = 7060 replication_factor_change_base_port = 7160 seed_base_port = 6560 notify_base_port = 6660 key_address_base_port = 6760 depart_done_base_port = 6760 latency_report_base_port = 6860 command_base_port = 6560 class Thread: def __init__(self, ip, tid): self.ip = ip self.tid = tid self._base = 'tcp://*:' self._ip_base = 'tcp://' + self.ip + ':' def get_ip(self): return self.ip def get_tid(self): return self.tid class Userthread(Thread): def get_request_pull_connect_addr(self): return self._ip_base + str(self.tid + REQUEST_PULLING_BASE_PORT) def get_request_pull_bind_addr(self): return self._base + str(self.tid + REQUEST_PULLING_BASE_PORT) def get_key_address_connect_addr(self): return self._ip_base + str(self.tid + KEY_ADDRESS_BASE_PORT) def get_key_address_bind_addr(self): return self._base + str(self.tid + KEY_ADDRESS_BASE_PORT) class Proxythread(Thread): def get_key_address_connect_addr(self): return self._ip_base + str(self.tid + KEY_ADDRESS_BASE_PORT) def key_address_bind_addr(self): return self._base + str(self.tid + KEY_ADDRESS_BASE_PORT)
t=input().split() hi=int(t[0]) hf=int(t[1]) if hi==hf: ht=24 elif hi>hf: ht=(24-hi)+hf elif hi<hf: ht=hf-hi print("O JOGO DUROU %d HORA(S)" %ht)
t = input().split() hi = int(t[0]) hf = int(t[1]) if hi == hf: ht = 24 elif hi > hf: ht = 24 - hi + hf elif hi < hf: ht = hf - hi print('O JOGO DUROU %d HORA(S)' % ht)
N = int(input()) ROCK, PAPER, SCISSORS = 'R', 'P', 'S' beating_move_by_move = { ROCK: PAPER, PAPER: SCISSORS, SCISSORS: ROCK, } MAX_CHARS = 500 IMPOSSIBLE = 'IMPOSSIBLE' for case_id in range(1, N + 1): nb_robots = int(input()) robot_programs = [input() for _ in range(nb_robots)] best_combination = '' can_win = True for char_index in range(MAX_CHARS): moves_to_beat = [*{robot_program[char_index % len(robot_program)] for robot_program in robot_programs}] if len(moves_to_beat) == 1: winning_move = beating_move_by_move[moves_to_beat[0]] best_combination += winning_move robot_programs = [] break elif len(moves_to_beat) == 2: best_move = '?' if ROCK not in moves_to_beat: best_move = SCISSORS elif PAPER not in moves_to_beat: best_move = ROCK elif SCISSORS not in moves_to_beat: best_move = PAPER best_combination += best_move robot_programs = [ robot_program for robot_program in robot_programs if beating_move_by_move[robot_program[char_index % len(robot_program)]] != best_move ] elif len(moves_to_beat) == 3: break print('Case #{}: {}'.format(case_id, best_combination if len(robot_programs) == 0 else IMPOSSIBLE))
n = int(input()) (rock, paper, scissors) = ('R', 'P', 'S') beating_move_by_move = {ROCK: PAPER, PAPER: SCISSORS, SCISSORS: ROCK} max_chars = 500 impossible = 'IMPOSSIBLE' for case_id in range(1, N + 1): nb_robots = int(input()) robot_programs = [input() for _ in range(nb_robots)] best_combination = '' can_win = True for char_index in range(MAX_CHARS): moves_to_beat = [*{robot_program[char_index % len(robot_program)] for robot_program in robot_programs}] if len(moves_to_beat) == 1: winning_move = beating_move_by_move[moves_to_beat[0]] best_combination += winning_move robot_programs = [] break elif len(moves_to_beat) == 2: best_move = '?' if ROCK not in moves_to_beat: best_move = SCISSORS elif PAPER not in moves_to_beat: best_move = ROCK elif SCISSORS not in moves_to_beat: best_move = PAPER best_combination += best_move robot_programs = [robot_program for robot_program in robot_programs if beating_move_by_move[robot_program[char_index % len(robot_program)]] != best_move] elif len(moves_to_beat) == 3: break print('Case #{}: {}'.format(case_id, best_combination if len(robot_programs) == 0 else IMPOSSIBLE))
class Pessoa: ano_atual = 2019 def __init__(self, nome, idade): self.nome = nome self.idade = idade def get_ano_nascimento(self): print(self.ano_atual - self.idade) @classmethod #Eu nao entendi a logica aq, sem nexo def por_ano_nascimento(cls, nome, ano_nascimento): idade = cls.ano_atual - ano_nascimento return cls(nome, idade) p1 = Pessoa('Pedro', 23) print(p1) print(p1.nome, p1.idade) p1.get_ano_nascimento()
class Pessoa: ano_atual = 2019 def __init__(self, nome, idade): self.nome = nome self.idade = idade def get_ano_nascimento(self): print(self.ano_atual - self.idade) @classmethod def por_ano_nascimento(cls, nome, ano_nascimento): idade = cls.ano_atual - ano_nascimento return cls(nome, idade) p1 = pessoa('Pedro', 23) print(p1) print(p1.nome, p1.idade) p1.get_ano_nascimento()
##Q3. Write a program to print table of 2 ############################################################################################################# ##Program Objective: to print table of 2 ## ##Coded by: KNR ## ##Date: 17/09/2019 22:20 ## ##Lang: Python 3.7.4 ## ##Version: 1.0 ## ############################################################################################################# # Method-1: Using for loop ##print("--------------------------------------------------") ## ##for i in range(1,11): ## print("{} x {} = {}".format(2,i,2*i)) ## ##print("--------------------------------------------------") # Method-2: Using while loop print("--------------------------------------------------") i = 1 while i<=10: print("{} x {} = {}".format(2,i,2*i)) i+=1 print("--------------------------------------------------")
print('--------------------------------------------------') i = 1 while i <= 10: print('{} x {} = {}'.format(2, i, 2 * i)) i += 1 print('--------------------------------------------------')
def funcaoOrig(x): return(x - 2) def raizFuncao(a, b): erro = 0.1 cont = 0 while((funcaoOrig(a)) * (funcaoOrig(b)) >= 0): print(f'\nErro!\nCom os valores {a} e {b}, eh impossivel calcularmos as raizes da funcao original!') a = float(input('\nDigite outro valor para a: ')) b = float(input('Digite outro valor para b: ')) while(abs(a - b) > erro): x = (a + b) / 2 if((funcaoOrig(a)) * (funcaoOrig(x)) < 0): b = x else: a = x cont += 1 print(f'\nA raiz da funcao eh: {x} com precisao de {erro} em {cont} iteracoes')
def funcao_orig(x): return x - 2 def raiz_funcao(a, b): erro = 0.1 cont = 0 while funcao_orig(a) * funcao_orig(b) >= 0: print(f'\nErro!\nCom os valores {a} e {b}, eh impossivel calcularmos as raizes da funcao original!') a = float(input('\nDigite outro valor para a: ')) b = float(input('Digite outro valor para b: ')) while abs(a - b) > erro: x = (a + b) / 2 if funcao_orig(a) * funcao_orig(x) < 0: b = x else: a = x cont += 1 print(f'\nA raiz da funcao eh: {x} com precisao de {erro} em {cont} iteracoes')
def make_default_resolver(field_attr_name): def resolver(source, args, info): property = getattr(source, field_attr_name, None) if callable(property): return property() return property resolver.__name__ = 'resolve_{}'.format(field_attr_name) return resolver
def make_default_resolver(field_attr_name): def resolver(source, args, info): property = getattr(source, field_attr_name, None) if callable(property): return property() return property resolver.__name__ = 'resolve_{}'.format(field_attr_name) return resolver
strs = ["flower","flow","flight"] if len(strs) == 0: print("") exit() prefix = strs[0] for str in strs: while(str.find(prefix) != 0): prefix = prefix[0:len(prefix)-1] if len(prefix) == 0: print("") exit() print(prefix)
strs = ['flower', 'flow', 'flight'] if len(strs) == 0: print('') exit() prefix = strs[0] for str in strs: while str.find(prefix) != 0: prefix = prefix[0:len(prefix) - 1] if len(prefix) == 0: print('') exit() print(prefix)
d1 = {1:'Sugandh', 2:'Divya', 3:'Mintoo'} print(d1) # D1 print("deleting an item from the dictionary...") del d1[3] print(d1) # D2 print("deleting an entire dictionary...") del d1 print(d1) # D3
d1 = {1: 'Sugandh', 2: 'Divya', 3: 'Mintoo'} print(d1) print('deleting an item from the dictionary...') del d1[3] print(d1) print('deleting an entire dictionary...') del d1 print(d1)
''' Template untuk solusi Lab 09 kelas A. ''' class Bangunan: ''' Sebuah bangunan. ''' def __init__(self, nama_bangunan, lama_sewa, harga_sewa): self.nama = nama_bangunan self.lama_sewa = lama_sewa self.harga_sewa = harga_sewa def get_harga_sewa(self): ''' Mengembalikan harga sewa. ''' return self.harga_sewa class Restoran(Bangunan): ''' Sebuah restoran. ''' def __init__(self, nama_restoran, lama_sewa=0): Bangunan.__init__(self, nama_restoran, lama_sewa, 30000000) # Silahkan ditambahkan class-class lainnya atau jika ingin memodifikasi daftar_bangunan = None while True: masukan = input().split() if masukan[0] == "BANGUN": # dapatkan nilai ini dari masukan_split sesuai indexnya nama = None jenis_bangunan = None # lakukan selection untuk menentukan tipe Pegawai if jenis_bangunan == "HOTEL": bangunan = None elif jenis_bangunan == "RESTORAN": bangunan = Restoran(nama) elif jenis_bangunan == "RUMAHSAKIT": bangunan = None # masukan bangunan yang sudah dibuat ke dalam dictionary # cetak pesan sesuai format elif masukan[0] == "INFO": pass elif masukan[0] == "JUALMAKANAN": pass elif masukan[0] == "TERIMATAMU": pass elif masukan[0] == "OBATIPASIEN": pass elif masukan[0] == "HITUNGUANG": pass
""" Template untuk solusi Lab 09 kelas A. """ class Bangunan: """ Sebuah bangunan. """ def __init__(self, nama_bangunan, lama_sewa, harga_sewa): self.nama = nama_bangunan self.lama_sewa = lama_sewa self.harga_sewa = harga_sewa def get_harga_sewa(self): """ Mengembalikan harga sewa. """ return self.harga_sewa class Restoran(Bangunan): """ Sebuah restoran. """ def __init__(self, nama_restoran, lama_sewa=0): Bangunan.__init__(self, nama_restoran, lama_sewa, 30000000) daftar_bangunan = None while True: masukan = input().split() if masukan[0] == 'BANGUN': nama = None jenis_bangunan = None if jenis_bangunan == 'HOTEL': bangunan = None elif jenis_bangunan == 'RESTORAN': bangunan = restoran(nama) elif jenis_bangunan == 'RUMAHSAKIT': bangunan = None elif masukan[0] == 'INFO': pass elif masukan[0] == 'JUALMAKANAN': pass elif masukan[0] == 'TERIMATAMU': pass elif masukan[0] == 'OBATIPASIEN': pass elif masukan[0] == 'HITUNGUANG': pass