content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
a = '73167176531330624919225119674426574742355349194934\ 96983520312774506326239578318016984801869478851843\ 85861560789112949495459501737958331952853208805511\ 12540698747158523863050715693290963295227443043557\ 66896648950445244523161731856403098711121722383113\ 62229893423380308135336276614282806444486645238749...
a = '731671765313306249192251196744265747423553491949349698352031277450632623957831801698480186947885184385861560789112949495459501737958331952853208805511125406987471585238630507156932909632952274430435576689664895044524452316173185640309871112172238311362229893423380308135336276614282806444486645238749303589072962904...
CONFIG_MAP = { 'prod': 'production', 'dev': 'development' } def get_config(env): return '.'.join(['smart_recruiting_server', 'conf', 'environments', CONFIG_MAP.get(env, env), 'Config'])
config_map = {'prod': 'production', 'dev': 'development'} def get_config(env): return '.'.join(['smart_recruiting_server', 'conf', 'environments', CONFIG_MAP.get(env, env), 'Config'])
names = ["Onofre","Jorge","Ricardi","Natalia","Dante"] print(names[0]) print(names[1]) print(names[2]) print(names[3]) print(names[4])
names = ['Onofre', 'Jorge', 'Ricardi', 'Natalia', 'Dante'] print(names[0]) print(names[1]) print(names[2]) print(names[3]) print(names[4])
class ManyClasses: ... def a_lot_of_functions(): ... def main(): do_a_lot_of_things_when_executed_directly() if __name__ == '__main__': main()
class Manyclasses: ... def a_lot_of_functions(): ... def main(): do_a_lot_of_things_when_executed_directly() if __name__ == '__main__': main()
def droga(lista): res = 0 level = 0 for elem in lista: if type(elem) is list: res += max(level - elem[1], elem[1] - level) + elem[0] level = elem[1] else: res += level + elem level = 0 res += level return res
def droga(lista): res = 0 level = 0 for elem in lista: if type(elem) is list: res += max(level - elem[1], elem[1] - level) + elem[0] level = elem[1] else: res += level + elem level = 0 res += level return res
class Solution(object): def definition(self, root): if root is None: return True if abs(self.depth(root.left) - self.depth(root.right)) <= 1: return self.definition(root.left) and self.definition(root.right) else: return False def depth(self, root): ...
class Solution(object): def definition(self, root): if root is None: return True if abs(self.depth(root.left) - self.depth(root.right)) <= 1: return self.definition(root.left) and self.definition(root.right) else: return False def depth(self, root): ...
# Repositories R_OK = 0 R_N_EXTRACTION = 1 # 2 ** 0 R_N_ERROR = 2 # 2 ** 1 R_COMPRESS_ERROR = 4 # 2 ** 2 R_COMPRESS_OK = 8 # 2 ** 3 R_UNAVAILABLE_FILES = 16 # 2 ** 4 R_COMMIT_MISMATCH = 32 # 2 ** 5 R_REQUIREMENTS_ERRO...
r_ok = 0 r_n_extraction = 1 r_n_error = 2 r_compress_error = 4 r_compress_ok = 8 r_unavailable_files = 16 r_commit_mismatch = 32 r_requirements_error = 64 r_requirements_ok = 128 r_failed_to_clone = 1024 r_troublesome = 4096 r_extracted_files = 8192 r_statuses = {R_OK: 'load - ok', R_N_EXTRACTION: 'notebooks and cells ...
# -*- coding: utf-8 -*- # ID of taxonomie STRAIN_ID = 1 SPECIES_ID = 2 GENUS_ID = 3 FAMILY_ID = 4 # Lysis Type CLEAR_LYSIS = 5 SEMI_CLEAR_LYSIS = 6 OPAQUE_LYSIS = 7 # Dilution > 1e7 CLEAR_LYSIS_1E7PLUS = 8 SEMI_CLEAR_LYSIS_1E7PLUS = 10 # Dilution < 1e7 CLEAR_LYSIS_1E7MINUS = 9 SEMI_CLEAR_LYSIS_1E7MINUS = 11 ALL_CL...
strain_id = 1 species_id = 2 genus_id = 3 family_id = 4 clear_lysis = 5 semi_clear_lysis = 6 opaque_lysis = 7 clear_lysis_1_e7_plus = 8 semi_clear_lysis_1_e7_plus = 10 clear_lysis_1_e7_minus = 9 semi_clear_lysis_1_e7_minus = 11 all_clear_lysis = [CLEAR_LYSIS, CLEAR_LYSIS_1E7PLUS, CLEAR_LYSIS_1E7MINUS] all_semi_clear_ly...
#e331 def caculate(X,Y,l,u,n): result=int() X.sort() Y.sort(reverse=True) for x in range(n): if (((X[x]+Y[x])>=l) and ((X[x]+Y[x])<=u)): result+=((X[x]+Y[x])-l) elif ((X[x]+Y[x])>u): result+=u return result while True: #get user data try:line=input() ...
def caculate(X, Y, l, u, n): result = int() X.sort() Y.sort(reverse=True) for x in range(n): if X[x] + Y[x] >= l and X[x] + Y[x] <= u: result += X[x] + Y[x] - l elif X[x] + Y[x] > u: result += u return result while True: try: line = input() exc...
class ShaderNodeTexPointDensity: interpolation = None object = None particle_color_source = None particle_system = None point_source = None radius = None resolution = None space = None vertex_attribute_name = None vertex_color_source = None def cache_point_density(self, scen...
class Shadernodetexpointdensity: interpolation = None object = None particle_color_source = None particle_system = None point_source = None radius = None resolution = None space = None vertex_attribute_name = None vertex_color_source = None def cache_point_density(self, scen...
def triangle_area(base, height): ''' (number, number) -> float Return the area of the triangle with base and height. >>> triangle_area(10, 8) 40.0 ''' return (base * height) / 2 def calculate_areas(base_list, height_list): ''' (list of number, list of number) -> list of f...
def triangle_area(base, height): """ (number, number) -> float Return the area of the triangle with base and height. >>> triangle_area(10, 8) 40.0 """ return base * height / 2 def calculate_areas(base_list, height_list): """ (list of number, list of number) -> list of float ...
class Solution: def isPrefixString(self, s: str, words: List[str]) -> bool: build = "" for word in words: build += word if build == s: return True return False
class Solution: def is_prefix_string(self, s: str, words: List[str]) -> bool: build = '' for word in words: build += word if build == s: return True return False
a_1, a_2, a_3 = map(int, input().split()) maxs = max(a_1, a_2, a_3) mins = min(a_1, a_2, a_3) ans = maxs-mins print(ans)
(a_1, a_2, a_3) = map(int, input().split()) maxs = max(a_1, a_2, a_3) mins = min(a_1, a_2, a_3) ans = maxs - mins print(ans)
def brac_balance(inp): stack = [] for char in inp: if char in ["(", "{", "["]: stack.append(char) else: if not stack: return False current_char = stack.pop() if current_char == '(': if char != ")": return False if current_char == '{': if char != "}": return False if current...
def brac_balance(inp): stack = [] for char in inp: if char in ['(', '{', '[']: stack.append(char) else: if not stack: return False current_char = stack.pop() if current_char == '(': if char != ')': ...
def addition(x, y): return x + y def subtraction(x, y): return x - y def multiplication(x, y): return x * y def division(x, y): z = round(y / x, 7) return z def square(x): return x * x def square_root(x): z = round(x ** (1 / 2), 7) return z class Calculate: result = 0 ...
def addition(x, y): return x + y def subtraction(x, y): return x - y def multiplication(x, y): return x * y def division(x, y): z = round(y / x, 7) return z def square(x): return x * x def square_root(x): z = round(x ** (1 / 2), 7) return z class Calculate: result = 0 def ...
#!/bin/env python3 print("Welcome to \"Introduction to Git\" webinar!") print("This is going well!")
print('Welcome to "Introduction to Git" webinar!') print('This is going well!')
# Copyright 2018 Databricks, Inc. VERSION = '1.10.1.dev0'
version = '1.10.1.dev0'
def test_trivial(): assert True
def test_trivial(): assert True
def resolve(): ''' code here ''' S = input() res = 0 temp = 0 for item in S: if item == 'R': temp += 1 else: temp = 0 res = max(res, temp) print(res) if __name__ == "__main__": resolve()
def resolve(): """ code here """ s = input() res = 0 temp = 0 for item in S: if item == 'R': temp += 1 else: temp = 0 res = max(res, temp) print(res) if __name__ == '__main__': resolve()
''' ColorFunctions - Utils ''' # Vars reset = '\033[00m' bold = '\033[01m' underline ='\033[04m' flashing = '\033[05m' reverse='\033[07m' hidden = '\033[08m' black = '\033[30m' red = '\033[31m' green = '\033[32m' yellow = '\033[33m' blue = '\033[34m' magenta = '\033[35m' cyan = '\033[36m' white = '\033[37m' # Main ...
""" ColorFunctions - Utils """ reset = '\x1b[00m' bold = '\x1b[01m' underline = '\x1b[04m' flashing = '\x1b[05m' reverse = '\x1b[07m' hidden = '\x1b[08m' black = '\x1b[30m' red = '\x1b[31m' green = '\x1b[32m' yellow = '\x1b[33m' blue = '\x1b[34m' magenta = '\x1b[35m' cyan = '\x1b[36m' white = '\x1b[37m' def color_trea...
class Cube: def __init__(self, x=0): self.x = x def __str__(self): return 'x = {}'.format(self.x) def area(self): return 6 * self.x * self.x def volume(self): return self.x * self.x * self.x cube1 = Cube(3) print(cube1) print('surface area', cube1.area()) print('volu...
class Cube: def __init__(self, x=0): self.x = x def __str__(self): return 'x = {}'.format(self.x) def area(self): return 6 * self.x * self.x def volume(self): return self.x * self.x * self.x cube1 = cube(3) print(cube1) print('surface area', cube1.area()) print('volum...
dias = float(input('Quantos dias alugados? ')) km = float(input('Quantos Km rodados? ')) pago = dias * 60 + km * 0.15 print('O custo do aluguel foi:R${}{}'.format('\033[1;4;33m', pago))
dias = float(input('Quantos dias alugados? ')) km = float(input('Quantos Km rodados? ')) pago = dias * 60 + km * 0.15 print('O custo do aluguel foi:R${}{}'.format('\x1b[1;4;33m', pago))
# Dashboard setting application_port = 5000 preview_base_url = 'https://elifesciences.org/' # Article scheduler settings article_scheduler_url = 'http://localhost:8000/schedule/v1/article_scheduled_status/' article_schedule_publication_url = 'http://localhost:8000/schedule/v1/schedule_article_publication/' article_sch...
application_port = 5000 preview_base_url = 'https://elifesciences.org/' article_scheduler_url = 'http://localhost:8000/schedule/v1/article_scheduled_status/' article_schedule_publication_url = 'http://localhost:8000/schedule/v1/schedule_article_publication/' article_schedule_range_url = '' sqs_region = 'eu-west-1' even...
def is_password_correct(password): password_string = str(password) for i in range(1, 6): if password_string[i] < password_string[i - 1]: return False for i in range(1, 6): if password_string[i] == password_string[i - 1]: return True return False def count_pas...
def is_password_correct(password): password_string = str(password) for i in range(1, 6): if password_string[i] < password_string[i - 1]: return False for i in range(1, 6): if password_string[i] == password_string[i - 1]: return True return False def count_passwor...
class Ponto: def __init__(self, x, y): self.__x = x self.__y = y def getX(self): return self._x def getY(self): return self._y def setX(self, x): self._x = x def setY(self, y): self._y = y def qualQuadrante(self, x, y): ...
class Ponto: def __init__(self, x, y): self.__x = x self.__y = y def get_x(self): return self._x def get_y(self): return self._y def set_x(self, x): self._x = x def set_y(self, y): self._y = y def qual_quadrante(self, x, y): if x > 0 ...
result = 0 for cont in range(0, 6): n = int(input('Type a number: ')) if n % 2 == 1: result = result + n print(f'The combined valor of the numbers typed is {result}.')
result = 0 for cont in range(0, 6): n = int(input('Type a number: ')) if n % 2 == 1: result = result + n print(f'The combined valor of the numbers typed is {result}.')
# https://medium.com/@perwagnernielsen/getting-started-with-flask-login-can-be-a-bit-daunting-in-this-tutorial-i-will-use-d68791e9b5b5 @app.route('/protected') @login_required def protected(): return "protected area" @login_manager.user_loader def load_user(email): return User.query.filter_by(email = email).f...
@app.route('/protected') @login_required def protected(): return 'protected area' @login_manager.user_loader def load_user(email): return User.query.filter_by(email=email).first() @app.route('/signup', methods=['GET', 'POST']) def signup(): form = signup_form() if request.method == 'GET': retu...
url = r"onlinelibrary.wiley.com/journal/{ID}/(?P<ISSN>\(ISSN\)[\d-]*)" extractor_args = dict(restrict_text=[r"author\s*guidelines"]) template = ( "https://onlinelibrary.wiley.com/page/journal/{ID}/{ISSN}/homepage/forauthors.html" )
url = 'onlinelibrary.wiley.com/journal/{ID}/(?P<ISSN>\\(ISSN\\)[\\d-]*)' extractor_args = dict(restrict_text=['author\\s*guidelines']) template = 'https://onlinelibrary.wiley.com/page/journal/{ID}/{ISSN}/homepage/forauthors.html'
expected_output = { 'lisp_id': { 0: { 'site_name': { 'Shire': { 'instance_id': { 4100: { 'eid_prefix': { '192.168.1.0/24': { 'first_register...
expected_output = {'lisp_id': {0: {'site_name': {'Shire': {'instance_id': {4100: {'eid_prefix': {'192.168.1.0/24': {'first_registered': 'never', 'last_registered': 'never', 'routing_table_tag': 0, 'origin': 'Configuration, accepting more specifics', 'merge_active': 'No', 'proxy_reply': 'No', 'skip_publication': 'No', '...
# O(n + log(n)) time | O(1) space class MinHeap: def __init__(self, array): self.heap = self._buildHeap(array) # O(n) def _buildHeap(self, array): firstParentIdx = (len(array) - 2) // 2 for currentIdx in reversed(range(firstParentIdx + 1)): self._siftDown(currentIdx, len...
class Minheap: def __init__(self, array): self.heap = self._buildHeap(array) def _build_heap(self, array): first_parent_idx = (len(array) - 2) // 2 for current_idx in reversed(range(firstParentIdx + 1)): self._siftDown(currentIdx, len(array) - 1, array) return array...
def bishopAndPawn(bishop, pawn): x = "abcdefgh" return abs(int(x.index(bishop[0])) - int(x.index(pawn[0]))) == abs( int(bishop[1]) - int(pawn[1]) )
def bishop_and_pawn(bishop, pawn): x = 'abcdefgh' return abs(int(x.index(bishop[0])) - int(x.index(pawn[0]))) == abs(int(bishop[1]) - int(pawn[1]))
abis ={ '0xBTC' : '[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"tokens","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type"...
abis = {'0xBTC': '[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"tokens","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool...
# dictionary comprehension square_value_dict = { x:x**2 for x in range(10) } # expected output: ''' {0: 0, 1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 64, 9: 81} ''' print( square_value_dict )
square_value_dict = {x: x ** 2 for x in range(10)} '\n{0: 0, 1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 64, 9: 81}\n' print(square_value_dict)
start = 137683 end = 596253 #start = 444 #end = 460 def runs(s): c = 1 for a,b in zip(s, s[1:]): if a == b: c+=1 if a != b: if c == 2: return True c = 1 if c == 2: return True return False counter = 0 for value in range(start+1, end): s=str(value) pairs = any(( a==...
start = 137683 end = 596253 def runs(s): c = 1 for (a, b) in zip(s, s[1:]): if a == b: c += 1 if a != b: if c == 2: return True c = 1 if c == 2: return True return False counter = 0 for value in range(start + 1, end): s = s...
class BananasBaseRouter: def get_default_basename(self, viewset): return viewset.get_admin_meta().basename def get_schema_view(self): raise NotImplementedError
class Bananasbaserouter: def get_default_basename(self, viewset): return viewset.get_admin_meta().basename def get_schema_view(self): raise NotImplementedError
num1, num2, num3 = input().split() lista = [int(num1), int(num2), int(num3)] maior = max(lista) print(maior, "eh o maior")
(num1, num2, num3) = input().split() lista = [int(num1), int(num2), int(num3)] maior = max(lista) print(maior, 'eh o maior')
def load_file(program_file): program_file = open(program_file,'r') program_code = program_file.read() return program_code
def load_file(program_file): program_file = open(program_file, 'r') program_code = program_file.read() return program_code
#Python program, to demonstrate binary search tree, insertion and search operation #Node class for creating a new node class Node: def __init__(self,data=None): self.data = data self.left = None self.right = None #BST class class BST: def __init__ (self): self.root = None ...
class Node: def __init__(self, data=None): self.data = data self.left = None self.right = None class Bst: def __init__(self): self.root = None def insert(self, data): if self.root == None: self.root = node(data) else: self._insert(d...
REPOS = { "bdsand/cornerwise": { "directory": "~/cornerwise-dev", "dtach": True } } ADDRESS = ("", 31415) # Only accept requests from clients with IPs in this range: IP_RANGE = ("162.242.195.46", "162.242.195.127")
repos = {'bdsand/cornerwise': {'directory': '~/cornerwise-dev', 'dtach': True}} address = ('', 31415) ip_range = ('162.242.195.46', '162.242.195.127')
# Time step dt = 1 # Make time range from 1 to 5 years with step size dt t = np.arange(1, 5+dt/2, dt) # Get number of steps n = len(t) # Initialize p array p = np.zeros(n) p[0] = np.exp(0.3*t[0]) # initial condition # Loop over steps for k in range(n-1): # Calculate the population step p[k+1] = p[k] + dt * ...
dt = 1 t = np.arange(1, 5 + dt / 2, dt) n = len(t) p = np.zeros(n) p[0] = np.exp(0.3 * t[0]) for k in range(n - 1): p[k + 1] = p[k] + dt * 0.3 * p[k] with plt.xkcd(): visualize_population_approx(t, p)
# Ultra-forgiving Tit for Tat. # Defect iff last 3 turns were defections. def strategy(history, memory): choice = 1 if ( history.shape[1] >= 3 and history[1, -1] == 0 and history[1, -2] == 0 and history[1, -3] == 0 ): choice = 0 return choice, None
def strategy(history, memory): choice = 1 if history.shape[1] >= 3 and history[1, -1] == 0 and (history[1, -2] == 0) and (history[1, -3] == 0): choice = 0 return (choice, None)
print("Use commands: \nquit\nstart \nstop \nhelp") command = "" started = False while command != "quit": command = input("> ").lower() if command == "start": if started: print("Car is already started") else: started = True print("Car started moving.....") ...
print('Use commands: \nquit\nstart \nstop \nhelp') command = '' started = False while command != 'quit': command = input('> ').lower() if command == 'start': if started: print('Car is already started') else: started = True print('Car started moving.....') ...
def primitive_nurbs_surface_circle_add(radius=1.0, view_align=False, enter_editmode=False, location=(0.0, 0.0, 0.0), rotation=(0.0, 0.0, 0.0), layers=(False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False)): pass def primitive_nu...
def primitive_nurbs_surface_circle_add(radius=1.0, view_align=False, enter_editmode=False, location=(0.0, 0.0, 0.0), rotation=(0.0, 0.0, 0.0), layers=(False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False)): pass def primitive_nur...
def render_fields_list(*items): ret = '\n Available fields:\n' for item in items: ret += '%s \n' % item return ret
def render_fields_list(*items): ret = '\n Available fields:\n' for item in items: ret += '%s \n' % item return ret
X = [] Y = [] for i in range(2): L = list(map(int,input().split())) X.extend([L[0],L[2]]) Y.extend([L[1],L[3]]) K = max(max(X)-min(X),max(Y)-min(Y)) print(K*K)
x = [] y = [] for i in range(2): l = list(map(int, input().split())) X.extend([L[0], L[2]]) Y.extend([L[1], L[3]]) k = max(max(X) - min(X), max(Y) - min(Y)) print(K * K)
_base_ = ['./twins_pcpvt-s_uperhead_8x4_512x512_160k_ade20k.py'] checkpoint = 'https://download.openmmlab.com/mmsegmentation/v0.5/pretrain/twins/pcpvt_large_20220308-37579dc6.pth' # noqa model = dict( backbone=dict( init_cfg=dict(type='Pretrained', checkpoint=checkpoint), depths=[3, 8, 27, 3], ...
_base_ = ['./twins_pcpvt-s_uperhead_8x4_512x512_160k_ade20k.py'] checkpoint = 'https://download.openmmlab.com/mmsegmentation/v0.5/pretrain/twins/pcpvt_large_20220308-37579dc6.pth' model = dict(backbone=dict(init_cfg=dict(type='Pretrained', checkpoint=checkpoint), depths=[3, 8, 27, 3], drop_path_rate=0.3)) data = dict(s...
class Alarm(object): CREATED_BY_SCRIPT_STR = 'Created by Script' def __init__(self, name, namespace=None, info={}): self.update(name=name, namespace=namespace, info=info) self.resolved = False self.is_human = False def update(self, name=None, namespace=None, info={}): self...
class Alarm(object): created_by_script_str = 'Created by Script' def __init__(self, name, namespace=None, info={}): self.update(name=name, namespace=namespace, info=info) self.resolved = False self.is_human = False def update(self, name=None, namespace=None, info={}): self....
def test_count(man): errors = [] G = man.setGraph("swapi") i = list(G.query().V().count()) if len(i) < 1: errors.append("Fail: nothing returned for O.query().V().count()") elif i[0]["count"] != 39: errors.append("Fail: G.query().V().count() %s != %s" % (i[0]["count"], 39)) i...
def test_count(man): errors = [] g = man.setGraph('swapi') i = list(G.query().V().count()) if len(i) < 1: errors.append('Fail: nothing returned for O.query().V().count()') elif i[0]['count'] != 39: errors.append('Fail: G.query().V().count() %s != %s' % (i[0]['count'], 39)) i = li...
class MaskSplinePoints: def add(self, count=1): pass def remove(self, point): pass
class Masksplinepoints: def add(self, count=1): pass def remove(self, point): pass
# Time complexity: O(n) # Approach: Pre-computing arrays containing information about max height poles around it. With that, finding the water contained over specific position becomes easier. class Solution: def trap(self, height: List[int]) -> int: n = len(height) if n == 1: return 0 ...
class Solution: def trap(self, height: List[int]) -> int: n = len(height) if n == 1: return 0 (left, right) = ([0] * n, [0] * n) left[0] = height[0] for i in range(1, n): left[i] = max(height[i], left[i - 1]) right[n - 1] = height[n - 1] ...
# https://leetcode.com/problems/partition-array-for-maximum-sum class Solution: def maxSumAfterPartitioning(self, A, K): A = [0] + A dp = [-1 for _ in range(len(A))] dp[0] = 0 for i in range(1, len(A)): for k in range(1, K + 1): if i - k >= 0: ...
class Solution: def max_sum_after_partitioning(self, A, K): a = [0] + A dp = [-1 for _ in range(len(A))] dp[0] = 0 for i in range(1, len(A)): for k in range(1, K + 1): if i - k >= 0: dp[i] = max(dp[i], dp[i - k] + k * max(A[i - k + 1:i...
def updateFirewallConfigCommand(root, old_command): changed = False # Only update the command element that corresponds to firewall-config new_command = '/usr/libexec/platform-python -s /usr/bin/firewall-config' for command in root.iter('command'): if 'name' in command.attrib and \ ol...
def update_firewall_config_command(root, old_command): changed = False new_command = '/usr/libexec/platform-python -s /usr/bin/firewall-config' for command in root.iter('command'): if 'name' in command.attrib and old_command == command.attrib['name'] and (old_command != new_command): com...
# Euler 002 # Each new term in the Fibonacci sequence is generated by adding the previous two terms. # By starting with 1 and 2, the first 10 terms will be: # 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... # By considering the terms in the Fibonacci sequence whose values do not exceed four million, # find the sum of the eve...
n1 = 0 n2 = 1 nth = 0 uvalue = 4000000 while nth <= uvalue: nth = n1 + n2 print(nth) if nth % 2 == 0: print('Even: ', nth) n1 = n2 n2 = nth
# # PySNMP MIB module DFL260-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DFL260-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:42:07 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constraint, constraints_intersection, value_range_constraint, single_value_constraint) ...
# https://www.codechef.com/submit/FLOW009 for i in range(int(input())): quantity,price = map(int, input().split()) total = quantity*price if quantity <= 1000: print(total) else: discounted = total-(total*10/100) print(discounted)
for i in range(int(input())): (quantity, price) = map(int, input().split()) total = quantity * price if quantity <= 1000: print(total) else: discounted = total - total * 10 / 100 print(discounted)
characters = [] input_line = input() for x in input_line: characters.append(x) characters.append('Z') counter = len(characters) - 1 for x in range(0, len(characters)-1): if characters[x] == 'c' and characters[x+1] == '=': counter -= 1 elif characters[x] == 'c' and characters[x+1] == '...
characters = [] input_line = input() for x in input_line: characters.append(x) characters.append('Z') counter = len(characters) - 1 for x in range(0, len(characters) - 1): if characters[x] == 'c' and characters[x + 1] == '=': counter -= 1 elif characters[x] == 'c' and characters[x + 1] == '-': ...
# -*- coding: utf-8 -*- container = "container" daemon = "daemon" group = "group" key = "key" name = "name" member = "member" perm = "perm" plugin = "plugin" project = "project" tail = "tail" task = "task" user = "user"
container = 'container' daemon = 'daemon' group = 'group' key = 'key' name = 'name' member = 'member' perm = 'perm' plugin = 'plugin' project = 'project' tail = 'tail' task = 'task' user = 'user'
def power(x,y,p): res = 1 x = x % p if (x == 0): return 0 while (y > 0): if (y & 1): res = (res * x) % p y = y >> 1 x = (x * x) % p return res class Solution: def kvowelwords(self, N, K): # code here i, j = 0, 0 MOD = 100...
def power(x, y, p): res = 1 x = x % p if x == 0: return 0 while y > 0: if y & 1: res = res * x % p y = y >> 1 x = x * x % p return res class Solution: def kvowelwords(self, N, K): (i, j) = (0, 0) mod = 1000000007 dp = [[0 for ...
tup1 = (1,2) tup2 = (3,4) tuple[1] = tuple[1] + tuple[0] # Output should error out
tup1 = (1, 2) tup2 = (3, 4) tuple[1] = tuple[1] + tuple[0]
# https://leetcode.com/problems/min-cost-climbing-stairs class Solution: def minCostClimbingStairs(self, cost: List[int]) -> int: # avoid index error cost = [0] + cost + [0] length = len(cost) memo = {} memo[0], memo[1] = cost[0], cost[1] for i in range(2, length):...
class Solution: def min_cost_climbing_stairs(self, cost: List[int]) -> int: cost = [0] + cost + [0] length = len(cost) memo = {} (memo[0], memo[1]) = (cost[0], cost[1]) for i in range(2, length): memo[i] = min(memo[i - 2] + cost[i], memo[i - 1] + cost[i]) ...
del_items(0x800B0440) SetType(0x800B0440, "char StrDate[12]") del_items(0x800B044C) SetType(0x800B044C, "char StrTime[9]") del_items(0x800B0458) SetType(0x800B0458, "char *Words[118]") del_items(0x800B0630) SetType(0x800B0630, "struct MONTH_DAYS MonDays[12]")
del_items(2148205632) set_type(2148205632, 'char StrDate[12]') del_items(2148205644) set_type(2148205644, 'char StrTime[9]') del_items(2148205656) set_type(2148205656, 'char *Words[118]') del_items(2148206128) set_type(2148206128, 'struct MONTH_DAYS MonDays[12]')
REST_FRAMEWORK = { 'DEFAULT_PERMISSION_CLASSES': ( 'rest_framework.permissions.AllowAny', ), 'DEFAULT_RENDERER_CLASSES': ( 'rest_framework.renderers.JSONRenderer', 'rest_framework.renderers.BrowsableAPIRenderer', ), 'DEFAULT_PARSER_CLASSES': ( 'rest_framework.parsers....
rest_framework = {'DEFAULT_PERMISSION_CLASSES': ('rest_framework.permissions.AllowAny',), 'DEFAULT_RENDERER_CLASSES': ('rest_framework.renderers.JSONRenderer', 'rest_framework.renderers.BrowsableAPIRenderer'), 'DEFAULT_PARSER_CLASSES': ('rest_framework.parsers.JSONParser',)}
# coefficients for servo feedback -> front wheel angle: # radians = (servo-126.5) / 121.3 def wheel_angle(servo_fb): return (servo_fb - 126.5) / 121.3 def servo_target(control_input): m, b = 0.3876, 119.5 return m*control_input + b def motor_constants(): ''' k1, k2, k3, control offset (in 0..1.0 P...
def wheel_angle(servo_fb): return (servo_fb - 126.5) / 121.3 def servo_target(control_input): (m, b) = (0.3876, 119.5) return m * control_input + b def motor_constants(): """ k1, k2, k3, control offset (in 0..1.0 PWM space) """ return (2.58, 0.0931, 0.218, 0.103)
def binary_classification_metrics(prediction, ground_truth): ''' Computes metrics for binary classification Arguments: prediction, np array of bool (num_samples) - model predictions ground_truth, np array of bool (num_samples) - true labels Returns: precision, recall, f1, accuracy - classi...
def binary_classification_metrics(prediction, ground_truth): """ Computes metrics for binary classification Arguments: prediction, np array of bool (num_samples) - model predictions ground_truth, np array of bool (num_samples) - true labels Returns: precision, recall, f1, accuracy - classi...
# In python inheritance, when an object of child class is created, # the parent class constructor is called only if the child class # does not have its own constructor.Else the parent class constructor is not called. # To invoke the parent class constructor and methods, we can use a magic method called super() clas...
class Shelter: def __init__(self, shelter_for): self.shelter_for = shelter_for class Tent(Shelter): def __init__(self, shelter_for, no_of_chairs, no_of_cots): super().__init__(shelter_for) self.no_of_chairs = no_of_chairs self.no_of_cots = no_of_cots class Cage(Shelter): ...
# Definition for singly-linked list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def removeNthFromEnd(self, head: Optional[ListNode], n: int) -> Optional[ListNode]: l1, l2 = head, head count = 1 while l2.next: ...
class Listnode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def remove_nth_from_end(self, head: Optional[ListNode], n: int) -> Optional[ListNode]: (l1, l2) = (head, head) count = 1 while l2.next: l2 = l2.next ...
description = 'setup for the status monitor, HTML version' group = 'special' _expcolumn = Column( Block('Experiment', [ BlockRow( Field(name='Proposal', key='exp/proposal', width=7), Field(name='Title', key='exp/title', width=20, istext=True, maxlen=20), ...
description = 'setup for the status monitor, HTML version' group = 'special' _expcolumn = column(block('Experiment', [block_row(field(name='Proposal', key='exp/proposal', width=7), field(name='Title', key='exp/title', width=20, istext=True, maxlen=20), field(name='Current status', key='exp/action', width=30, istext=Tru...
''' Problem statement: Given an array A of size N having distinct elements, the task is to find the next greater element for each element of the array in order of their appearance in the array. If no such element exists, output -1 ''' if __name__ == '__main__': test_cases = int(input()) list_counts, lists = []...
""" Problem statement: Given an array A of size N having distinct elements, the task is to find the next greater element for each element of the array in order of their appearance in the array. If no such element exists, output -1 """ if __name__ == '__main__': test_cases = int(input()) (list_counts, lists) = (...
# # PySNMP MIB module RDN-PROCESS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RDN-PROCESS-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:54:59 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_size_constraint, constraints_union, value_range_constraint, single_value_constraint) ...
class Solution(object): def calcEquation(self, equations, values, queries): table = make_val_table(equations, values) ans = [query_from_table(table, q) for q in queries] return [(-1.0 if x is None else x) for x in ans] def make_val_table(equations, values): val_table = {} ...
class Solution(object): def calc_equation(self, equations, values, queries): table = make_val_table(equations, values) ans = [query_from_table(table, q) for q in queries] return [-1.0 if x is None else x for x in ans] def make_val_table(equations, values): val_table = {} for (i, eq...
class Solution: def numWays(self, words: List[str], target: str) -> int: result = [1] + [0] * len(target) for i in range(len(words[0])): counter = Counter(w[i] for w in words) for j in range(min(i + 1, len(target)), 0, -1): result[j] = (result[j] + (result[j -...
class Solution: def num_ways(self, words: List[str], target: str) -> int: result = [1] + [0] * len(target) for i in range(len(words[0])): counter = counter((w[i] for w in words)) for j in range(min(i + 1, len(target)), 0, -1): result[j] = (result[j] + result[...
def maior(* num): mai = cont = 0 for i in num: print(f"{i}", end=" ", flush=True) if cont == 0: mai = i else: if i > mai: mai = i cont += 1 print(f"\nForam informados {cont} numeros.") print(f"O maior numero e {mai}") print("-=" ...
def maior(*num): mai = cont = 0 for i in num: print(f'{i}', end=' ', flush=True) if cont == 0: mai = i elif i > mai: mai = i cont += 1 print(f'\nForam informados {cont} numeros.') print(f'O maior numero e {mai}') print('-=' * 20) maior(2, 3, 6,...
def solution(numbers, target): answerSet = [numbers[0],-numbers[0]] for number in numbers[1:]: answerSet = [number + i for i in answerSet] + [-number + i for i in answerSet] return sum([target == i for i in answerSet])
def solution(numbers, target): answer_set = [numbers[0], -numbers[0]] for number in numbers[1:]: answer_set = [number + i for i in answerSet] + [-number + i for i in answerSet] return sum([target == i for i in answerSet])
class Solution: def defangIPaddr(self, address: str) -> str: new_string = "" for char in address: if char != ".": new_string += char else: new_string += "[.]" return new_string
class Solution: def defang_i_paddr(self, address: str) -> str: new_string = '' for char in address: if char != '.': new_string += char else: new_string += '[.]' return new_string
my_string = "aaabbbcccdddd" # converting the string to a set temp_set = set(my_string) # stitching set into a string using join new_string = ''.join(temp_set) print(new_string)
my_string = 'aaabbbcccdddd' temp_set = set(my_string) new_string = ''.join(temp_set) print(new_string)
with open('data.txt') as file: triStr = file.read() triArr = [[int(num) for num in row.split()] for row in triStr.strip('\n').split('\n')] for level in range(len(triArr) - 2, -1, -1): for index, _ in enumerate(triArr[level]): triArr[level][index] += max(triArr[level+1][index], ...
with open('data.txt') as file: tri_str = file.read() tri_arr = [[int(num) for num in row.split()] for row in triStr.strip('\n').split('\n')] for level in range(len(triArr) - 2, -1, -1): for (index, _) in enumerate(triArr[level]): triArr[level][index] += max(triArr[level + 1][index], triArr[level + 1][in...
def clean_up(s): return next(split_into_sentences(fix_hyphenation(fix_whitespace(s)))) def fix_whitespace(s): return s.replace("\n", " ") def fix_hyphenation(s): return s.replace("- ", "") def split_into_sentences(s): return map(ensure_ends_with_period, s.split(sep=". ")) def ensure_ends_with_pe...
def clean_up(s): return next(split_into_sentences(fix_hyphenation(fix_whitespace(s)))) def fix_whitespace(s): return s.replace('\n', ' ') def fix_hyphenation(s): return s.replace('- ', '') def split_into_sentences(s): return map(ensure_ends_with_period, s.split(sep='. ')) def ensure_ends_with_period...
skillset = { 'CS': [ 'java', 'python', 'c++', 'c#', 'lisp', 'node.js', 'javascript', 'machine learning', 'AI', 'artificial intelligence', 'data modeling', 'jquery', 'ruby', 'rails', 'asp.net' 'graph theory', 'business analy...
skillset = {'CS': ['java', 'python', 'c++', 'c#', 'lisp', 'node.js', 'javascript', 'machine learning', 'AI', 'artificial intelligence', 'data modeling', 'jquery', 'ruby', 'rails', 'asp.netgraph theory', 'business analytics', 'sysadmin', 'linux', 'hadoop', 'big data', 'mongodb', 'pgsql', 'postgres', 'postgresql', 'sql',...
def encryption(): text = input("Enter Text to Encrypt: ") e_text = "" for char in text: if (char.isupper()): e_text += chr((ord(char) + 1-65) % 26 + 65) else: e_text += chr((ord(char) + 1 - 97) % 26 + 97) print("\nInput Plain Text: " + text) print("\nCipher ...
def encryption(): text = input('Enter Text to Encrypt: ') e_text = '' for char in text: if char.isupper(): e_text += chr((ord(char) + 1 - 65) % 26 + 65) else: e_text += chr((ord(char) + 1 - 97) % 26 + 97) print('\nInput Plain Text: ' + text) print('\nCipher Te...
class Solution: def insertion_sort(self, arr): for i in range(1, len(arr)): key = arr[i] # key separates sorted (left side) from unsorted (right side) j = i-1 while j >= 0 and key < arr[j]: # while values to the left of the key are greater keep going arr[j+1] = arr[j] # shifting elements to the righ...
class Solution: def insertion_sort(self, arr): for i in range(1, len(arr)): key = arr[i] j = i - 1 while j >= 0 and key < arr[j]: arr[j + 1] = arr[j] j -= 1 arr[j + 1] = key return arr obj = solution() x = [2, 1, 6, 8, ...
# Entrada de datos name = input("What is your name: ") year1 = int(input("What is you birth year: ")) year2 = int(input("What is you actual year: ")) age = year2 - year1 print(f"Your name is {name} and you are {year2-year1} years old")
name = input('What is your name: ') year1 = int(input('What is you birth year: ')) year2 = int(input('What is you actual year: ')) age = year2 - year1 print(f'Your name is {name} and you are {year2 - year1} years old')
# Minimum Operations to Reduce X to Zero ''' You are given an integer array nums and an integer x. In one operation, you can either remove the leftmost or the rightmost element from the array nums and subtract its value from x. Note that this modifies the array for future operations. Return the minimum number of ope...
""" You are given an integer array nums and an integer x. In one operation, you can either remove the leftmost or the rightmost element from the array nums and subtract its value from x. Note that this modifies the array for future operations. Return the minimum number of operations to reduce x to exactly 0 if it's p...
class Solution: def maxSumOfThreeSubarrays(self, nums: List[int], k: int) -> List[int]: idx1, idx2, idx3 = 0, k, k * 2 s1, s2, s3 = sum(nums[idx1:idx1 + k]), sum(nums[idx2:idx2 + k]), sum(nums[idx3:idx3 + k]) bests1, bests12, bests123 = s1, s1 + s2, s1 + s2 + s3 besti1 = 0 be...
class Solution: def max_sum_of_three_subarrays(self, nums: List[int], k: int) -> List[int]: (idx1, idx2, idx3) = (0, k, k * 2) (s1, s2, s3) = (sum(nums[idx1:idx1 + k]), sum(nums[idx2:idx2 + k]), sum(nums[idx3:idx3 + k])) (bests1, bests12, bests123) = (s1, s1 + s2, s1 + s2 + s3) best...
class ResourceNotFoundException(Exception): pass class SongNotFoundException(ResourceNotFoundException): def __init__(self, song_id): self.message = "no song found for the id %s" % song_id super().__init__(self.message) class BadRequestException(Exception): pass
class Resourcenotfoundexception(Exception): pass class Songnotfoundexception(ResourceNotFoundException): def __init__(self, song_id): self.message = 'no song found for the id %s' % song_id super().__init__(self.message) class Badrequestexception(Exception): pass
passes = 0 count = 0 while count < 10: result = str(input('Enter result (passed=1, failed=2): ')) if result == '1': passes += 1 count += 1 elif result == '2': passes += 0 count += 1 else: passes += ...
passes = 0 count = 0 while count < 10: result = str(input('Enter result (passed=1, failed=2): ')) if result == '1': passes += 1 count += 1 elif result == '2': passes += 0 count += 1 else: passes += 0 count += 0 print('Passed:', passes) print('Failed:', 10 ...
# # PySNMP MIB module MIDCOM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MIDCOM-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:12:43 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, constraints_union, value_size_constraint, value_range_constraint, single_value_constraint) ...
def cmp(s, rpc): rpc["FLAGS"] = "0" * 16 flag = "0" * 12 s = s[10::] R_a = s[:3] R_b = s[3:6] register = { "000": "R0", "001": "R1", "010": "R2", "011": "R3", "100": "R4", "101": "R5", "110": "R6", } R_a = register[R_a] R_b =...
def cmp(s, rpc): rpc['FLAGS'] = '0' * 16 flag = '0' * 12 s = s[10:] r_a = s[:3] r_b = s[3:6] register = {'000': 'R0', '001': 'R1', '010': 'R2', '011': 'R3', '100': 'R4', '101': 'R5', '110': 'R6'} r_a = register[R_a] r_b = register[R_b] r_a = int(rpc[R_a], 2) r_b = int(rpc[R_b], 2...
ids = [ [11, 81, 32, 52, 13], [31, 71, 42, 62, 23], [21, 61, 12, 72, 33], [44, 51, 22, 82, 43] ] cellDatabase = [ # cell_1 { 'code': 1, 'motors': [ {'pins': {'digital': (53, 52), 'pwm': 11}}, {'pins': {'digital': (51, 50), 'pwm': 12}}, {'pins...
ids = [[11, 81, 32, 52, 13], [31, 71, 42, 62, 23], [21, 61, 12, 72, 33], [44, 51, 22, 82, 43]] cell_database = [{'code': 1, 'motors': [{'pins': {'digital': (53, 52), 'pwm': 11}}, {'pins': {'digital': (51, 50), 'pwm': 12}}, {'pins': {'digital': (49, 48), 'pwm': 13}}]}, {'code': 4, 'motors': [{'pins': {'digital': (29, 28...
DEFAULTS = { "save_path": "./runs/dev/extracted", "source_path": "./runs/dev/ingested/raw_data.npz", "CNN_features": { "step_size": 1, "start_time": 1, "num_steps": 64, }, "num_samples": None, "plevels_included": 40, "features": ["temp", "hght", "ucomp", "vcomp", "ome...
defaults = {'save_path': './runs/dev/extracted', 'source_path': './runs/dev/ingested/raw_data.npz', 'CNN_features': {'step_size': 1, 'start_time': 1, 'num_steps': 64}, 'num_samples': None, 'plevels_included': 40, 'features': ['temp', 'hght', 'ucomp', 'vcomp', 'omega', 'slp', 'lat', 'lon']} tensors_fn = 'tensors.csv' gw...
def checkIfEnabled(text): if (str(text).lower()=='disabled') or (str(text).lower()=='false') or (text is None): return False elif (str(text).lower()=='enabled') or (str(text).lower()=='on'): return True return False
def check_if_enabled(text): if str(text).lower() == 'disabled' or str(text).lower() == 'false' or text is None: return False elif str(text).lower() == 'enabled' or str(text).lower() == 'on': return True return False
# # PySNMP MIB module REDSTONE-SNMP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/REDSTONE-SNMP-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:55:50 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_size_constraint, value_range_constraint, constraints_union, single_value_constraint) ...
class Solution: def constructArray(self, n: int, k: int) -> List[int]: result = [0] * n start = 1 end = n i = 0 while start <= end: if k > 1: if k & 1: result[i] = end end -= 1 ...
class Solution: def construct_array(self, n: int, k: int) -> List[int]: result = [0] * n start = 1 end = n i = 0 while start <= end: if k > 1: if k & 1: result[i] = end end -= 1 else: ...
bike=["lala","lala2","lala3"] print(bike) print(bike[1]) # Insercao no indice desejado bike.insert(4,"a") print(bike) bike.insert(5,"c") print(bike) bike.insert(6,"b") print(bike) # Insercao no fim da lista bike.append("ajkdhaiudqwiehjkzchiuzxuciadqiwe") print(bike) bike.sort() print(bike) # Remoca...
bike = ['lala', 'lala2', 'lala3'] print(bike) print(bike[1]) bike.insert(4, 'a') print(bike) bike.insert(5, 'c') print(bike) bike.insert(6, 'b') print(bike) bike.append('ajkdhaiudqwiehjkzchiuzxuciadqiwe') print(bike) bike.sort() print(bike) bike.remove('lala2') print(bike) del bike[1] print(bike) bike_poped = bike.pop(...
# Strings and Variables # The input function allows you to specify a massage to display and returns the value typed in by user. # We use a variable to remember the value entered by the user. # name = is a variable. # here's variable name is "name". But we can call it anything as long the variable's name doesn't contai...
name = input('what is your name?') print(name) name = 'mraha' print(name) a = input('enter a number\n') print('enter another number') b = input() firstname = input('what is your first name?\n') lastname = input('what is your last name?\n') print('hello,' + firstname + lastname) print('hello, ' + firstname + '' + lastna...
class DataNotAvailable(Exception): pass
class Datanotavailable(Exception): pass
def method(): pass if True: class C: pass method()
def method(): pass if True: class C: pass method()
# Copyright 2016 Intuit # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
pig_template = "\n set mapreduce.job.queuename @QUEUE\n set default_parallel @NUM_REDUCERS\n @SET_COMPRESSION_ENABLED\n @SET_COMPRESSION_CODEC\n set pig.splitCombination false\n\n rmf @OUTPUT_PATH\n A = load '@INPUT_PATH' using PigStorage('\x01', '-tagFile') AS (filename: chararray,line: chararray)...
class Solution: # @param {integer} n # @return {boolean} def isPowerOfTwo(self, n): res = 0 while n > 0: res += n & 1 n = n >> 1 return res == 1
class Solution: def is_power_of_two(self, n): res = 0 while n > 0: res += n & 1 n = n >> 1 return res == 1
moves = [] l = [] while True: line = input() if line: l.append(line) else: break # l = s.split("\n") for i in l: moves.append(i.split("\"")[-2]) m = [] for i in moves: m.append("game.execute_move(\"" + i + "\");") for i in m: print(i)
moves = [] l = [] while True: line = input() if line: l.append(line) else: break for i in l: moves.append(i.split('"')[-2]) m = [] for i in moves: m.append('game.execute_move("' + i + '");') for i in m: print(i)
DELIM = ' ||| ' CAND_OUT = '.candidates' NOPIVOT_OUT = '.nopivot' PIVOT_OUT = '.pivot' RECALL_OUT = '.recall' MAX_SCORE = 1.0 ID_IDX=0 SOURCE_IDX=1 TARGET_IDX=2 PANPHON_VECTOR_SIZE = 22 UNK = 'unk' DEFAULT_ENCODE_BATCH_SIZE=512 TEST_IDX=2 INPUT_IDX=0
delim = ' ||| ' cand_out = '.candidates' nopivot_out = '.nopivot' pivot_out = '.pivot' recall_out = '.recall' max_score = 1.0 id_idx = 0 source_idx = 1 target_idx = 2 panphon_vector_size = 22 unk = 'unk' default_encode_batch_size = 512 test_idx = 2 input_idx = 0