content
stringlengths
7
1.05M
def solution(value): print("Solution: {}".format(value))
latam_countries = """Argentina Bolivia Brazil Chile Colombia Ecuador French Guiana Guyana Paraguay Peru Suriname Uruguay Venezuela Belize Costa Rica El Salvador Guatemala Honduras Mexico Nicaragua Panama Antigua & Barbuda Aruba Bahamas Barbados Cayman Islands Cuba Dominica Dominican Republic Grenada Guadeloupe Haiti Jamaica Martinique Puerto Rico Saint Barthélemy St. Kitts & Nevis St. Lucia St. Vincent and the Grenadines Trinidad & Tobago Turks & Caicos Islands Virgin Islands""".split("\n")
# See LICENSE for licensing information. # # Copyright (c) 2021 Regents of the University of California and The Board # of Regents for the Oklahoma Agricultural and Mechanical College # (acting for and on behalf of Oklahoma State University) # All rights reserved. # class test_bench: """ Class to generate the test bench file for simulation. """ def __init__(self, cache_config, name): cache_config.set_local_config(self) self.name = name self.success_message = "Simulation successful." self.failure_message = "Simulation failed." def test_bench_write(self, tb_path): """ Write the test bench file. """ self.tbf = open(tb_path, "w") self.tbf.write("// Timescale is overwritten when running the EDA tool to prevent bugs\n") self.tbf.write("// `timescale 1ns / 1ps\n\n") self.tbf.write("module test_bench;\n\n") self.write_parameters() self.write_registers() self.write_dumps() self.write_clock_generator() self.write_reset_block() self.write_instances() self.write_tasks() self.tbf.write(" initial begin\n") self.tbf.write(" `include \"test_data.v\"\n") self.tbf.write(" end\n\n") self.tbf.write("endmodule\n") self.tbf.close() def write_parameters(self): """ Write the parameters of the test bench. """ self.tbf.write(" parameter TAG_WIDTH = {};\n".format(self.tag_size)) # TODO: Fully associative cache's set_size = 0. self.tbf.write(" parameter SET_WIDTH = {};\n".format(self.set_size)) self.tbf.write(" parameter OFFSET_WIDTH = {};\n\n".format(self.offset_size)) self.tbf.write(" parameter WORD_WIDTH = {};\n".format(self.word_size)) if self.num_masks: self.tbf.write(" parameter MASK_COUNT = {};\n".format(self.num_masks)) self.tbf.write(" parameter WORD_COUNT = {};\n".format(self.words_per_line)) self.tbf.write(" localparam LINE_WIDTH = WORD_WIDTH * WORD_COUNT;\n\n") self.tbf.write(" localparam ADDR_WIDTH = TAG_WIDTH + SET_WIDTH + OFFSET_WIDTH;\n\n") self.tbf.write(" parameter CLOCK_DELAY = 5;\n") self.tbf.write(" // Reset is asserted for 1.5 cycles\n") self.tbf.write(" parameter RESET_DELAY = 15;\n") self.tbf.write(" parameter DELAY = 3;\n") self.tbf.write(" parameter MAX_TEST_SIZE = 64;\n\n") def write_registers(self): """ Write the registers of the test bench. """ self.tbf.write(" reg clk;\n") self.tbf.write(" reg rst;\n\n") self.tbf.write(" // Cache input pins\n") self.tbf.write(" reg cache_flush;\n") self.tbf.write(" reg cache_csb;\n") self.tbf.write(" reg cache_web;\n") if self.num_masks: self.tbf.write(" reg [MASK_COUNT-1:0] cache_wmask;\n") self.tbf.write(" reg [ADDR_WIDTH-1:0] cache_addr;\n") self.tbf.write(" reg [WORD_WIDTH-1:0] cache_din;\n\n") self.tbf.write(" // Cache output pins\n") self.tbf.write(" wire [WORD_WIDTH-1:0] cache_dout;\n\n") self.tbf.write(" wire cache_stall;\n") self.tbf.write(" // DRAM input pins\n") self.tbf.write(" wire dram_csb;\n") self.tbf.write(" wire dram_web;\n") self.tbf.write(" wire [ADDR_WIDTH-OFFSET_WIDTH-1:0] dram_addr;\n") self.tbf.write(" wire [LINE_WIDTH-1:0] dram_din;\n\n") self.tbf.write(" // DRAM output pins\n") self.tbf.write(" wire [LINE_WIDTH-1:0] dram_dout;\n\n") self.tbf.write(" wire dram_stall;\n") self.tbf.write(" // Test registers\n") self.tbf.write(" reg [MAX_TEST_SIZE-1:0] error_count;\n\n") def write_dumps(self): """ Write the $dumpfile and $dumpvars system functions for waveforms. """ self.tbf.write(" initial begin\n") self.tbf.write(" $dumpfile(\"waves.vcd\");\n") self.tbf.write(" $dumpvars;\n") self.tbf.write(" end\n\n") def write_clock_generator(self): """ Write the clock generator of the test bench. """ self.tbf.write(" // Clock generator\n") self.tbf.write(" initial begin\n") self.tbf.write(" clk = 1;\n") self.tbf.write(" forever #(CLOCK_DELAY) clk = !clk;\n") self.tbf.write(" end\n\n") def write_reset_block(self): """ Write the reset block of the test bench. """ self.tbf.write(" // Reset registers\n") self.tbf.write(" initial begin\n") self.tbf.write(" rst = 0;\n") self.tbf.write(" cache_flush = 0;\n") self.tbf.write(" cache_csb = 1;\n") self.tbf.write(" cache_web = 1;\n") if self.num_masks: self.tbf.write(" cache_wmask = 0;\n") self.tbf.write(" error_count = 0;\n") self.tbf.write(" end\n\n") def write_instances(self): """ Write the module instances of the cache and DRAM. """ self.tbf.write(" {} cache_instance (\n".format(self.name)) self.tbf.write(" .clk (clk),\n") self.tbf.write(" .rst (rst),\n") self.tbf.write(" .flush (cache_flush),\n") self.tbf.write(" .csb (cache_csb),\n") self.tbf.write(" .web (cache_web),\n") if self.num_masks: self.tbf.write(" .wmask (cache_wmask),\n") self.tbf.write(" .addr (cache_addr),\n") self.tbf.write(" .din (cache_din),\n") self.tbf.write(" .dout (cache_dout),\n") self.tbf.write(" .stall (cache_stall),\n") self.tbf.write(" .main_csb (dram_csb),\n") self.tbf.write(" .main_web (dram_web),\n") self.tbf.write(" .main_addr (dram_addr),\n") self.tbf.write(" .main_din (dram_din),\n") self.tbf.write(" .main_dout (dram_dout),\n") self.tbf.write(" .main_stall (dram_stall)\n") self.tbf.write(" );\n\n") self.tbf.write(" dram dram_instance (\n") self.tbf.write(" .clk (clk),\n") self.tbf.write(" .rst (rst),\n") self.tbf.write(" .csb (dram_csb),\n") self.tbf.write(" .web (dram_web),\n") self.tbf.write(" .addr (dram_addr),\n") self.tbf.write(" .din (dram_din),\n") self.tbf.write(" .dout (dram_dout),\n") self.tbf.write(" .stall (dram_stall)\n") self.tbf.write(" );\n\n") def write_tasks(self): """ Write the tasks of the test bench. """ self.tbf.write(" // Assert the reset signal\n") self.tbf.write(" task assert_reset;\n") self.tbf.write(" begin\n") self.tbf.write(" // Reset is asserted just before a posedge of the clock.\n") self.tbf.write(" // Therefore, it is enough to assert it for DELAY.\n") self.tbf.write(" rst <= 1;\n") self.tbf.write(" rst <= #(DELAY) 0;\n") self.tbf.write(" end\n") self.tbf.write(" endtask\n\n") self.tbf.write(" // Assert the flush signal\n") self.tbf.write(" task assert_flush;\n") self.tbf.write(" begin\n") self.tbf.write(" // Flush is asserted just before a posedge of the clock.\n") self.tbf.write(" // Therefore, it is enough to assert it for DELAY.\n") self.tbf.write(" cache_flush <= 1;\n") self.tbf.write(" cache_flush <= #(DELAY) 0;\n") self.tbf.write(" end\n") self.tbf.write(" endtask\n\n") self.tbf.write(" // Check for a number of stall cycles starting from the current cycle\n") self.tbf.write(" task check_stall;\n") self.tbf.write(" input integer cycle_count;\n") self.tbf.write(" input [MAX_TEST_SIZE-1:0] test_count;\n") self.tbf.write(" integer i;\n") self.tbf.write(" begin\n") self.tbf.write(" for (i = 1; i <= cycle_count; i = i + 1) begin\n") self.tbf.write(" if (!cache_stall) begin\n") self.tbf.write(" $display(\"Error at test #%0d! Cache stall #%0d is expected to be high but it is low.\", test_count, i);\n") self.tbf.write(" error_count = error_count + 1;\n") self.tbf.write(" end\n") self.tbf.write(" #(CLOCK_DELAY * 2);\n") self.tbf.write(" end\n") self.tbf.write(" end\n") self.tbf.write(" endtask\n\n") self.tbf.write(" // Output of the cache must match the expected\n") self.tbf.write(" task check_dout;\n") self.tbf.write(" input [WORD_WIDTH-1:0] dout_expected;\n") self.tbf.write(" input [MAX_TEST_SIZE-1:0] test_count;\n") self.tbf.write(" begin\n") self.tbf.write(" if (cache_dout !== dout_expected) begin\n") self.tbf.write(" $display(\"Error at test #%0d! Expected: %d, Received: %d\", test_count, dout_expected, cache_dout);\n") self.tbf.write(" error_count = error_count + 1;\n") self.tbf.write(" end\n") self.tbf.write(" end\n") self.tbf.write(" endtask\n\n") self.tbf.write(" // Print simulation result\n") self.tbf.write(" task end_simulation;\n") self.tbf.write(" begin\n") self.tbf.write(" if (!error_count) begin\n") self.tbf.write(" $display(\"{}\");\n".format(self.success_message)) self.tbf.write(" end else begin\n") self.tbf.write(" $display(\"{} Error count: %0d\", error_count);\n".format(self.failure_message)) self.tbf.write(" end\n") self.tbf.write(" end\n") self.tbf.write(" endtask\n\n")
def test(): # Here we can either check objects created in the solution code, or the # string value of the solution, available as __solution__. A helper for # printing formatted messages is available as __msg__. See the testTemplate # in the meta.json for details. # If an assertion fails, the message will be displayed assert not world_df is None, "Your answer for world_df does not exist. Have you loaded the TopoJSON data to the correct variable name?" assert "topo_feature" in __solution__, "The loaded data should be in TopoJSON format. In order to read TopoJSON file correctly, you need to use the alt.topo_feature() function." assert ( "quantitative" in __solution__ or "pop_density:Q" in __solution__ ), "Make sure you use pop_density column from gapminder_df for the color encoding. Hint: since pop_density column does not exist in world_df, Altair can't infer its data type and you need to specify that it is quantitative data." assert type(world_df) == alt.UrlData, "world_df does not appear to be an Altair UrlData object. Have you assigned the Altair UrlData object for the TopoJSON data to the correct variable?" assert world_df.url == data.world_110m.url, "Make sure you are loading the data from correct url." assert (world_df.format != alt.utils.schemapi.Undefined and world_df.format.type == 'topojson' ), "The loaded data should be in TopoJSON format. In order to read TopoJSON file correctly, you need to use the alt.topo_feature() function." assert world_df.format.feature == "countries", "Make sure to specify 'countries' feature when loading the TopoJSON file using alt.topo_feature()." assert not pop_dense_plot is None, "Your answer for pop_dense_plot does not exist. Have you assigned the plot to the correct variable name?" assert type(pop_dense_plot) == alt.Chart, "pop_dense_plot does not appear to be an Altair Chart object. Have you assigned the Altair Chart object for the plot to the correct variable?" assert pop_dense_plot.mark == 'geoshape', "Make sure you are using mark_geoshape for pop_dense_plot." assert pop_dense_plot.encoding.color != alt.utils.schemapi.Undefined and ( pop_dense_plot.encoding.color.shorthand in {'pop_density:quantitative', 'pop_density:Q'} or (pop_dense_plot.encoding.color.shorthand == 'pop_density' and pop_dense_plot.encoding.color.type == 'quantitative') or pop_dense_plot.encoding.color.field in {'pop_density:quantitative', 'pop_density:Q'} or (pop_dense_plot.encoding.color.field == 'pop_density' and pop_dense_plot.encoding.color.type == 'quantitative') ), "Make sure you use pop_density column from gapminder_df for the color encoding. Hint: since pop_density column does not exist in world_df, Altair can't infer its data type and you need to specify that it is quantitative data." assert pop_dense_plot.encoding.color.scale != alt.utils.schemapi.Undefined and ( pop_dense_plot.encoding.color.scale.scheme != alt.utils.schemapi.Undefined ), "Make sure to specify a colour scheme." assert pop_dense_plot.encoding.color.scale.domainMid == 81, "Make sure you set the domainMid of the color scale as the global median (81)." assert type(pop_dense_plot.transform) == list and ( len(pop_dense_plot.transform) == 1 and pop_dense_plot.transform[0]['from'] != alt.utils.schemapi.Undefined and pop_dense_plot.transform[0]['from'].fields == ['pop_density'] and pop_dense_plot.transform[0]['from'].key ), "Make sure you use .transform_lookup() to lookup the column 'pop_density' from the gapminder_df data using 'id' as the connecting column. Hint: 'pop_density' should be inside a list." assert pop_dense_plot.projection != alt.utils.schemapi.Undefined and ( pop_dense_plot.projection.scale == 80 ), "Make sure you use 'equalEarth' projection. Hint: you can use .project() method with type argument to specify projection type." __msg__.good("You're correct, well done!")
n = int(input()) #ans = 0 def rec(currentValue, usedValue, counter): #global ans if currentValue > n: return if usedValue==7: #ans += 1 counter.append(1) rec(currentValue*10 + 7, usedValue|1<<0, counter) rec(currentValue*10 + 5, usedValue|1<<1, counter) rec(currentValue*10 + 3, usedValue|1<<2, counter) def main(): ### globalにしてansを更新 # rec(0, 0, ans) ### 以下のようにして配列にアクセスさせている記事を発見 res =[] rec(0, 0, res) ans = sum(res) print(ans) if __name__=='__main__': main()
class SimpleSpriteList: def __init__(self) -> None: self.sprites = list() def draw(self) -> None: for sprite in self.sprites: sprite.draw() def update(self) -> None: for sprite in self.sprites: sprite.update() def append(self, sprite) -> None: self.sprites.append(sprite) def remove(self, sprite) -> None: self.sprites.remove(sprite) def pop(self, index: int = -1): self.sprites.pop(index) def clear(self) -> None: self.sprites.clear()
resp = 's' cont = soma = 0 list = [] while resp == 's': num = int(input('digite um número: ')) cont += 1 soma += num list.append(num) resp = input('Deseja continuar? [s/n]').lower().strip() print(f'Você digitou {cont} números\n' f'A média deles é {soma/cont}\n' f'O maior número é o {max(list)}\n' f'O menor número é o {min(list)}\n')
""" Problem: https://www.hackerrank.com/challenges/nested-list/problem Max Score: 10 Difficulty: Easy Author: Ric Date: Nov 13, 2019 """ def secondLow(classList): secondLowScore = sorted(set(m[1] for m in classList))[1] result = sorted([m[0] for m in classList if m[1] == secondLowScore]) return result n = int(input()) classList = [] for i in range(n): classList.append([str(input()), float(input())]) # print(classList) print('\n'.join(secondLow(classList)))
numberLines = int(input()) while 0 < numberLines: number = int(input()) sum = 0 for i in range(number): if i%3 == 0 or i%5 == 0: sum = sum + i print(sum) numberLines = numberLines - 1
#!/usr/bin/env python3 #bpm to millisecond for compressor release def compressor_release(bpm, note_length): ''' Inputs: BPM, note length Output: compression release time Note: Function returns perfect compression release time for standard note lengths. Electronic music is not standard mus ic so this does not have much of an application ''' # using a tuple because standard_lengths = ('1/4', '1/8', '1/16', '1/32', '1/64', '1/128', '1/256') return round((float(60)/bpm)*(10**3)/2**int(standard_lengths.index(note_length))) beep = int(input('BPM: ')) length = input('Note length: ') j = compressor_release(int(beep),length) print(j) # ~THIS IS OLD CODE~ """ if note == '1/4': desireBe = (60/bpm)*(10**3) print(f'{round(desireBe,1)}ms') elif note == '1/8': desireBe = (60/bpm)*(10**3)/2 print(f'{round(desireBe,1)}ms') elif note == '1/16': desireBe = (60/bpm)*(10**3)/4 print(f'{round(desireBe,1)}ms') elif note == '1/32': desireBe = (60/bpm)*(10**3)/8 print(f'{round(desireBe,1)}ms') elif note == '1/64': desireBe = (60/bpm)*(10**3)/16 print(f'{round(desireBe,1)}ms') elif note == '1/128': desireBe = (60/bpm)*(10**3)/32 print(f'{round(desireBe,1)}ms') elif note == '1/256': desireBe = (60/bpm)*(10**3)/64 print(f'{round(desireBe,1)}ms') else: print("invaled note length") """
#Mock class for GPIO BOARD = 1 BCM = 2 OUT = 1 IN = 1 HIGH = 1 LOW = 0 def setmode(a): print ("setmode GPIO",a) def setup(a, b): print ("setup GPIO", a, b) def output(a, b): print ("output GPIO", a, b) def cleanup(): print ("cleanup GPIO", a, b) def setwarnings(flag): print ("setwarnings", flag)
__author__ = 'yinjun' class Solution: """ @param n: An integer @return: An integer """ def climbStairs(self, n): # write your code here if n<=2 : return n stairs = [0 for i in range(n)] stairs[0] = 1 stairs[1] = 2 for i in range(2, n): stairs[i] = stairs[i-1] + stairs[i-2] return stairs[n-1]
# Damage Skin - Violetta success = sm.addDamageSkin(2433197) if success: sm.chat("The Damage Skin - Violetta has been added to your account's damage skin collection.")
#!/usr/bin/env python3 formulas = [ "XNd perr", "PNd (PNd (call And (XNu exc)))", "PNd (han And (XNd (exc And (XBu call))))", "G (exc --> XBu call)", "T Ud exc", "PNd (PNd (T Ud exc))", "G ((call And pa And ((~ ret) Ud WRx)) --> XNu exc)", "PNd (PBu call)", "PNd (PNd (PNd (PBu call)))", "XNd (PNd (PBu call))", "G ((call And pa And (PNu exc Or XNu exc)) --> (PNu eb Or XNu eb))", "F (HNd pb)", "F (HBd pb)", "F (pa And (call HUd pc))", "F (pc And (call HSd pa))", "G ((pc And (XNu exc)) --> ((~ pa) HSd pb))", "G ((call And pb) --> (~ pc) HUu perr)", "F (HNu perr)", "F (HBu perr)", "F (pa And (call HUu pb))", "F (pb And (call HSu pa))", "G (call --> XNd ret)", "G (call --> Not (PNu exc))", "G ((call And pa) --> ~ (PNu exc Or XNu exc))", "G (exc --> ~ (PBu (call And pa) Or XBu (call And pa)))", "G ((call And pb And (call Sd (call And pa))) --> (PNu exc Or XNu exc))", "G (han --> XNu ret)", "T Uu exc", "PNd (PNd (T Uu exc))", "PNd (PNd (PNd (T Uu exc)))", "G (call And pc --> (T Uu (exc And XBd han)))", "call Ud (ret And perr)", "XNd (call And ((call Or exc) Su pb))", "PNd (PNd ((call Or exc) Uu ret))"] n = 11 for form in formulas: with open(str(n) + '-generic-larger.pomc', 'w') as f: f.write('formulas = ' + form + ';\n') f.write('include = "../../Mcall.inc";\n\n') f.write('include = "opa.inc";') n += 1
numeros = [] for i in range(3): numeros.append(int(input(F'Digite o {i + 1}º número: '))) if len(numeros) == 1: maior = numeros[0] menor = numeros[0] if numeros[i] > maior: maior = numeros[i] elif numeros[i] < menor: menor = numeros[i] print(f'O maior número digitado foi: {maior}\nO menor foi: {menor}')
class Iterator(object): def __init__(self, iterable, looping: bool = False): self.iterable = iterable self.lastPos = 0 self.looping = looping def __next__(self): pos = self.lastPos self.lastPos += 1 if self.lastPos >= len(self.iterable): if self.looping: self.lastPos = 0 else: raise StopIteration return self.iterable[pos]
################################################################################## #### Runtime configuration ################################################################################## sampleCounter = 0 ################################################################################## #### General configuration ################################################################################## version = "1.0.2103.0401" ################################################################################## #### LCD configuration ################################################################################## lcdI2cExpanderType = "PCF8574" lcdI2cAddress = 0x27 lcdColumnCount = 20 lcdRowCount = 4
# REPLACE EVERYTHING IN CURLY BRACKETS {}, INCLUDING THE BRACKETS THEMSELVES. # THEN RENAME THIS FILE TO constants.py AND MOVE IT INTO YOUR PROJECT'S ROOT CONNECT_BASE_URL = '{YOUR BASE URL}/api/xml?action=' CONNECT_LOGIN = '{YOUR LOGIN}' CONNECT_PWD = '{YOUR PASSWORD}' # USERS YOU WANT TO BE ABLE TO EXCLUDE FROM REPORTS CONNECT_ADMIN_USERS = ['{USER1LOGIN}', '{USER2LOGIN}', '{USER3LOGIN}' ]
# -*- coding: utf-8 -*- def crearCombinaciones(abecedario): for d1 in abecedario: for d2 in abecedario: for d3 in abecedario: for d4 in abecedario: #print(d1 + '' + d2 + '' + d3 + '' + d4) f.write(d1 + '' + d2 + '' + d3 + '' + d4) f.write('\n') abecedario = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] f = open("dico.txt", "w") crearCombinaciones(abecedario) f.close()
set_name(0x8009CFEC, "VID_OpenModule__Fv", SN_NOWARN) set_name(0x8009D0AC, "InitScreens__Fv", SN_NOWARN) set_name(0x8009D19C, "MEM_SetupMem__Fv", SN_NOWARN) set_name(0x8009D1C8, "SetupWorkRam__Fv", SN_NOWARN) set_name(0x8009D258, "SYSI_Init__Fv", SN_NOWARN) set_name(0x8009D364, "GM_Open__Fv", SN_NOWARN) set_name(0x8009D388, "PA_Open__Fv", SN_NOWARN) set_name(0x8009D3C0, "PAD_Open__Fv", SN_NOWARN) set_name(0x8009D404, "OVR_Open__Fv", SN_NOWARN) set_name(0x8009D424, "SCR_Open__Fv", SN_NOWARN) set_name(0x8009D454, "DEC_Open__Fv", SN_NOWARN)
class MusicTextView: """This class represents one instance of a view for the music maze. The purpose of this class is to represent the maze through text and also to create a basis on the methods needed to cover all of the view's expected features for sanity checking purposes."""
lr_scheduler = dict( name='poly_scheduler', epochs=30, power=0.9 )
size(800, 600) background(255) triangle(20, 20, 20, 50, 50, 20) triangle(200, 100, 200, 150, 300, 320) triangle(700, 500, 800, 550, 600, 600)
# 深度优先搜索 DFS def DFS(graph, start): """深度优先搜索,start为起点""" stack = [] stack.append(start) seen = set() seen.add(start) while len(stack) > 0: vertex = stack.pop() nodes = graph[vertex] for w in nodes: if w not in seen: stack.append(w) seen.add(w) print(vertex, end=' ') if __name__ == '__main__': graph = { 'A': ['B', 'C'], 'B': ['A', 'C', 'D'], 'C': ['A', 'B', 'D', 'E'], 'D': ['B', 'C', 'E', 'F'], 'E': ['C', 'D'], 'F': ['D'] } DFS(graph, 'A') print() DFS(graph, 'E')
def get_bit_mask(bit_num): """Returns as bit mask with bit_num set. :param bit_num: The bit number. :type bit_num: int :returns: int -- the bit mask :raises: RangeError >>> bin(pifacecommon.core.get_bit_mask(0)) 1 >>> pifacecommon.core.get_bit_mask(1) 2 >>> bin(pifacecommon.core.get_bit_mask(3)) '0b1000' """ return 1 << (bit_num) def get_bit_num(bit_pattern): """Returns the lowest bit num from a given bit pattern. Returns None if no bits set. :param bit_pattern: The bit pattern. :type bit_pattern: int :returns: int -- the bit number :returns: None -- no bits set >>> pifacecommon.core.get_bit_num(0) None >>> pifacecommon.core.get_bit_num(0b1) 0 >>> pifacecommon.core.get_bit_num(0b11000) 3 """ if bit_pattern == 0: return None bit_num = 0 # assume bit 0 while (bit_pattern & 1) == 0: bit_pattern = bit_pattern >> 1 bit_num += 1 if bit_num > 7: bit_num = 0 break return bit_num def sleep_microseconds(microseconds): """Sleeps for the given number of microseconds. :param microseconds: Number of microseconds to sleep for. :type microseconds: int """ # divide microseconds by 1 million for seconds seconds = microseconds / float(1000000) time.sleep(seconds)
""" Module: 'lidar' on M5 FlowUI v1.4.0-beta """ # MCU: (sysname='esp32', nodename='esp32', release='1.11.0', version='v1.11-284-g5d8e1c867 on 2019-08-30', machine='ESP32 module with ESP32') # Stubber: 1.3.1 def deinit(): pass def distance(): pass def draw_map(): pass def get_distance(): pass def get_frame(): pass def init(): pass
"""Functions for determining micrograph scaling. """ def determine_scaling(image, bar_length_um, bar_frac): r"""Determine um per pixels scaling for an image provided the bar length in um and the fraction of the image for which it occupies. Parameters ---------- image : ndarray Input image. Must be grayscale. bar_length_um : float Length of scale bar (:math:`\mu \text{m}`). bar_frac : float Fraction of the image width occupied by the scale bar. Returns ------- um_per_px : float Scaling (:math:`\mu \text{m}` per px). """ # Convert bar length from um to pixels bar_length_px = bar_frac * image.shape[1] # Determine conversion um_per_px = bar_length_um / bar_length_px return um_per_px
black = (0, 0, 0) red = (255, 0, 0) orange = (255, 152, 0) deep_orange = (255, 87, 34) brown = (121, 85, 72) green = (0, 128, 0) light_green = (139, 195, 74) teal = (0, 150, 136) blue = (33, 150, 136) purple = (156, 39, 176) pink = (234, 30, 99) deep_purple = (103, 58, 183) color_dict = { 0: black, 2: red, 4: green, 8: purple, 16: deep_purple, 32: deep_orange, 64: teal, 128: light_green, 256: pink, 512: orange, 1024: black, 2048: brown } def getColor(tile_number): """ Returns the color for specific number. Arguments:\n :tileNumber: the tile for which you require color. """ return color_dict[tile_number]
#part 1 count = 0 expected_fields = {'byr', 'iyr', 'eyr', 'hgt', 'hcl', 'ecl', 'pid'} received_fields = set() with open("input.txt") as f: for line in f: if line != '\n': fields = {i[:3] for i in line.split(' ')} received_fields.update(fields) else: difference = expected_fields - received_fields if not difference: count += 1 received_fields.clear() print(count) #part 2 count = 0 expected_fields = {'byr', 'iyr', 'eyr', 'hgt', 'hcl', 'ecl', 'pid'} received_fields = set() received_pairs = {} with open("input.txt") as f: for line in f: if line != '\n': for pair in line.split(' '): key, value = pair.split(':') received_pairs[key.strip()] = value.strip() received_fields.add(key) else: difference = expected_fields - received_fields if not difference: rules = { 'byr': lambda x: 1920 <= int(x) <= 2002, 'iyr': lambda x: 2010 <= int(x) <= 2020, 'eyr': lambda x: 2020 <= int(x) <= 2030, 'hgt': lambda x: 150 <= int(x[:-2]) <= 193 if x[-2:] == 'cm' \ else 59 <= int(x[:-2]) <= 76 if x[-2:] == 'in' else False, 'hcl': lambda x: x[0] == '#' and len(x) == 7 and \ all(map(lambda y: '0' <= y <= '9' or 'a' <= y <= 'f', x[1:])), 'ecl': lambda x: x in {'amb', 'blu', 'brn', 'gry', 'grn', 'hzl', 'oth'}, 'pid': lambda x: len(x) == 9 and all(map(lambda y: '0' <= y <= '9', x)), 'cid': lambda x: True } for key in received_pairs: if not rules[key](received_pairs[key]): break else: count += 1 received_fields.clear() received_pairs.clear() print(count)
ACTION_CREATED = 'created' ACTION_UPDATED = 'updated' ACTION_DELETED = 'deleted' ACTION_OTHER = 'other' ACTION_CHOICES = ( (ACTION_CREATED, ACTION_CREATED), (ACTION_UPDATED, ACTION_UPDATED), (ACTION_DELETED, ACTION_DELETED), (ACTION_OTHER, ACTION_OTHER), ) LOG_LEVEL_CRITICAL = 'CRITICAL' LOG_LEVEL_ERROR = 'ERROR' LOG_LEVEL_WARNING = 'WARNING' LOG_LEVEL_INFO = 'INFO' LOG_LEVEL_DEBUG = 'DEBUG' LOG_LEVEL_NOTSET = 'NOTSET' LOG_LEVEL_CHOICES = ( (LOG_LEVEL_CRITICAL, LOG_LEVEL_CRITICAL), (LOG_LEVEL_ERROR, LOG_LEVEL_ERROR), (LOG_LEVEL_WARNING, LOG_LEVEL_WARNING), (LOG_LEVEL_INFO, LOG_LEVEL_INFO), (LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG), (LOG_LEVEL_NOTSET, LOG_LEVEL_NOTSET), )
""" A command line interface to the qcfractal. """ # from tornado.options import options, define # import tornado.ioloop # import tornado.web # define("port", default=8888, help="Run on the given port.", type=int) # define("mongod_ip", default="127.0.0.1", help="The Mongod instances IP.", type=str) # define("mongod_port", default=27017, help="The Mongod instances port.", type=int) # define("mongod_username", default="", help="The Mongod instance username.", type=str) # define("mongod_password", default="", help="The Mongod instances password.", type=str) # define("dask_ip", default="", help="The Dask instances IP. If blank starts a local cluster.", type=str) # define("dask_port", default=8786, help="The Dask instances port.", type=int) # # define("fireworks_ip", default="", help="The Fireworks instances IP. If blank starts a local cluster.", type=str) # # define("fireworks_port", default=None, help="The Fireworks instances port.", type=int) # define("logfile", default="qcdb_server.log", help="The logfile to write to.", type=str) # define("queue", default="fireworks", help="The type of queue to use dask or fireworks", type=str) # # # # queues = ["fireworks", "dask"] # if options.queue not in queues: # raise KeyError("Queue of type {} not understood".format(options.queue)) # # if options.queue == "dask": # import distributed # dask_dir_geuss = os.getcwd() + '/dask_scratch/' # define("dask_dir", default=dask_dir_geuss, help="The Dask workers working director", type=str) # dask_working_dir = options.dask_dir # elif options.queue == "fireworks": # import fireworks # # tornado.options.options.parse_command_line() # tornado.options.parse_command_line() # class DQMServer(object): # def __init__(self, logfile_name="qcfractal.log"): # self.logger = logging.getLogger(__name__) # self.logger.setLevel(logging.INFO) # handler = logging.FileHandler(options.logfile) # handler.setLevel(logging.INFO) # myFormatter = logging.Formatter('[%(asctime)s] %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p') # handler.setFormatter(myFormatter) # self.logger.addHandler(handler) # self.logger.info("Logfile set to {}\n".format(options.logfile)) # mongo_username = None # mongo_password = None # if options.mongod_username: # mongo_username = options.mongod_username # if options.mongod_password: # mongo_password = options.mongod_password # # Build mongo socket # self.mongod_socket = dqm.mongo_helper.MongoSocket(options.mongod_ip, options.mongod_port, username=mongo_username, password=mongo_password, globalAuth=True) # self.logger.info("Mongod Socket Info:") # self.logger.info(str(self.mongod_socket) + "\n") # loop = tornado.ioloop.IOLoop.current() # self.local_cluster = None # if options.queue == "dask": # # Grab the Dask Scheduler # if options.dask_ip == "": # self.local_cluster = distributed.LocalCluster(nanny=None) # self.queue_socket = distributed.Client(self.local_cluster) # else: # self.queue_socket = distributed.Client(options.dask_ip + ":" + str(options.dask_port)) # self.logger.info("Dask Scheduler Info:") # self.logger.info(str(self.queue_socket) + "\n") # # Make sure the scratch is there # if not os.path.exists(dask_working_dir): # os.makedirs(dask_working_dir) # # Dask Nanny # self.queue_nanny = dqm.handlers.DaskNanny(self.queue_socket, self.mongod_socket, logger=self.logger) # scheduler = dqm.handlers.DaskScheduler # else: # self.queue_socket = fireworks.LaunchPad.auto_load() # self.queue_nanny = dqm.handlers.FireworksNanny(self.queue_socket, self.mongod_socket, logger=self.logger) # self.logger.info("Fireworks Scheduler Info:") # self.logger.info(str(self.queue_socket.host) + ":" + str(self.queue_socket.port) + "\n") # scheduler = dqm.handlers.FireworksScheduler # tornado_args = { # "mongod_socket": self.mongod_socket, # "queue_socket": self.queue_socket, # "queue_nanny": self.queue_nanny, # "logger": self.logger, # } # # Start up the app # app = tornado.web.Application([ # (r"/information", dqm.handlers.Information, tornado_args), # (r"/scheduler", scheduler, tornado_args), # (r"/mongod", dqm.handlers.Mongod, tornado_args), # ]) # app.listen(options.port) # # Query Dask Nanny on loop # tornado.ioloop.PeriodicCallback(self.queue_nanny.update, 2000).start() # # This is for testing # #loop.add_callback(get, "{data}") # #loop.add_callback(post, json_data) # #loop.run_sync(lambda: post(data)) # self.loop = loop # self.logger.info("QCDB Client successfully initialized at https://localhost:{0:d}.\n".format(options.port)) # def start(self): # self.logger.info("QCDB Client successfully started. Starting IOLoop.\n") # # Soft quit at the end of a loop # try: # self.loop.start() # except KeyboardInterrupt: # if options.queue == "dask": # self.queue_socket.shutdown() # if self.local_cluster: # self.local_cluster.close() # self.loop.stop() # self.logger.info("QCDB Client stopping gracefully. Stopped IOLoop.\n") # def stop(self): if __name__ == "__main__": server = QCDBServer() server.start() def main(): server = qcfractal.server() server.start() if __name__ == '__main__': main()
def interest(n, principle_amount): def years(x): return principle_amount + (n * principle_amount * x) / 100 return years principle = 100000 home_loan = interest(7, principle) # percentage of 7 personal_loan = interest(11, principle) # percentage of 11 print(home_loan(20)) # for 20 years print(personal_loan(3)) # for 3 years
class ProducerEvent: timestamp = 0 csvName = "" houseId = 0 deviceId = 0 id = 0 def __init__(self, timestamp, ids, csv_name): self.timestamp = int(timestamp) self.csvName = csv_name # ids_list = list(map(int, ids.replace("[", "").replace("]", "").replace("pv_producer", "").split(":"))) # self.houseId = int(ids_list[0]) # self.deviceId = int(ids_list[1]) ids_list = csv_name.split("_") self.houseId = int(ids_list[0]) self.deviceId = int(ids_list[1]) self.id = int(ids_list[2].split(".")[0]) def __str__(self): return "timestamp %r, csvName %r, houseId %r, deviceId %r, Id %r" %\ (self.timestamp, self.csvName, self.houseId, self.deviceId, self.id)
# some mnemonics as specific to capstone CJMP_INS = ["je", "jne", "js", "jns", "jp", "jnp", "jo", "jno", "jl", "jle", "jg", "jge", "jb", "jbe", "ja", "jae", "jcxz", "jecxz", "jrcxz"] LOOP_INS = ["loop", "loopne", "loope"] JMP_INS = ["jmp", "ljmp"] CALL_INS = ["call", "lcall"] RET_INS = ["ret", "retn", "retf", "iret"] END_INS = ["ret", "retn", "retf", "iret", "int3"] REGS_32BIT = ["eax", "ebx", "ecx", "edx", "esi", "edi", "ebp", "esp"] DOUBLE_ZERO = bytearray(b"\x00\x00") DEFAULT_PROLOGUES = [ b"\x8B\xFF\x55\x8B\xEC", b"\x89\xFF\x55\x8B\xEC", b"\x55\x8B\xEC" ] # these cover 80%+ of manually confirmed function starts in the reference data set COMMON_PROLOGUES = { "5": { 32: { b"\x8B\xFF\x55\x8B\xEC": 5, # mov edi, edi, push ebp, mov ebp, esp b"\x89\xFF\x55\x8B\xEC": 3, # mov edi, edi, push ebp, mov ebp, esp }, 64: {} }, "3": { 32: { b"\x55\x8B\xEC": 3, # push ebp, mov ebp, esp }, 64: {} }, "2": { 32: { b"\x8B\xFF": 3, # mov edi, edi b"\xFF\x25": 3, # jmp dword ptr <addr> b"\x33\xC0": 2, # xor eax, eax b"\x83\xEC": 2, # sub esp, <byte> b"\x8B\x44": 2, # mov eax, dword ptr <esp + byte> b"\x81\xEC": 2, # sub esp, <byte> b"\x8D\x4D": 2, # lea ecx, dword ptr <ebp/esp +- byte> b"\x8D\x8D": 2, # lea ecx, dword ptr <ebp/esp +- byte> b"\xFF\x74": 2, # push dword ptr <addr> }, 64: {} }, "1": { 32: { b"\x6a": 3, # push <const byte> b"\x56": 3, # push esi b"\x53": 2, # push ebx b"\x51": 2, # push ecx b"\x57": 2, # push edi b"\xE8": 1, # call <offset> b"\xc3": 1 # ret }, 64: { b"\x40": 1, # x64 - push rxx b"\x44": 1, # x64 - mov rxx, ptr b"\x48": 1, # x64 - mov *, * b"\x33": 1, # xor, eax, * b"\x4c": 1, # x64 - mov reg, reg b"\xb8": 1, # mov reg, const b"\x8b": 1, # mov dword ptr, reg b"\x89": 1, # mov dword ptr, reg b"\x45": 1, # x64 - xor, reg, reg b"\xc3": 1 # retn } } } #TODO: 2018-06-27 expand the coverage in this list # https://stackoverflow.com/questions/25545470/long-multi-byte-nops-commonly-understood-macros-or-other-notation GAP_SEQUENCES = { 1: [ "\x90", # NOP1_OVERRIDE_NOP - AMD / nop - INTEL "\xCC" # int3 ], 2: [ b"\x66\x90", # NOP2_OVERRIDE_NOP - AMD / nop - INTEL b"\x8b\xc0", b"\x8b\xff", # mov edi, edi b"\x8d\x00", # lea eax, dword ptr [eax] b"\x86\xc0", # xchg al, al ], 3: [ b"\x0f\x1f\x00", # NOP3_OVERRIDE_NOP - AMD / nop - INTEL b"\x8d\x40\x00", # lea eax, dword ptr [eax] b"\x8d\x00\x00", # lea eax, dword ptr [eax] b"\x8d\x49\x00", # lea ecx, dword ptr [ecx] b"\x8d\x64\x24", # lea esp, dword ptr [esp] b"\x8d\x76\x00", b"\x66\x66\x90" ], 4: [ b"\x0f\x1f\x40\x00", # NOP4_OVERRIDE_NOP - AMD / nop - INTEL b"\x8d\x74\x26\x00", b"\x66\x66\x66\x90" ], 5: [ b"\x0f\x1f\x44\x00\x00", # NOP5_OVERRIDE_NOP - AMD / nop - INTEL b"\x90\x8d\x74\x26\x00" ], 6: [ b"\x66\x0f\x1f\x44\x00\x00", # NOP6_OVERRIDE_NOP - AMD / nop - INTEL b"\x8d\xb6\x00\x00\x00\x00" ], 7: [ b"\x0f\x1f\x80\x00\x00\x00\x00", # NOP7_OVERRIDE_NOP - AMD / nop - INTEL, b"\x8d\xb4\x26\x00\x00\x00\x00", b"\x8D\xBC\x27\x00\x00\x00\x00" ], 8: [ b"\x0f\x1f\x84\x00\x00\x00\x00\x00", # NOP8_OVERRIDE_NOP - AMD / nop - INTEL b"\x90\x8d\xb4\x26\x00\x00\x00\x00" ], 9: [ b"\x66\x0f\x1f\x84\x00\x00\x00\x00\x00", # NOP9_OVERRIDE_NOP - AMD / nop - INTEL b"\x89\xf6\x8d\xbc\x27\x00\x00\x00\x00" ], 10: [ b"\x66\x66\x0f\x1f\x84\x00\x00\x00\x00\x00", # NOP10_OVERRIDE_NOP - AMD b"\x8d\x76\x00\x8d\xbc\x27\x00\x00\x00\x00", b"\x66\x2e\x0f\x1f\x84\x00\x00\x00\x00\x00" ], 11: [ b"\x66\x66\x66\x0f\x1f\x84\x00\x00\x00\x00\x00", # NOP11_OVERRIDE_NOP - AMD b"\x8d\x74\x26\x00\x8d\xbc\x27\x00\x00\x00\x00", b"\x66\x66\x2e\x0f\x1f\x84\x00\x00\x00\x00\x00" ], 12: [ b"\x8d\xb6\x00\x00\x00\x00\x8d\xbf\x00\x00\x00\x00", b"\x66\x66\x66\x2e\x0f\x1f\x84\x00\x00\x00\x00\x00" ], 13: [ b"\x8d\xb6\x00\x00\x00\x00\x8d\xbc\x27\x00\x00\x00\x00", b"\x66\x66\x66\x66\x2e\x0f\x1f\x84\x00\x00\x00\x00\x00" ], 14: [ b"\x8d\xb4\x26\x00\x00\x00\x00\x8d\xbc\x27\x00\x00\x00\x00", b"\x66\x66\x66\x66\x66\x2e\x0f\x1f\x84\x00\x00\x00\x00\x00" ], 15: [ b"\x66\x66\x66\x66\x66\x66\x2e\x0f\x1f\x84\x00\x00\x00\x00\x00" ] } COMMON_START_BYTES = { "32": { "55": 8334, "6a": 758, "56": 756, "51": 312, "8d": 566, "83": 558, "53": 548 }, "64": { "48": 1341, "40": 349, "4c": 59, "33": 56, "44": 18, "45": 17, "e9": 16 } }
def main(): # input N = int(input()) # compute N = int(1.08*N) # output if N < 206: print('Yay!') elif N == 206: print('so-so') else: print(':(') if __name__ == '__main__': main()
# -*- coding: utf-8 -*- strings = { 'test.fallback': 'A fallback string' }
def climb_stairs2(n: int) -> int: if n == 1 or n == 2: return n n1 = 1 n2 = 2 t = 0 for i in range(3, n + 1): t = n1 + n2 n1 = n2 n2 = t return t class StairClimber: # total variable needed for the recursive solution total = 0 # recursive, mathy way that's slow for sufficiently big numbers def climb_stairs(self, n: int) -> int: if n == 0: self.total += 1 if n >= 1: self.climb_stairs(n - 1) if n >= 2: self.climb_stairs(n - 2) return self.total # standard, boring dynamic programming way print(climb_stairs2(3)) print(climb_stairs2(38))
#!usr/bin/python # -*- coding:utf8 -*- def gen_func(): try: yield "http://projectesdu.com" except GeneratorExit: pass yield 2 yield 3 return "bobby" if __name__ == "__main__": gen = gen_func() next(gen) gen.close() next(gen)
""" ShellSort is mainly a variation of Insertion Sort. In insertion sort, we move elements only one position ahead. When an element has to be moved far ahead, many movements are involved. The idea of shellSort is to allow exchange of far items. In shellSort, we make the array h-sorted for a large value of h. We keep reducing the value of h until it becomes 1. An array is said to be h-sorted if all sublists of every h’th element is sorted. Time complexity: Best : O(n) Average : O((nlog(n))^2) Worst : O((nlog(n))^2) Space complexity: O(1) """
list_images = [ ".jpeg",".jpg",".png",".gif",".webp",".tiff",".psd",".raw",".bmp",".heif",".indd",".svg",".ico" ] list_documents = [ ".doc",".txt",".pdf",".xlsx",".docx",".xls",".rtf",".md",".ods",".ppt",".pptx" ] list_videos = [ ".mp4",".m4v",".f4v",".f4a",".m4b",".m4r",".f4b",".mov",".3gp", ".3gp2",".3g2",".3gpp",".3gpp2",".ogg",".oga",".ogv",".ogx",".wmv", ".asf*",".webm",".flv",".avi",".QuickTime",".HDV",".OP1a",".OP-Atom",".MPEG-TS",".wav",".lxf",".gxf" ] list_audio = [ ".mp3",".wav",".m4a",".aac",".he-aac",".ac3",".eac3",".vorbis",".wma",".pcm" ] list_applications = [ ".exe",".lnk" ] list_codes = [ ".c",".py",".java",".cpp",".js",".html",".css",".php" ] list_archives = [ ".zip",".7-zip",".7z",".bz2",".gz",".rar",".tar" ] extensions = { "Images" : list_images, "Documents" : list_documents, "Videos" : list_videos, "Audio" : list_audio, "Applications" : list_applications, "Code" : list_codes, "Archives" : list_archives }
"""Aprimore o desafio anterior, mostrando no final: a) A soma de todos os valores pares digitados b) A soma dos valores da terceira coluna c) O maior valor da segunda linha""" matriz = list() linhas = list() for linha in range(0, 3): for coluna in range(0, 3): valor = int(input(f'Digite o da posição [{linha+1},{coluna+1}]: ')) linhas.append(valor) matriz.append(linhas[:]) linhas.clear() print(30*'=-') soma_par = 0 terc_col = 0 maior_valor = 0 for linha, valor in enumerate(matriz): for i in range(0, 3): print(f'[{valor[i]:^5}]', end='') if valor[i] % 2 == 0: soma_par += valor[i] if i == 2: # Se estamos na TERCEIRA COLUNA terc_col += valor[i] if linha == 1: # Se estamos na SEGUNDA LINHA if i == 0: maior_valor = valor[i] else: if valor[i] > maior_valor: maior_valor = valor[i] print() print(30*'=-') print(f'A soma de todos os valores pares digitados foi {soma_par}.') print(f'A soma dos elementos da TERCEIRA COLUNA foi {terc_col}.') print(f'O MAIOR valor da SEGUNDA LINHA foi {maior_valor}.')
# Least Common Multiple (LCM) Calculator - Burak Karabey def LCM(x, y): if x > y: limit = x else: limit = y prime_numbers = [] # Start of Finding Prime Number if limit < 2: return prime_numbers.append(0) elif limit == 2: return prime_numbers.append(2) else: prime_numbers.append(2) for t in range(3, limit): find_prime = False for r in range(2, t): if t % r == 0: find_prime = True break if not find_prime: prime_numbers.append(t) prime_numbers.sort() # End of Finding Prime Number i = 0 least_common_multiple = 1 while x != 1 or y != 1: if x % prime_numbers[i] == 0 or y % prime_numbers[i] == 0: least_common_multiple = least_common_multiple * prime_numbers[i] if x % prime_numbers[i] == 0: x = x / prime_numbers[i] if y % prime_numbers[i] == 0: y = y / prime_numbers[i] else: i += 1 return print("LCM=", least_common_multiple) # USAGE LCM(12,15)
# -*- coding: utf-8 -*- # See the "Code officiel géographique" on the INSEE website <www.insee.fr>. DEPARTMENT_CHOICES = ( # Metropolitan departments ('01', u'01 - Ain'), ('02', u'02 - Aisne'), ('03', u'03 - Allier'), ('04', u'04 - Alpes-de-Haute-Provence'), ('05', u'05 - Hautes-Alpes'), ('06', u'06 - Alpes-Maritimes'), ('07', u'07 - Ardèche'), ('08', u'08 - Ardennes'), ('09', u'09 - Ariège'), ('10', u'10 - Aube'), ('11', u'11 - Aude'), ('12', u'12 - Aveyron'), ('13', u'13 - Bouches-du-Rhône'), ('14', u'14 - Calvados'), ('15', u'15 - Cantal'), ('16', u'16 - Charente'), ('17', u'17 - Charente-Maritime'), ('18', u'18 - Cher'), ('19', u'19 - Corrèze'), ('2A', u'2A - Corse-du-Sud'), ('2B', u'2B - Haute-Corse'), ('21', u'21 - Côte-d\'Or'), ('22', u'22 - Côtes-d\'Armor'), ('23', u'23 - Creuse'), ('24', u'24 - Dordogne'), ('25', u'25 - Doubs'), ('26', u'26 - Drôme'), ('27', u'27 - Eure'), ('28', u'28 - Eure-et-Loir'), ('29', u'29 - Finistère'), ('30', u'30 - Gard'), ('31', u'31 - Haute-Garonne'), ('32', u'32 - Gers'), ('33', u'33 - Gironde'), ('34', u'34 - Hérault'), ('35', u'35 - Ille-et-Vilaine'), ('36', u'36 - Indre'), ('37', u'37 - Indre-et-Loire'), ('38', u'38 - Isère'), ('39', u'39 - Jura'), ('40', u'40 - Landes'), ('41', u'41 - Loir-et-Cher'), ('42', u'42 - Loire'), ('43', u'43 - Haute-Loire'), ('44', u'44 - Loire-Atlantique'), ('45', u'45 - Loiret'), ('46', u'46 - Lot'), ('47', u'47 - Lot-et-Garonne'), ('48', u'48 - Lozère'), ('49', u'49 - Maine-et-Loire'), ('50', u'50 - Manche'), ('51', u'51 - Marne'), ('52', u'52 - Haute-Marne'), ('53', u'53 - Mayenne'), ('54', u'54 - Meurthe-et-Moselle'), ('55', u'55 - Meuse'), ('56', u'56 - Morbihan'), ('57', u'57 - Moselle'), ('58', u'58 - Nièvre'), ('59', u'59 - Nord'), ('60', u'60 - Oise'), ('61', u'61 - Orne'), ('62', u'62 - Pas-de-Calais'), ('63', u'63 - Puy-de-Dôme'), ('64', u'64 - Pyrénées-Atlantiques'), ('65', u'65 - Hautes-Pyrénées'), ('66', u'66 - Pyrénées-Orientales'), ('67', u'67 - Bas-Rhin'), ('68', u'68 - Haut-Rhin'), ('69', u'69 - Rhône'), ('70', u'70 - Haute-Saône'), ('71', u'71 - Saône-et-Loire'), ('72', u'72 - Sarthe'), ('73', u'73 - Savoie'), ('74', u'74 - Haute-Savoie'), ('75', u'75 - Paris'), ('76', u'76 - Seine-Maritime'), ('77', u'77 - Seine-et-Marne'), ('78', u'78 - Yvelines'), ('79', u'79 - Deux-Sèvres'), ('80', u'80 - Somme'), ('81', u'81 - Tarn'), ('82', u'82 - Tarn-et-Garonne'), ('83', u'83 - Var'), ('84', u'84 - Vaucluse'), ('85', u'85 - Vendée'), ('86', u'86 - Vienne'), ('87', u'87 - Haute-Vienne'), ('88', u'88 - Vosges'), ('89', u'89 - Yonne'), ('90', u'90 - Territoire de Belfort'), ('91', u'91 - Essonne'), ('92', u'92 - Hauts-de-Seine'), ('93', u'93 - Seine-Saint-Denis'), ('94', u'94 - Val-de-Marne'), ('95', u'95 - Val-d\'Oise'), # Overseas departments, communities, and other territories ('971', u'971 - Guadeloupe'), ('972', u'972 - Martinique'), ('973', u'973 - Guyane'), ('974', u'974 - La Réunion'), ('975', u'975 - Saint-Pierre-et-Miquelon'), ('976', u'976 - Mayotte'), ('977', u'977 - Saint-Barthélemy'), ('978', u'978 - Saint-Martin'), ('984', u'984 - Terres australes et antarctiques françaises'), ('986', u'986 - Wallis et Futuna'), ('987', u'987 - Polynésie française'), ('988', u'988 - Nouvelle-Calédonie'), ('989', u'989 - Île de Clipperton'), )
# Dissecando uma Variável '''Faça um programa que leia algo pelo teclado e mostre na tela o seu tipo primitivo e todas as informações possíveis sobre ela''' a = input('Digite algo: ') print('\033[1;30m''O tipo primitivo deste valor é', type(a)) print('Só tem espaços?', a.isspace()) print('É um número?', a.isnumeric()) print('É alfabeto?', a.isalpha()) print('É alfanumério?', a.isalnum()) print('Está em maiúsculas?', a.isupper()) print('Éstá em minúsculas?', a.islower()) print('Éstá capitalizada?', a.istitle())
def is_prime(n): if n <= 1: return False elif n <= 3: return True elif n % 2 == 0 or n % 3 == 0: return False i = 5 while i * i <= n: if n % i == 0 or n % (i + 2) == 0: return False i += 6 return True T = int(input()) for _ in range(T): if is_prime(int(input())): print("Prime") else: print("Not prime")
#!/usr/bin/env python3 sum=0 a=1 while a<=100: sum +=a a+=1 print(sum)
class PositionedObjectError(Exception): def __init__(self, *args): super().__init__(*args) class RelativePositionNotSettableError(PositionedObjectError): pass class RelativeXNotSettableError(RelativePositionNotSettableError): pass class RelativeYNotSettableError(RelativePositionNotSettableError): pass class Positioned(object): def __init__(self, relative_x=None, relative_y=None, *args, **kwargs): self._relative_x = None self._relative_y = None self.relative_x = relative_x self.relative_y = relative_y super().__init__(*args, **kwargs) @property def relative_x(self): if self._relative_x is None: return 0 return self._relative_x @relative_x.setter def relative_x(self, val): self._relative_x = val @property def relative_y(self): if self._relative_y is None: return 0 return self._relative_y @relative_y.setter def relative_y(self, val): self._relative_y = val
# Image types INTENSITY = 'intensity' LABEL = 'label' SAMPLING_MAP = 'sampling_map' # Keys for dataset samples PATH = 'path' TYPE = 'type' STEM = 'stem' DATA = 'data' AFFINE = 'affine' # For aggregator IMAGE = 'image' LOCATION = 'location' # In PyTorch convention CHANNELS_DIMENSION = 1 # Code repository REPO_URL = 'https://github.com/fepegar/torchio/' # Data repository DATA_REPO = 'https://github.com/fepegar/torchio-data/raw/master/data/'
#!/usr/local/bin/python3 # Copyright 2019 NineFx Inc. # Justin Baum # 3 June 2019 # Precis Code-Generator ReasonML # https://github.com/NineFX/smeagol/blob/master/spec/code_gen/precis_cp.txt fp = open('precis_cp.txt', 'r') ranges = [] line = fp.readline() code = "DISALLOWED" prev = "DISALLOWED" firstOccurence = 0 count = 0 while line: count += 1 line = fp.readline() if len(line) < 2: break linesplit = line.split(";") codepoint = int(linesplit[0]) code = linesplit[1][:-1] if code != prev: ranges.append([firstOccurence, codepoint - 1, prev]) firstOccurence = count prev = code ranges.append([firstOccurence, count, code]) # Binary Tree def splitHalf(listy): if(len(listy) <= 2): print("switch (point) { ") for item in listy: print("| point when (point >= " + str(item[0]) + ") && (point <= " + str(item[1]) + ") =>" + item[2]) print("| _point => DISALLOWED") print("}") return splitValue = listy[len(listy)//2] firstHalf = listy[:(len(listy))//2] secondHalf = listy[(len(listy))//2:] print("if (point < "+str(splitValue[0]) +")") print("{") splitHalf(firstHalf) print("} else {") splitHalf(secondHalf) print("}") splitHalf(ranges)
"""Search filters for ExploreCourses queries""" # Term offered AUTUMN = "filter-term-Autumn" WINTER = "filter-term-Winter" SPRING = "filter-term-Spring" SUMMER = "filter-term-Summer" # Teaching presence INPERSON = "filter-instructionmode-INPERSON" ONLINEASYNC = "filter-instructionmode-ONLINEASYNC" ONLINESYNC = "filter-instructionmode-ONLINESYNC" REMOTEASYNC = "filter-instructionmode-REMOTEASYNC" REMOTESYNC = "filter-instructionmode-REMOTESYNC" INDEPENDENTSTDY = "filter-instructionmode-INDEPENDENTSTDY" # Number of units UNITS_1 = "filter-units-1" UNITS_2 = "filter-units-2" UNITS_3 = "filter-units-3" UNITS_4 = "filter-units-4" UNITS_5 = "filter-units-5" UNITS_GT5 = "filter-units-gt5" # Greater than 5 units # Time offered EARLY_MORNING = "filter-time-0" # before 10am MORNING = "filter-time-1" # 10am-12pm LUNCHTIME = "filter-time-2" # 12pm-2pm AFTERNOON = "filter-time-3" # 2pm-5pm EVENING = "filter-time-4" # after 5pm # Days SUNDAY = "filter-day-1" MONDAY = "filter-day-2" TUESDAY = "filter-day-3" WEDNESDAY = "filter-day-4" THURSDAY = "filter-day-5" FRIDAY = "filter-day-6" SATURDAY = "filter-day-7" # UG Requirements WAY_AII = "filter-ger-WAYAII" # Aesthetic and Interpretive Inquiry WAY_AQR = "filter-ger-WAYAQR" # Applied Quantitative Reasoning WAY_CE = "filter-ger-WAYCE" # Creative Expression WAY_ED = "filter-ger-WAYED" # Engaging Diversity WAY_ER = "filter-ger-WAYER" # Ethical Reasoning WAY_FR = "filter-ger-WAYFR" # Formal Reasoning WAY_SI = "filter-ger-WAYSI" # Social Inquiry WAY_SMA = "filter-ger-WAYSMA" # Scientific Method and Analysis LANGUAGE = "filter-ger-Language" WRITING1 = "filter-ger-Writing1" WRITING2 = "filter-ger-Writing2" WRITINGSLE = "filter-ger-WritingSLE" DBHUM = "filter-ger-GERDBHum" DBMATH = "filter-ger-GERDBMath" DBSOCSCI = "filter-ger-GERDBSocSci" DBENGRAPPSCI = "filter-ger-GERDBEngrAppSci" DBNATSCI = "filter-ger-GERDBNatSci" ECETHICREAS = "filter-ger-GERECEthicReas" ECGLOBALCOM = "filter-ger-GERECGlobalCom" ECAMERCUL = "filter-ger-GERECAmerCul" ECGENDER = "filter-ger-GERECGender" IHUM1 = "filter-ger-GERIHUM1" IHUM2 = "filter-ger-GERIHUM2" IHUM3 = "filter-ger-GERIHUM3" # Component LEC = "filter-component-LEC" # Lecture SEM = "filter-component-SEM" # Seminar DIS = "filter-component-DIS" # Discussion Section LAB = "filter-component-LAB" # Laboratory LBS = "filter-component-LBS" # Lab Section ACT = "filter-component-ACT" # Activity CAS = "filter-component-CAS" # Case Study COL = "filter-component-COL" # Colloquium WKS = "filter-component-WKS" # Workshop INS = "filter-component-INS" # Independent Study IDS = "filter-component-IDS" # Intro Dial, Sophomore ISF = "filter-component-ISF" # Intro Sem, Freshman ISS = "filter-component-ISS" # Intro Sem, Sophomore ITR = "filter-component-ITR" # Internship API = "filter-component-API" # Arts Intensive Program LNG = "filter-component-LNG" # Language CLK = "filter-component-CLK" # Clerkship PRA = "filter-component-PRA" # Practicum PRC = "filter-component-PRC" # Practicum RES = "filter-component-RES" # Research SCS = "filter-component-SCS" # Sophomore College TD = "filter-component-TD" # Thesis/Dissertation # Career UG = "filter-academiclevel-UG" # Undergraduate GR = "filter-academiclevel-GR" # Graduate GSB = "filter-academiclevel-GSB" # Graduate School of Business LAW = "filter-academiclevel-LAW" # Law School MED = "filter-academiclevel-MED" # Medical School
# https://leetcode.com/problems/unique-morse-code-words/ class Solution: def uniqueMorseRepresentations(self, words: List[str]) -> int: dictx = {"a": ".-", "b": "-...", "c": "-.-.", "d": "-..", "e": ".", "f": "..-.", "g": "--.", "h": "....", "i": "..", "j": ".---", "k": "-.-", "l": ".-..", "m": "--", "n": "-.", "o": "---", "p": ".--.", "q": "--.-", "r": ".-.", "s": "...", "t": "-", "u": "..-", "v": "...-", "w": ".--", "x": "-..-", "y": "-.--", "z": "--.."} keys = {} for each in words: res = "" for i in range(0, len(each)): res += dictx[each[i]] if res in keys: keys[res] += 1 else: keys[res] = 1 return len(keys.values())
class BadBatchRequestException(Exception): def __init__(self, org, repo, message=None): super() self.org = org self.repo = repo self.message = message class UnknownBatchOperationException(Exception): def __init__(self, org, repo, operation, message=None): super() self.org = org self.repo = repo self.operation = operation class StorageException(Exception): def __init__(self, org, repo, oid, operation, message=None): super() self.org = org self.repo = repo self.oid = oid self.operation = operation self.message = message class AuthException(Exception): def __init__(self, message=None): self.message = message
# Faça um programa que leia algo e diga # seu tipo primitivo e diga todas as informações # possíveis dele do .is num = input('Digite algo:') print('='*40) print('O tipo primitivo do valor {} é {}'.format(num, type(num)))#vamos mandar o pc mostra o tipo primitivo print('*'*10) print('({}) é um número? {}'.format(num, num.isnumeric())) print('*'*10) print('({}) é uma palavra? {}'.format(num, num.isalpha())) print('*'*10) print('({}) está totalmente em maiúsculo? {}'.format(num, num.isupper())) print('*'*10) print('({}) está totalmente em minúsculo? {}'.format(num, num.islower()))
class Agent: def __init__(self, name): self.name = name def reset(self, state): # Completely resets the state of the Agent for a new game return def make_action(self, state): # Returns a valid move in (row, column) format where 0 <= row, column < board_len move = (0, 0) return move def update_state(self, move): # Update the internal state of an agent according to the move made by the opponent (if necessary) return @staticmethod def get_params(): # Get agent parameters from command line input and return in tuple form return ()
""" * * Author: Juarez Paulino(coderemite) * Email: juarez.paulino@gmail.com * """ n=c=0;r=[] for x in map(int,[*open(0)][1].split()): if x<0: if n==2: r+=[c] n=1 c=0 else:n+=1 c+=1 r+=[c] print(len(r)) print(*r)
# # PySNMP MIB module ONEACCESS-SYS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ONEACCESS-SYS-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:25:27 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") ValueRangeConstraint, SingleValueConstraint, ConstraintsUnion, ValueSizeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "SingleValueConstraint", "ConstraintsUnion", "ValueSizeConstraint", "ConstraintsIntersection") oacExpIMSystem, oacMIBModules = mibBuilder.importSymbols("ONEACCESS-GLOBAL-REG", "oacExpIMSystem", "oacMIBModules") ModuleCompliance, ObjectGroup, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "ObjectGroup", "NotificationGroup") Bits, IpAddress, Gauge32, Integer32, TimeTicks, MibIdentifier, Unsigned32, Counter32, Counter64, iso, ModuleIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, NotificationType = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "IpAddress", "Gauge32", "Integer32", "TimeTicks", "MibIdentifier", "Unsigned32", "Counter32", "Counter64", "iso", "ModuleIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "NotificationType") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") oacSysMIBModule = ModuleIdentity((1, 3, 6, 1, 4, 1, 13191, 1, 100, 671)) oacSysMIBModule.setRevisions(('2014-05-05 00:01', '2011-06-15 00:00', '2010-12-14 00:01', '2010-08-11 10:00', '2010-07-08 10:00',)) if mibBuilder.loadTexts: oacSysMIBModule.setLastUpdated('201405050001Z') if mibBuilder.loadTexts: oacSysMIBModule.setOrganization(' OneAccess ') class OASysHwcClass(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2)) namedValues = NamedValues(("board", 0), ("cpu", 1), ("slot", 2)) class OASysHwcType(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6)) namedValues = NamedValues(("mainboard", 0), ("microprocessor", 1), ("ram", 2), ("flash", 3), ("dsp", 4), ("uplink", 5), ("module", 6)) class OASysCoreType(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3)) namedValues = NamedValues(("controlplane", 0), ("dataforwarding", 1), ("application", 2), ("mixed", 3)) oacExpIMSysStatistics = MibIdentifier((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1)) oacExpIMSysHardwareDescription = MibIdentifier((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2)) oacSysMemStatistics = MibIdentifier((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 1)) oacSysCpuStatistics = MibIdentifier((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 2)) oacSysSecureCrashlogCount = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 100), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: oacSysSecureCrashlogCount.setStatus('current') oacSysStartCaused = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 200), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: oacSysStartCaused.setStatus('current') oacSysIMSysMainBoard = MibIdentifier((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 1)) oacExpIMSysHwComponents = MibIdentifier((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 2)) oacExpIMSysFactory = MibIdentifier((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 3)) oacSysIMSysMainIdentifier = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 1, 1), ObjectIdentifier()).setMaxAccess("readonly") if mibBuilder.loadTexts: oacSysIMSysMainIdentifier.setStatus('current') oacSysIMSysMainManufacturedIdentity = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: oacSysIMSysMainManufacturedIdentity.setStatus('current') oacSysIMSysMainManufacturedDate = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: oacSysIMSysMainManufacturedDate.setStatus('current') oacSysIMSysMainCPU = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 1, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: oacSysIMSysMainCPU.setStatus('current') oacSysIMSysMainBSPVersion = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 1, 5), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: oacSysIMSysMainBSPVersion.setStatus('current') oacSysIMSysMainBootVersion = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 1, 6), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: oacSysIMSysMainBootVersion.setStatus('current') oacSysIMSysMainBootDateCreation = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 1, 7), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: oacSysIMSysMainBootDateCreation.setStatus('current') oacSysMemoryFree = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 1, 1), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: oacSysMemoryFree.setStatus('current') oacSysMemoryAllocated = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 1, 2), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: oacSysMemoryAllocated.setStatus('current') oacSysMemoryTotal = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 1, 3), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: oacSysMemoryTotal.setStatus('current') oacSysMemoryUsed = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 1, 4), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: oacSysMemoryUsed.setStatus('current') oacSysCpuUsed = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 2, 1), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: oacSysCpuUsed.setStatus('current') oacSysCpuUsedCoresCount = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 2, 2), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: oacSysCpuUsedCoresCount.setStatus('current') oacSysCpuUsedCoresTable = MibTable((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 2, 3), ) if mibBuilder.loadTexts: oacSysCpuUsedCoresTable.setStatus('current') oacSysCpuUsedCoresEntry = MibTableRow((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 2, 3, 1), ).setIndexNames((0, "ONEACCESS-SYS-MIB", "oacSysCpuUsedIndex")) if mibBuilder.loadTexts: oacSysCpuUsedCoresEntry.setStatus('current') oacSysCpuUsedIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 2, 3, 1, 1), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: oacSysCpuUsedIndex.setStatus('current') oacSysCpuUsedCoreType = MibTableColumn((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 2, 3, 1, 2), OASysCoreType()).setMaxAccess("readonly") if mibBuilder.loadTexts: oacSysCpuUsedCoreType.setStatus('current') oacSysCpuUsedValue = MibTableColumn((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 2, 3, 1, 3), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: oacSysCpuUsedValue.setStatus('current') oacSysCpuUsedOneMinuteValue = MibTableColumn((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 2, 3, 1, 4), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: oacSysCpuUsedOneMinuteValue.setStatus('current') oacSysLastRebootCause = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 1, 3), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: oacSysLastRebootCause.setStatus('current') oacExpIMSysHwComponentsCount = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 2, 1), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: oacExpIMSysHwComponentsCount.setStatus('current') oacExpIMSysHwComponentsTable = MibTable((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 2, 2), ) if mibBuilder.loadTexts: oacExpIMSysHwComponentsTable.setStatus('current') oacExpIMSysHwComponentsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 2, 2, 1), ).setIndexNames((0, "ONEACCESS-SYS-MIB", "oacExpIMSysHwcIndex")) if mibBuilder.loadTexts: oacExpIMSysHwComponentsEntry.setStatus('current') oacExpIMSysHwcIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 2, 2, 1, 1), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: oacExpIMSysHwcIndex.setStatus('current') oacExpIMSysHwcClass = MibTableColumn((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 2, 2, 1, 2), OASysHwcClass()).setMaxAccess("readonly") if mibBuilder.loadTexts: oacExpIMSysHwcClass.setStatus('current') oacExpIMSysHwcType = MibTableColumn((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 2, 2, 1, 3), OASysHwcType()).setMaxAccess("readonly") if mibBuilder.loadTexts: oacExpIMSysHwcType.setStatus('current') oacExpIMSysHwcDescription = MibTableColumn((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 2, 2, 1, 4), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: oacExpIMSysHwcDescription.setStatus('current') oacExpIMSysHwcSerialNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 2, 2, 1, 5), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: oacExpIMSysHwcSerialNumber.setStatus('current') oacExpIMSysHwcManufacturer = MibTableColumn((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 2, 2, 1, 6), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: oacExpIMSysHwcManufacturer.setStatus('current') oacExpIMSysHwcManufacturedDate = MibTableColumn((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 2, 2, 1, 7), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 10))).setMaxAccess("readonly") if mibBuilder.loadTexts: oacExpIMSysHwcManufacturedDate.setStatus('current') oacExpIMSysHwcProductName = MibTableColumn((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 2, 2, 1, 8), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: oacExpIMSysHwcProductName.setStatus('current') oacExpIMSysFactorySupplierID = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 3, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 14))).setMaxAccess("readonly") if mibBuilder.loadTexts: oacExpIMSysFactorySupplierID.setStatus('current') oacExpIMSysFactoryProductSalesCode = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 3, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 22))).setMaxAccess("readonly") if mibBuilder.loadTexts: oacExpIMSysFactoryProductSalesCode.setStatus('current') oacExpIMSysFactoryHwRevision = MibScalar((1, 3, 6, 1, 4, 1, 13191, 10, 3, 3, 2, 3, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(2, 7))).setMaxAccess("readonly") if mibBuilder.loadTexts: oacExpIMSysFactoryHwRevision.setStatus('current') mibBuilder.exportSymbols("ONEACCESS-SYS-MIB", oacSysCpuUsed=oacSysCpuUsed, oacSysCpuUsedValue=oacSysCpuUsedValue, OASysCoreType=OASysCoreType, oacSysCpuUsedIndex=oacSysCpuUsedIndex, oacExpIMSysHwcManufacturedDate=oacExpIMSysHwcManufacturedDate, oacSysCpuUsedOneMinuteValue=oacSysCpuUsedOneMinuteValue, oacSysIMSysMainIdentifier=oacSysIMSysMainIdentifier, oacSysCpuUsedCoresEntry=oacSysCpuUsedCoresEntry, oacSysCpuStatistics=oacSysCpuStatistics, oacExpIMSysFactorySupplierID=oacExpIMSysFactorySupplierID, OASysHwcClass=OASysHwcClass, oacSysIMSysMainCPU=oacSysIMSysMainCPU, oacExpIMSysHwcProductName=oacExpIMSysHwcProductName, oacExpIMSysStatistics=oacExpIMSysStatistics, oacSysMemoryFree=oacSysMemoryFree, oacSysMIBModule=oacSysMIBModule, oacSysMemoryAllocated=oacSysMemoryAllocated, oacSysMemStatistics=oacSysMemStatistics, oacExpIMSysHwcSerialNumber=oacExpIMSysHwcSerialNumber, oacSysMemoryUsed=oacSysMemoryUsed, oacExpIMSysHwComponentsTable=oacExpIMSysHwComponentsTable, oacSysMemoryTotal=oacSysMemoryTotal, oacSysCpuUsedCoresTable=oacSysCpuUsedCoresTable, oacExpIMSysHardwareDescription=oacExpIMSysHardwareDescription, oacSysIMSysMainManufacturedIdentity=oacSysIMSysMainManufacturedIdentity, oacSysIMSysMainBoard=oacSysIMSysMainBoard, oacSysIMSysMainBootDateCreation=oacSysIMSysMainBootDateCreation, oacExpIMSysHwcDescription=oacExpIMSysHwcDescription, oacSysIMSysMainBootVersion=oacSysIMSysMainBootVersion, oacExpIMSysHwcClass=oacExpIMSysHwcClass, PYSNMP_MODULE_ID=oacSysMIBModule, oacSysCpuUsedCoreType=oacSysCpuUsedCoreType, oacExpIMSysHwComponentsCount=oacExpIMSysHwComponentsCount, oacExpIMSysFactoryProductSalesCode=oacExpIMSysFactoryProductSalesCode, oacSysIMSysMainBSPVersion=oacSysIMSysMainBSPVersion, oacSysStartCaused=oacSysStartCaused, oacExpIMSysHwComponents=oacExpIMSysHwComponents, oacExpIMSysFactory=oacExpIMSysFactory, oacSysIMSysMainManufacturedDate=oacSysIMSysMainManufacturedDate, oacSysCpuUsedCoresCount=oacSysCpuUsedCoresCount, oacExpIMSysHwcIndex=oacExpIMSysHwcIndex, OASysHwcType=OASysHwcType, oacSysLastRebootCause=oacSysLastRebootCause, oacExpIMSysFactoryHwRevision=oacExpIMSysFactoryHwRevision, oacExpIMSysHwComponentsEntry=oacExpIMSysHwComponentsEntry, oacExpIMSysHwcType=oacExpIMSysHwcType, oacExpIMSysHwcManufacturer=oacExpIMSysHwcManufacturer, oacSysSecureCrashlogCount=oacSysSecureCrashlogCount)
#!/usr/bin/env python # -*- coding: utf-8 -*- class GitCommandError(Exception): """ Exception which can be raised when git exits with a non-zero exit code. """ pass class InvalidUpgradePath(Exception): """ Exception which is thrown if an invalid upgrade path is detected. This is usually when attempting to upgrade to a version before the one that is already the latest version. """ pass class DuplicateGitReference(Exception): """ Exception which is thrown when unable to create a tag/branch/etc. as it already exists in the repo. """ pass class InvalidGitReference(Exception): """ Exception which is thrown when unable to find a given git reference in the repo. """ pass
TOKEN = b'd4r3d3v!l' def chall(): s = Sign() while True: choice = input("> ").rstrip() if choice == 'P': print("\nN : {}".format(hex(s.n))) print("\ne : {}".format(hex(s.e))) elif choice == 'S': try: msg = bytes.fromhex(input('msg to sign : ')) if TOKEN in msg: print('[!] NOT ALLOWED') else: m = bytes_to_long(msg) print("\nsignature : {}".format(hex(s.sign(m)))) #pow(msg,d,n) print('\n') except: print('\n[!] ERROR (invalid input)') elif choice == 'V': try: msg = bytes.fromhex(input("msg : ")) m = bytes_to_long(msg) signature = int(input("signature : "),16) if m < 0 or m > s.n: print('[!] ERROR') if s.verify(m, signature): #pow(sign, e, n) == msg if long_to_bytes(m) == TOKEN: print(SECRET) else: print('\n[+] Valid signature') else: print('\n[!]Invalid signature') except: print('\n[!] ERROR(invalid input)') elif choice == 'Q': print('OK BYE :)') exit(0) else: print('\n[*] SEE OPTIONS')
# Python Class 2406 # Lesson 12 Problem 1 # Author: snowapple (471208) class Game: def __init__(self, n): '''__init__(n) -> Game creates an instance of the Game class''' if n% 2 == 0: #n has to be odd print('Please enter an odd n!') raise ValueError self.n = n #size of side of board self.board = [[0 for x in range(self.n)] for x in range(self.n)] #holds current state of the board, list of columns self.is_won = 0#is_won is 0 if game is not won, and 1 or 2 if won by player 1 or 2 respectively def __str__(self): '''__str__() -> str returns a str representation of the current state of the board''' ans = "" print_dict = {0:'. ', 1:'X ', 2:'O '} #On the board, these numbers represent the pieces for i in range(self.n):#row row = "" for j in range(self.n):#column row += print_dict[self.board[j][i]] #prints the board piece to where the player puts it ans = row + "\n" + ans title = "" for i in range(self.n): title += str(i) + " " ans = '\n' + title + '\n' +ans return ans def clear_board(self): '''clear_board() -> none clears the board by setting all entries to 0''' self.is_won = 0 self.board = [[0 for x in range(self.n)] for x in range(self.n)] def put(self,player_num,column):#takes care of errors '''put(player_num,column) -> boolean puts a piece of type player_num in the specified column, returns boolean which is true if the put was successful, otherwise false''' if self.is_won != 0: #if the game has been won print('Please start a new game as player ' + str(self.is_won) + ' has already won!') return False if player_num not in [1,2]: #if a valid player number is not entered print('Please enter 1 or 2 for the player number!') return False if column < 0 or column >= self.n: #if a valid column is not entered print('Please enter a valid column!') return False try: row = self.board[column].index(0) self.board[column][row]= player_num self.is_won = self.win_index(column,row) return True except ValueError: print('Column is full!') return False def win_index(self,column_index,row_index): '''win_index(column_index,row_index) -> int checks if piece at (column_index, row_index) is part of a connect 4 returns player_num if the piece is part of a connect4, and 0 otherwise''' #uses axis_check to check all of the axes player_num = self.board[column_index][row_index] #check up/down axis col = self.board[column_index] col_win = self.axis_check(col,row_index,player_num) #checks the row since it goes up/down if col_win != 0: #checks to see if won return col_win #check left/right axis row = [self.board[i][row_index] for i in range(self.n)] row_win = self.axis_check(row,column_index,player_num) #checks column since it goes left/right if row_win != 0: #checks to see if won return row_win #down-left/up-right diagonal axis axis = [player_num] index = 0 #down-left part curr_col_index = column_index - 1 #goes left so subtract one curr_row_index = row_index - 1 #goes down so subtract one while curr_row_index >= 0 and curr_col_index >= 0: #until you go to the most down-left part of the board axis = [self.board[curr_col_index][curr_row_index]] + axis curr_col_index -= 1 curr_row_index -= 1 index += 1 #up-right part curr_col_index = column_index + 1 #goes right so add one curr_row_index = row_index + 1 #goes up so add one while curr_row_index < self.n and curr_col_index < self.n: #until you go to the most up-right part of the board axis = axis +[self.board[curr_col_index][curr_row_index]] curr_col_index += 1 curr_row_index += 1 diag_win = self.axis_check(axis,index,player_num) if diag_win != 0: #checks to see if won return diag_win #up-left/down-right diagonal axis axis = [player_num] index = 0 #up-left part curr_col_index = column_index - 1 #goes left so minus one curr_row_index = row_index + 1 #goes up so plus one while curr_row_index < self.n and curr_col_index >= 0: #until you go to the most up-left part of the board axis = [self.board[curr_col_index][curr_row_index]] + axis curr_col_index -= 1 curr_row_index += 1 index += 1 #down-right part curr_col_index = column_index + 1 #goes right so plus one curr_row_index = row_index - 1 # goes down so minus one while curr_row_index >= 0 and curr_col_index < self.n: #until you go to the most down-right part of the board axis = axis +[self.board[curr_col_index][curr_row_index]] curr_col_index += 1 curr_row_index -= 1 diag_win = self.axis_check(axis,index,player_num) if diag_win != 0: #checks to see if won return diag_win return 0 def axis_check(self,axis, index, player_num): '''axis_check(axis, index, player_num) -> int checks if index in axis (list) is part of a connect4 returns player_num if the index is indeed part of a connect4 and 0 otherwise''' #takes the index and sees if the piece is part of a connect four and generalizes it for the four axes(up/down, left/right, two diagonals) down = index up = index for i in range(index,-1, -1): if axis[i] == player_num: down = i else: break for i in range(index,len(axis)): if axis[i] == player_num: up = i else: break if up - down + 1 >= 4: # print('Player ' + str(player_num) + ' has won the game!') return player_num return 0 game = Game(7) labels = {1:'X', 2:'O'} play = True while play: #setting up the board and players game.clear_board() name1 = input('Player ' + labels[1] + ' , enter your name: ') name2 = input('Player ' + labels[2] + ' , enter your name: ') names = {1:name1, 2:name2} print(game) turn = 1 while game.is_won == 0: success = False while not success: #until someone wins each player takes turns col_choice = int(input(names[turn] + ", you're " + labels[turn] + ". What column do you want to play in? ")) success = game.put(turn,col_choice) print(game) turn = turn % 2 +1 #to take turns between players print("Congratulations, " + names[game.is_won]+", you won!") #if players want to play again play_another = "" while play_another not in ['y','n']: play_another = input("Do you want to play another game? [Enter 'y' for yes, 'n' for no]: ") if play_another == 'n': play = False
""" Challenge - Program Flow # TODO: Create a program that takes an IP address entered at the keyboard and prints out the number of segments it contains, and the length of each segment. An IP address consists of 4 numbers, separated from each other with a full stop. But your program should just count however many are entered. Examples of the input you may get are: 127.0.0.1 .192.168.0.1 10.0.123456.255 172.16 255 So your program should work even with invalid IP Addresses. We're just interested in the number of segments and how long each one is. Once you have a working program, here are some more suggestions for invalid input to test: .123.45.678.91 123.4567.8.9. 123.156.289.10123456 10.10t.10.10 12.9.34.6.12.90 '' - that is, press enter without typing anything # *! This challenge is intended to practise for loops and if/else statements, so although you could use other techniques (such as splitting the string up), that's not the approach we're looking for here. """ print("An IP address consists of 4 numbers, separated from each other with a full stop.\n") ip = input("Enter IP address: ") if ip[-1] != ".": ip += "." segment = 1 segment_lenght = 0 character = "" for character in ip: if character == ".": print("Segment {} contains {} characters".format(segment, segment_lenght)) segment += 1 segment_lenght = 0 else: segment_lenght += 1
def BFS(graph,root,p1,max1): checked = [] visited=[] energy=[] level=[] l=[] l.append(root) level.append(l) checked.append(root) inienergy=14600 threshold=10 l1=0 flag=0 energy.append(inienergy) while(len(checked)>0): l1=l1+1 #print "level"+str(l1) v=checked.pop(0) e1=energy.pop(0) while v in visited: #print "ll" if(len(checked)>0): v=checked.pop(0) if len(checked)==0: flag=1 break if(flag==1): break # print "kk" visited.append(v) l=[] #print str(v)+"-->" if(float(e1)/float(len(graph[v])) >= float(threshold)): for edge in graph[v]: #print edge if edge not in checked: checked.append(edge) energy.append(float(e1*A[v][edge]/(len(graph[v])*max1))) str1="v"+str(v)+","+"v"+str(edge)+","+"false"+","+str(A[v][edge])+","+"true\n" fil_out.write(str1) for edge in level[(len(level)-1)]: l=list(set(graph[edge])|set(l)) #print "l "+str(l) for i in range(len(level)): for j in level[i]: if j in l: l.remove(j) if len(l)>0: level.append(l) f = open('dsfull1.gdf') text=f.read() p1=text.split('\n') V=[] flag=0 for each_line in p1: l=each_line.split(',') if len(l)==2: if flag!=0: #print(l[0]) V.append(int(l[0][1:])) flag=1 else: break A = [[0 for x in range(len(V))] for x in range(len(V))] flag=0 max1=-1 for each_line in p1: l=each_line.split(',') if len(l)==5: if flag!=0: #print(l[0],l[1],l[3]) A[int(l[0][1:])][int(l[1][1:])]=float(l[3]) #if(float(l[3]>max)): # max1=float(l[3]) flag=1 else: continue #print max1 graph = [[] for x in range(len(V))] flag=0 i=0 x=0 for each_line in p1: l=each_line.split(',') if len(l)==5: if flag!=0: #print(l[0],l[1],l[3]) #A[int(l[0][1:])][int(l[1][1:])]=float(l[3]) graph[int(l[0][1:])].append(int(l[1][1:])) flag=1 else: continue root=154 #print(len(graph[root])) fil_out=open("sub5.gdf",'w') fil_out1=open("ds2.txt","w") fil_out.write("nodedef> name,label\n") for i in range(0,len(V)): fil_out.write(p1[i+1]+'\n') fil_out.write("edgedef>node1,node2,directed,weight,labelvisible\n") h=p1[root+1].split(',') fil_out1.write(str(h[1])+",") BFS(graph,root,p1,max1) fil_out.close() f.close()
s="this this is a a cat cat cat ram ram jai it" l=[] count=[] i=0 #j=0 str="" for i in s: #print(i,end="") if i==" ": if str in l: for j in range(len(l)): if str == l[j]: count[j] += 1 str="" continue else: l.append(str) count.append(1) str="" continue str=str+i print(l) print(count)
class LRUCache: def __init__(self, capacity: int): self.db = dict() self.capacity = capacity self.time = 0 def get(self, key: int) -> int: if key in self.db: self.db[key][1] = self.time self.time += 1 return self.db[key][0] else: return -1 def put(self, key: int, value: int) -> None: if key in self.db: self.db[key] = [value, self.time] else: if len(self.db.keys()) < self.capacity: self.db[key] = [value, self.time] else: # evict LRU evict_key = sorted(self.db.items(), key=lambda x: x[1][1])[0][0] del self.db[evict_key] self.db[key] = [value, self.time] self.time += 1 # Your LRUCache object will be instantiated and called as such: # obj = LRUCache(capacity) # param_1 = obj.get(key) # obj.put(key,value)
# 2021.04.14 # Problem Statement: # https://leetcode.com/problems/majority-element/ class Solution: def majorityElement(self, nums: List[int]) -> int: # trivial question, no need to explain if len(nums) == 1: return nums[0] dict = {} for element in nums: if element not in dict.keys(): dict[element] = 1 else: dict[element] = dict[element] + 1 if dict[element] >= (len(nums)//2 + 1): return element
def ParseGraphVertexEdge(file): with open(file, 'r') as fw: read_data = fw.read() res = read_data.splitlines(False) def ParseV(v_str): ''' @type v_str: string :param v_str: :return: ''' return [int(i) for i in v_str.split()] v = int(res[0]) edges = [ParseV(vstr) for vstr in res[1:]] return v, edges if __name__ == '__main__': v, edges = ParseGraphVertexEdge('graph.in') print(v, edges)
def kIsClicked(): print("Character moves right ") def hUsClikced(): print("Charater moves left") keepGoing = True #boolean = 뭐냐면 TRUE 또는 False냐의 변수 while True: userInput = input("which number do you want to choose? (1~9) type 9 ") if userInput == "k": kIsClicked() elif userInput == "9": print("Finished") break else: break
# -*- coding: utf-8 -*- """ Created on Sat Nov 3 13:54:22 2018 @author: David """ mainmenu = ["1:Add a new item ", "2:Move an item", "3:search an item", "4:view the inventory of a warehouse", "0: exit the system"] def menu(): # display a main menu for i in mainmenu: print(i) # get the choice from the keyboard c = input("please choose a number or press any other key to return:") if c == '1': addNewItem() elif c == '2': moveItem() elif c == '3': searchItem() elif c == '4': viewInventory() elif c == '0': exit(0) else: menu() def viewInventory(): c = input("choose the warehouse that you want ro view or press any other key to go back to main menu") if c == 'A': print(WarehouseA) elif c == 'B': print(WarehouseB) elif c == 'C': print(WarehouseC) elif c == 'D': print(WarehouseD) else: menu()
# @Title: 删除排序链表中的重复元素 II (Remove Duplicates from Sorted List II) # @Author: 18015528893 # @Date: 2021-02-12 21:18:52 # @Runtime: 56 ms # @Memory: 14.9 MB # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def deleteDuplicates(self, head: ListNode) -> ListNode: if head is None or head.next is None: return head dummy = ListNode(next=head) cur = dummy while cur and cur.next and cur.next.next: if cur.next.val == cur.next.next.val: tmp = cur.next val = tmp.val while tmp and tmp.val == val: tmp = tmp.next cur.next = tmp else: cur = cur.next return dummy.next
"""Tools to manage census tables.""" POSTGRES_COLUMN_NAME_LIMIT = 63 def _verified_column_name(column_name, limit=POSTGRES_COLUMN_NAME_LIMIT): if len(column_name) > limit: raise Exception('Column name {} is too long. Postgres limit is {}.'.format( column_name, limit)) return column_name def readable_columns_from_census_mapping(census_mapping): census_columns = [ '{key} AS {unique_column_name}'.format( key=group, unique_column_name=_verified_column_name( census_mapping[category][group]['joined_column_name'] ) ) for category in census_mapping for group in census_mapping[category] ] return census_columns
class Solution: def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float: n = len(nums1) m = len(nums2) if (n > m): return self.findMedianSortedArrays(nums2, nums1) start = 0 end = n realmidinmergedarray = (n + m + 1) // 2 while (start <= end): mid = (start + end) // 2 leftAsize = mid leftBsize = realmidinmergedarray - mid leftA = nums1[leftAsize - 1] if (leftAsize > 0) else float('-inf') leftB = nums2[leftAsize - 1] if (leftBsize > 0) else float('-inf') rightA = nums1[leftAsize] if (leftAsize < n) else float('inf') rightB = nums2[leftAsize] if (leftBsize < m) else float('inf') if leftA <= rightB and leftB <= rightA: if ((m + n) % 2 == 0): return (max(leftA, leftB) + min(rightA, rightB)) / 2.0 return max(leftA, leftB) elif (leftA > rightB): end = mid - 1 else: start = mid + 1 # Driver code ans = Solution() arr1 = [-5, 3, 6, 12, 15] arr2 = [-12, -10, -6, -3, 4, 10] print("Median of the two arrays is {}".format(ans.Median(arr1, arr2)))
data_rows = [2, 3, 4, 5, 7, 8, 9, 10, 11, 13, 14, 16, 18, 20, 22, 24, 25, 27] data_rows_cool = [2, 3, 4, 6, 7, 8, 10, 12, 14] hig_temp_techs = [2, 7, 8, 13, 14, 16, 18, 20, 22] med_temp_techs = [3, 4, 5, 9, 10, 11] low_temp_techs = [24, 25] no_imput_rows_color = [232, 232, 232]
def letter_counter(token, word): count = 0 for letter in word: if letter == token: count = count + 1 else: continue return count
class ExceptionBase(Exception): """Base exception.""" message: str def __init__(self, message: str) -> None: super().__init__(message) self.message = message class InvalidPduState(ExceptionBase): """Thrown during PDU self-validation.""" def __init__(self, message: str, pdu) -> None: super().__init__(message=message) self.pdu = pdu class InvalidFrame(ExceptionBase): """Thrown during framing when a message cannot be extracted from a frame buffer.""" frame: bytes def __init__(self, message: str, frame: bytes) -> None: super().__init__(message=message) self.frame = frame
@React.command() async def redirect(ctx, *, url): await ctx.message.delete() try: embed = discord.Embed(color=int(json.load(open(f'./Themes/{json.load(open("config.json"))["theme"]}.json'))['embed_color'].replace('#', '0x'), 0), title='Redirect Checker') embed.set_thumbnail(url=json.load(open(f'./Themes/{json.load(open("config.json"))["theme"]}.json'))['embed_thumbnail_url']) embed.set_footer(text=json.load(open(f'./Themes/{json.load(open("config.json"))["theme"]}.json'))['embed_footer'], icon_url=json.load(open(f'./Themes/{json.load(open("config.json"))["theme"]}.json'))['embed_footer_url']) result = json.loads(requests.get(f"https://api.redirect-checker.net/?url={url}&timeout=5&maxhops=10&meta-refresh=1&format=json").text) for i in range(len(result['data'])): embed.add_field(name=f"__Redirect #{i + 1}__", value=f"{result['data'][i]['request']['info']['url']}", inline=False) await ctx.send(embed=embed, delete_after=json.load(open('config.json'))['delete_timeout']) except Exception as e: await ctx.send(f"Error: {e}")
arq_entrada = open("FORMAT.FLC", 'r') conjunto_entradas = \ {'SISTEMA FUZZY': '', 'CONJUNTO FUZZY': '', 'GRANULARIDADE': 3, 'OPERADOR COMPOSICAO': '', 'OPERADOR AGREGACAO': '', 'INFERENCIA': '', 'REGRA': False, 'DEFAULT': ''} for linha in arq_entrada.readlines(): #print(linha) variavel = linha.split(':')[0] valor = linha.split(':')[1].split('#')[0] conjunto_entradas[variavel] = valor print(conjunto_entradas)
num = 1 num = 2 num = 3 num = 4 num = 5
# The MIT License (MIT) # # Copyright (c) 2016 Adam Schubert # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. class MissingFieldException(Exception): """ Exception for cases when something is missing """ def __init__(self, message): """Initialize MissingFieldException Args: message: Message of exception """ super(MissingFieldException, self).__init__( "Field '{}' not found.".format(message)) class FormatException(Exception): """ Exception for cases when something has wrong format """ pass class WrongArgumentException(Exception): """ Exception for cases when wrong argument is passed """ pass
class Parser: def __init__(self, file_path): self.dottedproductions = {'S\'': [['.', 'S']]} file_program = self.read_program(file_path) self.terminals = file_program[0] self.nonTerminals = file_program[1] self.productions = {} self.transactions = file_program[2:] for elements in self.transactions: if elements[0] in self.productions: self.productions[elements[0]].append(elements[1:]) else: self.productions[elements[0]] = [elements[1:]] self.data = [self.terminals, self.nonTerminals, self.productions] dotted = self.dotMaker() self.initial_closure = {"S'": [dotted["S'"][0]]} self.closure(self.initial_closure, dotted, dotted["S'"][0]) def dotMaker(self): self.dottedproductions = {'S\'': [['.', 'S']]} for nonTerminal in self.productions: self.dottedproductions[nonTerminal] = [] for way in self.productions[nonTerminal]: self.dottedproductions[nonTerminal].append(["."] + way) return self.dottedproductions def closure(self, closure_map, transitions_map, transition_value): dot_index = transition_value.index(".") if dot_index + 1 == len(transition_value): return after_dot = transition_value[dot_index + 1] if after_dot in self.nonTerminals: non_terminal = after_dot if non_terminal not in closure_map: closure_map[non_terminal] = transitions_map[non_terminal] else: closure_map[non_terminal] += transitions_map[non_terminal] for transition in transitions_map[non_terminal]: self.closure(closure_map, transitions_map, transition) @staticmethod def shiftable(transition): dot_index = transition.index(".") if len(transition) > dot_index + 1: return True return False @staticmethod def shift_dot(transition): transition = transition[:] dot_index = transition.index(".") if not Parser.shiftable(transition): raise Exception("Should I shift it back ?") if len(transition) > dot_index + 2: remainder = transition[dot_index + 2:] else: remainder = [] transition = transition[:dot_index] + [transition[dot_index + 1]] + ["."] + remainder return transition def canonical_collection(self): self.idk = {} self.queue = [{ "state": self.initial_closure, "initial_dotted": self.dottedproductions, }] self.states = [] self.state_parents = {} while len(self.queue) > 0: self.goto_all(**self.queue.pop(0)) reduced = self.get_reduced() for k in reduced: red_k = list(reduced[k].keys()) if red_k[0] != "S'": trans = red_k + reduced[k][red_k[0]][0][:-1] reduce_index = self.transactions.index(trans) + 1 self.idk[k] = {terminal: f"r{reduce_index}" for terminal in self.terminals} self.idk[k]["$"] = f"r{reduce_index}" else: self.idk[k] = {"$": "accept"} del self.state_parents[0] for key in self.state_parents: parent = self.state_parents[key] if parent["parent_index"] in self.idk: self.idk[parent["parent_index"]][parent["before_dot"]] = key else: self.idk[parent["parent_index"]] = {parent["before_dot"]: key} table = {f"I{index}": self.idk[index] for index in range(len(self.states))} self.print_dict(table, "Table:") def goto_all(self, state, initial_dotted, parent=-1, parent_key="-1"): if state not in self.states: self.states.append(state) index = len(self.states) - 1 self.state_parents[index] = { "parent_index": parent, "before_dot": parent_key } {}.items() self.print_dict(state, f"state {index}") for key in state: for transition in state[key]: if self.shiftable(transition): self.goto_one(initial_dotted, key, transition, index) else: if parent in self.idk: self.idk[parent][parent_key] = self.states.index(state) else: self.idk[parent] = {parent_key: self.states.index(state)} def goto_one(self, initial_dotted, key, state, parent=-1): shifted_transition = self.shift_dot(state) closure_map = {key: [shifted_transition]} self.closure(closure_map, initial_dotted, shifted_transition) self.queue.append({ "state": closure_map, "initial_dotted": initial_dotted, "parent": parent, "parent_key": shifted_transition[shifted_transition.index(".") - 1] }) def get_reduced(self): self.reduced = {} for state in self.states: state_key = list(state.keys())[0] if len(state) == 1 and len(state[state_key]) and len(state[state_key][0]) \ and state[state_key][0][-1] == ".": self.reduced[self.states.index(state)] = state return self.reduced @staticmethod def read_program(file_path): file1 = open(file_path, 'r') lines = file1.readlines() file1.close() return [line.replace("\n", "").replace("\t", "").split(" ") for line in lines] @staticmethod def print_dict(hashmap, message=None, deepness=""): if message is not None: print(deepness + message) for key in hashmap: print(f"{deepness}{key} : {hashmap[key]}") def print_data(self, index=-1): if index == -1: exit() else: print(self.data[index - 1]) def print_production(self, non_terminal): data = self.data[2] if non_terminal in data: for row in data[non_terminal]: print(f"{non_terminal} -> {row}") else: print("Wrong non terminal!")
class instancemethod(object): def __init__(self, func): self._func = func def __get__(self, obj, type_=None): return lambda *args, **kwargs: self._func(obj, *args, **kwargs) class Func(object): def __init__(self): pass def __call__(self, *args, **kwargs): return self, args, kwargs class A(object): def __init__(self): pass f1 = classmethod(Func()) f2 = instancemethod(Func()) a = A() print(a.f1(10, 20)) print(a.f2(10, 20)) print(A.f1(10, 20))
#!/usr/bin/env python # https://adventofcode.com/2020/day/1 # Topic: Report repair my_list = [] with open("../data/1.puzzle.txt") as fp: Lines = fp.readlines() for line in Lines: my_list.append(int(line)) my_list.sort() num1 = 0 num2 = 0 for idx, x in enumerate(my_list): for y in range(0, len(my_list) - idx): if x + my_list[len(my_list) - 1 - y] == 2020: num1 = x num2 = my_list[len(my_list) - 1 - y] sum = num1 * num2 assert sum == 121396 num3 = 0 for x in my_list: for y in my_list: for z in my_list: if x + y + z == 2020: num1 = x num2 = y num3 = z sum = num1 * num2 * num3 assert sum == 73616634
class MasterConfig: def __init__(self, args): self.IP = args.ip self.PORT = args.port self.PERSISTENCE_DIR = args.persistence_dir self.SENDER_QUEUE_LENGTH = args.sender_queue_length self.SENDER_TIMEOUT = args.sender_timeout self.UI_PORT = args.ui_port self.CPU_PERCENT_THRESHOLD = 25.0
'''knot> pytest tests ''' def test_noting(): assert True
#!/usr/bin/env python3 ''' https://codeforces.com/group/H9K9zY8tcT/contest/297852 最长等差数列? 要用二分搜索? nl = [l[i]-l[i-1] for i in range(1,n)] n = len(nl) 实际是一个图的问题? 广度优先搜索? 看题解! [print(*l2[i*n:(i+1)*n]) for i in range(n)] l2 = ['-']*(n*n) #l2[i*n+j]=k so that v[k]=v[j]+(v[j]-v[i]), v[i]<v[j]<v[k] #57上面超内存! 内存和时间有点超! [print([(t1[i][c],t2[i][c]) for c in range(tc[i])]) for i in range(n)] https://codeforces.com/group/H9K9zY8tcT/contest/297852/submission/94813275 https://codeforces.com/group/H9K9zY8tcT/contest/297852/submission/94813332 (PyPy更快) 这个实现还是节省空间些,但是需要优化下链条过程的问题!!! 暂时放弃优化.. 加入字典..但那样空间又不够了.. ''' def f2(n,t1,t2,tc): l = ['-']*(n*n) for i in range(n): for c in range(tc[i]): l[i*n+t1[i][c]]=t2[i][c] [print(*l[i*n:(i+1)*n]) for i in range(n)] def f(v): n = len(v) t1 = [[] for _ in range(n)] t2 = [[] for _ in range(n)] tv = [[] for _ in range(n)] #记录是否visit tc = [0]*n tvc = [0]*n for j in range(1,n-1): jj = (v[j]<<1) i = j-1 k = j+1 while k<n and i>=0: ik = v[i]+v[k] if ik>jj: i -= 1 continue if ik<jj: k += 1 continue t1[i].append(j) t2[i].append(k) tv[i].append(False) tc[i]+=1 i -= 1 k += 1 mx = 2 i = -1 while i+mx<n: i += 1 if tvc[i]>=tc[i]: print("------------------------------") continue for ti in range(tc[i]): if tv[i][ti]: #i-j-k is visted from i's view continue j,k = t1[i][ti],t2[i][ti] #i => j-k sl = 3 tj = 0 while tj<tc[j]: kk = t1[j][tj] #j's t1 = k if kk < k: tj += 1 continue if kk > k: #note that each t1[i], t2[i] is sorted break tv[j][tj] = True tvc[j] += 1 k = t2[j][tj] #j=kk=k, k=j's j j = kk tj = 0 #easy2MISS! <=== sl += 1 if sl>mx: mx=sl print('mx:',mx) print('i:',i,tc[i]) return mx _ = int(input()) #5000. O(N^2) is acceptable l = sorted(list(map(int,input().split()))) #1e9 print(f(l))
#******************************************************************** # Filename: SingletonPattern_With.Metaclass.py # Author: Javier Montenegro (https://javiermontenegro.github.io/) # Copyright: # Details: This code is the implementation of the singleton pattern. #********************************************************************* class MetaSingleton(type): _instances = {} def __call__(cls, *args, **kwargs): if cls not in cls._instances: cls._instances[cls] = super(MetaSingleton, cls).__call__(*args, **kwargs) return cls._instances[cls] class Logger(metaclass=MetaSingleton): pass if __name__ == "__main__": logger1 = Logger() logger2 = Logger() # Reffer to same object. print(logger1, logger2)
""" Purpose: File for holding custom exception types that will be generated by the kafka_helpers libraries """ ### # Consumer Exceptions ### class TopicNotFound(Exception): """ Purpose: The TopicNotFound will be raised when attempting to consume a topic that does not exist """ pass ### # Producer Exceptions ###
a = float(input('Valor da primeira reta: ')) b = float(input('Valor da segunda reta: ')) c = float(input('Valor da terceira reta: ')) if (b - c) < a < b + c and (a - c) < b < a + c and (a - b) < c < a + b: print('Com essas medidas o triangulo pode ser feito') if a == b == c: print('Este triangulo é EQUILÁTERO') if a != b != c: print('Este triangulo é ESCALENO') if a == b != c or c == b != a or a == c != b: print('Este triangulo é ISÓSCELES') else: print('Com essas medidas o triangulo não pode ser feito')
def junta_listas(listas): planarizada = [] for lista in listas: for e in lista: planarizada.append(e) return planarizada lista = [[1, 2, 3], [4, 5, 6], [7, 8], [9], [10]] print(junta_listas(lista))
S = input() n = S.count("N") s = S.count("S") e = S.count("E") w = S.count("W") home = False if n and s: if e and w: print("Yes") elif not e and not w: print("Yes") else: print("No") elif not n and not s: if e and w: print("Yes") elif not e and not w: print("Yes") else: print("No") else: print("No")
# lec5prob9-semordnilap.py # edX MITx 6.00.1x # Introduction to Computer Science and Programming Using Python # Lecture 5, problem 9 # A semordnilap is a word or a phrase that spells a different word when backwards # ("semordnilap" is a semordnilap of "palindromes"). Here are some examples: # # nametag / gateman # dog / god # live / evil # desserts / stressed # # Write a recursive program, semordnilap, that takes in two words and says if # they are semordnilap. def semordnilap(str1, str2): ''' str1: a string str2: a string returns: True if str1 and str2 are semordnilap; False otherwise. ''' # Your code here # Check to see if both strings are empty if not (len(str1) or len(str2)): return True # Check to see if only one string is empty if not (len(str1) and len(str2)): return False # Check to see if first char of str1 = last of str2 # If not, no further comparison needed, return False if str1[0] != str2[-1]: return False return semordnilap(str1[1:], str2[:-1]) # Performing a semordnilap comparison using slicing notation, # but this is not valid for this assigment # elif str1 == str2[::-1]: # return True # Example of calling semordnilap() theResult = semordnilap('may', 'yam') print (str(theResult))
""" Module docstring """ def _impl(_ctx): print("printing at debug level") my_rule = rule( attrs = { }, implementation = _impl, )
class Solution(object): def myPow(self, x, n): """ :type x: float :type n: int :rtype: float """ if (n < 0): x = 1 / x n = -n if n == 0: return 1 half = self.myPow(x, n // 2) if(n % 2 == 0): return half * half else: return half * half * x
class Auth: """ Base class for authentication schemes. """ def auth(self): ... def synchronous_auth(self): ... async def asynchronous_auth(self): ...
__title__ = 'fobi.contrib.plugins.form_elements.fields.' \ 'hidden_model_object.default' __author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>' __copyright__ = 'Copyright (c) 2014-2017 Artur Barseghyan' __license__ = 'GPL 2.0/LGPL 2.1' __all__ = ('IGNORED_MODELS',) IGNORED_MODELS = []
# Exercício Python 064 # Leia varios numeros inteiros. Programa para quando digita 999 # No final, mostra quantos números foram digitados # A soma entre eles, desconsiderando o flag (999) soma = c = n = 0 while n != 999: soma = soma + n c = c + 1 n = int(input('Digite um número: ')) print('Você digitou {} números e a soma é {}.'.format(c - 1, soma))
# Description: Sequence Built-in Methods # Sequence Methods word = 'Hello' print(len(word[1:3])) # 2 print(ord('A')) # 65 print(chr(65)) # A print(str(65)) # 65 # Looping Sequence # 1. The position index and corresponding value can be retrieved at the same time using the enumerate() function. for i, v in enumerate(['tic', 'tac', 'toe']): print(i, v) # Looping Multiple Sequences # 1. To loop over two or more sequences at the same time, the entries can be paired with the zip() function. questions = ['name', 'quest', 'favorite color'] answers = ['lancelot', 'the holy grail', 'blue'] for q, a in zip(questions, answers): print('What is your {0}? It is {1}.'.format(q, a)) # Looping in Reverse Order for i in reversed(range(1, 10, 2)): print(i) # Looping in sorted order basket = ['apple', 'orange', 'apple', 'pear', 'orange', 'banana'] for fruit in sorted(set(basket)): print(fruit)
__author__ = "Inada Naoki <songofacandy@gmail.com>" version_info = (1,4,2,'final',0) __version__ = "1.4.2"
power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power gating': 0.0259246, 'Gate Leakage': 0.00662954, 'Peak Dynamic': 0.0, 'Runtime Dynamic': 0.0, 'Subthreshold Leakage': 0.0691322, 'Subthreshold Leakage with power gating': 0.0259246}, 'Core': [{'Area': 32.6082, 'Execution Unit/Area': 8.2042, 'Execution Unit/Complex ALUs/Area': 0.235435, 'Execution Unit/Complex ALUs/Gate Leakage': 0.0132646, 'Execution Unit/Complex ALUs/Peak Dynamic': 0.00614237, 'Execution Unit/Complex ALUs/Runtime Dynamic': 0.207513, 'Execution Unit/Complex ALUs/Subthreshold Leakage': 0.20111, 'Execution Unit/Complex ALUs/Subthreshold Leakage with power gating': 0.0754163, 'Execution Unit/Floating Point Units/Area': 4.6585, 'Execution Unit/Floating Point Units/Gate Leakage': 0.0656156, 'Execution Unit/Floating Point Units/Peak Dynamic': 0.0303174, 'Execution Unit/Floating Point Units/Runtime Dynamic': 0.304033, 'Execution Unit/Floating Point Units/Subthreshold Leakage': 0.994829, 'Execution Unit/Floating Point Units/Subthreshold Leakage with power gating': 0.373061, 'Execution Unit/Gate Leakage': 0.122718, 'Execution Unit/Instruction Scheduler/Area': 2.17927, 'Execution Unit/Instruction Scheduler/FP Instruction Window/Area': 0.328073, 'Execution Unit/Instruction Scheduler/FP Instruction Window/Gate Leakage': 0.00115349, 'Execution Unit/Instruction Scheduler/FP Instruction Window/Peak Dynamic': 1.20978, 'Execution Unit/Instruction Scheduler/FP Instruction Window/Runtime Dynamic': 0.144989, 'Execution Unit/Instruction Scheduler/FP Instruction Window/Subthreshold Leakage': 0.017004, 'Execution Unit/Instruction Scheduler/FP Instruction Window/Subthreshold Leakage with power gating': 0.00962066, 'Execution Unit/Instruction Scheduler/Gate Leakage': 0.00730101, 'Execution Unit/Instruction Scheduler/Instruction Window/Area': 1.00996, 'Execution Unit/Instruction Scheduler/Instruction Window/Gate Leakage': 0.00529112, 'Execution Unit/Instruction Scheduler/Instruction Window/Peak Dynamic': 2.07911, 'Execution Unit/Instruction Scheduler/Instruction Window/Runtime Dynamic': 0.251068, 'Execution Unit/Instruction Scheduler/Instruction Window/Subthreshold Leakage': 0.0800117, 'Execution Unit/Instruction Scheduler/Instruction Window/Subthreshold Leakage with power gating': 0.0455351, 'Execution Unit/Instruction Scheduler/Peak Dynamic': 4.84781, 'Execution Unit/Instruction Scheduler/ROB/Area': 0.841232, 'Execution Unit/Instruction Scheduler/ROB/Gate Leakage': 0.000856399, 'Execution Unit/Instruction Scheduler/ROB/Peak Dynamic': 1.55892, 'Execution Unit/Instruction Scheduler/ROB/Runtime Dynamic': 0.143995, 'Execution Unit/Instruction Scheduler/ROB/Subthreshold Leakage': 0.0178624, 'Execution Unit/Instruction Scheduler/ROB/Subthreshold Leakage with power gating': 0.00897339, 'Execution Unit/Instruction Scheduler/Runtime Dynamic': 0.540052, 'Execution Unit/Instruction Scheduler/Subthreshold Leakage': 0.114878, 'Execution Unit/Instruction Scheduler/Subthreshold Leakage with power gating': 0.0641291, 'Execution Unit/Integer ALUs/Area': 0.47087, 'Execution Unit/Integer ALUs/Gate Leakage': 0.0265291, 'Execution Unit/Integer ALUs/Peak Dynamic': 0.138668, 'Execution Unit/Integer ALUs/Runtime Dynamic': 0.101344, 'Execution Unit/Integer ALUs/Subthreshold Leakage': 0.40222, 'Execution Unit/Integer ALUs/Subthreshold Leakage with power gating': 0.150833, 'Execution Unit/Peak Dynamic': 5.18734, 'Execution Unit/Register Files/Area': 0.570804, 'Execution Unit/Register Files/Floating Point RF/Area': 0.208131, 'Execution Unit/Register Files/Floating Point RF/Gate Leakage': 0.000232788, 'Execution Unit/Register Files/Floating Point RF/Peak Dynamic': 0.00572761, 'Execution Unit/Register Files/Floating Point RF/Runtime Dynamic': 0.00525596, 'Execution Unit/Register Files/Floating Point RF/Subthreshold Leakage': 0.00399698, 'Execution Unit/Register Files/Floating Point RF/Subthreshold Leakage with power gating': 0.00176968, 'Execution Unit/Register Files/Gate Leakage': 0.000622708, 'Execution Unit/Register Files/Integer RF/Area': 0.362673, 'Execution Unit/Register Files/Integer RF/Gate Leakage': 0.00038992, 'Execution Unit/Register Files/Integer RF/Peak Dynamic': 0.040423, 'Execution Unit/Register Files/Integer RF/Runtime Dynamic': 0.038871, 'Execution Unit/Register Files/Integer RF/Subthreshold Leakage': 0.00614175, 'Execution Unit/Register Files/Integer RF/Subthreshold Leakage with power gating': 0.00246675, 'Execution Unit/Register Files/Peak Dynamic': 0.0461506, 'Execution Unit/Register Files/Runtime Dynamic': 0.044127, 'Execution Unit/Register Files/Subthreshold Leakage': 0.0101387, 'Execution Unit/Register Files/Subthreshold Leakage with power gating': 0.00423643, 'Execution Unit/Results Broadcast Bus/Area Overhead': 0.0442632, 'Execution Unit/Results Broadcast Bus/Gate Leakage': 0.00607074, 'Execution Unit/Results Broadcast Bus/Peak Dynamic': 0.0993613, 'Execution Unit/Results Broadcast Bus/Runtime Dynamic': 0.246254, 'Execution Unit/Results Broadcast Bus/Subthreshold Leakage': 0.0920413, 'Execution Unit/Results Broadcast Bus/Subthreshold Leakage with power gating': 0.0345155, 'Execution Unit/Runtime Dynamic': 1.44332, 'Execution Unit/Subthreshold Leakage': 1.83518, 'Execution Unit/Subthreshold Leakage with power gating': 0.709678, 'Gate Leakage': 0.372997, 'Instruction Fetch Unit/Area': 5.86007, 'Instruction Fetch Unit/Branch Predictor/Area': 0.138516, 'Instruction Fetch Unit/Branch Predictor/Chooser/Area': 0.0435221, 'Instruction Fetch Unit/Branch Predictor/Chooser/Gate Leakage': 0.000278362, 'Instruction Fetch Unit/Branch Predictor/Chooser/Peak Dynamic': 0.0168831, 'Instruction Fetch Unit/Branch Predictor/Chooser/Runtime Dynamic': 0.00141613, 'Instruction Fetch Unit/Branch Predictor/Chooser/Subthreshold Leakage': 0.00759719, 'Instruction Fetch Unit/Branch Predictor/Chooser/Subthreshold Leakage with power gating': 0.0039236, 'Instruction Fetch Unit/Branch Predictor/Gate Leakage': 0.000757657, 'Instruction Fetch Unit/Branch Predictor/Global Predictor/Area': 0.0435221, 'Instruction Fetch Unit/Branch Predictor/Global Predictor/Gate Leakage': 0.000278362, 'Instruction Fetch Unit/Branch Predictor/Global Predictor/Peak Dynamic': 0.0168831, 'Instruction Fetch Unit/Branch Predictor/Global Predictor/Runtime Dynamic': 0.00141613, 'Instruction Fetch Unit/Branch Predictor/Global Predictor/Subthreshold Leakage': 0.00759719, 'Instruction Fetch Unit/Branch Predictor/Global Predictor/Subthreshold Leakage with power gating': 0.0039236, 'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Area': 0.0257064, 'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Gate Leakage': 0.000154548, 'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Peak Dynamic': 0.0142575, 'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Runtime Dynamic': 0.00124171, 'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Subthreshold Leakage': 0.00384344, 'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Subthreshold Leakage with power gating': 0.00198631, 'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Area': 0.0151917, 'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Gate Leakage': 8.00196e-05, 'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Peak Dynamic': 0.00527447, 'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Runtime Dynamic': 0.000485201, 'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Subthreshold Leakage': 0.00181347, 'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Subthreshold Leakage with power gating': 0.000957045, 'Instruction Fetch Unit/Branch Predictor/Peak Dynamic': 0.0597838, 'Instruction Fetch Unit/Branch Predictor/RAS/Area': 0.0105732, 'Instruction Fetch Unit/Branch Predictor/RAS/Gate Leakage': 4.63858e-05, 'Instruction Fetch Unit/Branch Predictor/RAS/Peak Dynamic': 0.0117602, 'Instruction Fetch Unit/Branch Predictor/RAS/Runtime Dynamic': 0.000558386, 'Instruction Fetch Unit/Branch Predictor/RAS/Subthreshold Leakage': 0.000932505, 'Instruction Fetch Unit/Branch Predictor/RAS/Subthreshold Leakage with power gating': 0.000494733, 'Instruction Fetch Unit/Branch Predictor/Runtime Dynamic': 0.00463235, 'Instruction Fetch Unit/Branch Predictor/Subthreshold Leakage': 0.0199703, 'Instruction Fetch Unit/Branch Predictor/Subthreshold Leakage with power gating': 0.0103282, 'Instruction Fetch Unit/Branch Target Buffer/Area': 0.64954, 'Instruction Fetch Unit/Branch Target Buffer/Gate Leakage': 0.00272758, 'Instruction Fetch Unit/Branch Target Buffer/Peak Dynamic': 0.177867, 'Instruction Fetch Unit/Branch Target Buffer/Runtime Dynamic': 0.0132827, 'Instruction Fetch Unit/Branch Target Buffer/Subthreshold Leakage': 0.0811682, 'Instruction Fetch Unit/Branch Target Buffer/Subthreshold Leakage with power gating': 0.0435357, 'Instruction Fetch Unit/Gate Leakage': 0.0590479, 'Instruction Fetch Unit/Instruction Buffer/Area': 0.0226323, 'Instruction Fetch Unit/Instruction Buffer/Gate Leakage': 6.83558e-05, 'Instruction Fetch Unit/Instruction Buffer/Peak Dynamic': 0.606827, 'Instruction Fetch Unit/Instruction Buffer/Runtime Dynamic': 0.0373677, 'Instruction Fetch Unit/Instruction Buffer/Subthreshold Leakage': 0.00151885, 'Instruction Fetch Unit/Instruction Buffer/Subthreshold Leakage with power gating': 0.000701682, 'Instruction Fetch Unit/Instruction Cache/Area': 3.14635, 'Instruction Fetch Unit/Instruction Cache/Gate Leakage': 0.029931, 'Instruction Fetch Unit/Instruction Cache/Peak Dynamic': 2.37691, 'Instruction Fetch Unit/Instruction Cache/Runtime Dynamic': 0.117954, 'Instruction Fetch Unit/Instruction Cache/Subthreshold Leakage': 0.367022, 'Instruction Fetch Unit/Instruction Cache/Subthreshold Leakage with power gating': 0.180386, 'Instruction Fetch Unit/Instruction Decoder/Area': 1.85799, 'Instruction Fetch Unit/Instruction Decoder/Gate Leakage': 0.0222493, 'Instruction Fetch Unit/Instruction Decoder/Peak Dynamic': 1.37404, 'Instruction Fetch Unit/Instruction Decoder/Runtime Dynamic': 0.126918, 'Instruction Fetch Unit/Instruction Decoder/Subthreshold Leakage': 0.442943, 'Instruction Fetch Unit/Instruction Decoder/Subthreshold Leakage with power gating': 0.166104, 'Instruction Fetch Unit/Peak Dynamic': 4.71254, 'Instruction Fetch Unit/Runtime Dynamic': 0.300154, 'Instruction Fetch Unit/Subthreshold Leakage': 0.932587, 'Instruction Fetch Unit/Subthreshold Leakage with power gating': 0.408542, 'L2/Area': 4.53318, 'L2/Gate Leakage': 0.015464, 'L2/Peak Dynamic': 0.0873171, 'L2/Runtime Dynamic': 0.0261277, 'L2/Subthreshold Leakage': 0.834142, 'L2/Subthreshold Leakage with power gating': 0.401066, 'Load Store Unit/Area': 8.80969, 'Load Store Unit/Data Cache/Area': 6.84535, 'Load Store Unit/Data Cache/Gate Leakage': 0.0279261, 'Load Store Unit/Data Cache/Peak Dynamic': 2.17728, 'Load Store Unit/Data Cache/Runtime Dynamic': 0.491529, 'Load Store Unit/Data Cache/Subthreshold Leakage': 0.527675, 'Load Store Unit/Data Cache/Subthreshold Leakage with power gating': 0.25085, 'Load Store Unit/Gate Leakage': 0.0351387, 'Load Store Unit/LoadQ/Area': 0.0836782, 'Load Store Unit/LoadQ/Gate Leakage': 0.00059896, 'Load Store Unit/LoadQ/Peak Dynamic': 0.0304163, 'Load Store Unit/LoadQ/Runtime Dynamic': 0.0304164, 'Load Store Unit/LoadQ/Subthreshold Leakage': 0.00941961, 'Load Store Unit/LoadQ/Subthreshold Leakage with power gating': 0.00536918, 'Load Store Unit/Peak Dynamic': 2.32149, 'Load Store Unit/Runtime Dynamic': 0.671949, 'Load Store Unit/StoreQ/Area': 0.322079, 'Load Store Unit/StoreQ/Gate Leakage': 0.00329971, 'Load Store Unit/StoreQ/Peak Dynamic': 0.0750014, 'Load Store Unit/StoreQ/Runtime Dynamic': 0.150003, 'Load Store Unit/StoreQ/Subthreshold Leakage': 0.0345621, 'Load Store Unit/StoreQ/Subthreshold Leakage with power gating': 0.0197004, 'Load Store Unit/Subthreshold Leakage': 0.591622, 'Load Store Unit/Subthreshold Leakage with power gating': 0.283406, 'Memory Management Unit/Area': 0.434579, 'Memory Management Unit/Dtlb/Area': 0.0879726, 'Memory Management Unit/Dtlb/Gate Leakage': 0.00088729, 'Memory Management Unit/Dtlb/Peak Dynamic': 0.0266182, 'Memory Management Unit/Dtlb/Runtime Dynamic': 0.0279272, 'Memory Management Unit/Dtlb/Subthreshold Leakage': 0.0155699, 'Memory Management Unit/Dtlb/Subthreshold Leakage with power gating': 0.00887485, 'Memory Management Unit/Gate Leakage': 0.00813591, 'Memory Management Unit/Itlb/Area': 0.301552, 'Memory Management Unit/Itlb/Gate Leakage': 0.00393464, 'Memory Management Unit/Itlb/Peak Dynamic': 0.147787, 'Memory Management Unit/Itlb/Runtime Dynamic': 0.0193444, 'Memory Management Unit/Itlb/Subthreshold Leakage': 0.0413758, 'Memory Management Unit/Itlb/Subthreshold Leakage with power gating': 0.0235842, 'Memory Management Unit/Peak Dynamic': 0.352303, 'Memory Management Unit/Runtime Dynamic': 0.0472716, 'Memory Management Unit/Subthreshold Leakage': 0.0769113, 'Memory Management Unit/Subthreshold Leakage with power gating': 0.0399462, 'Peak Dynamic': 17.2227, 'Renaming Unit/Area': 0.369768, 'Renaming Unit/FP Front End RAT/Area': 0.168486, 'Renaming Unit/FP Front End RAT/Gate Leakage': 0.00489731, 'Renaming Unit/FP Front End RAT/Peak Dynamic': 3.33511, 'Renaming Unit/FP Front End RAT/Runtime Dynamic': 0.0199827, 'Renaming Unit/FP Front End RAT/Subthreshold Leakage': 0.0437281, 'Renaming Unit/FP Front End RAT/Subthreshold Leakage with power gating': 0.024925, 'Renaming Unit/Free List/Area': 0.0414755, 'Renaming Unit/Free List/Gate Leakage': 4.15911e-05, 'Renaming Unit/Free List/Peak Dynamic': 0.0401324, 'Renaming Unit/Free List/Runtime Dynamic': 0.00765439, 'Renaming Unit/Free List/Subthreshold Leakage': 0.000670426, 'Renaming Unit/Free List/Subthreshold Leakage with power gating': 0.000377987, 'Renaming Unit/Gate Leakage': 0.00863632, 'Renaming Unit/Int Front End RAT/Area': 0.114751, 'Renaming Unit/Int Front End RAT/Gate Leakage': 0.00038343, 'Renaming Unit/Int Front End RAT/Peak Dynamic': 0.86945, 'Renaming Unit/Int Front End RAT/Runtime Dynamic': 0.0750745, 'Renaming Unit/Int Front End RAT/Subthreshold Leakage': 0.00611897, 'Renaming Unit/Int Front End RAT/Subthreshold Leakage with power gating': 0.00348781, 'Renaming Unit/Peak Dynamic': 4.56169, 'Renaming Unit/Runtime Dynamic': 0.102712, 'Renaming Unit/Subthreshold Leakage': 0.070483, 'Renaming Unit/Subthreshold Leakage with power gating': 0.0362779, 'Runtime Dynamic': 2.59154, 'Subthreshold Leakage': 6.21877, 'Subthreshold Leakage with power gating': 2.58311}, {'Area': 32.0201, 'Execution Unit/Area': 7.68434, 'Execution Unit/Complex ALUs/Area': 0.235435, 'Execution Unit/Complex ALUs/Gate Leakage': 0.0132646, 'Execution Unit/Complex ALUs/Peak Dynamic': 0.00310047, 'Execution Unit/Complex ALUs/Runtime Dynamic': 0.205123, 'Execution Unit/Complex ALUs/Subthreshold Leakage': 0.20111, 'Execution Unit/Complex ALUs/Subthreshold Leakage with power gating': 0.0754163, 'Execution Unit/Floating Point Units/Area': 4.6585, 'Execution Unit/Floating Point Units/Gate Leakage': 0.0656156, 'Execution Unit/Floating Point Units/Peak Dynamic': 0.0152966, 'Execution Unit/Floating Point Units/Runtime Dynamic': 0.304033, 'Execution Unit/Floating Point Units/Subthreshold Leakage': 0.994829, 'Execution Unit/Floating Point Units/Subthreshold Leakage with power gating': 0.373061, 'Execution Unit/Gate Leakage': 0.120359, 'Execution Unit/Instruction Scheduler/Area': 1.66526, 'Execution Unit/Instruction Scheduler/FP Instruction Window/Area': 0.275653, 'Execution Unit/Instruction Scheduler/FP Instruction Window/Gate Leakage': 0.000977433, 'Execution Unit/Instruction Scheduler/FP Instruction Window/Peak Dynamic': 1.04181, 'Execution Unit/Instruction Scheduler/FP Instruction Window/Runtime Dynamic': 0.0679507, 'Execution Unit/Instruction Scheduler/FP Instruction Window/Subthreshold Leakage': 0.0143453, 'Execution Unit/Instruction Scheduler/FP Instruction Window/Subthreshold Leakage with power gating': 0.00810519, 'Execution Unit/Instruction Scheduler/Gate Leakage': 0.00568913, 'Execution Unit/Instruction Scheduler/Instruction Window/Area': 0.805223, 'Execution Unit/Instruction Scheduler/Instruction Window/Gate Leakage': 0.00414562, 'Execution Unit/Instruction Scheduler/Instruction Window/Peak Dynamic': 1.6763, 'Execution Unit/Instruction Scheduler/Instruction Window/Runtime Dynamic': 0.109602, 'Execution Unit/Instruction Scheduler/Instruction Window/Subthreshold Leakage': 0.0625755, 'Execution Unit/Instruction Scheduler/Instruction Window/Subthreshold Leakage with power gating': 0.0355964, 'Execution Unit/Instruction Scheduler/Peak Dynamic': 3.82262, 'Execution Unit/Instruction Scheduler/ROB/Area': 0.584388, 'Execution Unit/Instruction Scheduler/ROB/Gate Leakage': 0.00056608, 'Execution Unit/Instruction Scheduler/ROB/Peak Dynamic': 1.10451, 'Execution Unit/Instruction Scheduler/ROB/Runtime Dynamic': 0.0553234, 'Execution Unit/Instruction Scheduler/ROB/Subthreshold Leakage': 0.00906853, 'Execution Unit/Instruction Scheduler/ROB/Subthreshold Leakage with power gating': 0.00364446, 'Execution Unit/Instruction Scheduler/Runtime Dynamic': 0.232876, 'Execution Unit/Instruction Scheduler/Subthreshold Leakage': 0.0859892, 'Execution Unit/Instruction Scheduler/Subthreshold Leakage with power gating': 0.047346, 'Execution Unit/Integer ALUs/Area': 0.47087, 'Execution Unit/Integer ALUs/Gate Leakage': 0.0265291, 'Execution Unit/Integer ALUs/Peak Dynamic': 0.0753712, 'Execution Unit/Integer ALUs/Runtime Dynamic': 0.101344, 'Execution Unit/Integer ALUs/Subthreshold Leakage': 0.40222, 'Execution Unit/Integer ALUs/Subthreshold Leakage with power gating': 0.150833, 'Execution Unit/Peak Dynamic': 3.99799, 'Execution Unit/Register Files/Area': 0.570804, 'Execution Unit/Register Files/Floating Point RF/Area': 0.208131, 'Execution Unit/Register Files/Floating Point RF/Gate Leakage': 0.000232788, 'Execution Unit/Register Files/Floating Point RF/Peak Dynamic': 0.00288986, 'Execution Unit/Register Files/Floating Point RF/Runtime Dynamic': 0.00285016, 'Execution Unit/Register Files/Floating Point RF/Subthreshold Leakage': 0.00399698, 'Execution Unit/Register Files/Floating Point RF/Subthreshold Leakage with power gating': 0.00176968, 'Execution Unit/Register Files/Gate Leakage': 0.000622708, 'Execution Unit/Register Files/Integer RF/Area': 0.362673, 'Execution Unit/Register Files/Integer RF/Gate Leakage': 0.00038992, 'Execution Unit/Register Files/Integer RF/Peak Dynamic': 0.0218299, 'Execution Unit/Register Files/Integer RF/Runtime Dynamic': 0.0210787, 'Execution Unit/Register Files/Integer RF/Subthreshold Leakage': 0.00614175, 'Execution Unit/Register Files/Integer RF/Subthreshold Leakage with power gating': 0.00246675, 'Execution Unit/Register Files/Peak Dynamic': 0.0247198, 'Execution Unit/Register Files/Runtime Dynamic': 0.0239288, 'Execution Unit/Register Files/Subthreshold Leakage': 0.0101387, 'Execution Unit/Register Files/Subthreshold Leakage with power gating': 0.00423643, 'Execution Unit/Results Broadcast Bus/Area Overhead': 0.0390912, 'Execution Unit/Results Broadcast Bus/Gate Leakage': 0.00537402, 'Execution Unit/Results Broadcast Bus/Peak Dynamic': 0.0467649, 'Execution Unit/Results Broadcast Bus/Runtime Dynamic': 0.116768, 'Execution Unit/Results Broadcast Bus/Subthreshold Leakage': 0.081478, 'Execution Unit/Results Broadcast Bus/Subthreshold Leakage with power gating': 0.0305543, 'Execution Unit/Runtime Dynamic': 0.984073, 'Execution Unit/Subthreshold Leakage': 1.79543, 'Execution Unit/Subthreshold Leakage with power gating': 0.688821, 'Gate Leakage': 0.368936, 'Instruction Fetch Unit/Area': 5.85939, 'Instruction Fetch Unit/Branch Predictor/Area': 0.138516, 'Instruction Fetch Unit/Branch Predictor/Chooser/Area': 0.0435221, 'Instruction Fetch Unit/Branch Predictor/Chooser/Gate Leakage': 0.000278362, 'Instruction Fetch Unit/Branch Predictor/Chooser/Peak Dynamic': 0.0168831, 'Instruction Fetch Unit/Branch Predictor/Chooser/Runtime Dynamic': 0.000744305, 'Instruction Fetch Unit/Branch Predictor/Chooser/Subthreshold Leakage': 0.00759719, 'Instruction Fetch Unit/Branch Predictor/Chooser/Subthreshold Leakage with power gating': 0.0039236, 'Instruction Fetch Unit/Branch Predictor/Gate Leakage': 0.000757657, 'Instruction Fetch Unit/Branch Predictor/Global Predictor/Area': 0.0435221, 'Instruction Fetch Unit/Branch Predictor/Global Predictor/Gate Leakage': 0.000278362, 'Instruction Fetch Unit/Branch Predictor/Global Predictor/Peak Dynamic': 0.0168831, 'Instruction Fetch Unit/Branch Predictor/Global Predictor/Runtime Dynamic': 0.000744305, 'Instruction Fetch Unit/Branch Predictor/Global Predictor/Subthreshold Leakage': 0.00759719, 'Instruction Fetch Unit/Branch Predictor/Global Predictor/Subthreshold Leakage with power gating': 0.0039236, 'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Area': 0.0257064, 'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Gate Leakage': 0.000154548, 'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Peak Dynamic': 0.0142575, 'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Runtime Dynamic': 0.000658387, 'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Subthreshold Leakage': 0.00384344, 'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Subthreshold Leakage with power gating': 0.00198631, 'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Area': 0.0151917, 'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Gate Leakage': 8.00196e-05, 'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Peak Dynamic': 0.00527447, 'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Runtime Dynamic': 0.000260395, 'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Subthreshold Leakage': 0.00181347, 'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Subthreshold Leakage with power gating': 0.000957045, 'Instruction Fetch Unit/Branch Predictor/Peak Dynamic': 0.0597838, 'Instruction Fetch Unit/Branch Predictor/RAS/Area': 0.0105732, 'Instruction Fetch Unit/Branch Predictor/RAS/Gate Leakage': 4.63858e-05, 'Instruction Fetch Unit/Branch Predictor/RAS/Peak Dynamic': 0.0117602, 'Instruction Fetch Unit/Branch Predictor/RAS/Runtime Dynamic': 0.000302797, 'Instruction Fetch Unit/Branch Predictor/RAS/Subthreshold Leakage': 0.000932505, 'Instruction Fetch Unit/Branch Predictor/RAS/Subthreshold Leakage with power gating': 0.000494733, 'Instruction Fetch Unit/Branch Predictor/Runtime Dynamic': 0.00244979, 'Instruction Fetch Unit/Branch Predictor/Subthreshold Leakage': 0.0199703, 'Instruction Fetch Unit/Branch Predictor/Subthreshold Leakage with power gating': 0.0103282, 'Instruction Fetch Unit/Branch Target Buffer/Area': 0.64954, 'Instruction Fetch Unit/Branch Target Buffer/Gate Leakage': 0.00272758, 'Instruction Fetch Unit/Branch Target Buffer/Peak Dynamic': 0.177867, 'Instruction Fetch Unit/Branch Target Buffer/Runtime Dynamic': 0.00677554, 'Instruction Fetch Unit/Branch Target Buffer/Subthreshold Leakage': 0.0811682, 'Instruction Fetch Unit/Branch Target Buffer/Subthreshold Leakage with power gating': 0.0435357, 'Instruction Fetch Unit/Gate Leakage': 0.0589979, 'Instruction Fetch Unit/Instruction Buffer/Area': 0.0226323, 'Instruction Fetch Unit/Instruction Buffer/Gate Leakage': 6.83558e-05, 'Instruction Fetch Unit/Instruction Buffer/Peak Dynamic': 0.606827, 'Instruction Fetch Unit/Instruction Buffer/Runtime Dynamic': 0.0202635, 'Instruction Fetch Unit/Instruction Buffer/Subthreshold Leakage': 0.00151885, 'Instruction Fetch Unit/Instruction Buffer/Subthreshold Leakage with power gating': 0.000701682, 'Instruction Fetch Unit/Instruction Cache/Area': 3.14635, 'Instruction Fetch Unit/Instruction Cache/Gate Leakage': 0.029931, 'Instruction Fetch Unit/Instruction Cache/Peak Dynamic': 1.28893, 'Instruction Fetch Unit/Instruction Cache/Runtime Dynamic': 0.060666, 'Instruction Fetch Unit/Instruction Cache/Subthreshold Leakage': 0.367022, 'Instruction Fetch Unit/Instruction Cache/Subthreshold Leakage with power gating': 0.180386, 'Instruction Fetch Unit/Instruction Decoder/Area': 1.85799, 'Instruction Fetch Unit/Instruction Decoder/Gate Leakage': 0.0222493, 'Instruction Fetch Unit/Instruction Decoder/Peak Dynamic': 1.37404, 'Instruction Fetch Unit/Instruction Decoder/Runtime Dynamic': 0.0688238, 'Instruction Fetch Unit/Instruction Decoder/Subthreshold Leakage': 0.442943, 'Instruction Fetch Unit/Instruction Decoder/Subthreshold Leakage with power gating': 0.166104, 'Instruction Fetch Unit/Peak Dynamic': 3.57, 'Instruction Fetch Unit/Runtime Dynamic': 0.158979, 'Instruction Fetch Unit/Subthreshold Leakage': 0.932286, 'Instruction Fetch Unit/Subthreshold Leakage with power gating': 0.40843, 'L2/Area': 4.53318, 'L2/Gate Leakage': 0.015464, 'L2/Peak Dynamic': 0.0446739, 'L2/Runtime Dynamic': 0.0144724, 'L2/Subthreshold Leakage': 0.834142, 'L2/Subthreshold Leakage with power gating': 0.401066, 'Load Store Unit/Area': 8.80901, 'Load Store Unit/Data Cache/Area': 6.84535, 'Load Store Unit/Data Cache/Gate Leakage': 0.0279261, 'Load Store Unit/Data Cache/Peak Dynamic': 1.74675, 'Load Store Unit/Data Cache/Runtime Dynamic': 0.267023, 'Load Store Unit/Data Cache/Subthreshold Leakage': 0.527675, 'Load Store Unit/Data Cache/Subthreshold Leakage with power gating': 0.25085, 'Load Store Unit/Gate Leakage': 0.0350888, 'Load Store Unit/LoadQ/Area': 0.0836782, 'Load Store Unit/LoadQ/Gate Leakage': 0.00059896, 'Load Store Unit/LoadQ/Peak Dynamic': 0.0164876, 'Load Store Unit/LoadQ/Runtime Dynamic': 0.0164876, 'Load Store Unit/LoadQ/Subthreshold Leakage': 0.00941961, 'Load Store Unit/LoadQ/Subthreshold Leakage with power gating': 0.00536918, 'Load Store Unit/Peak Dynamic': 1.8246, 'Load Store Unit/Runtime Dynamic': 0.364822, 'Load Store Unit/StoreQ/Area': 0.322079, 'Load Store Unit/StoreQ/Gate Leakage': 0.00329971, 'Load Store Unit/StoreQ/Peak Dynamic': 0.0406556, 'Load Store Unit/StoreQ/Runtime Dynamic': 0.081311, 'Load Store Unit/StoreQ/Subthreshold Leakage': 0.0345621, 'Load Store Unit/StoreQ/Subthreshold Leakage with power gating': 0.0197004, 'Load Store Unit/Subthreshold Leakage': 0.591321, 'Load Store Unit/Subthreshold Leakage with power gating': 0.283293, 'Memory Management Unit/Area': 0.4339, 'Memory Management Unit/Dtlb/Area': 0.0879726, 'Memory Management Unit/Dtlb/Gate Leakage': 0.00088729, 'Memory Management Unit/Dtlb/Peak Dynamic': 0.0144288, 'Memory Management Unit/Dtlb/Runtime Dynamic': 0.0150982, 'Memory Management Unit/Dtlb/Subthreshold Leakage': 0.0155699, 'Memory Management Unit/Dtlb/Subthreshold Leakage with power gating': 0.00887485, 'Memory Management Unit/Gate Leakage': 0.00808595, 'Memory Management Unit/Itlb/Area': 0.301552, 'Memory Management Unit/Itlb/Gate Leakage': 0.00393464, 'Memory Management Unit/Itlb/Peak Dynamic': 0.0801409, 'Memory Management Unit/Itlb/Runtime Dynamic': 0.00994995, 'Memory Management Unit/Itlb/Subthreshold Leakage': 0.0413758, 'Memory Management Unit/Itlb/Subthreshold Leakage with power gating': 0.0235842, 'Memory Management Unit/Peak Dynamic': 0.261036, 'Memory Management Unit/Runtime Dynamic': 0.0250481, 'Memory Management Unit/Subthreshold Leakage': 0.0766103, 'Memory Management Unit/Subthreshold Leakage with power gating': 0.0398333, 'Peak Dynamic': 13.2878, 'Renaming Unit/Area': 0.303608, 'Renaming Unit/FP Front End RAT/Area': 0.131045, 'Renaming Unit/FP Front End RAT/Gate Leakage': 0.00351123, 'Renaming Unit/FP Front End RAT/Peak Dynamic': 2.51468, 'Renaming Unit/FP Front End RAT/Runtime Dynamic': 0.00760166, 'Renaming Unit/FP Front End RAT/Subthreshold Leakage': 0.0308571, 'Renaming Unit/FP Front End RAT/Subthreshold Leakage with power gating': 0.0175885, 'Renaming Unit/Free List/Area': 0.0340654, 'Renaming Unit/Free List/Gate Leakage': 2.5481e-05, 'Renaming Unit/Free List/Peak Dynamic': 0.0306032, 'Renaming Unit/Free List/Runtime Dynamic': 0.00315826, 'Renaming Unit/Free List/Subthreshold Leakage': 0.000370144, 'Renaming Unit/Free List/Subthreshold Leakage with power gating': 0.000201064, 'Renaming Unit/Gate Leakage': 0.00708398, 'Renaming Unit/Int Front End RAT/Area': 0.0941223, 'Renaming Unit/Int Front End RAT/Gate Leakage': 0.000283242, 'Renaming Unit/Int Front End RAT/Peak Dynamic': 0.731965, 'Renaming Unit/Int Front End RAT/Runtime Dynamic': 0.0346102, 'Renaming Unit/Int Front End RAT/Subthreshold Leakage': 0.00435488, 'Renaming Unit/Int Front End RAT/Subthreshold Leakage with power gating': 0.00248228, 'Renaming Unit/Peak Dynamic': 3.58947, 'Renaming Unit/Runtime Dynamic': 0.0453702, 'Renaming Unit/Subthreshold Leakage': 0.0552466, 'Renaming Unit/Subthreshold Leakage with power gating': 0.0276461, 'Runtime Dynamic': 1.59276, 'Subthreshold Leakage': 6.16288, 'Subthreshold Leakage with power gating': 2.55328}, {'Area': 32.0201, 'Execution Unit/Area': 7.68434, 'Execution Unit/Complex ALUs/Area': 0.235435, 'Execution Unit/Complex ALUs/Gate Leakage': 0.0132646, 'Execution Unit/Complex ALUs/Peak Dynamic': 0.00284541, 'Execution Unit/Complex ALUs/Runtime Dynamic': 0.204923, 'Execution Unit/Complex ALUs/Subthreshold Leakage': 0.20111, 'Execution Unit/Complex ALUs/Subthreshold Leakage with power gating': 0.0754163, 'Execution Unit/Floating Point Units/Area': 4.6585, 'Execution Unit/Floating Point Units/Gate Leakage': 0.0656156, 'Execution Unit/Floating Point Units/Peak Dynamic': 0.0136698, 'Execution Unit/Floating Point Units/Runtime Dynamic': 0.304033, 'Execution Unit/Floating Point Units/Subthreshold Leakage': 0.994829, 'Execution Unit/Floating Point Units/Subthreshold Leakage with power gating': 0.373061, 'Execution Unit/Gate Leakage': 0.120359, 'Execution Unit/Instruction Scheduler/Area': 1.66526, 'Execution Unit/Instruction Scheduler/FP Instruction Window/Area': 0.275653, 'Execution Unit/Instruction Scheduler/FP Instruction Window/Gate Leakage': 0.000977433, 'Execution Unit/Instruction Scheduler/FP Instruction Window/Peak Dynamic': 1.04181, 'Execution Unit/Instruction Scheduler/FP Instruction Window/Runtime Dynamic': 0.0702686, 'Execution Unit/Instruction Scheduler/FP Instruction Window/Subthreshold Leakage': 0.0143453, 'Execution Unit/Instruction Scheduler/FP Instruction Window/Subthreshold Leakage with power gating': 0.00810519, 'Execution Unit/Instruction Scheduler/Gate Leakage': 0.00568913, 'Execution Unit/Instruction Scheduler/Instruction Window/Area': 0.805223, 'Execution Unit/Instruction Scheduler/Instruction Window/Gate Leakage': 0.00414562, 'Execution Unit/Instruction Scheduler/Instruction Window/Peak Dynamic': 1.6763, 'Execution Unit/Instruction Scheduler/Instruction Window/Runtime Dynamic': 0.113341, 'Execution Unit/Instruction Scheduler/Instruction Window/Subthreshold Leakage': 0.0625755, 'Execution Unit/Instruction Scheduler/Instruction Window/Subthreshold Leakage with power gating': 0.0355964, 'Execution Unit/Instruction Scheduler/Peak Dynamic': 3.82262, 'Execution Unit/Instruction Scheduler/ROB/Area': 0.584388, 'Execution Unit/Instruction Scheduler/ROB/Gate Leakage': 0.00056608, 'Execution Unit/Instruction Scheduler/ROB/Peak Dynamic': 1.10451, 'Execution Unit/Instruction Scheduler/ROB/Runtime Dynamic': 0.0572105, 'Execution Unit/Instruction Scheduler/ROB/Subthreshold Leakage': 0.00906853, 'Execution Unit/Instruction Scheduler/ROB/Subthreshold Leakage with power gating': 0.00364446, 'Execution Unit/Instruction Scheduler/Runtime Dynamic': 0.24082, 'Execution Unit/Instruction Scheduler/Subthreshold Leakage': 0.0859892, 'Execution Unit/Instruction Scheduler/Subthreshold Leakage with power gating': 0.047346, 'Execution Unit/Integer ALUs/Area': 0.47087, 'Execution Unit/Integer ALUs/Gate Leakage': 0.0265291, 'Execution Unit/Integer ALUs/Peak Dynamic': 0.078271, 'Execution Unit/Integer ALUs/Runtime Dynamic': 0.101344, 'Execution Unit/Integer ALUs/Subthreshold Leakage': 0.40222, 'Execution Unit/Integer ALUs/Subthreshold Leakage with power gating': 0.150833, 'Execution Unit/Peak Dynamic': 4.00094, 'Execution Unit/Register Files/Area': 0.570804, 'Execution Unit/Register Files/Floating Point RF/Area': 0.208131, 'Execution Unit/Register Files/Floating Point RF/Gate Leakage': 0.000232788, 'Execution Unit/Register Files/Floating Point RF/Peak Dynamic': 0.00258252, 'Execution Unit/Register Files/Floating Point RF/Runtime Dynamic': 0.00294738, 'Execution Unit/Register Files/Floating Point RF/Subthreshold Leakage': 0.00399698, 'Execution Unit/Register Files/Floating Point RF/Subthreshold Leakage with power gating': 0.00176968, 'Execution Unit/Register Files/Gate Leakage': 0.000622708, 'Execution Unit/Register Files/Integer RF/Area': 0.362673, 'Execution Unit/Register Files/Integer RF/Gate Leakage': 0.00038992, 'Execution Unit/Register Files/Integer RF/Peak Dynamic': 0.0224475, 'Execution Unit/Register Files/Integer RF/Runtime Dynamic': 0.0217977, 'Execution Unit/Register Files/Integer RF/Subthreshold Leakage': 0.00614175, 'Execution Unit/Register Files/Integer RF/Subthreshold Leakage with power gating': 0.00246675, 'Execution Unit/Register Files/Peak Dynamic': 0.02503, 'Execution Unit/Register Files/Runtime Dynamic': 0.0247451, 'Execution Unit/Register Files/Subthreshold Leakage': 0.0101387, 'Execution Unit/Register Files/Subthreshold Leakage with power gating': 0.00423643, 'Execution Unit/Results Broadcast Bus/Area Overhead': 0.0390912, 'Execution Unit/Results Broadcast Bus/Gate Leakage': 0.00537402, 'Execution Unit/Results Broadcast Bus/Peak Dynamic': 0.0480021, 'Execution Unit/Results Broadcast Bus/Runtime Dynamic': 0.118752, 'Execution Unit/Results Broadcast Bus/Subthreshold Leakage': 0.081478, 'Execution Unit/Results Broadcast Bus/Subthreshold Leakage with power gating': 0.0305543, 'Execution Unit/Runtime Dynamic': 0.994617, 'Execution Unit/Subthreshold Leakage': 1.79543, 'Execution Unit/Subthreshold Leakage with power gating': 0.688821, 'Gate Leakage': 0.368936, 'Instruction Fetch Unit/Area': 5.85939, 'Instruction Fetch Unit/Branch Predictor/Area': 0.138516, 'Instruction Fetch Unit/Branch Predictor/Chooser/Area': 0.0435221, 'Instruction Fetch Unit/Branch Predictor/Chooser/Gate Leakage': 0.000278362, 'Instruction Fetch Unit/Branch Predictor/Chooser/Peak Dynamic': 0.0168831, 'Instruction Fetch Unit/Branch Predictor/Chooser/Runtime Dynamic': 0.000832841, 'Instruction Fetch Unit/Branch Predictor/Chooser/Subthreshold Leakage': 0.00759719, 'Instruction Fetch Unit/Branch Predictor/Chooser/Subthreshold Leakage with power gating': 0.0039236, 'Instruction Fetch Unit/Branch Predictor/Gate Leakage': 0.000757657, 'Instruction Fetch Unit/Branch Predictor/Global Predictor/Area': 0.0435221, 'Instruction Fetch Unit/Branch Predictor/Global Predictor/Gate Leakage': 0.000278362, 'Instruction Fetch Unit/Branch Predictor/Global Predictor/Peak Dynamic': 0.0168831, 'Instruction Fetch Unit/Branch Predictor/Global Predictor/Runtime Dynamic': 0.000832841, 'Instruction Fetch Unit/Branch Predictor/Global Predictor/Subthreshold Leakage': 0.00759719, 'Instruction Fetch Unit/Branch Predictor/Global Predictor/Subthreshold Leakage with power gating': 0.0039236, 'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Area': 0.0257064, 'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Gate Leakage': 0.000154548, 'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Peak Dynamic': 0.0142575, 'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Runtime Dynamic': 0.000733331, 'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Subthreshold Leakage': 0.00384344, 'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Subthreshold Leakage with power gating': 0.00198631, 'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Area': 0.0151917, 'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Gate Leakage': 8.00196e-05, 'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Peak Dynamic': 0.00527447, 'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Runtime Dynamic': 0.00028822, 'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Subthreshold Leakage': 0.00181347, 'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Subthreshold Leakage with power gating': 0.000957045, 'Instruction Fetch Unit/Branch Predictor/Peak Dynamic': 0.0597838, 'Instruction Fetch Unit/Branch Predictor/RAS/Area': 0.0105732, 'Instruction Fetch Unit/Branch Predictor/RAS/Gate Leakage': 4.63858e-05, 'Instruction Fetch Unit/Branch Predictor/RAS/Peak Dynamic': 0.0117602, 'Instruction Fetch Unit/Branch Predictor/RAS/Runtime Dynamic': 0.000313125, 'Instruction Fetch Unit/Branch Predictor/RAS/Subthreshold Leakage': 0.000932505, 'Instruction Fetch Unit/Branch Predictor/RAS/Subthreshold Leakage with power gating': 0.000494733, 'Instruction Fetch Unit/Branch Predictor/Runtime Dynamic': 0.00271214, 'Instruction Fetch Unit/Branch Predictor/Subthreshold Leakage': 0.0199703, 'Instruction Fetch Unit/Branch Predictor/Subthreshold Leakage with power gating': 0.0103282, 'Instruction Fetch Unit/Branch Target Buffer/Area': 0.64954, 'Instruction Fetch Unit/Branch Target Buffer/Gate Leakage': 0.00272758, 'Instruction Fetch Unit/Branch Target Buffer/Peak Dynamic': 0.177867, 'Instruction Fetch Unit/Branch Target Buffer/Runtime Dynamic': 0.00770199, 'Instruction Fetch Unit/Branch Target Buffer/Subthreshold Leakage': 0.0811682, 'Instruction Fetch Unit/Branch Target Buffer/Subthreshold Leakage with power gating': 0.0435357, 'Instruction Fetch Unit/Gate Leakage': 0.0589979, 'Instruction Fetch Unit/Instruction Buffer/Area': 0.0226323, 'Instruction Fetch Unit/Instruction Buffer/Gate Leakage': 6.83558e-05, 'Instruction Fetch Unit/Instruction Buffer/Peak Dynamic': 0.606827, 'Instruction Fetch Unit/Instruction Buffer/Runtime Dynamic': 0.0209547, 'Instruction Fetch Unit/Instruction Buffer/Subthreshold Leakage': 0.00151885, 'Instruction Fetch Unit/Instruction Buffer/Subthreshold Leakage with power gating': 0.000701682, 'Instruction Fetch Unit/Instruction Cache/Area': 3.14635, 'Instruction Fetch Unit/Instruction Cache/Gate Leakage': 0.029931, 'Instruction Fetch Unit/Instruction Cache/Peak Dynamic': 1.33289, 'Instruction Fetch Unit/Instruction Cache/Runtime Dynamic': 0.0685893, 'Instruction Fetch Unit/Instruction Cache/Subthreshold Leakage': 0.367022, 'Instruction Fetch Unit/Instruction Cache/Subthreshold Leakage with power gating': 0.180386, 'Instruction Fetch Unit/Instruction Decoder/Area': 1.85799, 'Instruction Fetch Unit/Instruction Decoder/Gate Leakage': 0.0222493, 'Instruction Fetch Unit/Instruction Decoder/Peak Dynamic': 1.37404, 'Instruction Fetch Unit/Instruction Decoder/Runtime Dynamic': 0.0711715, 'Instruction Fetch Unit/Instruction Decoder/Subthreshold Leakage': 0.442943, 'Instruction Fetch Unit/Instruction Decoder/Subthreshold Leakage with power gating': 0.166104, 'Instruction Fetch Unit/Peak Dynamic': 3.6161, 'Instruction Fetch Unit/Runtime Dynamic': 0.17113, 'Instruction Fetch Unit/Subthreshold Leakage': 0.932286, 'Instruction Fetch Unit/Subthreshold Leakage with power gating': 0.40843, 'L2/Area': 4.53318, 'L2/Gate Leakage': 0.015464, 'L2/Peak Dynamic': 0.0420885, 'L2/Runtime Dynamic': 0.0122313, 'L2/Subthreshold Leakage': 0.834142, 'L2/Subthreshold Leakage with power gating': 0.401066, 'Load Store Unit/Area': 8.80901, 'Load Store Unit/Data Cache/Area': 6.84535, 'Load Store Unit/Data Cache/Gate Leakage': 0.0279261, 'Load Store Unit/Data Cache/Peak Dynamic': 1.73161, 'Load Store Unit/Data Cache/Runtime Dynamic': 0.256355, 'Load Store Unit/Data Cache/Subthreshold Leakage': 0.527675, 'Load Store Unit/Data Cache/Subthreshold Leakage with power gating': 0.25085, 'Load Store Unit/Gate Leakage': 0.0350888, 'Load Store Unit/LoadQ/Area': 0.0836782, 'Load Store Unit/LoadQ/Gate Leakage': 0.00059896, 'Load Store Unit/LoadQ/Peak Dynamic': 0.0159978, 'Load Store Unit/LoadQ/Runtime Dynamic': 0.0159977, 'Load Store Unit/LoadQ/Subthreshold Leakage': 0.00941961, 'Load Store Unit/LoadQ/Subthreshold Leakage with power gating': 0.00536918, 'Load Store Unit/Peak Dynamic': 1.80715, 'Load Store Unit/Runtime Dynamic': 0.351248, 'Load Store Unit/StoreQ/Area': 0.322079, 'Load Store Unit/StoreQ/Gate Leakage': 0.00329971, 'Load Store Unit/StoreQ/Peak Dynamic': 0.0394478, 'Load Store Unit/StoreQ/Runtime Dynamic': 0.0788953, 'Load Store Unit/StoreQ/Subthreshold Leakage': 0.0345621, 'Load Store Unit/StoreQ/Subthreshold Leakage with power gating': 0.0197004, 'Load Store Unit/Subthreshold Leakage': 0.591321, 'Load Store Unit/Subthreshold Leakage with power gating': 0.283293, 'Memory Management Unit/Area': 0.4339, 'Memory Management Unit/Dtlb/Area': 0.0879726, 'Memory Management Unit/Dtlb/Gate Leakage': 0.00088729, 'Memory Management Unit/Dtlb/Peak Dynamic': 0.0140001, 'Memory Management Unit/Dtlb/Runtime Dynamic': 0.014631, 'Memory Management Unit/Dtlb/Subthreshold Leakage': 0.0155699, 'Memory Management Unit/Dtlb/Subthreshold Leakage with power gating': 0.00887485, 'Memory Management Unit/Gate Leakage': 0.00808595, 'Memory Management Unit/Itlb/Area': 0.301552, 'Memory Management Unit/Itlb/Gate Leakage': 0.00393464, 'Memory Management Unit/Itlb/Peak Dynamic': 0.0828745, 'Memory Management Unit/Itlb/Runtime Dynamic': 0.011248, 'Memory Management Unit/Itlb/Subthreshold Leakage': 0.0413758, 'Memory Management Unit/Itlb/Subthreshold Leakage with power gating': 0.0235842, 'Memory Management Unit/Peak Dynamic': 0.263033, 'Memory Management Unit/Runtime Dynamic': 0.025879, 'Memory Management Unit/Subthreshold Leakage': 0.0766103, 'Memory Management Unit/Subthreshold Leakage with power gating': 0.0398333, 'Peak Dynamic': 13.3188, 'Renaming Unit/Area': 0.303608, 'Renaming Unit/FP Front End RAT/Area': 0.131045, 'Renaming Unit/FP Front End RAT/Gate Leakage': 0.00351123, 'Renaming Unit/FP Front End RAT/Peak Dynamic': 2.51468, 'Renaming Unit/FP Front End RAT/Runtime Dynamic': 0.0067936, 'Renaming Unit/FP Front End RAT/Subthreshold Leakage': 0.0308571, 'Renaming Unit/FP Front End RAT/Subthreshold Leakage with power gating': 0.0175885, 'Renaming Unit/Free List/Area': 0.0340654, 'Renaming Unit/Free List/Gate Leakage': 2.5481e-05, 'Renaming Unit/Free List/Peak Dynamic': 0.0306032, 'Renaming Unit/Free List/Runtime Dynamic': 0.003253, 'Renaming Unit/Free List/Subthreshold Leakage': 0.000370144, 'Renaming Unit/Free List/Subthreshold Leakage with power gating': 0.000201064, 'Renaming Unit/Gate Leakage': 0.00708398, 'Renaming Unit/Int Front End RAT/Area': 0.0941223, 'Renaming Unit/Int Front End RAT/Gate Leakage': 0.000283242, 'Renaming Unit/Int Front End RAT/Peak Dynamic': 0.731965, 'Renaming Unit/Int Front End RAT/Runtime Dynamic': 0.0356485, 'Renaming Unit/Int Front End RAT/Subthreshold Leakage': 0.00435488, 'Renaming Unit/Int Front End RAT/Subthreshold Leakage with power gating': 0.00248228, 'Renaming Unit/Peak Dynamic': 3.58947, 'Renaming Unit/Runtime Dynamic': 0.0456951, 'Renaming Unit/Subthreshold Leakage': 0.0552466, 'Renaming Unit/Subthreshold Leakage with power gating': 0.0276461, 'Runtime Dynamic': 1.6008, 'Subthreshold Leakage': 6.16288, 'Subthreshold Leakage with power gating': 2.55328}, {'Area': 32.0201, 'Execution Unit/Area': 7.68434, 'Execution Unit/Complex ALUs/Area': 0.235435, 'Execution Unit/Complex ALUs/Gate Leakage': 0.0132646, 'Execution Unit/Complex ALUs/Peak Dynamic': 0.00224742, 'Execution Unit/Complex ALUs/Runtime Dynamic': 0.204454, 'Execution Unit/Complex ALUs/Subthreshold Leakage': 0.20111, 'Execution Unit/Complex ALUs/Subthreshold Leakage with power gating': 0.0754163, 'Execution Unit/Floating Point Units/Area': 4.6585, 'Execution Unit/Floating Point Units/Gate Leakage': 0.0656156, 'Execution Unit/Floating Point Units/Peak Dynamic': 0.0108716, 'Execution Unit/Floating Point Units/Runtime Dynamic': 0.304033, 'Execution Unit/Floating Point Units/Subthreshold Leakage': 0.994829, 'Execution Unit/Floating Point Units/Subthreshold Leakage with power gating': 0.373061, 'Execution Unit/Gate Leakage': 0.120359, 'Execution Unit/Instruction Scheduler/Area': 1.66526, 'Execution Unit/Instruction Scheduler/FP Instruction Window/Area': 0.275653, 'Execution Unit/Instruction Scheduler/FP Instruction Window/Gate Leakage': 0.000977433, 'Execution Unit/Instruction Scheduler/FP Instruction Window/Peak Dynamic': 1.04181, 'Execution Unit/Instruction Scheduler/FP Instruction Window/Runtime Dynamic': 0.0730174, 'Execution Unit/Instruction Scheduler/FP Instruction Window/Subthreshold Leakage': 0.0143453, 'Execution Unit/Instruction Scheduler/FP Instruction Window/Subthreshold Leakage with power gating': 0.00810519, 'Execution Unit/Instruction Scheduler/Gate Leakage': 0.00568913, 'Execution Unit/Instruction Scheduler/Instruction Window/Area': 0.805223, 'Execution Unit/Instruction Scheduler/Instruction Window/Gate Leakage': 0.00414562, 'Execution Unit/Instruction Scheduler/Instruction Window/Peak Dynamic': 1.6763, 'Execution Unit/Instruction Scheduler/Instruction Window/Runtime Dynamic': 0.117774, 'Execution Unit/Instruction Scheduler/Instruction Window/Subthreshold Leakage': 0.0625755, 'Execution Unit/Instruction Scheduler/Instruction Window/Subthreshold Leakage with power gating': 0.0355964, 'Execution Unit/Instruction Scheduler/Peak Dynamic': 3.82262, 'Execution Unit/Instruction Scheduler/ROB/Area': 0.584388, 'Execution Unit/Instruction Scheduler/ROB/Gate Leakage': 0.00056608, 'Execution Unit/Instruction Scheduler/ROB/Peak Dynamic': 1.10451, 'Execution Unit/Instruction Scheduler/ROB/Runtime Dynamic': 0.0594486, 'Execution Unit/Instruction Scheduler/ROB/Subthreshold Leakage': 0.00906853, 'Execution Unit/Instruction Scheduler/ROB/Subthreshold Leakage with power gating': 0.00364446, 'Execution Unit/Instruction Scheduler/Runtime Dynamic': 0.25024, 'Execution Unit/Instruction Scheduler/Subthreshold Leakage': 0.0859892, 'Execution Unit/Instruction Scheduler/Subthreshold Leakage with power gating': 0.047346, 'Execution Unit/Integer ALUs/Area': 0.47087, 'Execution Unit/Integer ALUs/Gate Leakage': 0.0265291, 'Execution Unit/Integer ALUs/Peak Dynamic': 0.0818435, 'Execution Unit/Integer ALUs/Runtime Dynamic': 0.101344, 'Execution Unit/Integer ALUs/Subthreshold Leakage': 0.40222, 'Execution Unit/Integer ALUs/Subthreshold Leakage with power gating': 0.150833, 'Execution Unit/Peak Dynamic': 4.00276, 'Execution Unit/Register Files/Area': 0.570804, 'Execution Unit/Register Files/Floating Point RF/Area': 0.208131, 'Execution Unit/Register Files/Floating Point RF/Gate Leakage': 0.000232788, 'Execution Unit/Register Files/Floating Point RF/Peak Dynamic': 0.00205387, 'Execution Unit/Register Files/Floating Point RF/Runtime Dynamic': 0.00306268, 'Execution Unit/Register Files/Floating Point RF/Subthreshold Leakage': 0.00399698, 'Execution Unit/Register Files/Floating Point RF/Subthreshold Leakage with power gating': 0.00176968, 'Execution Unit/Register Files/Gate Leakage': 0.000622708, 'Execution Unit/Register Files/Integer RF/Area': 0.362673, 'Execution Unit/Register Files/Integer RF/Gate Leakage': 0.00038992, 'Execution Unit/Register Files/Integer RF/Peak Dynamic': 0.0230397, 'Execution Unit/Register Files/Integer RF/Runtime Dynamic': 0.0226504, 'Execution Unit/Register Files/Integer RF/Subthreshold Leakage': 0.00614175, 'Execution Unit/Register Files/Integer RF/Subthreshold Leakage with power gating': 0.00246675, 'Execution Unit/Register Files/Peak Dynamic': 0.0250936, 'Execution Unit/Register Files/Runtime Dynamic': 0.0257131, 'Execution Unit/Register Files/Subthreshold Leakage': 0.0101387, 'Execution Unit/Register Files/Subthreshold Leakage with power gating': 0.00423643, 'Execution Unit/Results Broadcast Bus/Area Overhead': 0.0390912, 'Execution Unit/Results Broadcast Bus/Gate Leakage': 0.00537402, 'Execution Unit/Results Broadcast Bus/Peak Dynamic': 0.0491003, 'Execution Unit/Results Broadcast Bus/Runtime Dynamic': 0.12115, 'Execution Unit/Results Broadcast Bus/Subthreshold Leakage': 0.081478, 'Execution Unit/Results Broadcast Bus/Subthreshold Leakage with power gating': 0.0305543, 'Execution Unit/Runtime Dynamic': 1.00693, 'Execution Unit/Subthreshold Leakage': 1.79543, 'Execution Unit/Subthreshold Leakage with power gating': 0.688821, 'Gate Leakage': 0.368936, 'Instruction Fetch Unit/Area': 5.85939, 'Instruction Fetch Unit/Branch Predictor/Area': 0.138516, 'Instruction Fetch Unit/Branch Predictor/Chooser/Area': 0.0435221, 'Instruction Fetch Unit/Branch Predictor/Chooser/Gate Leakage': 0.000278362, 'Instruction Fetch Unit/Branch Predictor/Chooser/Peak Dynamic': 0.0168831, 'Instruction Fetch Unit/Branch Predictor/Chooser/Runtime Dynamic': 0.000924954, 'Instruction Fetch Unit/Branch Predictor/Chooser/Subthreshold Leakage': 0.00759719, 'Instruction Fetch Unit/Branch Predictor/Chooser/Subthreshold Leakage with power gating': 0.0039236, 'Instruction Fetch Unit/Branch Predictor/Gate Leakage': 0.000757657, 'Instruction Fetch Unit/Branch Predictor/Global Predictor/Area': 0.0435221, 'Instruction Fetch Unit/Branch Predictor/Global Predictor/Gate Leakage': 0.000278362, 'Instruction Fetch Unit/Branch Predictor/Global Predictor/Peak Dynamic': 0.0168831, 'Instruction Fetch Unit/Branch Predictor/Global Predictor/Runtime Dynamic': 0.000924954, 'Instruction Fetch Unit/Branch Predictor/Global Predictor/Subthreshold Leakage': 0.00759719, 'Instruction Fetch Unit/Branch Predictor/Global Predictor/Subthreshold Leakage with power gating': 0.0039236, 'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Area': 0.0257064, 'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Gate Leakage': 0.000154548, 'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Peak Dynamic': 0.0142575, 'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Runtime Dynamic': 0.000812503, 'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Subthreshold Leakage': 0.00384344, 'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Subthreshold Leakage with power gating': 0.00198631, 'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Area': 0.0151917, 'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Gate Leakage': 8.00196e-05, 'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Peak Dynamic': 0.00527447, 'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Runtime Dynamic': 0.00031829, 'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Subthreshold Leakage': 0.00181347, 'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Subthreshold Leakage with power gating': 0.000957045, 'Instruction Fetch Unit/Branch Predictor/Peak Dynamic': 0.0597838, 'Instruction Fetch Unit/Branch Predictor/RAS/Area': 0.0105732, 'Instruction Fetch Unit/Branch Predictor/RAS/Gate Leakage': 4.63858e-05, 'Instruction Fetch Unit/Branch Predictor/RAS/Peak Dynamic': 0.0117602, 'Instruction Fetch Unit/Branch Predictor/RAS/Runtime Dynamic': 0.000325375, 'Instruction Fetch Unit/Branch Predictor/RAS/Subthreshold Leakage': 0.000932505, 'Instruction Fetch Unit/Branch Predictor/RAS/Subthreshold Leakage with power gating': 0.000494733, 'Instruction Fetch Unit/Branch Predictor/Runtime Dynamic': 0.00298779, 'Instruction Fetch Unit/Branch Predictor/Subthreshold Leakage': 0.0199703, 'Instruction Fetch Unit/Branch Predictor/Subthreshold Leakage with power gating': 0.0103282, 'Instruction Fetch Unit/Branch Target Buffer/Area': 0.64954, 'Instruction Fetch Unit/Branch Target Buffer/Gate Leakage': 0.00272758, 'Instruction Fetch Unit/Branch Target Buffer/Peak Dynamic': 0.177867, 'Instruction Fetch Unit/Branch Target Buffer/Runtime Dynamic': 0.00862293, 'Instruction Fetch Unit/Branch Target Buffer/Subthreshold Leakage': 0.0811682, 'Instruction Fetch Unit/Branch Target Buffer/Subthreshold Leakage with power gating': 0.0435357, 'Instruction Fetch Unit/Gate Leakage': 0.0589979, 'Instruction Fetch Unit/Instruction Buffer/Area': 0.0226323, 'Instruction Fetch Unit/Instruction Buffer/Gate Leakage': 6.83558e-05, 'Instruction Fetch Unit/Instruction Buffer/Peak Dynamic': 0.606827, 'Instruction Fetch Unit/Instruction Buffer/Runtime Dynamic': 0.0217744, 'Instruction Fetch Unit/Instruction Buffer/Subthreshold Leakage': 0.00151885, 'Instruction Fetch Unit/Instruction Buffer/Subthreshold Leakage with power gating': 0.000701682, 'Instruction Fetch Unit/Instruction Cache/Area': 3.14635, 'Instruction Fetch Unit/Instruction Cache/Gate Leakage': 0.029931, 'Instruction Fetch Unit/Instruction Cache/Peak Dynamic': 1.38504, 'Instruction Fetch Unit/Instruction Cache/Runtime Dynamic': 0.0787611, 'Instruction Fetch Unit/Instruction Cache/Subthreshold Leakage': 0.367022, 'Instruction Fetch Unit/Instruction Cache/Subthreshold Leakage with power gating': 0.180386, 'Instruction Fetch Unit/Instruction Decoder/Area': 1.85799, 'Instruction Fetch Unit/Instruction Decoder/Gate Leakage': 0.0222493, 'Instruction Fetch Unit/Instruction Decoder/Peak Dynamic': 1.37404, 'Instruction Fetch Unit/Instruction Decoder/Runtime Dynamic': 0.0739556, 'Instruction Fetch Unit/Instruction Decoder/Subthreshold Leakage': 0.442943, 'Instruction Fetch Unit/Instruction Decoder/Subthreshold Leakage with power gating': 0.166104, 'Instruction Fetch Unit/Peak Dynamic': 3.67077, 'Instruction Fetch Unit/Runtime Dynamic': 0.186102, 'Instruction Fetch Unit/Subthreshold Leakage': 0.932286, 'Instruction Fetch Unit/Subthreshold Leakage with power gating': 0.40843, 'L2/Area': 4.53318, 'L2/Gate Leakage': 0.015464, 'L2/Peak Dynamic': 0.0378135, 'L2/Runtime Dynamic': 0.00922845, 'L2/Subthreshold Leakage': 0.834142, 'L2/Subthreshold Leakage with power gating': 0.401066, 'Load Store Unit/Area': 8.80901, 'Load Store Unit/Data Cache/Area': 6.84535, 'Load Store Unit/Data Cache/Gate Leakage': 0.0279261, 'Load Store Unit/Data Cache/Peak Dynamic': 1.71739, 'Load Store Unit/Data Cache/Runtime Dynamic': 0.244396, 'Load Store Unit/Data Cache/Subthreshold Leakage': 0.527675, 'Load Store Unit/Data Cache/Subthreshold Leakage with power gating': 0.25085, 'Load Store Unit/Gate Leakage': 0.0350888, 'Load Store Unit/LoadQ/Area': 0.0836782, 'Load Store Unit/LoadQ/Gate Leakage': 0.00059896, 'Load Store Unit/LoadQ/Peak Dynamic': 0.0155378, 'Load Store Unit/LoadQ/Runtime Dynamic': 0.0155378, 'Load Store Unit/LoadQ/Subthreshold Leakage': 0.00941961, 'Load Store Unit/LoadQ/Subthreshold Leakage with power gating': 0.00536918, 'Load Store Unit/Peak Dynamic': 1.79076, 'Load Store Unit/Runtime Dynamic': 0.336561, 'Load Store Unit/StoreQ/Area': 0.322079, 'Load Store Unit/StoreQ/Gate Leakage': 0.00329971, 'Load Store Unit/StoreQ/Peak Dynamic': 0.0383135, 'Load Store Unit/StoreQ/Runtime Dynamic': 0.0766271, 'Load Store Unit/StoreQ/Subthreshold Leakage': 0.0345621, 'Load Store Unit/StoreQ/Subthreshold Leakage with power gating': 0.0197004, 'Load Store Unit/Subthreshold Leakage': 0.591321, 'Load Store Unit/Subthreshold Leakage with power gating': 0.283293, 'Memory Management Unit/Area': 0.4339, 'Memory Management Unit/Dtlb/Area': 0.0879726, 'Memory Management Unit/Dtlb/Gate Leakage': 0.00088729, 'Memory Management Unit/Dtlb/Peak Dynamic': 0.0135976, 'Memory Management Unit/Dtlb/Runtime Dynamic': 0.0141645, 'Memory Management Unit/Dtlb/Subthreshold Leakage': 0.0155699, 'Memory Management Unit/Dtlb/Subthreshold Leakage with power gating': 0.00887485, 'Memory Management Unit/Gate Leakage': 0.00808595, 'Memory Management Unit/Itlb/Area': 0.301552, 'Memory Management Unit/Itlb/Gate Leakage': 0.00393464, 'Memory Management Unit/Itlb/Peak Dynamic': 0.0861164, 'Memory Management Unit/Itlb/Runtime Dynamic': 0.0129149, 'Memory Management Unit/Itlb/Subthreshold Leakage': 0.0413758, 'Memory Management Unit/Itlb/Subthreshold Leakage with power gating': 0.0235842, 'Memory Management Unit/Peak Dynamic': 0.265584, 'Memory Management Unit/Runtime Dynamic': 0.0270794, 'Memory Management Unit/Subthreshold Leakage': 0.0766103, 'Memory Management Unit/Subthreshold Leakage with power gating': 0.0398333, 'Peak Dynamic': 13.3572, 'Renaming Unit/Area': 0.303608, 'Renaming Unit/FP Front End RAT/Area': 0.131045, 'Renaming Unit/FP Front End RAT/Gate Leakage': 0.00351123, 'Renaming Unit/FP Front End RAT/Peak Dynamic': 2.51468, 'Renaming Unit/FP Front End RAT/Runtime Dynamic': 0.00540304, 'Renaming Unit/FP Front End RAT/Subthreshold Leakage': 0.0308571, 'Renaming Unit/FP Front End RAT/Subthreshold Leakage with power gating': 0.0175885, 'Renaming Unit/Free List/Area': 0.0340654, 'Renaming Unit/Free List/Gate Leakage': 2.5481e-05, 'Renaming Unit/Free List/Peak Dynamic': 0.0306032, 'Renaming Unit/Free List/Runtime Dynamic': 0.0033601, 'Renaming Unit/Free List/Subthreshold Leakage': 0.000370144, 'Renaming Unit/Free List/Subthreshold Leakage with power gating': 0.000201064, 'Renaming Unit/Gate Leakage': 0.00708398, 'Renaming Unit/Int Front End RAT/Area': 0.0941223, 'Renaming Unit/Int Front End RAT/Gate Leakage': 0.000283242, 'Renaming Unit/Int Front End RAT/Peak Dynamic': 0.731965, 'Renaming Unit/Int Front End RAT/Runtime Dynamic': 0.0369423, 'Renaming Unit/Int Front End RAT/Subthreshold Leakage': 0.00435488, 'Renaming Unit/Int Front End RAT/Subthreshold Leakage with power gating': 0.00248228, 'Renaming Unit/Peak Dynamic': 3.58947, 'Renaming Unit/Runtime Dynamic': 0.0457054, 'Renaming Unit/Subthreshold Leakage': 0.0552466, 'Renaming Unit/Subthreshold Leakage with power gating': 0.0276461, 'Runtime Dynamic': 1.61161, 'Subthreshold Leakage': 6.16288, 'Subthreshold Leakage with power gating': 2.55328}], 'DRAM': {'Area': 0, 'Gate Leakage': 0, 'Peak Dynamic': 6.846855329007461, 'Runtime Dynamic': 6.846855329007461, 'Subthreshold Leakage': 4.252, 'Subthreshold Leakage with power gating': 4.252}, 'L3': [{'Area': 61.9075, 'Gate Leakage': 0.0484137, 'Peak Dynamic': 0.380719, 'Runtime Dynamic': 0.170717, 'Subthreshold Leakage': 6.80085, 'Subthreshold Leakage with power gating': 3.32364}], 'Processor': {'Area': 191.908, 'Gate Leakage': 1.53485, 'Peak Dynamic': 57.5671, 'Peak Power': 90.6793, 'Runtime Dynamic': 7.56743, 'Subthreshold Leakage': 31.5774, 'Subthreshold Leakage with power gating': 13.9484, 'Total Cores/Area': 128.669, 'Total Cores/Gate Leakage': 1.4798, 'Total Cores/Peak Dynamic': 57.1864, 'Total Cores/Runtime Dynamic': 7.39671, 'Total Cores/Subthreshold Leakage': 24.7074, 'Total Cores/Subthreshold Leakage with power gating': 10.2429, 'Total L3s/Area': 61.9075, 'Total L3s/Gate Leakage': 0.0484137, 'Total L3s/Peak Dynamic': 0.380719, 'Total L3s/Runtime Dynamic': 0.170717, 'Total L3s/Subthreshold Leakage': 6.80085, 'Total L3s/Subthreshold Leakage with power gating': 3.32364, 'Total Leakage': 33.1122, 'Total NoCs/Area': 1.33155, 'Total NoCs/Gate Leakage': 0.00662954, 'Total NoCs/Peak Dynamic': 0.0, 'Total NoCs/Runtime Dynamic': 0.0, 'Total NoCs/Subthreshold Leakage': 0.0691322, 'Total NoCs/Subthreshold Leakage with power gating': 0.0259246}}
""" A min priority queue implementation using a binary heap. @author Swapnil Trambake, trambake.swapnil@gmail.com """ class BinaryHeap(): """ Class implements binary heap using array """ def __init__(self) -> None: super().__init__() self.__heap = [] def print(self): """ Prints heap on console """ print('The heap is: {}'.format(self.__heap)) def add(self, item : int): """ Add element into binary heap """ print('Adding {}'.format(item)) self.__heap.append(item) self.__swim(len(self.__heap) - 1) def poll(self): """ Poll the heap, which gets high priority element """ value = self.__heap[0] self.__remove(0) print('Polled {}'.format(value)) return value def remove(self, value): """ Removes specific element from heap """ index = self.__find(value) if index: self.__remove(index) def __remove(self, index): print('Removing {} at index {}'.format(self.__heap[index], index)) last_index = len(self.__heap) - 1 if index != last_index: self.__swap(index, last_index) del self.__heap[last_index] parent_index = int((index - 1) / 2) if parent_index <= 0 or self.__heap[parent_index] < self.__heap[index]: self.__sink(index) else: self.__swim(index) def __find(self, value): print('Finding {} in heap'.format(value)) index = None for i, val in enumerate(self.__heap): if value == val: index = i break print ('{} value {} in heap'.format('Found' if index else 'Not found', value)) return index def __swim(self, index): """ Perform bottom up swim o(log(n)) """ while True: parent = int((index - 1) / 2) if parent != index and \ self.__heap[parent] >= self.__heap[index]: self.__swap(parent, index) index = parent else: break def __sink(self, index): """ Perform top down sink o(log(n)) """ while index < len(self.__heap): leftChildIndex = 2 * index + 1 rightChildIndex = 2 * index + 2 if leftChildIndex < len(self.__heap) or rightChildIndex < len(self.__heap): if rightChildIndex < len(self.__heap): if self.__heap[index] > self.__heap[leftChildIndex] and \ self.__heap[index] > self.__heap[rightChildIndex]: indexToReplace = leftChildIndex \ if self.__heap[leftChildIndex] <= self.__heap[rightChildIndex] \ else rightChildIndex elif self.__heap[index] > self.__heap[leftChildIndex]: indexToReplace = leftChildIndex else: break else: if self.__heap[index] > self.__heap[leftChildIndex]: indexToReplace = leftChildIndex else: break else: break self.__swap(index, indexToReplace) index = indexToReplace def __swap(self, index1, index2): temp = self.__heap[index2] self.__heap[index2] = self.__heap[index1] self.__heap[index1] = temp
# tests.utils_tests # Tests for the Baleen utilities package. # # Author: Benjamin Bengfort <benjamin@bengfort.com> # Created: Sun Feb 21 15:31:55 2016 -0500 # # Copyright (C) 2016 Bengfort.com # For license information, see LICENSE.txt # # ID: __init__.py [] benjamin@bengfort.com $ """ Tests for the Baleen utilities package. """ ########################################################################## ## Imports ##########################################################################
budget = float(input()) statists = int(input()) one_costume_price = float(input()) decor_price = 0.1 * budget costumes_price = statists * one_costume_price if statists >= 150: costumes_price -= 0.1 * costumes_price total_price = decor_price + costumes_price money_left = budget - total_price money_needed = total_price - budget if money_left < 0: print("Not enough money!") print(f"Wingard needs {money_needed:.2f} leva more.") else: print("Action!") print(f"Wingard starts filming with {money_left:.2f} leva left.")