content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class Obj(object): def __init__(self, filename): with open(filename) as f: self.lines = f.read().splitlines() self.vertices = [] self.vfaces = [] self.read() def read(self): for line in self.lines: if line: prefix, value = line.split(' ', 1) if prefix == 'v': self.vertices.append(list(map(float, value.split(' ')))) elif prefix == 'f': self.vfaces.append([list(map(int, face.split('/'))) for face in value.split(' ')])
class Obj(object): def __init__(self, filename): with open(filename) as f: self.lines = f.read().splitlines() self.vertices = [] self.vfaces = [] self.read() def read(self): for line in self.lines: if line: (prefix, value) = line.split(' ', 1) if prefix == 'v': self.vertices.append(list(map(float, value.split(' ')))) elif prefix == 'f': self.vfaces.append([list(map(int, face.split('/'))) for face in value.split(' ')])
# Consider a row of n coins of values v1 . . . vn, where n is even. # We play a game against an opponent by alternating turns. In each turn, # a player selects either the first or last coin from the row, removes it # from the row permanently, and receives the value of the coin. Determine the # maximum possible amount of money we can definitely win if we move first. # Note: The opponent is as clever as the user. # http://www.geeksforgeeks.org/dynamic-programming-set-31-optimal-strategy-for-a-game/ def find_max_val_recur(coins,l,r): if l + 1 == r: return max(coins[l],coins[r]) if l == r: return coins[i] left_choose = coins[l] + min(find_max_val_recur(coins,l+1,r - 1),find_max_val_recur(coins,l+2,r)) right_choose = coins[r] + min(find_max_val_recur(coins,l + 1,r-1),find_max_val_recur(coins,l,r-2)) return max(left_choose,right_choose) coin_map = {} def find_max_val_memo(coins,l,r): if l + 1 == r: return max(coins[l],coins[r]) if l == r: return coins[i] if (l,r) in coin_map: return coin_map[(l,r)] left_choose = coins[l] + min(find_max_val_memo(coins,l+1,r - 1),find_max_val_memo(coins,l+2,r)) right_choose = coins[r] + min(find_max_val_memo(coins,l + 1,r-1),find_max_val_memo(coins,l,r-2)) max_val = max(left_choose,right_choose) coin_map[(l,r)] = max_val return max_val def find_max_val_bottom_up(coins): coins_len = len(coins) table = [[0] * coins_len for i in range(coins_len + 1)] for gap in range(coins_len): i = 0 for j in range(gap,coins_len): # Here x is value of F(i+2, j), y is F(i+1, j-1) and # z is F(i, j-2) in above recursive formula x = table[i+2][j] if (i+2) <= j else 0 y = table[i+1][j-1] if (i+1) <= (j-1) else 0 z = table[i][j-2] if i <= (j-2) else 0 table[i][j] = max(coins[i] + min(x,y),coins[j] + min(y,z)) i += 1 return table[0][coins_len - 1] if __name__=="__main__": coins = [8,15,3,7] print(find_max_val_bottom_up(coins))
def find_max_val_recur(coins, l, r): if l + 1 == r: return max(coins[l], coins[r]) if l == r: return coins[i] left_choose = coins[l] + min(find_max_val_recur(coins, l + 1, r - 1), find_max_val_recur(coins, l + 2, r)) right_choose = coins[r] + min(find_max_val_recur(coins, l + 1, r - 1), find_max_val_recur(coins, l, r - 2)) return max(left_choose, right_choose) coin_map = {} def find_max_val_memo(coins, l, r): if l + 1 == r: return max(coins[l], coins[r]) if l == r: return coins[i] if (l, r) in coin_map: return coin_map[l, r] left_choose = coins[l] + min(find_max_val_memo(coins, l + 1, r - 1), find_max_val_memo(coins, l + 2, r)) right_choose = coins[r] + min(find_max_val_memo(coins, l + 1, r - 1), find_max_val_memo(coins, l, r - 2)) max_val = max(left_choose, right_choose) coin_map[l, r] = max_val return max_val def find_max_val_bottom_up(coins): coins_len = len(coins) table = [[0] * coins_len for i in range(coins_len + 1)] for gap in range(coins_len): i = 0 for j in range(gap, coins_len): x = table[i + 2][j] if i + 2 <= j else 0 y = table[i + 1][j - 1] if i + 1 <= j - 1 else 0 z = table[i][j - 2] if i <= j - 2 else 0 table[i][j] = max(coins[i] + min(x, y), coins[j] + min(y, z)) i += 1 return table[0][coins_len - 1] if __name__ == '__main__': coins = [8, 15, 3, 7] print(find_max_val_bottom_up(coins))
''' Example: Given an array of distinct integer values, count the number of pairs of integers that have difference k. For example, given the array { 1, 7, 5, 9, 2, 12, 3 } and the difference k = 2,there are four pairs with difference2: (1, 3), (3, 5), (5, 7), (7, 9). ''' def pairs_of_difference(array, diff): hash_table = {} for num in array: hash_table[num] = num count = 0 for num in array: if num + diff in hash_table: count += 1 if num - diff in hash_table: count += 1 return count // 2 print(pairs_of_difference([1, 7, 5, 9, 2, 12, 3], 2))
""" Example: Given an array of distinct integer values, count the number of pairs of integers that have difference k. For example, given the array { 1, 7, 5, 9, 2, 12, 3 } and the difference k = 2,there are four pairs with difference2: (1, 3), (3, 5), (5, 7), (7, 9). """ def pairs_of_difference(array, diff): hash_table = {} for num in array: hash_table[num] = num count = 0 for num in array: if num + diff in hash_table: count += 1 if num - diff in hash_table: count += 1 return count // 2 print(pairs_of_difference([1, 7, 5, 9, 2, 12, 3], 2))
numbers_count = int(input()) sum_number = 0 for counter in range(numbers_count): current_number = int(input()) sum_number += current_number print(sum_number)
numbers_count = int(input()) sum_number = 0 for counter in range(numbers_count): current_number = int(input()) sum_number += current_number print(sum_number)
# coding=utf-8 def test_common_stats_insert(session): raise NotImplementedError def test_duplicate_common_stats_error(session): raise NotImplementedError def test_common_stats_default_values(session): raise NotImplementedError def test_common_stats_negative_value_error(session): raise NotImplementedError def test_field_stats_default_values(session): raise NotImplementedError def test_field_stats_negative_value_error(session): raise NotImplementedError def test_goalkeeper_stats_default_values(session): raise NotImplementedError def test_goalkeeper_stats_negative_value_error(session): raise NotImplementedError def test_field_and_goalkeeper_stats_insert(session): raise NotImplementedError
def test_common_stats_insert(session): raise NotImplementedError def test_duplicate_common_stats_error(session): raise NotImplementedError def test_common_stats_default_values(session): raise NotImplementedError def test_common_stats_negative_value_error(session): raise NotImplementedError def test_field_stats_default_values(session): raise NotImplementedError def test_field_stats_negative_value_error(session): raise NotImplementedError def test_goalkeeper_stats_default_values(session): raise NotImplementedError def test_goalkeeper_stats_negative_value_error(session): raise NotImplementedError def test_field_and_goalkeeper_stats_insert(session): raise NotImplementedError
#common utilities for all module def trap_exc_during_debug(*args): # when app raises uncaught exception, print info print(args)
def trap_exc_during_debug(*args): print(args)
# Copyright 2011 Nicholas Bray # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. def doNothing(node): pass class CFGDFS(object): def __init__(self, pre=doNothing, post=doNothing): self.pre = pre self.post = post self.processed = set() def process(self, node): if node not in self.processed: self.processed.add(node) self.pre(node) for child in node.forward(): self.process(child) self.post(node)
def do_nothing(node): pass class Cfgdfs(object): def __init__(self, pre=doNothing, post=doNothing): self.pre = pre self.post = post self.processed = set() def process(self, node): if node not in self.processed: self.processed.add(node) self.pre(node) for child in node.forward(): self.process(child) self.post(node)
def optical_flow(img_stack): """ Given an image stack (N, H, W, C) calculate the optical flow beginning from the center image (rounded down) towards either end. Returns the disparity maps stackes as (N, H, W, 2) """ pass
def optical_flow(img_stack): """ Given an image stack (N, H, W, C) calculate the optical flow beginning from the center image (rounded down) towards either end. Returns the disparity maps stackes as (N, H, W, 2) """ pass
class Calculator(object): def __init__(self, corpus, segment_size): self.corpus = corpus self.segment_size = segment_size @staticmethod def calc_proportion(matches, total): """ Simple float division placed into a static method to prevent Zero division error. """ if matches and total: return float(matches) / float(total) return 0.0 def get_relevant_words(self, position, inverse=False): """ Filter relevant words. I.e. checking if one letter word matches biphoneme segment doesn't make sense nor does matching phoneme in the fifth position with the words shorter than five characters. """ if inverse: return [x[::-1] for x in self.corpus if len(x) >= position + self.segment_size] return [x for x in self.corpus if len(x) >= position + self.segment_size] def split_into_segments(self, word): """ If segment size is equal to one, return list of characters. Otherwise, return appropriate segments. """ if self.segment_size == 1: return list(word) return (word[x:x+self.segment_size] for x in range(len(word)-self.segment_size+1)) def get_number_of_matches(self, segment, position, relevant_words): """ Find out number of matching segments in the set of relevant words. """ return len(filter( lambda x: x[position:position+self.segment_size] == segment, relevant_words) ) def get_probability_for_segments(self, word, inverse=False): """ Calculate probabilities for each segment. """ proportions = [] for position, segment in enumerate(self.split_into_segments(word)): relevant_words = self.get_relevant_words(position, inverse=inverse) matches = self.get_number_of_matches(segment, position, relevant_words) if inverse: segment = segment[::-1] proportions.append([segment,self.calc_proportion(matches,len(relevant_words))]) if inverse: proportions.reverse() return proportions def get_word_probability_by_segments(self, word, prob_type): """ Call the above method to calculate different probability types depending on parameters passed. If 'combined probability' is asked for, this method calls itself recursively to calculate 'regular probability' and 'inverse probability' for each segment, and then returns the average of the two results. """ if prob_type == 1: return self.get_probability_for_segments(word) if prob_type == 2: return self.get_probability_for_segments(word[::-1], inverse=True) return [ [i[0],(i[1]+j[1])/2] for i,j in zip( self.get_word_probability_by_segments(word, 1), self.get_word_probability_by_segments(word, 2) ) ] def get_probs(self, word, prob_type, averaged=False): """ Get probabilities for all segments of the word, sum them and average (if asked for). Return list of two elements, where the first one is summed/averaged probability and the second one is a list of probabilities by segments. """ by_segments = self.get_word_probability_by_segments(word, prob_type) summed = sum(x[1] for x in by_segments) if averaged and summed > 0: return [summed / (len(word)-self.segment_size+1), by_segments] return [summed, by_segments]
class Calculator(object): def __init__(self, corpus, segment_size): self.corpus = corpus self.segment_size = segment_size @staticmethod def calc_proportion(matches, total): """ Simple float division placed into a static method to prevent Zero division error. """ if matches and total: return float(matches) / float(total) return 0.0 def get_relevant_words(self, position, inverse=False): """ Filter relevant words. I.e. checking if one letter word matches biphoneme segment doesn't make sense nor does matching phoneme in the fifth position with the words shorter than five characters. """ if inverse: return [x[::-1] for x in self.corpus if len(x) >= position + self.segment_size] return [x for x in self.corpus if len(x) >= position + self.segment_size] def split_into_segments(self, word): """ If segment size is equal to one, return list of characters. Otherwise, return appropriate segments. """ if self.segment_size == 1: return list(word) return (word[x:x + self.segment_size] for x in range(len(word) - self.segment_size + 1)) def get_number_of_matches(self, segment, position, relevant_words): """ Find out number of matching segments in the set of relevant words. """ return len(filter(lambda x: x[position:position + self.segment_size] == segment, relevant_words)) def get_probability_for_segments(self, word, inverse=False): """ Calculate probabilities for each segment. """ proportions = [] for (position, segment) in enumerate(self.split_into_segments(word)): relevant_words = self.get_relevant_words(position, inverse=inverse) matches = self.get_number_of_matches(segment, position, relevant_words) if inverse: segment = segment[::-1] proportions.append([segment, self.calc_proportion(matches, len(relevant_words))]) if inverse: proportions.reverse() return proportions def get_word_probability_by_segments(self, word, prob_type): """ Call the above method to calculate different probability types depending on parameters passed. If 'combined probability' is asked for, this method calls itself recursively to calculate 'regular probability' and 'inverse probability' for each segment, and then returns the average of the two results. """ if prob_type == 1: return self.get_probability_for_segments(word) if prob_type == 2: return self.get_probability_for_segments(word[::-1], inverse=True) return [[i[0], (i[1] + j[1]) / 2] for (i, j) in zip(self.get_word_probability_by_segments(word, 1), self.get_word_probability_by_segments(word, 2))] def get_probs(self, word, prob_type, averaged=False): """ Get probabilities for all segments of the word, sum them and average (if asked for). Return list of two elements, where the first one is summed/averaged probability and the second one is a list of probabilities by segments. """ by_segments = self.get_word_probability_by_segments(word, prob_type) summed = sum((x[1] for x in by_segments)) if averaged and summed > 0: return [summed / (len(word) - self.segment_size + 1), by_segments] return [summed, by_segments]
""" ytsync.py Synchronize YouTube playlists on a channel to local storage. Downloads all videos using youtube-dl. """
""" ytsync.py Synchronize YouTube playlists on a channel to local storage. Downloads all videos using youtube-dl. """
def summation(number): total = 0 for num in range(number + 1): total += num return total if __name__ == "__main__": print(summation(1000))
def summation(number): total = 0 for num in range(number + 1): total += num return total if __name__ == '__main__': print(summation(1000))
a = int(input('Informe um numero:')) if a%2 == 0 : print("Par!") else: print('Impar!')
a = int(input('Informe um numero:')) if a % 2 == 0: print('Par!') else: print('Impar!')
class Piece: def __init__(self, board, square, white): self.square = square self.row = square[0] self.col = square[1] self.is_clicked = False #dk if i need this self._white = white self.pinned = False #self.letter def move(self): pass def check_move(self): if self.is_clicked == True: pass def clicked(self): self.is_clicked = True #white is uppercase #black loewrcase #team class Not_King(Piece): def __init__(self, square, white): #super().__init__(self, fname, lname) super().__init__(square, white) self.square = square self.is_pinned = False self.is_protected = False def check_pinned(self): pass def check_protection(self): pass class King(Piece): def move(self): moves = [(-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1),] pass #check squares class Knight(Not_King): def move(self): moves = [(-1, -2), (-1, 2), (1, 2), (1,-2), (-2, -1), (-2, 1), (2, -1), (2, 1)] #move #check L shape 2,1 pass class Pawn(Not_King): def move(self): pass # check squares of board def __init__(self, board, square, white): super().__init__(board, square, white) if self._white: self.moves = [(-1,0)] #-1 row is going up one row else: self.moves = [(1,0)] def move(self): pass def possible_moves(self): if self._white: #white #board pass else: #black pass #
class Piece: def __init__(self, board, square, white): self.square = square self.row = square[0] self.col = square[1] self.is_clicked = False self._white = white self.pinned = False def move(self): pass def check_move(self): if self.is_clicked == True: pass def clicked(self): self.is_clicked = True class Not_King(Piece): def __init__(self, square, white): super().__init__(square, white) self.square = square self.is_pinned = False self.is_protected = False def check_pinned(self): pass def check_protection(self): pass class King(Piece): def move(self): moves = [(-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1)] pass class Knight(Not_King): def move(self): moves = [(-1, -2), (-1, 2), (1, 2), (1, -2), (-2, -1), (-2, 1), (2, -1), (2, 1)] pass class Pawn(Not_King): def move(self): pass def __init__(self, board, square, white): super().__init__(board, square, white) if self._white: self.moves = [(-1, 0)] else: self.moves = [(1, 0)] def move(self): pass def possible_moves(self): if self._white: pass else: pass
print('please input the starting annual salary(annual_salary):') annual_salary=float(input()) print('please input The portion of salary to be saved (portion_saved):') portion_saved=float(input()) print("The cost of your dream home (total_cost):") total_cost=float(input()) portion_down_payment=0.25 current_savings=0 number_of_months=0 savings=0 r=0.04 while(current_savings<total_cost*portion_down_payment): current_savings=annual_salary/12*portion_saved+current_savings*(1+r/12) number_of_months=number_of_months+1 print(number_of_months)
print('please input the starting annual salary(annual_salary):') annual_salary = float(input()) print('please input The portion of salary to be saved (portion_saved):') portion_saved = float(input()) print('The cost of your dream home (total_cost):') total_cost = float(input()) portion_down_payment = 0.25 current_savings = 0 number_of_months = 0 savings = 0 r = 0.04 while current_savings < total_cost * portion_down_payment: current_savings = annual_salary / 12 * portion_saved + current_savings * (1 + r / 12) number_of_months = number_of_months + 1 print(number_of_months)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- mylist = [ "a", 2, 4.5 ] myotherlist = mylist[ : ] mylist[1] = "hello" print(myotherlist) mytext = "Hello world" myothertext = mytext mytext = "Hallo Welt!" #print(myothertext) print(mylist[ : ])
mylist = ['a', 2, 4.5] myotherlist = mylist[:] mylist[1] = 'hello' print(myotherlist) mytext = 'Hello world' myothertext = mytext mytext = 'Hallo Welt!' print(mylist[:])
''' Pig Latin: Rules if word starts with a vowel, add 'ay' to end if word does not start with a vowel, put first letter at the end, then add 'ay' word -> ordway apple -> appleay ''' def pig_latin(word): initial_letter = word[0] if initial_letter in 'aeiou': translated_word = word + 'ay' else: translated_word = word[1:] + initial_letter + 'ay' return translated_word print(pig_latin('word')) print(pig_latin('apple'))
""" Pig Latin: Rules if word starts with a vowel, add 'ay' to end if word does not start with a vowel, put first letter at the end, then add 'ay' word -> ordway apple -> appleay """ def pig_latin(word): initial_letter = word[0] if initial_letter in 'aeiou': translated_word = word + 'ay' else: translated_word = word[1:] + initial_letter + 'ay' return translated_word print(pig_latin('word')) print(pig_latin('apple'))
class Queryable: """This superclass holds all common behaviors of a queryable route of MBTA's API v3""" @property def list_route(self): raise NotImplementedError class SingularQueryable(Queryable): def __init__(self, id): self._id = id def __eq__(self, other): return self.id == other.id @property def id(self): return self._id @property def id_route(self): raise NotImplementedError
class Queryable: """This superclass holds all common behaviors of a queryable route of MBTA's API v3""" @property def list_route(self): raise NotImplementedError class Singularqueryable(Queryable): def __init__(self, id): self._id = id def __eq__(self, other): return self.id == other.id @property def id(self): return self._id @property def id_route(self): raise NotImplementedError
class Break: def __init__(self, dbRow): self.flinch = dbRow[0] self.wound = dbRow[1] self.sever = dbRow[2] self.extract = dbRow[3] self.name = dbRow[4] def __repr__(self): return f"{self.__dict__!r}"
class Break: def __init__(self, dbRow): self.flinch = dbRow[0] self.wound = dbRow[1] self.sever = dbRow[2] self.extract = dbRow[3] self.name = dbRow[4] def __repr__(self): return f'{self.__dict__!r}'
# -*- coding: utf-8 -*- empty_dict = dict() print(empty_dict) d = {} print(type(d)) #zbiory definuje sie set e = set() print(type(e)) # klucze nie moga sie w slowniku powtarzac #w slowniku uporzadkowanie nie jest istotne, i nie jest uporzadkowane pol_to_eng = {'jeden':'one', 'dwa':'two', 'trzy': 'three'} name_to_digit = {'Jeden':1, 'dwa':2, 'trzy':3} #%% len(name_to_digit) #dict = {'key1'='value1,'key2'='value2'...} #%% #dodawanie kolejnych danych, nie trzeba sie martwic na ktore miejsce, bo #nie ma uporzadkowania pol_to_eng['cztery'] = 'four' #%% pol_to_eng.clear() #%% pol_to_eng_copied = pol_to_eng.copy() #%% #wydobycie kluczy ze slownika pol_to_eng.keys() #przekonwertowanie kluczy slownika na liste list(pol_to_eng.keys()) #%% #wydobycie wartosci ze slownika pol_to_eng.values() #przekonwertowanie wartosci slownika na liste list(pol_to_eng.values()) #%% # dostaje liste tupli, nie moge zmienic pary "klucz - wartosc" pol_to_eng.items() list(pol_to_eng.items()) #%% pol_to_eng['jeden'] #pol_to_eng['zero'] #%% #drugi argument podaje to, co jezeli nie ma danego klucza w slowniku pol_to_eng.get('zero', 'NaN') #%% # wartosc usuwana ze struktury #pol_to_eng.pop('dwa') pol_to_eng.popitem() #%% #aktualizacje danych ktore moga zmieniac sie w czasie pol_to_eng.update({'jeden':1})
empty_dict = dict() print(empty_dict) d = {} print(type(d)) e = set() print(type(e)) pol_to_eng = {'jeden': 'one', 'dwa': 'two', 'trzy': 'three'} name_to_digit = {'Jeden': 1, 'dwa': 2, 'trzy': 3} len(name_to_digit) pol_to_eng['cztery'] = 'four' pol_to_eng.clear() pol_to_eng_copied = pol_to_eng.copy() pol_to_eng.keys() list(pol_to_eng.keys()) pol_to_eng.values() list(pol_to_eng.values()) pol_to_eng.items() list(pol_to_eng.items()) pol_to_eng['jeden'] pol_to_eng.get('zero', 'NaN') pol_to_eng.popitem() pol_to_eng.update({'jeden': 1})
class WordDictionary: def __init__(self, cache=True): self.cache = cache def train(self, data): raise NotImplemented() def predict(self, data): raise NotImplemented() def save(self, model_path): raise NotImplemented() def read(self, model_path): raise NotImplemented()
class Worddictionary: def __init__(self, cache=True): self.cache = cache def train(self, data): raise not_implemented() def predict(self, data): raise not_implemented() def save(self, model_path): raise not_implemented() def read(self, model_path): raise not_implemented()
''' Exercise 2: Odd Or Even Ask the user for a number. Depending on whether the number is even or odd, print out an appropriate message to the user. Hint: how does an even / odd number react differently when divided by 2? Extras: If the number is a multiple of 4, print out a different message. Ask the user for two numbers: one number to check (call it num) and one number to divide by (check). If check divides evenly into num, tell that to the user. If not, print a different appropriate message. ''' input_number = int(input('Please input a number (num):')) input_check = int(input('Please input a check number (check):')) result_message = "Your input is an even number." if input_number % 2 == 0 else "Your input is an odd number." result_message += "\nYour input is a multiple of 4." if input_number % 4 == 0 else "" number_divided = "divides" if input_number % input_check == 0 else "dose not divide" result_message += "\nYour input number {yes_or_not} evenly by {check}".format(yes_or_not = number_divided, check = input_check) print(result_message)
""" Exercise 2: Odd Or Even Ask the user for a number. Depending on whether the number is even or odd, print out an appropriate message to the user. Hint: how does an even / odd number react differently when divided by 2? Extras: If the number is a multiple of 4, print out a different message. Ask the user for two numbers: one number to check (call it num) and one number to divide by (check). If check divides evenly into num, tell that to the user. If not, print a different appropriate message. """ input_number = int(input('Please input a number (num):')) input_check = int(input('Please input a check number (check):')) result_message = 'Your input is an even number.' if input_number % 2 == 0 else 'Your input is an odd number.' result_message += '\nYour input is a multiple of 4.' if input_number % 4 == 0 else '' number_divided = 'divides' if input_number % input_check == 0 else 'dose not divide' result_message += '\nYour input number {yes_or_not} evenly by {check}'.format(yes_or_not=number_divided, check=input_check) print(result_message)
"Macros for loading dependencies and registering toolchains" load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") load("//lib/private:jq_toolchain.bzl", "JQ_PLATFORMS", "jq_host_alias_repo", "jq_platform_repo", "jq_toolchains_repo", _DEFAULT_JQ_VERSION = "DEFAULT_JQ_VERSION") load("//lib/private:yq_toolchain.bzl", "YQ_PLATFORMS", "yq_host_alias_repo", "yq_platform_repo", "yq_toolchains_repo", _DEFAULT_YQ_VERSION = "DEFAULT_YQ_VERSION") def aspect_bazel_lib_dependencies(): "Load dependencies required by aspect rules" maybe( http_archive, name = "bazel_skylib", sha256 = "c6966ec828da198c5d9adbaa94c05e3a1c7f21bd012a0b29ba8ddbccb2c93b0d", urls = [ "https://github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz", "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz", ], ) # Re-export the default versions DEFAULT_JQ_VERSION = _DEFAULT_JQ_VERSION DEFAULT_YQ_VERSION = _DEFAULT_YQ_VERSION def register_jq_toolchains(name = "jq", version = DEFAULT_JQ_VERSION, register = True): """Registers jq toolchain and repositories Args: name: override the prefix for the generated toolchain repositories version: the version of jq to execute (see https://github.com/stedolan/jq/releases) register: whether to call through to native.register_toolchains. Should be True for WORKSPACE users, but false when used under bzlmod extension """ for [platform, meta] in JQ_PLATFORMS.items(): jq_platform_repo( name = "%s_%s" % (name, platform), platform = platform, version = version, ) if register: native.register_toolchains("@%s_toolchains//:%s_toolchain" % (name, platform)) jq_host_alias_repo(name = name) jq_toolchains_repo( name = "%s_toolchains" % name, user_repository_name = name, ) def register_yq_toolchains(name = "yq", version = DEFAULT_YQ_VERSION, register = True): """Registers yq toolchain and repositories Args: name: override the prefix for the generated toolchain repositories version: the version of yq to execute (see https://github.com/mikefarah/yq/releases) register: whether to call through to native.register_toolchains. Should be True for WORKSPACE users, but false when used under bzlmod extension """ for [platform, meta] in YQ_PLATFORMS.items(): yq_platform_repo( name = "%s_%s" % (name, platform), platform = platform, version = version, ) if register: native.register_toolchains("@%s_toolchains//:%s_toolchain" % (name, platform)) yq_host_alias_repo(name = name) yq_toolchains_repo( name = "%s_toolchains" % name, user_repository_name = name, )
"""Macros for loading dependencies and registering toolchains""" load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') load('@bazel_tools//tools/build_defs/repo:utils.bzl', 'maybe') load('//lib/private:jq_toolchain.bzl', 'JQ_PLATFORMS', 'jq_host_alias_repo', 'jq_platform_repo', 'jq_toolchains_repo', _DEFAULT_JQ_VERSION='DEFAULT_JQ_VERSION') load('//lib/private:yq_toolchain.bzl', 'YQ_PLATFORMS', 'yq_host_alias_repo', 'yq_platform_repo', 'yq_toolchains_repo', _DEFAULT_YQ_VERSION='DEFAULT_YQ_VERSION') def aspect_bazel_lib_dependencies(): """Load dependencies required by aspect rules""" maybe(http_archive, name='bazel_skylib', sha256='c6966ec828da198c5d9adbaa94c05e3a1c7f21bd012a0b29ba8ddbccb2c93b0d', urls=['https://github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz', 'https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz']) default_jq_version = _DEFAULT_JQ_VERSION default_yq_version = _DEFAULT_YQ_VERSION def register_jq_toolchains(name='jq', version=DEFAULT_JQ_VERSION, register=True): """Registers jq toolchain and repositories Args: name: override the prefix for the generated toolchain repositories version: the version of jq to execute (see https://github.com/stedolan/jq/releases) register: whether to call through to native.register_toolchains. Should be True for WORKSPACE users, but false when used under bzlmod extension """ for [platform, meta] in JQ_PLATFORMS.items(): jq_platform_repo(name='%s_%s' % (name, platform), platform=platform, version=version) if register: native.register_toolchains('@%s_toolchains//:%s_toolchain' % (name, platform)) jq_host_alias_repo(name=name) jq_toolchains_repo(name='%s_toolchains' % name, user_repository_name=name) def register_yq_toolchains(name='yq', version=DEFAULT_YQ_VERSION, register=True): """Registers yq toolchain and repositories Args: name: override the prefix for the generated toolchain repositories version: the version of yq to execute (see https://github.com/mikefarah/yq/releases) register: whether to call through to native.register_toolchains. Should be True for WORKSPACE users, but false when used under bzlmod extension """ for [platform, meta] in YQ_PLATFORMS.items(): yq_platform_repo(name='%s_%s' % (name, platform), platform=platform, version=version) if register: native.register_toolchains('@%s_toolchains//:%s_toolchain' % (name, platform)) yq_host_alias_repo(name=name) yq_toolchains_repo(name='%s_toolchains' % name, user_repository_name=name)
# wwwhisper - web access control. # Copyright (C) 2012-2018 Jan Wrobel <jan@mixedbit.org> """wwwhisper authentication and authorization. The package defines model that associates users with locations that each user can access and exposes API for checking and manipulating permissions. It also provides REST API to login, logout a user and to check if a currently logged in user can access a given location. """
"""wwwhisper authentication and authorization. The package defines model that associates users with locations that each user can access and exposes API for checking and manipulating permissions. It also provides REST API to login, logout a user and to check if a currently logged in user can access a given location. """
# Copyright 2017 Neural Networks and Deep Learning lab, MIPT # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """ Description of the module agents.paraphraser: The task of the module To recognize whether two sentences are paraphrases or not. The module should give a positive answer in the case if two sentences are paraphrases, and a negative answer in the other case. Models architecture All models use Siamese architecture. Word embeddings to models are provided by the pretrained fastText model. A sentence level context is taken into account using LSTM or bi-LSTM layer. Most models use attention to identify similar parts in sentences. Currently implemented types of attention include multiplicative attention [1] and various types of multi-perspective matching [2]. After the attention layer the absolute value of the difference and element-wise product of two vectors representing the sentences are calculated. These vectors are concatenated and input to dense layer with a sigmoid activation performing final classification. The chosen model is trained k times, where k equals to the '--bagging-folds-number' parameter corresponding to the number of data folds. Predictions of the model trained on various data subsets are averaged at testing time (bagging). There is a possibility to choose few models for training at once. Each of them will be trained and their predictions will be averaged at testing time (ensembling). [1] Luong, M.-T., Pham, H., & Manning, C. D. (2015). Effective Approaches to Attention-based Neural Machine Translation. EMNLP 2015. CoRR, abs/1508.04025 [2] Zhiguo Wang, Wael Hamza, & Radu Florian. Bilateral multi-perspective matching for natural language sentences. CoRR, abs/1702.03814, 2017. """
""" Description of the module agents.paraphraser: The task of the module To recognize whether two sentences are paraphrases or not. The module should give a positive answer in the case if two sentences are paraphrases, and a negative answer in the other case. Models architecture All models use Siamese architecture. Word embeddings to models are provided by the pretrained fastText model. A sentence level context is taken into account using LSTM or bi-LSTM layer. Most models use attention to identify similar parts in sentences. Currently implemented types of attention include multiplicative attention [1] and various types of multi-perspective matching [2]. After the attention layer the absolute value of the difference and element-wise product of two vectors representing the sentences are calculated. These vectors are concatenated and input to dense layer with a sigmoid activation performing final classification. The chosen model is trained k times, where k equals to the '--bagging-folds-number' parameter corresponding to the number of data folds. Predictions of the model trained on various data subsets are averaged at testing time (bagging). There is a possibility to choose few models for training at once. Each of them will be trained and their predictions will be averaged at testing time (ensembling). [1] Luong, M.-T., Pham, H., & Manning, C. D. (2015). Effective Approaches to Attention-based Neural Machine Translation. EMNLP 2015. CoRR, abs/1508.04025 [2] Zhiguo Wang, Wael Hamza, & Radu Florian. Bilateral multi-perspective matching for natural language sentences. CoRR, abs/1702.03814, 2017. """
#!/usr/bin/env python # Copyright (c) 2019 VMware, Inc. All Rights Reserved. # SPDX-License-Identifier: BSD-2 License # The full license information can be found in LICENSE.txt # in the root directory of this project. SERVER_CONSTANTS = ( REQUEST_QUEUE_SIZE, PACKET_SIZE, ALLOW_REUSE_ADDRESS ) = ( 100, 1024, True )
server_constants = (request_queue_size, packet_size, allow_reuse_address) = (100, 1024, True)
class Formatting: """Terminal formatting constants""" SUCCESS = '\033[92m' INFO = '\033[94m' WARNING = '\033[93m' END = '\033[0m'
class Formatting: """Terminal formatting constants""" success = '\x1b[92m' info = '\x1b[94m' warning = '\x1b[93m' end = '\x1b[0m'
class Stack: def __init__(self, stack=[], lim=None): self._stack = stack self._lim = lim def push(self, data): if self._lim is not None and len(self._stack) == self._lim: print("~~STACK OVERFLOW~~") return self._stack.append(int(data)) def pop(self): if len(self._stack) == 0: print("~~STACK UNDERFLOW~~") return None return self._stack.pop() def __str__(self): return str(self._stack) if __name__ == '__main__': stack = Stack(lim=10) print("1. Push to stack") print("2. Pop stack") print("3. Print stack") while True: inp = input("Your choice: ") if inp == "1": stack.push(input(" Enter element: ")) elif inp == "2": print(" Element removed:", stack.pop()) else: print(stack)
class Stack: def __init__(self, stack=[], lim=None): self._stack = stack self._lim = lim def push(self, data): if self._lim is not None and len(self._stack) == self._lim: print('~~STACK OVERFLOW~~') return self._stack.append(int(data)) def pop(self): if len(self._stack) == 0: print('~~STACK UNDERFLOW~~') return None return self._stack.pop() def __str__(self): return str(self._stack) if __name__ == '__main__': stack = stack(lim=10) print('1. Push to stack') print('2. Pop stack') print('3. Print stack') while True: inp = input('Your choice: ') if inp == '1': stack.push(input(' Enter element: ')) elif inp == '2': print(' Element removed:', stack.pop()) else: print(stack)
### Code is based on PySimpleAutomata (https://github.com/Oneiroe/PySimpleAutomata/) # MIT License # Copyright (c) 2017 Alessio Cecconi # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. def _epsilon_closure(states, epsilon, transitions): ## add epsilon closure new_states = states while new_states: curr_states = set() for state in new_states: curr_states.update(transitions.get(state, {}).get(epsilon, set())) new_states = curr_states - states states.update(curr_states) def nfa_determinization(nfa: dict, any_input=None, epsilon=None) -> dict: dfa = { 'initial_state': None, 'accepting_states': set(), 'transitions': dict() } initial_states = nfa['initial_states'] _epsilon_closure(initial_states, epsilon, nfa['transitions']) initial_states = frozenset(initial_states) dfa['initial_state'] = initial_states if initial_states.intersection(nfa['accepting_states']): dfa['accepting_states'].add(initial_states) sets_states = set() sets_queue = list() sets_queue.append(initial_states) sets_states.add(initial_states) while sets_queue: current_set = sets_queue.pop(0) new_transitions = {} for state in current_set: old_transitions = nfa['transitions'].get(state, {}) for a in old_transitions.keys(): if a != epsilon: new_transitions[a] = new_transitions.get(a, set()) | old_transitions[a] for char, value in new_transitions.items(): next_set = value | new_transitions.get(any_input, set()) _epsilon_closure(next_set, epsilon, nfa['transitions']) next_set = frozenset(next_set) if next_set not in sets_states: sets_states.add(next_set) sets_queue.append(next_set) if next_set.intersection(nfa['accepting_states']): dfa['accepting_states'].add(next_set) dfa['transitions'].setdefault(current_set, {})[char] = next_set return dfa def dfa_intersection_language(dfa_1: dict, dfa_2: dict, any_input=None) -> dict: language = set() boundary = [(dfa_1['initial_state'], dfa_2['initial_state'])] while boundary: (state_dfa_1, state_dfa_2) = boundary.pop() if state_dfa_1 in dfa_1['accepting_states'] and state_dfa_2 in dfa_2['accepting_states']: language.add((state_dfa_1, state_dfa_2)) if any_input in dfa_1['transitions'].get(state_dfa_1, {}): characters = dfa_2['transitions'].get(state_dfa_2, {}).keys() elif any_input in dfa_2['transitions'].get(state_dfa_2, {}): characters = dfa_1['transitions'].get(state_dfa_1, {}).keys() else: characters = set(dfa_1['transitions'].get(state_dfa_1, {}).keys()).intersection(dfa_2['transitions'].get(state_dfa_2, {}).keys()) for a in characters: next_state_1 = dfa_1['transitions'][state_dfa_1].get(a, dfa_1['transitions'][state_dfa_1].get(any_input, frozenset())) next_state_2 = dfa_2['transitions'][state_dfa_2].get(a, dfa_2['transitions'][state_dfa_2].get(any_input, frozenset())) boundary.append((next_state_1, next_state_2)) return language
def _epsilon_closure(states, epsilon, transitions): new_states = states while new_states: curr_states = set() for state in new_states: curr_states.update(transitions.get(state, {}).get(epsilon, set())) new_states = curr_states - states states.update(curr_states) def nfa_determinization(nfa: dict, any_input=None, epsilon=None) -> dict: dfa = {'initial_state': None, 'accepting_states': set(), 'transitions': dict()} initial_states = nfa['initial_states'] _epsilon_closure(initial_states, epsilon, nfa['transitions']) initial_states = frozenset(initial_states) dfa['initial_state'] = initial_states if initial_states.intersection(nfa['accepting_states']): dfa['accepting_states'].add(initial_states) sets_states = set() sets_queue = list() sets_queue.append(initial_states) sets_states.add(initial_states) while sets_queue: current_set = sets_queue.pop(0) new_transitions = {} for state in current_set: old_transitions = nfa['transitions'].get(state, {}) for a in old_transitions.keys(): if a != epsilon: new_transitions[a] = new_transitions.get(a, set()) | old_transitions[a] for (char, value) in new_transitions.items(): next_set = value | new_transitions.get(any_input, set()) _epsilon_closure(next_set, epsilon, nfa['transitions']) next_set = frozenset(next_set) if next_set not in sets_states: sets_states.add(next_set) sets_queue.append(next_set) if next_set.intersection(nfa['accepting_states']): dfa['accepting_states'].add(next_set) dfa['transitions'].setdefault(current_set, {})[char] = next_set return dfa def dfa_intersection_language(dfa_1: dict, dfa_2: dict, any_input=None) -> dict: language = set() boundary = [(dfa_1['initial_state'], dfa_2['initial_state'])] while boundary: (state_dfa_1, state_dfa_2) = boundary.pop() if state_dfa_1 in dfa_1['accepting_states'] and state_dfa_2 in dfa_2['accepting_states']: language.add((state_dfa_1, state_dfa_2)) if any_input in dfa_1['transitions'].get(state_dfa_1, {}): characters = dfa_2['transitions'].get(state_dfa_2, {}).keys() elif any_input in dfa_2['transitions'].get(state_dfa_2, {}): characters = dfa_1['transitions'].get(state_dfa_1, {}).keys() else: characters = set(dfa_1['transitions'].get(state_dfa_1, {}).keys()).intersection(dfa_2['transitions'].get(state_dfa_2, {}).keys()) for a in characters: next_state_1 = dfa_1['transitions'][state_dfa_1].get(a, dfa_1['transitions'][state_dfa_1].get(any_input, frozenset())) next_state_2 = dfa_2['transitions'][state_dfa_2].get(a, dfa_2['transitions'][state_dfa_2].get(any_input, frozenset())) boundary.append((next_state_1, next_state_2)) return language
def ab(b): c=input("Term To Be Search:") if c in b: print ("Term Found") else: print ("Term Not Found") a=[] while True: b=input("Enter Term(To terminate type Exit):") if b=='Exit' or b=='exit': break else: a.append(b) ab(a)
def ab(b): c = input('Term To Be Search:') if c in b: print('Term Found') else: print('Term Not Found') a = [] while True: b = input('Enter Term(To terminate type Exit):') if b == 'Exit' or b == 'exit': break else: a.append(b) ab(a)
n = int(input()) def weird(n): string = str(n) while n != 1: if n%2 == 0: n = n//2 string += ' ' + str(n) else: n = n*3 + 1 string += ' ' + str(n) return string print(weird(n))
n = int(input()) def weird(n): string = str(n) while n != 1: if n % 2 == 0: n = n // 2 string += ' ' + str(n) else: n = n * 3 + 1 string += ' ' + str(n) return string print(weird(n))
PRICES = [0.01, 0.02, 0.05, 0.10, 0.20, 0.50, 1, 2] QUESTIONS = [ "Voer het aantal 1 centen in:\n", "Voer het aantal 2 centen in: \n", "Voer het aantal 5 centen in: \n", "Voer het aantal 10 centen in: \n", "Voer het aantal 20 centen in: \n", "Voer het aantal 50 centen in: \n", "Voer het aantal 1 euro's in: \n", "Voer het aantal 2 euro's in: \n" ] if __name__ == '__main__': munten = [int(input(question)) for question in QUESTIONS] aantal_munten = sum(munten) totale_waarde = sum(quantity * value for (quantity, value) in zip(munten, PRICES)) print("Totaal aantal munten: {}".format(aantal_munten)) print("Totale waarde van de munten: {} euro".format(totale_waarde))
prices = [0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2] questions = ['Voer het aantal 1 centen in:\n', 'Voer het aantal 2 centen in: \n', 'Voer het aantal 5 centen in: \n', 'Voer het aantal 10 centen in: \n', 'Voer het aantal 20 centen in: \n', 'Voer het aantal 50 centen in: \n', "Voer het aantal 1 euro's in: \n", "Voer het aantal 2 euro's in: \n"] if __name__ == '__main__': munten = [int(input(question)) for question in QUESTIONS] aantal_munten = sum(munten) totale_waarde = sum((quantity * value for (quantity, value) in zip(munten, PRICES))) print('Totaal aantal munten: {}'.format(aantal_munten)) print('Totale waarde van de munten: {} euro'.format(totale_waarde))
spec = { 'name' : "The devil's work...", 'external network name' : "exnet3", 'keypair' : "openstack_rsa", 'controller' : "r720", 'dns' : "10.30.65.200", 'credentials' : { 'user' : "nic", 'password' : "nic", 'project' : "nic" }, 'Networks' : [ { 'name' : "merlynctl" , "start": "172.16.1.2", "end": "172.16.1.100", "subnet" :" 172.16.1.0/24", "gateway": "172.16.1.1" }, { 'name' : "merlyn201" , "start": "192.168.1.201", "end": "192.168.1.202", "subnet" :" 192.168.1.0/24", "vlan": 201, "physical_network": "vlannet" }, { 'name' : "merlyn202" , "start": "192.168.1.202", "end": "192.168.1.203", "subnet" :" 192.168.1.0/24", "vlan": 202, "physical_network": "vlannet" } ], 'Hosts' : [ { 'name' : "monos" , 'image' : "centos7.2" , 'flavor':"m1.large" , 'net' : [ ("merlynctl","*","10.30.65.130")] }, { 'name' : "m201" , 'image' : "centos7.2" , 'flavor':"m1.medium" , 'net' : [ ("merlynctl","*","10.30.65.131"),("merlyn201" , "192.168.1.201") ] }, { 'name' : "m202" , 'image' : "centos7.2" , 'flavor':"m1.medium" , 'net' : [ ("merlynctl","*","10.30.65.132"),("merlyn202" , "192.168.1.202") ] }, ] }
spec = {'name': "The devil's work...", 'external network name': 'exnet3', 'keypair': 'openstack_rsa', 'controller': 'r720', 'dns': '10.30.65.200', 'credentials': {'user': 'nic', 'password': 'nic', 'project': 'nic'}, 'Networks': [{'name': 'merlynctl', 'start': '172.16.1.2', 'end': '172.16.1.100', 'subnet': ' 172.16.1.0/24', 'gateway': '172.16.1.1'}, {'name': 'merlyn201', 'start': '192.168.1.201', 'end': '192.168.1.202', 'subnet': ' 192.168.1.0/24', 'vlan': 201, 'physical_network': 'vlannet'}, {'name': 'merlyn202', 'start': '192.168.1.202', 'end': '192.168.1.203', 'subnet': ' 192.168.1.0/24', 'vlan': 202, 'physical_network': 'vlannet'}], 'Hosts': [{'name': 'monos', 'image': 'centos7.2', 'flavor': 'm1.large', 'net': [('merlynctl', '*', '10.30.65.130')]}, {'name': 'm201', 'image': 'centos7.2', 'flavor': 'm1.medium', 'net': [('merlynctl', '*', '10.30.65.131'), ('merlyn201', '192.168.1.201')]}, {'name': 'm202', 'image': 'centos7.2', 'flavor': 'm1.medium', 'net': [('merlynctl', '*', '10.30.65.132'), ('merlyn202', '192.168.1.202')]}]}
# coding: utf-8 # fields names BITMAP = 'bitmap' COLS = 'cols' DATA = 'data' EXTERIOR = 'exterior' INTERIOR = 'interior' MULTICHANNEL_BITMAP = 'multichannel_bitmap' ORIGIN = 'origin' POINTS = 'points' ROWS = 'rows' TYPE = 'type' NODES = 'nodes' EDGES = 'edges' ENABLED = 'enabled' LABEL = 'label' COLOR = 'color' TEMPLATE = 'template' LOCATION = 'location'
bitmap = 'bitmap' cols = 'cols' data = 'data' exterior = 'exterior' interior = 'interior' multichannel_bitmap = 'multichannel_bitmap' origin = 'origin' points = 'points' rows = 'rows' type = 'type' nodes = 'nodes' edges = 'edges' enabled = 'enabled' label = 'label' color = 'color' template = 'template' location = 'location'
# Data taken from the MathML 2.0 reference data = ''' "(" form="prefix" fence="true" stretchy="true" lspace="0em" rspace="0em" ")" form="postfix" fence="true" stretchy="true" lspace="0em" rspace="0em" "[" form="prefix" fence="true" stretchy="true" lspace="0em" rspace="0em" "]" form="postfix" fence="true" stretchy="true" lspace="0em" rspace="0em" "{" form="prefix" fence="true" stretchy="true" lspace="0em" rspace="0em" "}" form="postfix" fence="true" stretchy="true" lspace="0em" rspace="0em" "&CloseCurlyDoubleQuote;" form="postfix" fence="true" lspace="0em" rspace="0em" "&CloseCurlyQuote;" form="postfix" fence="true" lspace="0em" rspace="0em" "&LeftAngleBracket;" form="prefix" fence="true" stretchy="true" lspace="0em" rspace="0em" "&LeftBracketingBar;" form="prefix" fence="true" stretchy="true" lspace="0em" rspace="0em" "&LeftCeiling;" form="prefix" fence="true" stretchy="true" lspace="0em" rspace="0em" "&LeftDoubleBracket;" form="prefix" fence="true" stretchy="true" lspace="0em" rspace="0em" "&LeftDoubleBracketingBar;" form="prefix" fence="true" stretchy="true" lspace="0em" rspace="0em" "&LeftFloor;" form="prefix" fence="true" stretchy="true" lspace="0em" rspace="0em" "&OpenCurlyDoubleQuote;" form="prefix" fence="true" lspace="0em" rspace="0em" "&OpenCurlyQuote;" form="prefix" fence="true" lspace="0em" rspace="0em" "&RightAngleBracket;" form="postfix" fence="true" stretchy="true" lspace="0em" rspace="0em" "&RightBracketingBar;" form="postfix" fence="true" stretchy="true" lspace="0em" rspace="0em" "&RightCeiling;" form="postfix" fence="true" stretchy="true" lspace="0em" rspace="0em" "&RightDoubleBracket;" form="postfix" fence="true" stretchy="true" lspace="0em" rspace="0em" "&RightDoubleBracketingBar;" form="postfix" fence="true" stretchy="true" lspace="0em" rspace="0em" "&RightFloor;" form="postfix" fence="true" stretchy="true" lspace="0em" rspace="0em" "&LeftSkeleton;" form="prefix" fence="true" lspace="0em" rspace="0em" "&RightSkeleton;" form="postfix" fence="true" lspace="0em" rspace="0em" "&InvisibleComma;" form="infix" separator="true" lspace="0em" rspace="0em" "," form="infix" separator="true" lspace="0em" rspace="verythickmathspace" "&HorizontalLine;" form="infix" stretchy="true" minsize="0" lspace="0em" rspace="0em" "&VerticalLine;" form="infix" stretchy="true" minsize="0" lspace="0em" rspace="0em" ";" form="infix" separator="true" lspace="0em" rspace="thickmathspace" ";" form="postfix" separator="true" lspace="0em" rspace="0em" ":=" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&Assign;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&Because;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&Therefore;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&VerticalSeparator;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "//" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&Colon;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&amp;" form="prefix" lspace="0em" rspace="thickmathspace" "&amp;" form="postfix" lspace="thickmathspace" rspace="0em" "*=" form="infix" lspace="thickmathspace" rspace="thickmathspace" "-=" form="infix" lspace="thickmathspace" rspace="thickmathspace" "+=" form="infix" lspace="thickmathspace" rspace="thickmathspace" "/=" form="infix" lspace="thickmathspace" rspace="thickmathspace" "->" form="infix" lspace="thickmathspace" rspace="thickmathspace" ":" form="infix" lspace="thickmathspace" rspace="thickmathspace" ".." form="postfix" lspace="mediummathspace" rspace="0em" "..." form="postfix" lspace="mediummathspace" rspace="0em" "&SuchThat;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&DoubleLeftTee;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&DoubleRightTee;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&DownTee;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&LeftTee;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&RightTee;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&Implies;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "&RoundImplies;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "|" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "||" form="infix" lspace="mediummathspace" rspace="mediummathspace" "&Or;" form="infix" stretchy="true" lspace="mediummathspace" rspace="mediummathspace" "&amp;&amp;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&And;" form="infix" stretchy="true" lspace="mediummathspace" rspace="mediummathspace" "&amp;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "!" form="prefix" lspace="0em" rspace="thickmathspace" "&Not;" form="prefix" lspace="0em" rspace="thickmathspace" "&Exists;" form="prefix" lspace="0em" rspace="thickmathspace" "&ForAll;" form="prefix" lspace="0em" rspace="thickmathspace" "&NotExists;" form="prefix" lspace="0em" rspace="thickmathspace" "&Element;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotElement;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotReverseElement;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotSquareSubset;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotSquareSubsetEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotSquareSuperset;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotSquareSupersetEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotSubset;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotSubsetEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotSuperset;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotSupersetEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&ReverseElement;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&SquareSubset;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&SquareSubsetEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&SquareSuperset;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&SquareSupersetEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&Subset;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&SubsetEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&Superset;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&SupersetEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&DoubleLeftArrow;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "&DoubleLeftRightArrow;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "&DoubleRightArrow;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "&DownLeftRightVector;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "&DownLeftTeeVector;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "&DownLeftVector;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "&DownLeftVectorBar;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "&DownRightTeeVector;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "&DownRightVector;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "&DownRightVectorBar;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "&LeftArrow;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "&LeftArrowBar;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "&LeftArrowRightArrow;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "&LeftRightArrow;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "&LeftRightVector;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "&LeftTeeArrow;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "&LeftTeeVector;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "&LeftVector;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "&LeftVectorBar;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "&LowerLeftArrow;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "&LowerRightArrow;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "&RightArrow;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "&RightArrowBar;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "&RightArrowLeftArrow;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "&RightTeeArrow;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "&RightTeeVector;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "&RightVector;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "&RightVectorBar;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "&ShortLeftArrow;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&ShortRightArrow;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&UpperLeftArrow;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "&UpperRightArrow;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "=" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&lt;" form="infix" lspace="thickmathspace" rspace="thickmathspace" ">" form="infix" lspace="thickmathspace" rspace="thickmathspace" "!=" form="infix" lspace="thickmathspace" rspace="thickmathspace" "==" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&lt;=" form="infix" lspace="thickmathspace" rspace="thickmathspace" ">=" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&Congruent;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&CupCap;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&DotEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&DoubleVerticalBar;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&Equal;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&EqualTilde;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&Equilibrium;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "&GreaterEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&GreaterEqualLess;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&GreaterFullEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&GreaterGreater;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&GreaterLess;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&GreaterSlantEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&GreaterTilde;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&HumpDownHump;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&HumpEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&LeftTriangle;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&LeftTriangleBar;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&LeftTriangleEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&le;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&LessEqualGreater;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&LessFullEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&LessGreater;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&LessLess;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&LessSlantEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&LessTilde;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NestedGreaterGreater;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NestedLessLess;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotCongruent;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotCupCap;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotDoubleVerticalBar;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotEqualTilde;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotGreater;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotGreaterEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotGreaterFullEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotGreaterGreater;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotGreaterLess;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotGreaterSlantEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotGreaterTilde;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotHumpDownHump;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotHumpEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotLeftTriangle;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotLeftTriangleBar;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotLeftTriangleEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotLess;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotLessEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotLessFullEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotLessGreater;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotLessLess;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotLessSlantEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotLessTilde;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotNestedGreaterGreater;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotNestedLessLess;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotPrecedes;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotPrecedesEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotPrecedesSlantEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotPrecedesTilde;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotRightTriangle;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotRightTriangleBar;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotRightTriangleEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotSucceeds;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotSucceedsEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotSucceedsSlantEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotSucceedsTilde;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotTilde;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotTildeEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotTildeFullEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotTildeTilde;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&NotVerticalBar;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&Precedes;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&PrecedesEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&PrecedesSlantEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&PrecedesTilde;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&Proportion;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&Proportional;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&ReverseEquilibrium;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace" "&RightTriangle;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&RightTriangleBar;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&RightTriangleEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&Succeeds;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&SucceedsEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&SucceedsSlantEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&SucceedsTilde;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&Tilde;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&TildeEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&TildeFullEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&TildeTilde;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&UpTee;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&VerticalBar;" form="infix" lspace="thickmathspace" rspace="thickmathspace" "&SquareUnion;" form="infix" stretchy="true" lspace="mediummathspace" rspace="mediummathspace" "&Union;" form="infix" stretchy="true" lspace="mediummathspace" rspace="mediummathspace" "&UnionPlus;" form="infix" stretchy="true" lspace="mediummathspace" rspace="mediummathspace" "-" form="infix" lspace="mediummathspace" rspace="mediummathspace" "+" form="infix" lspace="mediummathspace" rspace="mediummathspace" "&Intersection;" form="infix" stretchy="true" lspace="mediummathspace" rspace="mediummathspace" "&MinusPlus;" form="infix" lspace="mediummathspace" rspace="mediummathspace" "&PlusMinus;" form="infix" lspace="mediummathspace" rspace="mediummathspace" "&SquareIntersection;" form="infix" stretchy="true" lspace="mediummathspace" rspace="mediummathspace" "&Vee;" form="prefix" largeop="true" movablelimits="true" stretchy="true" lspace="0em" rspace="thinmathspace" "&CircleMinus;" form="prefix" largeop="true" movablelimits="true" lspace="0em" rspace="thinmathspace" "&CirclePlus;" form="prefix" largeop="true" movablelimits="true" lspace="0em" rspace="thinmathspace" "&Sum;" form="prefix" largeop="true" movablelimits="true" stretchy="true" lspace="0em" rspace="thinmathspace" "&Union;" form="prefix" largeop="true" movablelimits="true" stretchy="true" lspace="0em" rspace="thinmathspace" "&UnionPlus;" form="prefix" largeop="true" movablelimits="true" stretchy="true" lspace="0em" rspace="thinmathspace" "lim" form="prefix" movablelimits="true" lspace="0em" rspace="thinmathspace" "max" form="prefix" movablelimits="true" lspace="0em" rspace="thinmathspace" "min" form="prefix" movablelimits="true" lspace="0em" rspace="thinmathspace" "&CircleMinus;" form="infix" lspace="thinmathspace" rspace="thinmathspace" "&CirclePlus;" form="infix" lspace="thinmathspace" rspace="thinmathspace" "&ClockwiseContourIntegral;" form="prefix" largeop="true" stretchy="true" lspace="0em" rspace="0em" "&ContourIntegral;" form="prefix" largeop="true" stretchy="true" lspace="0em" rspace="0em" "&CounterClockwiseContourIntegral;" form="prefix" largeop="true" stretchy="true" lspace="0em" rspace="0em" "&DoubleContourIntegral;" form="prefix" largeop="true" stretchy="true" lspace="0em" rspace="0em" "&Integral;" form="prefix" largeop="true" stretchy="true" lspace="0em" rspace="0em" "&Cup;" form="infix" lspace="thinmathspace" rspace="thinmathspace" "&Cap;" form="infix" lspace="thinmathspace" rspace="thinmathspace" "&VerticalTilde;" form="infix" lspace="thinmathspace" rspace="thinmathspace" "&Wedge;" form="prefix" largeop="true" movablelimits="true" stretchy="true" lspace="0em" rspace="thinmathspace" "&CircleTimes;" form="prefix" largeop="true" movablelimits="true" lspace="0em" rspace="thinmathspace" "&Coproduct;" form="prefix" largeop="true" movablelimits="true" stretchy="true" lspace="0em" rspace="thinmathspace" "&Product;" form="prefix" largeop="true" movablelimits="true" stretchy="true" lspace="0em" rspace="thinmathspace" "&Intersection;" form="prefix" largeop="true" movablelimits="true" stretchy="true" lspace="0em" rspace="thinmathspace" "&Coproduct;" form="infix" lspace="thinmathspace" rspace="thinmathspace" "&Star;" form="infix" lspace="thinmathspace" rspace="thinmathspace" "&CircleDot;" form="prefix" largeop="true" movablelimits="true" lspace="0em" rspace="thinmathspace" "*" form="infix" lspace="thinmathspace" rspace="thinmathspace" "&InvisibleTimes;" form="infix" lspace="0em" rspace="0em" "&CenterDot;" form="infix" lspace="thinmathspace" rspace="thinmathspace" "&CircleTimes;" form="infix" lspace="thinmathspace" rspace="thinmathspace" "&Vee;" form="infix" lspace="thinmathspace" rspace="thinmathspace" "&Wedge;" form="infix" lspace="thinmathspace" rspace="thinmathspace" "&Diamond;" form="infix" lspace="thinmathspace" rspace="thinmathspace" "&Backslash;" form="infix" stretchy="true" lspace="thinmathspace" rspace="thinmathspace" "/" form="infix" stretchy="true" lspace="thinmathspace" rspace="thinmathspace" "-" form="prefix" lspace="0em" rspace="veryverythinmathspace" "+" form="prefix" lspace="0em" rspace="veryverythinmathspace" "&MinusPlus;" form="prefix" lspace="0em" rspace="veryverythinmathspace" "&PlusMinus;" form="prefix" lspace="0em" rspace="veryverythinmathspace" "." form="infix" lspace="0em" rspace="0em" "&Cross;" form="infix" lspace="verythinmathspace" rspace="verythinmathspace" "**" form="infix" lspace="verythinmathspace" rspace="verythinmathspace" "&CircleDot;" form="infix" lspace="verythinmathspace" rspace="verythinmathspace" "&SmallCircle;" form="infix" lspace="verythinmathspace" rspace="verythinmathspace" "&Square;" form="prefix" lspace="0em" rspace="verythinmathspace" "&Del;" form="prefix" lspace="0em" rspace="verythinmathspace" "&PartialD;" form="prefix" lspace="0em" rspace="verythinmathspace" "&CapitalDifferentialD;" form="prefix" lspace="0em" rspace="verythinmathspace" "&DifferentialD;" form="prefix" lspace="0em" rspace="verythinmathspace" "&Sqrt;" form="prefix" stretchy="true" lspace="0em" rspace="verythinmathspace" "&DoubleDownArrow;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "&DoubleLongLeftArrow;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "&DoubleLongLeftRightArrow;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "&DoubleLongRightArrow;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "&DoubleUpArrow;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "&DoubleUpDownArrow;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "&DownArrow;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "&DownArrowBar;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "&DownArrowUpArrow;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "&DownTeeArrow;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "&LeftDownTeeVector;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "&LeftDownVector;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "&LeftDownVectorBar;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "&LeftUpDownVector;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "&LeftUpTeeVector;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "&LeftUpVector;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "&LeftUpVectorBar;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "&LongLeftArrow;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "&LongLeftRightArrow;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "&LongRightArrow;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "&ReverseUpEquilibrium;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "&RightDownTeeVector;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "&RightDownVector;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "&RightDownVectorBar;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "&RightUpDownVector;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "&RightUpTeeVector;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "&RightUpVector;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "&RightUpVectorBar;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "&ShortDownArrow;" form="infix" lspace="verythinmathspace" rspace="verythinmathspace" "&ShortUpArrow;" form="infix" lspace="verythinmathspace" rspace="verythinmathspace" "&UpArrow;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "&UpArrowBar;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "&UpArrowDownArrow;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "&UpDownArrow;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "&UpEquilibrium;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "&UpTeeArrow;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace" "^" form="infix" lspace="verythinmathspace" rspace="verythinmathspace" "&lt;>" form="infix" lspace="verythinmathspace" rspace="verythinmathspace" "'" form="postfix" lspace="verythinmathspace" rspace="0em" "!" form="postfix" lspace="verythinmathspace" rspace="0em" "!!" form="postfix" lspace="verythinmathspace" rspace="0em" "~" form="infix" lspace="verythinmathspace" rspace="verythinmathspace" "@" form="infix" lspace="verythinmathspace" rspace="verythinmathspace" "--" form="postfix" lspace="verythinmathspace" rspace="0em" "--" form="prefix" lspace="0em" rspace="verythinmathspace" "++" form="postfix" lspace="verythinmathspace" rspace="0em" "++" form="prefix" lspace="0em" rspace="verythinmathspace" "&ApplyFunction;" form="infix" lspace="0em" rspace="0em" "?" form="infix" lspace="verythinmathspace" rspace="verythinmathspace" "_" form="infix" lspace="verythinmathspace" rspace="verythinmathspace" "&Breve;" form="postfix" accent="true" lspace="0em" rspace="0em" "&Cedilla;" form="postfix" accent="true" lspace="0em" rspace="0em" "&DiacriticalGrave;" form="postfix" accent="true" lspace="0em" rspace="0em" "&DiacriticalDot;" form="postfix" accent="true" lspace="0em" rspace="0em" "&DiacriticalDoubleAcute;" form="postfix" accent="true" lspace="0em" rspace="0em" "&DiacriticalLeftArrow;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em" "&DiacriticalLeftRightArrow;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em" "&DiacriticalLeftRightVector;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em" "&DiacriticalLeftVector;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em" "&DiacriticalAcute;" form="postfix" accent="true" lspace="0em" rspace="0em" "&DiacriticalRightArrow;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em" "&DiacriticalRightVector;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em" "&DiacriticalTilde;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em" "&DoubleDot;" form="postfix" accent="true" lspace="0em" rspace="0em" "&DownBreve;" form="postfix" accent="true" lspace="0em" rspace="0em" "&Hacek;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em" "&Hat;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em" "&OverBar;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em" "&OverBrace;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em" "&OverBracket;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em" "&OverParenthesis;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em" "&TripleDot;" form="postfix" accent="true" lspace="0em" rspace="0em" "&UnderBar;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em" "&UnderBrace;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em" "&UnderBracket;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em" "&UnderParenthesis;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em" '''
data = '\n\n"(" form="prefix" fence="true" stretchy="true" lspace="0em" rspace="0em"\n")" form="postfix" fence="true" stretchy="true" lspace="0em" rspace="0em"\n"[" form="prefix" fence="true" stretchy="true" lspace="0em" rspace="0em"\n"]" form="postfix" fence="true" stretchy="true" lspace="0em" rspace="0em"\n"{" form="prefix" fence="true" stretchy="true" lspace="0em" rspace="0em"\n"}" form="postfix" fence="true" stretchy="true" lspace="0em" rspace="0em"\n \n"&CloseCurlyDoubleQuote;" form="postfix" fence="true" lspace="0em" rspace="0em"\n"&CloseCurlyQuote;" form="postfix" fence="true" lspace="0em" rspace="0em"\n"&LeftAngleBracket;" form="prefix" fence="true" stretchy="true" lspace="0em" rspace="0em"\n"&LeftBracketingBar;" form="prefix" fence="true" stretchy="true" lspace="0em" rspace="0em"\n"&LeftCeiling;" form="prefix" fence="true" stretchy="true" lspace="0em" rspace="0em"\n"&LeftDoubleBracket;" form="prefix" fence="true" stretchy="true" lspace="0em" rspace="0em"\n"&LeftDoubleBracketingBar;" form="prefix" fence="true" stretchy="true" lspace="0em" rspace="0em"\n"&LeftFloor;" form="prefix" fence="true" stretchy="true" lspace="0em" rspace="0em"\n"&OpenCurlyDoubleQuote;" form="prefix" fence="true" lspace="0em" rspace="0em"\n"&OpenCurlyQuote;" form="prefix" fence="true" lspace="0em" rspace="0em"\n"&RightAngleBracket;" form="postfix" fence="true" stretchy="true" lspace="0em" rspace="0em"\n"&RightBracketingBar;" form="postfix" fence="true" stretchy="true" lspace="0em" rspace="0em"\n"&RightCeiling;" form="postfix" fence="true" stretchy="true" lspace="0em" rspace="0em"\n"&RightDoubleBracket;" form="postfix" fence="true" stretchy="true" lspace="0em" rspace="0em"\n"&RightDoubleBracketingBar;" form="postfix" fence="true" stretchy="true" lspace="0em" rspace="0em"\n"&RightFloor;" form="postfix" fence="true" stretchy="true" lspace="0em" rspace="0em"\n"&LeftSkeleton;" form="prefix" fence="true" lspace="0em" rspace="0em"\n"&RightSkeleton;" form="postfix" fence="true" lspace="0em" rspace="0em"\n \n"&InvisibleComma;" form="infix" separator="true" lspace="0em" rspace="0em"\n \n"," form="infix" separator="true" lspace="0em" rspace="verythickmathspace"\n \n"&HorizontalLine;" form="infix" stretchy="true" minsize="0" lspace="0em" rspace="0em"\n"&VerticalLine;" form="infix" stretchy="true" minsize="0" lspace="0em" rspace="0em"\n \n";" form="infix" separator="true" lspace="0em" rspace="thickmathspace"\n";" form="postfix" separator="true" lspace="0em" rspace="0em"\n \n":=" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&Assign;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n \n"&Because;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&Therefore;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n \n"&VerticalSeparator;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n \n"//" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n \n"&Colon;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n \n"&amp;" form="prefix" lspace="0em" rspace="thickmathspace"\n"&amp;" form="postfix" lspace="thickmathspace" rspace="0em"\n \n"*=" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"-=" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"+=" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"/=" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n \n"->" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n \n":" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n \n".." form="postfix" lspace="mediummathspace" rspace="0em"\n"..." form="postfix" lspace="mediummathspace" rspace="0em"\n \n"&SuchThat;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n \n"&DoubleLeftTee;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&DoubleRightTee;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&DownTee;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&LeftTee;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&RightTee;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n \n"&Implies;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n"&RoundImplies;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n \n"|" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n"||" form="infix" lspace="mediummathspace" rspace="mediummathspace"\n"&Or;" form="infix" stretchy="true" lspace="mediummathspace" rspace="mediummathspace"\n \n"&amp;&amp;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&And;" form="infix" stretchy="true" lspace="mediummathspace" rspace="mediummathspace"\n \n"&amp;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n \n"!" form="prefix" lspace="0em" rspace="thickmathspace"\n"&Not;" form="prefix" lspace="0em" rspace="thickmathspace"\n \n"&Exists;" form="prefix" lspace="0em" rspace="thickmathspace"\n"&ForAll;" form="prefix" lspace="0em" rspace="thickmathspace"\n"&NotExists;" form="prefix" lspace="0em" rspace="thickmathspace"\n \n"&Element;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotElement;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotReverseElement;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotSquareSubset;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotSquareSubsetEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotSquareSuperset;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotSquareSupersetEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotSubset;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotSubsetEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotSuperset;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotSupersetEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&ReverseElement;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&SquareSubset;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&SquareSubsetEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&SquareSuperset;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&SquareSupersetEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&Subset;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&SubsetEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&Superset;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&SupersetEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n \n"&DoubleLeftArrow;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n"&DoubleLeftRightArrow;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n"&DoubleRightArrow;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n"&DownLeftRightVector;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n"&DownLeftTeeVector;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n"&DownLeftVector;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n"&DownLeftVectorBar;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n"&DownRightTeeVector;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n"&DownRightVector;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n"&DownRightVectorBar;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n"&LeftArrow;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n"&LeftArrowBar;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n"&LeftArrowRightArrow;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n"&LeftRightArrow;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n"&LeftRightVector;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n"&LeftTeeArrow;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n"&LeftTeeVector;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n"&LeftVector;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n"&LeftVectorBar;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n"&LowerLeftArrow;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n"&LowerRightArrow;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n"&RightArrow;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n"&RightArrowBar;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n"&RightArrowLeftArrow;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n"&RightTeeArrow;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n"&RightTeeVector;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n"&RightVector;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n"&RightVectorBar;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n"&ShortLeftArrow;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&ShortRightArrow;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&UpperLeftArrow;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n"&UpperRightArrow;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n \n"=" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&lt;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n">" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"!=" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"==" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&lt;=" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n">=" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&Congruent;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&CupCap;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&DotEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&DoubleVerticalBar;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&Equal;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&EqualTilde;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&Equilibrium;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n"&GreaterEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&GreaterEqualLess;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&GreaterFullEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&GreaterGreater;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&GreaterLess;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&GreaterSlantEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&GreaterTilde;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&HumpDownHump;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&HumpEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&LeftTriangle;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&LeftTriangleBar;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&LeftTriangleEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&le;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&LessEqualGreater;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&LessFullEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&LessGreater;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&LessLess;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&LessSlantEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&LessTilde;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NestedGreaterGreater;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NestedLessLess;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotCongruent;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotCupCap;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotDoubleVerticalBar;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotEqualTilde;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotGreater;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotGreaterEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotGreaterFullEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotGreaterGreater;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotGreaterLess;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotGreaterSlantEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotGreaterTilde;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotHumpDownHump;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotHumpEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotLeftTriangle;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotLeftTriangleBar;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotLeftTriangleEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotLess;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotLessEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotLessFullEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotLessGreater;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotLessLess;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotLessSlantEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotLessTilde;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotNestedGreaterGreater;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotNestedLessLess;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotPrecedes;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotPrecedesEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotPrecedesSlantEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotPrecedesTilde;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotRightTriangle;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotRightTriangleBar;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotRightTriangleEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotSucceeds;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotSucceedsEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotSucceedsSlantEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotSucceedsTilde;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotTilde;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotTildeEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotTildeFullEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotTildeTilde;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&NotVerticalBar;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&Precedes;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&PrecedesEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&PrecedesSlantEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&PrecedesTilde;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&Proportion;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&Proportional;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&ReverseEquilibrium;" form="infix" stretchy="true" lspace="thickmathspace" rspace="thickmathspace"\n"&RightTriangle;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&RightTriangleBar;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&RightTriangleEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&Succeeds;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&SucceedsEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&SucceedsSlantEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&SucceedsTilde;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&Tilde;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&TildeEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&TildeFullEqual;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&TildeTilde;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&UpTee;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n"&VerticalBar;" form="infix" lspace="thickmathspace" rspace="thickmathspace"\n \n"&SquareUnion;" form="infix" stretchy="true" lspace="mediummathspace" rspace="mediummathspace"\n"&Union;" form="infix" stretchy="true" lspace="mediummathspace" rspace="mediummathspace"\n"&UnionPlus;" form="infix" stretchy="true" lspace="mediummathspace" rspace="mediummathspace"\n \n"-" form="infix" lspace="mediummathspace" rspace="mediummathspace"\n"+" form="infix" lspace="mediummathspace" rspace="mediummathspace"\n"&Intersection;" form="infix" stretchy="true" lspace="mediummathspace" rspace="mediummathspace"\n"&MinusPlus;" form="infix" lspace="mediummathspace" rspace="mediummathspace"\n"&PlusMinus;" form="infix" lspace="mediummathspace" rspace="mediummathspace"\n"&SquareIntersection;" form="infix" stretchy="true" lspace="mediummathspace" rspace="mediummathspace"\n \n"&Vee;" form="prefix" largeop="true" movablelimits="true" stretchy="true" lspace="0em" rspace="thinmathspace"\n"&CircleMinus;" form="prefix" largeop="true" movablelimits="true" lspace="0em" rspace="thinmathspace"\n"&CirclePlus;" form="prefix" largeop="true" movablelimits="true" lspace="0em" rspace="thinmathspace"\n"&Sum;" form="prefix" largeop="true" movablelimits="true" stretchy="true" lspace="0em" rspace="thinmathspace"\n"&Union;" form="prefix" largeop="true" movablelimits="true" stretchy="true" lspace="0em" rspace="thinmathspace"\n"&UnionPlus;" form="prefix" largeop="true" movablelimits="true" stretchy="true" lspace="0em" rspace="thinmathspace"\n"lim" form="prefix" movablelimits="true" lspace="0em" rspace="thinmathspace"\n"max" form="prefix" movablelimits="true" lspace="0em" rspace="thinmathspace"\n"min" form="prefix" movablelimits="true" lspace="0em" rspace="thinmathspace"\n \n"&CircleMinus;" form="infix" lspace="thinmathspace" rspace="thinmathspace"\n"&CirclePlus;" form="infix" lspace="thinmathspace" rspace="thinmathspace"\n \n"&ClockwiseContourIntegral;" form="prefix" largeop="true" stretchy="true" lspace="0em" rspace="0em"\n"&ContourIntegral;" form="prefix" largeop="true" stretchy="true" lspace="0em" rspace="0em"\n"&CounterClockwiseContourIntegral;" form="prefix" largeop="true" stretchy="true" lspace="0em" rspace="0em"\n"&DoubleContourIntegral;" form="prefix" largeop="true" stretchy="true" lspace="0em" rspace="0em"\n"&Integral;" form="prefix" largeop="true" stretchy="true" lspace="0em" rspace="0em"\n \n"&Cup;" form="infix" lspace="thinmathspace" rspace="thinmathspace"\n \n"&Cap;" form="infix" lspace="thinmathspace" rspace="thinmathspace"\n \n"&VerticalTilde;" form="infix" lspace="thinmathspace" rspace="thinmathspace"\n \n"&Wedge;" form="prefix" largeop="true" movablelimits="true" stretchy="true" lspace="0em" rspace="thinmathspace"\n"&CircleTimes;" form="prefix" largeop="true" movablelimits="true" lspace="0em" rspace="thinmathspace"\n"&Coproduct;" form="prefix" largeop="true" movablelimits="true" stretchy="true" lspace="0em" rspace="thinmathspace"\n"&Product;" form="prefix" largeop="true" movablelimits="true" stretchy="true" lspace="0em" rspace="thinmathspace"\n"&Intersection;" form="prefix" largeop="true" movablelimits="true" stretchy="true" lspace="0em" rspace="thinmathspace"\n \n"&Coproduct;" form="infix" lspace="thinmathspace" rspace="thinmathspace"\n \n"&Star;" form="infix" lspace="thinmathspace" rspace="thinmathspace"\n \n"&CircleDot;" form="prefix" largeop="true" movablelimits="true" lspace="0em" rspace="thinmathspace"\n \n"*" form="infix" lspace="thinmathspace" rspace="thinmathspace"\n"&InvisibleTimes;" form="infix" lspace="0em" rspace="0em"\n \n"&CenterDot;" form="infix" lspace="thinmathspace" rspace="thinmathspace"\n \n"&CircleTimes;" form="infix" lspace="thinmathspace" rspace="thinmathspace"\n \n"&Vee;" form="infix" lspace="thinmathspace" rspace="thinmathspace"\n \n"&Wedge;" form="infix" lspace="thinmathspace" rspace="thinmathspace"\n \n"&Diamond;" form="infix" lspace="thinmathspace" rspace="thinmathspace"\n \n"&Backslash;" form="infix" stretchy="true" lspace="thinmathspace" rspace="thinmathspace"\n \n"/" form="infix" stretchy="true" lspace="thinmathspace" rspace="thinmathspace"\n \n"-" form="prefix" lspace="0em" rspace="veryverythinmathspace"\n"+" form="prefix" lspace="0em" rspace="veryverythinmathspace"\n"&MinusPlus;" form="prefix" lspace="0em" rspace="veryverythinmathspace"\n"&PlusMinus;" form="prefix" lspace="0em" rspace="veryverythinmathspace"\n \n"." form="infix" lspace="0em" rspace="0em"\n \n"&Cross;" form="infix" lspace="verythinmathspace" rspace="verythinmathspace"\n \n"**" form="infix" lspace="verythinmathspace" rspace="verythinmathspace"\n \n"&CircleDot;" form="infix" lspace="verythinmathspace" rspace="verythinmathspace"\n \n"&SmallCircle;" form="infix" lspace="verythinmathspace" rspace="verythinmathspace"\n \n"&Square;" form="prefix" lspace="0em" rspace="verythinmathspace"\n \n"&Del;" form="prefix" lspace="0em" rspace="verythinmathspace"\n"&PartialD;" form="prefix" lspace="0em" rspace="verythinmathspace"\n \n"&CapitalDifferentialD;" form="prefix" lspace="0em" rspace="verythinmathspace"\n"&DifferentialD;" form="prefix" lspace="0em" rspace="verythinmathspace"\n \n"&Sqrt;" form="prefix" stretchy="true" lspace="0em" rspace="verythinmathspace"\n \n"&DoubleDownArrow;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n"&DoubleLongLeftArrow;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n"&DoubleLongLeftRightArrow;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n"&DoubleLongRightArrow;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n"&DoubleUpArrow;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n"&DoubleUpDownArrow;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n"&DownArrow;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n"&DownArrowBar;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n"&DownArrowUpArrow;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n"&DownTeeArrow;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n"&LeftDownTeeVector;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n"&LeftDownVector;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n"&LeftDownVectorBar;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n"&LeftUpDownVector;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n"&LeftUpTeeVector;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n"&LeftUpVector;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n"&LeftUpVectorBar;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n"&LongLeftArrow;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n"&LongLeftRightArrow;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n"&LongRightArrow;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n"&ReverseUpEquilibrium;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n"&RightDownTeeVector;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n"&RightDownVector;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n"&RightDownVectorBar;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n"&RightUpDownVector;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n"&RightUpTeeVector;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n"&RightUpVector;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n"&RightUpVectorBar;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n"&ShortDownArrow;" form="infix" lspace="verythinmathspace" rspace="verythinmathspace"\n"&ShortUpArrow;" form="infix" lspace="verythinmathspace" rspace="verythinmathspace"\n"&UpArrow;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n"&UpArrowBar;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n"&UpArrowDownArrow;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n"&UpDownArrow;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n"&UpEquilibrium;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n"&UpTeeArrow;" form="infix" stretchy="true" lspace="verythinmathspace" rspace="verythinmathspace"\n \n"^" form="infix" lspace="verythinmathspace" rspace="verythinmathspace"\n \n"&lt;>" form="infix" lspace="verythinmathspace" rspace="verythinmathspace"\n \n"\'" form="postfix" lspace="verythinmathspace" rspace="0em"\n \n"!" form="postfix" lspace="verythinmathspace" rspace="0em"\n"!!" form="postfix" lspace="verythinmathspace" rspace="0em"\n \n"~" form="infix" lspace="verythinmathspace" rspace="verythinmathspace"\n \n"@" form="infix" lspace="verythinmathspace" rspace="verythinmathspace"\n \n"--" form="postfix" lspace="verythinmathspace" rspace="0em"\n"--" form="prefix" lspace="0em" rspace="verythinmathspace"\n"++" form="postfix" lspace="verythinmathspace" rspace="0em"\n"++" form="prefix" lspace="0em" rspace="verythinmathspace"\n \n"&ApplyFunction;" form="infix" lspace="0em" rspace="0em"\n \n"?" form="infix" lspace="verythinmathspace" rspace="verythinmathspace"\n \n"_" form="infix" lspace="verythinmathspace" rspace="verythinmathspace"\n \n"&Breve;" form="postfix" accent="true" lspace="0em" rspace="0em"\n"&Cedilla;" form="postfix" accent="true" lspace="0em" rspace="0em"\n"&DiacriticalGrave;" form="postfix" accent="true" lspace="0em" rspace="0em"\n"&DiacriticalDot;" form="postfix" accent="true" lspace="0em" rspace="0em"\n"&DiacriticalDoubleAcute;" form="postfix" accent="true" lspace="0em" rspace="0em"\n"&DiacriticalLeftArrow;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em"\n"&DiacriticalLeftRightArrow;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em"\n"&DiacriticalLeftRightVector;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em"\n"&DiacriticalLeftVector;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em"\n"&DiacriticalAcute;" form="postfix" accent="true" lspace="0em" rspace="0em"\n"&DiacriticalRightArrow;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em"\n"&DiacriticalRightVector;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em"\n"&DiacriticalTilde;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em"\n"&DoubleDot;" form="postfix" accent="true" lspace="0em" rspace="0em"\n"&DownBreve;" form="postfix" accent="true" lspace="0em" rspace="0em"\n"&Hacek;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em"\n"&Hat;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em"\n"&OverBar;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em"\n"&OverBrace;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em"\n"&OverBracket;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em"\n"&OverParenthesis;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em"\n"&TripleDot;" form="postfix" accent="true" lspace="0em" rspace="0em"\n"&UnderBar;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em"\n"&UnderBrace;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em"\n"&UnderBracket;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em"\n"&UnderParenthesis;" form="postfix" accent="true" stretchy="true" lspace="0em" rspace="0em"\n\n'
# -*- coding: utf-8 -*- # User role USER = 0 ADMIN = 1 USER_ROLE = { ADMIN: 'admin', USER: 'user', } # User status INACTIVE = 0 ACTIVE = 1 USER_STATUS = { INACTIVE: 'inactive', ACTIVE: 'active', } # Project progress PR_CHALLENGE = -1 PR_NEW = 0 PR_RESEARCHED = 10 PR_SKETCHED = 20 PR_PROTOTYPED = 30 PR_LAUNCHED = 40 PR_LIVE = 50 PROJECT_PROGRESS = { PR_CHALLENGE: 'This is an idea or challenge description', PR_NEW: 'A team has formed and started a project', PR_RESEARCHED: 'Research has been done to define the scope', PR_SKETCHED: 'Initial designs have been sketched and shared', PR_PROTOTYPED: 'A prototype of the idea has been developed', PR_LAUNCHED: 'The prototype has been deployed and presented', PR_LIVE: 'This project is live and available to the public', } PROJECT_PROGRESS_PHASE = { PR_NEW: 'Researching', PR_RESEARCHED: 'Sketching', PR_SKETCHED: 'Prototyping', PR_PROTOTYPED: 'Launching', PR_LAUNCHED: 'Promoting', PR_LIVE: 'Supporting', PR_CHALLENGE: 'Challenge', } def projectProgressList(All=True): if not All: return [(PR_CHALLENGE, PROJECT_PROGRESS[PR_CHALLENGE])] pl = [(g, PROJECT_PROGRESS[g]) for g in PROJECT_PROGRESS] return sorted(pl, key=lambda x: x[0])
user = 0 admin = 1 user_role = {ADMIN: 'admin', USER: 'user'} inactive = 0 active = 1 user_status = {INACTIVE: 'inactive', ACTIVE: 'active'} pr_challenge = -1 pr_new = 0 pr_researched = 10 pr_sketched = 20 pr_prototyped = 30 pr_launched = 40 pr_live = 50 project_progress = {PR_CHALLENGE: 'This is an idea or challenge description', PR_NEW: 'A team has formed and started a project', PR_RESEARCHED: 'Research has been done to define the scope', PR_SKETCHED: 'Initial designs have been sketched and shared', PR_PROTOTYPED: 'A prototype of the idea has been developed', PR_LAUNCHED: 'The prototype has been deployed and presented', PR_LIVE: 'This project is live and available to the public'} project_progress_phase = {PR_NEW: 'Researching', PR_RESEARCHED: 'Sketching', PR_SKETCHED: 'Prototyping', PR_PROTOTYPED: 'Launching', PR_LAUNCHED: 'Promoting', PR_LIVE: 'Supporting', PR_CHALLENGE: 'Challenge'} def project_progress_list(All=True): if not All: return [(PR_CHALLENGE, PROJECT_PROGRESS[PR_CHALLENGE])] pl = [(g, PROJECT_PROGRESS[g]) for g in PROJECT_PROGRESS] return sorted(pl, key=lambda x: x[0])
""" This script allows you to hijack http/https networks. Before you start use this commands on Kali machine 1. Enable ip forwarding: echo 1 > /proc/sys/net/ipv4/ip_forward 2. Activate your packets Queues - If want to test on your machine: iptables -I OUTPUT -j NFQUEUE --queue-num 0;iptables -I INPUT -j NFQUEUE --queue-num 0 - If want to use another machine: iptables -I FORWARD -j NFQUEUE --queue-num 0 3. Enable SSLStriper: sslstrip 4. Enable prerouting: iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 10000 5. Enable your web_service: service apache2 start """
""" This script allows you to hijack http/https networks. Before you start use this commands on Kali machine 1. Enable ip forwarding: echo 1 > /proc/sys/net/ipv4/ip_forward 2. Activate your packets Queues - If want to test on your machine: iptables -I OUTPUT -j NFQUEUE --queue-num 0;iptables -I INPUT -j NFQUEUE --queue-num 0 - If want to use another machine: iptables -I FORWARD -j NFQUEUE --queue-num 0 3. Enable SSLStriper: sslstrip 4. Enable prerouting: iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 10000 5. Enable your web_service: service apache2 start """
q = int(input()) e = str(input()).split() indq = 0 mini = int(e[0]) for i in range(1, len(e)): if int(e[i]) > mini: mini = int(e[i]) elif int(e[i]) < mini: indq = i + 1 break print(indq)
q = int(input()) e = str(input()).split() indq = 0 mini = int(e[0]) for i in range(1, len(e)): if int(e[i]) > mini: mini = int(e[i]) elif int(e[i]) < mini: indq = i + 1 break print(indq)
__version__ = "1.8.0" __all__ = ["epsonprinter","testpage"]
__version__ = '1.8.0' __all__ = ['epsonprinter', 'testpage']
class RequestExeption(Exception): def __init__(self, request): self.request = request def badRequest(self): self.message = "bad request url : %s" % self.request.url return self def __str__(self): return self.message
class Requestexeption(Exception): def __init__(self, request): self.request = request def bad_request(self): self.message = 'bad request url : %s' % self.request.url return self def __str__(self): return self.message
class Solution: def dieSimulator(self, n: int, rollMax: List[int]) -> int: # dp[i][j]: how many choices we have with i dices and the last face is j # again dp[i][j] means the number of distinct sequences that can be obtained when rolling i times and ending with j MOD = 10 ** 9 + 7 dp = [[0] * 7 for i in range(n + 1)] # dp[1][i]: roll once, end with i => only one possible sequence. so dp[1][i] = 1 for i in range(6): dp[1][i] = 1 # total dp[1][6] = 6 for i in range(2, n + 1): total = 0 for j in range(6): # if there is no constrains, the total sequences ending with j should be the total sequences from previous rolling dp[i][j] = dp[i - 1][6] # for axx1, only 111 is not allowed, so we need to remove 1 sequence from previous sum if i - rollMax[j] == 1: dp[i][j] -= 1 # for axx1, we need to remove the number of a11(211, 311, 411...) if i - rollMax[j] >= 2: reduction = dp[i - rollMax[j] - 1][6] - dp[i - rollMax[j] - 1][j] dp[i][j] = ((dp[i][j] - reduction) % MOD + MOD) % MOD total = (total + dp[i][j]) % MOD dp[i][6] = total return dp[n][6]
class Solution: def die_simulator(self, n: int, rollMax: List[int]) -> int: mod = 10 ** 9 + 7 dp = [[0] * 7 for i in range(n + 1)] for i in range(6): dp[1][i] = 1 dp[1][6] = 6 for i in range(2, n + 1): total = 0 for j in range(6): dp[i][j] = dp[i - 1][6] if i - rollMax[j] == 1: dp[i][j] -= 1 if i - rollMax[j] >= 2: reduction = dp[i - rollMax[j] - 1][6] - dp[i - rollMax[j] - 1][j] dp[i][j] = ((dp[i][j] - reduction) % MOD + MOD) % MOD total = (total + dp[i][j]) % MOD dp[i][6] = total return dp[n][6]
n1 = int(input('Digite um valor: ')) n2 = int(input('Digite um valor: ')) n3 = int(input('Digite um valor: ')) menor = n1 maior = n2 if n2 < n1 and n2 < 3: menor = n2 if n3 < n1 and n3 < n2: menor = n3 if n1 > n2 and n1 > n3: maior = n1 if n3 > n1 and n3 > n2: maior = n3 print(f'O maior valor digitado foi {maior}') print(f'O menor valor digitado foi {menor}')
n1 = int(input('Digite um valor: ')) n2 = int(input('Digite um valor: ')) n3 = int(input('Digite um valor: ')) menor = n1 maior = n2 if n2 < n1 and n2 < 3: menor = n2 if n3 < n1 and n3 < n2: menor = n3 if n1 > n2 and n1 > n3: maior = n1 if n3 > n1 and n3 > n2: maior = n3 print(f'O maior valor digitado foi {maior}') print(f'O menor valor digitado foi {menor}')
# a = ['a1','aa1','a2','aaa1'] # a.sort() # print(a) # print(2346/10) def repeat_to_length(string_to_expand, length): return (string_to_expand * (int(length/len(string_to_expand))+1))[:length] for i in range(200): if i > 10: strnum = str(i) tens = int(strnum[0:-1]) last = strnum[-1] print(strnum) print(tens) print(repeat_to_length("a",tens)+last)
def repeat_to_length(string_to_expand, length): return (string_to_expand * (int(length / len(string_to_expand)) + 1))[:length] for i in range(200): if i > 10: strnum = str(i) tens = int(strnum[0:-1]) last = strnum[-1] print(strnum) print(tens) print(repeat_to_length('a', tens) + last)
''' Given a binary string s (a string consisting only of '0's and '1's), we can split s into 3 non-empty strings s1, s2, s3 (s1+ s2+ s3 = s). Return the number of ways s can be split such that the number of characters '1' is the same in s1, s2, and s3. Since the answer may be too large, return it modulo 10^9 + 7. Example 1: Input: s = "10101" Output: 4 Explanation: There are four ways to split s in 3 parts where each part contain the same number of letters '1'. "1|010|1" "1|01|01" "10|10|1" "10|1|01" Example 2: Input: s = "1001" Output: 0 Example 3: Input: s = "0000" Output: 3 Explanation: There are three ways to split s in 3 parts. "0|0|00" "0|00|0" "00|0|0" Example 4: Input: s = "100100010100110" Output: 12 Constraints: 3 <= s.length <= 10^5 s[i] is '0' or '1'. ''' class Solution: def numWays(self, s: str) -> int: length = len(s) one_count = 0 split_range = {} for i in range(length): if s[i] == '1': one_count += 1 if one_count % 3 != 0 or length < 3: return 0 if one_count == 0: return (length - 2) * (length - 1) // 2 % (10 ** 9 + 7) for i in range(1, 3): split_range[i * one_count // 3] = i - 1 one_count = 0 split_index = [[] for i in range(2)] flag = False tmp_count = 0 for i in range(length): if s[i] == '1': one_count += 1 if flag == True: split_index[tmp_count].append(i) flag = False if s[i] == '1' and one_count in split_range: tmp_count = split_range[one_count] split_index[tmp_count].append(i) flag = True output = (split_index[0][1] - split_index[0][0]) * (split_index[1][1] - split_index[1][0]) return output % (10 ** 9 + 7)
""" Given a binary string s (a string consisting only of '0's and '1's), we can split s into 3 non-empty strings s1, s2, s3 (s1+ s2+ s3 = s). Return the number of ways s can be split such that the number of characters '1' is the same in s1, s2, and s3. Since the answer may be too large, return it modulo 10^9 + 7. Example 1: Input: s = "10101" Output: 4 Explanation: There are four ways to split s in 3 parts where each part contain the same number of letters '1'. "1|010|1" "1|01|01" "10|10|1" "10|1|01" Example 2: Input: s = "1001" Output: 0 Example 3: Input: s = "0000" Output: 3 Explanation: There are three ways to split s in 3 parts. "0|0|00" "0|00|0" "00|0|0" Example 4: Input: s = "100100010100110" Output: 12 Constraints: 3 <= s.length <= 10^5 s[i] is '0' or '1'. """ class Solution: def num_ways(self, s: str) -> int: length = len(s) one_count = 0 split_range = {} for i in range(length): if s[i] == '1': one_count += 1 if one_count % 3 != 0 or length < 3: return 0 if one_count == 0: return (length - 2) * (length - 1) // 2 % (10 ** 9 + 7) for i in range(1, 3): split_range[i * one_count // 3] = i - 1 one_count = 0 split_index = [[] for i in range(2)] flag = False tmp_count = 0 for i in range(length): if s[i] == '1': one_count += 1 if flag == True: split_index[tmp_count].append(i) flag = False if s[i] == '1' and one_count in split_range: tmp_count = split_range[one_count] split_index[tmp_count].append(i) flag = True output = (split_index[0][1] - split_index[0][0]) * (split_index[1][1] - split_index[1][0]) return output % (10 ** 9 + 7)
arr = [2,3,5,8,1,8,0,9,11, 23, 51] num = 0 def searchElement(arr, num): n = len(arr) for i in range(n): if arr[i] == num: print("From if block") return i elif arr[n-1] == num: print("From else if block") return n-1 n-=1 print(searchElement(arr, num))
arr = [2, 3, 5, 8, 1, 8, 0, 9, 11, 23, 51] num = 0 def search_element(arr, num): n = len(arr) for i in range(n): if arr[i] == num: print('From if block') return i elif arr[n - 1] == num: print('From else if block') return n - 1 n -= 1 print(search_element(arr, num))
class MidiProtocol: NON_REAL_TIME_HEADER = 0x7E GENERAL_SYSTEM_INFORMATION = 0x06 DEVICE_IDENTITY_REQUEST = 0x01 @staticmethod def device_identify_request(target=0x00): TARGET_ID = target SUB_ID_1 = MidiProtocol.GENERAL_SYSTEM_INFORMATION SUB_ID_2 = MidiProtocol.DEVICE_IDENTITY_REQUEST return [MidiProtocol.NON_REAL_TIME_HEADER, TARGET_ID, SUB_ID_1, SUB_ID_2] @staticmethod def device_identity_reply_decode(data): ''' F0 7E 00 06 02 52 5A 00 00 00 32 2E 31 30 F7 F0 7E Universal Non Real Time Sys Ex header id ID of target device (default = 7F = All devices) 06 Sub ID#1 = General System Information 02 Sub ID#2 = Device Identity message mm Manufacturers System Exclusive ID code. If mm = 00, then the message is extended by 2 bytes to accomodate the additional manufacturers ID code. ff ff Device family code (14 bits, LSB first) dd dd Device family member code (14 bits, LSB first) ss ss ss ss Software revision level (the format is device specific) F7 EOX ''' # 7e id 06 02 mm ff ff dd dd ss ss ss ss EOX return { 'id': data[1], 'manufacturer': data[4], 'device family code': data[5:7], 'device family member code': data[7:11], }
class Midiprotocol: non_real_time_header = 126 general_system_information = 6 device_identity_request = 1 @staticmethod def device_identify_request(target=0): target_id = target sub_id_1 = MidiProtocol.GENERAL_SYSTEM_INFORMATION sub_id_2 = MidiProtocol.DEVICE_IDENTITY_REQUEST return [MidiProtocol.NON_REAL_TIME_HEADER, TARGET_ID, SUB_ID_1, SUB_ID_2] @staticmethod def device_identity_reply_decode(data): """ F0 7E 00 06 02 52 5A 00 00 00 32 2E 31 30 F7 F0 7E Universal Non Real Time Sys Ex header id ID of target device (default = 7F = All devices) 06 Sub ID#1 = General System Information 02 Sub ID#2 = Device Identity message mm Manufacturers System Exclusive ID code. If mm = 00, then the message is extended by 2 bytes to accomodate the additional manufacturers ID code. ff ff Device family code (14 bits, LSB first) dd dd Device family member code (14 bits, LSB first) ss ss ss ss Software revision level (the format is device specific) F7 EOX """ return {'id': data[1], 'manufacturer': data[4], 'device family code': data[5:7], 'device family member code': data[7:11]}
"""Exceptions raised by flowpipe.""" class CycleError(Exception): """Raised when an action would result in a cycle in a graph."""
"""Exceptions raised by flowpipe.""" class Cycleerror(Exception): """Raised when an action would result in a cycle in a graph."""
def get_chunks(start, value): for each in range(start, 2000000001, value): yield range(each, each+value) def sum_xor_n(value): mod_value = value&3 if mod_value == 3: return 0 elif mod_value == 2: return value+1 elif mod_value == 1: return 1 elif mod_value == 0: return value else: return None def get_numbers_xor(start, end): start_xor = sum_xor_n(start-1) end_xor = sum_xor_n(end) return start_xor^end_xor def solution(start, length): # Your code here checkpoint = length-1 value = 0 for each_chunk in get_chunks(start, length): if checkpoint < 0: break temp = get_numbers_xor( each_chunk[0], each_chunk[checkpoint]) if checkpoint == 0: value ^= each_chunk[0] else: value ^= temp checkpoint -= 1 return value print(solution(0, 3)) print(solution(17, 4))
def get_chunks(start, value): for each in range(start, 2000000001, value): yield range(each, each + value) def sum_xor_n(value): mod_value = value & 3 if mod_value == 3: return 0 elif mod_value == 2: return value + 1 elif mod_value == 1: return 1 elif mod_value == 0: return value else: return None def get_numbers_xor(start, end): start_xor = sum_xor_n(start - 1) end_xor = sum_xor_n(end) return start_xor ^ end_xor def solution(start, length): checkpoint = length - 1 value = 0 for each_chunk in get_chunks(start, length): if checkpoint < 0: break temp = get_numbers_xor(each_chunk[0], each_chunk[checkpoint]) if checkpoint == 0: value ^= each_chunk[0] else: value ^= temp checkpoint -= 1 return value print(solution(0, 3)) print(solution(17, 4))
#! /usr/bin/python # -*- coding: utf-8 -*- VER_MAIN = '3' VER_SUB = '5' BUILD_SN = '160809'
ver_main = '3' ver_sub = '5' build_sn = '160809'
#4-9 Cube Comprehension numberscube = [value ** 3 for value in range(1, 11)] print(numberscube)
numberscube = [value ** 3 for value in range(1, 11)] print(numberscube)
#coding:utf-8 while True: l_c = input().split() x1 = int(l_c[0]) y1 = int(l_c[1]) x2 = int(l_c[2]) y2 = int(l_c[3]) if x1+x2+y1+y2 == 0: break else: if (x1 == x2 and y1 == y2): print(0) elif ((x2-x1) == -(y2-y1) or -(x2-x1) == -(y2-y1)): print(1) elif -(x2-x1) == (y2-y1) or (x2-x1) == (y2-y1): print(1) elif (x1 == x2 or y1 == y2): print(1) else: print(2)
while True: l_c = input().split() x1 = int(l_c[0]) y1 = int(l_c[1]) x2 = int(l_c[2]) y2 = int(l_c[3]) if x1 + x2 + y1 + y2 == 0: break elif x1 == x2 and y1 == y2: print(0) elif x2 - x1 == -(y2 - y1) or -(x2 - x1) == -(y2 - y1): print(1) elif -(x2 - x1) == y2 - y1 or x2 - x1 == y2 - y1: print(1) elif x1 == x2 or y1 == y2: print(1) else: print(2)
# Definition for a binary tree node. # class Node(object): # def __init__(self, val=" ", left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def expTree(self, s: str) -> 'Node': def process_op(): op = op_stack.pop() rhs = val_stack.pop() lhs = val_stack.pop() node = Node(val=op, left=lhs, right=rhs) val_stack.append(node) def priority(op): if op in '+-': return 1 elif op in '*/': return 2 else: return -1 val_stack = [] op_stack = [] for ch in s: if ch.isdigit(): val_stack.append(Node(ch)) else: if ch == '(': op_stack.append('(') elif ch == ')': while op_stack[-1] != '(': process_op() op_stack.pop() else: cur_op = ch while op_stack and priority(op_stack[-1]) >= priority(cur_op): process_op() op_stack.append(cur_op) while op_stack: process_op() return val_stack[0]
class Solution: def exp_tree(self, s: str) -> 'Node': def process_op(): op = op_stack.pop() rhs = val_stack.pop() lhs = val_stack.pop() node = node(val=op, left=lhs, right=rhs) val_stack.append(node) def priority(op): if op in '+-': return 1 elif op in '*/': return 2 else: return -1 val_stack = [] op_stack = [] for ch in s: if ch.isdigit(): val_stack.append(node(ch)) elif ch == '(': op_stack.append('(') elif ch == ')': while op_stack[-1] != '(': process_op() op_stack.pop() else: cur_op = ch while op_stack and priority(op_stack[-1]) >= priority(cur_op): process_op() op_stack.append(cur_op) while op_stack: process_op() return val_stack[0]
# Practice problem 1 for chapter 4 # Function that takes an array and returns a comma-separated string def make_string(array): answer_string = "" for i in array: if array.index(i) == 0: answer_string += str(i) # Last index word finishes with "and" before it elif array.index(i) == len(array) - 1: answer_string += ", and " + str(i) else: answer_string += ", " + str(i) print(answer_string) # Test from book my_arr = ["apple", "bananas", "tofu", "cats"] answer = make_string(my_arr)
def make_string(array): answer_string = '' for i in array: if array.index(i) == 0: answer_string += str(i) elif array.index(i) == len(array) - 1: answer_string += ', and ' + str(i) else: answer_string += ', ' + str(i) print(answer_string) my_arr = ['apple', 'bananas', 'tofu', 'cats'] answer = make_string(my_arr)
class RCListener: def __iter__(self): raise NotImplementedError() class Source: def listener(self, *args, **kwargs): raise NotImplementedError() def query(self, start, end, *args, types=None, **kwargs): raise NotImplementedError()
class Rclistener: def __iter__(self): raise not_implemented_error() class Source: def listener(self, *args, **kwargs): raise not_implemented_error() def query(self, start, end, *args, types=None, **kwargs): raise not_implemented_error()
class DataGridEditingUnit(Enum, IComparable, IFormattable, IConvertible): """ Defines constants that specify whether editing is enabled on a cell level or on a row level. enum DataGridEditingUnit,values: Cell (0),Row (1) """ def __eq__(self, *args): """ x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq__(y) <==> x==y """ pass def __format__(self, *args): """ __format__(formattable: IFormattable,format: str) -> str """ pass def __ge__(self, *args): pass def __gt__(self, *args): pass def __init__(self, *args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass def __le__(self, *args): pass def __lt__(self, *args): pass def __ne__(self, *args): pass def __reduce_ex__(self, *args): pass def __str__(self, *args): pass Cell = None Row = None value__ = None
class Datagrideditingunit(Enum, IComparable, IFormattable, IConvertible): """ Defines constants that specify whether editing is enabled on a cell level or on a row level. enum DataGridEditingUnit,values: Cell (0),Row (1) """ def __eq__(self, *args): """ x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq__(y) <==> x==y """ pass def __format__(self, *args): """ __format__(formattable: IFormattable,format: str) -> str """ pass def __ge__(self, *args): pass def __gt__(self, *args): pass def __init__(self, *args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass def __le__(self, *args): pass def __lt__(self, *args): pass def __ne__(self, *args): pass def __reduce_ex__(self, *args): pass def __str__(self, *args): pass cell = None row = None value__ = None
for _ in range(int(input())): n,q = [int(x) for x in input().split()] a = [int(x) for x in input().split()] for _ in range(q): k = int(input()) sum = 0 # if(k == 0):k = 1 for i in range(0,n,k + 1): sum += a[i] print(sum)
for _ in range(int(input())): (n, q) = [int(x) for x in input().split()] a = [int(x) for x in input().split()] for _ in range(q): k = int(input()) sum = 0 for i in range(0, n, k + 1): sum += a[i] print(sum)
def front_back(s): if len(s) > 1: string = [s[-1]] string.extend([i for i in s[1:-1]]) string.append(s[0]) return "".join(string) else: return s
def front_back(s): if len(s) > 1: string = [s[-1]] string.extend([i for i in s[1:-1]]) string.append(s[0]) return ''.join(string) else: return s
# twitter api data (replace yours here given are placeholder) # if you have not yet, go for applying at: https://developer.twitter.com/ TWITTER_KEY="" TWITTER_SECRET="" TWITTER_APP_KEY="" TWITTER_APP_SECRET="" with open("twitter_keys.txt") as f: for line in f: tups=line.strip().split("=") if tups[0] == "TWITTER_KEY": TWITTER_KEY=tups[1] elif tups[0] == "TWITTER_SECRET": TWITTER_SECRET=tups[1] elif tups[0] == "TWITTER_APP_KEY": TWITTER_APP_KEY=tups[1] elif tups[0] == "TWITTER_APP_SECRET": TWITTER_APP_SECRET=tups[1]
twitter_key = '' twitter_secret = '' twitter_app_key = '' twitter_app_secret = '' with open('twitter_keys.txt') as f: for line in f: tups = line.strip().split('=') if tups[0] == 'TWITTER_KEY': twitter_key = tups[1] elif tups[0] == 'TWITTER_SECRET': twitter_secret = tups[1] elif tups[0] == 'TWITTER_APP_KEY': twitter_app_key = tups[1] elif tups[0] == 'TWITTER_APP_SECRET': twitter_app_secret = tups[1]
def maximum_subarray_1(coll): n = len(coll) max_result = 0 for i in xrange(1, n+1): for j in range(n-i+1): result = sum(coll[j: j+i]) if max_result < result: max_result = result return max_result def maximum_subarray_2(coll): n = len(coll) max_result = 0 for i in xrange(n): result = 0 for j in xrange(i, n): result += coll[j] if max_result < result: max_result = result return max_result def maximum_subarray_3(coll): if len(coll) == 0: return 0 # return maximum of (1) maximum subarray of array excluding last one, and # (2) maximum subarray including the final element n = len(coll) result = 0 sums_with_final = [] for i in xrange(n-1, -1, -1): result += coll[i] sums_with_final.append(result) return max([maximum_subarray_3(coll[:-1])] + sums_with_final) def maximum_subarray(coll): return maximum_subarray_3(coll)
def maximum_subarray_1(coll): n = len(coll) max_result = 0 for i in xrange(1, n + 1): for j in range(n - i + 1): result = sum(coll[j:j + i]) if max_result < result: max_result = result return max_result def maximum_subarray_2(coll): n = len(coll) max_result = 0 for i in xrange(n): result = 0 for j in xrange(i, n): result += coll[j] if max_result < result: max_result = result return max_result def maximum_subarray_3(coll): if len(coll) == 0: return 0 n = len(coll) result = 0 sums_with_final = [] for i in xrange(n - 1, -1, -1): result += coll[i] sums_with_final.append(result) return max([maximum_subarray_3(coll[:-1])] + sums_with_final) def maximum_subarray(coll): return maximum_subarray_3(coll)
lines = [] for i in xrange(3): line = Line() line.xValues = xrange(5) line.yValues = [(i+1 / 2.0) * pow(x, i+1) for x in line.xValues] line.label = "Line %d" % (i + 1) lines.append(line) plot = Plot() plot.add(lines[0]) inset = Plot() inset.add(lines[1]) inset.hideTickLabels() inset.title = ("Inset in Yo Inset\n" "So You Can Inset\n" "While You Inset") insideInset = Plot() insideInset.hideTickLabels() insideInset.add(lines[2]) inset.addInset(insideInset, width=0.4, height=0.3, location="upper left") plot.addInset(inset, width=0.4, height=0.4, location="lower right") plot.save("inset.png")
lines = [] for i in xrange(3): line = line() line.xValues = xrange(5) line.yValues = [(i + 1 / 2.0) * pow(x, i + 1) for x in line.xValues] line.label = 'Line %d' % (i + 1) lines.append(line) plot = plot() plot.add(lines[0]) inset = plot() inset.add(lines[1]) inset.hideTickLabels() inset.title = 'Inset in Yo Inset\nSo You Can Inset\nWhile You Inset' inside_inset = plot() insideInset.hideTickLabels() insideInset.add(lines[2]) inset.addInset(insideInset, width=0.4, height=0.3, location='upper left') plot.addInset(inset, width=0.4, height=0.4, location='lower right') plot.save('inset.png')
file = open('csv_data.txt', 'r') lines = file.readlines() file.close() lines = [line.strip() for line in lines[1:]] for line in lines: person_data = line.split(',') name = person_data[0].title() age = person_data[1] university = person_data[2].title() degree = person_data[3].capitalize() print(f'{name} is {age}, studying {degree} at {university}.')
file = open('csv_data.txt', 'r') lines = file.readlines() file.close() lines = [line.strip() for line in lines[1:]] for line in lines: person_data = line.split(',') name = person_data[0].title() age = person_data[1] university = person_data[2].title() degree = person_data[3].capitalize() print(f'{name} is {age}, studying {degree} at {university}.')
"""Top-level package for BioCyc and BRENDA in Python.""" __author__ = """Yi Zhou""" __email__ = 'zhou.zy.yi@gmail.com' __version__ = '0.1.0'
"""Top-level package for BioCyc and BRENDA in Python.""" __author__ = 'Yi Zhou' __email__ = 'zhou.zy.yi@gmail.com' __version__ = '0.1.0'
def media(n1, n2): m = (n1 + n2)/2 return m print(media(n1=10, n2=5)) def juros(preco, juros): res = preco * (1 + juros/100) return res print(juros(preco=10, juros=50))
def media(n1, n2): m = (n1 + n2) / 2 return m print(media(n1=10, n2=5)) def juros(preco, juros): res = preco * (1 + juros / 100) return res print(juros(preco=10, juros=50))
"""Multiply two arbitrary-precision integers. - [EPI: 5.3]. """ def multiply(num1, num2): sign = -1 if (num1[0] < 0) ^ (num2[0] < 0) else 1 num1[0], num2[0] = abs(num1[0]), abs(num2[0]) result = [0] * (len(num1) + len(num2)) for i in reversed(range(len(num1))): for j in reversed(range(len(num2))): result[i + j + 1] += num1[i] * num2[j] result[i + j] += result[i + j + 1] // 10 result[i + j + 1] %= 10 # Remove the leading zeroes. result = result[next((i for i, x in enumerate(result) if x != 0), len(result)):] or [0] return [sign * result[0]] + result[1:]
"""Multiply two arbitrary-precision integers. - [EPI: 5.3]. """ def multiply(num1, num2): sign = -1 if (num1[0] < 0) ^ (num2[0] < 0) else 1 (num1[0], num2[0]) = (abs(num1[0]), abs(num2[0])) result = [0] * (len(num1) + len(num2)) for i in reversed(range(len(num1))): for j in reversed(range(len(num2))): result[i + j + 1] += num1[i] * num2[j] result[i + j] += result[i + j + 1] // 10 result[i + j + 1] %= 10 result = result[next((i for (i, x) in enumerate(result) if x != 0), len(result)):] or [0] return [sign * result[0]] + result[1:]
def test_session_interruption(ui, ui_interrupted_session): ui_interrupted_session.click() interrupted_test = ui.driver.find_element_by_css_selector('.item.test') css_classes = interrupted_test.get_attribute('class') assert 'success' not in css_classes assert 'fail' not in css_classes interrupted_test.click() assert 'errors' not in ui.driver.current_url [link] = ui.driver.find_elements_by_xpath("//*[contains(text(), 'Interruptions')]") link.click() error_boxes = ui.driver.find_elements_by_class_name('error-box') assert len(error_boxes) == 1 [err] = error_boxes assert 'interruption' in err.get_attribute('class')
def test_session_interruption(ui, ui_interrupted_session): ui_interrupted_session.click() interrupted_test = ui.driver.find_element_by_css_selector('.item.test') css_classes = interrupted_test.get_attribute('class') assert 'success' not in css_classes assert 'fail' not in css_classes interrupted_test.click() assert 'errors' not in ui.driver.current_url [link] = ui.driver.find_elements_by_xpath("//*[contains(text(), 'Interruptions')]") link.click() error_boxes = ui.driver.find_elements_by_class_name('error-box') assert len(error_boxes) == 1 [err] = error_boxes assert 'interruption' in err.get_attribute('class')
# Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: def sortedArrayToBST(self, nums): return self.recurse(nums,0,len(nums)-1) def recurse(self,nums,start,end): if end<start: return None mid=int(start+(end-start)/2) root=TreeNode(val=nums[mid],left=self.recurse(nums,start,mid-1),right=self.recurse(nums,mid+1,end)) return root def forward(self,root): if not root: return print(root.val) self.forward(root.left) self.forward(root.right) if __name__ == '__main__': sol=Solution() nums = [-10, -3, 0, 5, 9] root=sol.sortedArrayToBST(nums) sol.forward(root)
class Treenode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: def sorted_array_to_bst(self, nums): return self.recurse(nums, 0, len(nums) - 1) def recurse(self, nums, start, end): if end < start: return None mid = int(start + (end - start) / 2) root = tree_node(val=nums[mid], left=self.recurse(nums, start, mid - 1), right=self.recurse(nums, mid + 1, end)) return root def forward(self, root): if not root: return print(root.val) self.forward(root.left) self.forward(root.right) if __name__ == '__main__': sol = solution() nums = [-10, -3, 0, 5, 9] root = sol.sortedArrayToBST(nums) sol.forward(root)
"""Helper function to save serializer""" def save_serializer(serializer): """returns a particular response for when serializer passed is valid or not""" serializer.save() data = { "status": "success", "data": serializer.data } return data
"""Helper function to save serializer""" def save_serializer(serializer): """returns a particular response for when serializer passed is valid or not""" serializer.save() data = {'status': 'success', 'data': serializer.data} return data
Vivaldi = Goalkeeper('Juan Vivaldi', 83, 77, 72, 82) Peillat = Outfield_Player('Gonzalo Peillat', 'DF', 70, 89, 78, 73, 79, 67) Ortiz = Outfield_Player('Ignacio Ortiz', 'MF', 79, 78, 77, 80, 75, 81) Rey = Outfield_Player('Matias Rey', 'MF', 81, 77, 74, 72, 87, 72) Vila = Outfield_Player('Lucas Vila', 'FW', 87, 50, 80, 82, 74, 85) ARG = Team('Argentina', Vivaldi, Peillat, Ortiz, Rey, Vila)
vivaldi = goalkeeper('Juan Vivaldi', 83, 77, 72, 82) peillat = outfield__player('Gonzalo Peillat', 'DF', 70, 89, 78, 73, 79, 67) ortiz = outfield__player('Ignacio Ortiz', 'MF', 79, 78, 77, 80, 75, 81) rey = outfield__player('Matias Rey', 'MF', 81, 77, 74, 72, 87, 72) vila = outfield__player('Lucas Vila', 'FW', 87, 50, 80, 82, 74, 85) arg = team('Argentina', Vivaldi, Peillat, Ortiz, Rey, Vila)
def factorial(x): '''calculo de factorial con una funcion recursiva''' if x == 1: return 1 else: return (x * factorial(x-1)) num = 928 print('el factorial de: ', num ,'is ', factorial(num))
def factorial(x): """calculo de factorial con una funcion recursiva""" if x == 1: return 1 else: return x * factorial(x - 1) num = 928 print('el factorial de: ', num, 'is ', factorial(num))
# prompting user to enter the file name fname = input('Enter file name: ') d = dict() # catching exceptions try: fhand = open(fname) except: print('File does not exist') exit() # reading the lines in the file for line in fhand: words = line.split() # we only want email addresses if len(words) < 2 or words[0] != 'From': continue else: d[words[1]] = d.get(words[1], 0) + 1 print(d)
fname = input('Enter file name: ') d = dict() try: fhand = open(fname) except: print('File does not exist') exit() for line in fhand: words = line.split() if len(words) < 2 or words[0] != 'From': continue else: d[words[1]] = d.get(words[1], 0) + 1 print(d)
# Copyright 2014 Google Inc. # # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'variables': { 'skia_warnings_as_errors': 0, }, 'targets': [ { 'target_name': 'libpng', 'type': 'none', 'conditions': [ [ 'skia_android_framework', { 'dependencies': [ 'android_deps.gyp:png' ], 'export_dependent_settings': [ 'android_deps.gyp:png' ], },{ 'dependencies': [ 'libpng.gyp:libpng_static' ], 'export_dependent_settings': [ 'libpng.gyp:libpng_static' ], }] ] }, { 'target_name': 'libpng_static', 'type': 'static_library', 'standalone_static_library': 1, 'include_dirs': [ '../third_party/libpng', ], 'dependencies': [ 'zlib.gyp:zlib', ], 'export_dependent_settings': [ 'zlib.gyp:zlib', ], 'direct_dependent_settings': { 'include_dirs': [ '../third_party/libpng', ], }, 'cflags': [ '-w', '-fvisibility=hidden', ], 'sources': [ '../third_party/libpng/png.c', '../third_party/libpng/pngerror.c', '../third_party/libpng/pngget.c', '../third_party/libpng/pngmem.c', '../third_party/libpng/pngpread.c', '../third_party/libpng/pngread.c', '../third_party/libpng/pngrio.c', '../third_party/libpng/pngrtran.c', '../third_party/libpng/pngrutil.c', '../third_party/libpng/pngset.c', '../third_party/libpng/pngtrans.c', '../third_party/libpng/pngwio.c', '../third_party/libpng/pngwrite.c', '../third_party/libpng/pngwtran.c', '../third_party/libpng/pngwutil.c', ], 'conditions': [ [ '"x86" in skia_arch_type', { 'defines': [ 'PNG_INTEL_SSE_OPT=1', ], 'sources': [ '../third_party/libpng/contrib/intel/intel_init.c', '../third_party/libpng/contrib/intel/filter_sse2_intrinsics.c', ], }], [ '(("arm64" == skia_arch_type) or \ ("arm" == skia_arch_type and arm_neon == 1)) and \ ("ios" != skia_os)', { 'defines': [ 'PNG_ARM_NEON_OPT=2', 'PNG_ARM_NEON_IMPLEMENTATION=1', ], 'sources': [ '../third_party/libpng/arm/arm_init.c', '../third_party/libpng/arm/filter_neon_intrinsics.c', ], }], [ '"ios" == skia_os', { 'defines': [ 'PNG_ARM_NEON_OPT=0', ], }], ], } ] }
{'variables': {'skia_warnings_as_errors': 0}, 'targets': [{'target_name': 'libpng', 'type': 'none', 'conditions': [['skia_android_framework', {'dependencies': ['android_deps.gyp:png'], 'export_dependent_settings': ['android_deps.gyp:png']}, {'dependencies': ['libpng.gyp:libpng_static'], 'export_dependent_settings': ['libpng.gyp:libpng_static']}]]}, {'target_name': 'libpng_static', 'type': 'static_library', 'standalone_static_library': 1, 'include_dirs': ['../third_party/libpng'], 'dependencies': ['zlib.gyp:zlib'], 'export_dependent_settings': ['zlib.gyp:zlib'], 'direct_dependent_settings': {'include_dirs': ['../third_party/libpng']}, 'cflags': ['-w', '-fvisibility=hidden'], 'sources': ['../third_party/libpng/png.c', '../third_party/libpng/pngerror.c', '../third_party/libpng/pngget.c', '../third_party/libpng/pngmem.c', '../third_party/libpng/pngpread.c', '../third_party/libpng/pngread.c', '../third_party/libpng/pngrio.c', '../third_party/libpng/pngrtran.c', '../third_party/libpng/pngrutil.c', '../third_party/libpng/pngset.c', '../third_party/libpng/pngtrans.c', '../third_party/libpng/pngwio.c', '../third_party/libpng/pngwrite.c', '../third_party/libpng/pngwtran.c', '../third_party/libpng/pngwutil.c'], 'conditions': [['"x86" in skia_arch_type', {'defines': ['PNG_INTEL_SSE_OPT=1'], 'sources': ['../third_party/libpng/contrib/intel/intel_init.c', '../third_party/libpng/contrib/intel/filter_sse2_intrinsics.c']}], ['(("arm64" == skia_arch_type) or ("arm" == skia_arch_type and arm_neon == 1)) and ("ios" != skia_os)', {'defines': ['PNG_ARM_NEON_OPT=2', 'PNG_ARM_NEON_IMPLEMENTATION=1'], 'sources': ['../third_party/libpng/arm/arm_init.c', '../third_party/libpng/arm/filter_neon_intrinsics.c']}], ['"ios" == skia_os', {'defines': ['PNG_ARM_NEON_OPT=0']}]]}]}
_base_ = "./common_base.py" # ----------------------------------------------------------------------------- # base model cfg for gdrn # ----------------------------------------------------------------------------- MODEL = dict( DEVICE="cuda", WEIGHTS="", # PIXEL_MEAN = [103.530, 116.280, 123.675] # bgr # PIXEL_STD = [57.375, 57.120, 58.395] # PIXEL_MEAN = [123.675, 116.280, 103.530] # rgb # PIXEL_STD = [58.395, 57.120, 57.375] PIXEL_MEAN=[0, 0, 0], # to [0,1] PIXEL_STD=[255.0, 255.0, 255.0], LOAD_DETS_TEST=False, CDPN=dict( NAME="GDRN", # used module file name TASK="rot", USE_MTL=False, # uncertainty multi-task weighting ## backbone BACKBONE=dict( PRETRAINED="torchvision://resnet34", ARCH="resnet", NUM_LAYERS=34, INPUT_CHANNEL=3, INPUT_RES=256, OUTPUT_RES=64, FREEZE=False, ), ## rot head ROT_HEAD=dict( FREEZE=False, ROT_CONCAT=False, XYZ_BIN=64, # for classification xyz, the last one is bg NUM_LAYERS=3, NUM_FILTERS=256, CONV_KERNEL_SIZE=3, NORM="BN", NUM_GN_GROUPS=32, OUT_CONV_KERNEL_SIZE=1, NUM_CLASSES=13, ROT_CLASS_AWARE=False, XYZ_LOSS_TYPE="L1", # L1 | CE_coor XYZ_LOSS_MASK_GT="visib", # trunc | visib | obj XYZ_LW=1.0, MASK_CLASS_AWARE=False, MASK_LOSS_TYPE="L1", # L1 | BCE | CE MASK_LOSS_GT="trunc", # trunc | visib | gt MASK_LW=1.0, MASK_THR_TEST=0.5, # for region classification, 0 is bg, [1, num_regions] # num_regions <= 1: no region classification NUM_REGIONS=8, REGION_CLASS_AWARE=False, REGION_LOSS_TYPE="CE", # CE REGION_LOSS_MASK_GT="visib", # trunc | visib | obj REGION_LW=1.0, ), ## for direct regression PNP_NET=dict( FREEZE=False, R_ONLY=False, LR_MULT=1.0, # ConvPnPNet | SimplePointPnPNet | PointPnPNet | ResPointPnPNet PNP_HEAD_CFG=dict(type="ConvPnPNet", norm="GN", num_gn_groups=32, drop_prob=0.0), # 0.25 # PNP_HEAD_CFG=dict( # type="ConvPnPNet", # norm="GN", # num_gn_groups=32, # spatial_pooltype="max", # max | mean | soft | topk # spatial_topk=1, # region_softpool=False, # region_topk=8, # NOTE: default the same as NUM_REGIONS # ), WITH_2D_COORD=False, # using 2D XY coords REGION_ATTENTION=False, # region attention MASK_ATTENTION="none", # none | concat | mul TRANS_WITH_BOX_INFO="none", # none | ltrb | wh # TODO ## for losses # {allo/ego}_{quat/rot6d/log_quat/lie_vec} ROT_TYPE="ego_rot6d", TRANS_TYPE="centroid_z", # trans | centroid_z (SITE) | centroid_z_abs Z_TYPE="REL", # REL | ABS | LOG | NEG_LOG (only valid for centroid_z) # point matching loss NUM_PM_POINTS=3000, PM_LOSS_TYPE="L1", # L1 | Smooth_L1 PM_SMOOTH_L1_BETA=1.0, PM_LOSS_SYM=False, # use symmetric PM loss PM_NORM_BY_EXTENT=False, # 10. / extent.max(1, keepdim=True)[0] # if False, the trans loss is in point matching loss PM_R_ONLY=True, # only do R loss in PM PM_DISENTANGLE_T=False, # disentangle R/T PM_DISENTANGLE_Z=False, # disentangle R/xy/z PM_T_USE_POINTS=False, PM_LW=1.0, ROT_LOSS_TYPE="angular", # angular | L2 ROT_LW=0.0, CENTROID_LOSS_TYPE="L1", CENTROID_LW=0.0, Z_LOSS_TYPE="L1", Z_LW=0.0, TRANS_LOSS_TYPE="L1", TRANS_LOSS_DISENTANGLE=True, TRANS_LW=0.0, # bind term loss: R^T@t BIND_LOSS_TYPE="L1", BIND_LW=0.0, ), ## trans head TRANS_HEAD=dict( ENABLED=False, FREEZE=True, LR_MULT=1.0, NUM_LAYERS=3, NUM_FILTERS=256, NORM="BN", NUM_GN_GROUPS=32, CONV_KERNEL_SIZE=3, OUT_CHANNEL=3, TRANS_TYPE="centroid_z", # trans | centroid_z Z_TYPE="REL", # REL | ABS | LOG | NEG_LOG CENTROID_LOSS_TYPE="L1", CENTROID_LW=0.0, Z_LOSS_TYPE="L1", Z_LW=0.0, TRANS_LOSS_TYPE="L1", TRANS_LW=0.0, ), ), # some d2 keys but not used KEYPOINT_ON=False, LOAD_PROPOSALS=False, ) TEST = dict( EVAL_PERIOD=0, VIS=False, TEST_BBOX_TYPE="gt", # gt | est USE_PNP=False, # use pnp or direct prediction # ransac_pnp | net_iter_pnp (learned pnp init + iter pnp) | net_ransac_pnp (net init + ransac pnp) # net_ransac_pnp_rot (net_init + ransanc pnp --> net t + pnp R) PNP_TYPE="ransac_pnp", PRECISE_BN=dict(ENABLED=False, NUM_ITER=200), )
_base_ = './common_base.py' model = dict(DEVICE='cuda', WEIGHTS='', PIXEL_MEAN=[0, 0, 0], PIXEL_STD=[255.0, 255.0, 255.0], LOAD_DETS_TEST=False, CDPN=dict(NAME='GDRN', TASK='rot', USE_MTL=False, BACKBONE=dict(PRETRAINED='torchvision://resnet34', ARCH='resnet', NUM_LAYERS=34, INPUT_CHANNEL=3, INPUT_RES=256, OUTPUT_RES=64, FREEZE=False), ROT_HEAD=dict(FREEZE=False, ROT_CONCAT=False, XYZ_BIN=64, NUM_LAYERS=3, NUM_FILTERS=256, CONV_KERNEL_SIZE=3, NORM='BN', NUM_GN_GROUPS=32, OUT_CONV_KERNEL_SIZE=1, NUM_CLASSES=13, ROT_CLASS_AWARE=False, XYZ_LOSS_TYPE='L1', XYZ_LOSS_MASK_GT='visib', XYZ_LW=1.0, MASK_CLASS_AWARE=False, MASK_LOSS_TYPE='L1', MASK_LOSS_GT='trunc', MASK_LW=1.0, MASK_THR_TEST=0.5, NUM_REGIONS=8, REGION_CLASS_AWARE=False, REGION_LOSS_TYPE='CE', REGION_LOSS_MASK_GT='visib', REGION_LW=1.0), PNP_NET=dict(FREEZE=False, R_ONLY=False, LR_MULT=1.0, PNP_HEAD_CFG=dict(type='ConvPnPNet', norm='GN', num_gn_groups=32, drop_prob=0.0), WITH_2D_COORD=False, REGION_ATTENTION=False, MASK_ATTENTION='none', TRANS_WITH_BOX_INFO='none', ROT_TYPE='ego_rot6d', TRANS_TYPE='centroid_z', Z_TYPE='REL', NUM_PM_POINTS=3000, PM_LOSS_TYPE='L1', PM_SMOOTH_L1_BETA=1.0, PM_LOSS_SYM=False, PM_NORM_BY_EXTENT=False, PM_R_ONLY=True, PM_DISENTANGLE_T=False, PM_DISENTANGLE_Z=False, PM_T_USE_POINTS=False, PM_LW=1.0, ROT_LOSS_TYPE='angular', ROT_LW=0.0, CENTROID_LOSS_TYPE='L1', CENTROID_LW=0.0, Z_LOSS_TYPE='L1', Z_LW=0.0, TRANS_LOSS_TYPE='L1', TRANS_LOSS_DISENTANGLE=True, TRANS_LW=0.0, BIND_LOSS_TYPE='L1', BIND_LW=0.0), TRANS_HEAD=dict(ENABLED=False, FREEZE=True, LR_MULT=1.0, NUM_LAYERS=3, NUM_FILTERS=256, NORM='BN', NUM_GN_GROUPS=32, CONV_KERNEL_SIZE=3, OUT_CHANNEL=3, TRANS_TYPE='centroid_z', Z_TYPE='REL', CENTROID_LOSS_TYPE='L1', CENTROID_LW=0.0, Z_LOSS_TYPE='L1', Z_LW=0.0, TRANS_LOSS_TYPE='L1', TRANS_LW=0.0)), KEYPOINT_ON=False, LOAD_PROPOSALS=False) test = dict(EVAL_PERIOD=0, VIS=False, TEST_BBOX_TYPE='gt', USE_PNP=False, PNP_TYPE='ransac_pnp', PRECISE_BN=dict(ENABLED=False, NUM_ITER=200))
#This app does your math addition = input("Print your math sign, +, -, *, /: ") if addition == "+": a = int(input("First Number: ")) b = int(input("Seccond Number: ")) c = a + b print(c) elif addition == "-": a = int(input("First Number: ")) b = int(input("Seccond Number: ")) c = a - b print(c) elif addition == "*": a = int(input("First Number: ")) b = int(input("Seccond Number: ")) c = a * b print(c) elif addition == "/": a = int(input("First Number: ")) b = int(input("Seccond Number: ")) c = a / b print(c) else: print("That is not a valid operation. Please do +, -, *, /")
addition = input('Print your math sign, +, -, *, /: ') if addition == '+': a = int(input('First Number: ')) b = int(input('Seccond Number: ')) c = a + b print(c) elif addition == '-': a = int(input('First Number: ')) b = int(input('Seccond Number: ')) c = a - b print(c) elif addition == '*': a = int(input('First Number: ')) b = int(input('Seccond Number: ')) c = a * b print(c) elif addition == '/': a = int(input('First Number: ')) b = int(input('Seccond Number: ')) c = a / b print(c) else: print('That is not a valid operation. Please do +, -, *, /')
class Solution: def sequentialDigits(self, low: int, high: int) -> List[int]: sequence, base, result = '123456789', 10, [] for length in range(len(str(low)), len(str(high)) + 1): for start in range(base - length): number = int(sequence[start : start + length]) if low <= number <= high: result.append(number) return result
class Solution: def sequential_digits(self, low: int, high: int) -> List[int]: (sequence, base, result) = ('123456789', 10, []) for length in range(len(str(low)), len(str(high)) + 1): for start in range(base - length): number = int(sequence[start:start + length]) if low <= number <= high: result.append(number) return result
# -*- coding: utf-8 -*- def range(start, stop, step=1.): """Replacement for built-in range function. :param start: Starting value. :type start: number :param stop: End value. :type stop: number :param step: Step size. :type step: number :returns: List of values from `start` to `stop` incremented by `size`. :rtype: [float] """ start, stop, step = map(float, (start, stop, step)) result = [start] current = start while current < stop: current += step result.append(current) return result def up(a, b, x): a, b, x = map(float, (a, b, x)) a = float(a) b = float(b) x = float(x) if x < a: return 0.0 if x < b: return (x - a) / (b - a) return 1.0 def down(a, b, x): return 1. - up(a, b, x) def tri(a, b, x): a, b, x = map(float, (a, b, x)) m = (a + b) / 2. first = (x - a) / (m - a) second = (b - x) / (b - m) return max(min(first, second), 0.) def trap(a, b, c, d, x): a, b, c, d, x = map(float, (a, b, c, d, x)) first = (x - a) / (b - a) second = (d - x) / (d - c) return max(min(first, 1., second), 0.) def ltrap(a, b, x): a, b, x = map(float, (a, b, x)) return max(min((b - x) / (b - a), 1.), 0.) def rtrap(a, b, x): a, b, x = map(float, (a, b, x)) return max(min((x - a) / (b - a), 1.), 0.) def rect(a, b, x): a, b, x = map(float, (a, b, x)) return 1. if a < x < b else 0
def range(start, stop, step=1.0): """Replacement for built-in range function. :param start: Starting value. :type start: number :param stop: End value. :type stop: number :param step: Step size. :type step: number :returns: List of values from `start` to `stop` incremented by `size`. :rtype: [float] """ (start, stop, step) = map(float, (start, stop, step)) result = [start] current = start while current < stop: current += step result.append(current) return result def up(a, b, x): (a, b, x) = map(float, (a, b, x)) a = float(a) b = float(b) x = float(x) if x < a: return 0.0 if x < b: return (x - a) / (b - a) return 1.0 def down(a, b, x): return 1.0 - up(a, b, x) def tri(a, b, x): (a, b, x) = map(float, (a, b, x)) m = (a + b) / 2.0 first = (x - a) / (m - a) second = (b - x) / (b - m) return max(min(first, second), 0.0) def trap(a, b, c, d, x): (a, b, c, d, x) = map(float, (a, b, c, d, x)) first = (x - a) / (b - a) second = (d - x) / (d - c) return max(min(first, 1.0, second), 0.0) def ltrap(a, b, x): (a, b, x) = map(float, (a, b, x)) return max(min((b - x) / (b - a), 1.0), 0.0) def rtrap(a, b, x): (a, b, x) = map(float, (a, b, x)) return max(min((x - a) / (b - a), 1.0), 0.0) def rect(a, b, x): (a, b, x) = map(float, (a, b, x)) return 1.0 if a < x < b else 0
class Solution(object): def largestRectangleArea1(self, heights): """ :type heights: List[int] :rtype: int """ self.ans = float('-inf') def recurse(heights, l, r): if l > r: return 0 min_idx = l # index r is included when searching min for i in range(l, r + 1): if heights[min_idx] > heights[i]: min_idx = i print(l, r) return max( heights[min_idx] * (r - l + 1), recurse(heights, l, min_idx - 1), recurse(heights, min_idx + 1, r)) return recurse(heights, 0, len(heights) - 1) def largestRectangleArea2(self, heights): """ :type heights: List[int] :rtype: int """ self.ans = float('-inf') def recurse(heights, l, r): if l > r: return 0 min_idx = l # index r is included when searching min for i in range(l, r + 1): if heights[min_idx] > heights[i]: min_idx = i print(l, r) # time limit exceeded cur = heights[min_idx] * (r - l + 1) left = recurse(heights, min_idx + 1, r) right = recurse(heights, l, min_idx - 1) return max(cur, left, right) return recurse(heights, 0, len(heights) - 1) def largestRectangleArea(self, height): height.append(0) stack, size = [], 0 for i in range(len(height)): while stack and height[stack[-1]] > height[i]: l = stack.pop() h = height[l] w = i if not stack else i-l cand = h * w print(cand) size = max(size, cand) stack.append(i) return size solver = Solution() arr1 = [2,1,5,6,2,3] arr2 = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67] print("largestRectangleArea") print(solver.largestRectangleArea(arr2)) # print("largestRectangleArea") # print(solver.largestRectangleArea1(arr2)) # # print("largestRectangleArea2") # print(solver.largestRectangleArea2(arr2))
class Solution(object): def largest_rectangle_area1(self, heights): """ :type heights: List[int] :rtype: int """ self.ans = float('-inf') def recurse(heights, l, r): if l > r: return 0 min_idx = l for i in range(l, r + 1): if heights[min_idx] > heights[i]: min_idx = i print(l, r) return max(heights[min_idx] * (r - l + 1), recurse(heights, l, min_idx - 1), recurse(heights, min_idx + 1, r)) return recurse(heights, 0, len(heights) - 1) def largest_rectangle_area2(self, heights): """ :type heights: List[int] :rtype: int """ self.ans = float('-inf') def recurse(heights, l, r): if l > r: return 0 min_idx = l for i in range(l, r + 1): if heights[min_idx] > heights[i]: min_idx = i print(l, r) cur = heights[min_idx] * (r - l + 1) left = recurse(heights, min_idx + 1, r) right = recurse(heights, l, min_idx - 1) return max(cur, left, right) return recurse(heights, 0, len(heights) - 1) def largest_rectangle_area(self, height): height.append(0) (stack, size) = ([], 0) for i in range(len(height)): while stack and height[stack[-1]] > height[i]: l = stack.pop() h = height[l] w = i if not stack else i - l cand = h * w print(cand) size = max(size, cand) stack.append(i) return size solver = solution() arr1 = [2, 1, 5, 6, 2, 3] arr2 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67] print('largestRectangleArea') print(solver.largestRectangleArea(arr2))
class PaceMaker(): """ Class for a server that distributes the anonymized and hashed contact traces. Attributes: connected_peers = []: List of peers to communicate with. trace_buffer = {area: hashed_events}: Temporarily stored hashed events. """ def receive_hashed_trace(self, area, trace): """ Receive sets of hashed events (a trace) from a confirmed ill peer. Save to the trace buffer. """ pass def distribute_traces(self): """ Distribute the events from the trace buffer to all peers. """ trace_packets = self.shuffle_and_pack_traces() for peer in self.connected_peers(): for packet in trace_packets: self.send_packet(peer, packet) def shuffle_and_pack_traces(self): """ Shuffle the hashed events within the same area. Put into packets for distribution. """ pass def send_packet(self, peer, packet): """ Connect to peer and send packet of events. """ pass ### Other functionality # Connect to new peers
class Pacemaker: """ Class for a server that distributes the anonymized and hashed contact traces. Attributes: connected_peers = []: List of peers to communicate with. trace_buffer = {area: hashed_events}: Temporarily stored hashed events. """ def receive_hashed_trace(self, area, trace): """ Receive sets of hashed events (a trace) from a confirmed ill peer. Save to the trace buffer. """ pass def distribute_traces(self): """ Distribute the events from the trace buffer to all peers. """ trace_packets = self.shuffle_and_pack_traces() for peer in self.connected_peers(): for packet in trace_packets: self.send_packet(peer, packet) def shuffle_and_pack_traces(self): """ Shuffle the hashed events within the same area. Put into packets for distribution. """ pass def send_packet(self, peer, packet): """ Connect to peer and send packet of events. """ pass
while True: try: comprimento, eventos = [int(x) for x in input().split()] except EOFError: break lucro, utilizado, estacionamento = 0, 0, {} # 'veic' : tamanho for aux in range(0, eventos): evento = input().split(' ') if len(evento) == 3: # entrada veic if comprimento >= (utilizado + int(evento[2])): # ok estacionar utilizado += int(evento[2]) estacionamento[evento[1]] = int(evento[2]) lucro += 10 elif len(evento) == 2: # saida veic try: veic_tam = estacionamento[evento[1]] except: veic_tam = 0 utilizado -= veic_tam print(lucro)
while True: try: (comprimento, eventos) = [int(x) for x in input().split()] except EOFError: break (lucro, utilizado, estacionamento) = (0, 0, {}) for aux in range(0, eventos): evento = input().split(' ') if len(evento) == 3: if comprimento >= utilizado + int(evento[2]): utilizado += int(evento[2]) estacionamento[evento[1]] = int(evento[2]) lucro += 10 elif len(evento) == 2: try: veic_tam = estacionamento[evento[1]] except: veic_tam = 0 utilizado -= veic_tam print(lucro)
class EmbeddedDocumentMixin: _fields = {} _db_name_map = {} _dirty_fields = {} def __init__(self, **kwargs): self._values = {} for name, value in kwargs.items(): if name in self._fields: setattr(self, name, value) self._make_clean() def to_mongo(self): data = {} for field in self._fields.values(): value = field.to_mongo( getattr(self, field.name, None)) if value is not None: data[field.db_name] = value return data def to_dict(self, cls=dict): dct = cls() for name, field in self._fields.items(): dct[name] = getattr(self, name, None) return dct @classmethod async def from_mongo(cls, dct, resolver): kwargs = {} for db_name, value in dct.items(): field_name = cls._db_name_map[db_name] field = cls._fields[field_name] value = await field.from_mongo(value, resolver) kwargs[field_name] = value return cls(**kwargs) @property def is_valid(self): for field in self._fields.values(): if not field.validate(getattr(self, field.name, None)): return False return True @property def is_dirty(self): return len(self._dirty_fields) > 0 def _make_clean(self): self._dirty_fields = set() @property def _identity(self): return getattr(self, self._db_name_map['_id'], None) @_identity.setter def _identity(self, value): return setattr(self, self._db_name_map['_id'], value) def __eq__(self, other): for name in self._fields.keys(): if getattr(self, name, None) != getattr(other, name, None): return False return True def __repr__(self): name = self.__class__.__name__ args = ','.join([ name + '=' + repr(getattr(self, name, None)) for name, field in self._fields.items()]) return f"{name}({args})" # return str(self.to_dict()) class DocumentMixin(EmbeddedDocumentMixin): @classmethod def qs(self, db): raise Exception('This method is replaced by the metaclass') def before_create(self): pass def before_update(self): pass
class Embeddeddocumentmixin: _fields = {} _db_name_map = {} _dirty_fields = {} def __init__(self, **kwargs): self._values = {} for (name, value) in kwargs.items(): if name in self._fields: setattr(self, name, value) self._make_clean() def to_mongo(self): data = {} for field in self._fields.values(): value = field.to_mongo(getattr(self, field.name, None)) if value is not None: data[field.db_name] = value return data def to_dict(self, cls=dict): dct = cls() for (name, field) in self._fields.items(): dct[name] = getattr(self, name, None) return dct @classmethod async def from_mongo(cls, dct, resolver): kwargs = {} for (db_name, value) in dct.items(): field_name = cls._db_name_map[db_name] field = cls._fields[field_name] value = await field.from_mongo(value, resolver) kwargs[field_name] = value return cls(**kwargs) @property def is_valid(self): for field in self._fields.values(): if not field.validate(getattr(self, field.name, None)): return False return True @property def is_dirty(self): return len(self._dirty_fields) > 0 def _make_clean(self): self._dirty_fields = set() @property def _identity(self): return getattr(self, self._db_name_map['_id'], None) @_identity.setter def _identity(self, value): return setattr(self, self._db_name_map['_id'], value) def __eq__(self, other): for name in self._fields.keys(): if getattr(self, name, None) != getattr(other, name, None): return False return True def __repr__(self): name = self.__class__.__name__ args = ','.join([name + '=' + repr(getattr(self, name, None)) for (name, field) in self._fields.items()]) return f'{name}({args})' class Documentmixin(EmbeddedDocumentMixin): @classmethod def qs(self, db): raise exception('This method is replaced by the metaclass') def before_create(self): pass def before_update(self): pass
with open("input.txt", "r") as input_file: input = input_file.read().split("\n") total = 0 group_answers = {} for line in input: if not line: total += len(group_answers) group_answers = {} for char in line: group_answers[char] = 1 total += len(group_answers) print(total)
with open('input.txt', 'r') as input_file: input = input_file.read().split('\n') total = 0 group_answers = {} for line in input: if not line: total += len(group_answers) group_answers = {} for char in line: group_answers[char] = 1 total += len(group_answers) print(total)
class Solution: def calPoints(self, ops): """ :type ops: List[str] :rtype: int """ opsstack = [] point = 0 for o in ops: p = 0 if o == '+': p = opsstack[-1] + opsstack[-2] point += p opsstack.append(p) elif o == 'C': p = opsstack[-1] opsstack.pop() point -= p elif o == 'D': p = opsstack[-1] * 2 point += p opsstack.append(p) else: p = int(o) point += p opsstack.append(p) return point if __name__ == '__main__': solution = Solution() print(solution.calPoints(["5","2","C","D","+"])) print(solution.calPoints(["5","-2","4","C","D","9","+","+"])) else: pass
class Solution: def cal_points(self, ops): """ :type ops: List[str] :rtype: int """ opsstack = [] point = 0 for o in ops: p = 0 if o == '+': p = opsstack[-1] + opsstack[-2] point += p opsstack.append(p) elif o == 'C': p = opsstack[-1] opsstack.pop() point -= p elif o == 'D': p = opsstack[-1] * 2 point += p opsstack.append(p) else: p = int(o) point += p opsstack.append(p) return point if __name__ == '__main__': solution = solution() print(solution.calPoints(['5', '2', 'C', 'D', '+'])) print(solution.calPoints(['5', '-2', '4', 'C', 'D', '9', '+', '+'])) else: pass
# This file is implements of 'The elements of computer systesm' # chap 6.Assembler # author:gongqingkui AT 126.com # date:2021-09-18 jumpTable = { 'null': '000', 'JGT': '001', 'JEQ': '010', 'JGE': '011', 'JLT': '100', 'JNE': '101', 'JLE': '110', 'JMP': '111'} compTable = { # a = 0 A '0': '0101010', '1': '0111111', '-1': '0111010', 'D': '0001100', 'A': '0110000', '!D': '0001101', '!A': '0110001', '-D': '0001111', '-A': '0110011', 'D+1': '0011111', 'A+1': '0110111', 'D-1': '0001110', 'A-1': '0110010', 'D+A': '0000010', 'D-A': '0010011', 'A-D': '0000111', 'D&A': '0000000', 'D|A': '0010101', # a = 1 M 'M': '1110000', '!M': '1110001', '-M': '1110011', 'M+1': '1110111', 'M-1': '1110010', 'D+M': '1000010', 'D-M': '1010011', 'M-D': '1000111', 'D&M': '1000000', 'D|M': '1010101', } def destCode(amd=None): return '%s%s%s' % ('1' if 'A' in amd else '0', '1' if 'D' in amd else '0', '1' if 'M' in amd else '0') def compCode(c=None): return compTable[c] def jumpCode(j=None): return jumpTable[j] if __name__ == '__main__': # D=M+A print(destCode('D'), compCode('D-1'), jumpCode('null')) # D;JLE print(destCode('null'), compCode('D'), jumpCode('JLE'))
jump_table = {'null': '000', 'JGT': '001', 'JEQ': '010', 'JGE': '011', 'JLT': '100', 'JNE': '101', 'JLE': '110', 'JMP': '111'} comp_table = {'0': '0101010', '1': '0111111', '-1': '0111010', 'D': '0001100', 'A': '0110000', '!D': '0001101', '!A': '0110001', '-D': '0001111', '-A': '0110011', 'D+1': '0011111', 'A+1': '0110111', 'D-1': '0001110', 'A-1': '0110010', 'D+A': '0000010', 'D-A': '0010011', 'A-D': '0000111', 'D&A': '0000000', 'D|A': '0010101', 'M': '1110000', '!M': '1110001', '-M': '1110011', 'M+1': '1110111', 'M-1': '1110010', 'D+M': '1000010', 'D-M': '1010011', 'M-D': '1000111', 'D&M': '1000000', 'D|M': '1010101'} def dest_code(amd=None): return '%s%s%s' % ('1' if 'A' in amd else '0', '1' if 'D' in amd else '0', '1' if 'M' in amd else '0') def comp_code(c=None): return compTable[c] def jump_code(j=None): return jumpTable[j] if __name__ == '__main__': print(dest_code('D'), comp_code('D-1'), jump_code('null')) print(dest_code('null'), comp_code('D'), jump_code('JLE'))
# -*- encoding: utf-8 -*- ''' __author__ = "Larry_Pavanery ''' class User(object): def __init__(self, id, url_keys=[]): self.id = id self.url_keys = url_keys
""" __author__ = "Larry_Pavanery """ class User(object): def __init__(self, id, url_keys=[]): self.id = id self.url_keys = url_keys
def vmax(lista): n = 0 for c in range(len(lista)): for i in range(len(lista)): if lista[i] > lista[c]: n = i return n freq = [] num = int(input()) lista = list(range(2, num + 1)) n = num n_1 = 0 c = 0 while True: print(n_1) if n_1 <= len(lista) - 1: if n % lista[n_1] == 0: c += 1 n = n / lista[n_1] else: n_1 += 1 freq.append(c) c = 0 n = num else: break mais_fre = lista[vmax(freq)] frequencia = max(freq) print('mostFrequent: {}, frequency: {}'.format(mais_fre, frequencia))
def vmax(lista): n = 0 for c in range(len(lista)): for i in range(len(lista)): if lista[i] > lista[c]: n = i return n freq = [] num = int(input()) lista = list(range(2, num + 1)) n = num n_1 = 0 c = 0 while True: print(n_1) if n_1 <= len(lista) - 1: if n % lista[n_1] == 0: c += 1 n = n / lista[n_1] else: n_1 += 1 freq.append(c) c = 0 n = num else: break mais_fre = lista[vmax(freq)] frequencia = max(freq) print('mostFrequent: {}, frequency: {}'.format(mais_fre, frequencia))
mp = 'Today is a Great DAY' print(mp.lower()) print(mp.upper()) print(mp.strip()) print(mp.startswith('w')) print(mp.find('a'))
mp = 'Today is a Great DAY' print(mp.lower()) print(mp.upper()) print(mp.strip()) print(mp.startswith('w')) print(mp.find('a'))
""" Trie tree. """ class TrieNode: def __init__(self, data: str): self.data = data self.children = [None] * 26 self.is_ending_char = False class TrieTree: def __init__(self): self._root = TrieNode('/') def insert(self, word: str) -> None: p = self._root a_index = ord('a') for i in range(len(word)): index = ord(word[i]) - a_index if p.children[index] is None: np = TrieNode(word[i]) p.children[index] = np p = p.children[index] p.is_ending_char = True def find(self, pattern: str) -> bool: p = self._root a_index = ord('a') for i in range(len(pattern)): index = ord(pattern[i]) - a_index if p.children[index] is None: return False p = p.children[index] return p.is_ending_char if __name__ == '__main__': t = TrieTree() text = ['work', 'audio', 'zodic', 'element', 'world'] for w in text: t.insert(w) print(t.find('work'), t.find('audi'), t.find('zodicx'), t.find('ele'), t.find('world'))
""" Trie tree. """ class Trienode: def __init__(self, data: str): self.data = data self.children = [None] * 26 self.is_ending_char = False class Trietree: def __init__(self): self._root = trie_node('/') def insert(self, word: str) -> None: p = self._root a_index = ord('a') for i in range(len(word)): index = ord(word[i]) - a_index if p.children[index] is None: np = trie_node(word[i]) p.children[index] = np p = p.children[index] p.is_ending_char = True def find(self, pattern: str) -> bool: p = self._root a_index = ord('a') for i in range(len(pattern)): index = ord(pattern[i]) - a_index if p.children[index] is None: return False p = p.children[index] return p.is_ending_char if __name__ == '__main__': t = trie_tree() text = ['work', 'audio', 'zodic', 'element', 'world'] for w in text: t.insert(w) print(t.find('work'), t.find('audi'), t.find('zodicx'), t.find('ele'), t.find('world'))
#!/usr/bin/env python3 class Node(object): """Node class for binary tree""" def __init__(self, data=None): self.left = None self.right = None self.data = data class Tree(object): """Tree class for binary search""" def __init__(self, data=None): self.root = Node(data) def insert(self, data): self._add(data, self.root) def _add(self, data, node): if data < node.data: if node.left: self._add(data, node.left) else: node.left = Node(data) else: if node.right: self._add(data, node.right) else: node.right = Node(data) def traverseBFS(self, node): queue = [node] out = [] # output buffer while len(queue) > 0: currentNode = queue.pop(0) out.append(currentNode.data) if currentNode.left: queue.append(currentNode.left) if currentNode.right: queue.append(currentNode.right) return out def inorder(self, node, buf=[]): if node is not None: self.inorder(node.left, buf) buf.append(node.data) self.inorder(node.right, buf) def preorder(self, node, buf=[]): if node is not None: buf.append(node.data) self.preorder(node.left, buf) self.preorder(node.right, buf) def postorder(self, node, buf=[]): if node is not None: self.postorder(node.left, buf) self.postorder(node.right, buf) buf.append(node.data) def test(self): d = self.traverseBFS(self.root) assert(d == [1,0,5,7,10]) f = [] self.inorder(self.root, f) assert(f == [0,1,5,7,10]) j = [] self.preorder(self.root, j) assert(j == [1,0,5,7,10]) l = [] self.postorder(self.root, l) assert(l == [0,10,7,5,1]) def main(): tree = Tree(1) data = [5,7,10,0] for i in data: tree.insert(i) tree.test() if __name__ == '__main__': main()
class Node(object): """Node class for binary tree""" def __init__(self, data=None): self.left = None self.right = None self.data = data class Tree(object): """Tree class for binary search""" def __init__(self, data=None): self.root = node(data) def insert(self, data): self._add(data, self.root) def _add(self, data, node): if data < node.data: if node.left: self._add(data, node.left) else: node.left = node(data) elif node.right: self._add(data, node.right) else: node.right = node(data) def traverse_bfs(self, node): queue = [node] out = [] while len(queue) > 0: current_node = queue.pop(0) out.append(currentNode.data) if currentNode.left: queue.append(currentNode.left) if currentNode.right: queue.append(currentNode.right) return out def inorder(self, node, buf=[]): if node is not None: self.inorder(node.left, buf) buf.append(node.data) self.inorder(node.right, buf) def preorder(self, node, buf=[]): if node is not None: buf.append(node.data) self.preorder(node.left, buf) self.preorder(node.right, buf) def postorder(self, node, buf=[]): if node is not None: self.postorder(node.left, buf) self.postorder(node.right, buf) buf.append(node.data) def test(self): d = self.traverseBFS(self.root) assert d == [1, 0, 5, 7, 10] f = [] self.inorder(self.root, f) assert f == [0, 1, 5, 7, 10] j = [] self.preorder(self.root, j) assert j == [1, 0, 5, 7, 10] l = [] self.postorder(self.root, l) assert l == [0, 10, 7, 5, 1] def main(): tree = tree(1) data = [5, 7, 10, 0] for i in data: tree.insert(i) tree.test() if __name__ == '__main__': main()
# Copyright 2017 The Switch Authors. All rights reserved. # Licensed under the Apache License, Version 2, which is in the LICENSE file. """ This package implements a transport model for the transmission network. The core modules in the package are build and dispatch. """ core_modules = [ 'switch_model.transmission.transport.build', 'switch_model.transmission.transport.dispatch']
""" This package implements a transport model for the transmission network. The core modules in the package are build and dispatch. """ core_modules = ['switch_model.transmission.transport.build', 'switch_model.transmission.transport.dispatch']
# Programa que le a altura de uma parede em metros # e calcule a sua area e a quantidade de tinta necessaria # para pinta-la, sabendo que cada litro de tinta, pinta uma area # de 2m^2 larg = float(input('Digite a largura da parede: ')) alt = float(input('Digite a altura da parede: ')) area = larg * alt tinta = area / 2 print('A parede tem {}{}{} metros quadrados e para pintar essa parede precisaremos' ' de {} litros de tintas' .format('\033[1;107m', area, '\033[m', tinta))
larg = float(input('Digite a largura da parede: ')) alt = float(input('Digite a altura da parede: ')) area = larg * alt tinta = area / 2 print('A parede tem {}{}{} metros quadrados e para pintar essa parede precisaremos de {} litros de tintas'.format('\x1b[1;107m', area, '\x1b[m', tinta))
#----------* CHALLENGE 37 *---------- #Ask the user to enter their name and display each letter in their name on a separate line. name = input("Enter your name: ") for i in name: print(i)
name = input('Enter your name: ') for i in name: print(i)
class Camera(object): def __init__(self, macaddress, lastsnap='snaps/default.jpg'): self.macaddress = macaddress self.lastsnap = lastsnap
class Camera(object): def __init__(self, macaddress, lastsnap='snaps/default.jpg'): self.macaddress = macaddress self.lastsnap = lastsnap
# coding: utf-8 strings = ['KjgWZC', 'arf12', ''] for s in strings: if s.isalpha(): print("The string " + s + " consists of all letters.") else: print("The string " + s + " does not consist of all letters.")
strings = ['KjgWZC', 'arf12', ''] for s in strings: if s.isalpha(): print('The string ' + s + ' consists of all letters.') else: print('The string ' + s + ' does not consist of all letters.')
''' In order to get the Learn credentials, they do not to open a case on behind the blackboard nor email developers@blackboard.com. They need to go to developer.blackboard.com and register from there to grab the Learn credentials for their application, it is also imperative to remind them that they are creating an application based on your code, so they need to register as a developer. Now, for Collaborate production they CAN and MUST create a ticket on behind the blackboard requesting their credentials. ''' ''' Copy this file to a new file called Config.py. Do not put active API credentials in a file tracked by git! ''' credenciales = { "verify_certs" : "True", "learn_rest_fqdn" : "learn URL", "learn_rest_key" : "Learn API Key", "learn_rest_secret" : "Learn API Secret", "collab_key": "Collab Key", "collab_secret": "Collab Secret", "collab_base_url": "us.bbcollab.com/collab/api/csa", "ppto_server" : "panoptoServer", "ppto_folder_id" : "panoptoFolderId", "ppto_client_id" : "panoptoClientId", "ppto_client_secret" : "panoptoClientSecret", "ppto_username" : "panoptoUserName", "ppto_password" : "panoptoPassword" }
""" In order to get the Learn credentials, they do not to open a case on behind the blackboard nor email developers@blackboard.com. They need to go to developer.blackboard.com and register from there to grab the Learn credentials for their application, it is also imperative to remind them that they are creating an application based on your code, so they need to register as a developer. Now, for Collaborate production they CAN and MUST create a ticket on behind the blackboard requesting their credentials. """ '\nCopy this file to a new file called Config.py. Do not put active API credentials in a file tracked by git!\n' credenciales = {'verify_certs': 'True', 'learn_rest_fqdn': 'learn URL', 'learn_rest_key': 'Learn API Key', 'learn_rest_secret': 'Learn API Secret', 'collab_key': 'Collab Key', 'collab_secret': 'Collab Secret', 'collab_base_url': 'us.bbcollab.com/collab/api/csa', 'ppto_server': 'panoptoServer', 'ppto_folder_id': 'panoptoFolderId', 'ppto_client_id': 'panoptoClientId', 'ppto_client_secret': 'panoptoClientSecret', 'ppto_username': 'panoptoUserName', 'ppto_password': 'panoptoPassword'}
""" Frozen subpackages for meta release. """ frozen_packages = { "libpysal": "4.2.2", "esda": "2.2.1", "giddy": "2.3.0", "inequality": "1.0.0", "pointpats": "2.1.0", "segregation": "1.2.0", "spaghetti": "1.4.1", "mgwr": "2.1.1", "spglm": "1.0.7", "spint": "1.0.6", "spreg": "1.0.4", "spvcm": "0.3.0", "tobler": "0.2.0", "mapclassify": "2.2.0", "splot": "1.1.2" }
""" Frozen subpackages for meta release. """ frozen_packages = {'libpysal': '4.2.2', 'esda': '2.2.1', 'giddy': '2.3.0', 'inequality': '1.0.0', 'pointpats': '2.1.0', 'segregation': '1.2.0', 'spaghetti': '1.4.1', 'mgwr': '2.1.1', 'spglm': '1.0.7', 'spint': '1.0.6', 'spreg': '1.0.4', 'spvcm': '0.3.0', 'tobler': '0.2.0', 'mapclassify': '2.2.0', 'splot': '1.1.2'}
class CardError(Exception): pass class IssuerNotRecognised(CardError): pass class InvalidCardNumber(CardError): pass
class Carderror(Exception): pass class Issuernotrecognised(CardError): pass class Invalidcardnumber(CardError): pass
def Wspak(dane): for i in range(len(dane)-1, -1, -1): yield dane[i] tablica = Wspak([1, 2, 3]) print('tablica [1, 2, 3]', end=' ') print('[', end='') print(next(tablica), end=', ') print(next(tablica), end=', ') print(next(tablica), end=']') print()
def wspak(dane): for i in range(len(dane) - 1, -1, -1): yield dane[i] tablica = wspak([1, 2, 3]) print('tablica [1, 2, 3]', end=' ') print('[', end='') print(next(tablica), end=', ') print(next(tablica), end=', ') print(next(tablica), end=']') print()
class Solution: def getHint(self, secret, guess): ss, gs = {str(x): 0 for x in range(10)}, {str(x): 0 for x in range(10)} A = 0 for s, g in zip(secret, guess): if s == g: A += 1 ss[s] += 1 gs[g] += 1 ans = 0 for k, v in ss.items(): ans += min(v, gs[k]) return str(A) + "A" + str(ans - A) + "B"
class Solution: def get_hint(self, secret, guess): (ss, gs) = ({str(x): 0 for x in range(10)}, {str(x): 0 for x in range(10)}) a = 0 for (s, g) in zip(secret, guess): if s == g: a += 1 ss[s] += 1 gs[g] += 1 ans = 0 for (k, v) in ss.items(): ans += min(v, gs[k]) return str(A) + 'A' + str(ans - A) + 'B'
class Sample: def __init__(self, source=None, data=None, history=None, uid=None): if history is not None: self.history = history elif source is not None: self.history = [("init", "", source)] else: self.history = [] if data is not None: self.data = data if "_lazy_resources" not in self.data.keys(): self.data["_lazy_resources"] = {} else: if uid is not None: self.data = {"uid": uid, "_lazy_resources": {}} else: raise ValueError("Need UID for sample!") def add_resource(self, source, resource_id, datum): assert resource_id not in self.data.keys() new_history = self.history + [("add", resource_id, source)] new_data = {resource_id: datum, **self.data} return Sample(data=new_data, history=new_history) def add_lazy_resource(self, source, resource_id, fn): new_history = self.history + [("add_lazy", resource_id, source)] new_lazy_resources = {resource_id: fn, **self.data["_lazy_resources"]} new_data = { "_lazy_resources": new_lazy_resources, **{k: v for k, v in self.data.items() if k != "_lazy_resources"}, } return Sample(data=new_data, history=new_history) def apply_on_resource(self, source, resource_id, fn): assert resource_id in self.data.keys() new_history = self.history + [("apply", resource_id, source)] new_data = {k: v if k != resource_id else fn(v) for k, v in self.data.items()} return Sample(data=new_data, history=new_history) def get_resource(self, resource_id): if resource_id in self.data.keys(): return self.data[resource_id] elif resource_id in self.data["_lazy_resources"].keys(): return self.data["_lazy_resources"][resource_id](self) else: raise ValueError(f"Unknown resource id {resource_id}") def get_resource_ids(self): return [k for k in self.data.keys() if not k.startswith("_")] + list( self.data["_lazy_resources"].keys() ) def has_resource(self, resource_id): return ( resource_id in self.data.keys() or resource_id in self.data["_lazy_resources"].keys() ) def __eq__(self, other): return self.data["uid"] == other.data["uid"] def __hash__(self): return hash(self.data["uid"])
class Sample: def __init__(self, source=None, data=None, history=None, uid=None): if history is not None: self.history = history elif source is not None: self.history = [('init', '', source)] else: self.history = [] if data is not None: self.data = data if '_lazy_resources' not in self.data.keys(): self.data['_lazy_resources'] = {} elif uid is not None: self.data = {'uid': uid, '_lazy_resources': {}} else: raise value_error('Need UID for sample!') def add_resource(self, source, resource_id, datum): assert resource_id not in self.data.keys() new_history = self.history + [('add', resource_id, source)] new_data = {resource_id: datum, **self.data} return sample(data=new_data, history=new_history) def add_lazy_resource(self, source, resource_id, fn): new_history = self.history + [('add_lazy', resource_id, source)] new_lazy_resources = {resource_id: fn, **self.data['_lazy_resources']} new_data = {'_lazy_resources': new_lazy_resources, **{k: v for (k, v) in self.data.items() if k != '_lazy_resources'}} return sample(data=new_data, history=new_history) def apply_on_resource(self, source, resource_id, fn): assert resource_id in self.data.keys() new_history = self.history + [('apply', resource_id, source)] new_data = {k: v if k != resource_id else fn(v) for (k, v) in self.data.items()} return sample(data=new_data, history=new_history) def get_resource(self, resource_id): if resource_id in self.data.keys(): return self.data[resource_id] elif resource_id in self.data['_lazy_resources'].keys(): return self.data['_lazy_resources'][resource_id](self) else: raise value_error(f'Unknown resource id {resource_id}') def get_resource_ids(self): return [k for k in self.data.keys() if not k.startswith('_')] + list(self.data['_lazy_resources'].keys()) def has_resource(self, resource_id): return resource_id in self.data.keys() or resource_id in self.data['_lazy_resources'].keys() def __eq__(self, other): return self.data['uid'] == other.data['uid'] def __hash__(self): return hash(self.data['uid'])
# class Solution: # # @param A : integer # # @return a strings def findDigitsInBinary(self, A): res = "" while(A != 0): temp = A%2 res += str(temp) A = A//2 res = res[::-1] return res print(findDigitsInBinary(6))
def find_digits_in_binary(self, A): res = '' while A != 0: temp = A % 2 res += str(temp) a = A // 2 res = res[::-1] return res print(find_digits_in_binary(6))
class Solution(object): def minimumSum(self, num): """ :type num: int :rtype: int """ num = list(str(num)) min_sum = 9999 for i in range(3): s1 = int(num[i] + num[i + 1]) + int(num[i - 2] + num[i - 1]) s2 = int(num[i] + num[i + 1]) + int(num[i - 1] + num[i - 2]) s3 = int(num[i + 1] + num[i]) + int(num[i - 2] + num[i - 1]) s4 = int(num[i + 1] + num[i]) + int(num[i - 1] + num[i - 2]) min_sum = min(min_sum, s1, s2, s3, s4) return min_sum if __name__ == '__main__': obj = Solution() num = 2932 obj.minimumSum(num)
class Solution(object): def minimum_sum(self, num): """ :type num: int :rtype: int """ num = list(str(num)) min_sum = 9999 for i in range(3): s1 = int(num[i] + num[i + 1]) + int(num[i - 2] + num[i - 1]) s2 = int(num[i] + num[i + 1]) + int(num[i - 1] + num[i - 2]) s3 = int(num[i + 1] + num[i]) + int(num[i - 2] + num[i - 1]) s4 = int(num[i + 1] + num[i]) + int(num[i - 1] + num[i - 2]) min_sum = min(min_sum, s1, s2, s3, s4) return min_sum if __name__ == '__main__': obj = solution() num = 2932 obj.minimumSum(num)
#!python class Node(object): def __init__(self, data): """Initialize this node with the given data""" self.data = data self.prev = None self.next = None def __repr__(self): """Return a string representation of this node""" return 'Node({!r})'.format(self.data) class DoublyLinkedList(object): def __init__(self, iterable=None): """Initialize the linked list and append the given items, if any""" self.head = None self.tail = None self.size = 0 if iterable is not None: for item in iterable: self.append(item) def __str__(self): """Return a formatted string representation of this linked list.""" items = ['({!r})'.format(item) for item in self.items()] return '[{}]'.format(' <-> '.join(items)) def __repr__(self): """Return a string representation of this linked list.""" return 'LinkedList({!r})'.format(self.items()) def items(self): """Returns all the items in the doubly linked list""" result = [] node = self.head while node is not None: result.append(node.data) node = node.next return result def is_empty(self): """Returns True is list is empty and False if not""" return True if self.head is None else False def length(self): """Returns the lenght(size) if the list""" return self.size def get_at_index(self, index): """Returns the item at the index or rases a value error if index exceeds the size of the list""" if not (0 <= index < self.size): raise ValueError('List index out of range: {}'.format(index)) node = self.head while index > 0: node = node.next index -= 1 return node.data def insert_at_index(self, index, item): """Inserts an item into the list at a given index or rases a value error is index is greater that the size of the list or less that 0""" node = self.head new_node = Node(item) if not (0 <= index <= self.size): raise ValueError('List index out of range: {}'.format(index)) if self.size > 0: while index > 1: node = node.next index -= 1 if node.prev is not None: if node.next is None: self.tail = new_node node.prev.next = new_node new_node.prev = node.prev if node.prev is None: self.head = new_node new_node.next = node node.prev = new_node else: self.head, self.tail = new_node, new_node self.size += 1 def append(self, item): """Intert a given item at the end of the list""" new_node = Node(item) if self.is_empty(): self.head = new_node else: self.tail.next = new_node new_node.prev = self.tail self.tail = new_node self.size += 1 def prepend(self, item): """Insert a given item at the beging of the list""" new_node = Node(item) if self.is_empty(): self.tail = new_node else: new_node.next = self.head self.head.prev = new_node self.head = new_node self.size += 1 def find(self, quality): """Return an item based on the quality or None if no item was found with the quality""" node = self.head while node is not None: if quality(node.data): return node.data node = node.next return None def replace(self, old_item, new_item): """Replaces the node's data that holds the old data with the new data or None if there is no node that holds old data""" node = self.head while node is not None: if node.data == old_item: node.data = new_item break node = node.next else: raise ValueError('Item not found in list') def delete(self, item): """Delete the given item from the list, or raise a value error""" node = self.head found = False while not found and node is not None: if node.data == item: found = True else: node = node.next if found: if node is not self.head and node is not self.tail: if node.next is not None: node.next.prev = node.prev node.prev.next = node.next node.prev = None node.next = None if node is self.head: if self.head is not None: self.head.prev = None self.head = node.next node.next = None if node is self.tail: self.tail = node.prev if node.prev is not None: node.prev.next = None node.prev = None self.size -= 1 break else: raise ValueError('Item not found: {}'.format(item)) def test_doubly_linked_list(): ll = DoublyLinkedList() print(ll) print('Appending items:') ll.append('A') print(ll) ll.append('B') print(ll) ll.append('C') print(ll) print('head: {}'.format(ll.head)) print('tail: {}'.format(ll.tail)) print('size: {}'.format(ll.size)) print('length: {}'.format(ll.length())) print('Getting items by index:') for index in range(ll.size): item = ll.get_at_index(index) print('get_at_index({}): {!r}'.format(index, item)) print('Deleting items:') ll.delete('B') print(ll) ll.delete('C') print(ll) ll.delete('A') print(ll) print('head: {}'.format(ll.head)) print('tail: {}'.format(ll.tail)) print('size: {}'.format(ll.size)) print('length: {}'.format(ll.length())) if __name__ == '__main__': test_doubly_linked_list()
class Node(object): def __init__(self, data): """Initialize this node with the given data""" self.data = data self.prev = None self.next = None def __repr__(self): """Return a string representation of this node""" return 'Node({!r})'.format(self.data) class Doublylinkedlist(object): def __init__(self, iterable=None): """Initialize the linked list and append the given items, if any""" self.head = None self.tail = None self.size = 0 if iterable is not None: for item in iterable: self.append(item) def __str__(self): """Return a formatted string representation of this linked list.""" items = ['({!r})'.format(item) for item in self.items()] return '[{}]'.format(' <-> '.join(items)) def __repr__(self): """Return a string representation of this linked list.""" return 'LinkedList({!r})'.format(self.items()) def items(self): """Returns all the items in the doubly linked list""" result = [] node = self.head while node is not None: result.append(node.data) node = node.next return result def is_empty(self): """Returns True is list is empty and False if not""" return True if self.head is None else False def length(self): """Returns the lenght(size) if the list""" return self.size def get_at_index(self, index): """Returns the item at the index or rases a value error if index exceeds the size of the list""" if not 0 <= index < self.size: raise value_error('List index out of range: {}'.format(index)) node = self.head while index > 0: node = node.next index -= 1 return node.data def insert_at_index(self, index, item): """Inserts an item into the list at a given index or rases a value error is index is greater that the size of the list or less that 0""" node = self.head new_node = node(item) if not 0 <= index <= self.size: raise value_error('List index out of range: {}'.format(index)) if self.size > 0: while index > 1: node = node.next index -= 1 if node.prev is not None: if node.next is None: self.tail = new_node node.prev.next = new_node new_node.prev = node.prev if node.prev is None: self.head = new_node new_node.next = node node.prev = new_node else: (self.head, self.tail) = (new_node, new_node) self.size += 1 def append(self, item): """Intert a given item at the end of the list""" new_node = node(item) if self.is_empty(): self.head = new_node else: self.tail.next = new_node new_node.prev = self.tail self.tail = new_node self.size += 1 def prepend(self, item): """Insert a given item at the beging of the list""" new_node = node(item) if self.is_empty(): self.tail = new_node else: new_node.next = self.head self.head.prev = new_node self.head = new_node self.size += 1 def find(self, quality): """Return an item based on the quality or None if no item was found with the quality""" node = self.head while node is not None: if quality(node.data): return node.data node = node.next return None def replace(self, old_item, new_item): """Replaces the node's data that holds the old data with the new data or None if there is no node that holds old data""" node = self.head while node is not None: if node.data == old_item: node.data = new_item break node = node.next else: raise value_error('Item not found in list') def delete(self, item): """Delete the given item from the list, or raise a value error""" node = self.head found = False while not found and node is not None: if node.data == item: found = True else: node = node.next if found: if node is not self.head and node is not self.tail: if node.next is not None: node.next.prev = node.prev node.prev.next = node.next node.prev = None node.next = None if node is self.head: if self.head is not None: self.head.prev = None self.head = node.next node.next = None if node is self.tail: self.tail = node.prev if node.prev is not None: node.prev.next = None node.prev = None self.size -= 1 break else: raise value_error('Item not found: {}'.format(item)) def test_doubly_linked_list(): ll = doubly_linked_list() print(ll) print('Appending items:') ll.append('A') print(ll) ll.append('B') print(ll) ll.append('C') print(ll) print('head: {}'.format(ll.head)) print('tail: {}'.format(ll.tail)) print('size: {}'.format(ll.size)) print('length: {}'.format(ll.length())) print('Getting items by index:') for index in range(ll.size): item = ll.get_at_index(index) print('get_at_index({}): {!r}'.format(index, item)) print('Deleting items:') ll.delete('B') print(ll) ll.delete('C') print(ll) ll.delete('A') print(ll) print('head: {}'.format(ll.head)) print('tail: {}'.format(ll.tail)) print('size: {}'.format(ll.size)) print('length: {}'.format(ll.length())) if __name__ == '__main__': test_doubly_linked_list()