content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
""" One way of improving the memory efficiency of the NaiveStack would be to recognise that: [] [1] [1,2] [1,2,3] Holds the same information as: [1, 2, 3] (on the assumption that there have been no pops) So rather than creating a new version for every push and every pop, we could create a new version only on pops, since it is easy to see what the previous version of a stack that has been pushed to was. This does mean that finding a particular version would no longer be a simple index look-up. You'd need to iterate through each version until you found the right one. Rather than storing a copy of each version, perhaps it would be more memory efficient to store the sequence of update operations. And when a particular version is asked for, we could then re-create that particular version from scratch? This would come at a cost for reading. Each read would require all the update operations to be re-run first. One solution to this might be to store a) the most recently accessed version r, and b) the sequence of update operations, and c) to make sure all update operations are reversible. Then, if we want to read from version v, rather than iterating through update operations from 0 to v, we could find the 'fastest path' either forwards or backwards from r to v. A stack is readily reversible. The reverse of a push is a pop. And the reverse of a pop is to push its return value. If we know the sequence of pushes and pops we can start at any point in that sequence and go back and forth in it. Let's implement that as ReversibleStack. """ class NaiveStack: """ A partially persistent stack that makes no effort to save space or time. """ def __init__(self): self.stacks = [[]] def push(self, value): new_stack = self.stacks[-1].copy() new_stack.append(value) self.stacks.append(new_stack) def pop(self): new_stack = self.stacks[-1].copy() value = new_stack.pop() self.stacks.append(new_stack) return value def read(self, version, index): return self.stacks[version][index] def show(self): for stack in self.stacks: print(stack) class SequenceStack: """ A partially persistent stack that iterates through a subsequence of update operations to return a given version. Saves space but slows down read operations.""" def __init__(self): self.sequence = [] # the complete sequence of pushes and pops def push(self, value): """Append a push operation to end of update sequence.""" self.sequence.append(lambda stack: stack.append(value)) def pop(self): """Append a pop operation to end of update sequence.""" self.sequence.append(lambda stack: stack.pop()) def read_version(self, version): """Return the stack as it was at version.""" stack = [] for update_operation in self.sequence[:version]: update_operation(stack) return stack def read(self, version, index): return self.read_version(version)[index] def show(self): """ Print all versions of the stack. """ for v in range(len(self.sequence)): print("version {}: ".format(v), self.read_version(v)) class ReversibleSequenceStack: """ A partially persistent stack that stores the most recently read version and iterates either forwards or backwards through the sequence of update operations to return a requested version. This saves on space (although doubles the space requirements for storing update operations because we are saving both the original and its reverse), and tries to make up for the slow reading operation by reducing how many update operations must be applied to reach the desired version.""" def __init__(self): self.sequence = [] # the complete sequence of pushes and pops self.stack = [] # most recently read version of the stack self.version = 0 # most recently read version def push(self, value): """Append a tuple of push and pop operation to end of update sequence.""" # the second value of the tuple is the opposite and can be used to iterate backwards op = lambda stack: stack.append(value) rev_op = lambda stack: stack.pop() self.sequence.append((op, rev_op)) def pop(self): """Append a tuple of pop and push operation to end of update sequence.""" # the second value of the tuple is the opposite and can be used to iterate backwards value = self.read_version(len(self.sequence))[-1] op = lambda stack: stack.pop() rev_op = lambda stack: stack.append(value) self.sequence.append((op, rev_op)) def read_version(self, version): """Return the stack as it was at version.""" if version == self.version: return self.stack while self.version < version: update_operation = self.sequence[self.version][0] self.version += 1 update_operation(self.stack) while self.version > version: update_operation = self.sequence[self.version-1][1] self.version -= 1 update_operation(self.stack) return self.stack def read(self, version, index): return self.read_version(version)[index] rs = ReversibleSequenceStack() rs.push(1) rs.push(2) rs.push(3) rs.pop() rs.pop() rs.push(7) for i in range(0, 7): print(i, rs.read_version(i)) for i in range(6, -1, -1): print(i, rs.read_version(i))
""" One way of improving the memory efficiency of the NaiveStack would be to recognise that: [] [1] [1,2] [1,2,3] Holds the same information as: [1, 2, 3] (on the assumption that there have been no pops) So rather than creating a new version for every push and every pop, we could create a new version only on pops, since it is easy to see what the previous version of a stack that has been pushed to was. This does mean that finding a particular version would no longer be a simple index look-up. You'd need to iterate through each version until you found the right one. Rather than storing a copy of each version, perhaps it would be more memory efficient to store the sequence of update operations. And when a particular version is asked for, we could then re-create that particular version from scratch? This would come at a cost for reading. Each read would require all the update operations to be re-run first. One solution to this might be to store a) the most recently accessed version r, and b) the sequence of update operations, and c) to make sure all update operations are reversible. Then, if we want to read from version v, rather than iterating through update operations from 0 to v, we could find the 'fastest path' either forwards or backwards from r to v. A stack is readily reversible. The reverse of a push is a pop. And the reverse of a pop is to push its return value. If we know the sequence of pushes and pops we can start at any point in that sequence and go back and forth in it. Let's implement that as ReversibleStack. """ class Naivestack: """ A partially persistent stack that makes no effort to save space or time. """ def __init__(self): self.stacks = [[]] def push(self, value): new_stack = self.stacks[-1].copy() new_stack.append(value) self.stacks.append(new_stack) def pop(self): new_stack = self.stacks[-1].copy() value = new_stack.pop() self.stacks.append(new_stack) return value def read(self, version, index): return self.stacks[version][index] def show(self): for stack in self.stacks: print(stack) class Sequencestack: """ A partially persistent stack that iterates through a subsequence of update operations to return a given version. Saves space but slows down read operations.""" def __init__(self): self.sequence = [] def push(self, value): """Append a push operation to end of update sequence.""" self.sequence.append(lambda stack: stack.append(value)) def pop(self): """Append a pop operation to end of update sequence.""" self.sequence.append(lambda stack: stack.pop()) def read_version(self, version): """Return the stack as it was at version.""" stack = [] for update_operation in self.sequence[:version]: update_operation(stack) return stack def read(self, version, index): return self.read_version(version)[index] def show(self): """ Print all versions of the stack. """ for v in range(len(self.sequence)): print('version {}: '.format(v), self.read_version(v)) class Reversiblesequencestack: """ A partially persistent stack that stores the most recently read version and iterates either forwards or backwards through the sequence of update operations to return a requested version. This saves on space (although doubles the space requirements for storing update operations because we are saving both the original and its reverse), and tries to make up for the slow reading operation by reducing how many update operations must be applied to reach the desired version.""" def __init__(self): self.sequence = [] self.stack = [] self.version = 0 def push(self, value): """Append a tuple of push and pop operation to end of update sequence.""" op = lambda stack: stack.append(value) rev_op = lambda stack: stack.pop() self.sequence.append((op, rev_op)) def pop(self): """Append a tuple of pop and push operation to end of update sequence.""" value = self.read_version(len(self.sequence))[-1] op = lambda stack: stack.pop() rev_op = lambda stack: stack.append(value) self.sequence.append((op, rev_op)) def read_version(self, version): """Return the stack as it was at version.""" if version == self.version: return self.stack while self.version < version: update_operation = self.sequence[self.version][0] self.version += 1 update_operation(self.stack) while self.version > version: update_operation = self.sequence[self.version - 1][1] self.version -= 1 update_operation(self.stack) return self.stack def read(self, version, index): return self.read_version(version)[index] rs = reversible_sequence_stack() rs.push(1) rs.push(2) rs.push(3) rs.pop() rs.pop() rs.push(7) for i in range(0, 7): print(i, rs.read_version(i)) for i in range(6, -1, -1): print(i, rs.read_version(i))
__all__ = ("Values", ) class Data(object): def __init__( self, plugin_instance=None, meta=None, plugin=None, host=None, type=None, type_instance=None, interval=None, time=None, values=None, ): self.plugin = plugin self.plugin_instance = plugin_instance, self.meta = meta self.host = host self.type = type self.type_instance = type_instance self.dstypes = dstypes self.values = values self.interval = interval self.time = time def dispatch(self): pass def mk_values( plugin_instance=None, meta=None, plugin=None, host=None, type=None, type_instance=None, interval=None, time=None, values=None, ): return Data( plugin_instance=plugin_instance, meta=meta, plugin=plugin, host=host, type=type, type_instance=type_instance, interval=interval, time=time, values=values, ) Values = mk_values
__all__ = ('Values',) class Data(object): def __init__(self, plugin_instance=None, meta=None, plugin=None, host=None, type=None, type_instance=None, interval=None, time=None, values=None): self.plugin = plugin self.plugin_instance = (plugin_instance,) self.meta = meta self.host = host self.type = type self.type_instance = type_instance self.dstypes = dstypes self.values = values self.interval = interval self.time = time def dispatch(self): pass def mk_values(plugin_instance=None, meta=None, plugin=None, host=None, type=None, type_instance=None, interval=None, time=None, values=None): return data(plugin_instance=plugin_instance, meta=meta, plugin=plugin, host=host, type=type, type_instance=type_instance, interval=interval, time=time, values=values) values = mk_values
age = 6 if age < 1: print("baby") elif age < 3: print("toddler") elif age < 5: print("preschool") elif age < 12: print("gradeschooler") elif age < 19: print("teen") elif age > 20: print("old") else: print("integer error")
age = 6 if age < 1: print('baby') elif age < 3: print('toddler') elif age < 5: print('preschool') elif age < 12: print('gradeschooler') elif age < 19: print('teen') elif age > 20: print('old') else: print('integer error')
def main(): # input H, W = map(int, input().split()) sss = [input() for _ in range(H)] # compute cnt = 0 for h in range(1,H-1): for w in range(1,W-1): if sss[h][w]=='#' and sss[h-1][w]!='#' and sss[h+1][w]!='#' and sss[h][w-1]!='#' and sss[h][w+1]!='#': cnt += 1 # output if cnt == 0: print('Yes') else: print('No') if __name__ == '__main__': main()
def main(): (h, w) = map(int, input().split()) sss = [input() for _ in range(H)] cnt = 0 for h in range(1, H - 1): for w in range(1, W - 1): if sss[h][w] == '#' and sss[h - 1][w] != '#' and (sss[h + 1][w] != '#') and (sss[h][w - 1] != '#') and (sss[h][w + 1] != '#'): cnt += 1 if cnt == 0: print('Yes') else: print('No') if __name__ == '__main__': main()
class Solution: def getModifiedArray(self, length: int, updates: List[List[int]]) -> List[int]: arr = [0] * (length + 1) for s, e, i in updates: arr[s] += i arr[e+1] -= i for i in range(1, length): arr[i] += arr[i-1] return arr[:-1]
class Solution: def get_modified_array(self, length: int, updates: List[List[int]]) -> List[int]: arr = [0] * (length + 1) for (s, e, i) in updates: arr[s] += i arr[e + 1] -= i for i in range(1, length): arr[i] += arr[i - 1] return arr[:-1]
nerdle_len = 8 nerd_num_list = [str(x) for x in range(nerdle_len+2)] nerd_op_list = ['+','-','*','/','=='] nerd_list = nerd_num_list+nerd_op_list
nerdle_len = 8 nerd_num_list = [str(x) for x in range(nerdle_len + 2)] nerd_op_list = ['+', '-', '*', '/', '=='] nerd_list = nerd_num_list + nerd_op_list
def assert_raises(excClass, callableObj, *args, **kwargs): """ Like unittest.TestCase.assertRaises, but returns the exception. """ try: callableObj(*args, **kwargs) except excClass as e: return e else: if hasattr(excClass,'__name__'): excName = excClass.__name__ else: excName = str(excClass) raise AssertionError("%s not raised" % excName)
def assert_raises(excClass, callableObj, *args, **kwargs): """ Like unittest.TestCase.assertRaises, but returns the exception. """ try: callable_obj(*args, **kwargs) except excClass as e: return e else: if hasattr(excClass, '__name__'): exc_name = excClass.__name__ else: exc_name = str(excClass) raise assertion_error('%s not raised' % excName)
''' As is can shift max '1111' -> 15 on one command... So a call like shift(20) would need to be split up... Thinking the user should do this when coding... or could be stdlib fx that does this... If want to do shift(16) in one cycle, can add s4 support (and correspoinding 16muxes) to hardware... revisit as needed ''' def shiftRight16_( x, y ): ''' 16 bit barrel shifter (right) ''' N = 16 t0 = [ None ] * N t1 = [ None ] * N t2 = [ None ] * N t3 = [ None ] * N y = y[::-1] # make life simpler by matching array access to MSB-to-LSB format # for i in range( N - 1, 0, -1 ): t0[i] = mux_( x[ i - 1 ], x[i], y[0] ) t0[0] = mux_( 0, x[0], y[0] ) # for i in range( N - 1, 1, -1 ): t1[i] = mux_( t0[ i - 2 ], t0[i], y[1] ) t1[1] = mux_( 0, t0[1], y[1] ) t1[0] = mux_( 0, t0[0], y[1] ) # for i in range( N - 1, 3, -1 ): t2[i] = mux_( t1[ i - 4 ], t1[i], y[2] ) t2[3] = mux_( 0, t1[3], y[2] ) t2[2] = mux_( 0, t1[2], y[2] ) t2[1] = mux_( 0, t1[1], y[2] ) t2[0] = mux_( 0, t1[0], y[2] ) # for i in range( N - 1, 7, -1 ): t3[i] = mux_( t2[ i - 8 ], t2[i], y[3] ) t3[7] = mux_( 0, t2[7], y[3] ) t3[6] = mux_( 0, t2[6], y[3] ) t3[5] = mux_( 0, t2[5], y[3] ) t3[4] = mux_( 0, t2[4], y[3] ) t3[3] = mux_( 0, t2[3], y[3] ) t3[2] = mux_( 0, t2[2], y[3] ) t3[1] = mux_( 0, t2[1], y[3] ) t3[0] = mux_( 0, t2[0], y[3] ) # return t3 def shiftLeft16_( x, y ): ''' 16 bit barrel shifter (left) ''' N = 16 t0 = [ None ] * N t1 = [ None ] * N t2 = [ None ] * N t3 = [ None ] * N y = y[::-1] # make life simpler by matching array access to MSB-to-LSB format # t0[N - 1] = mux_( 0, x[N - 1], y[0] ) for i in range( N - 2, -1, -1 ): t0[i] = mux_( x[ i + 1 ], x[i], y[0] ) # t1[ N - 1 ] = mux_( 0, t0[ N - 1 ], y[1] ) t1[ N - 2 ] = mux_( 0, t0[ N - 2 ], y[1] ) for i in range( N - 3, -1, -1 ): t1[i] = mux_( t0[ i + 2 ], t0[i], y[1] ) # t2[ N - 1 ] = mux_( 0, t1[ N - 1 ], y[2] ) t2[ N - 2 ] = mux_( 0, t1[ N - 2 ], y[2] ) t2[ N - 3 ] = mux_( 0, t1[ N - 3 ], y[2] ) t2[ N - 4 ] = mux_( 0, t1[ N - 4 ], y[2] ) for i in range( N - 5, -1, -1 ): t2[i] = mux_( t1[ i + 4 ], t1[i], y[2] ) # t3[ N - 1 ] = mux_( 0, t2[ N - 1 ], y[3] ) t3[ N - 2 ] = mux_( 0, t2[ N - 2 ], y[3] ) t3[ N - 3 ] = mux_( 0, t2[ N - 3 ], y[3] ) t3[ N - 4 ] = mux_( 0, t2[ N - 4 ], y[3] ) t3[ N - 5 ] = mux_( 0, t2[ N - 5 ], y[3] ) t3[ N - 6 ] = mux_( 0, t2[ N - 6 ], y[3] ) t3[ N - 7 ] = mux_( 0, t2[ N - 7 ], y[3] ) t3[ N - 8 ] = mux_( 0, t2[ N - 8 ], y[3] ) for i in range( N - 9, -1, -1 ): t3[i] = mux_( t2[ i + 8 ], t2[i], y[3] ) # return t3
""" As is can shift max '1111' -> 15 on one command... So a call like shift(20) would need to be split up... Thinking the user should do this when coding... or could be stdlib fx that does this... If want to do shift(16) in one cycle, can add s4 support (and correspoinding 16muxes) to hardware... revisit as needed """ def shift_right16_(x, y): """ 16 bit barrel shifter (right) """ n = 16 t0 = [None] * N t1 = [None] * N t2 = [None] * N t3 = [None] * N y = y[::-1] for i in range(N - 1, 0, -1): t0[i] = mux_(x[i - 1], x[i], y[0]) t0[0] = mux_(0, x[0], y[0]) for i in range(N - 1, 1, -1): t1[i] = mux_(t0[i - 2], t0[i], y[1]) t1[1] = mux_(0, t0[1], y[1]) t1[0] = mux_(0, t0[0], y[1]) for i in range(N - 1, 3, -1): t2[i] = mux_(t1[i - 4], t1[i], y[2]) t2[3] = mux_(0, t1[3], y[2]) t2[2] = mux_(0, t1[2], y[2]) t2[1] = mux_(0, t1[1], y[2]) t2[0] = mux_(0, t1[0], y[2]) for i in range(N - 1, 7, -1): t3[i] = mux_(t2[i - 8], t2[i], y[3]) t3[7] = mux_(0, t2[7], y[3]) t3[6] = mux_(0, t2[6], y[3]) t3[5] = mux_(0, t2[5], y[3]) t3[4] = mux_(0, t2[4], y[3]) t3[3] = mux_(0, t2[3], y[3]) t3[2] = mux_(0, t2[2], y[3]) t3[1] = mux_(0, t2[1], y[3]) t3[0] = mux_(0, t2[0], y[3]) return t3 def shift_left16_(x, y): """ 16 bit barrel shifter (left) """ n = 16 t0 = [None] * N t1 = [None] * N t2 = [None] * N t3 = [None] * N y = y[::-1] t0[N - 1] = mux_(0, x[N - 1], y[0]) for i in range(N - 2, -1, -1): t0[i] = mux_(x[i + 1], x[i], y[0]) t1[N - 1] = mux_(0, t0[N - 1], y[1]) t1[N - 2] = mux_(0, t0[N - 2], y[1]) for i in range(N - 3, -1, -1): t1[i] = mux_(t0[i + 2], t0[i], y[1]) t2[N - 1] = mux_(0, t1[N - 1], y[2]) t2[N - 2] = mux_(0, t1[N - 2], y[2]) t2[N - 3] = mux_(0, t1[N - 3], y[2]) t2[N - 4] = mux_(0, t1[N - 4], y[2]) for i in range(N - 5, -1, -1): t2[i] = mux_(t1[i + 4], t1[i], y[2]) t3[N - 1] = mux_(0, t2[N - 1], y[3]) t3[N - 2] = mux_(0, t2[N - 2], y[3]) t3[N - 3] = mux_(0, t2[N - 3], y[3]) t3[N - 4] = mux_(0, t2[N - 4], y[3]) t3[N - 5] = mux_(0, t2[N - 5], y[3]) t3[N - 6] = mux_(0, t2[N - 6], y[3]) t3[N - 7] = mux_(0, t2[N - 7], y[3]) t3[N - 8] = mux_(0, t2[N - 8], y[3]) for i in range(N - 9, -1, -1): t3[i] = mux_(t2[i + 8], t2[i], y[3]) return t3
# coding: utf-8 SECRET_KEY = 'foo' EMAIL_BACKEND = 'postmarker.django.EmailBackend' POSTMARK = { 'TOKEN': '<YOUR POSTMARK SERVER TOKEN>' }
secret_key = 'foo' email_backend = 'postmarker.django.EmailBackend' postmark = {'TOKEN': '<YOUR POSTMARK SERVER TOKEN>'}
def is_prime(num, primes): for prime in primes: if prime == num: return True if not num % prime: return False return True def get_primes(num): limit = (num // 2) + 1 candidates = list() primes = list() for i in range(2, limit): if is_prime(i, primes): primes.append(i) candidates.append((i, num - i)) new_candidates = list() for first, second in candidates[::-1]: if is_prime(second, primes): primes.append(second) new_candidates.append((first, second)) return new_candidates[-1] assert get_primes(4) == (2, 2) assert get_primes(10) == (3, 7) assert get_primes(100) == (3, 97)
def is_prime(num, primes): for prime in primes: if prime == num: return True if not num % prime: return False return True def get_primes(num): limit = num // 2 + 1 candidates = list() primes = list() for i in range(2, limit): if is_prime(i, primes): primes.append(i) candidates.append((i, num - i)) new_candidates = list() for (first, second) in candidates[::-1]: if is_prime(second, primes): primes.append(second) new_candidates.append((first, second)) return new_candidates[-1] assert get_primes(4) == (2, 2) assert get_primes(10) == (3, 7) assert get_primes(100) == (3, 97)
#program to remove two duplicate numbers from a given number of list. def two_unique_nums(nums): return [i for i in nums if nums.count(i)==1] print(two_unique_nums([1,2,3,2,3,4,5])) print(two_unique_nums([1,2,3,2,4,5])) print(two_unique_nums([1,2,3,4,5]))
def two_unique_nums(nums): return [i for i in nums if nums.count(i) == 1] print(two_unique_nums([1, 2, 3, 2, 3, 4, 5])) print(two_unique_nums([1, 2, 3, 2, 4, 5])) print(two_unique_nums([1, 2, 3, 4, 5]))
types = [ { 'name': 'RNAExpression', 'item_type': 'rna-expression', 'schema': { 'title': 'RNAExpression', 'description': 'Schema for RNA-seq expression', 'properties': { 'uuid': { 'title': 'UUID', }, 'expression': { 'type': 'object', 'properties': { 'gene_id': { 'title': 'Gene ID', 'type': 'string' }, 'transcript_ids': { 'title': 'Transcript ID', 'type': 'string' }, 'tpm': { 'title': 'TPM', 'type': 'float' }, 'fpkm': { 'title': 'FPKM', 'type': 'float' } } }, 'file': { 'type': 'object', 'properties': { '@id': { 'type': 'string' }, 'assay_title': { 'title': 'Assay title', 'type': 'string' }, 'assembly': { 'title': 'Assembly', 'type': 'string' }, 'biosample_ontology': { 'type': 'object', 'properties': { 'organ_slims': { 'type': 'string' }, 'term_name': { 'type': 'string' }, 'synonyms': { 'type': 'string' }, 'name': { 'type': 'string' }, 'term_id': { 'type': 'string' }, 'classification': { 'type': 'string' } } }, 'dataset': { 'type': 'string' }, 'donors': { 'type': 'string' }, 'genome_annotation': { 'type': 'string' } } }, 'dataset': { 'type': 'object', 'properties': { '@id': { 'type': 'string' }, 'biosample_summary': { 'type': 'string' }, 'replicates': { 'type': 'object', 'properties': { 'library': { 'type': 'object', 'properties': { 'biosample': { 'type': 'object', 'properties': { 'age_units': { 'type': 'string' }, 'sex': { 'type': 'string' }, 'age': { 'type': 'string' }, 'donor': { 'type': 'object', 'properties': { 'organism': { 'type': 'object', 'properties': { 'scientific_name': { 'type': 'string' } } } } } } } } } } } } }, 'gene': { 'type': 'object', 'properties': { 'geneid': { 'type': 'string' }, 'symbol': { 'type': 'string' }, 'name': { 'type': 'string' }, 'synonyms': { 'type': 'string' }, '@id': { 'type': 'string' }, 'title': { 'type': 'string' } } }, '@id': { 'title': 'ID', 'type': 'string', }, '@type': { 'title': 'Type', 'type': 'array', 'items': { 'type': 'string' }, } }, 'columns': { 'expression.gene_id': { 'title': 'Feature ID' }, 'expression.tpm': { 'title': 'TPM' }, 'expression.fpkm': { 'title': 'FPKM' }, 'gene.symbol': { 'title': 'Gene symbol' }, 'gene.name': { 'title': 'Gene name' }, 'gene.title': { 'title': 'Gene title' }, 'file.biosample_ontology.term_name': { 'title': 'Biosample term name' }, 'file.assay_title': { 'title': 'Assay title' }, 'file.assembly': { 'title': 'Assembly' }, 'file.biosample_ontology.classification': { 'title': 'Biosample classification' }, 'file.biosample_ontology.organ_slims': { 'title': 'Biosample organ' }, 'dataset.replicates.library.biosample.sex': { 'title': 'Biosample sex' }, 'dataset.replicates.library.biosample.donor.organism.scientific_name': { 'title': 'Organism' }, 'dataset.biosample_summary': { 'title': 'Biosample summary' }, 'file.genome_annotation': { 'title': 'Genome annotation' }, 'file.donors': { 'title': 'Donors' }, 'file.@id': { 'title': 'File' }, 'dataset.@id': { 'title': 'Experiment' } }, 'facets': { 'file.assay_title': { 'title': 'Assay title', 'open_on_load': True }, 'file.biosample_ontology.classification': { 'title': 'Biosample classification', 'open_on_load': True }, 'file.biosample_ontology.term_name': { 'title': 'Biosample term name', 'open_on_load': True, 'type': 'typeahead', 'length': 'long' }, 'file.assembly': { 'title': 'Assembly', 'open_on_load': True }, 'dataset.replicates.library.biosample.donor.organism.scientific_name': { 'title': 'Organism', 'open_on_load': True }, 'dataset.replicates.library.biosample.sex': { 'title': 'Biosample sex' } }, } } ]
types = [{'name': 'RNAExpression', 'item_type': 'rna-expression', 'schema': {'title': 'RNAExpression', 'description': 'Schema for RNA-seq expression', 'properties': {'uuid': {'title': 'UUID'}, 'expression': {'type': 'object', 'properties': {'gene_id': {'title': 'Gene ID', 'type': 'string'}, 'transcript_ids': {'title': 'Transcript ID', 'type': 'string'}, 'tpm': {'title': 'TPM', 'type': 'float'}, 'fpkm': {'title': 'FPKM', 'type': 'float'}}}, 'file': {'type': 'object', 'properties': {'@id': {'type': 'string'}, 'assay_title': {'title': 'Assay title', 'type': 'string'}, 'assembly': {'title': 'Assembly', 'type': 'string'}, 'biosample_ontology': {'type': 'object', 'properties': {'organ_slims': {'type': 'string'}, 'term_name': {'type': 'string'}, 'synonyms': {'type': 'string'}, 'name': {'type': 'string'}, 'term_id': {'type': 'string'}, 'classification': {'type': 'string'}}}, 'dataset': {'type': 'string'}, 'donors': {'type': 'string'}, 'genome_annotation': {'type': 'string'}}}, 'dataset': {'type': 'object', 'properties': {'@id': {'type': 'string'}, 'biosample_summary': {'type': 'string'}, 'replicates': {'type': 'object', 'properties': {'library': {'type': 'object', 'properties': {'biosample': {'type': 'object', 'properties': {'age_units': {'type': 'string'}, 'sex': {'type': 'string'}, 'age': {'type': 'string'}, 'donor': {'type': 'object', 'properties': {'organism': {'type': 'object', 'properties': {'scientific_name': {'type': 'string'}}}}}}}}}}}}}, 'gene': {'type': 'object', 'properties': {'geneid': {'type': 'string'}, 'symbol': {'type': 'string'}, 'name': {'type': 'string'}, 'synonyms': {'type': 'string'}, '@id': {'type': 'string'}, 'title': {'type': 'string'}}}, '@id': {'title': 'ID', 'type': 'string'}, '@type': {'title': 'Type', 'type': 'array', 'items': {'type': 'string'}}}, 'columns': {'expression.gene_id': {'title': 'Feature ID'}, 'expression.tpm': {'title': 'TPM'}, 'expression.fpkm': {'title': 'FPKM'}, 'gene.symbol': {'title': 'Gene symbol'}, 'gene.name': {'title': 'Gene name'}, 'gene.title': {'title': 'Gene title'}, 'file.biosample_ontology.term_name': {'title': 'Biosample term name'}, 'file.assay_title': {'title': 'Assay title'}, 'file.assembly': {'title': 'Assembly'}, 'file.biosample_ontology.classification': {'title': 'Biosample classification'}, 'file.biosample_ontology.organ_slims': {'title': 'Biosample organ'}, 'dataset.replicates.library.biosample.sex': {'title': 'Biosample sex'}, 'dataset.replicates.library.biosample.donor.organism.scientific_name': {'title': 'Organism'}, 'dataset.biosample_summary': {'title': 'Biosample summary'}, 'file.genome_annotation': {'title': 'Genome annotation'}, 'file.donors': {'title': 'Donors'}, 'file.@id': {'title': 'File'}, 'dataset.@id': {'title': 'Experiment'}}, 'facets': {'file.assay_title': {'title': 'Assay title', 'open_on_load': True}, 'file.biosample_ontology.classification': {'title': 'Biosample classification', 'open_on_load': True}, 'file.biosample_ontology.term_name': {'title': 'Biosample term name', 'open_on_load': True, 'type': 'typeahead', 'length': 'long'}, 'file.assembly': {'title': 'Assembly', 'open_on_load': True}, 'dataset.replicates.library.biosample.donor.organism.scientific_name': {'title': 'Organism', 'open_on_load': True}, 'dataset.replicates.library.biosample.sex': {'title': 'Biosample sex'}}}}]
def square(x): return x * x def launch_missiles(): print('missiles launched') def even_or_odd(n): if n % 2 == 0: print('even') return print('odd')
def square(x): return x * x def launch_missiles(): print('missiles launched') def even_or_odd(n): if n % 2 == 0: print('even') return print('odd')
n = 1 for i in range(1, 10 + 1): print(n) n *= i
n = 1 for i in range(1, 10 + 1): print(n) n *= i
#!/usr/bin/env python # coding: utf-8 # # Hill Cipher # Below is the code to implement the Hill Cipher, which is an example of a **polyalphabetic cryptosystem**, that is, it does # not assign a single ciphertext letter to a single plaintext letter, but rather a ciphertext letter may represent more than # one plaintext letter. This example is from Judson's [Abstract Algebra](http://abstract.ups.edu/sage-aata.html) textbook, # example 7.4. The encryption is based on the matrix # \begin{equation*} # A=\left(\begin{array}{cc} # 3 & 5 \\ # 1 & 2 # \end{array}\right) # \end{equation*} # and encryptes pairs of letters at a time, rather than one letter at a time. # # The digitize and alphabetize functions are rather similar to the ones found in the CeasarCipher document, the bigest change # being that these pair the numbers up so as to form matrices for encryption and decryption. # In[ ]: def digitize(string): cipher_text = [] holder = [] for i in string: if i == 'A' or i == 'a': holder.append(0) if i == 'B' or i == 'b': holder.append(1) if i == 'C' or i == 'c': holder.append(2) if i == 'D' or i == 'd': holder.append(3) if i == 'E' or i == 'e': holder.append(4) if i == 'F' or i == 'f': holder.append(5) if i == 'G' or i == 'g': holder.append(6) if i == 'H' or i == 'h': holder.append(7) if i == 'I' or i == 'i': holder.append(8) if i == 'J' or i == 'j': holder.append(9) if i == 'K' or i == 'k': holder.append(10) if i == 'L' or i == 'l': holder.append(11) if i == 'M' or i == 'm': holder.append(12) if i == 'N' or i == 'n': holder.append(13) if i == 'O' or i == 'o': holder.append(14) if i == 'P' or i == 'p': holder.append(15) if i == 'Q' or i == 'q': holder.append(16) if i == 'R' or i == 'r': holder.append(17) if i == 'S' or i == 's': holder.append(18) if i == 'T' or i == 't': holder.append(19) if i == 'U' or i == 'u': holder.append(20) if i == 'V' or i == 'v': holder.append(21) if i == 'W' or i == 'w': holder.append(22) if i == 'X' or i == 'x': holder.append(23) if i == 'Y' or i == 'y': holder.append(24) if i == 'Z' or i == 'z': holder.append(25) if len(holder)==2: cipher_text.append(matrix(holder)) holder = [] if len(holder)==1: holder.append(23) cipher_text.append(matrix(holder)) return cipher_text # In[ ]: def alphabetize(digits): plain_text = "" comparison = MatrixSpace(IntegerModRing(26),1,1) for number in digits: for i in number: if i == comparison([0])[0]: plain_text = plain_text + "A" if i == comparison([1])[0]: plain_text = plain_text + "B" if i == comparison([2])[0]: plain_text = plain_text + "C" if i == comparison([3])[0]: plain_text = plain_text + "D" if i == comparison([4])[0]: plain_text = plain_text + "E" if i == comparison([5])[0]: plain_text = plain_text + "F" if i == comparison([6])[0]: plain_text = plain_text + "G" if i == comparison([7])[0]: plain_text = plain_text + "H" if i == comparison([8])[0]: plain_text = plain_text + "I" if i == comparison([9])[0]: plain_text = plain_text + "J" if i == comparison([10])[0]: plain_text = plain_text + "K" if i == comparison([11])[0]: plain_text = plain_text + "L" if i == comparison([12])[0]: plain_text = plain_text + "M" if i == comparison([13])[0]: plain_text = plain_text + "N" if i == comparison([14])[0]: plain_text = plain_text + "O" if i == comparison([15])[0]: plain_text = plain_text + "P" if i == comparison([16])[0]: plain_text = plain_text + "Q" if i == comparison([17])[0]: plain_text = plain_text + "R" if i == comparison([18])[0]: plain_text = plain_text + "S" if i == comparison([19])[0]: plain_text = plain_text + "T" if i == comparison([20])[0]: plain_text = plain_text + "U" if i == comparison([21])[0]: plain_text = plain_text + "V" if i == comparison([22])[0]: plain_text = plain_text + "W" if i == comparison([23])[0]: plain_text = plain_text + "X" if i == comparison([24])[0]: plain_text = plain_text + "Y" if i == comparison([25])[0]: plain_text = plain_text + "Z" return plain_text # Here we define the HillEncrypt and HillDecrypt functions, which take in strings, and encrypt or decrypt them according # to the matrices passed into them as parameters. # In[ ]: def HillEncrypt(message, A, b): encoded = digitize(message) cipher_text = [] for item in encoded: cipher_text.append(A*item.transpose()+b) return alphabetize(cipher_text) def HillDecrypt(message, A, b): A = A.inverse() encoded = digitize(message) plain_text = [] for item in encoded: plain_text.append(A*item.transpose()-A*b) return alphabetize(plain_text) # Here we use MatrixSpaces over the Ring of integers mod 26, to define the matrices used for encryption and decryption. # We use MatrixSpaces rather than ordinary matrices to ensure that the inverse of $A$ is calculated correctly. # In[ ]: Z22_26 = MatrixSpace(IntegerModRing(26),2,2) Z21_26 = MatrixSpace(IntegerModRing(26),2,1) # these are the matrices used in the example in the book. A = Z22_26([[3,5],[1,2]]) b = Z21_26([2,2]) # Here we go through our first example, which is the example in the book, encrypting the message "help". # In[ ]: message = "help" encrypted = HillEncrypt(message,A,b) print(encrypted) decrypted = HillDecrypt(encrypted,A,b) print(decrypted)
def digitize(string): cipher_text = [] holder = [] for i in string: if i == 'A' or i == 'a': holder.append(0) if i == 'B' or i == 'b': holder.append(1) if i == 'C' or i == 'c': holder.append(2) if i == 'D' or i == 'd': holder.append(3) if i == 'E' or i == 'e': holder.append(4) if i == 'F' or i == 'f': holder.append(5) if i == 'G' or i == 'g': holder.append(6) if i == 'H' or i == 'h': holder.append(7) if i == 'I' or i == 'i': holder.append(8) if i == 'J' or i == 'j': holder.append(9) if i == 'K' or i == 'k': holder.append(10) if i == 'L' or i == 'l': holder.append(11) if i == 'M' or i == 'm': holder.append(12) if i == 'N' or i == 'n': holder.append(13) if i == 'O' or i == 'o': holder.append(14) if i == 'P' or i == 'p': holder.append(15) if i == 'Q' or i == 'q': holder.append(16) if i == 'R' or i == 'r': holder.append(17) if i == 'S' or i == 's': holder.append(18) if i == 'T' or i == 't': holder.append(19) if i == 'U' or i == 'u': holder.append(20) if i == 'V' or i == 'v': holder.append(21) if i == 'W' or i == 'w': holder.append(22) if i == 'X' or i == 'x': holder.append(23) if i == 'Y' or i == 'y': holder.append(24) if i == 'Z' or i == 'z': holder.append(25) if len(holder) == 2: cipher_text.append(matrix(holder)) holder = [] if len(holder) == 1: holder.append(23) cipher_text.append(matrix(holder)) return cipher_text def alphabetize(digits): plain_text = '' comparison = matrix_space(integer_mod_ring(26), 1, 1) for number in digits: for i in number: if i == comparison([0])[0]: plain_text = plain_text + 'A' if i == comparison([1])[0]: plain_text = plain_text + 'B' if i == comparison([2])[0]: plain_text = plain_text + 'C' if i == comparison([3])[0]: plain_text = plain_text + 'D' if i == comparison([4])[0]: plain_text = plain_text + 'E' if i == comparison([5])[0]: plain_text = plain_text + 'F' if i == comparison([6])[0]: plain_text = plain_text + 'G' if i == comparison([7])[0]: plain_text = plain_text + 'H' if i == comparison([8])[0]: plain_text = plain_text + 'I' if i == comparison([9])[0]: plain_text = plain_text + 'J' if i == comparison([10])[0]: plain_text = plain_text + 'K' if i == comparison([11])[0]: plain_text = plain_text + 'L' if i == comparison([12])[0]: plain_text = plain_text + 'M' if i == comparison([13])[0]: plain_text = plain_text + 'N' if i == comparison([14])[0]: plain_text = plain_text + 'O' if i == comparison([15])[0]: plain_text = plain_text + 'P' if i == comparison([16])[0]: plain_text = plain_text + 'Q' if i == comparison([17])[0]: plain_text = plain_text + 'R' if i == comparison([18])[0]: plain_text = plain_text + 'S' if i == comparison([19])[0]: plain_text = plain_text + 'T' if i == comparison([20])[0]: plain_text = plain_text + 'U' if i == comparison([21])[0]: plain_text = plain_text + 'V' if i == comparison([22])[0]: plain_text = plain_text + 'W' if i == comparison([23])[0]: plain_text = plain_text + 'X' if i == comparison([24])[0]: plain_text = plain_text + 'Y' if i == comparison([25])[0]: plain_text = plain_text + 'Z' return plain_text def hill_encrypt(message, A, b): encoded = digitize(message) cipher_text = [] for item in encoded: cipher_text.append(A * item.transpose() + b) return alphabetize(cipher_text) def hill_decrypt(message, A, b): a = A.inverse() encoded = digitize(message) plain_text = [] for item in encoded: plain_text.append(A * item.transpose() - A * b) return alphabetize(plain_text) z22_26 = matrix_space(integer_mod_ring(26), 2, 2) z21_26 = matrix_space(integer_mod_ring(26), 2, 1) a = z22_26([[3, 5], [1, 2]]) b = z21_26([2, 2]) message = 'help' encrypted = hill_encrypt(message, A, b) print(encrypted) decrypted = hill_decrypt(encrypted, A, b) print(decrypted)
file = open('Advent-of-Code-2021\\Day 13\\Day 13 input.txt') points = [] folds = [] for line in file: line = line.strip() if (line.find(',') != -1): pointparse = line.split(',') points.append([int(pointparse[0]),int(pointparse[1])]) elif (line.find('=') != -1): foldparse = line.split('=') folds.append([foldparse[0][len(foldparse[0])-1], int(foldparse[1])]) else: "Do nothing" for thisfold in folds: newpoints = [] for point in points: if (thisfold[0] == 'x'): if (point[0] > thisfold[1]): checkpoint = [thisfold[1]-(point[0]-thisfold[1]),point[1]] if (checkpoint not in newpoints): newpoints.append(checkpoint) elif (point not in newpoints): newpoints.append(point) else: "Do Nothing" else: if (point[1] > thisfold[1]): checkpoint = [point[0],thisfold[1]-(point[1]-thisfold[1])] if (checkpoint not in newpoints): newpoints.append(checkpoint) elif (point not in newpoints): newpoints.append(point) else: "Do Nothing" points = newpoints maxX = 0 maxY = 0 for point in points: if (point[0] > maxX): maxX = point[0] if (point[1] > maxY): maxY = point[1] outstring = [] for y in range(maxY+1): row = '' for x in range(maxX+1): if ([x,y] in points): row += '#' else: row += '.' outstring.append(row) for row in outstring: print(row)
file = open('Advent-of-Code-2021\\Day 13\\Day 13 input.txt') points = [] folds = [] for line in file: line = line.strip() if line.find(',') != -1: pointparse = line.split(',') points.append([int(pointparse[0]), int(pointparse[1])]) elif line.find('=') != -1: foldparse = line.split('=') folds.append([foldparse[0][len(foldparse[0]) - 1], int(foldparse[1])]) else: 'Do nothing' for thisfold in folds: newpoints = [] for point in points: if thisfold[0] == 'x': if point[0] > thisfold[1]: checkpoint = [thisfold[1] - (point[0] - thisfold[1]), point[1]] if checkpoint not in newpoints: newpoints.append(checkpoint) elif point not in newpoints: newpoints.append(point) else: 'Do Nothing' elif point[1] > thisfold[1]: checkpoint = [point[0], thisfold[1] - (point[1] - thisfold[1])] if checkpoint not in newpoints: newpoints.append(checkpoint) elif point not in newpoints: newpoints.append(point) else: 'Do Nothing' points = newpoints max_x = 0 max_y = 0 for point in points: if point[0] > maxX: max_x = point[0] if point[1] > maxY: max_y = point[1] outstring = [] for y in range(maxY + 1): row = '' for x in range(maxX + 1): if [x, y] in points: row += '#' else: row += '.' outstring.append(row) for row in outstring: print(row)
dummy1_iface_cfg = { 'INTERFACE': { 'MODULE': 'daq.interface.interface', 'CLASS': 'DummyInterface', }, 'IFCONFIG': { 'LABEL': 'Dummy1', 'ADDRESS': 'DummyAddress', 'SerialNumber': '1234', } } dummycpc_inst_cfg = { 'INSTRUMENT': { 'MODULE': 'daq.instrument.instrument', 'CLASS': 'DummyInstrument', }, 'INSTCONFIG': { 'DESCRIPTION': { 'LABEL': 'DummyCPC', 'SERIAL_NUMBER': '0001', 'PROPERTY_NUMBER': 'CD0000001', }, 'IFACE_LIST': { 'DUMMY1': { 'IFACE_CONFIG': dummy1_iface_cfg, 'OPERATION': { 'POLLED': False, 'SAMPLE_FREQ_SEC': 1, }, }, }, }, # could be IFACE_LIST to allow for multiple iface } dummy_controller_cfg = { 'CONTROLLER': { 'MODULE': 'daq.controller.controller', 'CLASS': 'Controller', } }
dummy1_iface_cfg = {'INTERFACE': {'MODULE': 'daq.interface.interface', 'CLASS': 'DummyInterface'}, 'IFCONFIG': {'LABEL': 'Dummy1', 'ADDRESS': 'DummyAddress', 'SerialNumber': '1234'}} dummycpc_inst_cfg = {'INSTRUMENT': {'MODULE': 'daq.instrument.instrument', 'CLASS': 'DummyInstrument'}, 'INSTCONFIG': {'DESCRIPTION': {'LABEL': 'DummyCPC', 'SERIAL_NUMBER': '0001', 'PROPERTY_NUMBER': 'CD0000001'}, 'IFACE_LIST': {'DUMMY1': {'IFACE_CONFIG': dummy1_iface_cfg, 'OPERATION': {'POLLED': False, 'SAMPLE_FREQ_SEC': 1}}}}} dummy_controller_cfg = {'CONTROLLER': {'MODULE': 'daq.controller.controller', 'CLASS': 'Controller'}}
print(dir(str)) nome = 'Flavio' print(nome) print(nome[:3]) texto = 'marca d\' agua' print(texto) texto = "marca d' agua" print(texto) texto = ''' texto ... texto ''' print(texto) texto = ' texto\n\t ...texto' print(texto) print(str.__add__('a', 'b')) nome = 'Flavio Garcia Fernandes' print(nome) print(nome[-9:]) print(nome[::-1]) numeros = '0123456789' print(numeros[1::2]) print(numeros[::2])
print(dir(str)) nome = 'Flavio' print(nome) print(nome[:3]) texto = "marca d' agua" print(texto) texto = "marca d' agua" print(texto) texto = ' texto\n ... texto\n' print(texto) texto = ' texto\n\t ...texto' print(texto) print(str.__add__('a', 'b')) nome = 'Flavio Garcia Fernandes' print(nome) print(nome[-9:]) print(nome[::-1]) numeros = '0123456789' print(numeros[1::2]) print(numeros[::2])
with open('in') as f: data = list(map(lambda l: list(l.strip().replace(' ', '')), f.readlines())) def evaluate(e): value = None operation = None i = 0 while i < len(e): c = e[i] if c in '+*': operation = c elif c in '0123456789': c = int(c) if operation is None: value = c else: if operation == '+': value += c else: value *= c elif c == '(': tmp_e = [] i += 1 level = 1 while True: if e[i] == '(': level += 1 elif e[i] == ')': level -= 1 if level == 0: break else: tmp_e.append(e[i]) i += 1 b = evaluate(tmp_e) if operation is None: value = b else: if operation == '+': value += b else: value *= b else: assert False i += 1 return value def evaluate_2(e): i = 0 while i < len(e): if e[i] == '+': level = 0 index = -1 for j in range(i - 1, -1, -1): if e[j] == ')': level += 1 elif e[j] == '(': level -= 1 if (level == 0 and e[j] in '+*') or (level < 0 and e[j] in '()'): index = j break e.insert(index + 1, '(') i += 1 level = 0 index = len(e) for j in range(i + 1, len(e)): if e[j] == '(': level += 1 elif e[j] == ')': level -= 1 if (level == 0 and e[j] in '+*') or (level < 0 and e[j] in '()'): index = j break e.insert(index, ')') i += 1 return evaluate(e) def part_one(): return sum(map(evaluate, data)) def part_two(): return sum(map(evaluate_2, data)) if __name__ == '__main__': print(f'Part One: {part_one()}') print(f'Part Two: {part_two()}')
with open('in') as f: data = list(map(lambda l: list(l.strip().replace(' ', '')), f.readlines())) def evaluate(e): value = None operation = None i = 0 while i < len(e): c = e[i] if c in '+*': operation = c elif c in '0123456789': c = int(c) if operation is None: value = c elif operation == '+': value += c else: value *= c elif c == '(': tmp_e = [] i += 1 level = 1 while True: if e[i] == '(': level += 1 elif e[i] == ')': level -= 1 if level == 0: break else: tmp_e.append(e[i]) i += 1 b = evaluate(tmp_e) if operation is None: value = b elif operation == '+': value += b else: value *= b else: assert False i += 1 return value def evaluate_2(e): i = 0 while i < len(e): if e[i] == '+': level = 0 index = -1 for j in range(i - 1, -1, -1): if e[j] == ')': level += 1 elif e[j] == '(': level -= 1 if level == 0 and e[j] in '+*' or (level < 0 and e[j] in '()'): index = j break e.insert(index + 1, '(') i += 1 level = 0 index = len(e) for j in range(i + 1, len(e)): if e[j] == '(': level += 1 elif e[j] == ')': level -= 1 if level == 0 and e[j] in '+*' or (level < 0 and e[j] in '()'): index = j break e.insert(index, ')') i += 1 return evaluate(e) def part_one(): return sum(map(evaluate, data)) def part_two(): return sum(map(evaluate_2, data)) if __name__ == '__main__': print(f'Part One: {part_one()}') print(f'Part Two: {part_two()}')
# just keep this as-is def not_an_activity(): print("boom")
def not_an_activity(): print('boom')
label_data = open("label", encoding='utf-8').readlines() label_data = [x.strip() for x in label_data] print(len(label_data)) label_kinds = set(label_data) print(label_kinds)
label_data = open('label', encoding='utf-8').readlines() label_data = [x.strip() for x in label_data] print(len(label_data)) label_kinds = set(label_data) print(label_kinds)
class NotFoundError(Exception): """ Thrown during :meth:`get` when the requested object could not be found. """ pass class ValidationError(Exception): """ Thrown by :class:`Field` subclasses when setting attributes that are invalid. """ pass
class Notfounderror(Exception): """ Thrown during :meth:`get` when the requested object could not be found. """ pass class Validationerror(Exception): """ Thrown by :class:`Field` subclasses when setting attributes that are invalid. """ pass
def tupler(atuple): print(f"{atuple=}") return (1, 2, 3) print(f"{type(tupler((10, 11)))=}")
def tupler(atuple): print(f'atuple={atuple!r}') return (1, 2, 3) print(f'type(tupler((10, 11)))={type(tupler((10, 11)))!r}')
n1 = int (input()) s1 = set(map(int,input().split())) n2 = int (input()) s2 = set(map(int,input().split())) print(len(s1.intersection(s2)))
n1 = int(input()) s1 = set(map(int, input().split())) n2 = int(input()) s2 = set(map(int, input().split())) print(len(s1.intersection(s2)))
raio = int(input()) pi = 3.14159 volume = float(4.0 * pi * (raio* raio * raio) / 3) print("VOLUME = %0.3f" %volume)
raio = int(input()) pi = 3.14159 volume = float(4.0 * pi * (raio * raio * raio) / 3) print('VOLUME = %0.3f' % volume)
#!/usr/bin/env python # encoding: utf-8 GRADES_FILENAME = 'grades.csv' GRADING_SLASH_DELIMINATOR = '/' SUBMISSIONS_FILENAME = 'Submissions' GRADING_URL_EXTENSION = '&action=grading' SUBMISSION_LISTING_DELIMINATOR = '-_submission_-' GRADING_BLANK_GRADE = '-' GRADING_HEADER_NAME = 'Name' GRADING_HEADER_EMAIL = 'Email' GRADING_HEADER_GRADE = 'Grade'
grades_filename = 'grades.csv' grading_slash_deliminator = '/' submissions_filename = 'Submissions' grading_url_extension = '&action=grading' submission_listing_deliminator = '-_submission_-' grading_blank_grade = '-' grading_header_name = 'Name' grading_header_email = 'Email' grading_header_grade = 'Grade'
#print("for loop") #word = ["this", "is","roshan"] # for w in word: print(w, len(w)) #give range of each word for w in range(len(word)): print(w, word[w]) #get odd or even """ for x in range(0,5): x+=1 #print(x) if x % 2 == 0: print(f"{x}::Even No") else: print(f"{x}::Odd No") print("PRime No's") for n in range(1,10): for x in range(2,n): if n % x ==0: print(f"{n} get by multiple of {x} and is divisible of {x}, So it is not a prime no") break else: print(f"{n} is prime no") """ #Loop while for the printing numbers def whileloop(x): y=0 while(y<x): print(y) y=y+1 #print number using for loop def forloop(x): y=0 for i in range(y,x): print(i) #print even or odd based on the condition def printodd(x): y=0 for i in range(y,x): if(i%2 != 0): continue print("Even No: ",i) for i in range(y,x): if(i%2 == 0): continue print("Odd No: ",i) printodd(10) #whileloop(10) #forloop(10)
""" for x in range(0,5): x+=1 #print(x) if x % 2 == 0: print(f"{x}::Even No") else: print(f"{x}::Odd No") print("PRime No's") for n in range(1,10): for x in range(2,n): if n % x ==0: print(f"{n} get by multiple of {x} and is divisible of {x}, So it is not a prime no") break else: print(f"{n} is prime no") """ def whileloop(x): y = 0 while y < x: print(y) y = y + 1 def forloop(x): y = 0 for i in range(y, x): print(i) def printodd(x): y = 0 for i in range(y, x): if i % 2 != 0: continue print('Even No: ', i) for i in range(y, x): if i % 2 == 0: continue print('Odd No: ', i) printodd(10)
# Time: O(n) # Space: O(n) class UnionFind(object): def __init__(self, n): self.set = range(n) def find_set(self, x): if self.set[x] != x: self.set[x] = self.find_set(self.set[x]) # path compression. return self.set[x] def union_set(self, x, y): x_root, y_root = map(self.find_set, (x, y)) if x_root == y_root: return False self.set[min(x_root, y_root)] = max(x_root, y_root) return True class Solution(object): def removeStones(self, stones): """ :type stones: List[List[int]] :rtype: int """ MAX_ROW = 10000 union_find = UnionFind(2*MAX_ROW) for r, c in stones: union_find.union_set(r, c+MAX_ROW) return len(stones) - len({union_find.find_set(r) for r, _ in stones})
class Unionfind(object): def __init__(self, n): self.set = range(n) def find_set(self, x): if self.set[x] != x: self.set[x] = self.find_set(self.set[x]) return self.set[x] def union_set(self, x, y): (x_root, y_root) = map(self.find_set, (x, y)) if x_root == y_root: return False self.set[min(x_root, y_root)] = max(x_root, y_root) return True class Solution(object): def remove_stones(self, stones): """ :type stones: List[List[int]] :rtype: int """ max_row = 10000 union_find = union_find(2 * MAX_ROW) for (r, c) in stones: union_find.union_set(r, c + MAX_ROW) return len(stones) - len({union_find.find_set(r) for (r, _) in stones})
# IP and port to bind to. bind = ['127.0.0.1:4000'] # Maximum number of pending connections. backlog = 2048 # Number of worker processes to handle connections. workers = 2 # Fork main process to background. daemon = True # PID file to write to. pidfile = "web.gunicorn.pid" # Allow connections from any frontend proxy. # forwarded_allow_ips = '*' # Logging configuration. accesslog = "web.gunicorn.access.log" errorlog = "web.gunicorn.error.log" loglevel = "warning" # Gunicorn process name. proc_name = "rouly.net-gunicorn"
bind = ['127.0.0.1:4000'] backlog = 2048 workers = 2 daemon = True pidfile = 'web.gunicorn.pid' accesslog = 'web.gunicorn.access.log' errorlog = 'web.gunicorn.error.log' loglevel = 'warning' proc_name = 'rouly.net-gunicorn'
i = 0 while(True): if i+1<5: i = i + 1 continue print(i+1, end=" ") if(i==50): break #stop the loop i = i+ 1
i = 0 while True: if i + 1 < 5: i = i + 1 continue print(i + 1, end=' ') if i == 50: break i = i + 1
#https://leetcode.com/problems/min-stack/ class MinStack(object): def __init__(self): self.stack = [] def push(self, x): self.stack.append((x, min(x, self.getMin()))) def pop(self): if len(self.stack)==0: return None return self.stack.pop()[0] def top(self): if len(self.stack)==0: return None return self.stack[-1][0] def getMin(self): if len(self.stack)==0: return float('inf') return self.stack[-1][1] # Your MinStack object will be instantiated and called as such: # obj = MinStack() # obj.push(x) # obj.pop() # param_3 = obj.top() # param_4 = obj.getMin()
class Minstack(object): def __init__(self): self.stack = [] def push(self, x): self.stack.append((x, min(x, self.getMin()))) def pop(self): if len(self.stack) == 0: return None return self.stack.pop()[0] def top(self): if len(self.stack) == 0: return None return self.stack[-1][0] def get_min(self): if len(self.stack) == 0: return float('inf') return self.stack[-1][1]
# -*- coding: utf-8 -*- """ flybirds common error """ class FlybirdNotFoundException(Exception): """ not find flybirds """ def __init__(self, message, select_dic, error=None): message = f"selectors={str(select_dic)} {message}" if error is not None: message = f"{message} innerErr:{error}" super().__init__(message) self.message = message def __str__(self): return str(self.message) class PositionNotChangeException(Exception): """ position not change """ def __init__(self, message): super().__init__(message) self.message = message def __str__(self): return str(self.message) class FlybirdCallMethodParamsException(Exception): """ params error """ def __init__(self, method, param_name): message = f"call method:{method} has invalid params:{param_name}" super().__init__(message) self.message = message def __str__(self): return str(self.message) class FlybirdEleExistsException(Exception): """ ele not exists """ def __init__(self, message): super().__init__(message) self.message = message def __str__(self): return str(self.message) class FlybirdVerifyException(Exception): """ verify error """ def __init__(self, message): super().__init__() self.message = message def __str__(self): return str(self.message) class FlybirdPositionChanging(Exception): """ position changing """ def __init__(self, message): super().__init__() self.message = message def __str__(self): return str(self.message) class ScreenRecordException(Exception): """ screen record error """ def __init__(self, message): super().__init__() self.message = message def __str__(self): return str(self.message)
""" flybirds common error """ class Flybirdnotfoundexception(Exception): """ not find flybirds """ def __init__(self, message, select_dic, error=None): message = f'selectors={str(select_dic)} {message}' if error is not None: message = f'{message} innerErr:{error}' super().__init__(message) self.message = message def __str__(self): return str(self.message) class Positionnotchangeexception(Exception): """ position not change """ def __init__(self, message): super().__init__(message) self.message = message def __str__(self): return str(self.message) class Flybirdcallmethodparamsexception(Exception): """ params error """ def __init__(self, method, param_name): message = f'call method:{method} has invalid params:{param_name}' super().__init__(message) self.message = message def __str__(self): return str(self.message) class Flybirdeleexistsexception(Exception): """ ele not exists """ def __init__(self, message): super().__init__(message) self.message = message def __str__(self): return str(self.message) class Flybirdverifyexception(Exception): """ verify error """ def __init__(self, message): super().__init__() self.message = message def __str__(self): return str(self.message) class Flybirdpositionchanging(Exception): """ position changing """ def __init__(self, message): super().__init__() self.message = message def __str__(self): return str(self.message) class Screenrecordexception(Exception): """ screen record error """ def __init__(self, message): super().__init__() self.message = message def __str__(self): return str(self.message)
class RaggedContiguous: """Mixin class for an underlying compressed ragged array. .. versionadded:: (cfdm) 1.7.0 """ def get_count(self, default=ValueError()): """Return the count variable for a compressed array. .. versionadded:: (cfdm) 1.7.0 :Parameters: default: optional Return the value of the *default* parameter if the count variable has not been set. {{default Exception}} :Returns: The count variable. **Examples:** >>> c = d.get_count() """ out = self._get_component("count_variable", None) if out is None: return self._default( default, f"{self.__class__.__name__!r} has no count variable" ) return out
class Raggedcontiguous: """Mixin class for an underlying compressed ragged array. .. versionadded:: (cfdm) 1.7.0 """ def get_count(self, default=value_error()): """Return the count variable for a compressed array. .. versionadded:: (cfdm) 1.7.0 :Parameters: default: optional Return the value of the *default* parameter if the count variable has not been set. {{default Exception}} :Returns: The count variable. **Examples:** >>> c = d.get_count() """ out = self._get_component('count_variable', None) if out is None: return self._default(default, f'{self.__class__.__name__!r} has no count variable') return out
## This module deals with code regarding handling the double ## underscore separated keys def dunderkey(*args): """Produces a nested key from multiple args separated by double underscore >>> dunderkey('a', 'b', 'c') >>> 'a__b__c' :param *args : *String :rtype : String """ return '__'.join(args) def dunder_partition(key): """Splits a dunderkey into 2 parts The first part is everything before the final double underscore The second part is after the final double underscore >>> dunder_partition('a__b__c') >>> ('a__b', 'c') :param neskey : String :rtype : 2 Tuple """ parts = key.rsplit('__', 1) return tuple(parts) if len(parts) > 1 else (parts[0], None) def dunder_init(key): """Returns the initial part of the dunder key >>> dunder_init('a__b__c') >>> 'a__b' :param neskey : String :rtype : String """ return dunder_partition(key)[0] def dunder_last(key): """Returns the last part of the dunder key >>> dunder_last('a__b__c') >>> 'c' :param neskey : String :rtype : String """ return dunder_partition(key)[1] def dunder_get(_dict, key): """Returns value for a specified dunderkey A "dunderkey" is just a fieldname that may or may not contain double underscores (dunderscores!) for referrencing nested keys in a dict. eg:: >>> data = {'a': {'b': 1}} >>> nesget(data, 'a__b') 1 key 'b' can be referrenced as 'a__b' :param _dict : (dict) :param key : (str) that represents a first level or nested key in the dict :rtype : (mixed) value corresponding to the key """ parts = key.split('__', 1) key = parts[0] try: result = _dict[key] except KeyError: return None except TypeError: try: result = getattr(_dict, key) except AttributeError: return None return result if len(parts) == 1 else dunder_get(result, parts[1]) def undunder_keys(_dict): """Returns dict with the dunder keys converted back to nested dicts eg:: >>> undunder_keys({'a': 'hello', 'b__c': 'world'}) {'a': 'hello', 'b': {'c': 'world'}} :param _dict : (dict) flat dict :rtype : (dict) nested dict """ def f(key, value): parts = key.split('__') return { parts[0]: value if len(parts) == 1 else f(parts[1], value) } result = {} for r in [f(k, v) for k, v in _dict.items()]: rk = list(r.keys())[0] if rk not in result: result.update(r) else: result[rk].update(r[rk]) return result def dunder_truncate(_dict): """Returns dict with dunder keys truncated to only the last part In other words, replaces the dunder keys with just last part of it. In case many identical last parts are encountered, they are not truncated further eg:: >>> dunder_truncate({'a__p': 3, 'b__c': 'no'}) {'c': 'no', 'p': 3} >>> dunder_truncate({'a__p': 'yay', 'b__p': 'no', 'c__z': 'dunno'}) {'a__p': 'yay', 'b__p': 'no', 'z': 'dunno'} :param _dict : (dict) to flatten :rtype : (dict) flattened result """ keylist = list(_dict.keys()) def decide_key(k, klist): newkey = dunder_last(k) return newkey if list(map(dunder_last, klist)).count(newkey) == 1 else k original_keys = [decide_key(key, keylist) for key in keylist] return dict(zip(original_keys, _dict.values()))
def dunderkey(*args): """Produces a nested key from multiple args separated by double underscore >>> dunderkey('a', 'b', 'c') >>> 'a__b__c' :param *args : *String :rtype : String """ return '__'.join(args) def dunder_partition(key): """Splits a dunderkey into 2 parts The first part is everything before the final double underscore The second part is after the final double underscore >>> dunder_partition('a__b__c') >>> ('a__b', 'c') :param neskey : String :rtype : 2 Tuple """ parts = key.rsplit('__', 1) return tuple(parts) if len(parts) > 1 else (parts[0], None) def dunder_init(key): """Returns the initial part of the dunder key >>> dunder_init('a__b__c') >>> 'a__b' :param neskey : String :rtype : String """ return dunder_partition(key)[0] def dunder_last(key): """Returns the last part of the dunder key >>> dunder_last('a__b__c') >>> 'c' :param neskey : String :rtype : String """ return dunder_partition(key)[1] def dunder_get(_dict, key): """Returns value for a specified dunderkey A "dunderkey" is just a fieldname that may or may not contain double underscores (dunderscores!) for referrencing nested keys in a dict. eg:: >>> data = {'a': {'b': 1}} >>> nesget(data, 'a__b') 1 key 'b' can be referrenced as 'a__b' :param _dict : (dict) :param key : (str) that represents a first level or nested key in the dict :rtype : (mixed) value corresponding to the key """ parts = key.split('__', 1) key = parts[0] try: result = _dict[key] except KeyError: return None except TypeError: try: result = getattr(_dict, key) except AttributeError: return None return result if len(parts) == 1 else dunder_get(result, parts[1]) def undunder_keys(_dict): """Returns dict with the dunder keys converted back to nested dicts eg:: >>> undunder_keys({'a': 'hello', 'b__c': 'world'}) {'a': 'hello', 'b': {'c': 'world'}} :param _dict : (dict) flat dict :rtype : (dict) nested dict """ def f(key, value): parts = key.split('__') return {parts[0]: value if len(parts) == 1 else f(parts[1], value)} result = {} for r in [f(k, v) for (k, v) in _dict.items()]: rk = list(r.keys())[0] if rk not in result: result.update(r) else: result[rk].update(r[rk]) return result def dunder_truncate(_dict): """Returns dict with dunder keys truncated to only the last part In other words, replaces the dunder keys with just last part of it. In case many identical last parts are encountered, they are not truncated further eg:: >>> dunder_truncate({'a__p': 3, 'b__c': 'no'}) {'c': 'no', 'p': 3} >>> dunder_truncate({'a__p': 'yay', 'b__p': 'no', 'c__z': 'dunno'}) {'a__p': 'yay', 'b__p': 'no', 'z': 'dunno'} :param _dict : (dict) to flatten :rtype : (dict) flattened result """ keylist = list(_dict.keys()) def decide_key(k, klist): newkey = dunder_last(k) return newkey if list(map(dunder_last, klist)).count(newkey) == 1 else k original_keys = [decide_key(key, keylist) for key in keylist] return dict(zip(original_keys, _dict.values()))
def insert_newlines(string, every=64): return '\n'.join(string[i:i+every] for i in range(0, len(string), every)) for __ in range(int(input())): n = int(input()) o = "O" x = "X" a = ["X" for i in range(64)] for i in range(n): a[i] = "." a[0]=o print(insert_newlines("".join(a),8))
def insert_newlines(string, every=64): return '\n'.join((string[i:i + every] for i in range(0, len(string), every))) for __ in range(int(input())): n = int(input()) o = 'O' x = 'X' a = ['X' for i in range(64)] for i in range(n): a[i] = '.' a[0] = o print(insert_newlines(''.join(a), 8))
## Set Configs print('Set configs..') sns.set() pd.options.display.max_columns = None RANDOM_SEED = 42 fig_path = os.path.join(os.getcwd(), 'figs') model_path = os.path.join(os.getcwd(), 'models') model_bib_path = os.path.join(model_path,'model_bib') data_path = os.path.join(os.getcwd(), 'data') ## read the data print('Read the data..') data_fn = os.path.join(data_path, 'simulation_data_y_2020_2021_reduced.h5') df_data = pd.read_hdf(data_fn, key='df') print('Shape of normal data (X_sim): {}'.format(df_data.shape)) data_fn_anormal = os.path.join(data_path, 'anomalous_data_y_2022_reduced.h5') df_data_anormal = pd.read_hdf(data_fn_anormal, key='df') print('Shape of anormal data (X_test): {}'.format(df_data_anormal.shape)) data_fn_drifted = os.path.join(data_path, 'drifted_data_y_2023_reduced_more_cos_phi.h5') df_data_drifted = pd.read_hdf(data_fn_drifted, key='df') print('Shape of drifted data (X_drifted): {}'.format(df_data_drifted.shape)) data_fn_drifted_anormal = os.path.join(data_path, 'anomalous_drifted_data_y_2023_reduced_more_cos_phi.h5') df_data_drifted_anormal = pd.read_hdf(data_fn_drifted_anormal, key='df') print('Shape of drifted anormal data (X_drifted,anormal): {}'.format(df_data_drifted_anormal.shape)) ## save label print('Save label..') s_labels = df_data_anormal['label'] df_data_anormal.drop('label', axis=1, inplace=True) print('Shape of anormal data (X_test): {}'.format(df_data_anormal.shape)) s_drift_labels = df_data_drifted['drift_labels'] df_data_drifted.drop('drift_labels',axis=1,inplace=True) print('Shape of drifted data (X_drifted): {}'.format(df_data_drifted.shape)) s_drift_labels_drifted_ano = df_data_drifted_anormal['drift_labels'] df_data_drifted_anormal.drop('drift_labels', axis=1, inplace=True) s_ano_labels_drifted_ano = df_data_drifted_anormal['anomaly_labels'] df_data_drifted_anormal.drop('anomaly_labels', axis=1, inplace=True) print('Shape of drifted anormal data (X_drifted,anormal): {}'.format(df_data_drifted_anormal.shape)) ### Scale data print('Scale data..') scaler_train = MinMaxScaler((-1,1)) scaler_train = scaler_train.fit(df_data) scaled_anormal = scaler_train.transform(df_data_anormal.to_numpy()) scaled_normal = scaler_train.transform(df_data.to_numpy()) scaled_drifted = scaler_train.transform(df_data_drifted.to_numpy()) scaled_drifted_anormal = scaler_train.transform(df_data_drifted_anormal.to_numpy()) ## prepare for PyTorch print('Prepare data for PyTorch..') # build tensor from numpy anormal_torch_tensor = torch.from_numpy(scaled_anormal).type(torch.FloatTensor) normal_torch_tensor = torch.from_numpy(scaled_normal).type(torch.FloatTensor) drifted_torch_tensor = torch.from_numpy(scaled_drifted).type(torch.FloatTensor) drifted_anormal_torch_tensor = torch.from_numpy(scaled_drifted_anormal).type(torch.FloatTensor) # build TensorDataset from Tensor anormal_dataset = TensorDataset(anormal_torch_tensor, anormal_torch_tensor) normal_dataset = TensorDataset(normal_torch_tensor, normal_torch_tensor) drifted_dataset = TensorDataset(drifted_torch_tensor, drifted_torch_tensor) drifted_anormal_dataset = TensorDataset(drifted_anormal_torch_tensor, drifted_anormal_torch_tensor) # build DataLoader from TensorDataset anormal_dataloader = torch.utils.data.DataLoader(anormal_dataset,batch_size=128,shuffle=False, num_workers=0) normal_dataloader = torch.utils.data.DataLoader(normal_dataset,batch_size=128,shuffle=False, num_workers=0) drifted_dataloader = torch.utils.data.DataLoader(drifted_dataset,batch_size=128,shuffle=False, num_workers=0) drifted_anormal_dataloader = torch.utils.data.DataLoader(drifted_anormal_dataset, batch_size=128, shuffle=False, num_workers=0)
print('Set configs..') sns.set() pd.options.display.max_columns = None random_seed = 42 fig_path = os.path.join(os.getcwd(), 'figs') model_path = os.path.join(os.getcwd(), 'models') model_bib_path = os.path.join(model_path, 'model_bib') data_path = os.path.join(os.getcwd(), 'data') print('Read the data..') data_fn = os.path.join(data_path, 'simulation_data_y_2020_2021_reduced.h5') df_data = pd.read_hdf(data_fn, key='df') print('Shape of normal data (X_sim): {}'.format(df_data.shape)) data_fn_anormal = os.path.join(data_path, 'anomalous_data_y_2022_reduced.h5') df_data_anormal = pd.read_hdf(data_fn_anormal, key='df') print('Shape of anormal data (X_test): {}'.format(df_data_anormal.shape)) data_fn_drifted = os.path.join(data_path, 'drifted_data_y_2023_reduced_more_cos_phi.h5') df_data_drifted = pd.read_hdf(data_fn_drifted, key='df') print('Shape of drifted data (X_drifted): {}'.format(df_data_drifted.shape)) data_fn_drifted_anormal = os.path.join(data_path, 'anomalous_drifted_data_y_2023_reduced_more_cos_phi.h5') df_data_drifted_anormal = pd.read_hdf(data_fn_drifted_anormal, key='df') print('Shape of drifted anormal data (X_drifted,anormal): {}'.format(df_data_drifted_anormal.shape)) print('Save label..') s_labels = df_data_anormal['label'] df_data_anormal.drop('label', axis=1, inplace=True) print('Shape of anormal data (X_test): {}'.format(df_data_anormal.shape)) s_drift_labels = df_data_drifted['drift_labels'] df_data_drifted.drop('drift_labels', axis=1, inplace=True) print('Shape of drifted data (X_drifted): {}'.format(df_data_drifted.shape)) s_drift_labels_drifted_ano = df_data_drifted_anormal['drift_labels'] df_data_drifted_anormal.drop('drift_labels', axis=1, inplace=True) s_ano_labels_drifted_ano = df_data_drifted_anormal['anomaly_labels'] df_data_drifted_anormal.drop('anomaly_labels', axis=1, inplace=True) print('Shape of drifted anormal data (X_drifted,anormal): {}'.format(df_data_drifted_anormal.shape)) print('Scale data..') scaler_train = min_max_scaler((-1, 1)) scaler_train = scaler_train.fit(df_data) scaled_anormal = scaler_train.transform(df_data_anormal.to_numpy()) scaled_normal = scaler_train.transform(df_data.to_numpy()) scaled_drifted = scaler_train.transform(df_data_drifted.to_numpy()) scaled_drifted_anormal = scaler_train.transform(df_data_drifted_anormal.to_numpy()) print('Prepare data for PyTorch..') anormal_torch_tensor = torch.from_numpy(scaled_anormal).type(torch.FloatTensor) normal_torch_tensor = torch.from_numpy(scaled_normal).type(torch.FloatTensor) drifted_torch_tensor = torch.from_numpy(scaled_drifted).type(torch.FloatTensor) drifted_anormal_torch_tensor = torch.from_numpy(scaled_drifted_anormal).type(torch.FloatTensor) anormal_dataset = tensor_dataset(anormal_torch_tensor, anormal_torch_tensor) normal_dataset = tensor_dataset(normal_torch_tensor, normal_torch_tensor) drifted_dataset = tensor_dataset(drifted_torch_tensor, drifted_torch_tensor) drifted_anormal_dataset = tensor_dataset(drifted_anormal_torch_tensor, drifted_anormal_torch_tensor) anormal_dataloader = torch.utils.data.DataLoader(anormal_dataset, batch_size=128, shuffle=False, num_workers=0) normal_dataloader = torch.utils.data.DataLoader(normal_dataset, batch_size=128, shuffle=False, num_workers=0) drifted_dataloader = torch.utils.data.DataLoader(drifted_dataset, batch_size=128, shuffle=False, num_workers=0) drifted_anormal_dataloader = torch.utils.data.DataLoader(drifted_anormal_dataset, batch_size=128, shuffle=False, num_workers=0)
a = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100] # dumb way # for i in range(0,len(a),1): # if a[i]%2 == 0: # print(str(a[i]),end=" ") b = [i for i in a if i % 2 == 0] print(b)
a = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100] b = [i for i in a if i % 2 == 0] print(b)
''' Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V 5 X 10 L 50 C 100 D 500 M 1000 For example, 2 is written as II in Roman numeral, just two one's added together. 12 is written as XII, which is simply X + II. The number 27 is written as XXVII, which is XX + V + II. Roman numerals are usually written largest to smallest from left to right. However, the numeral for four is not IIII. Instead, the number four is written as IV. Because the one is before the five we subtract it making four. The same principle applies to the number nine, which is written as IX. There are six instances where subtraction is used: I can be placed before V (5) and X (10) to make 4 and 9. X can be placed before L (50) and C (100) to make 40 and 90. C can be placed before D (500) and M (1000) to make 400 and 900. Given a roman numeral, convert it to an integer. ''' class Solution: def romanToInt(self, s: str) -> int: roman = {'I' : 1, 'V' : 5, 'X' : 10, 'L' : 50, 'C' : 100, 'D' : 500, 'M' : 1000 } ans = 0 for i in range(len(s)): if i < len(s) - 1 and roman[s[i]] < roman[s[i + 1]]: ans -= roman[s[i]] else: ans += roman[s[i]] return ans
""" Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V 5 X 10 L 50 C 100 D 500 M 1000 For example, 2 is written as II in Roman numeral, just two one's added together. 12 is written as XII, which is simply X + II. The number 27 is written as XXVII, which is XX + V + II. Roman numerals are usually written largest to smallest from left to right. However, the numeral for four is not IIII. Instead, the number four is written as IV. Because the one is before the five we subtract it making four. The same principle applies to the number nine, which is written as IX. There are six instances where subtraction is used: I can be placed before V (5) and X (10) to make 4 and 9. X can be placed before L (50) and C (100) to make 40 and 90. C can be placed before D (500) and M (1000) to make 400 and 900. Given a roman numeral, convert it to an integer. """ class Solution: def roman_to_int(self, s: str) -> int: roman = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000} ans = 0 for i in range(len(s)): if i < len(s) - 1 and roman[s[i]] < roman[s[i + 1]]: ans -= roman[s[i]] else: ans += roman[s[i]] return ans
# https://www.codewars.com/kata/55a243393fb3e87021000198/train/python # My solution def remember(text): counter = {} result = [] for ch in text: counter[ch] = counter.get(ch, 0) + 1 if counter[ch] == 2: result.append(ch) return result # ... def remember(str_): seen = set() res = [] for i in str_: res.append(i) if i in seen and i not in res else seen.add(i) return res
def remember(text): counter = {} result = [] for ch in text: counter[ch] = counter.get(ch, 0) + 1 if counter[ch] == 2: result.append(ch) return result def remember(str_): seen = set() res = [] for i in str_: res.append(i) if i in seen and i not in res else seen.add(i) return res
directory_map = { "abilene": "directed-abilene-zhang-5min-over-6months-ALL", "geant": "directed-geant-uhlig-15min-over-4months-ALL", "germany50": "directed-germany50-DFN-aggregated-1day-over-1month", }
directory_map = {'abilene': 'directed-abilene-zhang-5min-over-6months-ALL', 'geant': 'directed-geant-uhlig-15min-over-4months-ALL', 'germany50': 'directed-germany50-DFN-aggregated-1day-over-1month'}
class Math1(): def __init__(self): self.my_num1 = 10 self.my_num2 = 20 def addition(self): return self.my_num1 + self.my_num2 def subtraction(self): return self.my_num1 - self.my_num2 class Math_Plus(Math1): def __init__(self, my_num1=40, my_num2=90): self.my_num1 = my_num1 self.my_num2 = my_num2 def multiplication(self): return self.my_num1 * self.my_num2 def division(self): return self.my_num1 / self.my_num2 if __name__ == "__main__": math1 = Math1() print(math1.addition()) #30 print(math1.subtraction()) #-10 math_plus = Math_Plus() print(math_plus.addition()) #130 print(math_plus.subtraction()) #-50 print(math_plus.multiplication()) #3600 print(math_plus.division()) #0.-44444444
class Math1: def __init__(self): self.my_num1 = 10 self.my_num2 = 20 def addition(self): return self.my_num1 + self.my_num2 def subtraction(self): return self.my_num1 - self.my_num2 class Math_Plus(Math1): def __init__(self, my_num1=40, my_num2=90): self.my_num1 = my_num1 self.my_num2 = my_num2 def multiplication(self): return self.my_num1 * self.my_num2 def division(self): return self.my_num1 / self.my_num2 if __name__ == '__main__': math1 = math1() print(math1.addition()) print(math1.subtraction()) math_plus = math__plus() print(math_plus.addition()) print(math_plus.subtraction()) print(math_plus.multiplication()) print(math_plus.division())
# single source of truth for package version, # see https://packaging.python.org/en/latest/single_source_version/ __version__ = "0.6.0" # app name to send as part of SDK requests app_name = "DLHub CLI v{}".format(__version__)
__version__ = '0.6.0' app_name = 'DLHub CLI v{}'.format(__version__)
# coding: utf8 # try something like def index(): return plugin_flatpage() def rfp(): return plugin_flatpage()
def index(): return plugin_flatpage() def rfp(): return plugin_flatpage()
""" MicroPython driver for MLX90615 IR temperature I2C sensor : https://github.com/rcolistete/MicroPython_MLX90615_driver Version with simple read functions : 0.2.1 @ 2020/05/05 Author: Roberto Colistete Jr. (roberto.colistete at gmail.com) License: MIT License (https://opensource.org/licenses/MIT) """ __version__ = '0.2.1' MLX90615_I2C_DEFAULT_ADDR = const(0x5B) _REG_ID_LOW = const(0x1E) # EEPROM register - ID number low _REG_ID_HIGH = const(0x1F) # EEPROM register - ID number high _REG_AMBIENT_TEMP = const(0x26) # RAM register - ambient temperature register _REG_OBJECT_TEMP = const(0x27) # RAM register - object temperature register class MLX90615: def __init__(self, i2c, address=MLX90615_I2C_DEFAULT_ADDR): self.i2c = i2c self.address = address self.buf = bytearray(3) def _crc8(self, icrc, data): crc = icrc ^ data for _ in range(8): crc <<= 1 if crc & 0x0100: crc ^= 0x07 crc &= 0xFF return crc def read16(self, register, crc_check=True): self.i2c.readfrom_mem_into(self.address, register, self.buf) lsb = self.buf[0] msb = self.buf[1] pec = self.buf[2] crc = 0 if crc_check: crc = self._crc8(crc, self.address << 1) crc = self._crc8(crc, register) crc = self._crc8(crc, (self.address << 1) + 1) crc = self._crc8(crc, lsb) crc = self._crc8(crc, msb) if (not crc_check) or (pec == crc): return lsb | (msb << 8) else: raise Exception("PEC != CRC8 error in reading register {:02x}.".format(register)) def read_ambient_temp(self, pec_check=True): try: t = self.read16(_REG_AMBIENT_TEMP, crc_check=pec_check) except Exception as err: raise Exception("Error reading ambient temperature.\n{}".format(err)) else: if (t > 0x7FFF): raise Exception("Invalid ambient temperature error.") else: return t*2 - 27315 def read_object_temp(self, pec_check=True): try: t = self.read16(_REG_OBJECT_TEMP, crc_check=pec_check) except Exception as err: raise Exception("Error reading object temperature.\n{}".format(err)) else: if (t > 0x7FFF): raise Exception("Invalid object temperature error.") else: return t*2 - 27315 def read_id(self, pec_check=True): try: return self.read16(_REG_ID_LOW, crc_check=pec_check) | (self.read16(_REG_ID_HIGH, crc_check=pec_check) << 16) except Exception as err: raise Exception("Error reading sensor ID.\n{}".format(err)) def read_eeprom(self, pec_check=True): eeprom_data = [0]*0x10 for register in range(0x10, 0x20): try: eeprom_data[register - 0x10] = self.read16(register, crc_check=pec_check) except Exception as err: raise Exception("Error reading EEPROM.\n{}".format(err)) return eeprom_data
""" MicroPython driver for MLX90615 IR temperature I2C sensor : https://github.com/rcolistete/MicroPython_MLX90615_driver Version with simple read functions : 0.2.1 @ 2020/05/05 Author: Roberto Colistete Jr. (roberto.colistete at gmail.com) License: MIT License (https://opensource.org/licenses/MIT) """ __version__ = '0.2.1' mlx90615_i2_c_default_addr = const(91) _reg_id_low = const(30) _reg_id_high = const(31) _reg_ambient_temp = const(38) _reg_object_temp = const(39) class Mlx90615: def __init__(self, i2c, address=MLX90615_I2C_DEFAULT_ADDR): self.i2c = i2c self.address = address self.buf = bytearray(3) def _crc8(self, icrc, data): crc = icrc ^ data for _ in range(8): crc <<= 1 if crc & 256: crc ^= 7 crc &= 255 return crc def read16(self, register, crc_check=True): self.i2c.readfrom_mem_into(self.address, register, self.buf) lsb = self.buf[0] msb = self.buf[1] pec = self.buf[2] crc = 0 if crc_check: crc = self._crc8(crc, self.address << 1) crc = self._crc8(crc, register) crc = self._crc8(crc, (self.address << 1) + 1) crc = self._crc8(crc, lsb) crc = self._crc8(crc, msb) if not crc_check or pec == crc: return lsb | msb << 8 else: raise exception('PEC != CRC8 error in reading register {:02x}.'.format(register)) def read_ambient_temp(self, pec_check=True): try: t = self.read16(_REG_AMBIENT_TEMP, crc_check=pec_check) except Exception as err: raise exception('Error reading ambient temperature.\n{}'.format(err)) else: if t > 32767: raise exception('Invalid ambient temperature error.') else: return t * 2 - 27315 def read_object_temp(self, pec_check=True): try: t = self.read16(_REG_OBJECT_TEMP, crc_check=pec_check) except Exception as err: raise exception('Error reading object temperature.\n{}'.format(err)) else: if t > 32767: raise exception('Invalid object temperature error.') else: return t * 2 - 27315 def read_id(self, pec_check=True): try: return self.read16(_REG_ID_LOW, crc_check=pec_check) | self.read16(_REG_ID_HIGH, crc_check=pec_check) << 16 except Exception as err: raise exception('Error reading sensor ID.\n{}'.format(err)) def read_eeprom(self, pec_check=True): eeprom_data = [0] * 16 for register in range(16, 32): try: eeprom_data[register - 16] = self.read16(register, crc_check=pec_check) except Exception as err: raise exception('Error reading EEPROM.\n{}'.format(err)) return eeprom_data
# -*- coding: utf-8 -*- """Contains version information""" __version__ = "0.7.9"
"""Contains version information""" __version__ = '0.7.9'
''' PyTorch implementation of the RetinaNet object detector: Lin, Tsung-Yi, et al. "Focal loss for dense object detection." Proceedings of the IEEE international conference on computer vision. 2017. Basic implementation forked and adapted from: https://github.com/kuangliu/pytorch-retinanet 2019 Benjamin Kellenberger ''' # default options for the model, may be overridden in the custom configuration loaded at runtime DEFAULT_OPTIONS = { "general": { "image_size": [800, 600], "device": "cuda", "seed": 1234 }, "model": { "kwargs": { "backbone": "resnet50", "pretrained": False, "out_planes": 256, "convertToInstanceNorm": False } }, "train": { "dataLoader": { "kwargs": { "shuffle": True, "batch_size": 32 } }, "optim": { "class": "torch.optim.Adam", "kwargs": { "lr": 1e-7, "weight_decay": 0.0 } }, "transform": { "class": "ai.models.pytorch.boundingBoxes.Compose", "kwargs": { "transforms": [{ "class": "ai.models.pytorch.boundingBoxes.Resize", "kwargs": { "size": [800, 600] } }, { "class": "ai.models.pytorch.boundingBoxes.RandomHorizontalFlip", "kwargs": { "p": 0.5 } }, { "class": "ai.models.pytorch.boundingBoxes.DefaultTransform", "kwargs": { "transform": { "class": "torchvision.transforms.ColorJitter", "kwargs": { "brightness": 0.25, "contrast": 0.25, "saturation": 0.25, "hue": 0.01 } } } }, { "class": "ai.models.pytorch.boundingBoxes.DefaultTransform", "kwargs": { "transform": { "class": "torchvision.transforms.ToTensor" } } }, { "class": "ai.models.pytorch.boundingBoxes.DefaultTransform", "kwargs": { "transform": { "class": "torchvision.transforms.Normalize", "kwargs": { "mean": [0.485, 0.456, 0.406], "std": [0.229, 0.224, 0.225] } } } } ] } }, "criterion": { "class": "ai.models.pytorch.functional._retinanet.loss.FocalLoss", "kwargs": { "gamma": 2.0, "alpha": 0.25, "background_weight": 1.0 } }, "ignore_unsure": True }, "inference": { "transform": { "class": "ai.models.pytorch.boundingBoxes.Compose", "kwargs": { "transforms": [{ "class": "ai.models.pytorch.boundingBoxes.Resize", "kwargs": { "size": [800, 600] } }, { "class": "ai.models.pytorch.boundingBoxes.DefaultTransform", "kwargs": { "transform": { "class": "torchvision.transforms.ToTensor" } } }, { "class": "ai.models.pytorch.boundingBoxes.DefaultTransform", "kwargs": { "transform": { "class": "torchvision.transforms.Normalize", "kwargs": { "mean": [0.485, 0.456, 0.406], "std": [0.229, 0.224, 0.225] } } } } ] } }, "dataLoader": { "kwargs": { "shuffle": False, "batch_size": 32 } } } }
""" PyTorch implementation of the RetinaNet object detector: Lin, Tsung-Yi, et al. "Focal loss for dense object detection." Proceedings of the IEEE international conference on computer vision. 2017. Basic implementation forked and adapted from: https://github.com/kuangliu/pytorch-retinanet 2019 Benjamin Kellenberger """ default_options = {'general': {'image_size': [800, 600], 'device': 'cuda', 'seed': 1234}, 'model': {'kwargs': {'backbone': 'resnet50', 'pretrained': False, 'out_planes': 256, 'convertToInstanceNorm': False}}, 'train': {'dataLoader': {'kwargs': {'shuffle': True, 'batch_size': 32}}, 'optim': {'class': 'torch.optim.Adam', 'kwargs': {'lr': 1e-07, 'weight_decay': 0.0}}, 'transform': {'class': 'ai.models.pytorch.boundingBoxes.Compose', 'kwargs': {'transforms': [{'class': 'ai.models.pytorch.boundingBoxes.Resize', 'kwargs': {'size': [800, 600]}}, {'class': 'ai.models.pytorch.boundingBoxes.RandomHorizontalFlip', 'kwargs': {'p': 0.5}}, {'class': 'ai.models.pytorch.boundingBoxes.DefaultTransform', 'kwargs': {'transform': {'class': 'torchvision.transforms.ColorJitter', 'kwargs': {'brightness': 0.25, 'contrast': 0.25, 'saturation': 0.25, 'hue': 0.01}}}}, {'class': 'ai.models.pytorch.boundingBoxes.DefaultTransform', 'kwargs': {'transform': {'class': 'torchvision.transforms.ToTensor'}}}, {'class': 'ai.models.pytorch.boundingBoxes.DefaultTransform', 'kwargs': {'transform': {'class': 'torchvision.transforms.Normalize', 'kwargs': {'mean': [0.485, 0.456, 0.406], 'std': [0.229, 0.224, 0.225]}}}}]}}, 'criterion': {'class': 'ai.models.pytorch.functional._retinanet.loss.FocalLoss', 'kwargs': {'gamma': 2.0, 'alpha': 0.25, 'background_weight': 1.0}}, 'ignore_unsure': True}, 'inference': {'transform': {'class': 'ai.models.pytorch.boundingBoxes.Compose', 'kwargs': {'transforms': [{'class': 'ai.models.pytorch.boundingBoxes.Resize', 'kwargs': {'size': [800, 600]}}, {'class': 'ai.models.pytorch.boundingBoxes.DefaultTransform', 'kwargs': {'transform': {'class': 'torchvision.transforms.ToTensor'}}}, {'class': 'ai.models.pytorch.boundingBoxes.DefaultTransform', 'kwargs': {'transform': {'class': 'torchvision.transforms.Normalize', 'kwargs': {'mean': [0.485, 0.456, 0.406], 'std': [0.229, 0.224, 0.225]}}}}]}}, 'dataLoader': {'kwargs': {'shuffle': False, 'batch_size': 32}}}}
#import gui.gui as gui # Python3 program to find number # of bins required using # First Fit algorithm. # Returns number of bins required # using first fit # online algorithm def firstFit(weight, n, c): # Initialize result (Count of bins) res = 0 # Create an array to store # remaining space in bins # there can be at most n bins bin_rem = [0]*n # Place items one by one for i in range(n): # Find the first bin that # can accommodate # weight[i] j = 0 # Initialize minimum space # left and index # of best bin min = c + 1 bi = 0 for j in range(res): if (bin_rem[j] >= weight[i] and bin_rem[j] - weight[i] < min): bi = j min = bin_rem[j] - weight[i] # If no bin could accommodate weight[i], # create a new bin if (min == c + 1): bin_rem[res] = c - weight[i] res += 1 else: # Assign the item to best bin bin_rem[bi] -= weight[i] return res # Driver code if __name__ == '__main__': weight = [ 10, 5, 10, 7, 1, 10, 10 ] c = 10 n = len(weight) print("Number of bins required in First Fit : ", firstFit(weight, n, c))
def first_fit(weight, n, c): res = 0 bin_rem = [0] * n for i in range(n): j = 0 min = c + 1 bi = 0 for j in range(res): if bin_rem[j] >= weight[i] and bin_rem[j] - weight[i] < min: bi = j min = bin_rem[j] - weight[i] if min == c + 1: bin_rem[res] = c - weight[i] res += 1 else: bin_rem[bi] -= weight[i] return res if __name__ == '__main__': weight = [10, 5, 10, 7, 1, 10, 10] c = 10 n = len(weight) print('Number of bins required in First Fit : ', first_fit(weight, n, c))
# mapping for AWS IAM user_name to slack ID accross all AWS accounts # # Fill in "<aws_IAM_user_id>:<slack_id>" here. Seperate each entry by a comma, and leave the last one without a comma # Example: # mapping = { # "IAM_user_id1":"slack_id1", # "IAM_user_id2":"slack_id2", # "IAM_user_id3":"slack_id3" # } mapping = { "IAM_user_id1":"slack_id1", "IAM_user_id2":"slack_id2", "IAM_user_id3":"slack_id3" }
mapping = {'IAM_user_id1': 'slack_id1', 'IAM_user_id2': 'slack_id2', 'IAM_user_id3': 'slack_id3'}
vents = """964,133 -> 596,133 920,215 -> 920,976 123,528 -> 123,661 613,13 -> 407,13 373,876 -> 424,876 616,326 -> 120,326 486,335 -> 539,388 104,947 -> 54,947 319,241 -> 282,204 453,175 -> 453,438 485,187 -> 915,617 863,605 -> 603,605 870,524 -> 342,524 967,395 -> 634,62 405,181 -> 807,181 961,363 -> 419,905 89,586 -> 214,461 545,481 -> 731,295 407,678 -> 626,678 421,642 -> 91,312 11,22 -> 935,946 770,208 -> 76,902 668,858 -> 668,890 568,451 -> 574,451 233,56 -> 371,56 233,932 -> 44,932 404,81 -> 796,81 520,77 -> 403,194 296,736 -> 447,887 210,909 -> 16,909 692,483 -> 877,668 777,289 -> 744,289 22,760 -> 652,130 96,360 -> 626,360 101,267 -> 101,783 47,667 -> 660,667 805,682 -> 563,440 112,15 -> 463,366 406,808 -> 430,808 793,767 -> 107,81 560,534 -> 958,534 722,429 -> 722,459 646,889 -> 646,195 433,942 -> 449,958 716,503 -> 716,99 266,450 -> 266,780 316,81 -> 565,81 760,452 -> 687,452 976,983 -> 15,22 499,564 -> 499,909 839,913 -> 38,112 707,333 -> 438,333 47,644 -> 352,644 807,309 -> 807,706 434,686 -> 812,308 559,572 -> 63,76 493,352 -> 581,352 94,88 -> 928,88 898,738 -> 106,738 201,10 -> 564,10 976,914 -> 976,472 836,153 -> 585,153 178,43 -> 17,204 784,967 -> 738,967 370,359 -> 449,359 13,526 -> 637,526 399,158 -> 10,158 572,293 -> 289,293 627,674 -> 895,674 921,402 -> 984,402 907,667 -> 944,704 574,877 -> 882,569 977,977 -> 121,121 550,584 -> 862,584 396,556 -> 396,289 391,33 -> 532,174 12,988 -> 989,11 48,787 -> 48,637 476,638 -> 113,638 985,985 -> 13,13 838,784 -> 198,784 567,195 -> 677,305 174,251 -> 577,654 296,801 -> 53,558 983,899 -> 983,380 507,230 -> 507,929 264,516 -> 668,920 865,952 -> 865,768 522,290 -> 744,512 936,958 -> 936,115 527,871 -> 527,519 944,972 -> 21,49 880,380 -> 695,565 471,374 -> 446,349 503,597 -> 127,221 471,514 -> 30,73 890,232 -> 890,511 14,461 -> 14,853 167,676 -> 148,676 987,230 -> 754,230 797,725 -> 797,847 347,21 -> 84,21 839,274 -> 964,274 607,456 -> 894,456 335,949 -> 301,949 167,236 -> 820,889 87,558 -> 87,917 318,788 -> 622,484 699,583 -> 699,321 971,967 -> 35,31 420,44 -> 420,36 29,484 -> 458,484 768,157 -> 768,30 690,839 -> 317,839 870,578 -> 560,578 697,195 -> 70,822 689,45 -> 689,223 790,724 -> 341,724 694,291 -> 694,507 43,339 -> 43,987 590,733 -> 590,179 751,361 -> 945,361 99,820 -> 450,469 460,696 -> 942,696 783,940 -> 487,644 630,537 -> 48,537 643,856 -> 643,396 558,733 -> 257,432 16,972 -> 570,418 636,188 -> 636,610 868,138 -> 868,407 85,424 -> 85,919 710,932 -> 354,576 356,505 -> 783,505 606,876 -> 606,62 577,431 -> 749,431 108,262 -> 108,145 615,455 -> 264,104 205,754 -> 866,754 189,182 -> 855,848 10,43 -> 925,958 293,773 -> 293,534 746,313 -> 802,369 607,174 -> 211,570 860,840 -> 260,240 879,78 -> 595,78 11,143 -> 449,143 190,983 -> 267,983 912,92 -> 76,928 744,364 -> 744,258 436,417 -> 46,807 629,592 -> 517,592 113,893 -> 113,959 714,213 -> 786,285 868,165 -> 868,731 349,69 -> 491,69 278,430 -> 111,263 593,849 -> 593,203 156,860 -> 876,860 169,615 -> 169,984 983,93 -> 139,937 94,548 -> 18,548 623,72 -> 106,589 530,334 -> 473,334 384,746 -> 925,205 711,74 -> 28,757 850,728 -> 629,949 378,801 -> 228,651 347,968 -> 201,822 82,578 -> 82,555 149,405 -> 707,963 254,169 -> 793,169 443,454 -> 331,454 460,659 -> 608,807 838,807 -> 31,807 561,952 -> 290,952 755,626 -> 204,75 550,424 -> 550,81 772,115 -> 772,600 40,517 -> 40,232 277,841 -> 317,841 899,150 -> 128,921 735,332 -> 465,332 839,254 -> 915,330 959,616 -> 182,616 729,723 -> 487,965 64,838 -> 953,838 689,830 -> 689,982 191,83 -> 191,879 522,833 -> 942,833 877,785 -> 877,346 255,95 -> 556,95 782,491 -> 475,798 268,815 -> 812,271 119,181 -> 905,181 445,457 -> 742,160 973,30 -> 27,976 356,681 -> 356,289 882,279 -> 914,279 672,162 -> 672,153 180,729 -> 357,729 985,716 -> 985,313 191,618 -> 191,963 949,749 -> 636,749 289,902 -> 142,902 923,615 -> 123,615 710,929 -> 541,760 211,402 -> 211,433 515,178 -> 533,178 525,869 -> 525,578 201,569 -> 17,569 629,848 -> 882,848 152,512 -> 152,189 914,723 -> 764,723 218,231 -> 721,734 438,382 -> 846,382 582,475 -> 582,559 529,943 -> 529,683 330,312 -> 59,312 242,900 -> 862,900 271,220 -> 271,118 182,459 -> 182,673 513,265 -> 513,420 918,942 -> 378,942 277,765 -> 812,230 625,874 -> 219,874 737,533 -> 644,626 647,975 -> 152,480 638,284 -> 785,284 549,680 -> 549,877 886,278 -> 372,792 130,560 -> 516,174 186,741 -> 186,555 208,536 -> 469,536 674,906 -> 312,906 934,156 -> 934,322 568,412 -> 214,412 243,19 -> 243,814 861,230 -> 104,987 683,891 -> 683,533 545,740 -> 545,980 343,320 -> 796,320 821,220 -> 821,302 578,741 -> 578,141 633,405 -> 27,405 645,975 -> 225,555 25,527 -> 412,527 378,817 -> 378,913 352,741 -> 352,293 48,986 -> 925,109 506,231 -> 491,231 854,883 -> 48,77 261,221 -> 895,855 902,240 -> 902,943 145,338 -> 770,963 832,216 -> 832,869 480,385 -> 324,385 644,202 -> 433,202 202,176 -> 190,176 668,693 -> 668,349 95,230 -> 143,230 873,144 -> 67,950 232,509 -> 238,509 963,43 -> 133,873 527,631 -> 641,517 363,61 -> 849,61 72,326 -> 72,861 542,801 -> 233,492 247,48 -> 247,785 972,563 -> 480,71 362,870 -> 932,300 263,811 -> 263,584 556,157 -> 417,157 946,900 -> 175,129 790,542 -> 530,542 777,195 -> 154,818 71,764 -> 71,193 197,13 -> 453,13 664,714 -> 158,714 257,819 -> 257,730 796,927 -> 688,927 124,53 -> 954,883 30,16 -> 980,966 84,151 -> 597,151 840,776 -> 684,776 548,460 -> 718,630 291,635 -> 291,151 948,43 -> 58,933 373,483 -> 373,591 309,81 -> 259,81 692,808 -> 692,835 737,112 -> 215,634 808,595 -> 808,115 160,912 -> 973,99 494,191 -> 494,475 713,925 -> 43,255 736,580 -> 290,134 257,679 -> 725,211 464,81 -> 712,81 35,147 -> 35,420 372,159 -> 372,548 508,228 -> 682,402 120,491 -> 518,889 139,948 -> 272,815 398,523 -> 398,818 935,50 -> 40,945 415,959 -> 195,739 250,868 -> 250,930 77,60 -> 917,900 584,389 -> 493,298 362,163 -> 362,704 670,740 -> 670,703 689,297 -> 689,388 988,572 -> 988,340 238,248 -> 238,916 748,753 -> 29,34 184,565 -> 184,486 812,217 -> 812,34 60,140 -> 96,104 826,673 -> 230,673 221,221 -> 207,235 449,483 -> 270,304 805,810 -> 805,564 952,52 -> 139,865 428,967 -> 312,851 854,673 -> 661,673 985,209 -> 853,209 523,365 -> 54,365 492,171 -> 646,171 908,853 -> 69,14 38,698 -> 724,12 400,479 -> 167,479 948,313 -> 948,976 280,145 -> 37,145 206,858 -> 683,381 203,413 -> 545,413 726,173 -> 673,173 30,954 -> 150,954 319,592 -> 870,41 808,91 -> 180,719 845,612 -> 972,485 160,430 -> 160,780 19,339 -> 379,339 476,550 -> 476,291 341,785 -> 229,673 371,476 -> 371,663 509,836 -> 412,933 980,20 -> 31,969 822,526 -> 328,32 859,314 -> 425,314 963,961 -> 963,100 984,978 -> 31,25 659,251 -> 619,211 649,477 -> 846,477 32,259 -> 724,951 468,753 -> 468,91 690,301 -> 690,652 436,912 -> 845,503 32,123 -> 576,667 142,79 -> 741,678 610,228 -> 468,370 172,667 -> 172,736 961,700 -> 132,700 804,875 -> 804,213 71,970 -> 340,970 171,52 -> 149,30 754,604 -> 226,604 485,941 -> 27,941 126,383 -> 328,181 41,39 -> 987,985 128,62 -> 896,830 414,278 -> 923,787 712,15 -> 712,859 794,35 -> 200,629 516,147 -> 402,261 526,862 -> 905,862 721,407 -> 721,887 728,920 -> 339,920 117,417 -> 203,417 291,561 -> 17,835 171,359 -> 837,359 93,125 -> 136,125 220,226 -> 220,177 75,434 -> 75,407 235,664 -> 141,664 553,490 -> 566,477 487,651 -> 487,877 699,150 -> 933,384 73,556 -> 453,556 363,371 -> 363,984 905,106 -> 668,106 139,271 -> 139,125 466,379 -> 466,420 12,935 -> 625,935 89,892 -> 779,892 119,701 -> 270,852 354,886 -> 80,886 917,376 -> 440,376 23,182 -> 794,953 451,718 -> 121,718 62,251 -> 62,451 642,74 -> 642,698 425,200 -> 442,200 828,175 -> 828,405 751,743 -> 591,743 569,681 -> 574,681 329,187 -> 329,837 302,592 -> 302,230 359,135 -> 386,108 44,234 -> 44,731 836,305 -> 836,574 170,512 -> 367,512 576,699 -> 576,44 398,185 -> 821,185 733,78 -> 733,747 141,183 -> 141,787 65,360 -> 65,691 828,780 -> 828,98 776,744 -> 776,751 881,74 -> 481,474 438,642 -> 438,399 676,972 -> 175,972 60,318 -> 56,314 312,169 -> 341,169 736,472 -> 392,128 225,281 -> 164,281 407,799 -> 341,799 458,826 -> 983,301 12,988 -> 987,13 23,854 -> 662,215 82,863 -> 82,416 542,708 -> 542,44 659,51 -> 520,51 353,246 -> 353,90 985,976 -> 77,68 628,493 -> 628,510 51,48 -> 635,48 97,814 -> 828,83 14,44 -> 773,44 603,178 -> 597,178 11,220 -> 783,220 613,39 -> 613,719 68,303 -> 690,925 121,974 -> 896,199 343,54 -> 343,837 744,303 -> 744,942 678,370 -> 246,370 937,134 -> 84,987 357,333 -> 357,516 848,212 -> 429,631 909,244 -> 138,244 122,794 -> 786,130 274,611 -> 57,611 66,337 -> 385,18 847,356 -> 831,356 740,480 -> 740,359 194,443 -> 194,301 50,564 -> 572,42 86,587 -> 774,587 708,258 -> 49,917 420,530 -> 277,387 509,580 -> 509,71 237,196 -> 479,196 442,287 -> 850,287 830,393 -> 532,393 274,720 -> 501,493 610,565 -> 218,957 380,393 -> 380,800 237,847 -> 155,847 267,791 -> 52,791 275,772 -> 275,794 239,238 -> 419,418 200,785 -> 884,101 185,980 -> 185,284 47,46 -> 750,749 724,661 -> 724,337 630,349 -> 666,349 21,911 -> 21,569 661,562 -> 661,925 41,898 -> 41,104 988,67 -> 105,67 739,65 -> 868,65 187,973 -> 809,973 730,211 -> 255,686 254,445 -> 254,872 622,364 -> 235,751 402,980 -> 761,621 46,488 -> 960,488 799,708 -> 799,862 909,181 -> 909,189 450,266 -> 450,304 631,584 -> 631,455 164,830 -> 744,250 679,755 -> 690,744 949,26 -> 190,785 695,783 -> 218,783 269,151 -> 40,151 166,152 -> 22,152 281,819 -> 922,178 956,649 -> 956,593""" vents2="""0,9 -> 5,9 8,0 -> 0,8 9,4 -> 3,4 2,2 -> 2,1 7,0 -> 7,4 6,4 -> 2,0 0,9 -> 2,9 3,4 -> 1,4 0,0 -> 8,8 5,5 -> 8,2""" size=1000 map = [[0 for x in range(size)] for y in range(size)] #print(map) for vent in vents.splitlines(): line = vent.split(" -> ") x1, y1 = [int(digit) for digit in line[0].split(",")] x2, y2 = [int(digit) for digit in line[1].split(",")] if x1 == x2: y_min = min(y1, y2) y_max = max(y1, y2) #print(x1, y_min, y_max) for y in range(y_min, y_max + 1): map[y][x1] += 1 elif y1 == y2: x_min = min(x1, x2) x_max = max(x1, x2) #print(y1, x_min, x_max) for x in range(x_min, x_max + 1): map[y1][x] += 1 else: dx = 1 if x2 > x1 else -1 dy = 1 if y2 > y1 else -1 range_x = range(x1, x2 + dx, dx) range_y = range(y1, y2 + dy, dy) for y, x in zip(range_y, range_x): map[y][x] += 1 overlap = 0 for row in map: for cell in row: #print(cell) if cell > 1: overlap += 1 print("\n".join([",".join([str(digit) for digit in line]) for line in map])) print(overlap)
vents = '964,133 -> 596,133\n920,215 -> 920,976\n123,528 -> 123,661\n613,13 -> 407,13\n373,876 -> 424,876\n616,326 -> 120,326\n486,335 -> 539,388\n104,947 -> 54,947\n319,241 -> 282,204\n453,175 -> 453,438\n485,187 -> 915,617\n863,605 -> 603,605\n870,524 -> 342,524\n967,395 -> 634,62\n405,181 -> 807,181\n961,363 -> 419,905\n89,586 -> 214,461\n545,481 -> 731,295\n407,678 -> 626,678\n421,642 -> 91,312\n11,22 -> 935,946\n770,208 -> 76,902\n668,858 -> 668,890\n568,451 -> 574,451\n233,56 -> 371,56\n233,932 -> 44,932\n404,81 -> 796,81\n520,77 -> 403,194\n296,736 -> 447,887\n210,909 -> 16,909\n692,483 -> 877,668\n777,289 -> 744,289\n22,760 -> 652,130\n96,360 -> 626,360\n101,267 -> 101,783\n47,667 -> 660,667\n805,682 -> 563,440\n112,15 -> 463,366\n406,808 -> 430,808\n793,767 -> 107,81\n560,534 -> 958,534\n722,429 -> 722,459\n646,889 -> 646,195\n433,942 -> 449,958\n716,503 -> 716,99\n266,450 -> 266,780\n316,81 -> 565,81\n760,452 -> 687,452\n976,983 -> 15,22\n499,564 -> 499,909\n839,913 -> 38,112\n707,333 -> 438,333\n47,644 -> 352,644\n807,309 -> 807,706\n434,686 -> 812,308\n559,572 -> 63,76\n493,352 -> 581,352\n94,88 -> 928,88\n898,738 -> 106,738\n201,10 -> 564,10\n976,914 -> 976,472\n836,153 -> 585,153\n178,43 -> 17,204\n784,967 -> 738,967\n370,359 -> 449,359\n13,526 -> 637,526\n399,158 -> 10,158\n572,293 -> 289,293\n627,674 -> 895,674\n921,402 -> 984,402\n907,667 -> 944,704\n574,877 -> 882,569\n977,977 -> 121,121\n550,584 -> 862,584\n396,556 -> 396,289\n391,33 -> 532,174\n12,988 -> 989,11\n48,787 -> 48,637\n476,638 -> 113,638\n985,985 -> 13,13\n838,784 -> 198,784\n567,195 -> 677,305\n174,251 -> 577,654\n296,801 -> 53,558\n983,899 -> 983,380\n507,230 -> 507,929\n264,516 -> 668,920\n865,952 -> 865,768\n522,290 -> 744,512\n936,958 -> 936,115\n527,871 -> 527,519\n944,972 -> 21,49\n880,380 -> 695,565\n471,374 -> 446,349\n503,597 -> 127,221\n471,514 -> 30,73\n890,232 -> 890,511\n14,461 -> 14,853\n167,676 -> 148,676\n987,230 -> 754,230\n797,725 -> 797,847\n347,21 -> 84,21\n839,274 -> 964,274\n607,456 -> 894,456\n335,949 -> 301,949\n167,236 -> 820,889\n87,558 -> 87,917\n318,788 -> 622,484\n699,583 -> 699,321\n971,967 -> 35,31\n420,44 -> 420,36\n29,484 -> 458,484\n768,157 -> 768,30\n690,839 -> 317,839\n870,578 -> 560,578\n697,195 -> 70,822\n689,45 -> 689,223\n790,724 -> 341,724\n694,291 -> 694,507\n43,339 -> 43,987\n590,733 -> 590,179\n751,361 -> 945,361\n99,820 -> 450,469\n460,696 -> 942,696\n783,940 -> 487,644\n630,537 -> 48,537\n643,856 -> 643,396\n558,733 -> 257,432\n16,972 -> 570,418\n636,188 -> 636,610\n868,138 -> 868,407\n85,424 -> 85,919\n710,932 -> 354,576\n356,505 -> 783,505\n606,876 -> 606,62\n577,431 -> 749,431\n108,262 -> 108,145\n615,455 -> 264,104\n205,754 -> 866,754\n189,182 -> 855,848\n10,43 -> 925,958\n293,773 -> 293,534\n746,313 -> 802,369\n607,174 -> 211,570\n860,840 -> 260,240\n879,78 -> 595,78\n11,143 -> 449,143\n190,983 -> 267,983\n912,92 -> 76,928\n744,364 -> 744,258\n436,417 -> 46,807\n629,592 -> 517,592\n113,893 -> 113,959\n714,213 -> 786,285\n868,165 -> 868,731\n349,69 -> 491,69\n278,430 -> 111,263\n593,849 -> 593,203\n156,860 -> 876,860\n169,615 -> 169,984\n983,93 -> 139,937\n94,548 -> 18,548\n623,72 -> 106,589\n530,334 -> 473,334\n384,746 -> 925,205\n711,74 -> 28,757\n850,728 -> 629,949\n378,801 -> 228,651\n347,968 -> 201,822\n82,578 -> 82,555\n149,405 -> 707,963\n254,169 -> 793,169\n443,454 -> 331,454\n460,659 -> 608,807\n838,807 -> 31,807\n561,952 -> 290,952\n755,626 -> 204,75\n550,424 -> 550,81\n772,115 -> 772,600\n40,517 -> 40,232\n277,841 -> 317,841\n899,150 -> 128,921\n735,332 -> 465,332\n839,254 -> 915,330\n959,616 -> 182,616\n729,723 -> 487,965\n64,838 -> 953,838\n689,830 -> 689,982\n191,83 -> 191,879\n522,833 -> 942,833\n877,785 -> 877,346\n255,95 -> 556,95\n782,491 -> 475,798\n268,815 -> 812,271\n119,181 -> 905,181\n445,457 -> 742,160\n973,30 -> 27,976\n356,681 -> 356,289\n882,279 -> 914,279\n672,162 -> 672,153\n180,729 -> 357,729\n985,716 -> 985,313\n191,618 -> 191,963\n949,749 -> 636,749\n289,902 -> 142,902\n923,615 -> 123,615\n710,929 -> 541,760\n211,402 -> 211,433\n515,178 -> 533,178\n525,869 -> 525,578\n201,569 -> 17,569\n629,848 -> 882,848\n152,512 -> 152,189\n914,723 -> 764,723\n218,231 -> 721,734\n438,382 -> 846,382\n582,475 -> 582,559\n529,943 -> 529,683\n330,312 -> 59,312\n242,900 -> 862,900\n271,220 -> 271,118\n182,459 -> 182,673\n513,265 -> 513,420\n918,942 -> 378,942\n277,765 -> 812,230\n625,874 -> 219,874\n737,533 -> 644,626\n647,975 -> 152,480\n638,284 -> 785,284\n549,680 -> 549,877\n886,278 -> 372,792\n130,560 -> 516,174\n186,741 -> 186,555\n208,536 -> 469,536\n674,906 -> 312,906\n934,156 -> 934,322\n568,412 -> 214,412\n243,19 -> 243,814\n861,230 -> 104,987\n683,891 -> 683,533\n545,740 -> 545,980\n343,320 -> 796,320\n821,220 -> 821,302\n578,741 -> 578,141\n633,405 -> 27,405\n645,975 -> 225,555\n25,527 -> 412,527\n378,817 -> 378,913\n352,741 -> 352,293\n48,986 -> 925,109\n506,231 -> 491,231\n854,883 -> 48,77\n261,221 -> 895,855\n902,240 -> 902,943\n145,338 -> 770,963\n832,216 -> 832,869\n480,385 -> 324,385\n644,202 -> 433,202\n202,176 -> 190,176\n668,693 -> 668,349\n95,230 -> 143,230\n873,144 -> 67,950\n232,509 -> 238,509\n963,43 -> 133,873\n527,631 -> 641,517\n363,61 -> 849,61\n72,326 -> 72,861\n542,801 -> 233,492\n247,48 -> 247,785\n972,563 -> 480,71\n362,870 -> 932,300\n263,811 -> 263,584\n556,157 -> 417,157\n946,900 -> 175,129\n790,542 -> 530,542\n777,195 -> 154,818\n71,764 -> 71,193\n197,13 -> 453,13\n664,714 -> 158,714\n257,819 -> 257,730\n796,927 -> 688,927\n124,53 -> 954,883\n30,16 -> 980,966\n84,151 -> 597,151\n840,776 -> 684,776\n548,460 -> 718,630\n291,635 -> 291,151\n948,43 -> 58,933\n373,483 -> 373,591\n309,81 -> 259,81\n692,808 -> 692,835\n737,112 -> 215,634\n808,595 -> 808,115\n160,912 -> 973,99\n494,191 -> 494,475\n713,925 -> 43,255\n736,580 -> 290,134\n257,679 -> 725,211\n464,81 -> 712,81\n35,147 -> 35,420\n372,159 -> 372,548\n508,228 -> 682,402\n120,491 -> 518,889\n139,948 -> 272,815\n398,523 -> 398,818\n935,50 -> 40,945\n415,959 -> 195,739\n250,868 -> 250,930\n77,60 -> 917,900\n584,389 -> 493,298\n362,163 -> 362,704\n670,740 -> 670,703\n689,297 -> 689,388\n988,572 -> 988,340\n238,248 -> 238,916\n748,753 -> 29,34\n184,565 -> 184,486\n812,217 -> 812,34\n60,140 -> 96,104\n826,673 -> 230,673\n221,221 -> 207,235\n449,483 -> 270,304\n805,810 -> 805,564\n952,52 -> 139,865\n428,967 -> 312,851\n854,673 -> 661,673\n985,209 -> 853,209\n523,365 -> 54,365\n492,171 -> 646,171\n908,853 -> 69,14\n38,698 -> 724,12\n400,479 -> 167,479\n948,313 -> 948,976\n280,145 -> 37,145\n206,858 -> 683,381\n203,413 -> 545,413\n726,173 -> 673,173\n30,954 -> 150,954\n319,592 -> 870,41\n808,91 -> 180,719\n845,612 -> 972,485\n160,430 -> 160,780\n19,339 -> 379,339\n476,550 -> 476,291\n341,785 -> 229,673\n371,476 -> 371,663\n509,836 -> 412,933\n980,20 -> 31,969\n822,526 -> 328,32\n859,314 -> 425,314\n963,961 -> 963,100\n984,978 -> 31,25\n659,251 -> 619,211\n649,477 -> 846,477\n32,259 -> 724,951\n468,753 -> 468,91\n690,301 -> 690,652\n436,912 -> 845,503\n32,123 -> 576,667\n142,79 -> 741,678\n610,228 -> 468,370\n172,667 -> 172,736\n961,700 -> 132,700\n804,875 -> 804,213\n71,970 -> 340,970\n171,52 -> 149,30\n754,604 -> 226,604\n485,941 -> 27,941\n126,383 -> 328,181\n41,39 -> 987,985\n128,62 -> 896,830\n414,278 -> 923,787\n712,15 -> 712,859\n794,35 -> 200,629\n516,147 -> 402,261\n526,862 -> 905,862\n721,407 -> 721,887\n728,920 -> 339,920\n117,417 -> 203,417\n291,561 -> 17,835\n171,359 -> 837,359\n93,125 -> 136,125\n220,226 -> 220,177\n75,434 -> 75,407\n235,664 -> 141,664\n553,490 -> 566,477\n487,651 -> 487,877\n699,150 -> 933,384\n73,556 -> 453,556\n363,371 -> 363,984\n905,106 -> 668,106\n139,271 -> 139,125\n466,379 -> 466,420\n12,935 -> 625,935\n89,892 -> 779,892\n119,701 -> 270,852\n354,886 -> 80,886\n917,376 -> 440,376\n23,182 -> 794,953\n451,718 -> 121,718\n62,251 -> 62,451\n642,74 -> 642,698\n425,200 -> 442,200\n828,175 -> 828,405\n751,743 -> 591,743\n569,681 -> 574,681\n329,187 -> 329,837\n302,592 -> 302,230\n359,135 -> 386,108\n44,234 -> 44,731\n836,305 -> 836,574\n170,512 -> 367,512\n576,699 -> 576,44\n398,185 -> 821,185\n733,78 -> 733,747\n141,183 -> 141,787\n65,360 -> 65,691\n828,780 -> 828,98\n776,744 -> 776,751\n881,74 -> 481,474\n438,642 -> 438,399\n676,972 -> 175,972\n60,318 -> 56,314\n312,169 -> 341,169\n736,472 -> 392,128\n225,281 -> 164,281\n407,799 -> 341,799\n458,826 -> 983,301\n12,988 -> 987,13\n23,854 -> 662,215\n82,863 -> 82,416\n542,708 -> 542,44\n659,51 -> 520,51\n353,246 -> 353,90\n985,976 -> 77,68\n628,493 -> 628,510\n51,48 -> 635,48\n97,814 -> 828,83\n14,44 -> 773,44\n603,178 -> 597,178\n11,220 -> 783,220\n613,39 -> 613,719\n68,303 -> 690,925\n121,974 -> 896,199\n343,54 -> 343,837\n744,303 -> 744,942\n678,370 -> 246,370\n937,134 -> 84,987\n357,333 -> 357,516\n848,212 -> 429,631\n909,244 -> 138,244\n122,794 -> 786,130\n274,611 -> 57,611\n66,337 -> 385,18\n847,356 -> 831,356\n740,480 -> 740,359\n194,443 -> 194,301\n50,564 -> 572,42\n86,587 -> 774,587\n708,258 -> 49,917\n420,530 -> 277,387\n509,580 -> 509,71\n237,196 -> 479,196\n442,287 -> 850,287\n830,393 -> 532,393\n274,720 -> 501,493\n610,565 -> 218,957\n380,393 -> 380,800\n237,847 -> 155,847\n267,791 -> 52,791\n275,772 -> 275,794\n239,238 -> 419,418\n200,785 -> 884,101\n185,980 -> 185,284\n47,46 -> 750,749\n724,661 -> 724,337\n630,349 -> 666,349\n21,911 -> 21,569\n661,562 -> 661,925\n41,898 -> 41,104\n988,67 -> 105,67\n739,65 -> 868,65\n187,973 -> 809,973\n730,211 -> 255,686\n254,445 -> 254,872\n622,364 -> 235,751\n402,980 -> 761,621\n46,488 -> 960,488\n799,708 -> 799,862\n909,181 -> 909,189\n450,266 -> 450,304\n631,584 -> 631,455\n164,830 -> 744,250\n679,755 -> 690,744\n949,26 -> 190,785\n695,783 -> 218,783\n269,151 -> 40,151\n166,152 -> 22,152\n281,819 -> 922,178\n956,649 -> 956,593' vents2 = '0,9 -> 5,9\n8,0 -> 0,8\n9,4 -> 3,4\n2,2 -> 2,1\n7,0 -> 7,4\n6,4 -> 2,0\n0,9 -> 2,9\n3,4 -> 1,4\n0,0 -> 8,8\n5,5 -> 8,2' size = 1000 map = [[0 for x in range(size)] for y in range(size)] for vent in vents.splitlines(): line = vent.split(' -> ') (x1, y1) = [int(digit) for digit in line[0].split(',')] (x2, y2) = [int(digit) for digit in line[1].split(',')] if x1 == x2: y_min = min(y1, y2) y_max = max(y1, y2) for y in range(y_min, y_max + 1): map[y][x1] += 1 elif y1 == y2: x_min = min(x1, x2) x_max = max(x1, x2) for x in range(x_min, x_max + 1): map[y1][x] += 1 else: dx = 1 if x2 > x1 else -1 dy = 1 if y2 > y1 else -1 range_x = range(x1, x2 + dx, dx) range_y = range(y1, y2 + dy, dy) for (y, x) in zip(range_y, range_x): map[y][x] += 1 overlap = 0 for row in map: for cell in row: if cell > 1: overlap += 1 print('\n'.join([','.join([str(digit) for digit in line]) for line in map])) print(overlap)
# Bot's version number __version__ = "0.1.0" # Authorized guild GUILD_ID = 952941520867196958
__version__ = '0.1.0' guild_id = 952941520867196958
#Rep of loops numbers = [2, 3, 4, 45] l = len(numbers) for i in range(l): print(numbers[i]) # each iteration the i takes on a different #value according to len of numbers (4) for i in range(8): print(i) # prints numbers 0 through 7 for el in numbers: print(el) # using a loop to change elements within a list items = ['yellow', 'red', 'green', 'purple', 'blue'] #list of colours for i in range(5): print('Before item ', i , 'is', items[i]) items[i] = 'different' print('After item ', i , 'is', items[i]) items = ['yellow', 'red', 'green', 'purple', 'blue'] #list of colours for index_of_enumerate, colors in enumerate(items): print(index_of_enumerate, colors) # while: months = ['june', 'august', 'july', 'may'] i = 0 month = 'a' while month != 'august': month = months[i] print(month) i += 1 # Write your code below and press Shift+Enter to execute # Write a while loop to display the values of the Rating of an album playlist stored in the list PlayListRatings. If the score is less than 6, exit the loop. The list PlayListRatings is given by: PlayListRatings = [10, 9.5, 10, 8, 7.5, 5, 10, 10] PlayListRatings = [10, 9.5, 10, 8, 7.5, 5, 10, 10] i = 0 score = PlayListRatings[i] #print(score) while score >= 6: score = PlayListRatings[i] print(score) i += 1
numbers = [2, 3, 4, 45] l = len(numbers) for i in range(l): print(numbers[i]) for i in range(8): print(i) for el in numbers: print(el) items = ['yellow', 'red', 'green', 'purple', 'blue'] for i in range(5): print('Before item ', i, 'is', items[i]) items[i] = 'different' print('After item ', i, 'is', items[i]) items = ['yellow', 'red', 'green', 'purple', 'blue'] for (index_of_enumerate, colors) in enumerate(items): print(index_of_enumerate, colors) months = ['june', 'august', 'july', 'may'] i = 0 month = 'a' while month != 'august': month = months[i] print(month) i += 1 play_list_ratings = [10, 9.5, 10, 8, 7.5, 5, 10, 10] i = 0 score = PlayListRatings[i] while score >= 6: score = PlayListRatings[i] print(score) i += 1
""" cheesyutils - A number of utility packages and functions """ __title__ = "cheesyutils" __author__ = "CheesyGamer77" __copyright__ = "Copyright 2021-present CheesyGamer77" __version__ = "0.0.30"
""" cheesyutils - A number of utility packages and functions """ __title__ = 'cheesyutils' __author__ = 'CheesyGamer77' __copyright__ = 'Copyright 2021-present CheesyGamer77' __version__ = '0.0.30'
def append_text(new_text): ''' Write the code instruction to be exported later on Args. new_text (str): the text that will be appended to the base string ''' global code_base_text code_base_text = code_base_text + new_text
def append_text(new_text): """ Write the code instruction to be exported later on Args. new_text (str): the text that will be appended to the base string """ global code_base_text code_base_text = code_base_text + new_text
""" Given an unsorted array of integers, find the length of the longest consecutive elements sequence. Your algorithm should run in O(n) complexity. Example: Input: [100, 4, 200, 1, 3, 2] Output: 4 Explanation: The longest consecutive elements sequence is [1, 2, 3, 4]. Therefore its length is 4. Solution: 1. Sort 2. Hashset """ # Sort # TLE: while loop too slow # Time: O(NlogN) # Space: O(1) class Solution(object): def longestConsecutive(self, nums): """ :type nums: List[int] :rtype: int """ l = len(nums) if l == 0: return 0 nums.sort() max_len = 0 for i in range(l): cur_len = 1 j = i + 1 while j < l: if nums[j] == nums[j-1] + 1: cur_len += 1 j += 1 elif nums[j] == nums[j-1]: j += 1 else: break if cur_len > max_len: max_len = cur_len i = j return max_len # Sort # Time: O(NlogN) # Space: O(1) class Solution(object): def longestConsecutive(self, nums): """ :type nums: List[int] :rtype: int """ l = len(nums) if l == 0: return 0 nums.sort() max_len = 0 cur_len = 1 for i in range(1, l): if nums[i] != nums[i-1]: # jump duplicates if nums[i] == nums[i-1] + 1: cur_len += 1 else: max_len = max(max_len, cur_len) cur_len = 1 # in case of the last number is in the longest consecutive numbers max_len = max(max_len, cur_len) return max_len # Sort # Time: O(NlogN) # Space: O(1) class Solution(object): def longestConsecutive(self, nums): """ :type nums: List[int] :rtype: int """ l = len(nums) if l < 2 : return l res = 0 cur_len = 1 nums = list(set(nums)) nums.sort() for i in range(1, len(nums)) : if nums[i] == nums[i-1]+1 : cur_len += 1 else: res = max(res, cur_len) cur_len = 1 res = max(res, cur_len) return res # Set # Time: O(N), since we visit each number once # Space: O(1) class Solution(object): def longestConsecutive(self, nums): """ :type nums: List[int] :rtype: int """ # for each num I will check whether num-1 exists # if yes, then I ignore this num # Otherwise if num-1 doesn't exist, then I will go till I can find num+1 # so in a way I am only checking each number max once and once in set. s = set(nums) res = 0 for num in s: cur_len = 1 if num - 1 not in s: while num + 1 in s: cur_len += 1 num += 1 res = max(res, cur_len) return res
""" Given an unsorted array of integers, find the length of the longest consecutive elements sequence. Your algorithm should run in O(n) complexity. Example: Input: [100, 4, 200, 1, 3, 2] Output: 4 Explanation: The longest consecutive elements sequence is [1, 2, 3, 4]. Therefore its length is 4. Solution: 1. Sort 2. Hashset """ class Solution(object): def longest_consecutive(self, nums): """ :type nums: List[int] :rtype: int """ l = len(nums) if l == 0: return 0 nums.sort() max_len = 0 for i in range(l): cur_len = 1 j = i + 1 while j < l: if nums[j] == nums[j - 1] + 1: cur_len += 1 j += 1 elif nums[j] == nums[j - 1]: j += 1 else: break if cur_len > max_len: max_len = cur_len i = j return max_len class Solution(object): def longest_consecutive(self, nums): """ :type nums: List[int] :rtype: int """ l = len(nums) if l == 0: return 0 nums.sort() max_len = 0 cur_len = 1 for i in range(1, l): if nums[i] != nums[i - 1]: if nums[i] == nums[i - 1] + 1: cur_len += 1 else: max_len = max(max_len, cur_len) cur_len = 1 max_len = max(max_len, cur_len) return max_len class Solution(object): def longest_consecutive(self, nums): """ :type nums: List[int] :rtype: int """ l = len(nums) if l < 2: return l res = 0 cur_len = 1 nums = list(set(nums)) nums.sort() for i in range(1, len(nums)): if nums[i] == nums[i - 1] + 1: cur_len += 1 else: res = max(res, cur_len) cur_len = 1 res = max(res, cur_len) return res class Solution(object): def longest_consecutive(self, nums): """ :type nums: List[int] :rtype: int """ s = set(nums) res = 0 for num in s: cur_len = 1 if num - 1 not in s: while num + 1 in s: cur_len += 1 num += 1 res = max(res, cur_len) return res
SHORT_DESCRIPTION = "Sorter organises/sorts files using a customised search function to group those that have similar characteristics into a single folder. Similar characteristics include file type, file name or part of the name and file category. You can put all letters documents into one folder, all images with the word home into another, all music by one artist in yet another folder, etc." SOURCE_DESCRIPTION = "SOURCE (required)\nThis is the folder in which the sorting should be done i.e the folder containing the disorganised files." DESTINATION_DESCRIPTION = "DESTINATION (optional)\nAn optional destination (a folder) where the user would want the sorted files/folders to be moved to." RECURSIVE_DESCRIPTION = "LOOK INTO SUB-FOLDERS (optional)\nChecks into every child folder, starting from the source folder, and groups/sorts the files accordingly." TYPES_DESCRIPTION = "SELECT FILE TYPES (optional)\nSelect the specific file types/formats to be sorted." SEARCH_DESCRIPTION = "SEARCH FOR (optional)\nDirects Sorter to search and only group files with names containing this value. If this is enabled then, by default, Sort Folders option is enabled to enable the sorted files to be moved to a folder whose name will be the value provided here. The search is case-insensitive but the final folder will adopt the case styles." GROUP_FOLDER_DESCRIPTION = "GROUP INTO FOLDER (optional)\nMoves all files (and folders) fitting the search descriptions into a folder named by the value provided in this option." BY_EXTENSION_DESCRIPTION = "GROUP BY FILE TYPE (optional)\nGroups files in the destination and according to their file type. That is, all JPGs different from PDFs different from DOCXs." CLEANUP_DESCRIPTION = "PERFORM CLEANUP (optional)\nLooks into the child folders of the source folder and removes those which are empty." NOTE = "Note:\nIf you want a folder and its contents to be left as is (i.e. not to be sorted or affected in any way), just add a file named `.signore` (no extension) into the folder." HELP_MESSAGE = "How it Works \n" + SHORT_DESCRIPTION + "\n\nBelow is a description of the fields required to achieve results using Sorter:\n\n" + SOURCE_DESCRIPTION + "\n\n" + DESTINATION_DESCRIPTION + \ "\n\n" + SEARCH_DESCRIPTION + "\n\n" + RECURSIVE_DESCRIPTION + \ "\n\n" + TYPES_DESCRIPTION + "\n\n" + \ GROUP_FOLDER_DESCRIPTION + "\n\n" + BY_EXTENSION_DESCRIPTION + "\n\n" + CLEANUP_DESCRIPTION + \ "\n\n" + NOTE COPYRIGHT_MESSAGE = "Copyright \u00a9 2017\n\nAswa Paul\nAll rights reserved.\n\n" HOMEPAGE = "https://giantas.github.io/sorter" SOURCE_CODE = "https://github.com/giantas/sorter" LICENSE = """BSD 3-Clause License Copyright (c) 2017, Aswa Paul All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """
short_description = 'Sorter organises/sorts files using a customised search function to group those that have similar characteristics into a single folder. Similar characteristics include file type, file name or part of the name and file category. You can put all letters documents into one folder, all images with the word home into another, all music by one artist in yet another folder, etc.' source_description = 'SOURCE (required)\nThis is the folder in which the sorting should be done i.e the folder containing the disorganised files.' destination_description = 'DESTINATION (optional)\nAn optional destination (a folder) where the user would want the sorted files/folders to be moved to.' recursive_description = 'LOOK INTO SUB-FOLDERS (optional)\nChecks into every child folder, starting from the source folder, and groups/sorts the files accordingly.' types_description = 'SELECT FILE TYPES (optional)\nSelect the specific file types/formats to be sorted.' search_description = 'SEARCH FOR (optional)\nDirects Sorter to search and only group files with names containing this value. If this is enabled then, by default, Sort Folders option is enabled to enable the sorted files to be moved to a folder whose name will be the value provided here. The search is case-insensitive but the final folder will adopt the case styles.' group_folder_description = 'GROUP INTO FOLDER (optional)\nMoves all files (and folders) fitting the search descriptions into a folder named by the value provided in this option.' by_extension_description = 'GROUP BY FILE TYPE (optional)\nGroups files in the destination and according to their file type. That is, all JPGs different from PDFs different from DOCXs.' cleanup_description = 'PERFORM CLEANUP (optional)\nLooks into the child folders of the source folder and removes those which are empty.' note = 'Note:\nIf you want a folder and its contents to be left as is (i.e. not to be sorted or affected in any way), just add a file named `.signore` (no extension) into the folder.' help_message = 'How it Works \n' + SHORT_DESCRIPTION + '\n\nBelow is a description of the fields required to achieve results using Sorter:\n\n' + SOURCE_DESCRIPTION + '\n\n' + DESTINATION_DESCRIPTION + '\n\n' + SEARCH_DESCRIPTION + '\n\n' + RECURSIVE_DESCRIPTION + '\n\n' + TYPES_DESCRIPTION + '\n\n' + GROUP_FOLDER_DESCRIPTION + '\n\n' + BY_EXTENSION_DESCRIPTION + '\n\n' + CLEANUP_DESCRIPTION + '\n\n' + NOTE copyright_message = 'Copyright © 2017\n\nAswa Paul\nAll rights reserved.\n\n' homepage = 'https://giantas.github.io/sorter' source_code = 'https://github.com/giantas/sorter' license = 'BSD 3-Clause License\n\nCopyright (c) 2017, Aswa Paul\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n* Neither the name of the copyright holder nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n'
n=int(input ('veverite')) if n %2==0: print ('par') else: print ('impar') print('par' if n%2==0 else 'impar')
n = int(input('veverite')) if n % 2 == 0: print('par') else: print('impar') print('par' if n % 2 == 0 else 'impar')
# pylint: disable=missing-class-docstring, disable=missing-function-docstring, missing-module-docstring/ #$ header class Point(public) #$ header method __init__(Point, double, double) #$ header method __del__(Point) #$ header method translate(Point, double, double) class Point(object): def __init__(self, x, y): self.x = x self.y = y def __del__(self): pass def translate(self, a, b): self.x = self.x + a self.y = self.y + b if __name__ == '__main__': p = Point(0.0, 0.0) x=p.x p.x=x a = p.x a = p.x - 2 a = 2 * p.x - 2 a = 2 * (p.x + 6) - 2 p.y = a + 5 p.y = p.x + 5 p.translate(1.0, 2.0) print(p.x, p.y) print(a) del p
class Point(object): def __init__(self, x, y): self.x = x self.y = y def __del__(self): pass def translate(self, a, b): self.x = self.x + a self.y = self.y + b if __name__ == '__main__': p = point(0.0, 0.0) x = p.x p.x = x a = p.x a = p.x - 2 a = 2 * p.x - 2 a = 2 * (p.x + 6) - 2 p.y = a + 5 p.y = p.x + 5 p.translate(1.0, 2.0) print(p.x, p.y) print(a) del p
# parsetab.py # This file is automatically generated. Do not edit. # pylint: disable=W,C,R _tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'leftPLUSMINUSleftTIMESDIVIDEleftPOWERrightUMINUSCOMMA DATA DEF DIM DIVIDE END EQUALS FLOAT FOR GE GOSUB GOTO GT ID IF INTEGER LE LET LIST LPAREN LT MINUS NE NEW NEWLINE NEXT PLUS POWER PRINT READ REM RETURN RPAREN RUN SEMI STEP STOP STRING THEN TIMES TOprogram : program statement\n | statementprogram : errorstatement : INTEGER command NEWLINEstatement : RUN NEWLINE\n | LIST NEWLINE\n | NEW NEWLINEstatement : INTEGER NEWLINEstatement : INTEGER error NEWLINEstatement : NEWLINEcommand : LET variable EQUALS exprcommand : LET variable EQUALS errorcommand : READ varlistcommand : READ errorcommand : DATA numlistcommand : DATA errorcommand : PRINT plist optendcommand : PRINT erroroptend : COMMA \n | SEMI\n |command : PRINTcommand : GOTO INTEGERcommand : GOTO errorcommand : IF relexpr THEN INTEGERcommand : IF error THEN INTEGERcommand : IF relexpr THEN errorcommand : FOR ID EQUALS expr TO expr optstepcommand : FOR ID EQUALS error TO expr optstepcommand : FOR ID EQUALS expr TO error optstepcommand : FOR ID EQUALS expr TO expr STEP erroroptstep : STEP expr\n | emptycommand : NEXT IDcommand : NEXT errorcommand : ENDcommand : REMcommand : STOPcommand : DEF ID LPAREN ID RPAREN EQUALS exprcommand : DEF ID LPAREN ID RPAREN EQUALS errorcommand : DEF ID LPAREN error RPAREN EQUALS exprcommand : GOSUB INTEGERcommand : GOSUB errorcommand : RETURNcommand : DIM dimlistcommand : DIM errordimlist : dimlist COMMA dimitem\n | dimitemdimitem : ID LPAREN INTEGER RPARENdimitem : ID LPAREN INTEGER COMMA INTEGER RPARENexpr : expr PLUS expr\n | expr MINUS expr\n | expr TIMES expr\n | expr DIVIDE expr\n | expr POWER exprexpr : INTEGER\n | FLOATexpr : variableexpr : LPAREN expr RPARENexpr : MINUS expr %prec UMINUSrelexpr : expr LT expr\n | expr LE expr\n | expr GT expr\n | expr GE expr\n | expr EQUALS expr\n | expr NE exprvariable : ID\n | ID LPAREN expr RPAREN\n | ID LPAREN expr COMMA expr RPARENvarlist : varlist COMMA variable\n | variablenumlist : numlist COMMA number\n | numbernumber : INTEGER\n | FLOATnumber : MINUS INTEGER\n | MINUS FLOATplist : plist COMMA pitem\n | pitempitem : STRINGpitem : STRING exprpitem : exprempty : ' _lr_action_items = {'error':([0,4,14,15,16,17,18,20,25,27,69,86,94,95,127,137,142,],[3,12,36,39,45,55,57,61,64,66,99,111,120,122,135,148,152,]),'INTEGER':([0,1,2,3,5,9,11,15,16,17,18,25,28,29,30,31,32,43,47,49,53,69,70,72,76,79,80,81,82,83,86,87,88,89,90,91,92,93,94,97,126,127,128,132,137,138,142,145,],[4,4,-2,-3,-10,-1,-8,41,50,54,50,63,-5,-6,-7,-4,-9,73,50,50,50,50,50,41,50,50,50,50,50,50,110,112,50,50,50,50,50,50,50,124,50,50,50,139,50,50,50,50,]),'RUN':([0,1,2,3,5,9,11,28,29,30,31,32,],[6,6,-2,-3,-10,-1,-8,-5,-6,-7,-4,-9,]),'LIST':([0,1,2,3,5,9,11,28,29,30,31,32,],[7,7,-2,-3,-10,-1,-8,-5,-6,-7,-4,-9,]),'NEW':([0,1,2,3,5,9,11,28,29,30,31,32,],[8,8,-2,-3,-10,-1,-8,-5,-6,-7,-4,-9,]),'NEWLINE':([0,1,2,3,4,5,6,7,8,9,10,11,12,16,21,22,23,26,28,29,30,31,32,34,35,36,37,38,39,40,41,42,44,45,46,47,48,50,51,52,54,55,60,61,63,64,65,66,67,73,74,75,76,77,78,84,98,99,101,102,103,104,105,106,107,108,109,110,111,112,123,125,131,134,135,136,140,141,143,144,146,147,148,149,150,151,152,],[5,5,-2,-3,11,-10,28,29,30,-1,31,-8,32,-22,-36,-37,-38,-44,-5,-6,-7,-4,-9,-67,-13,-14,-71,-15,-16,-73,-74,-75,-21,-18,-79,-80,-82,-56,-57,-58,-23,-24,-34,-35,-42,-43,-45,-46,-48,-76,-77,-17,-19,-20,-81,-60,-11,-12,-70,-72,-78,-51,-52,-53,-54,-55,-59,-25,-27,-26,-47,-68,-49,-83,-83,-83,-69,-28,-33,-30,-29,-39,-40,-41,-50,-32,-31,]),'$end':([1,2,3,5,9,11,28,29,30,31,32,],[0,-2,-3,-10,-1,-8,-5,-6,-7,-4,-9,]),'LET':([4,],[13,]),'READ':([4,],[14,]),'DATA':([4,],[15,]),'PRINT':([4,],[16,]),'GOTO':([4,],[17,]),'IF':([4,],[18,]),'FOR':([4,],[19,]),'NEXT':([4,],[20,]),'END':([4,],[21,]),'REM':([4,],[22,]),'STOP':([4,],[23,]),'DEF':([4,],[24,]),'GOSUB':([4,],[25,]),'RETURN':([4,],[26,]),'DIM':([4,],[27,]),'ID':([13,14,16,18,19,20,24,27,47,49,53,69,70,71,76,79,80,81,82,83,88,89,90,91,92,93,94,95,96,126,127,128,137,138,142,145,],[34,34,34,34,59,60,62,68,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,121,68,34,34,34,34,34,34,34,]),'FLOAT':([15,16,18,43,47,49,53,69,70,72,76,79,80,81,82,83,88,89,90,91,92,93,94,126,127,128,137,138,142,145,],[42,51,51,74,51,51,51,51,51,42,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,]),'MINUS':([15,16,18,34,47,48,49,50,51,52,53,58,69,70,72,76,78,79,80,81,82,83,84,85,88,89,90,91,92,93,94,98,100,104,105,106,107,108,109,113,114,115,116,117,118,119,125,126,127,128,133,134,136,137,138,140,142,145,147,149,151,],[43,49,49,-67,49,80,49,-56,-57,-58,49,80,49,49,43,49,80,49,49,49,49,49,-60,80,49,49,49,49,49,49,49,80,80,-51,-52,-53,-54,-55,-59,80,80,80,80,80,80,80,-68,49,49,49,80,80,80,49,49,-69,49,49,80,80,80,]),'STRING':([16,76,],[47,47,]),'LPAREN':([16,18,34,47,49,53,62,68,69,70,76,79,80,81,82,83,88,89,90,91,92,93,94,126,127,128,137,138,142,145,],[53,53,70,53,53,53,95,97,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,]),'EQUALS':([33,34,50,51,52,58,59,84,104,105,106,107,108,109,125,129,130,140,],[69,-67,-56,-57,-58,92,94,-60,-51,-52,-53,-54,-55,-59,-68,137,138,-69,]),'COMMA':([34,35,37,38,40,41,42,44,46,47,48,50,51,52,65,67,73,74,78,84,100,101,102,103,104,105,106,107,108,109,123,124,125,131,140,150,],[-67,71,-71,72,-73,-74,-75,76,-79,-80,-82,-56,-57,-58,96,-48,-76,-77,-81,-60,126,-70,-72,-78,-51,-52,-53,-54,-55,-59,-47,132,-68,-49,-69,-50,]),'PLUS':([34,48,50,51,52,58,78,84,85,98,100,104,105,106,107,108,109,113,114,115,116,117,118,119,125,133,134,136,140,147,149,151,],[-67,79,-56,-57,-58,79,79,-60,79,79,79,-51,-52,-53,-54,-55,-59,79,79,79,79,79,79,79,-68,79,79,79,-69,79,79,79,]),'TIMES':([34,48,50,51,52,58,78,84,85,98,100,104,105,106,107,108,109,113,114,115,116,117,118,119,125,133,134,136,140,147,149,151,],[-67,81,-56,-57,-58,81,81,-60,81,81,81,81,81,-53,-54,-55,-59,81,81,81,81,81,81,81,-68,81,81,81,-69,81,81,81,]),'DIVIDE':([34,48,50,51,52,58,78,84,85,98,100,104,105,106,107,108,109,113,114,115,116,117,118,119,125,133,134,136,140,147,149,151,],[-67,82,-56,-57,-58,82,82,-60,82,82,82,82,82,-53,-54,-55,-59,82,82,82,82,82,82,82,-68,82,82,82,-69,82,82,82,]),'POWER':([34,48,50,51,52,58,78,84,85,98,100,104,105,106,107,108,109,113,114,115,116,117,118,119,125,133,134,136,140,147,149,151,],[-67,83,-56,-57,-58,83,83,-60,83,83,83,83,83,83,83,-55,-59,83,83,83,83,83,83,83,-68,83,83,83,-69,83,83,83,]),'SEMI':([34,44,46,47,48,50,51,52,78,84,103,104,105,106,107,108,109,125,140,],[-67,77,-79,-80,-82,-56,-57,-58,-81,-60,-78,-51,-52,-53,-54,-55,-59,-68,-69,]),'LT':([34,50,51,52,58,84,104,105,106,107,108,109,125,140,],[-67,-56,-57,-58,88,-60,-51,-52,-53,-54,-55,-59,-68,-69,]),'LE':([34,50,51,52,58,84,104,105,106,107,108,109,125,140,],[-67,-56,-57,-58,89,-60,-51,-52,-53,-54,-55,-59,-68,-69,]),'GT':([34,50,51,52,58,84,104,105,106,107,108,109,125,140,],[-67,-56,-57,-58,90,-60,-51,-52,-53,-54,-55,-59,-68,-69,]),'GE':([34,50,51,52,58,84,104,105,106,107,108,109,125,140,],[-67,-56,-57,-58,91,-60,-51,-52,-53,-54,-55,-59,-68,-69,]),'NE':([34,50,51,52,58,84,104,105,106,107,108,109,125,140,],[-67,-56,-57,-58,93,-60,-51,-52,-53,-54,-55,-59,-68,-69,]),'RPAREN':([34,50,51,52,84,85,100,104,105,106,107,108,109,121,122,124,125,133,139,140,],[-67,-56,-57,-58,-60,109,125,-51,-52,-53,-54,-55,-59,129,130,131,-68,140,150,-69,]),'THEN':([34,50,51,52,56,57,84,104,105,106,107,108,109,113,114,115,116,117,118,125,140,],[-67,-56,-57,-58,86,87,-60,-51,-52,-53,-54,-55,-59,-61,-62,-63,-64,-65,-66,-68,-69,]),'TO':([34,50,51,52,84,104,105,106,107,108,109,119,120,125,140,],[-67,-56,-57,-58,-60,-51,-52,-53,-54,-55,-59,127,128,-68,-69,]),'STEP':([34,50,51,52,84,104,105,106,107,108,109,125,134,135,136,140,],[-67,-56,-57,-58,-60,-51,-52,-53,-54,-55,-59,-68,142,145,145,-69,]),} _lr_action = {} for _k, _v in _lr_action_items.items(): for _x,_y in zip(_v[0],_v[1]): if not _x in _lr_action: _lr_action[_x] = {} _lr_action[_x][_k] = _y del _lr_action_items _lr_goto_items = {'program':([0,],[1,]),'statement':([0,1,],[2,9,]),'command':([4,],[10,]),'variable':([13,14,16,18,47,49,53,69,70,71,76,79,80,81,82,83,88,89,90,91,92,93,94,126,127,128,137,138,142,145,],[33,37,52,52,52,52,52,52,52,101,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,]),'varlist':([14,],[35,]),'numlist':([15,],[38,]),'number':([15,72,],[40,102,]),'plist':([16,],[44,]),'pitem':([16,76,],[46,103,]),'expr':([16,18,47,49,53,69,70,76,79,80,81,82,83,88,89,90,91,92,93,94,126,127,128,137,138,142,145,],[48,58,78,84,85,98,100,48,104,105,106,107,108,113,114,115,116,117,118,119,133,134,136,147,149,151,151,]),'relexpr':([18,],[56,]),'dimlist':([27,],[65,]),'dimitem':([27,96,],[67,123,]),'optend':([44,],[75,]),'optstep':([134,135,136,],[141,144,146,]),'empty':([134,135,136,],[143,143,143,]),} _lr_goto = {} for _k, _v in _lr_goto_items.items(): for _x, _y in zip(_v[0], _v[1]): if not _x in _lr_goto: _lr_goto[_x] = {} _lr_goto[_x][_k] = _y del _lr_goto_items _lr_productions = [ ("S' -> program","S'",1,None,None,None), ('program -> program statement','program',2,'p_program','basparse.py',21), ('program -> statement','program',1,'p_program','basparse.py',22), ('program -> error','program',1,'p_program_error','basparse.py',41), ('statement -> INTEGER command NEWLINE','statement',3,'p_statement','basparse.py',49), ('statement -> RUN NEWLINE','statement',2,'p_statement_interactive','basparse.py',62), ('statement -> LIST NEWLINE','statement',2,'p_statement_interactive','basparse.py',63), ('statement -> NEW NEWLINE','statement',2,'p_statement_interactive','basparse.py',64), ('statement -> INTEGER NEWLINE','statement',2,'p_statement_blank','basparse.py',71), ('statement -> INTEGER error NEWLINE','statement',3,'p_statement_bad','basparse.py',78), ('statement -> NEWLINE','statement',1,'p_statement_newline','basparse.py',87), ('command -> LET variable EQUALS expr','command',4,'p_command_let','basparse.py',94), ('command -> LET variable EQUALS error','command',4,'p_command_let_bad','basparse.py',99), ('command -> READ varlist','command',2,'p_command_read','basparse.py',106), ('command -> READ error','command',2,'p_command_read_bad','basparse.py',111), ('command -> DATA numlist','command',2,'p_command_data','basparse.py',118), ('command -> DATA error','command',2,'p_command_data_bad','basparse.py',123), ('command -> PRINT plist optend','command',3,'p_command_print','basparse.py',130), ('command -> PRINT error','command',2,'p_command_print_bad','basparse.py',135), ('optend -> COMMA','optend',1,'p_optend','basparse.py',142), ('optend -> SEMI','optend',1,'p_optend','basparse.py',143), ('optend -> <empty>','optend',0,'p_optend','basparse.py',144), ('command -> PRINT','command',1,'p_command_print_empty','basparse.py',154), ('command -> GOTO INTEGER','command',2,'p_command_goto','basparse.py',161), ('command -> GOTO error','command',2,'p_command_goto_bad','basparse.py',166), ('command -> IF relexpr THEN INTEGER','command',4,'p_command_if','basparse.py',173), ('command -> IF error THEN INTEGER','command',4,'p_command_if_bad','basparse.py',178), ('command -> IF relexpr THEN error','command',4,'p_command_if_bad2','basparse.py',183), ('command -> FOR ID EQUALS expr TO expr optstep','command',7,'p_command_for','basparse.py',190), ('command -> FOR ID EQUALS error TO expr optstep','command',7,'p_command_for_bad_initial','basparse.py',195), ('command -> FOR ID EQUALS expr TO error optstep','command',7,'p_command_for_bad_final','basparse.py',200), ('command -> FOR ID EQUALS expr TO expr STEP error','command',8,'p_command_for_bad_step','basparse.py',205), ('optstep -> STEP expr','optstep',2,'p_optstep','basparse.py',212), ('optstep -> empty','optstep',1,'p_optstep','basparse.py',213), ('command -> NEXT ID','command',2,'p_command_next','basparse.py',223), ('command -> NEXT error','command',2,'p_command_next_bad','basparse.py',229), ('command -> END','command',1,'p_command_end','basparse.py',236), ('command -> REM','command',1,'p_command_rem','basparse.py',243), ('command -> STOP','command',1,'p_command_stop','basparse.py',250), ('command -> DEF ID LPAREN ID RPAREN EQUALS expr','command',7,'p_command_def','basparse.py',257), ('command -> DEF ID LPAREN ID RPAREN EQUALS error','command',7,'p_command_def_bad_rhs','basparse.py',262), ('command -> DEF ID LPAREN error RPAREN EQUALS expr','command',7,'p_command_def_bad_arg','basparse.py',267), ('command -> GOSUB INTEGER','command',2,'p_command_gosub','basparse.py',274), ('command -> GOSUB error','command',2,'p_command_gosub_bad','basparse.py',279), ('command -> RETURN','command',1,'p_command_return','basparse.py',286), ('command -> DIM dimlist','command',2,'p_command_dim','basparse.py',293), ('command -> DIM error','command',2,'p_command_dim_bad','basparse.py',298), ('dimlist -> dimlist COMMA dimitem','dimlist',3,'p_dimlist','basparse.py',305), ('dimlist -> dimitem','dimlist',1,'p_dimlist','basparse.py',306), ('dimitem -> ID LPAREN INTEGER RPAREN','dimitem',4,'p_dimitem_single','basparse.py',317), ('dimitem -> ID LPAREN INTEGER COMMA INTEGER RPAREN','dimitem',6,'p_dimitem_double','basparse.py',322), ('expr -> expr PLUS expr','expr',3,'p_expr_binary','basparse.py',329), ('expr -> expr MINUS expr','expr',3,'p_expr_binary','basparse.py',330), ('expr -> expr TIMES expr','expr',3,'p_expr_binary','basparse.py',331), ('expr -> expr DIVIDE expr','expr',3,'p_expr_binary','basparse.py',332), ('expr -> expr POWER expr','expr',3,'p_expr_binary','basparse.py',333), ('expr -> INTEGER','expr',1,'p_expr_number','basparse.py',339), ('expr -> FLOAT','expr',1,'p_expr_number','basparse.py',340), ('expr -> variable','expr',1,'p_expr_variable','basparse.py',345), ('expr -> LPAREN expr RPAREN','expr',3,'p_expr_group','basparse.py',350), ('expr -> MINUS expr','expr',2,'p_expr_unary','basparse.py',355), ('relexpr -> expr LT expr','relexpr',3,'p_relexpr','basparse.py',362), ('relexpr -> expr LE expr','relexpr',3,'p_relexpr','basparse.py',363), ('relexpr -> expr GT expr','relexpr',3,'p_relexpr','basparse.py',364), ('relexpr -> expr GE expr','relexpr',3,'p_relexpr','basparse.py',365), ('relexpr -> expr EQUALS expr','relexpr',3,'p_relexpr','basparse.py',366), ('relexpr -> expr NE expr','relexpr',3,'p_relexpr','basparse.py',367), ('variable -> ID','variable',1,'p_variable','basparse.py',374), ('variable -> ID LPAREN expr RPAREN','variable',4,'p_variable','basparse.py',375), ('variable -> ID LPAREN expr COMMA expr RPAREN','variable',6,'p_variable','basparse.py',376), ('varlist -> varlist COMMA variable','varlist',3,'p_varlist','basparse.py',388), ('varlist -> variable','varlist',1,'p_varlist','basparse.py',389), ('numlist -> numlist COMMA number','numlist',3,'p_numlist','basparse.py',400), ('numlist -> number','numlist',1,'p_numlist','basparse.py',401), ('number -> INTEGER','number',1,'p_number','basparse.py',413), ('number -> FLOAT','number',1,'p_number','basparse.py',414), ('number -> MINUS INTEGER','number',2,'p_number_signed','basparse.py',421), ('number -> MINUS FLOAT','number',2,'p_number_signed','basparse.py',422), ('plist -> plist COMMA pitem','plist',3,'p_plist','basparse.py',430), ('plist -> pitem','plist',1,'p_plist','basparse.py',431), ('pitem -> STRING','pitem',1,'p_item_string','basparse.py',440), ('pitem -> STRING expr','pitem',2,'p_item_string_expr','basparse.py',445), ('pitem -> expr','pitem',1,'p_item_expr','basparse.py',450), ('empty -> <empty>','empty',0,'p_empty','basparse.py',457), ]
_tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'leftPLUSMINUSleftTIMESDIVIDEleftPOWERrightUMINUSCOMMA DATA DEF DIM DIVIDE END EQUALS FLOAT FOR GE GOSUB GOTO GT ID IF INTEGER LE LET LIST LPAREN LT MINUS NE NEW NEWLINE NEXT PLUS POWER PRINT READ REM RETURN RPAREN RUN SEMI STEP STOP STRING THEN TIMES TOprogram : program statement\n | statementprogram : errorstatement : INTEGER command NEWLINEstatement : RUN NEWLINE\n | LIST NEWLINE\n | NEW NEWLINEstatement : INTEGER NEWLINEstatement : INTEGER error NEWLINEstatement : NEWLINEcommand : LET variable EQUALS exprcommand : LET variable EQUALS errorcommand : READ varlistcommand : READ errorcommand : DATA numlistcommand : DATA errorcommand : PRINT plist optendcommand : PRINT erroroptend : COMMA \n | SEMI\n |command : PRINTcommand : GOTO INTEGERcommand : GOTO errorcommand : IF relexpr THEN INTEGERcommand : IF error THEN INTEGERcommand : IF relexpr THEN errorcommand : FOR ID EQUALS expr TO expr optstepcommand : FOR ID EQUALS error TO expr optstepcommand : FOR ID EQUALS expr TO error optstepcommand : FOR ID EQUALS expr TO expr STEP erroroptstep : STEP expr\n | emptycommand : NEXT IDcommand : NEXT errorcommand : ENDcommand : REMcommand : STOPcommand : DEF ID LPAREN ID RPAREN EQUALS exprcommand : DEF ID LPAREN ID RPAREN EQUALS errorcommand : DEF ID LPAREN error RPAREN EQUALS exprcommand : GOSUB INTEGERcommand : GOSUB errorcommand : RETURNcommand : DIM dimlistcommand : DIM errordimlist : dimlist COMMA dimitem\n | dimitemdimitem : ID LPAREN INTEGER RPARENdimitem : ID LPAREN INTEGER COMMA INTEGER RPARENexpr : expr PLUS expr\n | expr MINUS expr\n | expr TIMES expr\n | expr DIVIDE expr\n | expr POWER exprexpr : INTEGER\n | FLOATexpr : variableexpr : LPAREN expr RPARENexpr : MINUS expr %prec UMINUSrelexpr : expr LT expr\n | expr LE expr\n | expr GT expr\n | expr GE expr\n | expr EQUALS expr\n | expr NE exprvariable : ID\n | ID LPAREN expr RPAREN\n | ID LPAREN expr COMMA expr RPARENvarlist : varlist COMMA variable\n | variablenumlist : numlist COMMA number\n | numbernumber : INTEGER\n | FLOATnumber : MINUS INTEGER\n | MINUS FLOATplist : plist COMMA pitem\n | pitempitem : STRINGpitem : STRING exprpitem : exprempty : ' _lr_action_items = {'error': ([0, 4, 14, 15, 16, 17, 18, 20, 25, 27, 69, 86, 94, 95, 127, 137, 142], [3, 12, 36, 39, 45, 55, 57, 61, 64, 66, 99, 111, 120, 122, 135, 148, 152]), 'INTEGER': ([0, 1, 2, 3, 5, 9, 11, 15, 16, 17, 18, 25, 28, 29, 30, 31, 32, 43, 47, 49, 53, 69, 70, 72, 76, 79, 80, 81, 82, 83, 86, 87, 88, 89, 90, 91, 92, 93, 94, 97, 126, 127, 128, 132, 137, 138, 142, 145], [4, 4, -2, -3, -10, -1, -8, 41, 50, 54, 50, 63, -5, -6, -7, -4, -9, 73, 50, 50, 50, 50, 50, 41, 50, 50, 50, 50, 50, 50, 110, 112, 50, 50, 50, 50, 50, 50, 50, 124, 50, 50, 50, 139, 50, 50, 50, 50]), 'RUN': ([0, 1, 2, 3, 5, 9, 11, 28, 29, 30, 31, 32], [6, 6, -2, -3, -10, -1, -8, -5, -6, -7, -4, -9]), 'LIST': ([0, 1, 2, 3, 5, 9, 11, 28, 29, 30, 31, 32], [7, 7, -2, -3, -10, -1, -8, -5, -6, -7, -4, -9]), 'NEW': ([0, 1, 2, 3, 5, 9, 11, 28, 29, 30, 31, 32], [8, 8, -2, -3, -10, -1, -8, -5, -6, -7, -4, -9]), 'NEWLINE': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 16, 21, 22, 23, 26, 28, 29, 30, 31, 32, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 50, 51, 52, 54, 55, 60, 61, 63, 64, 65, 66, 67, 73, 74, 75, 76, 77, 78, 84, 98, 99, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 123, 125, 131, 134, 135, 136, 140, 141, 143, 144, 146, 147, 148, 149, 150, 151, 152], [5, 5, -2, -3, 11, -10, 28, 29, 30, -1, 31, -8, 32, -22, -36, -37, -38, -44, -5, -6, -7, -4, -9, -67, -13, -14, -71, -15, -16, -73, -74, -75, -21, -18, -79, -80, -82, -56, -57, -58, -23, -24, -34, -35, -42, -43, -45, -46, -48, -76, -77, -17, -19, -20, -81, -60, -11, -12, -70, -72, -78, -51, -52, -53, -54, -55, -59, -25, -27, -26, -47, -68, -49, -83, -83, -83, -69, -28, -33, -30, -29, -39, -40, -41, -50, -32, -31]), '$end': ([1, 2, 3, 5, 9, 11, 28, 29, 30, 31, 32], [0, -2, -3, -10, -1, -8, -5, -6, -7, -4, -9]), 'LET': ([4], [13]), 'READ': ([4], [14]), 'DATA': ([4], [15]), 'PRINT': ([4], [16]), 'GOTO': ([4], [17]), 'IF': ([4], [18]), 'FOR': ([4], [19]), 'NEXT': ([4], [20]), 'END': ([4], [21]), 'REM': ([4], [22]), 'STOP': ([4], [23]), 'DEF': ([4], [24]), 'GOSUB': ([4], [25]), 'RETURN': ([4], [26]), 'DIM': ([4], [27]), 'ID': ([13, 14, 16, 18, 19, 20, 24, 27, 47, 49, 53, 69, 70, 71, 76, 79, 80, 81, 82, 83, 88, 89, 90, 91, 92, 93, 94, 95, 96, 126, 127, 128, 137, 138, 142, 145], [34, 34, 34, 34, 59, 60, 62, 68, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 121, 68, 34, 34, 34, 34, 34, 34, 34]), 'FLOAT': ([15, 16, 18, 43, 47, 49, 53, 69, 70, 72, 76, 79, 80, 81, 82, 83, 88, 89, 90, 91, 92, 93, 94, 126, 127, 128, 137, 138, 142, 145], [42, 51, 51, 74, 51, 51, 51, 51, 51, 42, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51]), 'MINUS': ([15, 16, 18, 34, 47, 48, 49, 50, 51, 52, 53, 58, 69, 70, 72, 76, 78, 79, 80, 81, 82, 83, 84, 85, 88, 89, 90, 91, 92, 93, 94, 98, 100, 104, 105, 106, 107, 108, 109, 113, 114, 115, 116, 117, 118, 119, 125, 126, 127, 128, 133, 134, 136, 137, 138, 140, 142, 145, 147, 149, 151], [43, 49, 49, -67, 49, 80, 49, -56, -57, -58, 49, 80, 49, 49, 43, 49, 80, 49, 49, 49, 49, 49, -60, 80, 49, 49, 49, 49, 49, 49, 49, 80, 80, -51, -52, -53, -54, -55, -59, 80, 80, 80, 80, 80, 80, 80, -68, 49, 49, 49, 80, 80, 80, 49, 49, -69, 49, 49, 80, 80, 80]), 'STRING': ([16, 76], [47, 47]), 'LPAREN': ([16, 18, 34, 47, 49, 53, 62, 68, 69, 70, 76, 79, 80, 81, 82, 83, 88, 89, 90, 91, 92, 93, 94, 126, 127, 128, 137, 138, 142, 145], [53, 53, 70, 53, 53, 53, 95, 97, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53]), 'EQUALS': ([33, 34, 50, 51, 52, 58, 59, 84, 104, 105, 106, 107, 108, 109, 125, 129, 130, 140], [69, -67, -56, -57, -58, 92, 94, -60, -51, -52, -53, -54, -55, -59, -68, 137, 138, -69]), 'COMMA': ([34, 35, 37, 38, 40, 41, 42, 44, 46, 47, 48, 50, 51, 52, 65, 67, 73, 74, 78, 84, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 123, 124, 125, 131, 140, 150], [-67, 71, -71, 72, -73, -74, -75, 76, -79, -80, -82, -56, -57, -58, 96, -48, -76, -77, -81, -60, 126, -70, -72, -78, -51, -52, -53, -54, -55, -59, -47, 132, -68, -49, -69, -50]), 'PLUS': ([34, 48, 50, 51, 52, 58, 78, 84, 85, 98, 100, 104, 105, 106, 107, 108, 109, 113, 114, 115, 116, 117, 118, 119, 125, 133, 134, 136, 140, 147, 149, 151], [-67, 79, -56, -57, -58, 79, 79, -60, 79, 79, 79, -51, -52, -53, -54, -55, -59, 79, 79, 79, 79, 79, 79, 79, -68, 79, 79, 79, -69, 79, 79, 79]), 'TIMES': ([34, 48, 50, 51, 52, 58, 78, 84, 85, 98, 100, 104, 105, 106, 107, 108, 109, 113, 114, 115, 116, 117, 118, 119, 125, 133, 134, 136, 140, 147, 149, 151], [-67, 81, -56, -57, -58, 81, 81, -60, 81, 81, 81, 81, 81, -53, -54, -55, -59, 81, 81, 81, 81, 81, 81, 81, -68, 81, 81, 81, -69, 81, 81, 81]), 'DIVIDE': ([34, 48, 50, 51, 52, 58, 78, 84, 85, 98, 100, 104, 105, 106, 107, 108, 109, 113, 114, 115, 116, 117, 118, 119, 125, 133, 134, 136, 140, 147, 149, 151], [-67, 82, -56, -57, -58, 82, 82, -60, 82, 82, 82, 82, 82, -53, -54, -55, -59, 82, 82, 82, 82, 82, 82, 82, -68, 82, 82, 82, -69, 82, 82, 82]), 'POWER': ([34, 48, 50, 51, 52, 58, 78, 84, 85, 98, 100, 104, 105, 106, 107, 108, 109, 113, 114, 115, 116, 117, 118, 119, 125, 133, 134, 136, 140, 147, 149, 151], [-67, 83, -56, -57, -58, 83, 83, -60, 83, 83, 83, 83, 83, 83, 83, -55, -59, 83, 83, 83, 83, 83, 83, 83, -68, 83, 83, 83, -69, 83, 83, 83]), 'SEMI': ([34, 44, 46, 47, 48, 50, 51, 52, 78, 84, 103, 104, 105, 106, 107, 108, 109, 125, 140], [-67, 77, -79, -80, -82, -56, -57, -58, -81, -60, -78, -51, -52, -53, -54, -55, -59, -68, -69]), 'LT': ([34, 50, 51, 52, 58, 84, 104, 105, 106, 107, 108, 109, 125, 140], [-67, -56, -57, -58, 88, -60, -51, -52, -53, -54, -55, -59, -68, -69]), 'LE': ([34, 50, 51, 52, 58, 84, 104, 105, 106, 107, 108, 109, 125, 140], [-67, -56, -57, -58, 89, -60, -51, -52, -53, -54, -55, -59, -68, -69]), 'GT': ([34, 50, 51, 52, 58, 84, 104, 105, 106, 107, 108, 109, 125, 140], [-67, -56, -57, -58, 90, -60, -51, -52, -53, -54, -55, -59, -68, -69]), 'GE': ([34, 50, 51, 52, 58, 84, 104, 105, 106, 107, 108, 109, 125, 140], [-67, -56, -57, -58, 91, -60, -51, -52, -53, -54, -55, -59, -68, -69]), 'NE': ([34, 50, 51, 52, 58, 84, 104, 105, 106, 107, 108, 109, 125, 140], [-67, -56, -57, -58, 93, -60, -51, -52, -53, -54, -55, -59, -68, -69]), 'RPAREN': ([34, 50, 51, 52, 84, 85, 100, 104, 105, 106, 107, 108, 109, 121, 122, 124, 125, 133, 139, 140], [-67, -56, -57, -58, -60, 109, 125, -51, -52, -53, -54, -55, -59, 129, 130, 131, -68, 140, 150, -69]), 'THEN': ([34, 50, 51, 52, 56, 57, 84, 104, 105, 106, 107, 108, 109, 113, 114, 115, 116, 117, 118, 125, 140], [-67, -56, -57, -58, 86, 87, -60, -51, -52, -53, -54, -55, -59, -61, -62, -63, -64, -65, -66, -68, -69]), 'TO': ([34, 50, 51, 52, 84, 104, 105, 106, 107, 108, 109, 119, 120, 125, 140], [-67, -56, -57, -58, -60, -51, -52, -53, -54, -55, -59, 127, 128, -68, -69]), 'STEP': ([34, 50, 51, 52, 84, 104, 105, 106, 107, 108, 109, 125, 134, 135, 136, 140], [-67, -56, -57, -58, -60, -51, -52, -53, -54, -55, -59, -68, 142, 145, 145, -69])} _lr_action = {} for (_k, _v) in _lr_action_items.items(): for (_x, _y) in zip(_v[0], _v[1]): if not _x in _lr_action: _lr_action[_x] = {} _lr_action[_x][_k] = _y del _lr_action_items _lr_goto_items = {'program': ([0], [1]), 'statement': ([0, 1], [2, 9]), 'command': ([4], [10]), 'variable': ([13, 14, 16, 18, 47, 49, 53, 69, 70, 71, 76, 79, 80, 81, 82, 83, 88, 89, 90, 91, 92, 93, 94, 126, 127, 128, 137, 138, 142, 145], [33, 37, 52, 52, 52, 52, 52, 52, 52, 101, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52]), 'varlist': ([14], [35]), 'numlist': ([15], [38]), 'number': ([15, 72], [40, 102]), 'plist': ([16], [44]), 'pitem': ([16, 76], [46, 103]), 'expr': ([16, 18, 47, 49, 53, 69, 70, 76, 79, 80, 81, 82, 83, 88, 89, 90, 91, 92, 93, 94, 126, 127, 128, 137, 138, 142, 145], [48, 58, 78, 84, 85, 98, 100, 48, 104, 105, 106, 107, 108, 113, 114, 115, 116, 117, 118, 119, 133, 134, 136, 147, 149, 151, 151]), 'relexpr': ([18], [56]), 'dimlist': ([27], [65]), 'dimitem': ([27, 96], [67, 123]), 'optend': ([44], [75]), 'optstep': ([134, 135, 136], [141, 144, 146]), 'empty': ([134, 135, 136], [143, 143, 143])} _lr_goto = {} for (_k, _v) in _lr_goto_items.items(): for (_x, _y) in zip(_v[0], _v[1]): if not _x in _lr_goto: _lr_goto[_x] = {} _lr_goto[_x][_k] = _y del _lr_goto_items _lr_productions = [("S' -> program", "S'", 1, None, None, None), ('program -> program statement', 'program', 2, 'p_program', 'basparse.py', 21), ('program -> statement', 'program', 1, 'p_program', 'basparse.py', 22), ('program -> error', 'program', 1, 'p_program_error', 'basparse.py', 41), ('statement -> INTEGER command NEWLINE', 'statement', 3, 'p_statement', 'basparse.py', 49), ('statement -> RUN NEWLINE', 'statement', 2, 'p_statement_interactive', 'basparse.py', 62), ('statement -> LIST NEWLINE', 'statement', 2, 'p_statement_interactive', 'basparse.py', 63), ('statement -> NEW NEWLINE', 'statement', 2, 'p_statement_interactive', 'basparse.py', 64), ('statement -> INTEGER NEWLINE', 'statement', 2, 'p_statement_blank', 'basparse.py', 71), ('statement -> INTEGER error NEWLINE', 'statement', 3, 'p_statement_bad', 'basparse.py', 78), ('statement -> NEWLINE', 'statement', 1, 'p_statement_newline', 'basparse.py', 87), ('command -> LET variable EQUALS expr', 'command', 4, 'p_command_let', 'basparse.py', 94), ('command -> LET variable EQUALS error', 'command', 4, 'p_command_let_bad', 'basparse.py', 99), ('command -> READ varlist', 'command', 2, 'p_command_read', 'basparse.py', 106), ('command -> READ error', 'command', 2, 'p_command_read_bad', 'basparse.py', 111), ('command -> DATA numlist', 'command', 2, 'p_command_data', 'basparse.py', 118), ('command -> DATA error', 'command', 2, 'p_command_data_bad', 'basparse.py', 123), ('command -> PRINT plist optend', 'command', 3, 'p_command_print', 'basparse.py', 130), ('command -> PRINT error', 'command', 2, 'p_command_print_bad', 'basparse.py', 135), ('optend -> COMMA', 'optend', 1, 'p_optend', 'basparse.py', 142), ('optend -> SEMI', 'optend', 1, 'p_optend', 'basparse.py', 143), ('optend -> <empty>', 'optend', 0, 'p_optend', 'basparse.py', 144), ('command -> PRINT', 'command', 1, 'p_command_print_empty', 'basparse.py', 154), ('command -> GOTO INTEGER', 'command', 2, 'p_command_goto', 'basparse.py', 161), ('command -> GOTO error', 'command', 2, 'p_command_goto_bad', 'basparse.py', 166), ('command -> IF relexpr THEN INTEGER', 'command', 4, 'p_command_if', 'basparse.py', 173), ('command -> IF error THEN INTEGER', 'command', 4, 'p_command_if_bad', 'basparse.py', 178), ('command -> IF relexpr THEN error', 'command', 4, 'p_command_if_bad2', 'basparse.py', 183), ('command -> FOR ID EQUALS expr TO expr optstep', 'command', 7, 'p_command_for', 'basparse.py', 190), ('command -> FOR ID EQUALS error TO expr optstep', 'command', 7, 'p_command_for_bad_initial', 'basparse.py', 195), ('command -> FOR ID EQUALS expr TO error optstep', 'command', 7, 'p_command_for_bad_final', 'basparse.py', 200), ('command -> FOR ID EQUALS expr TO expr STEP error', 'command', 8, 'p_command_for_bad_step', 'basparse.py', 205), ('optstep -> STEP expr', 'optstep', 2, 'p_optstep', 'basparse.py', 212), ('optstep -> empty', 'optstep', 1, 'p_optstep', 'basparse.py', 213), ('command -> NEXT ID', 'command', 2, 'p_command_next', 'basparse.py', 223), ('command -> NEXT error', 'command', 2, 'p_command_next_bad', 'basparse.py', 229), ('command -> END', 'command', 1, 'p_command_end', 'basparse.py', 236), ('command -> REM', 'command', 1, 'p_command_rem', 'basparse.py', 243), ('command -> STOP', 'command', 1, 'p_command_stop', 'basparse.py', 250), ('command -> DEF ID LPAREN ID RPAREN EQUALS expr', 'command', 7, 'p_command_def', 'basparse.py', 257), ('command -> DEF ID LPAREN ID RPAREN EQUALS error', 'command', 7, 'p_command_def_bad_rhs', 'basparse.py', 262), ('command -> DEF ID LPAREN error RPAREN EQUALS expr', 'command', 7, 'p_command_def_bad_arg', 'basparse.py', 267), ('command -> GOSUB INTEGER', 'command', 2, 'p_command_gosub', 'basparse.py', 274), ('command -> GOSUB error', 'command', 2, 'p_command_gosub_bad', 'basparse.py', 279), ('command -> RETURN', 'command', 1, 'p_command_return', 'basparse.py', 286), ('command -> DIM dimlist', 'command', 2, 'p_command_dim', 'basparse.py', 293), ('command -> DIM error', 'command', 2, 'p_command_dim_bad', 'basparse.py', 298), ('dimlist -> dimlist COMMA dimitem', 'dimlist', 3, 'p_dimlist', 'basparse.py', 305), ('dimlist -> dimitem', 'dimlist', 1, 'p_dimlist', 'basparse.py', 306), ('dimitem -> ID LPAREN INTEGER RPAREN', 'dimitem', 4, 'p_dimitem_single', 'basparse.py', 317), ('dimitem -> ID LPAREN INTEGER COMMA INTEGER RPAREN', 'dimitem', 6, 'p_dimitem_double', 'basparse.py', 322), ('expr -> expr PLUS expr', 'expr', 3, 'p_expr_binary', 'basparse.py', 329), ('expr -> expr MINUS expr', 'expr', 3, 'p_expr_binary', 'basparse.py', 330), ('expr -> expr TIMES expr', 'expr', 3, 'p_expr_binary', 'basparse.py', 331), ('expr -> expr DIVIDE expr', 'expr', 3, 'p_expr_binary', 'basparse.py', 332), ('expr -> expr POWER expr', 'expr', 3, 'p_expr_binary', 'basparse.py', 333), ('expr -> INTEGER', 'expr', 1, 'p_expr_number', 'basparse.py', 339), ('expr -> FLOAT', 'expr', 1, 'p_expr_number', 'basparse.py', 340), ('expr -> variable', 'expr', 1, 'p_expr_variable', 'basparse.py', 345), ('expr -> LPAREN expr RPAREN', 'expr', 3, 'p_expr_group', 'basparse.py', 350), ('expr -> MINUS expr', 'expr', 2, 'p_expr_unary', 'basparse.py', 355), ('relexpr -> expr LT expr', 'relexpr', 3, 'p_relexpr', 'basparse.py', 362), ('relexpr -> expr LE expr', 'relexpr', 3, 'p_relexpr', 'basparse.py', 363), ('relexpr -> expr GT expr', 'relexpr', 3, 'p_relexpr', 'basparse.py', 364), ('relexpr -> expr GE expr', 'relexpr', 3, 'p_relexpr', 'basparse.py', 365), ('relexpr -> expr EQUALS expr', 'relexpr', 3, 'p_relexpr', 'basparse.py', 366), ('relexpr -> expr NE expr', 'relexpr', 3, 'p_relexpr', 'basparse.py', 367), ('variable -> ID', 'variable', 1, 'p_variable', 'basparse.py', 374), ('variable -> ID LPAREN expr RPAREN', 'variable', 4, 'p_variable', 'basparse.py', 375), ('variable -> ID LPAREN expr COMMA expr RPAREN', 'variable', 6, 'p_variable', 'basparse.py', 376), ('varlist -> varlist COMMA variable', 'varlist', 3, 'p_varlist', 'basparse.py', 388), ('varlist -> variable', 'varlist', 1, 'p_varlist', 'basparse.py', 389), ('numlist -> numlist COMMA number', 'numlist', 3, 'p_numlist', 'basparse.py', 400), ('numlist -> number', 'numlist', 1, 'p_numlist', 'basparse.py', 401), ('number -> INTEGER', 'number', 1, 'p_number', 'basparse.py', 413), ('number -> FLOAT', 'number', 1, 'p_number', 'basparse.py', 414), ('number -> MINUS INTEGER', 'number', 2, 'p_number_signed', 'basparse.py', 421), ('number -> MINUS FLOAT', 'number', 2, 'p_number_signed', 'basparse.py', 422), ('plist -> plist COMMA pitem', 'plist', 3, 'p_plist', 'basparse.py', 430), ('plist -> pitem', 'plist', 1, 'p_plist', 'basparse.py', 431), ('pitem -> STRING', 'pitem', 1, 'p_item_string', 'basparse.py', 440), ('pitem -> STRING expr', 'pitem', 2, 'p_item_string_expr', 'basparse.py', 445), ('pitem -> expr', 'pitem', 1, 'p_item_expr', 'basparse.py', 450), ('empty -> <empty>', 'empty', 0, 'p_empty', 'basparse.py', 457)]
#-*- coding: utf8 -*- class P3PMiddleware(object): def process_response(self, request, response): response['P3P'] = 'CP="CAO PSA OUR"' return response
class P3Pmiddleware(object): def process_response(self, request, response): response['P3P'] = 'CP="CAO PSA OUR"' return response
# Copyright 2018 Databricks, Inc. VERSION = '0.7.0.dev'
version = '0.7.0.dev'
#!/usr/bin/env python ''' This script prints Hello World! ''' print('Hello, World!')
""" This script prints Hello World! """ print('Hello, World!')
__all__ = ["InvalidECFGFormatException"] class InvalidECFGFormatException(Exception): pass
__all__ = ['InvalidECFGFormatException'] class Invalidecfgformatexception(Exception): pass
r=int(input('banyaknya angka:')) data=[] for i in range (r): #v n=int(input("Enter Integer {}:".format(i+1))) #v data.append(n) #v m=10**(r-1) for i in range (r): y=int(data[i]*m) print(y) m=m/10 #print(r);
r = int(input('banyaknya angka:')) data = [] for i in range(r): n = int(input('Enter Integer {}:'.format(i + 1))) data.append(n) m = 10 ** (r - 1) for i in range(r): y = int(data[i] * m) print(y) m = m / 10
def define_display_nodes(tree,nodemap,unscoped_vectors=False,looped_definition=False): if unscoped_vectors: s = '' else: s = '\t\t\tstd::vector<MPILib::NodeId> display_nodes;\n' display_nodes = tree.findall('.//Display') for dn in display_nodes: node_id = str(nodemap[dn.attrib['node']]) if looped_definition: node_id = str(len(nodemap))+'*i+'+node_id s += '\t\t\tdisplay_nodes.push_back('+ node_id + ');\n' s += '\n' return s def define_rate_nodes(tree, nodemap,unscoped_vectors=False,looped_definition=False): if unscoped_vectors: s = '' else: s = '\t\t\tstd::vector<MPILib::NodeId> rate_nodes;\n' s += '\t\t\tstd::vector<MPILib::Time> rate_node_intervals;\n' rate_nodes = tree.findall('.//Rate') for rn in rate_nodes: node_id = str(nodemap[rn.attrib['node']]) if looped_definition: node_id = str(len(nodemap))+'*i+'+node_id t_interval = rn.attrib['t_interval'] s += '\t\t\trate_nodes.push_back('+ node_id + ');\n' s += '\t\t\trate_node_intervals.push_back('+ t_interval + ');\n' s += '\n' return s def define_density_nodes(tree,nodemap,unscoped_vectors=False,looped_definition=False): if unscoped_vectors: s = '' else: s = '\t\t\tstd::vector<MPILib::NodeId> density_nodes;\n' s += '\t\t\tstd::vector<MPILib::Time> density_node_start_times;\n' s += '\t\t\tstd::vector<MPILib::Time> density_node_end_times;\n' s += '\t\t\tstd::vector<MPILib::Time> density_node_intervals;\n' density_nodes = tree.findall('.//Density') for dn in density_nodes: node_id = str(nodemap[dn.attrib['node']]) if looped_definition: node_id = str(len(nodemap))+'*i+'+node_id t_start = dn.attrib['t_start'] t_end = dn.attrib['t_end'] t_interval = dn.attrib['t_interval'] s += '\t\t\tdensity_nodes.push_back('+ node_id + ');\n' s += '\t\t\tdensity_node_start_times.push_back('+ t_start + ');\n' s += '\t\t\tdensity_node_end_times.push_back('+ t_end + ');\n' s += '\t\t\tdensity_node_intervals.push_back('+ t_interval + ');\n' s += '\n' return s
def define_display_nodes(tree, nodemap, unscoped_vectors=False, looped_definition=False): if unscoped_vectors: s = '' else: s = '\t\t\tstd::vector<MPILib::NodeId> display_nodes;\n' display_nodes = tree.findall('.//Display') for dn in display_nodes: node_id = str(nodemap[dn.attrib['node']]) if looped_definition: node_id = str(len(nodemap)) + '*i+' + node_id s += '\t\t\tdisplay_nodes.push_back(' + node_id + ');\n' s += '\n' return s def define_rate_nodes(tree, nodemap, unscoped_vectors=False, looped_definition=False): if unscoped_vectors: s = '' else: s = '\t\t\tstd::vector<MPILib::NodeId> rate_nodes;\n' s += '\t\t\tstd::vector<MPILib::Time> rate_node_intervals;\n' rate_nodes = tree.findall('.//Rate') for rn in rate_nodes: node_id = str(nodemap[rn.attrib['node']]) if looped_definition: node_id = str(len(nodemap)) + '*i+' + node_id t_interval = rn.attrib['t_interval'] s += '\t\t\trate_nodes.push_back(' + node_id + ');\n' s += '\t\t\trate_node_intervals.push_back(' + t_interval + ');\n' s += '\n' return s def define_density_nodes(tree, nodemap, unscoped_vectors=False, looped_definition=False): if unscoped_vectors: s = '' else: s = '\t\t\tstd::vector<MPILib::NodeId> density_nodes;\n' s += '\t\t\tstd::vector<MPILib::Time> density_node_start_times;\n' s += '\t\t\tstd::vector<MPILib::Time> density_node_end_times;\n' s += '\t\t\tstd::vector<MPILib::Time> density_node_intervals;\n' density_nodes = tree.findall('.//Density') for dn in density_nodes: node_id = str(nodemap[dn.attrib['node']]) if looped_definition: node_id = str(len(nodemap)) + '*i+' + node_id t_start = dn.attrib['t_start'] t_end = dn.attrib['t_end'] t_interval = dn.attrib['t_interval'] s += '\t\t\tdensity_nodes.push_back(' + node_id + ');\n' s += '\t\t\tdensity_node_start_times.push_back(' + t_start + ');\n' s += '\t\t\tdensity_node_end_times.push_back(' + t_end + ');\n' s += '\t\t\tdensity_node_intervals.push_back(' + t_interval + ');\n' s += '\n' return s
def factorial(n): if n==0: return 1 else: return factorial(n-1)*n print(factorial(80))
def factorial(n): if n == 0: return 1 else: return factorial(n - 1) * n print(factorial(80))
# two_tasks.py def task_reformat_temperature_data(): """Reformats the raw temperature data file for easier analysis""" return { 'file_dep': ['UK_Tmean_data.txt'], 'targets': ['UK_Tmean_data.reformatted.txt'], 'actions': ['python reformat_weather_data.py UK_Tmean_data.txt > UK_Tmean_data.reformatted.txt'], } def task_reformat_sunshine_data(): """Reformats the raw sunshine data file for easier analysis""" return { 'file_dep': ['UK_Sunshine_data.txt'], 'targets': ['UK_Sunshine_data.reformatted.txt'], 'actions': ['python reformat_weather_data.py UK_Sunshine_data.txt > UK_Sunshine_data.reformatted.txt'], }
def task_reformat_temperature_data(): """Reformats the raw temperature data file for easier analysis""" return {'file_dep': ['UK_Tmean_data.txt'], 'targets': ['UK_Tmean_data.reformatted.txt'], 'actions': ['python reformat_weather_data.py UK_Tmean_data.txt > UK_Tmean_data.reformatted.txt']} def task_reformat_sunshine_data(): """Reformats the raw sunshine data file for easier analysis""" return {'file_dep': ['UK_Sunshine_data.txt'], 'targets': ['UK_Sunshine_data.reformatted.txt'], 'actions': ['python reformat_weather_data.py UK_Sunshine_data.txt > UK_Sunshine_data.reformatted.txt']}
#Make sure that we handle keyword-only arguments correctly def f(a, *varargs, kw1, kw2="has-default"): pass #OK f(1, 2, 3, kw1=1) f(1, 2, kw1=1, kw2=2) #Not OK f(1, 2, 3, kw1=1, kw3=3) f(1, 2, 3, kw3=3) #ODASA-5897 def analyze_member_access(msg, *, original, override, chk: 'default' = None): pass def ok(): return analyze_member_access(msg, original=original, chk=chk) def bad(): return analyze_member_access(msg, original, chk=chk)
def f(a, *varargs, kw1, kw2='has-default'): pass f(1, 2, 3, kw1=1) f(1, 2, kw1=1, kw2=2) f(1, 2, 3, kw1=1, kw3=3) f(1, 2, 3, kw3=3) def analyze_member_access(msg, *, original, override, chk: 'default'=None): pass def ok(): return analyze_member_access(msg, original=original, chk=chk) def bad(): return analyze_member_access(msg, original, chk=chk)
class Parser(): def __init__(self, config): self._config_args = config @property def experiment_args(self): return self._config_args["Experiment"] @property def train_dataset_args(self): return self._config_args["Dataset - metatrain"] @property def valid_dataset_args(self): return self._config_args["Dataset - metatest"] @property def model_args(self): return self._config_args["Model"] @property def maml_args(self): return self._config_args["MAML"] @property def training_args(self): return self._config_args["training"] def parse(self): return self.experiment_args, self.train_dataset_args, self.valid_dataset_args, self.model_args, self.maml_args, self.training_args
class Parser: def __init__(self, config): self._config_args = config @property def experiment_args(self): return self._config_args['Experiment'] @property def train_dataset_args(self): return self._config_args['Dataset - metatrain'] @property def valid_dataset_args(self): return self._config_args['Dataset - metatest'] @property def model_args(self): return self._config_args['Model'] @property def maml_args(self): return self._config_args['MAML'] @property def training_args(self): return self._config_args['training'] def parse(self): return (self.experiment_args, self.train_dataset_args, self.valid_dataset_args, self.model_args, self.maml_args, self.training_args)
''' According to the Wikipedia's article: "The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970." Given a board with m by n cells, each cell has an initial state live (1) or dead (0). Each cell interacts with its eight neighbors (horizontal, vertical, diagonal) using the following four rules (taken from the above Wikipedia article): Any live cell with fewer than two live neighbors dies, as if caused by under-population. Any live cell with two or three live neighbors lives on to the next generation. Any live cell with more than three live neighbors dies, as if by over-population.. Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction. Write a function to compute the next state (after one update) of the board given its current state. Follow up: Could you solve it in-place? Remember that the board needs to be updated at the same time: You cannot update some cells first and then use their updated values to update other cells. In this question, we represent the board using a 2D array. In principle, the board is infinite, which would cause problems when the active area encroaches the border of the array. How would you address these problems? Credits: Special thanks to @jianchao.li.fighter for adding this problem and creating all test cases. ''' class Solution(object): def gameOfLife(self, board): """ :type board: List[List[int]] :rtype: void Do not return anything, modify board in-place instead. """ if not board: return n = len(board) m = len(board[0]) copy_board = [[board[i][j] for j in xrange(m)] for i in xrange(n)] for i in xrange(n): for j in xrange(m): live_neighbors = 0 for x, y in [(1, 0), (-1, 0), (0, 1), (0, -1), (-1, -1), (-1, 1), (1, -1), (1, 1)]: ii = i + x jj = j + y if 0 <= ii < n and 0 <= jj < m: if copy_board[ii][jj] == 1: live_neighbors += 1 if copy_board[i][j] == 1: if live_neighbors < 2: board[i][j] = 0 elif live_neighbors < 4: board[i][j] = 1 else: board[i][j] = 0 elif copy_board[i][j] == 0: if live_neighbors == 3: board[i][j] = 1 else: board[i][j] = 0
""" According to the Wikipedia's article: "The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970." Given a board with m by n cells, each cell has an initial state live (1) or dead (0). Each cell interacts with its eight neighbors (horizontal, vertical, diagonal) using the following four rules (taken from the above Wikipedia article): Any live cell with fewer than two live neighbors dies, as if caused by under-population. Any live cell with two or three live neighbors lives on to the next generation. Any live cell with more than three live neighbors dies, as if by over-population.. Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction. Write a function to compute the next state (after one update) of the board given its current state. Follow up: Could you solve it in-place? Remember that the board needs to be updated at the same time: You cannot update some cells first and then use their updated values to update other cells. In this question, we represent the board using a 2D array. In principle, the board is infinite, which would cause problems when the active area encroaches the border of the array. How would you address these problems? Credits: Special thanks to @jianchao.li.fighter for adding this problem and creating all test cases. """ class Solution(object): def game_of_life(self, board): """ :type board: List[List[int]] :rtype: void Do not return anything, modify board in-place instead. """ if not board: return n = len(board) m = len(board[0]) copy_board = [[board[i][j] for j in xrange(m)] for i in xrange(n)] for i in xrange(n): for j in xrange(m): live_neighbors = 0 for (x, y) in [(1, 0), (-1, 0), (0, 1), (0, -1), (-1, -1), (-1, 1), (1, -1), (1, 1)]: ii = i + x jj = j + y if 0 <= ii < n and 0 <= jj < m: if copy_board[ii][jj] == 1: live_neighbors += 1 if copy_board[i][j] == 1: if live_neighbors < 2: board[i][j] = 0 elif live_neighbors < 4: board[i][j] = 1 else: board[i][j] = 0 elif copy_board[i][j] == 0: if live_neighbors == 3: board[i][j] = 1 else: board[i][j] = 0
class X: def __init__(self,x): print("Inside X ", x) class Y: def __init__(self): print("Inside Y") class Z(X,Y): def __init__(self): super().__init__(10) print("Inside Z") obj = Z()
class X: def __init__(self, x): print('Inside X ', x) class Y: def __init__(self): print('Inside Y') class Z(X, Y): def __init__(self): super().__init__(10) print('Inside Z') obj = z()
# -*- coding: utf-8 -*- valor = float(input()) if 0 < valor <= 25: print('Intervalo [0, 25]') elif 25 < valor <= 50: print('Intervalo (25, 50]') elif 50 < valor <= 75: print('Intervalo (50, 75]') elif 75 < valor <= 100: print('Intervalo (75, 100]') else: print('Fora de intervalo')
valor = float(input()) if 0 < valor <= 25: print('Intervalo [0, 25]') elif 25 < valor <= 50: print('Intervalo (25, 50]') elif 50 < valor <= 75: print('Intervalo (50, 75]') elif 75 < valor <= 100: print('Intervalo (75, 100]') else: print('Fora de intervalo')
""" Consider the following: A string, , of length where . An integer, , where is a factor of . We can split into subsegments where each subsegment, , consists of a contiguous block of characters in . Then, use each to create string such that: The characters in are a subsequence of the characters in . Any repeat occurrence of a character is removed from the string such that each character in occurs exactly once. In other words, if the character at some index in occurs at a previous index in , then do not include the character in string . Given and , print lines where each line denotes string . Input Format The first line contains a single string denoting . The second line contains an integer, , denoting the length of each subsegment. Constraints , where is the length of It is guaranteed that is a multiple of . Output Format Print lines where each line contains string . Sample Input AABCAAADA 3 Sample Output AB CA AD Explanation String is split into equal parts of length . We convert each to by removing any subsequent occurrences non-distinct characters in : We then print each on a new line. """ S, N = input(), int(input()) for part in zip(*[iter(S)] * N): d = dict() print(''.join([d.setdefault(c, c) for c in part if c not in d]))
""" Consider the following: A string, , of length where . An integer, , where is a factor of . We can split into subsegments where each subsegment, , consists of a contiguous block of characters in . Then, use each to create string such that: The characters in are a subsequence of the characters in . Any repeat occurrence of a character is removed from the string such that each character in occurs exactly once. In other words, if the character at some index in occurs at a previous index in , then do not include the character in string . Given and , print lines where each line denotes string . Input Format The first line contains a single string denoting . The second line contains an integer, , denoting the length of each subsegment. Constraints , where is the length of It is guaranteed that is a multiple of . Output Format Print lines where each line contains string . Sample Input AABCAAADA 3 Sample Output AB CA AD Explanation String is split into equal parts of length . We convert each to by removing any subsequent occurrences non-distinct characters in : We then print each on a new line. """ (s, n) = (input(), int(input())) for part in zip(*[iter(S)] * N): d = dict() print(''.join([d.setdefault(c, c) for c in part if c not in d]))
# SPDX-FileCopyrightText: Copyright (C) 2020-2021 Ryan Finnie # SPDX-License-Identifier: MIT def numfmt( num, fmt="{num.real:0.02f} {num.prefix}", binary=False, rollover=1.0, limit=0, prefixes=None, ): """Formats a number with decimal or binary prefixes num: Input number fmt: Format string of default repr/str output binary: If True, use divide by 1024 and use IEC binary prefixes rollover: Threshold to roll over to the next prefix limit: Stop after a specified number of rollovers prefixes: List of (decimal, binary) prefix strings, ascending """ # SPDX-SnippetComment: Originally from https://github.com/rfinnie/rf-pymods # SPDX-SnippetCopyrightText: Copyright (C) 2020-2021 Ryan Finnie # SPDX-LicenseInfoInSnippet: MIT class NumberFormat(float): prefix = "" fmt = "{num.real:0.02f} {num.prefix}" def __str__(self): return self.fmt.format(num=self) def __repr__(self): return str(self) if prefixes is None: prefixes = [ ("k", "Ki"), ("M", "Mi"), ("G", "Gi"), ("T", "Ti"), ("P", "Pi"), ("E", "Ei"), ("Z", "Zi"), ("Y", "Yi"), ] divisor = 1024 if binary else 1000 if limit <= 0 or limit > len(prefixes): limit = len(prefixes) count = 0 p = "" for prefix in prefixes: if num < (divisor * rollover): break if count >= limit: break count += 1 num = num / float(divisor) p = prefix[1] if binary else prefix[0] ret = NumberFormat(num) ret.fmt = fmt ret.prefix = p return ret
def numfmt(num, fmt='{num.real:0.02f} {num.prefix}', binary=False, rollover=1.0, limit=0, prefixes=None): """Formats a number with decimal or binary prefixes num: Input number fmt: Format string of default repr/str output binary: If True, use divide by 1024 and use IEC binary prefixes rollover: Threshold to roll over to the next prefix limit: Stop after a specified number of rollovers prefixes: List of (decimal, binary) prefix strings, ascending """ class Numberformat(float): prefix = '' fmt = '{num.real:0.02f} {num.prefix}' def __str__(self): return self.fmt.format(num=self) def __repr__(self): return str(self) if prefixes is None: prefixes = [('k', 'Ki'), ('M', 'Mi'), ('G', 'Gi'), ('T', 'Ti'), ('P', 'Pi'), ('E', 'Ei'), ('Z', 'Zi'), ('Y', 'Yi')] divisor = 1024 if binary else 1000 if limit <= 0 or limit > len(prefixes): limit = len(prefixes) count = 0 p = '' for prefix in prefixes: if num < divisor * rollover: break if count >= limit: break count += 1 num = num / float(divisor) p = prefix[1] if binary else prefix[0] ret = number_format(num) ret.fmt = fmt ret.prefix = p return ret
# Aula 13 - Desafio 47: Contagem de numeros pares # Mostrar na tela todos os numeros pares entre 1 e 50 print('Entre 1 e 50, sao numeros pares:') for n in range(2, 51, 2): print(n, end=' ')
print('Entre 1 e 50, sao numeros pares:') for n in range(2, 51, 2): print(n, end=' ')
word1=input() word2=input() dict={} alphabet="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" for char in alphabet: dict[char]=0 for ch in word1: dict[ch]+=1 for ch in word2: dict[ch]-=1 flag=False sum=0 for char in dict: count=dict[char] sum+=count if count == 1: flag=True if flag and count>1: flag=False break if flag and sum==0: print("Yes") else: print("No")
word1 = input() word2 = input() dict = {} alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' for char in alphabet: dict[char] = 0 for ch in word1: dict[ch] += 1 for ch in word2: dict[ch] -= 1 flag = False sum = 0 for char in dict: count = dict[char] sum += count if count == 1: flag = True if flag and count > 1: flag = False break if flag and sum == 0: print('Yes') else: print('No')
#!/usr/bin/env python # -*- coding: utf-8 -*- # Source code meta data __author__ = 'Dalwar Hossain' __email__ = 'dalwar.hossain@protonmail.com'
__author__ = 'Dalwar Hossain' __email__ = 'dalwar.hossain@protonmail.com'
tm20 = toi = h = 0 print('-' * 25) print(' CADASTRANDO PESSOAS ') print('-' * 25) while True: id = int(input('digite a idade ')) sex = ' ' while sex not in 'MF': sex = str(input('digite o sexo')).upper() if id >= 18: toi += 1 if sex == 'M': h += 1 if sex == 'f' and id < 18: tm20 += 1 r = ' ' while r not in "SN": r = str(input('quer continuar?[s/n]')).upper() if r == 'N': break print(f' {toi} pessoas tem mais de 18 anos') print(f'o total de homens foi {h}') print(f'total de mulheres com menos de 20 anos {tm20}')
tm20 = toi = h = 0 print('-' * 25) print(' CADASTRANDO PESSOAS ') print('-' * 25) while True: id = int(input('digite a idade ')) sex = ' ' while sex not in 'MF': sex = str(input('digite o sexo')).upper() if id >= 18: toi += 1 if sex == 'M': h += 1 if sex == 'f' and id < 18: tm20 += 1 r = ' ' while r not in 'SN': r = str(input('quer continuar?[s/n]')).upper() if r == 'N': break print(f' {toi} pessoas tem mais de 18 anos') print(f'o total de homens foi {h}') print(f'total de mulheres com menos de 20 anos {tm20}')
# De uitwerking van 4-autoencoder.py moet hiervoor gedraaid worden! voorspeller = tf.keras.models.Sequential([ tf.keras.layers.Dense(200, activation=tf.nn.relu), tf.keras.layers.Dense(50, activation=tf.nn.relu), tf.keras.layers.Dense(50, activation=tf.nn.relu), tf.keras.layers.Dense(10, activation=tf.nn.softmax) ]) voorspeller.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy']) voorspeller.fit(xtr, ytr, epochs=10) print(voorspeller.evaluate(xtr, ytr)) print("Performance op ruizige getallen:") print(voorspeller.evaluate(xruis, y)) print("Performance van hetzelfde netwerk op door auto-encoder gereconstrueerde getallen:") print(voorspeller.evaluate(reconstructed, y)) print("Als het goed is, flinke winst!")
voorspeller = tf.keras.models.Sequential([tf.keras.layers.Dense(200, activation=tf.nn.relu), tf.keras.layers.Dense(50, activation=tf.nn.relu), tf.keras.layers.Dense(50, activation=tf.nn.relu), tf.keras.layers.Dense(10, activation=tf.nn.softmax)]) voorspeller.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy']) voorspeller.fit(xtr, ytr, epochs=10) print(voorspeller.evaluate(xtr, ytr)) print('Performance op ruizige getallen:') print(voorspeller.evaluate(xruis, y)) print('Performance van hetzelfde netwerk op door auto-encoder gereconstrueerde getallen:') print(voorspeller.evaluate(reconstructed, y)) print('Als het goed is, flinke winst!')
# Time: O(logn) # Space: O(1) class Solution(object): def fixedPoint(self, A): """ :type A: List[int] :rtype: int """ left, right = 0, len(A)-1 while left <= right: mid = left + (right-left)//2 if A[mid] >= mid: right = mid-1 else: left = mid+1 return left if A[left] == left else -1
class Solution(object): def fixed_point(self, A): """ :type A: List[int] :rtype: int """ (left, right) = (0, len(A) - 1) while left <= right: mid = left + (right - left) // 2 if A[mid] >= mid: right = mid - 1 else: left = mid + 1 return left if A[left] == left else -1
# model settings model = dict( type='ImageClassifier', pretrained=None, backbone=dict( type='OmzBackboneCls', mode='train', model_path='public/mobilenet-v2/FP32/mobilenet-v2.xml', last_layer_name='relu6_4', normalized_img_input=True ), neck=dict( type='GlobalAveragePooling'), head=dict( type='LinearClsHead', num_classes=1000, in_channels=1280, loss=dict(type='CrossEntropyLoss', loss_weight=1.0), ))
model = dict(type='ImageClassifier', pretrained=None, backbone=dict(type='OmzBackboneCls', mode='train', model_path='public/mobilenet-v2/FP32/mobilenet-v2.xml', last_layer_name='relu6_4', normalized_img_input=True), neck=dict(type='GlobalAveragePooling'), head=dict(type='LinearClsHead', num_classes=1000, in_channels=1280, loss=dict(type='CrossEntropyLoss', loss_weight=1.0)))
class Environment(object): def __init__(self): pass def act(self, state, action): pass def end_state(self, state): return True def reset(self): pass def available_actions(self): return None
class Environment(object): def __init__(self): pass def act(self, state, action): pass def end_state(self, state): return True def reset(self): pass def available_actions(self): return None
class NodeCalculator: @staticmethod def calculate_node_size(node, relationships): linked_tables = list() size = 0 for table_key, table_value in relationships.items(): if table_key == node: for table in relationships[table_key]: linked_tables.append(table) if len(linked_tables) == 0: size = 1 return size else: if node in linked_tables: linked_tables = [table for table in linked_tables if table != node] for table in linked_tables: for table_key, table_value in relationships.items(): if table_key == table: for table in relationships[table_key]: if table not in linked_tables: linked_tables.append(table) size = size + len(linked_tables) return size @staticmethod def calculate_usage_score(node, relationships): linked_nodes = list() for node_key, node_value in relationships.items(): if node in node_value: linked_nodes.append(node_key) used_keys = list() for node_source in linked_nodes: for node_key, node_value in relationships.items(): if node_source in node_value and node_key not in used_keys: linked_nodes.append(node_key) used_keys.append(node_key) score = len(linked_nodes) return score @staticmethod def calculate_root_score_level_0(root_scores, levels, grouped_weights): for node_level_0 in levels[0]: for weight in grouped_weights.keys(): if node_level_0 in grouped_weights[weight]: root_scores[node_level_0] = weight return root_scores @staticmethod def list_unique_nodes(relationships): unique_nodes = list() for node in relationships: unique_nodes.append(node) for relationship in relationships: for node in relationships[relationship]: if node not in unique_nodes: unique_nodes.append(node) return unique_nodes @staticmethod def calculate_root_score_remaining_levels(levels, root_scores, relationships, grouped_weights): level = 1 max_level = NodeCalculator.find_max_level(levels=levels) - 1 unique_nodes = NodeCalculator.list_unique_nodes(relationships=relationships) while level <= max_level: if level in levels: for node in levels[level]: if node in unique_nodes: node_weight = 0 for weight in grouped_weights.keys(): if node in grouped_weights[weight]: node_weight = weight all_present = 1 if node in relationships: for source in relationships[node]: if source not in root_scores: all_present = 0 if all_present == 1: if node in relationships: for source in relationships[node]: node_weight += root_scores[source] root_scores[node] = node_weight level += 1 return root_scores @staticmethod def calculate_root_scores(levels, relationships, grouped_weights): root_scores = dict() root_scores = NodeCalculator.calculate_root_score_level_0(root_scores=root_scores, grouped_weights=grouped_weights, levels=levels) root_scores = NodeCalculator.calculate_root_score_remaining_levels(root_scores=root_scores, grouped_weights=grouped_weights, relationships=relationships, levels=levels) return root_scores @staticmethod def undouble_list(list_objects): list_objects = list(set(list_objects)) return list_objects @staticmethod def check_level(levels, level): if len(levels[level]) > 0: level += 1 return level @staticmethod def list_max_level_nodes(nodes, relationships): max_nodes = list() to_do_nodes = list() for node in nodes: present = 0 for key in relationships.keys(): if node in relationships[key]: present = 1 if present == 0: max_nodes.append(node) else: to_do_nodes.append(node) max_nodes = NodeCalculator.undouble_list(list_objects=max_nodes) to_do_nodes = NodeCalculator.undouble_list(list_objects=to_do_nodes) return to_do_nodes, max_nodes @staticmethod def list_level_0(level, levels, golden_sources, nodes): levels[level] = list() to_do_nodes = list() for node in nodes: if node in golden_sources: levels[level].append(node) else: to_do_nodes.append(node) to_do_nodes = NodeCalculator.undouble_list(list_objects=to_do_nodes) levels[level] = NodeCalculator.undouble_list(list_objects=levels[level]) return to_do_nodes, levels @staticmethod def list_level_1(level, levels, nodes, relationships, golden_sources): levels[level] = list() to_do_nodes = list() for node in nodes: if node not in relationships and node not in golden_sources: levels[level].append(node) else: to_do_nodes.append(node) to_do_nodes = NodeCalculator.undouble_list(list_objects=to_do_nodes) levels[level] = NodeCalculator.undouble_list(list_objects=levels[level]) return to_do_nodes, levels @staticmethod def list_level_2(level, levels, nodes, relationships): levels[level] = list() to_do_nodes = list() for node in nodes: present = 0 for key in relationships.keys(): for source in relationships[key]: if source in nodes: present = 1 if present == 0: levels[level].append(node) else: to_do_nodes.append(node) to_do_nodes = NodeCalculator.undouble_list(list_objects=to_do_nodes) levels[level] = NodeCalculator.undouble_list(list_objects=levels[level]) return to_do_nodes, levels @staticmethod def dict_remaining_levels(nodes, level, relationships): to_do_levels = dict() for node in nodes: check_level = level level_up_nodes = list() for source in relationships[node]: if source in nodes: level_up_nodes.append(source) for level_up_node in level_up_nodes: check_level += 1 for source in relationships[level_up_node]: if source in nodes and source not in level_up_nodes: level_up_nodes.append(source) # else: # check_level -= 1 if check_level in to_do_levels: to_do_levels[check_level].append(node) else: to_do_levels[check_level] = [node] test = list() for key in to_do_levels.keys(): test.append(key) test.sort() return to_do_levels @staticmethod def combine_levels(levels, to_do_levels): levels = {**levels, **to_do_levels} return levels @staticmethod def find_max_level(levels): max_level = 0 for key in levels.keys(): if key > max_level: max_level = key max_level += 1 return max_level @staticmethod def add_max_level(levels, level, max_nodes): levels[level] = max_nodes return levels @staticmethod def calculate_levels(golden_sources, nodes, relationships): levels = dict() level = 0 # On level 0 only the golden sources will be placed. The golden sources are the absolute primitive of the # hierarchy, and should thus be placed on the absolute bottom of the hierarchy. nodes, levels = NodeCalculator.list_level_0(level=level, levels=levels, golden_sources=golden_sources, nodes=nodes) level = NodeCalculator.check_level(levels=levels, level=level) # Now we first check if we can also spot the absolute root objects. An absolute root object follows these # conditions: # [*] Not a Golden Source # [*] Is a key in the relationships dictionary # [*] Is not present as a source for any of the keys in the relationships dictionary nodes, max_nodes = NodeCalculator.list_max_level_nodes(nodes=nodes, relationships=relationships) # On level 1, we will place all the object that follow these conditions: # [*] Not a Golden Source # [*] Not a key in the relationships dictionary nodes, levels = NodeCalculator.list_level_1(level=level, levels=levels, golden_sources=golden_sources, nodes=nodes, relationships=relationships) level = NodeCalculator.check_level(levels=levels, level=level) # On level 2, we will place all the object that follow these conditions: # [*] Not a Golden Source # [*] Is a key in the relationships dictionary # [*] No connection with other objects, except for the objects in level 0 & 1 nodes, levels = NodeCalculator.list_level_2(level=level, levels=levels, nodes=nodes, relationships=relationships) level = NodeCalculator.check_level(levels=levels, level=level) # For the remaining levels, we take the following steps for each remaining node: # [1] Check for the remaining node's sources, if any of these sources are also present in the list of the # remaining networkers # [2] If former is the case, we append this source to a checklist. # [3] We iterate over every node of this list and up the level's value by one. # [4] During this iteration, we check if this node also has any sources that is in the first list. # [5] If former is the case, we check if this node is not already present in the checklist. If this is not the # case, we add it to the checklist # [6] After all the iterations have ended, we put the level as a key to a dictionary, append the node to a list # of this key to_do_levels = NodeCalculator.dict_remaining_levels(nodes=nodes, level=level, relationships=relationships) levels = NodeCalculator.combine_levels(levels=levels, to_do_levels=to_do_levels) level = NodeCalculator.find_max_level(levels=levels) levels = NodeCalculator.add_max_level(levels=levels, level=level, max_nodes=max_nodes) """ EXAMPLE: 5 'test_db_1.example_table_a' 4 'test_db_1.example_table_b' 3 'test_db_2.example_table_b' 2 'test_db_2.example_table_a', 'test_db_4.example_table_a' 1 'test_db_3.example_table_c', 'test_db_3.example_table_b', 'test_db_2.example_table_c', 'test_db_3.example_table_a' 0 'golden_source.example_table_a', 'golden_source.example_table_b' """ return levels
class Nodecalculator: @staticmethod def calculate_node_size(node, relationships): linked_tables = list() size = 0 for (table_key, table_value) in relationships.items(): if table_key == node: for table in relationships[table_key]: linked_tables.append(table) if len(linked_tables) == 0: size = 1 return size else: if node in linked_tables: linked_tables = [table for table in linked_tables if table != node] for table in linked_tables: for (table_key, table_value) in relationships.items(): if table_key == table: for table in relationships[table_key]: if table not in linked_tables: linked_tables.append(table) size = size + len(linked_tables) return size @staticmethod def calculate_usage_score(node, relationships): linked_nodes = list() for (node_key, node_value) in relationships.items(): if node in node_value: linked_nodes.append(node_key) used_keys = list() for node_source in linked_nodes: for (node_key, node_value) in relationships.items(): if node_source in node_value and node_key not in used_keys: linked_nodes.append(node_key) used_keys.append(node_key) score = len(linked_nodes) return score @staticmethod def calculate_root_score_level_0(root_scores, levels, grouped_weights): for node_level_0 in levels[0]: for weight in grouped_weights.keys(): if node_level_0 in grouped_weights[weight]: root_scores[node_level_0] = weight return root_scores @staticmethod def list_unique_nodes(relationships): unique_nodes = list() for node in relationships: unique_nodes.append(node) for relationship in relationships: for node in relationships[relationship]: if node not in unique_nodes: unique_nodes.append(node) return unique_nodes @staticmethod def calculate_root_score_remaining_levels(levels, root_scores, relationships, grouped_weights): level = 1 max_level = NodeCalculator.find_max_level(levels=levels) - 1 unique_nodes = NodeCalculator.list_unique_nodes(relationships=relationships) while level <= max_level: if level in levels: for node in levels[level]: if node in unique_nodes: node_weight = 0 for weight in grouped_weights.keys(): if node in grouped_weights[weight]: node_weight = weight all_present = 1 if node in relationships: for source in relationships[node]: if source not in root_scores: all_present = 0 if all_present == 1: if node in relationships: for source in relationships[node]: node_weight += root_scores[source] root_scores[node] = node_weight level += 1 return root_scores @staticmethod def calculate_root_scores(levels, relationships, grouped_weights): root_scores = dict() root_scores = NodeCalculator.calculate_root_score_level_0(root_scores=root_scores, grouped_weights=grouped_weights, levels=levels) root_scores = NodeCalculator.calculate_root_score_remaining_levels(root_scores=root_scores, grouped_weights=grouped_weights, relationships=relationships, levels=levels) return root_scores @staticmethod def undouble_list(list_objects): list_objects = list(set(list_objects)) return list_objects @staticmethod def check_level(levels, level): if len(levels[level]) > 0: level += 1 return level @staticmethod def list_max_level_nodes(nodes, relationships): max_nodes = list() to_do_nodes = list() for node in nodes: present = 0 for key in relationships.keys(): if node in relationships[key]: present = 1 if present == 0: max_nodes.append(node) else: to_do_nodes.append(node) max_nodes = NodeCalculator.undouble_list(list_objects=max_nodes) to_do_nodes = NodeCalculator.undouble_list(list_objects=to_do_nodes) return (to_do_nodes, max_nodes) @staticmethod def list_level_0(level, levels, golden_sources, nodes): levels[level] = list() to_do_nodes = list() for node in nodes: if node in golden_sources: levels[level].append(node) else: to_do_nodes.append(node) to_do_nodes = NodeCalculator.undouble_list(list_objects=to_do_nodes) levels[level] = NodeCalculator.undouble_list(list_objects=levels[level]) return (to_do_nodes, levels) @staticmethod def list_level_1(level, levels, nodes, relationships, golden_sources): levels[level] = list() to_do_nodes = list() for node in nodes: if node not in relationships and node not in golden_sources: levels[level].append(node) else: to_do_nodes.append(node) to_do_nodes = NodeCalculator.undouble_list(list_objects=to_do_nodes) levels[level] = NodeCalculator.undouble_list(list_objects=levels[level]) return (to_do_nodes, levels) @staticmethod def list_level_2(level, levels, nodes, relationships): levels[level] = list() to_do_nodes = list() for node in nodes: present = 0 for key in relationships.keys(): for source in relationships[key]: if source in nodes: present = 1 if present == 0: levels[level].append(node) else: to_do_nodes.append(node) to_do_nodes = NodeCalculator.undouble_list(list_objects=to_do_nodes) levels[level] = NodeCalculator.undouble_list(list_objects=levels[level]) return (to_do_nodes, levels) @staticmethod def dict_remaining_levels(nodes, level, relationships): to_do_levels = dict() for node in nodes: check_level = level level_up_nodes = list() for source in relationships[node]: if source in nodes: level_up_nodes.append(source) for level_up_node in level_up_nodes: check_level += 1 for source in relationships[level_up_node]: if source in nodes and source not in level_up_nodes: level_up_nodes.append(source) if check_level in to_do_levels: to_do_levels[check_level].append(node) else: to_do_levels[check_level] = [node] test = list() for key in to_do_levels.keys(): test.append(key) test.sort() return to_do_levels @staticmethod def combine_levels(levels, to_do_levels): levels = {**levels, **to_do_levels} return levels @staticmethod def find_max_level(levels): max_level = 0 for key in levels.keys(): if key > max_level: max_level = key max_level += 1 return max_level @staticmethod def add_max_level(levels, level, max_nodes): levels[level] = max_nodes return levels @staticmethod def calculate_levels(golden_sources, nodes, relationships): levels = dict() level = 0 (nodes, levels) = NodeCalculator.list_level_0(level=level, levels=levels, golden_sources=golden_sources, nodes=nodes) level = NodeCalculator.check_level(levels=levels, level=level) (nodes, max_nodes) = NodeCalculator.list_max_level_nodes(nodes=nodes, relationships=relationships) (nodes, levels) = NodeCalculator.list_level_1(level=level, levels=levels, golden_sources=golden_sources, nodes=nodes, relationships=relationships) level = NodeCalculator.check_level(levels=levels, level=level) (nodes, levels) = NodeCalculator.list_level_2(level=level, levels=levels, nodes=nodes, relationships=relationships) level = NodeCalculator.check_level(levels=levels, level=level) to_do_levels = NodeCalculator.dict_remaining_levels(nodes=nodes, level=level, relationships=relationships) levels = NodeCalculator.combine_levels(levels=levels, to_do_levels=to_do_levels) level = NodeCalculator.find_max_level(levels=levels) levels = NodeCalculator.add_max_level(levels=levels, level=level, max_nodes=max_nodes) "\n EXAMPLE:\n \n 5 'test_db_1.example_table_a' \n 4 'test_db_1.example_table_b'\n 3 'test_db_2.example_table_b'\n 2 'test_db_2.example_table_a', 'test_db_4.example_table_a'\n 1 'test_db_3.example_table_c', 'test_db_3.example_table_b', 'test_db_2.example_table_c', 'test_db_3.example_table_a'\n 0 'golden_source.example_table_a', 'golden_source.example_table_b'\n " return levels
# Question(#1143): Given two strings text1 and text2, return the length of their longest common subsequence. # Solution: Use the longest common susequence dynamic programming algorithm def longestCommonSubsequence(text1: str, text2: str) -> int: grid = [[0 for _ in range(len(text2)+1)] for _ in range(len(text1)+1)] for i in range(1, len(text1)+1): for j in range(1, len(text2)+1): if text1[i-1] == text2[j-1]: grid[i][j] = 1 + grid[i-1][j-1] else: grid[i][j] = max(grid[i][j-1], grid[i-1][j]) return grid[-1][-1]
def longest_common_subsequence(text1: str, text2: str) -> int: grid = [[0 for _ in range(len(text2) + 1)] for _ in range(len(text1) + 1)] for i in range(1, len(text1) + 1): for j in range(1, len(text2) + 1): if text1[i - 1] == text2[j - 1]: grid[i][j] = 1 + grid[i - 1][j - 1] else: grid[i][j] = max(grid[i][j - 1], grid[i - 1][j]) return grid[-1][-1]
""" gnmi_tools - Basic GNMI operations on a device """ __copyright__ = "Copyright (c) 2020 Cisco Systems, Inc. and/or its affiliates" __version__ = "0.1" __author__ = "Marcelo Reis" __email__ = "mareis@cisco.com" __url__ = "https://github.com/reismarcelo/gnmi_hello"
""" gnmi_tools - Basic GNMI operations on a device """ __copyright__ = 'Copyright (c) 2020 Cisco Systems, Inc. and/or its affiliates' __version__ = '0.1' __author__ = 'Marcelo Reis' __email__ = 'mareis@cisco.com' __url__ = 'https://github.com/reismarcelo/gnmi_hello'
print("Let's do Factorial") #printing the operation what we are performing def factorial(number): #defining the factorial method result = 1 # result is intially defined with 1. if we define initially with 0 the factorial will be 0. if number == 0: # if number is equals to 0, it prints 1. print("The factorial of 0 is 1") elif number < 0: # if number is negative number , it prints error message print("Error..Enter only whole numbers") else: for i in range(1, number+1): # we are using range function for multiplication of numbers result = result * i # multiplication of numbers is factorial. result is stored in result variable print("The Factorial of" ,number, "is : ", result) # result will be printed number = int(input("Enter the number: ")) # Input is taken from user factorial(number) # Function is called
print("Let's do Factorial") def factorial(number): result = 1 if number == 0: print('The factorial of 0 is 1') elif number < 0: print('Error..Enter only whole numbers') else: for i in range(1, number + 1): result = result * i print('The Factorial of', number, 'is : ', result) number = int(input('Enter the number: ')) factorial(number)
name = "glew" version = "2.1.0" authors = [ "Milan Ikits", "Marcelo Magallon", "Nigel Stewart" ] description = \ """ The OpenGL Extension Wrangler Library (GLEW) is a cross-platform open-source C/C++ extension loading library. """ requires = [ "cmake-3+", "gcc-6+" ] variants = [ ["platform-linux"] ] tools = [ "glewinfo", "visualinfo" ] build_system = "cmake" with scope("config") as config: config.build_thread_count = "logical_cores" uuid = "glew-{version}".format(version=str(version)) def commands(): env.PATH.prepend("{root}/bin") env.LD_LIBRARY_PATH.prepend("{root}/lib64") env.PKG_CONFIG_PATH.prepend("{root}/lib64/pkgconfig") env.CMAKE_MODULE_PATH.prepend("{root}/lib64/cmake/glew") # Helper environment variables. env.GLEW_BINARY_PATH.set("{root}/bin") env.GLEW_INCLUDE_PATH.set("{root}/include") env.GLEW_LIBRARY_PATH.set("{root}/lib64")
name = 'glew' version = '2.1.0' authors = ['Milan Ikits', 'Marcelo Magallon', 'Nigel Stewart'] description = '\n The OpenGL Extension Wrangler Library (GLEW) is a cross-platform open-source C/C++ extension loading library.\n ' requires = ['cmake-3+', 'gcc-6+'] variants = [['platform-linux']] tools = ['glewinfo', 'visualinfo'] build_system = 'cmake' with scope('config') as config: config.build_thread_count = 'logical_cores' uuid = 'glew-{version}'.format(version=str(version)) def commands(): env.PATH.prepend('{root}/bin') env.LD_LIBRARY_PATH.prepend('{root}/lib64') env.PKG_CONFIG_PATH.prepend('{root}/lib64/pkgconfig') env.CMAKE_MODULE_PATH.prepend('{root}/lib64/cmake/glew') env.GLEW_BINARY_PATH.set('{root}/bin') env.GLEW_INCLUDE_PATH.set('{root}/include') env.GLEW_LIBRARY_PATH.set('{root}/lib64')
#!/usr/bin/env python include = "$chrs".replace("[", "").replace("]", "").replace(" ", "").split(",") ref = "$reference" with open(ref) as ifh, open("include.bed", "w") as ofh: for line in ifh: toks = line.strip().split("\\t") if toks[0] in include: print(toks[0], 0, toks[1], sep="\\t", file=ofh)
include = '$chrs'.replace('[', '').replace(']', '').replace(' ', '').split(',') ref = '$reference' with open(ref) as ifh, open('include.bed', 'w') as ofh: for line in ifh: toks = line.strip().split('\\t') if toks[0] in include: print(toks[0], 0, toks[1], sep='\\t', file=ofh)
# Modify the program to show the numbers from 50 to 100 x=50 while x<=100: print(x) x=x+1
x = 50 while x <= 100: print(x) x = x + 1
# Number of queens print("Enter the number of queens") N = int(input()) # chessboard # NxN matrix with all elements 0 board = [[0]*N for _ in range(N)] def is_attack(i, j): # checking if there is a queen in row or column for k in range(0, N): if board[i][k] == 1 or board[k][j] == 1: return True # checking diagonals for k in range(0, N): for l in range(0, N): if (k+l == i+j) or (k-l == i-j): if board[k][l] == 1: return True return False def N_queen(n): # if n is 0, solution found if n == 0: return True for i in range(0, N): for j in range(0, N): '''checking if we can place a queen here or not queen will not be placed if the place is being attacked or already occupied''' if (not(is_attack(i, j))) and (board[i][j] != 1): board[i][j] = 1 # recursion # wether we can put the next queen with this arrangment or not if N_queen(n-1) == True: return True board[i][j] = 0 return False N_queen(N) for i in board: print(i)
print('Enter the number of queens') n = int(input()) board = [[0] * N for _ in range(N)] def is_attack(i, j): for k in range(0, N): if board[i][k] == 1 or board[k][j] == 1: return True for k in range(0, N): for l in range(0, N): if k + l == i + j or k - l == i - j: if board[k][l] == 1: return True return False def n_queen(n): if n == 0: return True for i in range(0, N): for j in range(0, N): 'checking if we can place a queen here or not\n queen will not be placed if the place is being attacked\n or already occupied' if not is_attack(i, j) and board[i][j] != 1: board[i][j] = 1 if n_queen(n - 1) == True: return True board[i][j] = 0 return False n_queen(N) for i in board: print(i)
class Device(object): """Device. :param id: Unique identifier for the device. :type id: str :param name: The name of the device. :type name: str """ def __init__(self, data=None): if data is None: data = {} self.id = data.get('id', None) self.name = data.get('name', None)
class Device(object): """Device. :param id: Unique identifier for the device. :type id: str :param name: The name of the device. :type name: str """ def __init__(self, data=None): if data is None: data = {} self.id = data.get('id', None) self.name = data.get('name', None)
start_inventory = 20 num_items = start_inventory while num_items > 0: print("We have " + str(num_items) + " items in inventory.") user_purchase = input("How many would you like to buy? ") if int(user_purchase) > num_items: print("Not Enough Stock") else: num_items = num_items - int(user_purchase) print("All out!")
start_inventory = 20 num_items = start_inventory while num_items > 0: print('We have ' + str(num_items) + ' items in inventory.') user_purchase = input('How many would you like to buy? ') if int(user_purchase) > num_items: print('Not Enough Stock') else: num_items = num_items - int(user_purchase) print('All out!')
first_list = range(11) second_list = range(1,12) ziplist = list(zip(first_list, second_list)) def square(a, b): return (a*a) + (b*b) + 2 * a * b # output = [square(item[0], item[1]) for item in ziplist] output = [square(a, b) for a, b in ziplist] print(output) def square2(pair): a = pair[0] b = pair[1] return (a*a) + (b*b) + 2 * a * b map_list = list(map(square2, ziplist)) print(map_list)
first_list = range(11) second_list = range(1, 12) ziplist = list(zip(first_list, second_list)) def square(a, b): return a * a + b * b + 2 * a * b output = [square(a, b) for (a, b) in ziplist] print(output) def square2(pair): a = pair[0] b = pair[1] return a * a + b * b + 2 * a * b map_list = list(map(square2, ziplist)) print(map_list)
class Quest: def __init__(self, dbRow): self.id = dbRow[0] self.name = dbRow[1] self.description = dbRow[2] self.objective = dbRow[3] self.questType = dbRow[4] self.category = dbRow[5] self.location = dbRow[6] self.stars = dbRow[7] self.zenny = dbRow[8] def __repr__(self): return f"{self.__dict__!r}"
class Quest: def __init__(self, dbRow): self.id = dbRow[0] self.name = dbRow[1] self.description = dbRow[2] self.objective = dbRow[3] self.questType = dbRow[4] self.category = dbRow[5] self.location = dbRow[6] self.stars = dbRow[7] self.zenny = dbRow[8] def __repr__(self): return f'{self.__dict__!r}'
r""" cgtasknet is a library for training spiking neural networks with cognitive tasks """
""" cgtasknet is a library for training spiking neural networks with cognitive tasks """
termination = 4000000 previous = 1 current = 2 total = 2 while(True): new = current+ previous previous = current current = new if(current >= termination): break if(current % 2 == 0): total = total + current print(total)
termination = 4000000 previous = 1 current = 2 total = 2 while True: new = current + previous previous = current current = new if current >= termination: break if current % 2 == 0: total = total + current print(total)
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.0980777, 'Execution Unit/Complex ALUs/Runtime Dynamic': 0.279723, '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.394, '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.148207, '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.256641, '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.147191, '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.55204, '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.0860909, '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.81603, '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.0744351, 'Execution Unit/Register Files/Floating Point RF/Runtime Dynamic': 0.00537263, '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.0810849, 'Execution Unit/Register Files/Integer RF/Runtime Dynamic': 0.0397339, '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.15552, 'Execution Unit/Register Files/Runtime Dynamic': 0.0451065, '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.222804, 'Execution Unit/Results Broadcast Bus/Runtime Dynamic': 0.402293, '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.68454, '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.000225002, '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.000225002, '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.000194444, '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': 7.44341e-05, '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.000570781, '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.00121523, '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.00221206, '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.0381972, '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.42967, 'Instruction Fetch Unit/Instruction Cache/Runtime Dynamic': 0.0551552, '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.129735, '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.76791, 'Instruction Fetch Unit/Runtime Dynamic': 0.226515, '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.0140516, 'L2/Runtime Dynamic': 0.00517116, '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': 1.57809, 'Load Store Unit/Data Cache/Runtime Dynamic': 0.182297, '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.0110311, 'Load Store Unit/LoadQ/Runtime Dynamic': 0.0110311, '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.63039, 'Load Store Unit/Runtime Dynamic': 0.247729, 'Load Store Unit/StoreQ/Area': 0.322079, 'Load Store Unit/StoreQ/Gate Leakage': 0.00329971, 'Load Store Unit/StoreQ/Peak Dynamic': 0.0272009, 'Load Store Unit/StoreQ/Runtime Dynamic': 0.0544015, '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.0096537, 'Memory Management Unit/Dtlb/Runtime Dynamic': 0.00986453, '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.151068, 'Memory Management Unit/Itlb/Runtime Dynamic': 0.00904231, '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.326256, 'Memory Management Unit/Runtime Dynamic': 0.0189068, 'Memory Management Unit/Subthreshold Leakage': 0.0769113, 'Memory Management Unit/Subthreshold Leakage with power gating': 0.0399462, 'Peak Dynamic': 17.1163, '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.259687, '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.0107034, '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.0719334, '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.342324, 'Renaming Unit/Subthreshold Leakage': 0.070483, 'Renaming Unit/Subthreshold Leakage with power gating': 0.0362779, 'Runtime Dynamic': 2.52519, '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.0982865, 'Execution Unit/Complex ALUs/Runtime Dynamic': 0.279887, '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.394843, '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.123408, '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.199053, '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.100475, '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.422937, '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.0806077, '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.75412, '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.0745942, 'Execution Unit/Register Files/Floating Point RF/Runtime Dynamic': 0.0051763, '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.0797547, 'Execution Unit/Register Files/Integer RF/Runtime Dynamic': 0.0382819, '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.154349, 'Execution Unit/Register Files/Runtime Dynamic': 0.0434582, '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.192598, 'Execution Unit/Results Broadcast Bus/Runtime Dynamic': 0.345046, '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.49671, '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.000196117, '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.000196117, '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.000169484, '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': 6.48802e-05, '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.000549923, '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.00111164, '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.00192802, '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.0368014, '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.34089, 'Instruction Fetch Unit/Instruction Cache/Runtime Dynamic': 0.0552637, '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.124994, '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.67301, 'Instruction Fetch Unit/Runtime Dynamic': 0.220099, '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.0129726, 'L2/Runtime Dynamic': 0.00485966, '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.53514, 'Load Store Unit/Data Cache/Runtime Dynamic': 0.160709, '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.00964176, 'Load Store Unit/LoadQ/Runtime Dynamic': 0.00964166, '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.58067, 'Load Store Unit/Runtime Dynamic': 0.2179, 'Load Store Unit/StoreQ/Area': 0.322079, 'Load Store Unit/StoreQ/Gate Leakage': 0.00329971, 'Load Store Unit/StoreQ/Peak Dynamic': 0.0237749, 'Load Store Unit/StoreQ/Runtime Dynamic': 0.0475494, '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.0084378, 'Memory Management Unit/Dtlb/Runtime Dynamic': 0.00863242, '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.145548, 'Memory Management Unit/Itlb/Runtime Dynamic': 0.00906, '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.316151, 'Memory Management Unit/Runtime Dynamic': 0.0176924, 'Memory Management Unit/Subthreshold Leakage': 0.0766103, 'Memory Management Unit/Subthreshold Leakage with power gating': 0.0398333, 'Peak Dynamic': 14.9264, '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.196223, '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.00795584, '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.0588229, '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.263002, 'Renaming Unit/Subthreshold Leakage': 0.0552466, 'Renaming Unit/Subthreshold Leakage with power gating': 0.0276461, 'Runtime Dynamic': 2.22026, '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.0978179, 'Execution Unit/Complex ALUs/Runtime Dynamic': 0.279519, '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.392958, '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.123829, '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.199732, '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.100818, '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.424379, '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.081378, '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.75194, '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.0742381, 'Execution Unit/Register Files/Floating Point RF/Runtime Dynamic': 0.00519396, '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.0796807, 'Execution Unit/Register Files/Integer RF/Runtime Dynamic': 0.0384125, '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.153919, 'Execution Unit/Register Files/Runtime Dynamic': 0.0436065, '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.192325, 'Execution Unit/Results Broadcast Bus/Runtime Dynamic': 0.345489, '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.49837, '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.000199387, '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.000199387, '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.000172309, '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': 6.59614e-05, '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.000551799, '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.00112288, '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.0019602, '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.0369269, '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.34887, 'Instruction Fetch Unit/Instruction Cache/Runtime Dynamic': 0.0549932, '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.12542, '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.68138, 'Instruction Fetch Unit/Runtime Dynamic': 0.220424, '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.013049, 'L2/Runtime Dynamic': 0.0049262, '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.54336, 'Load Store Unit/Data Cache/Runtime Dynamic': 0.164681, '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.00990766, 'Load Store Unit/LoadQ/Runtime Dynamic': 0.00990762, '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.59015, 'Load Store Unit/Runtime Dynamic': 0.22345, 'Load Store Unit/StoreQ/Area': 0.322079, 'Load Store Unit/StoreQ/Gate Leakage': 0.00329971, 'Load Store Unit/StoreQ/Peak Dynamic': 0.0244306, 'Load Store Unit/StoreQ/Runtime Dynamic': 0.048861, '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.0086705, 'Memory Management Unit/Dtlb/Runtime Dynamic': 0.00886632, '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.146044, 'Memory Management Unit/Itlb/Runtime Dynamic': 0.00901559, '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.317047, 'Memory Management Unit/Runtime Dynamic': 0.0178819, 'Memory Management Unit/Subthreshold Leakage': 0.0766103, 'Memory Management Unit/Subthreshold Leakage with power gating': 0.0398333, 'Peak Dynamic': 14.943, '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.195287, '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.00796344, '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.0590762, '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.262327, 'Renaming Unit/Subthreshold Leakage': 0.0552466, 'Renaming Unit/Subthreshold Leakage with power gating': 0.0276461, 'Runtime Dynamic': 2.22738, '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.0979794, 'Execution Unit/Complex ALUs/Runtime Dynamic': 0.279646, '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.393608, '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.123725, '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.199564, '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.100733, '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.424022, '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.0811593, '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.75278, '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.074361, 'Execution Unit/Register Files/Floating Point RF/Runtime Dynamic': 0.00518958, '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.0797187, 'Execution Unit/Register Files/Integer RF/Runtime Dynamic': 0.0383801, '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.15408, 'Execution Unit/Register Files/Runtime Dynamic': 0.0435697, '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.192445, 'Execution Unit/Results Broadcast Bus/Runtime Dynamic': 0.345389, '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.498, '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.000197415, '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.000197415, '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.000170604, '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': 6.53086e-05, '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.000551334, '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.00111677, '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.00194081, '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.0368958, '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.34689, 'Instruction Fetch Unit/Instruction Cache/Runtime Dynamic': 0.0550619, '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.125315, '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.6793, 'Instruction Fetch Unit/Runtime Dynamic': 0.22033, '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.0131558, 'L2/Runtime Dynamic': 0.0049838, '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.5413, 'Load Store Unit/Data Cache/Runtime Dynamic': 0.163934, '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.00984081, 'Load Store Unit/LoadQ/Runtime Dynamic': 0.0098409, '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.58777, 'Load Store Unit/Runtime Dynamic': 0.222306, 'Load Store Unit/StoreQ/Area': 0.322079, 'Load Store Unit/StoreQ/Gate Leakage': 0.00329971, 'Load Store Unit/StoreQ/Peak Dynamic': 0.0242658, 'Load Store Unit/StoreQ/Runtime Dynamic': 0.048532, '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.008612, 'Memory Management Unit/Dtlb/Runtime Dynamic': 0.00880954, '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.145921, 'Memory Management Unit/Itlb/Runtime Dynamic': 0.00902684, '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.316824, 'Memory Management Unit/Runtime Dynamic': 0.0178364, 'Memory Management Unit/Subthreshold Leakage': 0.0766103, 'Memory Management Unit/Subthreshold Leakage with power gating': 0.0398333, 'Peak Dynamic': 14.9393, '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.195609, '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.00796266, '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.0590131, '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.262585, 'Renaming Unit/Subthreshold Leakage': 0.0552466, 'Renaming Unit/Subthreshold Leakage with power gating': 0.0276461, 'Runtime Dynamic': 2.22605, 'Subthreshold Leakage': 6.16288, 'Subthreshold Leakage with power gating': 2.55328}], 'DRAM': {'Area': 0, 'Gate Leakage': 0, 'Peak Dynamic': 1.2868175454447888, 'Runtime Dynamic': 1.2868175454447888, 'Subthreshold Leakage': 4.252, 'Subthreshold Leakage with power gating': 4.252}, 'L3': [{'Area': 61.9075, 'Gate Leakage': 0.0484137, 'Peak Dynamic': 0.0451325, 'Runtime Dynamic': 0.0231622, 'Subthreshold Leakage': 6.80085, 'Subthreshold Leakage with power gating': 3.32364}], 'Processor': {'Area': 191.908, 'Gate Leakage': 1.53485, 'Peak Dynamic': 61.9702, 'Peak Power': 95.0824, 'Runtime Dynamic': 9.22203, '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': 61.9251, 'Total Cores/Runtime Dynamic': 9.19887, '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.0451325, 'Total L3s/Runtime Dynamic': 0.0231622, '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}}
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.0980777, 'Execution Unit/Complex ALUs/Runtime Dynamic': 0.279723, '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.394, '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.148207, '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.256641, '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.147191, '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.55204, '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.0860909, '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.81603, '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.0744351, 'Execution Unit/Register Files/Floating Point RF/Runtime Dynamic': 0.00537263, '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.0810849, 'Execution Unit/Register Files/Integer RF/Runtime Dynamic': 0.0397339, '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.15552, 'Execution Unit/Register Files/Runtime Dynamic': 0.0451065, '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.222804, 'Execution Unit/Results Broadcast Bus/Runtime Dynamic': 0.402293, '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.68454, '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.000225002, '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.000225002, '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.000194444, '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': 7.44341e-05, '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.000570781, '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.00121523, '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.00221206, '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.0381972, '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.42967, 'Instruction Fetch Unit/Instruction Cache/Runtime Dynamic': 0.0551552, '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.129735, '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.76791, 'Instruction Fetch Unit/Runtime Dynamic': 0.226515, '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.0140516, 'L2/Runtime Dynamic': 0.00517116, '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': 1.57809, 'Load Store Unit/Data Cache/Runtime Dynamic': 0.182297, '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.0110311, 'Load Store Unit/LoadQ/Runtime Dynamic': 0.0110311, '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.63039, 'Load Store Unit/Runtime Dynamic': 0.247729, 'Load Store Unit/StoreQ/Area': 0.322079, 'Load Store Unit/StoreQ/Gate Leakage': 0.00329971, 'Load Store Unit/StoreQ/Peak Dynamic': 0.0272009, 'Load Store Unit/StoreQ/Runtime Dynamic': 0.0544015, '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.0096537, 'Memory Management Unit/Dtlb/Runtime Dynamic': 0.00986453, '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.151068, 'Memory Management Unit/Itlb/Runtime Dynamic': 0.00904231, '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.326256, 'Memory Management Unit/Runtime Dynamic': 0.0189068, 'Memory Management Unit/Subthreshold Leakage': 0.0769113, 'Memory Management Unit/Subthreshold Leakage with power gating': 0.0399462, 'Peak Dynamic': 17.1163, '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.259687, '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.0107034, '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.0719334, '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.342324, 'Renaming Unit/Subthreshold Leakage': 0.070483, 'Renaming Unit/Subthreshold Leakage with power gating': 0.0362779, 'Runtime Dynamic': 2.52519, '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.0982865, 'Execution Unit/Complex ALUs/Runtime Dynamic': 0.279887, '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.394843, '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.123408, '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.199053, '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.100475, '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.422937, '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.0806077, '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.75412, '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.0745942, 'Execution Unit/Register Files/Floating Point RF/Runtime Dynamic': 0.0051763, '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.0797547, 'Execution Unit/Register Files/Integer RF/Runtime Dynamic': 0.0382819, '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.154349, 'Execution Unit/Register Files/Runtime Dynamic': 0.0434582, '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.192598, 'Execution Unit/Results Broadcast Bus/Runtime Dynamic': 0.345046, '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.49671, '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.000196117, '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.000196117, '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.000169484, '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': 6.48802e-05, '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.000549923, '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.00111164, '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.00192802, '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.0368014, '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.34089, 'Instruction Fetch Unit/Instruction Cache/Runtime Dynamic': 0.0552637, '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.124994, '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.67301, 'Instruction Fetch Unit/Runtime Dynamic': 0.220099, '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.0129726, 'L2/Runtime Dynamic': 0.00485966, '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.53514, 'Load Store Unit/Data Cache/Runtime Dynamic': 0.160709, '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.00964176, 'Load Store Unit/LoadQ/Runtime Dynamic': 0.00964166, '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.58067, 'Load Store Unit/Runtime Dynamic': 0.2179, 'Load Store Unit/StoreQ/Area': 0.322079, 'Load Store Unit/StoreQ/Gate Leakage': 0.00329971, 'Load Store Unit/StoreQ/Peak Dynamic': 0.0237749, 'Load Store Unit/StoreQ/Runtime Dynamic': 0.0475494, '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.0084378, 'Memory Management Unit/Dtlb/Runtime Dynamic': 0.00863242, '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.145548, 'Memory Management Unit/Itlb/Runtime Dynamic': 0.00906, '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.316151, 'Memory Management Unit/Runtime Dynamic': 0.0176924, 'Memory Management Unit/Subthreshold Leakage': 0.0766103, 'Memory Management Unit/Subthreshold Leakage with power gating': 0.0398333, 'Peak Dynamic': 14.9264, '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.196223, '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.00795584, '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.0588229, '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.263002, 'Renaming Unit/Subthreshold Leakage': 0.0552466, 'Renaming Unit/Subthreshold Leakage with power gating': 0.0276461, 'Runtime Dynamic': 2.22026, '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.0978179, 'Execution Unit/Complex ALUs/Runtime Dynamic': 0.279519, '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.392958, '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.123829, '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.199732, '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.100818, '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.424379, '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.081378, '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.75194, '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.0742381, 'Execution Unit/Register Files/Floating Point RF/Runtime Dynamic': 0.00519396, '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.0796807, 'Execution Unit/Register Files/Integer RF/Runtime Dynamic': 0.0384125, '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.153919, 'Execution Unit/Register Files/Runtime Dynamic': 0.0436065, '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.192325, 'Execution Unit/Results Broadcast Bus/Runtime Dynamic': 0.345489, '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.49837, '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.000199387, '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.000199387, '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.000172309, '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': 6.59614e-05, '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.000551799, '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.00112288, '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.0019602, '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.0369269, '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.34887, 'Instruction Fetch Unit/Instruction Cache/Runtime Dynamic': 0.0549932, '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.12542, '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.68138, 'Instruction Fetch Unit/Runtime Dynamic': 0.220424, '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.013049, 'L2/Runtime Dynamic': 0.0049262, '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.54336, 'Load Store Unit/Data Cache/Runtime Dynamic': 0.164681, '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.00990766, 'Load Store Unit/LoadQ/Runtime Dynamic': 0.00990762, '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.59015, 'Load Store Unit/Runtime Dynamic': 0.22345, 'Load Store Unit/StoreQ/Area': 0.322079, 'Load Store Unit/StoreQ/Gate Leakage': 0.00329971, 'Load Store Unit/StoreQ/Peak Dynamic': 0.0244306, 'Load Store Unit/StoreQ/Runtime Dynamic': 0.048861, '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.0086705, 'Memory Management Unit/Dtlb/Runtime Dynamic': 0.00886632, '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.146044, 'Memory Management Unit/Itlb/Runtime Dynamic': 0.00901559, '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.317047, 'Memory Management Unit/Runtime Dynamic': 0.0178819, 'Memory Management Unit/Subthreshold Leakage': 0.0766103, 'Memory Management Unit/Subthreshold Leakage with power gating': 0.0398333, 'Peak Dynamic': 14.943, '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.195287, '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.00796344, '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.0590762, '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.262327, 'Renaming Unit/Subthreshold Leakage': 0.0552466, 'Renaming Unit/Subthreshold Leakage with power gating': 0.0276461, 'Runtime Dynamic': 2.22738, '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.0979794, 'Execution Unit/Complex ALUs/Runtime Dynamic': 0.279646, '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.393608, '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.123725, '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.199564, '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.100733, '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.424022, '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.0811593, '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.75278, '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.074361, 'Execution Unit/Register Files/Floating Point RF/Runtime Dynamic': 0.00518958, '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.0797187, 'Execution Unit/Register Files/Integer RF/Runtime Dynamic': 0.0383801, '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.15408, 'Execution Unit/Register Files/Runtime Dynamic': 0.0435697, '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.192445, 'Execution Unit/Results Broadcast Bus/Runtime Dynamic': 0.345389, '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.498, '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.000197415, '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.000197415, '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.000170604, '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': 6.53086e-05, '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.000551334, '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.00111677, '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.00194081, '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.0368958, '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.34689, 'Instruction Fetch Unit/Instruction Cache/Runtime Dynamic': 0.0550619, '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.125315, '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.6793, 'Instruction Fetch Unit/Runtime Dynamic': 0.22033, '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.0131558, 'L2/Runtime Dynamic': 0.0049838, '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.5413, 'Load Store Unit/Data Cache/Runtime Dynamic': 0.163934, '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.00984081, 'Load Store Unit/LoadQ/Runtime Dynamic': 0.0098409, '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.58777, 'Load Store Unit/Runtime Dynamic': 0.222306, 'Load Store Unit/StoreQ/Area': 0.322079, 'Load Store Unit/StoreQ/Gate Leakage': 0.00329971, 'Load Store Unit/StoreQ/Peak Dynamic': 0.0242658, 'Load Store Unit/StoreQ/Runtime Dynamic': 0.048532, '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.008612, 'Memory Management Unit/Dtlb/Runtime Dynamic': 0.00880954, '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.145921, 'Memory Management Unit/Itlb/Runtime Dynamic': 0.00902684, '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.316824, 'Memory Management Unit/Runtime Dynamic': 0.0178364, 'Memory Management Unit/Subthreshold Leakage': 0.0766103, 'Memory Management Unit/Subthreshold Leakage with power gating': 0.0398333, 'Peak Dynamic': 14.9393, '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.195609, '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.00796266, '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.0590131, '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.262585, 'Renaming Unit/Subthreshold Leakage': 0.0552466, 'Renaming Unit/Subthreshold Leakage with power gating': 0.0276461, 'Runtime Dynamic': 2.22605, 'Subthreshold Leakage': 6.16288, 'Subthreshold Leakage with power gating': 2.55328}], 'DRAM': {'Area': 0, 'Gate Leakage': 0, 'Peak Dynamic': 1.2868175454447888, 'Runtime Dynamic': 1.2868175454447888, 'Subthreshold Leakage': 4.252, 'Subthreshold Leakage with power gating': 4.252}, 'L3': [{'Area': 61.9075, 'Gate Leakage': 0.0484137, 'Peak Dynamic': 0.0451325, 'Runtime Dynamic': 0.0231622, 'Subthreshold Leakage': 6.80085, 'Subthreshold Leakage with power gating': 3.32364}], 'Processor': {'Area': 191.908, 'Gate Leakage': 1.53485, 'Peak Dynamic': 61.9702, 'Peak Power': 95.0824, 'Runtime Dynamic': 9.22203, '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': 61.9251, 'Total Cores/Runtime Dynamic': 9.19887, '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.0451325, 'Total L3s/Runtime Dynamic': 0.0231622, '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}}
def assign_ROSCO_values(wt_opt, modeling_options, control): # ROSCO tuning parameters wt_opt['tune_rosco_ivc.PC_omega'] = control['pitch']['PC_omega'] wt_opt['tune_rosco_ivc.PC_zeta'] = control['pitch']['PC_zeta'] wt_opt['tune_rosco_ivc.VS_omega'] = control['torque']['VS_omega'] wt_opt['tune_rosco_ivc.VS_zeta'] = control['torque']['VS_zeta'] if modeling_options['Level3']['ROSCO']['Flp_Mode'] > 0: wt_opt['tune_rosco_ivc.Flp_omega'] = control['dac']['Flp_omega'] wt_opt['tune_rosco_ivc.Flp_zeta'] = control['dac']['Flp_zeta'] if 'IPC' in control.keys(): wt_opt['tune_rosco_ivc.IPC_KI'] = control['IPC']['IPC_gain_1P'] # # other optional parameters wt_opt['tune_rosco_ivc.max_pitch'] = control['pitch']['max_pitch'] wt_opt['tune_rosco_ivc.min_pitch'] = control['pitch']['min_pitch'] wt_opt['tune_rosco_ivc.vs_minspd'] = control['torque']['VS_minspd'] wt_opt['tune_rosco_ivc.ss_vsgain'] = control['setpoint_smooth']['ss_vsgain'] wt_opt['tune_rosco_ivc.ss_pcgain'] = control['setpoint_smooth']['ss_pcgain'] wt_opt['tune_rosco_ivc.ps_percent'] = control['pitch']['ps_percent'] # Check for proper Flp_Mode, print warning if modeling_options['WISDEM']['RotorSE']['n_tab'] > 1 and modeling_options['Level3']['ROSCO']['Flp_Mode'] == 0: raise Exception('A distributed aerodynamic control device is specified in the geometry yaml, but Flp_Mode is zero in the modeling options.') if modeling_options['WISDEM']['RotorSE']['n_tab'] == 1 and modeling_options['Level3']['ROSCO']['Flp_Mode'] > 0: raise Exception('Flp_Mode is non zero in the modeling options, but no distributed aerodynamic control device is specified in the geometry yaml.') return wt_opt
def assign_rosco_values(wt_opt, modeling_options, control): wt_opt['tune_rosco_ivc.PC_omega'] = control['pitch']['PC_omega'] wt_opt['tune_rosco_ivc.PC_zeta'] = control['pitch']['PC_zeta'] wt_opt['tune_rosco_ivc.VS_omega'] = control['torque']['VS_omega'] wt_opt['tune_rosco_ivc.VS_zeta'] = control['torque']['VS_zeta'] if modeling_options['Level3']['ROSCO']['Flp_Mode'] > 0: wt_opt['tune_rosco_ivc.Flp_omega'] = control['dac']['Flp_omega'] wt_opt['tune_rosco_ivc.Flp_zeta'] = control['dac']['Flp_zeta'] if 'IPC' in control.keys(): wt_opt['tune_rosco_ivc.IPC_KI'] = control['IPC']['IPC_gain_1P'] wt_opt['tune_rosco_ivc.max_pitch'] = control['pitch']['max_pitch'] wt_opt['tune_rosco_ivc.min_pitch'] = control['pitch']['min_pitch'] wt_opt['tune_rosco_ivc.vs_minspd'] = control['torque']['VS_minspd'] wt_opt['tune_rosco_ivc.ss_vsgain'] = control['setpoint_smooth']['ss_vsgain'] wt_opt['tune_rosco_ivc.ss_pcgain'] = control['setpoint_smooth']['ss_pcgain'] wt_opt['tune_rosco_ivc.ps_percent'] = control['pitch']['ps_percent'] if modeling_options['WISDEM']['RotorSE']['n_tab'] > 1 and modeling_options['Level3']['ROSCO']['Flp_Mode'] == 0: raise exception('A distributed aerodynamic control device is specified in the geometry yaml, but Flp_Mode is zero in the modeling options.') if modeling_options['WISDEM']['RotorSE']['n_tab'] == 1 and modeling_options['Level3']['ROSCO']['Flp_Mode'] > 0: raise exception('Flp_Mode is non zero in the modeling options, but no distributed aerodynamic control device is specified in the geometry yaml.') return wt_opt
# Tuples # Assignment 1 tuple_numbers = (1, 2, 3, 4, 5) tuple_groceries = ('coconuts', 'bananas', 'onions', 'spinach', 'tomatoes', 'cilantro', 'milk') groceries_inventory = ('coconuts', 'tomatoes', 'onions', 'coconuts', 'bananas', 'onions', 'spinach', 'tomatoes', 'cilantro', 'milk', 'spinach', 'tomatoes', 'cilantro', 'tomatoes') tuple_nested =((1, 2, 3), ["Python", "Database", "System"], 'Coding') tuple_numbers_100s = (100, 200, 300, 400, 500) # Print 3rd item from tuple_groceries print("*" * 50) print("The 3rd item of tuple_groceries :", tuple_groceries[2]) # Print the length of tuple_groceries print("*" * 50) print("The length of tuple_groceries :", len(tuple_groceries)) # Print the reverse of tuple_numbers & tuples_names print("*" * 50) tuple_groceries_rev = tuple(reversed(tuple_groceries)) print("Reverse of tuple_groceries :", tuple_groceries_rev) # Print "Python" from "tuple_nested" print("*" * 50) print(tuple_nested[1][0]) # Unpack tuple_groceries tuple and print them print("*" * 50) print("Unpacking...") g1, g2, g3, g4, g5, g6, g7, = tuple_groceries print(g1) print(g1) print(g2) print(g3) print(g4) print(g5) print(g6) print(g7) # Swap tuple_numbers and tuple_numbers_100s print("*" * 50) print("Swapping...") tuple_numbers, tuple_numbers_100s = tuple_numbers_100s, tuple_numbers print("tuple_numbers_100s :", tuple_numbers_100s) print("tuple_numbers :", tuple_numbers) # Construct a new tuple "tuples_a" by extracting # bananas, onions, spinach from tuples_groceries print("*" * 50) print("Subset items.... bananas, onions, spinach") tuples_a = tuple_groceries[1:4] print("tuples_a :", tuples_a) # Count the number of times coconuts is listed in groceries_inventory tuple print("*" * 50) print("Count the number of times coconuts...") coconut_count = groceries_inventory.count("coconuts") print("coconuts :", coconut_count)
tuple_numbers = (1, 2, 3, 4, 5) tuple_groceries = ('coconuts', 'bananas', 'onions', 'spinach', 'tomatoes', 'cilantro', 'milk') groceries_inventory = ('coconuts', 'tomatoes', 'onions', 'coconuts', 'bananas', 'onions', 'spinach', 'tomatoes', 'cilantro', 'milk', 'spinach', 'tomatoes', 'cilantro', 'tomatoes') tuple_nested = ((1, 2, 3), ['Python', 'Database', 'System'], 'Coding') tuple_numbers_100s = (100, 200, 300, 400, 500) print('*' * 50) print('The 3rd item of tuple_groceries :', tuple_groceries[2]) print('*' * 50) print('The length of tuple_groceries :', len(tuple_groceries)) print('*' * 50) tuple_groceries_rev = tuple(reversed(tuple_groceries)) print('Reverse of tuple_groceries :', tuple_groceries_rev) print('*' * 50) print(tuple_nested[1][0]) print('*' * 50) print('Unpacking...') (g1, g2, g3, g4, g5, g6, g7) = tuple_groceries print(g1) print(g1) print(g2) print(g3) print(g4) print(g5) print(g6) print(g7) print('*' * 50) print('Swapping...') (tuple_numbers, tuple_numbers_100s) = (tuple_numbers_100s, tuple_numbers) print('tuple_numbers_100s :', tuple_numbers_100s) print('tuple_numbers :', tuple_numbers) print('*' * 50) print('Subset items.... bananas, onions, spinach') tuples_a = tuple_groceries[1:4] print('tuples_a :', tuples_a) print('*' * 50) print('Count the number of times coconuts...') coconut_count = groceries_inventory.count('coconuts') print('coconuts :', coconut_count)
class QueryToken: """A placeholder token for dry-run query output""" def __str__(self) -> str: return "?" def __repr__(self) -> str: return "?"
class Querytoken: """A placeholder token for dry-run query output""" def __str__(self) -> str: return '?' def __repr__(self) -> str: return '?'
class Solution: def minMeetingRooms(self, intervals: list[list[int]]) -> int: start = sorted([i[0] for i in intervals]) end = sorted(i[1] for i in intervals) result = count = 0 s, e = 0, 0 while s < len(intervals): if start[s] < end[e]: s += 1 count += 1 else: e += 1 count -= 1 result = max(result, count) return result
class Solution: def min_meeting_rooms(self, intervals: list[list[int]]) -> int: start = sorted([i[0] for i in intervals]) end = sorted((i[1] for i in intervals)) result = count = 0 (s, e) = (0, 0) while s < len(intervals): if start[s] < end[e]: s += 1 count += 1 else: e += 1 count -= 1 result = max(result, count) return result