content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
DEBUG = True SERVE_MEDIA = DEBUG TEMPLATE_DEBUG = DEBUG EMAIL_DEBUG = DEBUG THUMBNAIL_DEBUG = DEBUG DEBUG_PROPAGATE_EXCEPTIONS = False # DATABASE_ENGINE = 'postgresql_psycopg2' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. # DATABASE_HOST = '192.168.0.2' # Set to empty s...
debug = True serve_media = DEBUG template_debug = DEBUG email_debug = DEBUG thumbnail_debug = DEBUG debug_propagate_exceptions = False email_host = 'localhost' email_port = 1025
# Example of Iterator Design Pattern def count_to(count): numbers = ["one", "two", "three", "four", "five"] for number in numbers[:count]: yield number count_to_two = count_to(2) count_to_five = count_to(5) for count in [count_to_two, count_to_five]: for number in count: print(number, e...
def count_to(count): numbers = ['one', 'two', 'three', 'four', 'five'] for number in numbers[:count]: yield number count_to_two = count_to(2) count_to_five = count_to(5) for count in [count_to_two, count_to_five]: for number in count: print(number, end=' ') print()
"""AoC Day 10""" pairs = ( "{", "}", "[", "]", "<", ">", "(", ")", ) openings = pairs[0::2] closings = pairs[1::2] def compose(*functions): def inner(arg): for f in reversed(functions): arg = f(arg) return arg return inner def find_corrupted(line...
"""AoC Day 10""" pairs = ('{', '}', '[', ']', '<', '>', '(', ')') openings = pairs[0::2] closings = pairs[1::2] def compose(*functions): def inner(arg): for f in reversed(functions): arg = f(arg) return arg return inner def find_corrupted(line): """Return the first bad char in...
class Layout: def __init__(self, keyboard): if keyboard == "azerty": self.up = 'Z' self.down = 'S' self.left = 'Q' self.right = 'D' self.ok = 'C' self.no = 'K' self.drop = 'L' self.change = 'P' self...
class Layout: def __init__(self, keyboard): if keyboard == 'azerty': self.up = 'Z' self.down = 'S' self.left = 'Q' self.right = 'D' self.ok = 'C' self.no = 'K' self.drop = 'L' self.change = 'P' self....
# Factorial program with memoization using decorators. # Memoization is a technique of recording the intermediate results so that it can be used to avoid repeated calculations and speed up the programs. # memoization can be done with the help of function decorators. def Memoize(func): history={} def wr...
def memoize(func): history = {} def wrapper(*args): if args not in history: history[args] = func(*args) return history[args] return wrapper def factorial(n): if type(n) != int: raise value_error('passed value is not integer') if n < 0: raise value_error(...
NUM, IMG_SIZE, FACE = 8, 720, False def config(): return None config.expName = None config.checkpoint_dir = None config.train = lambda: None config.train.batch_size = 4 config.train.lr = 0.001 config.train.decay = 0.001 config.train.epochs = 10 config.latent_code_garms_sz = 1024 config.PCA_ = 35 co...
(num, img_size, face) = (8, 720, False) def config(): return None config.expName = None config.checkpoint_dir = None config.train = lambda : None config.train.batch_size = 4 config.train.lr = 0.001 config.train.decay = 0.001 config.train.epochs = 10 config.latent_code_garms_sz = 1024 config.PCA_ = 35 config.garmen...
# -*- coding: utf-8 -*- def main(): n = int(input()) b = [0 for _ in range(n)] for i in range(n): ai = int(input()) ai -= 1 b[ai] += 1 y = 0 x = 0 for index, bi in enumerate(b, 1): if bi == 0: x = index elif bi == 2: ...
def main(): n = int(input()) b = [0 for _ in range(n)] for i in range(n): ai = int(input()) ai -= 1 b[ai] += 1 y = 0 x = 0 for (index, bi) in enumerate(b, 1): if bi == 0: x = index elif bi == 2: y = index if x == 0 and y == 0: ...
class VoteBreakdownTotals: def __init__(self, headers: list[str]): self.__headers = headers self.__failures = {} self.__current_row = 0 votes = "votes" if votes in self.__headers: self.__votes_index = self.__headers.index(votes) else: self.__v...
class Votebreakdowntotals: def __init__(self, headers: list[str]): self.__headers = headers self.__failures = {} self.__current_row = 0 votes = 'votes' if votes in self.__headers: self.__votes_index = self.__headers.index(votes) else: self.__v...
# 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 rob(self, root: Optional[TreeNode]) -> int: """ subproblems: 1. rob...
class Solution: def rob(self, root: Optional[TreeNode]) -> int: """ subproblems: 1. rob current node 2. not rob current node recurrence: 1. find max amount can be robbed for current node 2. pass to the parent: ...
def splitCols(saleRow): '''this function will split a string with '. Some columns are quoted with "". So we need to handle it''' saleRow = saleRow.split(',') result = [] flag = True # if flag is false, the current i is within a pair of " for i in range(len(saleRow)): if flag: ...
def split_cols(saleRow): """this function will split a string with '. Some columns are quoted with "". So we need to handle it""" sale_row = saleRow.split(',') result = [] flag = True for i in range(len(saleRow)): if flag: result.append(saleRow[i]) if '"' in saleR...
# # PySNMP MIB module H3C-OBJECT-INFO-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/H3C-OBJECT-INFO-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:10:08 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, value_range_constraint, constraints_union, single_value_constraint, constraints_intersection) ...
# Most football fans love it for the goals and excitement. Well, this problem does not. # You are up to handle the referee's little notebook and count the players who were sent off for fouls and misbehavior. # The rules: Two teams, named "A" and "B" have 11 players each. The players on each team are numbered from 1 to ...
team_a = 11 team_b = 11 cards = input().split() card_list = set(cards) stop = False for i in cards: x = ''.join(i) if 'A' in x: team_a -= 1 elif 'B' in x: team_b -= 1 if team_a < 7 or team_b < 7: stop = True break print(f'Team A - {team_a}; Team B - {team_b}') if stop: ...
K, X = tuple(map(int, input().split())) start = X - K + 1 end = X + K print(*range(start, end))
(k, x) = tuple(map(int, input().split())) start = X - K + 1 end = X + K print(*range(start, end))
# -*- coding: utf-8 -*- config = { "consumer_key": "VALUE", "consumer_secret": "VALUE", "access_token": "VALUE", "access_token_secret": "VALUE", }
config = {'consumer_key': 'VALUE', 'consumer_secret': 'VALUE', 'access_token': 'VALUE', 'access_token_secret': 'VALUE'}
class Solution: # @param {integer[]} nums # @return {integer[][]} def permuteUnique(self, nums): if len(nums) == 0: return nums if len(nums) == 1: return [nums] res = [] bag = set() for i in range(len(nums)): if nums[i] not in bag:...
class Solution: def permute_unique(self, nums): if len(nums) == 0: return nums if len(nums) == 1: return [nums] res = [] bag = set() for i in range(len(nums)): if nums[i] not in bag: tmp = nums[:] head = tmp...
def benjHochFDR(pVals,pValColumn=1): """ pVals = 2D list(hypothesis,p-value) hypothesis could = geneName tested for enrichment pValColumn = integer of column index containing the p-value. returns _ALL_ items passed to it with no filtering at the moment. """ assert type(pValColumn) ==...
def benj_hoch_fdr(pVals, pValColumn=1): """ pVals = 2D list(hypothesis,p-value) hypothesis could = geneName tested for enrichment pValColumn = integer of column index containing the p-value. returns _ALL_ items passed to it with no filtering at the moment. """ assert type(pValColumn) =...
{ "targets": [ { "target_name": "posix", "sources": [ "src/posix.cc" ] } ] }
{'targets': [{'target_name': 'posix', 'sources': ['src/posix.cc']}]}
DATABASE_NAME = "glass_rooms.sqlite" STARTING_ROOM_NUMBER = 1 ENDING_ROOM_NUMBER = 9 TABLE_NAME_HEADER = "Room_" TABLE_NAME = "Bookings" URL_HEADER = "https://www.scss.tcd.ie/cgi-bin/webcal/sgmr/sgmr" URL_ENDER = ".pl" URL_BOOKING = ".request" # Regex Constants # DATE_HEADER_REGEX: regex to match '4 Nov 2015 (Wednesda...
database_name = 'glass_rooms.sqlite' starting_room_number = 1 ending_room_number = 9 table_name_header = 'Room_' table_name = 'Bookings' url_header = 'https://www.scss.tcd.ie/cgi-bin/webcal/sgmr/sgmr' url_ender = '.pl' url_booking = '.request' date_header_regex = '[0-9]{1,2} [A-Z][a-z]+ 20[0-9]{2,2} \\([A-Z][a-z]+\\):'...
class TagsArgument(object): """Parse the tags argument""" def __init__(self): """ Initialize the class """ super(TagsArgument, self).__init__() def parse(self, configuration): """ Parse tags from the configuration file and return it formatted :param ...
class Tagsargument(object): """Parse the tags argument""" def __init__(self): """ Initialize the class """ super(TagsArgument, self).__init__() def parse(self, configuration): """ Parse tags from the configuration file and return it formatted :param ...
#!/usr/bin/python3 def bubbleSort(arr, reverse=False): length = len(arr) for i in range(0, length-1): for j in range(0, length-i-1): if arr[j] > arr[j+1]: arr[j], arr[j+1] = arr[j+1], arr[j] if reverse: arr.reverse() return arr
def bubble_sort(arr, reverse=False): length = len(arr) for i in range(0, length - 1): for j in range(0, length - i - 1): if arr[j] > arr[j + 1]: (arr[j], arr[j + 1]) = (arr[j + 1], arr[j]) if reverse: arr.reverse() return arr
# https://www.hackerrank.com/challenges/minimum-loss/problem def minimumLoss(price): min_loss = list() price = [(i,j) for i,j in zip(range(len(price)), price)] price = sorted(price,key=lambda x: x[1]) for i in range(len(price)-1): if(price[i][0]>price[i+1][0] and price[i][1]<price[i+1][1]): ...
def minimum_loss(price): min_loss = list() price = [(i, j) for (i, j) in zip(range(len(price)), price)] price = sorted(price, key=lambda x: x[1]) for i in range(len(price) - 1): if price[i][0] > price[i + 1][0] and price[i][1] < price[i + 1][1]: min_loss.append(price[i + 1][1] - pric...
# recursive function # O(n) time | O(h) space def nodedepth(root, depth=0): if root is None: return 0 return depth + nodedepth(root.left, depth + 1) + nodedepth(root.right, depth+1) # iterative function # O(n) time | O(h) space def findtheddepth(root): stack = [{"node": root, "depth": 0}] sum...
def nodedepth(root, depth=0): if root is None: return 0 return depth + nodedepth(root.left, depth + 1) + nodedepth(root.right, depth + 1) def findtheddepth(root): stack = [{'node': root, 'depth': 0}] sum_of_depth = 0 while len(stack) > 0: node_info = stack.pop() (node, depth...
#!/usr/bin/env python3 # # Copyright (C) 2018 ETH Zurich and University of Bologna # # 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 # # Unl...
class Condor_Pool(object): def __init__(self): machines = ['fenga1.ee.ethz.ch', 'pisoc1.ee.ethz.ch', 'pisoc3.ee.ethz.ch', 'pisoc4.ee.ethz.ch', 'pisoc5.ee.ethz.ch', 'pisoc6.ee.ethz.ch'] self.env = {} self.env['CONDOR_REQUIREMENTS'] = '( TARGET.OpSysAndVer == "CentOS7" )' def get_cmd(sel...
class Event: # TODO: This gonna abstract the concept of row data in traditional ML approach pass
class Event: pass
def parse(file_path): # Method to read the config file. # Using a custom function for parsing so that we have only one config for # both the scripts and the mapreduce tasks. config = {} with open(file_path) as f: for line in f: data = line.strip() if(data and not dat...
def parse(file_path): config = {} with open(file_path) as f: for line in f: data = line.strip() if data and (not data.startswith('#')): (key, value) = data.split('=') config[key] = value return config
# -*- coding: utf-8 -*- ############################################################################### # # Copyright (C) 2021-TODAY Prof-Dev Integrated(<http://www.prof-dev.com>). ############################################################################### { 'name': 'Prof-Dev School MGMT', 'version': '...
{'name': 'Prof-Dev School MGMT', 'version': '1.0', 'license': 'LGPL-3', 'category': 'Education', 'sequence': 1, 'summary': 'Manage Students, School stages,levels, classes and fees', 'complexity': 'easy', 'author': 'Prof-Dev Integrated Solutions', 'website': 'http://www.prof-dev.com', 'depends': ['hr'], 'data': ['views/...
class Solution: def xorOperation(self, n: int, start: int) -> int: nums = [start + 2 * i for i in range(n)]; ret = 0; for val in nums: ret ^= val return ret
class Solution: def xor_operation(self, n: int, start: int) -> int: nums = [start + 2 * i for i in range(n)] ret = 0 for val in nums: ret ^= val return ret
text = '' with open('/home/reagan/code/proj/familienanlichkeiten/data/DeReKo-2014-II-MainArchive-STT.100000.freq', 'r+') as f: text = f.read() def process_line(line: str): parts = line.split('\t') return (parts[1], parts[2]) known = set() lemmas = [] for line in text.splitlines(): lemma = process_lin...
text = '' with open('/home/reagan/code/proj/familienanlichkeiten/data/DeReKo-2014-II-MainArchive-STT.100000.freq', 'r+') as f: text = f.read() def process_line(line: str): parts = line.split('\t') return (parts[1], parts[2]) known = set() lemmas = [] for line in text.splitlines(): lemma = process_line(...
EXCHANGE_COSMOS_BLOCKCHAIN = "cosmos_blockchain" CUR_ATOM = "ATOM" MILLION = 1000000.0 CURRENCIES = { "ibc/14F9BC3E44B8A9C1BE1FB08980FAB87034C9905EF17CF2F5008FC085218811CC": "OSMO" }
exchange_cosmos_blockchain = 'cosmos_blockchain' cur_atom = 'ATOM' million = 1000000.0 currencies = {'ibc/14F9BC3E44B8A9C1BE1FB08980FAB87034C9905EF17CF2F5008FC085218811CC': 'OSMO'}
''' Given an n-ary tree, return the level order traversal of its nodes' values. Nary-Tree input serialization is represented in their level order traversal, each group of children is separated by the null value (See examples). Example: 1 / | \ 3 2 4 / \ 5 6 Input: root = [1,nul...
""" Given an n-ary tree, return the level order traversal of its nodes' values. Nary-Tree input serialization is represented in their level order traversal, each group of children is separated by the null value (See examples). Example: 1 / | 3 2 4 / 5 6 Input: root = [1,null,3,...
class StoreDoesNotExist(Exception): def __init__(self): super(StoreDoesNotExist, self).__init__("Store with the given query does not exist")
class Storedoesnotexist(Exception): def __init__(self): super(StoreDoesNotExist, self).__init__('Store with the given query does not exist')
class Blend(GenericForm, IDisposable): """ A blend solid or void form. """ def Dispose(self): """ Dispose(self: Element,A_0: bool) """ pass def getBoundingBox(self, *args): """ getBoundingBox(self: Element,view: View) -> BoundingBoxXYZ """ pass def GetVertex...
class Blend(GenericForm, IDisposable): """ A blend solid or void form. """ def dispose(self): """ Dispose(self: Element,A_0: bool) """ pass def get_bounding_box(self, *args): """ getBoundingBox(self: Element,view: View) -> BoundingBoxXYZ """ pass def get_vertex_connect...
class LexerFileWriter(): def __init__(self, tokens: dict, lexical_errors: dict, symbol_table: dict, token_filename="tokens.txt", lexical_error_filename="lexical_errors.txt", symbol_table_filename="symbol_table.txt"): self.tokens = tokens self.lexical_errors = lexical_errors ...
class Lexerfilewriter: def __init__(self, tokens: dict, lexical_errors: dict, symbol_table: dict, token_filename='tokens.txt', lexical_error_filename='lexical_errors.txt', symbol_table_filename='symbol_table.txt'): self.tokens = tokens self.lexical_errors = lexical_errors self.symbol_table ...
classes = { # layout = ["name", [attacks],[item_drops], [changes]] 0: ["soldier", [0], [2, 4, 5, 11], ["h+10", "d+2"]], 1: ["mage", [0, 2], [3, 7], ["m+40"]], 2: ["tank", [0], [1, 2, 6, 11], ["h*2", "d*0.7"]], 3: ["archer", [0, 1], [0, 3, 4, 11], ["a+10"]], 100: ["boss", [], [], ["h*1.3", "d*1.5...
classes = {0: ['soldier', [0], [2, 4, 5, 11], ['h+10', 'd+2']], 1: ['mage', [0, 2], [3, 7], ['m+40']], 2: ['tank', [0], [1, 2, 6, 11], ['h*2', 'd*0.7']], 3: ['archer', [0, 1], [0, 3, 4, 11], ['a+10']], 100: ['boss', [], [], ['h*1.3', 'd*1.5', 'a*2', 'm*2']], 101: ['basic', [0], [], []]} def get_all_classes(name_only=F...
def common_settings(args, plt): # Common options if args['--title']: plt.title(args['--title']) plt.ylabel(args['--ylabel']) plt.xlabel(args['--xlabel']) if args['--xlog']: plt.xscale('log') if args['--ylog']: plt.yscale('log')
def common_settings(args, plt): if args['--title']: plt.title(args['--title']) plt.ylabel(args['--ylabel']) plt.xlabel(args['--xlabel']) if args['--xlog']: plt.xscale('log') if args['--ylog']: plt.yscale('log')
#This assignment will allow you to practice writing #Python Generator functions and a small GUI using tkinter #Title: Generator Function of Powers of Two #Author: Anthony Narlock #Prof: Lisa Minogue #Class: CSCI 2061 #Date: Nov 14, 2020 #Powers of two is a gen function that can take multiple parameters, 1 or 2, gives...
def powers_of_twos(*args): number_of_parameters = len(args) if number_of_parameters == 1: starting_pow = 1 num_of_pow = args[0] elif number_of_parameters == 2: starting_pow = args[0] num_of_pow = args[1] else: raise type_error('Expected either one or two parameter...
class FileNames(object): '''standardize and handle all file names/types encountered by pipeline''' def __init__(self, name): '''do everything upon instantiation''' # determine root file name self.root = name self.root = self.root.replace('_c.fit','') self.root = self.ro...
class Filenames(object): """standardize and handle all file names/types encountered by pipeline""" def __init__(self, name): """do everything upon instantiation""" self.root = name self.root = self.root.replace('_c.fit', '') self.root = self.root.replace('_sobj.fit', '') ...
# -*- coding: utf-8 -*- class Hero(object): def __init__(self, forename, surname, hero): self.forename = forename self.surname = surname self.heroname = hero def __repr__(self): return 'Hero({0}, {1}, {2})'.format( self.forename, self.surname, self.heroname)
class Hero(object): def __init__(self, forename, surname, hero): self.forename = forename self.surname = surname self.heroname = hero def __repr__(self): return 'Hero({0}, {1}, {2})'.format(self.forename, self.surname, self.heroname)
result = [] with open(FILE, mode='r') as file: reader = csv.reader(file, lineterminator='\n') for *features, label in reader: label = SPECIES[int(label)] row = tuple(features) + (label,) result.append(row)
result = [] with open(FILE, mode='r') as file: reader = csv.reader(file, lineterminator='\n') for (*features, label) in reader: label = SPECIES[int(label)] row = tuple(features) + (label,) result.append(row)
def spec(x, y, color="run ID"): def subfigure(params, x_kwargs, y_kwargs): return { "height": 400, "width": 600, "encoding": { "x": {"type": "quantitative", "field": x, **x_kwargs}, "y": {"type": "quantitative", "field": y, **y_kwargs}, ...
def spec(x, y, color='run ID'): def subfigure(params, x_kwargs, y_kwargs): return {'height': 400, 'width': 600, 'encoding': {'x': {'type': 'quantitative', 'field': x, **x_kwargs}, 'y': {'type': 'quantitative', 'field': y, **y_kwargs}, 'color': {'type': 'nominal', 'field': color}, 'opacity': {'value': 0.1, ...
# Option for variable 'simulation_type': # 1: cylindrical roller bearing # 2: # 3: cylindrical roller thrust bearing # 4: ball on disk (currently not fully supported) # 5: pin on disk # 6: 4 ball # 7: ball on three plates # 8: ring on ring # global simulation setup simulation_type = 8 # one of the above type numbers ...
simulation_type = 8 simulation_name = 'RingOnRing' auto_print = True auto_plot = False auto_report = False tribo_system_name = 'bla' number_planets = 2 e_cb1 = 210000 ny_cb1 = 0.3 diameter_cb1 = 37.5 length_cb1 = 10 type_profile_cb1 = 'ISO' path_profile_cb1 = 'tribology/p3can/BearingProfiles/NU206-RE-1.txt' profile_rad...
class TestAuth: """ Test all functions relating to authentication in api.py. Logout is designed always to return success (even if user not logged in), since its job is to clear session data. """ def test_1(self, auth): # login and logout: correct input and method res = auth.login(uname="U1...
class Testauth: """ Test all functions relating to authentication in api.py. Logout is designed always to return success (even if user not logged in), since its job is to clear session data. """ def test_1(self, auth): res = auth.login(uname='U1', password='111') assert res.headers....
e={'Eid':100120,'name':'vijay','age':21} e1={'Eid':100121,'name':'vijay','age':21} e3={'Eid':100122,'name':'vijay','age':21} print(e) print(e.get('name')) e['age']=22; for i in e.keys(): print(e[i]) for i,j in e.items(): print(i,j)
e = {'Eid': 100120, 'name': 'vijay', 'age': 21} e1 = {'Eid': 100121, 'name': 'vijay', 'age': 21} e3 = {'Eid': 100122, 'name': 'vijay', 'age': 21} print(e) print(e.get('name')) e['age'] = 22 for i in e.keys(): print(e[i]) for (i, j) in e.items(): print(i, j)
class Solution(object): def islandPerimeter(self, grid): """ :type grid: List[List[int]] :rtype: int """ island_num = neighbor_num = 0 for i in range(len(grid)): for j in range(len(grid[i])): if grid[i][j] == 1: island_n...
class Solution(object): def island_perimeter(self, grid): """ :type grid: List[List[int]] :rtype: int """ island_num = neighbor_num = 0 for i in range(len(grid)): for j in range(len(grid[i])): if grid[i][j] == 1: island...
def all_doe_stake_transactions(): data = { 'module': 'account', 'action': 'txlist', 'address':'0x60C6b5DC066E33801F2D9F2830595490A3086B4e', 'startblock':'13554136', 'endblock':'99999999', # 'page': '1', # 'offset': '5', 'sort': 'asc', 'apikey'...
def all_doe_stake_transactions(): data = {'module': 'account', 'action': 'txlist', 'address': '0x60C6b5DC066E33801F2D9F2830595490A3086B4e', 'startblock': '13554136', 'endblock': '99999999', 'sort': 'asc', 'apikey': hidden_details.etherscan_key} return requests.get('https://api.etherscan.io/api', data=data).json...
# -*- coding: utf-8 -*- class Solution(object): def removeDuplicates(self, nums): """ :type nums: List[int] :rtype: int """ if not nums: return 0 last = 0 for i in range(1, len(nums)): if nums[i] != nums[last]: ...
class Solution(object): def remove_duplicates(self, nums): """ :type nums: List[int] :rtype: int """ if not nums: return 0 last = 0 for i in range(1, len(nums)): if nums[i] != nums[last]: last += 1 nums[...
""" 53. How to get the last n rows of a dataframe with row sum > 100? """ """ Difficulty Level: L2 """ """ Get the last two rows of df whose row sum is greater than 100. """ """ df = pd.DataFrame(np.random.randint(10, 40, 60).reshape(-1, 4)) """
""" 53. How to get the last n rows of a dataframe with row sum > 100? """ '\nDifficulty Level: L2\n' '\nGet the last two rows of df whose row sum is greater than 100.\n' '\ndf = pd.DataFrame(np.random.randint(10, 40, 60).reshape(-1, 4))\n'
class Thinker: def __init__(self): self.velocity = 0 def viewDistance(self): return 20 def step(self, deltaTime): self.velocity = 30 def getVelocity(self): return self.velocity
class Thinker: def __init__(self): self.velocity = 0 def view_distance(self): return 20 def step(self, deltaTime): self.velocity = 30 def get_velocity(self): return self.velocity
__author__ = 'fernando' class BaseAuth(object): def has_data(self): raise NotImplementedError() def get_username(self): raise NotImplementedError() def get_password(self): raise NotImplementedError()
__author__ = 'fernando' class Baseauth(object): def has_data(self): raise not_implemented_error() def get_username(self): raise not_implemented_error() def get_password(self): raise not_implemented_error()
# -*- coding: utf-8 -*- def test_readuntil(monkey): pass
def test_readuntil(monkey): pass
class dotRebarSpacing_t(object): # no doc EndOffset = None EndOffsetIsAutomatic = None EndOffsetIsFixed = None NumberSpacingZones = None StartOffset = None StartOffsetIsAutomatic = None StartOffsetIsFixed = None Zones = None
class Dotrebarspacing_T(object): end_offset = None end_offset_is_automatic = None end_offset_is_fixed = None number_spacing_zones = None start_offset = None start_offset_is_automatic = None start_offset_is_fixed = None zones = None
# You can create a generator using a generator expression like a lambda function. # This function does not need or use a yield keyword. # Syntax : Y = ([ Expression ]) y = [1,2,3,4,5] print([x**2 for x in y]) print("\nDoing this without using the generator expressions :") length = len(y) print((x**2 for x in y).__ne...
y = [1, 2, 3, 4, 5] print([x ** 2 for x in y]) print('\nDoing this without using the generator expressions :') length = len(y) print((x ** 2 for x in y).__next__()) input('Press any key to exit ')
# Mock out starturls for ../spiders.py file class MockGenerator(object): def __init__(self, *args, **kwargs): pass def __call__(self, *args, **kwargs): return [] class FeedGenerator(MockGenerator): pass class FragmentGenerator(MockGenerator): pass
class Mockgenerator(object): def __init__(self, *args, **kwargs): pass def __call__(self, *args, **kwargs): return [] class Feedgenerator(MockGenerator): pass class Fragmentgenerator(MockGenerator): pass
class Time: def gettime(self): self.hour=int(input("Enter hour: ")) self.minute=int(input("Enter minute: ")) self.second=int(input("Enter seconds: ")) def display(self): print(f"Time is {self.hour}:{self.minute}:{self.second}\n") def __add__(self,other): sum=Time() sum.hour=self.hour+other.hour ...
class Time: def gettime(self): self.hour = int(input('Enter hour: ')) self.minute = int(input('Enter minute: ')) self.second = int(input('Enter seconds: ')) def display(self): print(f'Time is {self.hour}:{self.minute}:{self.second}\n') def __add__(self, other): sum...
n = int(input()) for i in range(n): a = input() set1 = set(input().split()) b = input() set2 = set(input().split()) print(set1.issubset(set2))
n = int(input()) for i in range(n): a = input() set1 = set(input().split()) b = input() set2 = set(input().split()) print(set1.issubset(set2))
def estimator(data): reportedCases=data['reportedCases'] totalHospitalBeds=data['totalHospitalBeds'] output={"data": {},"impact": {},"severeImpact":{}} output['impact']['currentlyInfected']=reportedCases * 10 output['severeImpact']['currentlyInfected']=reportedCases * 50 days=28 if days: factor=int(da...
def estimator(data): reported_cases = data['reportedCases'] total_hospital_beds = data['totalHospitalBeds'] output = {'data': {}, 'impact': {}, 'severeImpact': {}} output['impact']['currentlyInfected'] = reportedCases * 10 output['severeImpact']['currentlyInfected'] = reportedCases * 50 days = 2...
class Location(object): """ Represents a Location where an Action could be taken. """ def __init__(self, location_id: str): """ Create a new Location. :param location_id: The id of the Location. """ self._location_id: str = location_id @property def loca...
class Location(object): """ Represents a Location where an Action could be taken. """ def __init__(self, location_id: str): """ Create a new Location. :param location_id: The id of the Location. """ self._location_id: str = location_id @property def loc...
# The base class for all widgets class Widget: def __init__(self, name): self.name = name pass def press_on(self, key): """Called with the argument `key`""" pass def release_on(self, k): pass # Text related methods def start_text_on(self, ...
class Widget: def __init__(self, name): self.name = name pass def press_on(self, key): """Called with the argument `key`""" pass def release_on(self, k): pass def start_text_on(self, k): pass def update_text_on(self, k): pass def end_...
""" Space : O(n) Time : O(n) Hackerrank competition """ def getMinimumUniqueSum(arr): ans = 0 dp = [0] * 7000 for i in arr: dp[i] += 1 n = len(dp) for i in range(n-1): if dp[i] > 1: dp[i+1] += dp[i] - 1 dp[i] = 1 for j in range(n): if dp[j...
""" Space : O(n) Time : O(n) Hackerrank competition """ def get_minimum_unique_sum(arr): ans = 0 dp = [0] * 7000 for i in arr: dp[i] += 1 n = len(dp) for i in range(n - 1): if dp[i] > 1: dp[i + 1] += dp[i] - 1 dp[i] = 1 for j in range(n): if ...
num1=int(input('Enter the first number:')) num2=int(input('Enter the second number:')) sum=lambda num1,num2:num1+num2 diff=lambda num1,num2:num1-num2 mul=lambda num1,num2:num1*num2 div=lambda num1,num2:num1//num2 print("Sum is:",sum(num1,num2)) print("Difference is:",diff(num1,num2)) print("Multiply is",mul(num1,num2...
num1 = int(input('Enter the first number:')) num2 = int(input('Enter the second number:')) sum = lambda num1, num2: num1 + num2 diff = lambda num1, num2: num1 - num2 mul = lambda num1, num2: num1 * num2 div = lambda num1, num2: num1 // num2 print('Sum is:', sum(num1, num2)) print('Difference is:', diff(num1, num2)) pri...
""" command line function stuff @author: matt milunski """ def check_refresh(input): if input >= 1: return input else: return 1 def check_currency(input): assert len(input) > 0, "you forgot to specify the crypto to track" return input
""" command line function stuff @author: matt milunski """ def check_refresh(input): if input >= 1: return input else: return 1 def check_currency(input): assert len(input) > 0, 'you forgot to specify the crypto to track' return input
SECRET_KEY='development-key' MYSQL_DATABASE_USER='root' MYSQL_DATABASE_PASSWORD='classroom' MYSQL_DATABASE_DB='Ascott_InvMgmt' MYSQL_DATABASE_HOST='dogfood.coxb3venarbl.ap-southeast-1.rds.amazonaws.com' UPLOADS_DEFAULT_DEST = 'static/img/items/' UPLOADS_DEFAULT_URL = 'http://localhost:5000/static/img/items/' UPLOADE...
secret_key = 'development-key' mysql_database_user = 'root' mysql_database_password = 'classroom' mysql_database_db = 'Ascott_InvMgmt' mysql_database_host = 'dogfood.coxb3venarbl.ap-southeast-1.rds.amazonaws.com' uploads_default_dest = 'static/img/items/' uploads_default_url = 'http://localhost:5000/static/img/items/' ...
class ThreadModule(object): '''docstring for ThreadModule''' def __init__(self, ): super().__init__()
class Threadmodule(object): """docstring for ThreadModule""" def __init__(self): super().__init__()
# Copyright (c) 2014, MapR Technologies # # 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 agree...
oozie = 'Oozie' hive = 'Hive' hive_metastore = 'HiveMetastore' hive_server2 = 'HiveServer2' cldb = 'CLDB' file_server = 'FileServer' zookeeper = 'ZooKeeper' resource_manager = 'ResourceManager' history_server = 'HistoryServer' is_m7_enabled = 'Enable MapR-DB' general = 'general' jobtracker = 'JobTracker' node_manager =...
def Analysis(cipherText): alphabet = dict(zip('ABCDEFGHIJKLMNOPQRSTUVWXYZ', [0] * 27)) for letter in cipherText: if letter.isalpha(): alphabet[letter] += 1 for key, value in alphabet.items(): alphabet[key] = value * (value - 1) IC = sum(alphabet.values()) / (len(cipherT...
def analysis(cipherText): alphabet = dict(zip('ABCDEFGHIJKLMNOPQRSTUVWXYZ', [0] * 27)) for letter in cipherText: if letter.isalpha(): alphabet[letter] += 1 for (key, value) in alphabet.items(): alphabet[key] = value * (value - 1) ic = sum(alphabet.values()) / (len(cipherText)...
# find nth fibonacci number using recursion. # sample output: # 21 def findnthfibnumber(n, map={1: 0, 2: 1}): if n in map: return map[n] else: map[n] = findnthfibnumber(n-1, map) + findnthfibnumber(n-2, map) return map[n] print (findnthfibnumber(9))
def findnthfibnumber(n, map={1: 0, 2: 1}): if n in map: return map[n] else: map[n] = findnthfibnumber(n - 1, map) + findnthfibnumber(n - 2, map) return map[n] print(findnthfibnumber(9))
class Solution: def countElements(self, arr: List[int]) -> int: d = {} count = 0 for i in arr: d[i] = 1 for x in arr: if x+1 in d.keys(): count += 1 return count
class Solution: def count_elements(self, arr: List[int]) -> int: d = {} count = 0 for i in arr: d[i] = 1 for x in arr: if x + 1 in d.keys(): count += 1 return count
def part_1() -> None: h_pos: int = 0 v_pos: int = 0 with open("../data/day2.txt", "r") as dFile: for row in dFile.readlines(): value: int = int(row.split(" ")[1]) match row.split(" ")[0]: case "forward": h_pos += ...
def part_1() -> None: h_pos: int = 0 v_pos: int = 0 with open('../data/day2.txt', 'r') as d_file: for row in dFile.readlines(): value: int = int(row.split(' ')[1]) match row.split(' ')[0]: case 'forward': h_pos += value case...
pkgname = "libffi8" pkgver = "3.4.2" pkgrel = 0 build_style = "gnu_configure" configure_args = [ "--includedir=/usr/include", "--disable-multi-os-directory", "--with-pic" ] hostmakedepends = ["pkgconf"] # actually only on x86 and arm (tramp.c code) but it does not hurt makedepends = ["linux-headers"] checkdepends =...
pkgname = 'libffi8' pkgver = '3.4.2' pkgrel = 0 build_style = 'gnu_configure' configure_args = ['--includedir=/usr/include', '--disable-multi-os-directory', '--with-pic'] hostmakedepends = ['pkgconf'] makedepends = ['linux-headers'] checkdepends = ['dejagnu'] pkgdesc = 'Library supporting Foreign Function Interfaces' m...
# # PySNMP MIB module HPN-ICF-L2VPN-PWE3-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-L2VPN-PWE3-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:27:17 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, value_size_constraint, constraints_union, single_value_constraint, constraints_intersection) ...
""" This file contains misc functions that are used throughout the project... """ def print_dict(d, level=0): # Prints a dictionary for k, v in d.items(): if isinstance(v, dict): print(level * '\t', k, ':') print_dict(v, level + 1) else: print(level * '\t', ...
""" This file contains misc functions that are used throughout the project... """ def print_dict(d, level=0): for (k, v) in d.items(): if isinstance(v, dict): print(level * '\t', k, ':') print_dict(v, level + 1) else: print(level * '\t', k, '-', v)
{ "targets": [ { "target_name": "gameLauncher", "conditions": [ ["OS==\"win\"", { "sources": [ "srcs/windows/GameLauncher.cpp" ] }], ["OS==\"linux\"", { "sources": [ "srcs/linux/GameLauncher.cpp" ] }] ...
{'targets': [{'target_name': 'gameLauncher', 'conditions': [['OS=="win"', {'sources': ['srcs/windows/GameLauncher.cpp']}], ['OS=="linux"', {'sources': ['srcs/linux/GameLauncher.cpp']}]]}]}
# pylint: disable=undefined-variable ## Whether to include output from clients other than this one sharing the same # kernel. # Required for jupyter-vim, see: # https://github.com/jupyter-vim/jupyter-vim#jupyter-configuration c.ZMQTerminalInteractiveShell.include_other_output = True ## Text to display before the f...
c.ZMQTerminalInteractiveShell.include_other_output = True c.ZMQTerminalInteractiveShell.banner = 'Jupyter console {version}' c.ZMQTerminalInteractiveShell.highlighting_style = 'solarized-dark' c.ZMQTerminalInteractiveShell.history_load_length = 1000 c.ZMQTerminalInteractiveShell.true_color = True
# Function to count number of substrings # with exactly k unique characters def countkDist(str1, k): n = len(str1) # Initialize result res = 0 # Consider all substrings beginning # with str[i] for i in range(0, n): dist_count = 0 # Initializing array with 0 cnt = [0] ...
def countk_dist(str1, k): n = len(str1) res = 0 for i in range(0, n): dist_count = 0 cnt = [0] * 27 for j in range(i, n): if cnt[ord(str1[j]) - 97] == 0: dist_count += 1 cnt[ord(str1[j]) - 97] += 1 if dist_count == k: ...
def check_order(scale_list): ascending_list = sorted(scale_list) descending_list = sorted(scale_list, reverse=True) if scale_list == ascending_list: return "ascending" elif scale_list == descending_list: return "descending" else: return "mixed" def main(): scale_list = i...
def check_order(scale_list): ascending_list = sorted(scale_list) descending_list = sorted(scale_list, reverse=True) if scale_list == ascending_list: return 'ascending' elif scale_list == descending_list: return 'descending' else: return 'mixed' def main(): scale_list = i...
#! /usr/bin/env python3 # -*- coding: UTF-8 -*- #------------------------------------------------------------------------------ def asSeparator () : return "//" + ("-" * 78) + "\n" #------------------------------------------------------------------------------ def generateInterruptSection (interruptSectionName) : ...
def as_separator(): return '//' + '-' * 78 + '\n' def generate_interrupt_section(interruptSectionName): s_code = as_separator() s_code += '// INTERRUPT - SECTION: ' + interruptSectionName + '\n' s_code += as_separator() + '\n' s_code += ' .section .text.interrupt.' + interruptSectionName + ', "a...
class Solution(object): # Empty list + join (Accepted + Top Voted), O(n) space and time def restoreString(self, s, indices): """ :type s: str :type indices: List[int] :rtype: str """ ret = [None] * len(s) for i in range(len(s)): ret[indices[i]]...
class Solution(object): def restore_string(self, s, indices): """ :type s: str :type indices: List[int] :rtype: str """ ret = [None] * len(s) for i in range(len(s)): ret[indices[i]] = s[i] return ''.join(ret)
''' File name: jr_utils.py Author: Tyche Analytics Co. Note: truncated file, suitable for model inference, but not development ''' """Collect various utility functions for JR model""" def mean(xs): if hasattr(xs,"__len__"): return sum(xs)/float(len(xs)) else: acc = 0 n = 0 ...
""" File name: jr_utils.py Author: Tyche Analytics Co. Note: truncated file, suitable for model inference, but not development """ 'Collect various utility functions for JR model' def mean(xs): if hasattr(xs, '__len__'): return sum(xs) / float(len(xs)) else: acc = 0 n = 0 ...
def two_fer(name="you"): """Returns a string in the two-fer format.""" return "One for " + name + ", one for me."
def two_fer(name='you'): """Returns a string in the two-fer format.""" return 'One for ' + name + ', one for me.'
in_str = list(str(input())) str_len = len(in_str) # letters set set_letters = set(in_str) set_len = len(set_letters) if str_len == set_len: print("Unique") else: print("Deja Vu")
in_str = list(str(input())) str_len = len(in_str) set_letters = set(in_str) set_len = len(set_letters) if str_len == set_len: print('Unique') else: print('Deja Vu')
# Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. # # Use of this source code is governed by a BSD-style license # that can be found in the LICENSE file in the root of the source # tree. An additional intellectual property rights grant can be found # in the file PATENTS. All contributing project au...
{'includes': ['../build/common.gypi'], 'targets': [{'target_name': 'peerconnection_unittests', 'type': '<(gtest_target_type)', 'dependencies': ['<(DEPTH)/testing/gmock.gyp:gmock', '<(webrtc_root)/api/api.gyp:libjingle_peerconnection', '<(webrtc_root)/base/base_tests.gyp:rtc_base_tests_utils', '<(webrtc_root)/common.gyp...
txtFile=open("/Users/chenchaoyang/Desktop/python/Python/content/content.txt","r") while True: line=txtFile.readline() if not line: break else: print(line) txtFile.close()
txt_file = open('/Users/chenchaoyang/Desktop/python/Python/content/content.txt', 'r') while True: line = txtFile.readline() if not line: break else: print(line) txtFile.close()
class DatabaseException(Exception): """Base exception for this package.""" pass class NoDataFoundException(DatabaseException): """Should be used when no data has been found.""" pass class BadDataException(DatabaseException): """Should be used when incorrect data is being submitted.""" pass
class Databaseexception(Exception): """Base exception for this package.""" pass class Nodatafoundexception(DatabaseException): """Should be used when no data has been found.""" pass class Baddataexception(DatabaseException): """Should be used when incorrect data is being submitted.""" pass
def beautify_parameter_name(s: str) -> str: """Make a parameter name look better. Good for parameter names that have words separated by _ . 1. change _ by spaces. 2. First letter is uppercased. """ new_s = " ".join(s.split("_")) return new_s.capitalize()
def beautify_parameter_name(s: str) -> str: """Make a parameter name look better. Good for parameter names that have words separated by _ . 1. change _ by spaces. 2. First letter is uppercased. """ new_s = ' '.join(s.split('_')) return new_s.capitalize()
# Extra parsing for markdown (Highlighting and alert boxes) def parse(rtxt, look, control): txtl = rtxt.split(look) i, j = 0, 0 ret_text = "" while i < len(txtl): if j == 0: # This is the start before the specified tag, add it normally ret_text += control.start(txtl[i]) ...
def parse(rtxt, look, control): txtl = rtxt.split(look) (i, j) = (0, 0) ret_text = '' while i < len(txtl): if j == 0: ret_text += control.start(txtl[i]) j += 1 elif j == 1: ret_text += control.inner(txtl[i]) j += 1 else: ...
# Copyright 2021, Google LLC # 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, sof...
def handle_webhook(request): req = request.get_json() response_text = '' intent = req['queryResult']['intent']['displayName'] if intent == 'Default Welcome Intent': response_text = 'Hello from a GCF Webhook' elif intent == 'get-agent-name': response_text = 'My name is Flowhook' e...
class TxtReader: def __init__(self, f): self.f = f def parse(self): file = open(self.f) line = file.readline() while line: print(line) line = file.readline() file.close #t = TxtReader('sample.txt') #t.parse()
class Txtreader: def __init__(self, f): self.f = f def parse(self): file = open(self.f) line = file.readline() while line: print(line) line = file.readline() file.close
#!/usr/bin/env python # encoding: utf-8 """ search_in_2d_matrix.py Created by Shengwei on 2014-07-24. """ # https://oj.leetcode.com/problems/search-a-2d-matrix/ # tags: easy / medium, matrix, search, edge cases """ Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the followi...
""" search_in_2d_matrix.py Created by Shengwei on 2014-07-24. """ '\nWrite an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:\n\nIntegers in each row are sorted from left to right.\nThe first integer of each row is greater than the last integer of the previou...
# -*- coding: utf-8 -*- def greet(name): i =0 # while True: # i +=1 first_name, surname = name.split(' ') return 'Hello {0}, {1}'.format(surname, first_name) def suggest_travel(distance): if distance > 5: return 'You should take the train.' elif distance > 2: return...
def greet(name): i = 0 (first_name, surname) = name.split(' ') return 'Hello {0}, {1}'.format(surname, first_name) def suggest_travel(distance): if distance > 5: return 'You should take the train.' elif distance > 2: return 'You should cycle.' else: return 'Stop being la...
# Para criar uma lista com 5 elementos '_' # ex. ['_', '_', '_', '_', '_'] print("Lista com elementos iguais") lista = [] for i in range(5): lista.append('_') print("Lista: ", lista) # Alternativa lista_alternativa = ['_' for i in range(5)] print("Modo Alternativdo de criar lista: ", lista_alternativa) # Para cr...
print('Lista com elementos iguais') lista = [] for i in range(5): lista.append('_') print('Lista: ', lista) lista_alternativa = ['_' for i in range(5)] print('Modo Alternativdo de criar lista: ', lista_alternativa) print('Lista com numeros na sequencia') lista = [] for i in range(6): lista.append(i) print('List...
#hack RSA, caluclate the p,q,d in order by given t,n,e def finitePrimeHack(t, n, e): res_list = [] # find p & q for i in range(2, t): if n % i == 0: p = i q = n//p res_list.append(p) res_list.append(q) #sort the list as p <= q res_list.sort() # find the d whic...
def finite_prime_hack(t, n, e): res_list = [] for i in range(2, t): if n % i == 0: p = i q = n // p res_list.append(p) res_list.append(q) res_list.sort() d = 0 y = 1 far = (p - 1) * (q - 1) while (far * y + 1) % e != 0: y += 1 d = (far * y + 1) // ...
d1 = {0:1, 1:1, 2:2, 3:3} pent_nums = [] for i in range(1, 100): val1 = ((3*(i**2))-i)/2 val2 = ((3*((-i)**2))+i)/2 pent_nums.append(val1) pent_nums.append(val2) for n in range(4, 101): ite = 0 p_t = d1[n-pent_nums[ite]] step = 1 stop = False rolling_sum = 0 while not stop: ...
d1 = {0: 1, 1: 1, 2: 2, 3: 3} pent_nums = [] for i in range(1, 100): val1 = (3 * i ** 2 - i) / 2 val2 = (3 * (-i) ** 2 + i) / 2 pent_nums.append(val1) pent_nums.append(val2) for n in range(4, 101): ite = 0 p_t = d1[n - pent_nums[ite]] step = 1 stop = False rolling_sum = 0 while n...
n1 = int(input()) n2 = int(input()) n3 = int(input()) if n1 > n2 > n3: print(n3) print(n2) print(n1) elif n2 > n1 > n3: print(n3) print(n1) print(n2) elif n1 > n3 > n2: print(n2) print(n3) print(n1) elif n2 > n3 > n1: print(n1) print(n3) print(n2) elif n3 > n2 > n1: ...
n1 = int(input()) n2 = int(input()) n3 = int(input()) if n1 > n2 > n3: print(n3) print(n2) print(n1) elif n2 > n1 > n3: print(n3) print(n1) print(n2) elif n1 > n3 > n2: print(n2) print(n3) print(n1) elif n2 > n3 > n1: print(n1) print(n3) print(n2) elif n3 > n2 > n1: p...
RBNF = r""" NEWLINE := '' ENDMARKER := '' NAME := '' INDENT := '' DEDENT := '' NUMBER := '' STRING := '' single_input ::= it=NEWLINE | seq=simple_stmt | it=compound_stmt NEWLINE file_input ::= (NEWLINE | seqs<<stmt)* [ENDMARKER] -> mod=Module(sum(seqs or [], [])); fix_missing_locations(mod); return mod eval_input ...
rbnf = "\nNEWLINE := ''\nENDMARKER := ''\nNAME := ''\nINDENT := ''\nDEDENT := ''\nNUMBER := ''\nSTRING := ''\n\nsingle_input ::= it=NEWLINE | seq=simple_stmt | it=compound_stmt NEWLINE\nfile_input ::= (NEWLINE | seqs<<stmt)* [ENDMARKER] -> mod=Module(sum(seqs or [], [])); fix_missing_locations(mod); return mod\neval_...
# https://codeforces.com/problemset/problem/959/A n = int(input()) print('Mahmoud' if n%2 == 0 else 'Ehab')
n = int(input()) print('Mahmoud' if n % 2 == 0 else 'Ehab')
# # Copyright (c) 2017-2018 Joy Diamond. All rights reserved. # @gem('Sapphire.Parse1Atom') def gem(): show = 7 @share def parse1_map_element(): if qk() is not none: #my_line('qk: %r', qk()) raise_unknown_line() token = parse1_atom() if token.is_right_b...
@gem('Sapphire.Parse1Atom') def gem(): show = 7 @share def parse1_map_element(): if qk() is not none: raise_unknown_line() token = parse1_atom() if token.is_right_brace: return token if token.is_special_operator: raise_unknown_line() ...
def calculateFuel(weight): return int(weight / 3)-2 # Part 1 total = 0 with open("/Users/a318196/Code/AdventOfCode2020/20191201/input.txt") as file: for line in file: total += calculateFuel(int(line)) print ('Total part 1: ' + str(total)) # Part 2 total = 0 with open("/Users/a318196/Code/AdventOfCode20...
def calculate_fuel(weight): return int(weight / 3) - 2 total = 0 with open('/Users/a318196/Code/AdventOfCode2020/20191201/input.txt') as file: for line in file: total += calculate_fuel(int(line)) print('Total part 1: ' + str(total)) total = 0 with open('/Users/a318196/Code/AdventOfCode2020/20191201/inpu...
class FLAG_OPTIONS: MUTLIPLE_SEGMENTS_EXIST = 0x1 ALL_PROPERLY_ALIGNED = 0x2 SEG_UNMAPPED = 0x4 NEXT_SEG_UNMAPPED = 0x8 SEQ_REV_COMP = 0x10 NEXT_SEQ_REV_COMP = 0x20 FIRST_SEQ_IN_TEMP = 0x40 LAST_SEQ_IN_TEMP = 0x80 SECONDARY_ALG = 0x100 POOR_QUALITY = 0x200 DUPLICATE_READ = 0x...
class Flag_Options: mutliple_segments_exist = 1 all_properly_aligned = 2 seg_unmapped = 4 next_seg_unmapped = 8 seq_rev_comp = 16 next_seq_rev_comp = 32 first_seq_in_temp = 64 last_seq_in_temp = 128 secondary_alg = 256 poor_quality = 512 duplicate_read = 1024 supplementar...
secure_log_path = "/var/log/secure"; secure_log_score_tokens = \ { "Invalid user": 3, "User root": 5, "Failed password": 2 }; secure_log_score_limit = 10; #firewall-cmd --permanent --ipset=some_set --add-entry=xxx.xxx.xxx.xxx firewalld_ipset_name = "ips2drop"; ##########################################...
secure_log_path = '/var/log/secure' secure_log_score_tokens = {'Invalid user': 3, 'User root': 5, 'Failed password': 2} secure_log_score_limit = 10 firewalld_ipset_name = 'ips2drop' ip_address_pattern = '[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}' abuse_report_mail_pattern = 'abuse@[a-zA-Z]+\\.[a-zA-Z]+'
a, b, c, d = map(int, input().split()) s = a + b + c + d a, b, c, d = map(int, input().split()) t = a + b + c + d print(max(s, t))
(a, b, c, d) = map(int, input().split()) s = a + b + c + d (a, b, c, d) = map(int, input().split()) t = a + b + c + d print(max(s, t))