content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# coding=utf-8 class NodeType: select = 'SELECT' insert = 'INSERT' delete = 'DELETE' update = 'UPDATE' train = 'TRAIN' register = 'REGISTER' load = 'LOAD' save = 'SAVE' connect = 'CONNECT' set = 'SET' alert = 'ALERT' create_table = 'CREATETABLE' drop_table = 'DROPTA...
class Nodetype: select = 'SELECT' insert = 'INSERT' delete = 'DELETE' update = 'UPDATE' train = 'TRAIN' register = 'REGISTER' load = 'LOAD' save = 'SAVE' connect = 'CONNECT' set = 'SET' alert = 'ALERT' create_table = 'CREATETABLE' drop_table = 'DROPTABLE' create_i...
# Name: # Date: # proj02: sum # Write a program that prompts the user to enter numbers, one per line, # ending with a line containing 0, and keep a running sum of the numbers. # Only print out the sum after all the numbers are entered # (at least in your final version). Each time you read in a number, # you can immed...
num = int(input('Enter a number to sum, or 0 to indicate you are finished:')) sum = 0 summ = 0 while num > 0: sum = sum + num num = int(input('Enter a number to sum, or 0 to indicate you are finished:')) summ = summ + 1 average = sum / summ print('Your average is ' + str(average)) '"#R/P/S\nanswer = input("...
sentence='I am interested in {num}' pi=3.14 print(sentence.format(num=pi)) e=2.712 print(sentence.format(num=e))
sentence = 'I am interested in {num}' pi = 3.14 print(sentence.format(num=pi)) e = 2.712 print(sentence.format(num=e))
""" File: rocket.py Name:Claire Lin ----------------------- This program should implement a console program that draws ASCII art - a rocket. The size of rocket is determined by a constant defined as SIZE at top of the file. Output format should match what is shown in the sample run in the Assignment 2 Handout....
""" File: rocket.py Name:Claire Lin ----------------------- This program should implement a console program that draws ASCII art - a rocket. The size of rocket is determined by a constant defined as SIZE at top of the file. Output format should match what is shown in the sample run in the Assignment 2 Handout. """ siz...
l = [int(i) for i in input().split()] print("largest - ", max(l)) print('smallest - ', min(l)) print('2nd largest - ', sorted(l)[-2]) print('2nd smallest - ', sorted(l)[1])
l = [int(i) for i in input().split()] print('largest - ', max(l)) print('smallest - ', min(l)) print('2nd largest - ', sorted(l)[-2]) print('2nd smallest - ', sorted(l)[1])
"""Tier of ecosystem membership.""" # pylint: disable=too-few-public-methods class Tier: """Tiers of ecosystem membership.""" MAIN: str = "MAIN" MEMBER: str = "MEMBER" CANDIDATE: str = "CANDIDATE" COMMUNITY: str = "COMMUNITY" PROTOTYPES: str = "PROTOTYPES"
"""Tier of ecosystem membership.""" class Tier: """Tiers of ecosystem membership.""" main: str = 'MAIN' member: str = 'MEMBER' candidate: str = 'CANDIDATE' community: str = 'COMMUNITY' prototypes: str = 'PROTOTYPES'
N, M = list(map(int, input().split())) # N, M = (2, 3) def simple_add(n, m): if m == 0: return n elif m > 0: return simple_add(n + m, 0) else: return simple_add(n + m, 0) print(simple_add(N, M))
(n, m) = list(map(int, input().split())) def simple_add(n, m): if m == 0: return n elif m > 0: return simple_add(n + m, 0) else: return simple_add(n + m, 0) print(simple_add(N, M))
qtd=int(input()) if qtd>=0 and qtd<=1000: lista=[] for a in range(0,qtd): A=int(input()) while A<0 or A>10**6: A=int(input()) lista.append(A) acessos=0 dias=0 for a in lista: acessos+=a print(a, acessos) if acessos+a<10**6: ...
qtd = int(input()) if qtd >= 0 and qtd <= 1000: lista = [] for a in range(0, qtd): a = int(input()) while A < 0 or A > 10 ** 6: a = int(input()) lista.append(A) acessos = 0 dias = 0 for a in lista: acessos += a print(a, acessos) if acessos ...
class person: count=0 #class attribute def __init__(self,name="bol",age=23): #constructor self.__name=name #instance attribute self.__age=age #instance attribute person.count=person.count+1 def setname(self,name): self.__name=name def getname(self): retur...
class Person: count = 0 def __init__(self, name='bol', age=23): self.__name = name self.__age = age person.count = person.count + 1 def setname(self, name): self.__name = name def getname(self): return self.__name def display_info(self): print(self...
# # PySNMP MIB module ELTEX-IP-OSPF-IF-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ELTEX-IP-OSPF-IF-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:45:50 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_union, constraints_intersection, value_range_constraint, value_size_constraint) ...
# -*- coding: utf-8 -*- def main(): s = input().split() ans = list() for si in s: if '@' in si: is_at = False string = '' for sii in si: if sii == '@': if string != '': ans.append(strin...
def main(): s = input().split() ans = list() for si in s: if '@' in si: is_at = False string = '' for sii in si: if sii == '@': if string != '': ans.append(string) string = '' ...
# move.py # handles movement in the world def toRoom(server, player, command): ''' moves player from their currentRoom to newRoom ''' newRoom = None #print "cmd:" + str(command) #print "cmd0:" + str(command[0]) #print str(player.currentRoom.orderedExits) # args = <some int> if int(command[0]) <= len(player.cu...
def to_room(server, player, command): """ moves player from their currentRoom to newRoom """ new_room = None if int(command[0]) <= len(player.currentRoom.orderedExits): target_room = player.currentRoom.orderedExits[int(command[0]) - 1][0] for room in server.structureManager.masterRooms: ...
#!/usr/bin/env python3 # Testing apostraphes' in single quotes # if I were to: print('he's done') # error: compiler thinks the statement # is ended at the apostraphe after 'he'. # In order to print apostraphes and other # characters like it, escape them: print('he\'s done')
print("he's done")
# Given: A protein string P of length at most 1000 aa. # # Return: The total weight of P. Consult the monoisotopic mass table. table = {} tableFile = open("mass table.txt","r") for line in tableFile: table[line[0]]=float(line[4::].strip()) aaFile = open("input.txt","r") total = float(0) for aa in aaFile.read().re...
table = {} table_file = open('mass table.txt', 'r') for line in tableFile: table[line[0]] = float(line[4:].strip()) aa_file = open('input.txt', 'r') total = float(0) for aa in aaFile.read().replace('\n', ''): total += table[aa] print('%.3f' % total)
__author__ = "xTrinch" __email__ = "mojca.rojko@gmail.com" __version__ = "0.2.21" class NotificationError(Exception): pass default_app_config = 'fcm_django.apps.FcmDjangoConfig'
__author__ = 'xTrinch' __email__ = 'mojca.rojko@gmail.com' __version__ = '0.2.21' class Notificationerror(Exception): pass default_app_config = 'fcm_django.apps.FcmDjangoConfig'
''' Intuition Imagine you are writing a small compiler for your college project and one of the tasks (or say sub-tasks) for the compiler would be to detect if the parenthesis are in place or not. The algorithm we will look at in this article can be then used to process all the parenthesis in the program your compiler...
""" Intuition Imagine you are writing a small compiler for your college project and one of the tasks (or say sub-tasks) for the compiler would be to detect if the parenthesis are in place or not. The algorithm we will look at in this article can be then used to process all the parenthesis in the program your compiler...
kDragAttributeFromAE = [] kIncompatibleAttribute = [] kInvalidAttribute = [] kLayer = []
k_drag_attribute_from_ae = [] k_incompatible_attribute = [] k_invalid_attribute = [] k_layer = []
DOTNETIMPL = { "mono": None, "core": None, "net": None, } DOTNETOS = { "darwin": "@bazel_tools//platforms:osx", "linux": "@bazel_tools//platforms:linux", "windows": "@bazel_tools//platforms:windows", } DOTNETARCH = { "amd64": "@bazel_tools//platforms:x86_64", } DOTNETIMPL_OS_ARCH = ( ...
dotnetimpl = {'mono': None, 'core': None, 'net': None} dotnetos = {'darwin': '@bazel_tools//platforms:osx', 'linux': '@bazel_tools//platforms:linux', 'windows': '@bazel_tools//platforms:windows'} dotnetarch = {'amd64': '@bazel_tools//platforms:x86_64'} dotnetimpl_os_arch = (('mono', 'darwin', 'amd64'), ('mono', 'linux'...
def cheese_and_crackers(cheese_count, boxes_of_crackers): print("You have ", cheese_count, "cheese!") print("you have ", boxes_of_crackers," boxes of crackers!") print("Man that's enough for a party!") print("Get a blamnket.\n") print("We can just give the function numbers directly:") cheese_and_cracke...
def cheese_and_crackers(cheese_count, boxes_of_crackers): print('You have ', cheese_count, 'cheese!') print('you have ', boxes_of_crackers, ' boxes of crackers!') print("Man that's enough for a party!") print('Get a blamnket.\n') print('We can just give the function numbers directly:') cheese_and_cracke...
x=100 text="python tutorial" print(x) print(text) # Assign values to multiple variables x,y,z=10,20,30 print(x) print(y) print(z)
x = 100 text = 'python tutorial' print(x) print(text) (x, y, z) = (10, 20, 30) print(x) print(y) print(z)
p = [0, 4, 8, 6, 2, 10, 100000000] s=[] d = {} rem=10 for i in p: if i in d: d[i] += 1 else: d[i] = 1 for i in range(0,rem/2+1): if i in d: pair = [i, rem-i] if pair[0]==pair[1] and d[i]>=2: s.append(pair) elif pair[1] in d: s.append(pair) p...
p = [0, 4, 8, 6, 2, 10, 100000000] s = [] d = {} rem = 10 for i in p: if i in d: d[i] += 1 else: d[i] = 1 for i in range(0, rem / 2 + 1): if i in d: pair = [i, rem - i] if pair[0] == pair[1] and d[i] >= 2: s.append(pair) elif pair[1] in d: s.ap...
class Solution(object): def wordPattern(self, pattern, str): dic = {} dic2 = {} words = str.split(" ") if len(pattern) != len(words): return False i = 0 for cha in pattern: if cha in dic.keys(): if dic[cha] != words[i]: ...
class Solution(object): def word_pattern(self, pattern, str): dic = {} dic2 = {} words = str.split(' ') if len(pattern) != len(words): return False i = 0 for cha in pattern: if cha in dic.keys(): if dic[cha] != words[i]: ...
class Solution: def lastStoneWeight(self, stones: List[int]) -> int: while len(stones) > 1: stones.sort() a = stones.pop() b = stones.pop() last = a - b if last: stones.append(last) return stones[0] if stones else 0
class Solution: def last_stone_weight(self, stones: List[int]) -> int: while len(stones) > 1: stones.sort() a = stones.pop() b = stones.pop() last = a - b if last: stones.append(last) return stones[0] if stones else 0
class MyHashSet: def __init__(self): self.buckets = [] def hash(self, key: int) -> str: return chr(key) def add(self, key: int) -> None: val = self.hash(key) if val not in self.buckets: self.buckets.append(val) def remove(self, key: int) -> None: ...
class Myhashset: def __init__(self): self.buckets = [] def hash(self, key: int) -> str: return chr(key) def add(self, key: int) -> None: val = self.hash(key) if val not in self.buckets: self.buckets.append(val) def remove(self, key: int) -> None: v...
def min_number(num_list): min_num = None for num in num_list: if min_num is None or min_num > num: min_num = num return min_num
def min_number(num_list): min_num = None for num in num_list: if min_num is None or min_num > num: min_num = num return min_num
def pytest_addoption(parser): group = parser.getgroup("pypyjit options") group.addoption("--pypy", action="store", default=None, dest="pypy_c", help="the location of the JIT enabled pypy-c")
def pytest_addoption(parser): group = parser.getgroup('pypyjit options') group.addoption('--pypy', action='store', default=None, dest='pypy_c', help='the location of the JIT enabled pypy-c')
# @Time : 2019/6/1 23:01 # @Author : shakespere # @FileName: Sort Colors.py ''' 75. Sort Colors Medium 1623 156 Favorite Share Given an array with n objects colored red, white or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red, white and bl...
""" 75. Sort Colors Medium 1623 156 Favorite Share Given an array with n objects colored red, white or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red, white and blue. Here, we will use the integers 0, 1, and 2 to represent the color red, white, and blue re...
expected_output = { "interfaces": { "Port-channel20": { "description": "distacc Te1/1/1, Te2/1/1", "switchport_trunk_vlans": "9,51", "switchport_mode": "trunk", "ip_arp_inspection_trust": True, "ip_dhcp_snooping_trust": True, }, "Gi...
expected_output = {'interfaces': {'Port-channel20': {'description': 'distacc Te1/1/1, Te2/1/1', 'switchport_trunk_vlans': '9,51', 'switchport_mode': 'trunk', 'ip_arp_inspection_trust': True, 'ip_dhcp_snooping_trust': True}, 'GigabitEthernet0/0': {'vrf': 'Mgmt-vrf', 'shutdown': True, 'negotiation_auto': True}, 'GigabitE...
# -*- coding: utf-8 -*- """ Solve a given equation and return the value of x in the form of string "x=#value". The equation contains only '+', '-' operation, the variable x and its coefficient. If there is no solution for the equation, return "No solution". If there are infinite solutions for the equation, return "I...
""" Solve a given equation and return the value of x in the form of string "x=#value". The equation contains only '+', '-' operation, the variable x and its coefficient. If there is no solution for the equation, return "No solution". If there are infinite solutions for the equation, return "Infinite solutions". If ...
#SKill : array iteration #A UTF-8 character encoding is a variable width character encoding # that can vary from 1 to 4 bytes depending on the character. The structure of the encoding is as follows: #1 byte: 0xxxxxxx #2 bytes: 110xxxxx 10xxxxxx #3 bytes: 1110xxxx 10xxxxxx 10xxxxxx #4 bytes: 11110xxx 10xxxxxx 10xxxxxx ...
byte_masks = [None, 128, 224, 240, 248] byte_equal = [None, 0, 192, 224, 240] def utf8_validator(bytes): num_of_bytes = 4 cnt = 0 while cnt < len(bytes): while numOfBytes > 0: value = bytes[cnt] & BYTE_MASKS[numOfBytes] if value == BYTE_EQUAL[numOfBytes]: bre...
ES_HOST = 'localhost' ES_PORT = 9200 BULK_MAX_OPS_CNT = 1000 INDEX_NAME = 'cosc488' INDEX_SETTINGS_FP = 'properties/index_settings.json' DATA_DIR = 'data/docs' QUERIES_FP = 'data/queryfile.txt' QRELS_FP = 'data/qrel.txt' TRECEVAL_FP = 'bin/trec_eval'
es_host = 'localhost' es_port = 9200 bulk_max_ops_cnt = 1000 index_name = 'cosc488' index_settings_fp = 'properties/index_settings.json' data_dir = 'data/docs' queries_fp = 'data/queryfile.txt' qrels_fp = 'data/qrel.txt' treceval_fp = 'bin/trec_eval'
prev = None def check_bst(root): if not root: return True ans = check_bst(root.left) if ans == False: return False if prev and root.value < prev: return False global prev prev = root return check_bst(root.right)
prev = None def check_bst(root): if not root: return True ans = check_bst(root.left) if ans == False: return False if prev and root.value < prev: return False global prev prev = root return check_bst(root.right)
#!/usr/bin/python3.5 class MyClass: "This is a class" a = 10; def func(self): print('Hello World'); return 3; def my_function(a: MyClass): return a.func(); def other_function(b: my_function): a = MyClass(); return my_function(a); def object_function(obj: object): return 3;
class Myclass: """This is a class""" a = 10 def func(self): print('Hello World') return 3 def my_function(a: MyClass): return a.func() def other_function(b: my_function): a = my_class() return my_function(a) def object_function(obj: object): return 3
### PROBLEM 1 def main(): print("Name: Shaymae Senhaji") print("Favorite Food: Brie Cheese") print("Favorite Color: Red") print("Favorite Hobby: Traveling") if __name__ == "__main__": main() #Name: Shaymae Senhaji #Favorite Food: Brie Cheese #Favorite Color: Red #Favorite Hobby: Traveling
def main(): print('Name: Shaymae Senhaji') print('Favorite Food: Brie Cheese') print('Favorite Color: Red') print('Favorite Hobby: Traveling') if __name__ == '__main__': main()
def getProgress(current, length): """This function formats a progress bar string for print out during a for loop execution. Currently, this uses 2% increments. Adjusting the inc variable to N will change increments to 1/N.""" inc = 50 n_bars = int(round(current*inc/length,1)) rem = ...
def get_progress(current, length): """This function formats a progress bar string for print out during a for loop execution. Currently, this uses 2% increments. Adjusting the inc variable to N will change increments to 1/N.""" inc = 50 n_bars = int(round(current * inc / length, 1)) rem = inc - n_bar...
## Does my number look big in this? ## 6 kyu ## https://www.codewars.com/kata/5287e858c6b5a9678200083c def narcissistic(value): total = 0 for digit in str(value): total += int(digit) ** len(str(value)) return value == total
def narcissistic(value): total = 0 for digit in str(value): total += int(digit) ** len(str(value)) return value == total
# This is the ball class that handles everything related to Balls class Ball: # The __init__ method is used to initialize class variables def __init__(self, position, velocity, acceleration): # Each ball has a position, velocity and acceleration self.position = position self.velocity = v...
class Ball: def __init__(self, position, velocity, acceleration): self.position = position self.velocity = velocity self.acceleration = acceleration def display(self): no_stroke() fill(255, 0, 0) ellipse(self.position.x, self.position.y, 50, 50) def move(se...
# # @lc app=leetcode id=75 lang=python3 # # [75] Sort Colors # class Solution: def sortColors(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ a, i, b = 0, 0, len(nums) - 1 while i <= b: n_i = nums[i] if n_i...
class Solution: def sort_colors(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ (a, i, b) = (0, 0, len(nums) - 1) while i <= b: n_i = nums[i] if n_i == 1: i += 1 elif n_i == 0: ...
"""All files in this module are automatically generated by hassfest. To update, run python3 -m script.hassfest """
"""All files in this module are automatically generated by hassfest. To update, run python3 -m script.hassfest """
def hashfunction(key): sum=0 for i in key: sum+=ord(i) return sum%100 hashtable=[] def insertkey(key,value): hashkey=hashfunction(key) return hashtable[hashkey].append(value)
def hashfunction(key): sum = 0 for i in key: sum += ord(i) return sum % 100 hashtable = [] def insertkey(key, value): hashkey = hashfunction(key) return hashtable[hashkey].append(value)
t = int(input()) while(t!=0): count=0 n=int(input()) if n==1: print('no') else: for i in range(2,n//2): if(n%i == 0): count+=1 if(count>=1): print('no') else: print('yes') t-=1
t = int(input()) while t != 0: count = 0 n = int(input()) if n == 1: print('no') else: for i in range(2, n // 2): if n % i == 0: count += 1 if count >= 1: print('no') else: print('yes') t -= 1
class Solution: def romanToInt(self, s): """ :type s: str :rtype: int """ roman_int = {'I':1, 'V':5, 'X':10, 'L':50, 'C':100, 'D':500, 'M':1000} s = [roman_int[x] for x in s] ans = 0 for n in range(len(s)-1): if s[n] >= s[n+1]: ...
class Solution: def roman_to_int(self, s): """ :type s: str :rtype: int """ roman_int = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000} s = [roman_int[x] for x in s] ans = 0 for n in range(len(s) - 1): if s[n] >= s[n + 1]...
class OrderDamageConfirmation: def __init__(self, content): self.system_seat_ids = content['systemSeatIds'] self.msg_id = content['msgId'] self.game_state_id = content['gameStateId'] self.result = content['orderDamageConfirmation']['result'] self.order_damage_type = content['...
class Orderdamageconfirmation: def __init__(self, content): self.system_seat_ids = content['systemSeatIds'] self.msg_id = content['msgId'] self.game_state_id = content['gameStateId'] self.result = content['orderDamageConfirmation']['result'] self.order_damage_type = content[...
"""Python implementation of a Graph Data structure.""" class Graph(object): """ Graph implementation. Graph data structure supports following methods: nodes(): return a list of all nodes in the graph. edges(): return a list of all edges in the graph. add_node(n): adds a new node 'n' to the g...
"""Python implementation of a Graph Data structure.""" class Graph(object): """ Graph implementation. Graph data structure supports following methods: nodes(): return a list of all nodes in the graph. edges(): return a list of all edges in the graph. add_node(n): adds a new node 'n' to the gr...
def test(): # if an assertion fails, the message will be displayed # --> must have the output in a comment assert "Mean: 5.0" in __solution__, "Did you record the correct program output as a comment?" # --> must have the correct arithmetic mean assert mean == 5.0, "Are you calculating the arithmetic...
def test(): assert 'Mean: 5.0' in __solution__, 'Did you record the correct program output as a comment?' assert mean == 5.0, 'Are you calculating the arithmetic mean?' assert 'TODO' not in __solution__, 'Did you remove the TODO marker when finished?' __msg__.good('Well done!')
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def buildTree(self, inorder, postorder): """ :type inorder: List[int] :type postorder: List[int] :rtype: ...
class Solution: def build_tree(self, inorder, postorder): """ :type inorder: List[int] :type postorder: List[int] :rtype: TreeNode """ assert len(inorder) == len(postorder) in_indices = {val: index for (index, val) in enumerate(inorder)} def dfs(in_s...
MASTER_NAME = 'localhost:9090' MASTER_AUTH = ('admin', 'password') TEST_MONITOR_SVC_URLS = dict( base='http://{0}/nitestmonitor', base_sans_protocol='{0}://{1}/nitestmonitor', can_write='/v2/can-write', query_results='/v1/query-results', query_results_skip_take='/v1/query-results?skip={0}...
master_name = 'localhost:9090' master_auth = ('admin', 'password') test_monitor_svc_urls = dict(base='http://{0}/nitestmonitor', base_sans_protocol='{0}://{1}/nitestmonitor', can_write='/v2/can-write', query_results='/v1/query-results', query_results_skip_take='/v1/query-results?skip={0}&take={1}', create_results='/v2/...
requested_toppings = ['mushrooms', 'extra cheese'] if 'mushrooms' in requested_toppings: print("Adding mushrooms") if 'pepperoni' in requested_toppings: print("Adding pepperoni.") if 'extra cheese' in requested_toppings: print("Adding extra cheese.") print("\nFinished making your pizza!") """TRY IT YOURS...
requested_toppings = ['mushrooms', 'extra cheese'] if 'mushrooms' in requested_toppings: print('Adding mushrooms') if 'pepperoni' in requested_toppings: print('Adding pepperoni.') if 'extra cheese' in requested_toppings: print('Adding extra cheese.') print('\nFinished making your pizza!') 'TRY IT YOURSELFS'...
extensions = ["sphinx-favicon"] master_doc = "index" exclude_patterns = ["_build"] html_theme = "basic" html_static_path = ["gfx"] favicons = [ { "sizes": "32x32", "static-file": "square.svg", }, { "sizes": "128x128", "static-file": "nested/triangle.svg", }, ]
extensions = ['sphinx-favicon'] master_doc = 'index' exclude_patterns = ['_build'] html_theme = 'basic' html_static_path = ['gfx'] favicons = [{'sizes': '32x32', 'static-file': 'square.svg'}, {'sizes': '128x128', 'static-file': 'nested/triangle.svg'}]
acceptall = [ "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-US,en;q=0.5\r\nAccept-Encoding: gzip, deflate\r\n", "Accept-Encoding: gzip, deflate\r\n", "Accept-Language: en-US,en;q=0.5\r\nAccept-Encoding: gzip, deflate\r\n", "Accept: text/html, application...
acceptall = ['Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-US,en;q=0.5\r\nAccept-Encoding: gzip, deflate\r\n', 'Accept-Encoding: gzip, deflate\r\n', 'Accept-Language: en-US,en;q=0.5\r\nAccept-Encoding: gzip, deflate\r\n', 'Accept: text/html, application/xhtml+xml, appli...
# -*- coding: utf-8 -*- """Top-level package for Make Notebooks.""" __author__ = """Martin Skarzynski""" __version__ = '0.0.1'
"""Top-level package for Make Notebooks.""" __author__ = 'Martin Skarzynski' __version__ = '0.0.1'
# region headers # escript-template v20190605 / stephane.bourdeaud@nutanix.com # * author: Geluykens, Andy <Andy.Geluykens@pfizer.com> # * version: 2019/06/05 # task_name: RubrikGetSlaDomainId # description: This script gets the id of the specified Rubrik SLA domain. # endregion # region capture Cal...
username = '@@{rubrik.username}@@' username_secret = '@@{rubrik.secret}@@' api_server = '@@{rubrik_ip}@@' sla_domain = '@@{sla_domain}@@' api_server_port = '443' api_server_endpoint = '/api/v1/sla_domain?name={}'.format(sla_domain) url = 'https://{}:{}{}'.format(api_server, api_server_port, api_server_endpoint) method ...
class Animal: def __init__(self, name): # Constructor of the class self.name = name def speak(self): # Abstract method, defined by convention only raise NotImplementedError("Subclass must implement abstract method") class Dog(Animal): def speak(self): return self.n...
class Animal: def __init__(self, name): self.name = name def speak(self): raise not_implemented_error('Subclass must implement abstract method') class Dog(Animal): def speak(self): return self.name + ' says Woof!' class Cat(Animal): def speak(self): return self.name...
''' You are given a spreadsheet that contains a list of N athletes and their details (such as age, height, weight and so on). You are required to sort the data based on the Kth attribute and print the final resulting table. Follow the example given below for better understanding. image Note that K is indexed fro...
""" You are given a spreadsheet that contains a list of N athletes and their details (such as age, height, weight and so on). You are required to sort the data based on the Kth attribute and print the final resulting table. Follow the example given below for better understanding. image Note that K is indexed from 0 t...
# Copyright 2019 BlueCat Networks. All rights reserved. # -*- coding: utf-8 -*- type = 'ui' sub_pages = [ { 'name' : 'cmdb_routers_page', 'title' : u'CMDB Routers', 'endpoint' : 'cmdb_routers/cmdb_routers_endpoint', 'description' : u'cmdb_routers' }, ]
type = 'ui' sub_pages = [{'name': 'cmdb_routers_page', 'title': u'CMDB Routers', 'endpoint': 'cmdb_routers/cmdb_routers_endpoint', 'description': u'cmdb_routers'}]
input = """ #maxint=100. g(1,X):- #int(X). s(1). f(X) :- s(Y), g(Y,X), T=1+2. """ output = """ {f(0), f(1), f(10), f(100), f(11), f(12), f(13), f(14), f(15), f(16), f(17), f(18), f(19), f(2), f(20), f(21), f(22), f(23), f(24), f(25), f(26), f(27), f(28), f(29), f(3), f(30), f(31), f(32), f(33), f(34), f(35), f(36), f...
input = '\n#maxint=100.\ng(1,X):- #int(X).\ns(1).\nf(X) :- s(Y), g(Y,X), T=1+2. \n' output = '\n{f(0), f(1), f(10), f(100), f(11), f(12), f(13), f(14), f(15), f(16), f(17), f(18), f(19), f(2), f(20), f(21), f(22), f(23), f(24), f(25), f(26), f(27), f(28), f(29), f(3), f(30), f(31), f(32), f(33), f(34), f(35), f(36), f(...
# coding=utf-8 # Copyright 2021 The Google Research Authors. # # 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 applicab...
"""MNIST Constants. These constants, specific to the MNIST dataset, are used across multiple places in this project. """ num_outputs = 10 train_data_percent = 80 train_val_split = (4, 1) num_train_examples = 48000 image_edge_length = 28 num_flatten_features = IMAGE_EDGE_LENGTH * IMAGE_EDGE_LENGTH
__title__ = "mathy_core" __version__ = "0.8.4" __summary__ = "Computer Algebra System for working with math expressions" __uri__ = "https://mathy.ai" __author__ = "Justin DuJardin" __email__ = "justin@dujardinconsulting.com" __license__ = "All rights reserved"
__title__ = 'mathy_core' __version__ = '0.8.4' __summary__ = 'Computer Algebra System for working with math expressions' __uri__ = 'https://mathy.ai' __author__ = 'Justin DuJardin' __email__ = 'justin@dujardinconsulting.com' __license__ = 'All rights reserved'
#!/usr/bin/env python3 theInput = """785 516 744 272 511 358 801 791 693 572 150 74 644 534 138 191 396 196 860 92 399 233 321 823 720 333 570 308 427 572 246 206 66 156 261 595 336 810 505 810 210 938 615 987 820 117 22 519 412 990 256 405 996 423 55 366 418 290 402 810 31...
the_input = '785 516 744\n272 511 358\n801 791 693\n572 150 74\n644 534 138\n191 396 196\n860 92 399\n233 321 823\n720 333 570\n308 427 572\n246 206 66\n156 261 595\n336 810 505\n810 210 938\n615 987 820\n117 22 519\n412 990 256\n405 996 423\n 55 366 418\n290 402 810\n313 60...
# -*- coding: utf-8 -*- """Holder for shared Configuration""" def init(): """Holder for shared Configuration""" global config try: config except NameError: config = {}
"""Holder for shared Configuration""" def init(): """Holder for shared Configuration""" global config try: config except NameError: config = {}
#!/usr/bin/env python3 def validate_script(script): """ Validate compiled script """ assert type(script) == bytes # TODO - more validation
def validate_script(script): """ Validate compiled script """ assert type(script) == bytes
class ContactHelper: def __init__(self, app): self.app = app def open_contacts_page(self): wd = self.app.wd if not (wd.current_url.endswith("/group.php") and len (wd.find_elements_by_name("new"))) > 0: wd.find_element_by_link_text("home").click() def create(self, conta...
class Contacthelper: def __init__(self, app): self.app = app def open_contacts_page(self): wd = self.app.wd if not (wd.current_url.endswith('/group.php') and len(wd.find_elements_by_name('new'))) > 0: wd.find_element_by_link_text('home').click() def create(self, contac...
# some sample PROJECT_NAME = "My Application" APPLICATION_SENTENCE = "Hello Django" # add apps into project read after settings.py # append application into lists # INSTALLED_APPS.append('my_application') # MIDDLEWARE.append('my_application.middleware.MyApplicationMiddleware') # add an application INSTALLED_APPS.appe...
project_name = 'My Application' application_sentence = 'Hello Django' INSTALLED_APPS.append('myapplication.apps.MyapplicationConfig')
""" AAn isogram is a word that has no repeating letters, consecutive or non-consecutive. For example "something" and "brother" are isograms, where as "nothing" and "sister" are not. Below method compares the length of the string with the length (or size) of the set of the same string. The set of the string removes...
""" AAn isogram is a word that has no repeating letters, consecutive or non-consecutive. For example "something" and "brother" are isograms, where as "nothing" and "sister" are not. Below method compares the length of the string with the length (or size) of the set of the same string. The set of the string removes...
__source__ = 'https://leetcode.com/problems/next-greater-element-i/' # Time: O(m + n) # Space: O(m + n) # # Description: 496. Next Greater Element I # # You are given two arrays (without duplicates) nums1 and nums2 where nums1's elements are subset of nums2. # Find all the next greater numbers for nums1's elements in ...
__source__ = 'https://leetcode.com/problems/next-greater-element-i/' class Solution(object): def next_greater_element(self, findNums, nums): """ :type findNums: List[int] :type nums: List[int] :rtype: List[int] """ dict = {} st = [] res = [] ...
__all__=["declare_reproducible"] def declare_reproducible(SEED = 123): ''' https://github.com/NVIDIA/framework-determinism/blob/master/pytorch.md ''' # or whatever you choose try : random.seed(SEED) # if you're using random except : pass try : np.random.seed(SEED)...
__all__ = ['declare_reproducible'] def declare_reproducible(SEED=123): """ https://github.com/NVIDIA/framework-determinism/blob/master/pytorch.md """ try: random.seed(SEED) except: pass try: np.random.seed(SEED) except: pass try: torch.manual_seed...
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:' } } SECRET_KEY = 'supersecret' INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'nonr...
databases = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:'}} secret_key = 'supersecret' installed_apps = ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'nonrelated_inlines.tests.testapp'] root_urlconf = 'nonrelat...
class Solution: def buildTree(self, preorder, inorder): if not inorder: return None root_val = preorder[0] index = inorder.index(root_val) left_tree = self.buildTree(preorder[1:index + 1], inorder[:index]) right_tree = self.buildTree(preorder[index + 1:...
class Solution: def build_tree(self, preorder, inorder): if not inorder: return None root_val = preorder[0] index = inorder.index(root_val) left_tree = self.buildTree(preorder[1:index + 1], inorder[:index]) right_tree = self.buildTree(preorder[index + 1:], inorde...
num1 = int(input()) num2 = int(input()) print(f'X = {num1 + num2}')
num1 = int(input()) num2 = int(input()) print(f'X = {num1 + num2}')
def PeptideMasses(PeptideMassesSummaryFileName, PeptidesListFileLocation): # 'amino acid', monoisotopic residue mass, average residue mass AAResidueMassData = {'A':('Ala', 71.037114, 71.0779), 'C':('Cys', 103.009185, 103.1429), 'D':('Asp', 115.026943, 115.0874), '...
def peptide_masses(PeptideMassesSummaryFileName, PeptidesListFileLocation): aa_residue_mass_data = {'A': ('Ala', 71.037114, 71.0779), 'C': ('Cys', 103.009185, 103.1429), 'D': ('Asp', 115.026943, 115.0874), 'E': ('Glu', 129.042593, 129.114), 'F': ('Phe', 147.068414, 147.1739), 'G': ('Gly', 57.021464, 57.0513), 'H': ...
# Multiplying strings and accessing characters within them # You can print a string multiple times by... multiplying it! print("-" * 10) # Since strings are basically a list, you can also access characters # or ranges of characters by indexing into them name = "Phil Hinton" print(f"Name: {name}") # First characte...
print('-' * 10) name = 'Phil Hinton' print(f'Name: {name}') print(name[0])
# TWITTER ACCESS_KEY = (" ") ACCESS_SECRET = (" ") CONSUMER_KEY = (" ") CONSUMER_SECRET = (" ") BEARER_TOKEN = (" ") # TELEGRAM API_KEY = (" ") BOT_CHAT_ID = (" ") # DISCORD APPLICATION_ID = (" ") PUBLIC_KEY = (" ") CLIENT_ID = (" ") CLIENT_SECRET = (" ") TOKEN = (" ") invite_url = (" ") # tweets baixados tweets = [...
access_key = ' ' access_secret = ' ' consumer_key = ' ' consumer_secret = ' ' bearer_token = ' ' api_key = ' ' bot_chat_id = ' ' application_id = ' ' public_key = ' ' client_id = ' ' client_secret = ' ' token = ' ' invite_url = ' ' tweets = [] number = 0
SESSION_EXPIRED = "Session expired. Please log in again." NETWORK_ERROR_MESSAGE = ( "Network error. Please check your connection and try again." ) AUTH_SERVER_ERROR = ( "A problem occured while trying to authenticate with divio.com. " "Please try again later" ) SERVER_ERROR = ( "A problem occured while ...
session_expired = 'Session expired. Please log in again.' network_error_message = 'Network error. Please check your connection and try again.' auth_server_error = 'A problem occured while trying to authenticate with divio.com. Please try again later' server_error = 'A problem occured while trying to communicate with di...
class FileType: CSV = 'csv' XLSX = 'xlsx' JSON = 'json' XML = 'xml'
class Filetype: csv = 'csv' xlsx = 'xlsx' json = 'json' xml = 'xml'
def test_eval_mode(wdriver): assert wdriver.execute_script("return window.rp.pyEval('1+1')") == 2 def test_exec_mode(wdriver): assert wdriver.execute_script("return window.rp.pyExec('1+1')") is None def test_exec_single_mode(wdriver): assert wdriver.execute_script("return window.rp.pyExecSingle('1+1')")...
def test_eval_mode(wdriver): assert wdriver.execute_script("return window.rp.pyEval('1+1')") == 2 def test_exec_mode(wdriver): assert wdriver.execute_script("return window.rp.pyExec('1+1')") is None def test_exec_single_mode(wdriver): assert wdriver.execute_script("return window.rp.pyExecSingle('1+1')") =...
# encoding: UTF-8 def remove_chinese(str): s = "" for w in str: if w >= u'\u4e00' and w <= u'\u9fa5': continue s += w return s def remove_non_numerical(s): f = '' for i in range(len(s)): try: f = float(s[:i+1]) except: return f ...
def remove_chinese(str): s = '' for w in str: if w >= u'一' and w <= u'龥': continue s += w return s def remove_non_numerical(s): f = '' for i in range(len(s)): try: f = float(s[:i + 1]) except: return f return str(f)
# Link: https://leetcode.com/problems/search-in-rotated-sorted-array/ # Time: O(LogN) # Space: O(1) # As the given array is rotated sorted, binary search cannot be applied directly. def search(nums, target): start, end = 0, len(nums) - 1 while start <= end: mid = (start + end) // 2 if targ...
def search(nums, target): (start, end) = (0, len(nums) - 1) while start <= end: mid = (start + end) // 2 if target == nums[mid]: return mid if nums[start] <= nums[mid]: if nums[start] <= target < nums[mid]: end = mid - 1 else: ...
class Sequence: transcription_table = {'A':'U', 'T':'A', 'C':'G' , 'G':'C'} enz_dict = {'EcoRI':'GAATTC', 'EcoRV':'GATATC'} def __init__(self, seqstring): self.seqstring = seqstring.upper() def restriction(self, enz): try: enz_target = Sequence.enz_dict[enz] retur...
class Sequence: transcription_table = {'A': 'U', 'T': 'A', 'C': 'G', 'G': 'C'} enz_dict = {'EcoRI': 'GAATTC', 'EcoRV': 'GATATC'} def __init__(self, seqstring): self.seqstring = seqstring.upper() def restriction(self, enz): try: enz_target = Sequence.enz_dict[enz] ...
''' URL: https://leetcode.com/problems/delete-node-in-a-linked-list/ Difficulty: Easy Description: Delete Node in a Linked List Write a function to delete a node in a singly-linked list. You will not be given access to the head of the list, instead you will be given access to the node to be deleted directly. It is ...
""" URL: https://leetcode.com/problems/delete-node-in-a-linked-list/ Difficulty: Easy Description: Delete Node in a Linked List Write a function to delete a node in a singly-linked list. You will not be given access to the head of the list, instead you will be given access to the node to be deleted directly. It is ...
class Messages: USERS_1 = 'Username already exists.' USERS_2 = 'Email already exists.' USERS_3 = 'Password and Confirm Password must be same.' USERS_4 = 'Username or Password is incorrect.' USERS_5 = 'Your email address is not verified.' TOKENS_1 = 'Token does not exist.' TOKENS_2 = 'User d...
class Messages: users_1 = 'Username already exists.' users_2 = 'Email already exists.' users_3 = 'Password and Confirm Password must be same.' users_4 = 'Username or Password is incorrect.' users_5 = 'Your email address is not verified.' tokens_1 = 'Token does not exist.' tokens_2 = 'User do...
class PageEffectiveImageMixin(object): def get_effective_image(self): if self.image: return self.image page = self.get_main_language_page() if page.specific.image: return page.specific.get_effective_image() return ''
class Pageeffectiveimagemixin(object): def get_effective_image(self): if self.image: return self.image page = self.get_main_language_page() if page.specific.image: return page.specific.get_effective_image() return ''
# /home/bruce/python/workareas/pyke-hg/r1_working/pyke/krb_compiler/krbparser_tables.py # This file is automatically generated. Do not edit. _tabversion = '3.2' _lr_method = 'LALR' _lr_signature = '`\xa3O\x17\xd6C\xd4E2\xb5\xf60wIM\xd9' _lr_action_items = {'TAKING_TOK':([142,161,187,216,],[-66,188,-66,240,]),'L...
_tabversion = '3.2' _lr_method = 'LALR' _lr_signature = '`£O\x17ÖCÔE2µö0wIMÙ' _lr_action_items = {'TAKING_TOK': ([142, 161, 187, 216], [-66, 188, -66, 240]), 'LP_TOK': ([18, 32, 43, 65, 73, 85, 88, 95, 111, 112, 124, 125, 128, 132, 144, 150, 158, 162, 165, 170, 171, 179, 180, 181, 182, 183, 184, 185, 189, 192, 193, 196...
def code_function(): #function begin############################################ global code code=""" `include "{0}_env.sv" class {0}_model_base_test extends uvm_test; `uvm_component_utils({0}_model_base_test) //--------------------------------------- // env instance //------------...
def code_function(): global code code = '\n\n`include "{0}_env.sv"\nclass {0}_model_base_test extends uvm_test;\n\n `uvm_component_utils({0}_model_base_test)\n \n //---------------------------------------\n // env instance \n //--------------------------------------- \n {0}_model_env env;\n\n //---------...
# The next lines will make the Pixel Turtle and its heading invisible # and will clear the screen for light show hidePixel() hideHeading() clear() # Those are the colors for the light show colors = [white, red, yellow, green, cyan, blue, purple, white] # First we move to the top left corner moveTo(0, 0) # For each c...
hide_pixel() hide_heading() clear() colors = [white, red, yellow, green, cyan, blue, purple, white] move_to(0, 0) for color in colors: set_color(color) backward(7) move(1, 0) forward(7) move(1, 0) move_to(8, 4) set_color(green) show_pixel() show_heading()
# Write a Python program to multiply two numbers entered by the user and display their product # for more info on this quiz, go to this url: http://www.programmr.com/multiply-two-numbers-1 def multiply_number(): print("Please enter two numbers") user_inputs = [] result = 1 for i in range(2): ...
def multiply_number(): print('Please enter two numbers') user_inputs = [] result = 1 for i in range(2): user_input = int(input('Enter a number: ')) user_inputs.append(user_input) for i in user_inputs: result = i * result return result print(multiply_number())
personal_details = ('Sanjar', 22, 'India') print(personal_details) name, _, country = personal_details print(name, country)
personal_details = ('Sanjar', 22, 'India') print(personal_details) (name, _, country) = personal_details print(name, country)
print ("how old are you?.",) age=raw_input() print("How tall are you?.",) height=raw_input() print("How much do you weight?.",) weight=raw_input() print("So you're %r old,%r tall and %r heavy."%(age,height,weight))
print('how old are you?.') age = raw_input() print('How tall are you?.') height = raw_input() print('How much do you weight?.') weight = raw_input() print("So you're %r old,%r tall and %r heavy." % (age, height, weight))
""" Define directories and options, here as an example for modeling crime offences. Input file requirements: Input csv file must include one column labeled "region_id" which holds the ID number for each location and two columns "centroid_x" and "centroid_y" which hold the x and y coordinate for each location, respectiv...
""" Define directories and options, here as an example for modeling crime offences. Input file requirements: Input csv file must include one column labeled "region_id" which holds the ID number for each location and two columns "centroid_x" and "centroid_y" which hold the x and y coordinate for each location, respectiv...
x = list(input().lower()) y = list(input().lower()) for i,j in zip(x,y): if i>j: print("1") break elif i<j: print("-1") break else: print("0")
x = list(input().lower()) y = list(input().lower()) for (i, j) in zip(x, y): if i > j: print('1') break elif i < j: print('-1') break else: print('0')
fashion_mnist = tf.keras.datasets.fashion_mnist (train_images, train_labels), (test_images, test_labels) = fashion_mnist.load_data() class_names = ['T-shirt/top', 'Trouser', 'Pullover', 'Dress', 'Coat', 'Sandal', 'Shirt', 'Sneaker', 'Bag', 'Ankle boot'] (train_images, train_labels), (test_images, test_la...
fashion_mnist = tf.keras.datasets.fashion_mnist ((train_images, train_labels), (test_images, test_labels)) = fashion_mnist.load_data() class_names = ['T-shirt/top', 'Trouser', 'Pullover', 'Dress', 'Coat', 'Sandal', 'Shirt', 'Sneaker', 'Bag', 'Ankle boot'] ((train_images, train_labels), (test_images, test_labels)) = fas...
marksheet = [] scores = [] n = int(input()) for i in range(n): name = input() score = float(input()) marksheet += [[name, score]] scores += [score] li = sorted(set(scores))[1] for n, s in marksheet: if s == li: print(n)
marksheet = [] scores = [] n = int(input()) for i in range(n): name = input() score = float(input()) marksheet += [[name, score]] scores += [score] li = sorted(set(scores))[1] for (n, s) in marksheet: if s == li: print(n)
def import_and_create_dictionary(filename): """This function is used to create an expense dictionary from a file Every line in the file should be in the format: key , value the key is a user's name and the value is an expense to update the user's total expense with. the value shld be a number, however...
def import_and_create_dictionary(filename): """This function is used to create an expense dictionary from a file Every line in the file should be in the format: key , value the key is a user's name and the value is an expense to update the user's total expense with. the value shld be a number, however...
# -*- coding: utf-8 -*- def main(): n = int(input()) ans = set() for i in range(n): ai, bi = map(int, input().split()) if ai > bi: ans.add((bi, ai)) else: ans.add((ai, bi)) print(len(ans)) if __name__ == '__main__': main()
def main(): n = int(input()) ans = set() for i in range(n): (ai, bi) = map(int, input().split()) if ai > bi: ans.add((bi, ai)) else: ans.add((ai, bi)) print(len(ans)) if __name__ == '__main__': main()
# vim: set ts=4 sw=4 et fileencoding=utf-8: '''Vim encoding mappings to Sublime Text''' ENCODING_MAP = { 'latin1': 'Western (Windows 1252)', 'koi8-r': 'Cyrillic (KOI8-R)', 'koi8-u': 'Cyrillic (KOI8-U)', 'macroman': 'Western (Mac Roman)', 'iso-8859-1': 'Western (ISO 8859-1)', ...
"""Vim encoding mappings to Sublime Text""" encoding_map = {'latin1': 'Western (Windows 1252)', 'koi8-r': 'Cyrillic (KOI8-R)', 'koi8-u': 'Cyrillic (KOI8-U)', 'macroman': 'Western (Mac Roman)', 'iso-8859-1': 'Western (ISO 8859-1)', 'iso-8859-2': 'Central European (ISO 8859-2)', 'iso-8859-3': 'Western (ISO 8859-3)', 'iso...
""" Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k. Example 1: Input:nums = [1,1,1], k = 2 Output: 2 Solution: 1. Brute Force Enumerate all subarray 2. Accumulative Sum """ # Brute Force # Time: O(n^2) # Space: O(1) class Solution: d...
""" Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k. Example 1: Input:nums = [1,1,1], k = 2 Output: 2 Solution: 1. Brute Force Enumerate all subarray 2. Accumulative Sum """ class Solution: def subarray_sum(self, nums: List[int], k: i...
# # PySNMP MIB module NNCEXTPVC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NNCEXTPVC-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:13:11 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, single_value_constraint, value_range_constraint, constraints_union, value_size_constraint) ...
# The isBadVersion API is already defined for you. # def isBadVersion(version: int) -> int: class Solution: def firstBadVersion(self, n: int) -> int: start, end = 1, n while start < end: mid = start + (end - start) // 2 check = isBadVersion(mid) if check...
class Solution: def first_bad_version(self, n: int) -> int: (start, end) = (1, n) while start < end: mid = start + (end - start) // 2 check = is_bad_version(mid) if check: end = mid else: start = mid + 1 return ...
load("@bazel_skylib//lib:shell.bzl", "shell") _CONTENT_PREFIX = """#!/usr/bin/env bash set -euo pipefail """ def _multirun_impl(ctx): transitive_depsets = [] content = [_CONTENT_PREFIX] for command in ctx.attr.commands: defaultInfo = command[DefaultInfo] if defaultInfo.files_to_run == N...
load('@bazel_skylib//lib:shell.bzl', 'shell') _content_prefix = '#!/usr/bin/env bash\n\nset -euo pipefail\n\n' def _multirun_impl(ctx): transitive_depsets = [] content = [_CONTENT_PREFIX] for command in ctx.attr.commands: default_info = command[DefaultInfo] if defaultInfo.files_to_run == No...
current_petrol = 0 current_position = 0 n = int(input().strip()) for i in range(n): petrol, distance = map(int, input().strip().split(' ')) current_petrol += petrol if (current_petrol > distance): current_petrol -= distance else: current_petrol = 0 current_position = i print(curr...
current_petrol = 0 current_position = 0 n = int(input().strip()) for i in range(n): (petrol, distance) = map(int, input().strip().split(' ')) current_petrol += petrol if current_petrol > distance: current_petrol -= distance else: current_petrol = 0 current_position = i print(curr...
APPNAME = 'assembly' APPAUTHOR = 'kbase' URL = 'http://kbase.us/services/assembly' AUTH_SERVICE = 'KBase' OAUTH_EXP_DAYS = 14 OAUTH_FILENAME = 'globus_oauth.prop'
appname = 'assembly' appauthor = 'kbase' url = 'http://kbase.us/services/assembly' auth_service = 'KBase' oauth_exp_days = 14 oauth_filename = 'globus_oauth.prop'