content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
load("@fbcode_macros//build_defs:config.bzl", "config") def require_global_compiler(msg, compiler = None): """ Assert that a global compiler is set. """ global_compiler = config.get_global_compiler_family() if compiler == None: if global_compiler == None: fail(msg) elif glo...
load('@fbcode_macros//build_defs:config.bzl', 'config') def require_global_compiler(msg, compiler=None): """ Assert that a global compiler is set. """ global_compiler = config.get_global_compiler_family() if compiler == None: if global_compiler == None: fail(msg) elif global...
#!/usr/bin/python # -*- coding: utf-8 -*- # Classes class app: version = " v1.00 " # released 2022/02/18 class emoji: bye = "\U0001F44B" clock = "\U000023F3" help = "\U0001F4A1" class colour: grey = "\033[2m" default = "\033[m" class dictionary: projects = {} tasks = {} class list: ...
class App: version = ' v1.00 ' class Emoji: bye = '👋' clock = '⏳' help = '💡' class Colour: grey = '\x1b[2m' default = '\x1b[m' class Dictionary: projects = {} tasks = {} class List: projects = []
def rule(event): # check that this is a password change event; # event id 11 is actor_user changed password for user # Normally, admin's may change a user's password (event id 211) return event.get('event_type_id') == 11 def title(event): return 'A user [{}] password changed by user [{}]'.format(...
def rule(event): return event.get('event_type_id') == 11 def title(event): return 'A user [{}] password changed by user [{}]'.format(event.get('user_name'), event.get('actor_user_name'))
class Solution: def isPalindrome(self, head): w = [] while head: w.append(head.val) head = head.next return w == w[::-1]
class Solution: def is_palindrome(self, head): w = [] while head: w.append(head.val) head = head.next return w == w[::-1]
#!/usr/bin/env python STAGES = { # anonymous step { "install": "/path/to/file", "install": "/path/to/file", "install": "/path/to/file", "send": "", }, } def pre_handler(scenario): pass def post_handler(scenario): pass
stages = {{'install': '/path/to/file', 'install': '/path/to/file', 'install': '/path/to/file', 'send': ''}} def pre_handler(scenario): pass def post_handler(scenario): pass
#!/usr/bin/env python # $Id: 20121004$ # $Date: 2012-10-04 16:35:23$ # $Author: Marek Lukaszuk$ # based on: # http://keccak.noekeon.org/specs_summary.html rc = [0x0000000000000001,0x000000008000808B, 0x0000000000008082,0x800000000000008B, 0x800000000000808A,0x8000000000008089, 0x8000000080008000,0x8000000000008003, ...
rc = [1, 2147516555, 32898, 9223372036854775947, 9223372036854808714, 9223372036854808713, 9223372039002292224, 9223372036854808579, 32907, 9223372036854808578, 2147483649, 9223372036854775936, 9223372039002292353, 32778, 9223372036854808585, 9223372039002259466, 138, 9223372039002292353, 136, 9223372036854808704, 2147...
#!/usr/bin/env python3 """A generic object to hold a users data for sorting Author(s) --------- Daniel Gisolfi <Daniel.Gisolfi1@marist.edu> """ class Object: def __init__(self, title, value, **kwargs): """basic object for sorting Parameters ---------- title : str ...
"""A generic object to hold a users data for sorting Author(s) --------- Daniel Gisolfi <Daniel.Gisolfi1@marist.edu> """ class Object: def __init__(self, title, value, **kwargs): """basic object for sorting Parameters ---------- title : str title of object fo...
# https://tinyurl.com/qmbd2vl class Solution(object): def findMaxLength(self, nums): """ :type nums: List[int] :rtype: int """ count, maxLenSoFar = 0, 0 counterMap = {count: -1} # count:index, for i in range(len(nums)): currentNum = nums[i] ...
class Solution(object): def find_max_length(self, nums): """ :type nums: List[int] :rtype: int """ (count, max_len_so_far) = (0, 0) counter_map = {count: -1} for i in range(len(nums)): current_num = nums[i] if currentNum == 0: ...
while True : a = int (input()) if a == 0: break
while True: a = int(input()) if a == 0: break
"DylDylan Murphy " "2018-07-20" """TThis Program takes files generated by the NYC Open Data application GBAT and pastes the BBL, X and Y Coordinates for addresses of petroleum spills stored in Borough specific files""" class Sysifish: def __init__(self, BoroughCode, Cramped, Spacious, street, BBL, x, y,...
"""DylDylan Murphy """ '2018-07-20' 'TThis Program takes files generated by the NYC Open Data application GBAT and pastes the BBL, X and Y Coordinates \nfor addresses of petroleum spills stored in Borough specific files' class Sysifish: def __init__(self, BoroughCode, Cramped, Spacious, street, BBL, x, y, end): ...
n = 600851475143 i = 2 while i ** 2 < n: while n % i == 0: n //= i i += 1 print(n)
n = 600851475143 i = 2 while i ** 2 < n: while n % i == 0: n //= i i += 1 print(n)
# Description: "Hello World" Program in Python print("Hello World!") print('Hello Again! But in single quotes') print("You can't enter double quotes inside double quoted string but can use ' like this.") print('Similarly you can enter " inside single quoted string.') print('Or you can escape single quotes like t...
print('Hello World!') print('Hello Again! But in single quotes') print("You can't enter double quotes inside double quoted string but can use ' like this.") print('Similarly you can enter " inside single quoted string.') print("Or you can escape single quotes like this ' inside single quoted string.") print('Or you can...
cont_18 = cont_M = cont_F = 0 while True: print('-' * 25) print(' CADASTRE UMA PESSOA') print('-' * 25) idade = int(input('Idade: ')) sexo = ' ' while sexo not in 'MF': sexo = str(input('Sexo: [M/F] ')).upper().strip()[0] print('-' * 25) if idade >= 18: cont_18 += 1 ...
cont_18 = cont_m = cont_f = 0 while True: print('-' * 25) print(' CADASTRE UMA PESSOA') print('-' * 25) idade = int(input('Idade: ')) sexo = ' ' while sexo not in 'MF': sexo = str(input('Sexo: [M/F] ')).upper().strip()[0] print('-' * 25) if idade >= 18: cont_18 += 1 ...
with open('secrets.txt') as input: with open("src/secrets.h", "w") as output: for line_number, define in enumerate(input): output.write("#define {}".format(define))
with open('secrets.txt') as input: with open('src/secrets.h', 'w') as output: for (line_number, define) in enumerate(input): output.write('#define {}'.format(define))
n_plots_per_species = survey_data.groupby(["name"])["verbatimLocality"].nunique().sort_values() fig, ax = plt.subplots(figsize=(10, 8)) n_plots_per_species.plot(kind="barh", ax=ax) ax.set_xlabel("Number of plots"); ax.set_ylabel("");
n_plots_per_species = survey_data.groupby(['name'])['verbatimLocality'].nunique().sort_values() (fig, ax) = plt.subplots(figsize=(10, 8)) n_plots_per_species.plot(kind='barh', ax=ax) ax.set_xlabel('Number of plots') ax.set_ylabel('')
# 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, WHET...
url_scheme = 'https://' allowed_methods = frozenset(['GET', 'POST', 'PUT', 'DELETE', 'PATCH']) body_methods = frozenset(['POST', 'PUT', 'PATCH']) query_methods = frozenset(['GET', 'DELETE']) default_content_headers = {'content-type': 'application/json'} status_ok = 200 status_invalid_request = 400 status_unauthorized =...
# Start with the program you wrote for Exercise 6-1 (page 99). tesla = { 'first_name': 'elon', 'last_name': 'musk', 'age': 45, 'city': 'los angeles', } # Make two new dictionaries representing different people, and store all three # dictionaries in a list called people. Loop through your list of pe...
tesla = {'first_name': 'elon', 'last_name': 'musk', 'age': 45, 'city': 'los angeles'} microsoft = {'first_name': 'bill', 'last_name': 'gates', 'age': 70, 'city': 'seattle'} apple = {'first_name': 'steve', 'last_name': 'jobs', 'age': 63, 'city': 'cupertino'} ceo_list = [] ceo_list.append(tesla) ceo_list.append(microsoft...
CONTROL_NAMES = { 'anti_malware': 'Anti-Malware', 'web_reputation': 'Web Reputation', 'firewall': 'Firewall', 'intrusion_prevention': 'Intrusion Prevention', 'integrity_monitoring': 'Integrity Monitoring', 'log_inspection': 'Log Inspection', }
control_names = {'anti_malware': 'Anti-Malware', 'web_reputation': 'Web Reputation', 'firewall': 'Firewall', 'intrusion_prevention': 'Intrusion Prevention', 'integrity_monitoring': 'Integrity Monitoring', 'log_inspection': 'Log Inspection'}
#!/usr/local/bin/python3 ################################################################################################################################# class Merchant: def __init__(self, name, classtype, description, items): self.name = name self.description = description self.inventory = items self.clas...
class Merchant: def __init__(self, name, classtype, description, items): self.name = name self.description = description self.inventory = items self.classtype = classtype self.taken = False def is_taken(self): return False
def solve(arr): visited = set() max_length = 0 for elem in arr: if elem not in visited: length = 1 current = elem while current not in visited: visited.add(current) current = arr[current] length += 1 max...
def solve(arr): visited = set() max_length = 0 for elem in arr: if elem not in visited: length = 1 current = elem while current not in visited: visited.add(current) current = arr[current] length += 1 max_...
""" contains opcode_dict and stack_diffs dictionaries opcode_dict is used by the loader to disassemble a contract stack_diffs is used by vm.apply_stack to test the proper parsing of opcodes """ opcode_dict = { # # Stop and Arithmetic # 0x00: "stop", 0x01: "add", 0x02: "mul", 0...
""" contains opcode_dict and stack_diffs dictionaries opcode_dict is used by the loader to disassemble a contract stack_diffs is used by vm.apply_stack to test the proper parsing of opcodes """ opcode_dict = {0: 'stop', 1: 'add', 2: 'mul', 3: 'sub', 4: 'div', 5: 'sdiv', 6: 'mod', 7: 'smod', 8: 'addmod', 9...
arr = [5,3,20,15,8,3] n = len(arr) max = -999999 for i in range(n-1,-1,-1): if arr[i] > max: print(arr[i], end = " ") # you can use stack and then print to get in the same order max = arr[i] # Leader of an array are the elements in which no element on the right side of teh element is greater than that...
arr = [5, 3, 20, 15, 8, 3] n = len(arr) max = -999999 for i in range(n - 1, -1, -1): if arr[i] > max: print(arr[i], end=' ') max = arr[i]
class ServiceFunctionChain: def __init__(self, arrival_time, ttl, bandwidth_demand, max_response_latency, vnfs, processing_delays=None): '''Creating a new service function chain Args: arrival_time (int): Arrival time of the SFC request ttl (int): Time to live of the SFC ...
class Servicefunctionchain: def __init__(self, arrival_time, ttl, bandwidth_demand, max_response_latency, vnfs, processing_delays=None): """Creating a new service function chain Args: arrival_time (int): Arrival time of the SFC request ttl (int): Time to live of the SFC ...
a = [1, 8, 5, 3, 11, 6, 15] def selection_sort(array): for i in range(len(array)): swap_from = i swap_to = -1 for j in range(i + 1, len(array)): if array[swap_from] > array[j] and ( swap_to == -1 or array[swap_to] > array[j] ): swap_...
a = [1, 8, 5, 3, 11, 6, 15] def selection_sort(array): for i in range(len(array)): swap_from = i swap_to = -1 for j in range(i + 1, len(array)): if array[swap_from] > array[j] and (swap_to == -1 or array[swap_to] > array[j]): swap_to = j if swap_to > 0: ...
# # PySNMP MIB module A3Com-products-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/A3COM-PRODUCTS-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:08:14 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, constraints_union, value_range_constraint, constraints_intersection) ...
def find_similar_dogs(breed): temperment = dogs[breed] good_boys = set() most_common = 0 for dog in dogs: if dog == breed: continue common = 0 for x in temperment: if x in dogs[dog]: common += 1 if common ...
def find_similar_dogs(breed): temperment = dogs[breed] good_boys = set() most_common = 0 for dog in dogs: if dog == breed: continue common = 0 for x in temperment: if x in dogs[dog]: common += 1 if common > most_common: ...
class Viewbox(): """ Class representing a bounding box. Defaults to maximum bounds for WKID 4326. """ def convert_srs(self, new_wkid): """Return a new Viewbox object with the specified SRS.""" return self # not yet implemented def __init__(self, left=-180, top=90, right=180, bo...
class Viewbox: """ Class representing a bounding box. Defaults to maximum bounds for WKID 4326. """ def convert_srs(self, new_wkid): """Return a new Viewbox object with the specified SRS.""" return self def __init__(self, left=-180, top=90, right=180, bottom=-90, wkid=4326): ...
########################################################################## # NSAp - Copyright (C) CEA, 2013 - 2015 # Distributed under the terms of the CeCILL-B license, as published by # the CEA-CNRS-INRIA. Refer to the LICENSE file or to # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html # for details. ###...
""" Module custom exceptions. """ class Fslerror(Exception): """ Base exception type for the package. """ def __init__(self, message): super(FSLError, self).__init__(message) class Fslruntimeerror(FSLError): """ Error thrown when call to the FSL software failed. """ def __init__(self...
def remove_letter(letter, string): """Removes all occurrences of a given letter from a string.""" string_without_letter = string.replace(letter, '') return string_without_letter def main(): """Define main function.""" # Prompt the user for a word word = input('Please enter a wor...
def remove_letter(letter, string): """Removes all occurrences of a given letter from a string.""" string_without_letter = string.replace(letter, '') return string_without_letter def main(): """Define main function.""" word = input('Please enter a word: ') letter = input('Please enter a letter y...
def checksum(s1,s2): length=len(s1) check_sum="" carry=0 for i in range(length-1,-1,-1): if s1[i]=='0' and s2[i]=='0': if carry==0: check_sum="0"+check_sum else: check_sum="1"+check_sum carry=0 elif (s1[i]=='0' and s...
def checksum(s1, s2): length = len(s1) check_sum = '' carry = 0 for i in range(length - 1, -1, -1): if s1[i] == '0' and s2[i] == '0': if carry == 0: check_sum = '0' + check_sum else: check_sum = '1' + check_sum carry = 0 ...
""" PERIODS """ numPeriods = 180 """ STOPS """ numStations = 13 station_names = ( "Hamburg Hbf", # 0 "Landwehr", # 1 "Hasselbrook", # 2 "Wansbeker Chaussee*", # 3 "Friedrichsberg*", # 4 "Barmbek*", # 5 "Alte Woehr (Stadtpark)", # 6 "Ruebenkamp (City Nord)", # 7 "Ohlsdorf*", # 8 "Kornweg", # 9 ...
""" PERIODS """ num_periods = 180 '\nSTOPS\n' num_stations = 13 station_names = ('Hamburg Hbf', 'Landwehr', 'Hasselbrook', 'Wansbeker Chaussee*', 'Friedrichsberg*', 'Barmbek*', 'Alte Woehr (Stadtpark)', 'Ruebenkamp (City Nord)', 'Ohlsdorf*', 'Kornweg', 'Hoheneichen', 'Wellingsbuettel', 'Poppenbuettel*') num_stops = 26 ...
GEM_NAME = 'CloudGemDynamicContent' TEST_FILENAMES = [ 'DynamicContentTest.manifest.pak', 'UserRequestedData.shared.pak', 'DynamicContentTestData.shared.pak' ] STAGING_STATUS_PUBLIC = 'PUBLIC' STAGING_STATUS_PRIVATE = 'PRIVATE' STAGING_STATUS_WINDOW = 'WINDOW'
gem_name = 'CloudGemDynamicContent' test_filenames = ['DynamicContentTest.manifest.pak', 'UserRequestedData.shared.pak', 'DynamicContentTestData.shared.pak'] staging_status_public = 'PUBLIC' staging_status_private = 'PRIVATE' staging_status_window = 'WINDOW'
class Path(object): """ Performs operations on System.String instances that contain file or directory path information. These operations are performed in a cross-platform manner. """ @staticmethod def ChangeExtension(path,extension): """ ChangeExtension(path: str,extension: str) -> str Changes t...
class Path(object): """ Performs operations on System.String instances that contain file or directory path information. These operations are performed in a cross-platform manner. """ @staticmethod def change_extension(path, extension): """ ChangeExtension(path: str,extension: str) -> str ...
""" URL: https://codeforces.com/problemset/problem/732/B Author: Safiul Kabir [safiulanik at gmail.com] Tags: dp, greedy, *1000 """ n, k = map(int, input().split()) a = list(map(int, input().split())) min_count = 0 d = 0 for i in range(n - 1): if a[i] + a[i + 1] < k: d = k - a[i] - a[i + 1] min_cou...
""" URL: https://codeforces.com/problemset/problem/732/B Author: Safiul Kabir [safiulanik at gmail.com] Tags: dp, greedy, *1000 """ (n, k) = map(int, input().split()) a = list(map(int, input().split())) min_count = 0 d = 0 for i in range(n - 1): if a[i] + a[i + 1] < k: d = k - a[i] - a[i + 1] min_co...
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def deleteDuplicates(self, head): """ :type head: ListNode :rtype: ListNode """ temp = head while te...
class Solution(object): def delete_duplicates(self, head): """ :type head: ListNode :rtype: ListNode """ temp = head while temp is not None and temp.next is not None: if temp.val == temp.next.val: temp.next = temp.next.next els...
# https://www.hackerrank.com/challenges/sherlock-and-the-beast/problem?isFullScreen=true def decentNumber(n): # Write your code here a, b = divmod(n,3) while b%5: b+=3 a-=1 if a>-1: print("5"*a*3+"3"*b) else: print("-1")
def decent_number(n): (a, b) = divmod(n, 3) while b % 5: b += 3 a -= 1 if a > -1: print('5' * a * 3 + '3' * b) else: print('-1')
w = [] for _ in range(10): w.append(int(input())) k = [] for _ in range(10): k.append(int(input())) w.sort(reverse=True) k.sort(reverse=True) print(sum(w[0:3]), sum(k[0:3]))
w = [] for _ in range(10): w.append(int(input())) k = [] for _ in range(10): k.append(int(input())) w.sort(reverse=True) k.sort(reverse=True) print(sum(w[0:3]), sum(k[0:3]))
def main(): a=[10,20,5,49,32,68] print(mergeSort(a)) def mergeSort(a): key=len(a)//2 left=a[0] right=a[-1] l=mergeSort(a[left:key]) r=mergesort(a[key+1:right]) return(merge(a,l,r)) def merge(a,l,r): if a[l]<a[r]: pass elif a[l]>a[r]: a[l],a[r]=a[r]...
def main(): a = [10, 20, 5, 49, 32, 68] print(merge_sort(a)) def merge_sort(a): key = len(a) // 2 left = a[0] right = a[-1] l = merge_sort(a[left:key]) r = mergesort(a[key + 1:right]) return merge(a, l, r) def merge(a, l, r): if a[l] < a[r]: pass elif a[l] > a[r]: ...
number=int(input()) cond1=(number%9==0) conv_to_str=str(number) digit1=int(conv_to_str[0]) digit2=int(conv_to_str[1]) cond2=(digit1 or digit2) if cond1 and cond2: print("Lucky Number") else: print("Unlucky Number")
number = int(input()) cond1 = number % 9 == 0 conv_to_str = str(number) digit1 = int(conv_to_str[0]) digit2 = int(conv_to_str[1]) cond2 = digit1 or digit2 if cond1 and cond2: print('Lucky Number') else: print('Unlucky Number')
# 0 1 1 2 3 5 8 13 21 34 nterms=int(input("Enter the number of terms:")) n1=0 n2=1 count=0 if nterms <=0: print("Please enter a positive number.") elif nterms==1: print("Fibonacci series upto", nterms,":") print(n1) else: print("Fibonacci series upto", nterms," is:") while coun...
nterms = int(input('Enter the number of terms:')) n1 = 0 n2 = 1 count = 0 if nterms <= 0: print('Please enter a positive number.') elif nterms == 1: print('Fibonacci series upto', nterms, ':') print(n1) else: print('Fibonacci series upto', nterms, ' is:') while count < nterms: print(n1, end=...
class User: GENDER = ['male', 'female'] MULTIPLIERS = {'female': 0.413, 'male': 0.415} AVERAGES = {'female': 70.0, 'male': 78.0} def __init__(self, gender=None, height=None, stride=None): try: self.gender = str(gender).lower() if gender else None except ValueError: ...
class User: gender = ['male', 'female'] multipliers = {'female': 0.413, 'male': 0.415} averages = {'female': 70.0, 'male': 78.0} def __init__(self, gender=None, height=None, stride=None): try: self.gender = str(gender).lower() if gender else None except ValueError: ...
f = open("input/day6input.txt", "r") gans = f.read().split('\n\n') pyes = 0 # passenger yes gyes = 0 # gyes pcl = [] grpans = [] for ans in gans: gcl = list(set()) pcl.clear() for a in ans.split('\n'): cset = set() for l in a: for c in l: pcl.append(c...
f = open('input/day6input.txt', 'r') gans = f.read().split('\n\n') pyes = 0 gyes = 0 pcl = [] grpans = [] for ans in gans: gcl = list(set()) pcl.clear() for a in ans.split('\n'): cset = set() for l in a: for c in l: pcl.append(c) cset.add(c) ...
class geotile(): class gps(): def __init__(self, latitude, longitude): self.latitude = latitude self.longitude = longitude if latitude < -90.0 or latitude > 90.0: raise ValueError("Latitude must be between -90 and 90") if longi...
class Geotile: class Gps: def __init__(self, latitude, longitude): self.latitude = latitude self.longitude = longitude if latitude < -90.0 or latitude > 90.0: raise value_error('Latitude must be between -90 and 90') if longitude < -180.0 or l...
class Category: def __init__(self, name, image): self.name = name self.image = image self.description = None
class Category: def __init__(self, name, image): self.name = name self.image = image self.description = None
#!/usr/bin/python class Token: KEYWORD = 1 SYMBOL = 2 IDENTIFIER = 3 INT_CONST = 4 STRING_CONST = 5 class JackTokenizer: def __init__(self, filename): self.initTransitionTable() f = open(filename, 'r') self.data = f.read() f.close() self.tokens = [] self.currentTokenId = -1 s...
class Token: keyword = 1 symbol = 2 identifier = 3 int_const = 4 string_const = 5 class Jacktokenizer: def __init__(self, filename): self.initTransitionTable() f = open(filename, 'r') self.data = f.read() f.close() self.tokens = [] self.currentTo...
# check old-Code-Analysis.py for feedback of your code # An SMS Simulation class SMSMessage(object) class SMSMessage: #class variables initialized with default value hasBeenRead = False messageText = "text" fromNumber = 12345 #for initializing object def __init__(self, hasBeenRead, messageText...
class Smsmessage: has_been_read = False message_text = 'text' from_number = 12345 def __init__(self, hasBeenRead, messageText, fromNumber): self.hasBeenRead = hasBeenRead self.messageText = messageText self.fromNumber = fromNumber def mark_as_read(self): self.hasBee...
class Solution(object): def letterCasePermutation(self, S): """ :type S: str :rtype: List[str] """ answer = [] self.backtrack(S, "", 0, answer) return answer def backtrack(self, originalString, path, index, cache): if index == len(originalString)...
class Solution(object): def letter_case_permutation(self, S): """ :type S: str :rtype: List[str] """ answer = [] self.backtrack(S, '', 0, answer) return answer def backtrack(self, originalString, path, index, cache): if index == len(originalStrin...
""" Solutions for 2020's Advent of Code """ # TODO is it tidy? # TODO is it complete?a
""" Solutions for 2020's Advent of Code """
# -*- coding=utf-8 -*- class _Missing(object): def __repr__(self): return "no value" def __reduce__(self): return "_missing" def __nonzero__(self): return False _missing = _Missing() class cached_property(object): def __init__(self, func, name=None, doc=None): sel...
class _Missing(object): def __repr__(self): return 'no value' def __reduce__(self): return '_missing' def __nonzero__(self): return False _missing = __missing() class Cached_Property(object): def __init__(self, func, name=None, doc=None): self.__name__ = name or func...
''' Longest Uncommon Subsequence II Given a list of strings, you need to find the longest uncommon subsequence among them. The longest uncommon subsequence is defined as the longest subsequence of one of these strings and this subsequence should not be any subsequence of the other strings. A subsequence is a sequence...
""" Longest Uncommon Subsequence II Given a list of strings, you need to find the longest uncommon subsequence among them. The longest uncommon subsequence is defined as the longest subsequence of one of these strings and this subsequence should not be any subsequence of the other strings. A subsequence is a sequence...
class LinkedListNode: def __init__(self, val): self.data = val self.next = None def add_to_linked_list(head, node): cur = head while cur.next != None: cur = cur.next cur.next = node def contains_cycle(head): slow = head.next fast = head.next.next maxi = 0 while ...
class Linkedlistnode: def __init__(self, val): self.data = val self.next = None def add_to_linked_list(head, node): cur = head while cur.next != None: cur = cur.next cur.next = node def contains_cycle(head): slow = head.next fast = head.next.next maxi = 0 while...
def parse_field_names_and_types(schema_string, to_keep=True, strip_quotes=True): """Parses the string representation of a VDS schema into a list of 2-tuples: (name, type_string) For example - given the string: ''' chrom: String, pos: Int, '''' It will yield the ...
def parse_field_names_and_types(schema_string, to_keep=True, strip_quotes=True): """Parses the string representation of a VDS schema into a list of 2-tuples: (name, type_string) For example - given the string: ''' chrom: String, pos: Int, '''' It will yield the t...
expected_output = { 'clock_state': {'system_status': {'associations_address': '10.4.1.1', 'clock_state': 'synchronized', 'clock_stratum': 8, 'root_delay': 0.01311}}, 'vrf': { 'default': { ...
expected_output = {'clock_state': {'system_status': {'associations_address': '10.4.1.1', 'clock_state': 'synchronized', 'clock_stratum': 8, 'root_delay': 0.01311}}, 'vrf': {'default': {'peer': {'10.4.1.1': {'delay': 0.01311, 'local': '0.0.0.0', 'mode': 'synchronized', 'poll': 16, 'reach': 377, 'remote': '10.4.1.1', 'st...
''' POW(X,N) Implement pow(x, n), which calculates x raised to the power n (xn). ''' def myPow(x: float, n: int) -> float: if n < 0: x, n = (1/x), -n if n == 0: return 1 if n % 2: return x * self.myPow(x*x, n//2) return self.myPow(x*x, n//2)
""" POW(X,N) Implement pow(x, n), which calculates x raised to the power n (xn). """ def my_pow(x: float, n: int) -> float: if n < 0: (x, n) = (1 / x, -n) if n == 0: return 1 if n % 2: return x * self.myPow(x * x, n // 2) return self.myPow(x * x, n // 2)
# # @lc app=leetcode id=81 lang=python3 # # [81] Search in Rotated Sorted Array II # # @lc code=start class Solution: def search(self, nums: List[int], target: int) -> bool: left = 0 right = len(nums) - 1 while left <= right: middle = (left + right) // 2 if nums[midd...
class Solution: def search(self, nums: List[int], target: int) -> bool: left = 0 right = len(nums) - 1 while left <= right: middle = (left + right) // 2 if nums[middle] == target: return True elif nums[middle] == nums[left]: ...
class NoConfigValueError(LookupError): def __init__(self, *args): super(NoConfigValueError, self).__init__(*args) self.message = ("No local configuration value for: '%s'." % args[0]) class Config(dict): def __getitem__(self, x): # Re-write for better error message try: ...
class Noconfigvalueerror(LookupError): def __init__(self, *args): super(NoConfigValueError, self).__init__(*args) self.message = "No local configuration value for: '%s'." % args[0] class Config(dict): def __getitem__(self, x): try: return super(Config, self).__getitem__(x)...
dataset_defaults = { 'fmow': { 'epochs': 12, 'batch_size': 64, 'optimiser': 'Adam', 'optimiser_args': { 'lr': 1e-4, 'weight_decay': 0, 'amsgrad': True, 'betas': (0.9, 0.999), }, 'pretrain_iters': 24000, 'meta_lr...
dataset_defaults = {'fmow': {'epochs': 12, 'batch_size': 64, 'optimiser': 'Adam', 'optimiser_args': {'lr': 0.0001, 'weight_decay': 0, 'amsgrad': True, 'betas': (0.9, 0.999)}, 'pretrain_iters': 24000, 'meta_lr': 0.01, 'meta_steps': 5, 'selection_metric': 'acc_worst_region', 'reload_inner_optim': True, 'print_iters': 500...
def palavras_sao_iguais(palavras): p1 = palavras.split("-") if len(p1) < 2: return False modelo = p1[0] iguais = True for p in p1: if p != modelo: iguais = False return iguais print(palavras_sao_iguais('abobrinha')) # 'pega-pega', 'cri-cri', 'zum-zum'
def palavras_sao_iguais(palavras): p1 = palavras.split('-') if len(p1) < 2: return False modelo = p1[0] iguais = True for p in p1: if p != modelo: iguais = False return iguais print(palavras_sao_iguais('abobrinha'))
class Streamer(object): """ Interface for streaming """ def initialize_connection(self, address: str, port: int) -> None: """ Initializes connection to the server :param address: address to stream to :param port: port to access server on """ pass def...
class Streamer(object): """ Interface for streaming """ def initialize_connection(self, address: str, port: int) -> None: """ Initializes connection to the server :param address: address to stream to :param port: port to access server on """ pass def...
cases_body = """ <p>As of today, the total number of COVID-19 cases in the United States has exceeded 7 million.</p> """ deaths_body = """ <p>As of today, the total number of COVID-19 deaths in the United States has exceeded 2 million.</p> """
cases_body = '\n\n<p>As of today, the total number of COVID-19 cases in\nthe United States has exceeded 7 million.</p>\n\n' deaths_body = '\n\n<p>As of today, the total number of COVID-19 deaths in\nthe United States has exceeded 2 million.</p>\n\n'
READER_NAME = "self.reader" PROCESSOR_FUNCTION_FIELD = "__processor__" REPROCESS_AFTER_FIELD = "__reprocess_after__" REPROCESSOR_FUNCTION_FIELD = "__reprocessor__" REPROCESS_ASSIGN_TO_FIELD = "__reprocessor_name__" PREFUNCTION_FIELD = "__duckparse_first__" STREAM_TYPE_FIELD = "__duckparse_stream_type__" DATAKIND_GUA...
reader_name = 'self.reader' processor_function_field = '__processor__' reprocess_after_field = '__reprocess_after__' reprocessor_function_field = '__reprocessor__' reprocess_assign_to_field = '__reprocessor_name__' prefunction_field = '__duckparse_first__' stream_type_field = '__duckparse_stream_type__' datakind_guard_...
fruits = ["Nanas","Apel","Pepaya","Kentang"] x = 3 for x in range (4): print(fruits[x])
fruits = ['Nanas', 'Apel', 'Pepaya', 'Kentang'] x = 3 for x in range(4): print(fruits[x])
class PlannerSystem: def __init__(self): self.maps = {} self.dispensers = {} self.taskboards = {} self.goals = {} self.task_assigned = {} self.states = {} self.default_metas = { 'is_goal': False, 'is_task_board': False, 'a...
class Plannersystem: def __init__(self): self.maps = {} self.dispensers = {} self.taskboards = {} self.goals = {} self.task_assigned = {} self.states = {} self.default_metas = {'is_goal': False, 'is_task_board': False, 'are_dispensers': False} self.ta...
""" IDEX v2 API Wrapper Base https://docs.idex.io """ __version__ = '0.0.0'
""" IDEX v2 API Wrapper Base https://docs.idex.io """ __version__ = '0.0.0'
# SOURCE SYSTEMS ECE_REPORTER = 'ECE Reporter' HISTORICAL_ECIS = 'Historical ECIS Snapshot' # Pensieve PENSIEVE_SCHEMA = 'Pensieve' # Canonical Times FULL_TIME = 'FT' PART_TIME = 'PT' # ECIS times ECIS_FULL_TIME = 'F/T' ECIS_WRAP_AROUND = 'WA' ECIS_SCHOOL_AGE = 'School Age' # Age Groups INFANT_TODDLER = 'Infant/Tod...
ece_reporter = 'ECE Reporter' historical_ecis = 'Historical ECIS Snapshot' pensieve_schema = 'Pensieve' full_time = 'FT' part_time = 'PT' ecis_full_time = 'F/T' ecis_wrap_around = 'WA' ecis_school_age = 'School Age' infant_toddler = 'Infant/Toddler' preschool = 'Preschool' school_age = 'School-age'
peso = float(input('Insira o peso: ')) limite = 50 excesso = peso - limite multa = excesso * 4 print(f'Multa no valor de: R$ {multa}')
peso = float(input('Insira o peso: ')) limite = 50 excesso = peso - limite multa = excesso * 4 print(f'Multa no valor de: R$ {multa}')
{ 'name': "Bista Training Management System", 'version': '1.0', 'summary': "", 'sequence': 10, 'description': """Practice - Lithin Sir""", 'depends': ['base', 'mail', 'hr', 'sale', 'contacts', 'stock', ...
{'name': 'Bista Training Management System', 'version': '1.0', 'summary': '', 'sequence': 10, 'description': 'Practice - Lithin Sir', 'depends': ['base', 'mail', 'hr', 'sale', 'contacts', 'stock'], 'data': ['security/bista_tms_security.xml', 'security/bista_tms_record_rules.xml', 'security/ir.model.access.csv', 'views/...
expected_output = { 'app_id' : 'meraki', 'owner' : 'iox', 'state' : 'RUNNING', 'application':{ 'type' : 'docker', 'name' : 'cat9k-app', 'version' : 'T-202106031655-G5c6da678-L0b29c1a9M-clouisa-creditor', 'activated_profile_name' : 'custom' }, 'resource_reservation...
expected_output = {'app_id': 'meraki', 'owner': 'iox', 'state': 'RUNNING', 'application': {'type': 'docker', 'name': 'cat9k-app', 'version': 'T-202106031655-G5c6da678-L0b29c1a9M-clouisa-creditor', 'activated_profile_name': 'custom'}, 'resource_reservation': {'memory': '512 MB', 'disk': '2 MB', 'cpu': '500 units', 'cpu_...
def main(): name = input("What's your name? ") if name != "Richard": print("Hi,",name) else: print("I have a secret message for you.") print("You are AWESOME!!!") print("Goodbye!") main()
def main(): name = input("What's your name? ") if name != 'Richard': print('Hi,', name) else: print('I have a secret message for you.') print('You are AWESOME!!!') print('Goodbye!') main()
# coding: utf-8 class Solution: # @param {int} n the nth # @return {string} the nth sequence def countAndSay(self, n): # Write your code here return self._countAndSay(n) def _countAndSay(self, n): if n == 1: return '1' ret = '' prev_str = self._count...
class Solution: def count_and_say(self, n): return self._countAndSay(n) def _count_and_say(self, n): if n == 1: return '1' ret = '' prev_str = self._countAndSay(n - 1) i = 0 while i < len(prev_str): ch = prev_str[i] sum = 1 ...
# -*- coding: utf-8 -*- # # This file is part of REANA. # Copyright (C) 2019 CERN. # # REANA is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """REANA client API utils.""" def get_path_from_operation_id(paths_dict, operation_id): "...
"""REANA client API utils.""" def get_path_from_operation_id(paths_dict, operation_id): """Find API path based on operation id.""" paths = paths_dict.keys() for path in paths: methods = paths_dict[path].keys() for method in methods: if paths_dict[path][method]['operationId'] == ...
class Solution: def romanToInt(self, s: str) -> int: value = {'M': 1000,'D': 500, 'C': 100,'L': 50,'X': 10,'V': 5,'I': 1} p = 0;ans = 0 n = len(s) for i in range(n-1, -1, -1): if value[s[i]] >= p: ans += value[s[i]] else: ans -...
class Solution: def roman_to_int(self, s: str) -> int: value = {'M': 1000, 'D': 500, 'C': 100, 'L': 50, 'X': 10, 'V': 5, 'I': 1} p = 0 ans = 0 n = len(s) for i in range(n - 1, -1, -1): if value[s[i]] >= p: ans += value[s[i]] else: ...
duanweichang=(1298,438) refresh=(106, 65) biaoqing=(1735, 621) biaoqing0=(1398, 500) biaoqing1=(1398, 500) biaoqing2=(1531, 490) biaoqing3=(1684, 506) biaoqing4=(1421, 624) biaoqing5=(1550, 639) biaoqing6=(1681, 629) biaoqing7=(1402, 779) biaoqing8=(1549, 774) biaoqing9=(1682, 772) queding=(1648, 967) fanhui=(218, 192)...
duanweichang = (1298, 438) refresh = (106, 65) biaoqing = (1735, 621) biaoqing0 = (1398, 500) biaoqing1 = (1398, 500) biaoqing2 = (1531, 490) biaoqing3 = (1684, 506) biaoqing4 = (1421, 624) biaoqing5 = (1550, 639) biaoqing6 = (1681, 629) biaoqing7 = (1402, 779) biaoqing8 = (1549, 774) biaoqing9 = (1682, 772) queding = ...
log_file = """ ------------------Log File------------------- (20, 4) (20, 1) [[ 43. 311. 96. 4.] [ 33. 308. 327. 14.] [142. 3. 158. 188.] [204. 26. 110. 161.] [112. 272. 254. 290.] [314. 167. 276. 199.] [333. 348. 288. 234.] [263. 362. 280. 233.] [ 73. 145. 111. 183.] [ 14. 146. 58. 50.] [ 41. 153. ...
log_file = '\n------------------Log File-------------------\n\n(20, 4)\n(20, 1)\n[[ 43. 311. 96. 4.]\n [ 33. 308. 327. 14.]\n [142. 3. 158. 188.]\n [204. 26. 110. 161.]\n [112. 272. 254. 290.]\n [314. 167. 276. 199.]\n [333. 348. 288. 234.]\n [263. 362. 280. 233.]\n [ 73. 145. 111. 183.]\n [ 14. 146. 58. 50.]\...
class deer: def __init__(self, name, speed, dash, rest): self.name = name self.speed = speed self.dash = dash self.rest = rest self.points = 0 return def ret_val(self): return self.name, self.speed, self.dash, self.rest def race(time, speed, dash, rest): clock = dist = stam = 0 wh...
class Deer: def __init__(self, name, speed, dash, rest): self.name = name self.speed = speed self.dash = dash self.rest = rest self.points = 0 return def ret_val(self): return (self.name, self.speed, self.dash, self.rest) def race(time, speed, dash, res...
class Solution(object): def moveZeroes(self, nums): """ :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. """ def swap(array, index_a, index_b): temp = array[index_a] array[index_a] = array[index_b] a...
class Solution(object): def move_zeroes(self, nums): """ :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. """ def swap(array, index_a, index_b): temp = array[index_a] array[index_a] = array[index_b] ...
class Solution: def removeDuplicates(self, nums): """ :type nums: List[int] :rtype: int see this link for animation of this problem https://mp.weixin.qq.com/s?__biz=MzUyNjQxNjYyMg==&mid=2247484284&idx=2&sn=c8af62a82a62a21217d0f0b2b5891e4f&chksm=fa0e6cfdcd79e5ebe8726a61f93b83...
class Solution: def remove_duplicates(self, nums): """ :type nums: List[int] :rtype: int see this link for animation of this problem https://mp.weixin.qq.com/s?__biz=MzUyNjQxNjYyMg==&mid=2247484284&idx=2&sn=c8af62a82a62a21217d0f0b2b5891e4f&chksm=fa0e6cfdcd79e5ebe8726a61f93b...
class Solution: def maxSum(self, nums1: List[int], nums2: List[int]) -> int: s1=[0]*(len(nums1)+1) s2=[0]*(len(nums2)+1) index1=len(nums1)-1 index2=len(nums2)-1 while index1>=0 and index2>=0: if nums1[index1]>nums2[index2]: s1[index1]=s1[in...
class Solution: def max_sum(self, nums1: List[int], nums2: List[int]) -> int: s1 = [0] * (len(nums1) + 1) s2 = [0] * (len(nums2) + 1) index1 = len(nums1) - 1 index2 = len(nums2) - 1 while index1 >= 0 and index2 >= 0: if nums1[index1] > nums2[index2]: ...
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def mergeTwoLists(self, l1, l2): """ :type l1: ListNode :type l2: ListNode :rtype: ListNode """ if n...
class Solution(object): def merge_two_lists(self, l1, l2): """ :type l1: ListNode :type l2: ListNode :rtype: ListNode """ if not l1: return l2 if not l2: return l1 (sorted_head, sorted_tail) = (None, None) if l1.val < l...
# V1 : dev # class Solution(object): # def validSquare(self, p1, p2, p3, p4): # def get_length(p1,p2): # return (p1[0]-p2[0])**2 + (p1[1]-p2[1])**2 # length_sq = min( get_length(p1,p2), get_length(p1,p3)) # print (length_sq) # count = 0 # for pair in [[p1,p3], [p1,p4], [p2,p3], [p3,p4]]: # if (...
class Solution(object): def valid_square(self, p1, p2, p3, p4): """ :type p1: List[int] :type p2: List[int] :type p3: List[int] :type p4: List[int] :rtype: bool """ def dist(p1, p2): return (p1[0] - p2[0]) ** 2 + (p1[1] - p2[1]) ** 2 ...
class Solution: def combinationSum4(self, nums, target): memo = {} def dfs(sm): if sm in memo: return memo[sm] else: if sm >= target: memo[sm] = sm == target return memo[sm] cnt = 0 ...
class Solution: def combination_sum4(self, nums, target): memo = {} def dfs(sm): if sm in memo: return memo[sm] else: if sm >= target: memo[sm] = sm == target return memo[sm] cnt = 0 ...
""" ci_reduce.imred =============== Pixel-level reduction utilities for the DESI Commissioning Instrument (CI) off-line image analysis pipeline. """
""" ci_reduce.imred =============== Pixel-level reduction utilities for the DESI Commissioning Instrument (CI) off-line image analysis pipeline. """
# Copyright 2017 The Bazel Authors. All rights reserved. # # 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 la...
""" Rules to set capabilities on a container. The container must have the `setcap` binary in it. """ load('@io_bazel_rules_docker//container:container.bzl', 'container_image') def _setcap_impl(ctx): """Implementation for the setcap rule. This rule sets capabilities on a binary in an image and stores the image....
"""Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the original relative order of the nodes in each of the two partitions. For example, Given 1->4->3->2->5->2 and x = 3, return 1->2->2->4->3->5.""" # Definition for sing...
"""Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the original relative order of the nodes in each of the two partitions. For example, Given 1->4->3->2->5->2 and x = 3, return 1->2->2->4->3->5.""" class Solution(object...
def capitalizeVowels(word): result = "" vowels = 'AaEeIiOoUu' for i in word: if (i in vowels): result += i.upper() else: result +=i return result print(capitalizeVowels('apple'))
def capitalize_vowels(word): result = '' vowels = 'AaEeIiOoUu' for i in word: if i in vowels: result += i.upper() else: result += i return result print(capitalize_vowels('apple'))
# Verifying an Alien Dictionary: https://leetcode.com/problems/verifying-an-alien-dictionary/ # In an alien language, surprisingly they also use english lowercase letters, but possibly in a different order. The order of the alphabet is some permutation of lowercase letters. # Given a sequence of words written in the a...
class Solution: def is_alien_sorted(self, words, order: str) -> bool: alien_value = {} for (index, value) in enumerate(order): alienValue[value] = index for i in range(1, len(words)): word1 = words[i - 1] word2 = words[i] for j in range(len(wo...
class Solution: def partition(self, s: str) -> list[list[str]]: res = [] def is_palindrome(s): start, end = 0, len(s)-1 while start < end: if s[start] != s[end]: return False start += 1 end -= 1 ...
class Solution: def partition(self, s: str) -> list[list[str]]: res = [] def is_palindrome(s): (start, end) = (0, len(s) - 1) while start < end: if s[start] != s[end]: return False start += 1 end -= 1 ...
"""Codewars: Product Of Maximums Of Array (Array Series #2) 7 kyu URL: https://www.codewars.com/kata/5a63948acadebff56f000018/train/python Task Given an array/list [] of integers , Find the product of the k maximal numbers. Notes Array/list size is at least 3 . Array/list's numbers Will be mixture of positives , neg...
"""Codewars: Product Of Maximums Of Array (Array Series #2) 7 kyu URL: https://www.codewars.com/kata/5a63948acadebff56f000018/train/python Task Given an array/list [] of integers , Find the product of the k maximal numbers. Notes Array/list size is at least 3 . Array/list's numbers Will be mixture of positives , neg...
class BlockError: def __init__(self): self.errors = {} self.error_count = 0 @staticmethod def get() -> {str}: return BlockError().get_block_error() def add_error(self, block_id: str, error: str): if block_id not in self.errors: self.error_count += 1 ...
class Blockerror: def __init__(self): self.errors = {} self.error_count = 0 @staticmethod def get() -> {str}: return block_error().get_block_error() def add_error(self, block_id: str, error: str): if block_id not in self.errors: self.error_count += 1 ...
class ProcessInterface(object): """ProcessInterface Something that can be processed """ def process(self, input_interface): """process Do the processing :param input_interface: the input to process :type input_interface: InputInterface :return: the result of the ...
class Processinterface(object): """ProcessInterface Something that can be processed """ def process(self, input_interface): """process Do the processing :param input_interface: the input to process :type input_interface: InputInterface :return: the result of the ...
x = input().split() y = float(x[1]) x = float(x[0]) if(y == 0): if(x == 0): print("Origem") else: print("Eixo X") else: if(x == 0): if(y != 0): print("Eixo Y") else: if(x > 0): if(y > 0): print("Q1") else: print("Q4") else: if(y > 0): print("Q2") else: print("Q3")
x = input().split() y = float(x[1]) x = float(x[0]) if y == 0: if x == 0: print('Origem') else: print('Eixo X') elif x == 0: if y != 0: print('Eixo Y') elif x > 0: if y > 0: print('Q1') else: print('Q4') elif y > 0: print('Q2') else: print('Q3')
entries = [ { 'env-title': 'atari-alien', 'env-variant': 'No-op start', 'score': 6163, 'stddev': 1077, }, { 'env-title': 'atari-amidar', 'env-variant': 'No-op start', 'score': 2296, 'stddev': 154, }, { 'env-title': 'atari-assaul...
entries = [{'env-title': 'atari-alien', 'env-variant': 'No-op start', 'score': 6163, 'stddev': 1077}, {'env-title': 'atari-amidar', 'env-variant': 'No-op start', 'score': 2296, 'stddev': 154}, {'env-title': 'atari-assault', 'env-variant': 'No-op start', 'score': 8010, 'stddev': 381}, {'env-title': 'atari-asterix', 'env...
class Tree(object): def __init__(self): self.__struct = {} def add(self, item): p = 1 b = "1" if len(self.__struct) == 0: self.__struct[1] = item else: found = False while not found: if item < self.__struct[p]: b += "0" else: b += "1" p = int(b,2) i...
class Tree(object): def __init__(self): self.__struct = {} def add(self, item): p = 1 b = '1' if len(self.__struct) == 0: self.__struct[1] = item else: found = False while not found: if item < self.__struct[p]: ...
""" Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=1500 ] = 0.105 Average Precision (AP) @[ IoU=0.25 | area= all | maxDets=1500 ] = -1.000 Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=1500 ] = 0.249 Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=1500 ] = 0...
""" Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=1500 ] = 0.105 Average Precision (AP) @[ IoU=0.25 | area= all | maxDets=1500 ] = -1.000 Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=1500 ] = 0.249 Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=1500 ] = 0...
def main(): N = int(input()) X, Y = map(int, input().split()) As =[0]*N Bs = [0]*N for i in range(N): As[i], Bs[i] = map(int, input().split()) if __name__ == '__main__': main()
def main(): n = int(input()) (x, y) = map(int, input().split()) as = [0] * N bs = [0] * N for i in range(N): (As[i], Bs[i]) = map(int, input().split()) if __name__ == '__main__': main()
class User(object): def __init__(self, **kwargs): # TODO: prevent bad usernames or passwords (too small, etc) if "username" in kwargs: self.username = kwargs["username"] if "user_name" in kwargs: self.username = kwargs["user_name"] if "password" in kwargs: ...
class User(object): def __init__(self, **kwargs): if 'username' in kwargs: self.username = kwargs['username'] if 'user_name' in kwargs: self.username = kwargs['user_name'] if 'password' in kwargs: self.password = kwargs['password'] self.role = 'st...
# Dictionary of ASCII characters and a creative name for each of them # TODO: give the items that don't have a # at the end a creative name! # Regex: .*(?<!#)$ ingredients_dictionary = { # '\n' : 'new lines', # ' ' : 'air', # '!' : 'gunpowder', # '"' : 'ice', # '#' : 'hashbrowns', # '$' : 'gold', # '%'...
ingredients_dictionary = {' ': 'air', '!': 'gunpowder', '"': 'ice', '#': 'hashbrowns', '$': 'gold', '%': 'sunscreen', '&': 'glue', "'": 'apple juice', '(': 'salt', ')': 'pepper', '*': 'sprinkles', '+': 'plusses', ',': 'food coloring', '-': 'hyphens', '.': 'bread crumbs', '/': 'laxative', '0': 'olives', '1': 'eggnog', '...
def nth_row_pascal(n): """ :param: - n - index (0 based) return - list() representing nth row of Pascal's triangle """ if n ==0: return [1] output = [1,1] for i in range(1, n): new_array = [] new_array.append(1) for j in range(len(output) - 1): ne...
def nth_row_pascal(n): """ :param: - n - index (0 based) return - list() representing nth row of Pascal's triangle """ if n == 0: return [1] output = [1, 1] for i in range(1, n): new_array = [] new_array.append(1) for j in range(len(output) - 1): n...
puzzleInput = open('AdventOfCode_08.txt').read().strip().split() puzzleInput = [int(i) for i in puzzleInput] metaSum = pos = 0 def readMetaData(): global metaSum, pos anzChilds = puzzleInput[pos] anzMeta = puzzleInput[pos+1] pos += 2 for i in range(anzChilds): readMetaData() for i in range(anzMeta): ...
puzzle_input = open('AdventOfCode_08.txt').read().strip().split() puzzle_input = [int(i) for i in puzzleInput] meta_sum = pos = 0 def read_meta_data(): global metaSum, pos anz_childs = puzzleInput[pos] anz_meta = puzzleInput[pos + 1] pos += 2 for i in range(anzChilds): read_meta_data() ...
class AlwaysPositive: def __init__(self, number): self.n = number def __add__(self, other): """ 'abs' return the absolute value :param other: object of class :return: absolute value of the sum """ return abs(self.n + other.n) if __name__ == '__main__': ...
class Alwayspositive: def __init__(self, number): self.n = number def __add__(self, other): """ 'abs' return the absolute value :param other: object of class :return: absolute value of the sum """ return abs(self.n + other.n) if __name__ == '__main__': ...