content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class CopyAsValuesParam(object):
def __init__(self, **kargs):
self.nodeId = kargs["nodeId"] if "nodeId" in kargs else None
self.asNewNode = kargs["asNewNode"] if "asNewNode" in kargs else False
| class Copyasvaluesparam(object):
def __init__(self, **kargs):
self.nodeId = kargs['nodeId'] if 'nodeId' in kargs else None
self.asNewNode = kargs['asNewNode'] if 'asNewNode' in kargs else False |
# a queue is a data structure in which the data element entered first is removed first
# basically you insert elements from one end and remove them from another end
# a very simple, and cliche example would be that of a plain old queue at McDonald's
# The person who joined the queue first will order first, and the one... | class Ourqueue:
def __init__(self):
self.front = -1
self.end = -1
self.elements = []
def queue(self, value):
self.front = self.front + 1
self.elements.insert(self.top, value)
def pop(self):
if self.top >= 0:
self.top = self.top - 1
else:... |
#!/usr/bin/env python3
def coverage_test_helper():
one = 10 + 3 - 12
print('This function should be called {one} time to achieve 100% coverage')
return one
| def coverage_test_helper():
one = 10 + 3 - 12
print('This function should be called {one} time to achieve 100% coverage')
return one |
class Checksum:
@staticmethod
def calc(data: str):
chksum = Checksum.__str_list2bin(data)
chksum = Checksum.__sum_bytes(chksum)
map(lambda x: bytearray(x + 1)[0], chksum)
return chksum
@staticmethod
def __str_list2bin(data: str) -> list:
map(lambda x: bytearray(x... | class Checksum:
@staticmethod
def calc(data: str):
chksum = Checksum.__str_list2bin(data)
chksum = Checksum.__sum_bytes(chksum)
map(lambda x: bytearray(x + 1)[0], chksum)
return chksum
@staticmethod
def __str_list2bin(data: str) -> list:
map(lambda x: bytearray(... |
# --------------
##File path for the file
file_path
#Code starts here
#Function to read file
def read_file(path):
#Opening of the file located in the path in 'read' mode
file = open(path, 'r')
#Reading of the first line of the file and storing it in a variable
sentence=file.rea... | file_path
def read_file(path):
file = open(path, 'r')
sentence = file.readline()
file.close()
return sentence
sample_message = read_file(file_path)
print(sample_message)
file_1 = open(file_path_1)
file_2 = open(file_path_2)
message_1 = read_file(file_path_1)
print(message_1)
message_2 = read_file(file_... |
# Adapted from: https://stackoverflow.com/questions/37935920/quantile-normalization-on-pandas-dataframe
# Citing: https://en.wikipedia.org/wiki/Quantile_normalization
class QNorm:
def __init__(self):
return
def fit(self,df):
return _QNormFit(self,df.stack().groupby(df.rank(method='first').stack(... | class Qnorm:
def __init__(self):
return
def fit(self, df):
return _q_norm_fit(self, df.stack().groupby(df.rank(method='first').stack().astype(int)).mean())
def fit_transform(self, df):
return self.fit(df).transform(df)
class _Qnormfit:
def __init__(self, parent, df):
... |
class PluginError(Exception):
pass
class OneLoginClientError(PluginError):
pass
class UserNotFound(PluginError):
pass
class FactorNotFound(PluginError):
pass
class TimeOutError(PluginError):
pass
class APIResponseError(PluginError):
pass | class Pluginerror(Exception):
pass
class Oneloginclienterror(PluginError):
pass
class Usernotfound(PluginError):
pass
class Factornotfound(PluginError):
pass
class Timeouterror(PluginError):
pass
class Apiresponseerror(PluginError):
pass |
YES = "LuckyChef"
NO = "UnluckyChef"
def solve():
for _ in range(int(input())):
x, y, k, n = map(int, input().split())
arr = []
for __ in range(n):
arr.append(list(map(int, input().split())))
remaining_pages = x - y
if remaining_pages <= 0:
print(YE... | yes = 'LuckyChef'
no = 'UnluckyChef'
def solve():
for _ in range(int(input())):
(x, y, k, n) = map(int, input().split())
arr = []
for __ in range(n):
arr.append(list(map(int, input().split())))
remaining_pages = x - y
if remaining_pages <= 0:
print(YE... |
nome = input('Digite seu nome completo: ')
nomem = nome.upper()
nomemin = nome.lower()
fat = nome.split()
juntin = '-'.join(fat)
nomefatiado = nome.replace(" ", "")
print(len(nomefatiado))
print(nomemin)
print(nomem)
print(len(fat[0]))
print(fat)
print(juntin) | nome = input('Digite seu nome completo: ')
nomem = nome.upper()
nomemin = nome.lower()
fat = nome.split()
juntin = '-'.join(fat)
nomefatiado = nome.replace(' ', '')
print(len(nomefatiado))
print(nomemin)
print(nomem)
print(len(fat[0]))
print(fat)
print(juntin) |
if __name__ == '__main__':
n = int(input())
arr = map(int, input().split())
# Copy original array
new_arr = set(arr)
# Remove max values
new_arr.remove(max(new_arr))
# Print new max (2nd max)
print(max(new_arr))
| if __name__ == '__main__':
n = int(input())
arr = map(int, input().split())
new_arr = set(arr)
new_arr.remove(max(new_arr))
print(max(new_arr)) |
a, b, c = map(int, input().split())
if b - a == c - b:
print("YES")
else:
print("NO") | (a, b, c) = map(int, input().split())
if b - a == c - b:
print('YES')
else:
print('NO') |
# https://leetcode.com/problems/longest-valid-parentheses/
# Given a string containing just the characters '(' and ')', find the length of
# the longest valid (well-formed) parentheses substring.
################################################################################
# dp[i] = longest valid of s[i:n] starti... | class Solution:
def longest_valid_parentheses(self, s: str) -> int:
if len(s) <= 1:
return 0
n = len(s)
ans = 0
dp = [0] * n
for i in range(n - 2, -1, -1):
if s[i] == '(':
j = i + dp[i + 1] + 1
if j < n and s[j] == ')':... |
def fizz_buzz(n):
for fizz_buzz in range(n+1):
if fizz_buzz % 3 == 0 and fizz_buzz % 5 == 0:
print("fizzbuzz")
continue
elif fizz_buzz % 3 == 0:
print("fizz")
continue
elif fizz_buzz % 5 == 0:
print("buzz")
print(fizz_buzz)
... | def fizz_buzz(n):
for fizz_buzz in range(n + 1):
if fizz_buzz % 3 == 0 and fizz_buzz % 5 == 0:
print('fizzbuzz')
continue
elif fizz_buzz % 3 == 0:
print('fizz')
continue
elif fizz_buzz % 5 == 0:
print('buzz')
print(fizz_buzz... |
#import GreenMindLib
msg_menu = '''
Use: sudo ./green -u http://businesscorp.com.br -o teste.txt \n\n
Green Recon
=============
Command Description
------- -----------
greenrecon Start recon OSINT
recon Suite recon OSINT
googl... | msg_menu = '\n\n Use: sudo ./green -u http://businesscorp.com.br -o teste.txt \n\n\nGreen Recon\n=============\n\n Command Description\n ------- -----------\n greenrecon Start recon OSINT\n recon Suite recon OSINT\n google_search ... |
_base_ = [
'../../_base_/default_runtime.py',
'../../_base_/schedules/schedule_sgd_1200e.py',
'../../_base_/det_models/dbnet_r18_fpnc.py',
'../../_base_/det_datasets/icdar2015.py',
'../../_base_/det_pipelines/dbnet_pipeline.py'
]
train_list = {{_base_.train_list}}
test_list = {{_base_.test_list}}
... | _base_ = ['../../_base_/default_runtime.py', '../../_base_/schedules/schedule_sgd_1200e.py', '../../_base_/det_models/dbnet_r18_fpnc.py', '../../_base_/det_datasets/icdar2015.py', '../../_base_/det_pipelines/dbnet_pipeline.py']
train_list = {{_base_.train_list}}
test_list = {{_base_.test_list}}
train_pipeline_r18 = {{_... |
class MoveNotFound(Exception):
pass
class CharacterNotFound(Exception):
pass
class OptionError(Exception):
pass
class LimitError(Exception):
pass
class CharacterMainError(Exception):
pass
class CharacterSubError(Exception):
pass
class CommandNotFound(Exception):
pass
class Comm... | class Movenotfound(Exception):
pass
class Characternotfound(Exception):
pass
class Optionerror(Exception):
pass
class Limiterror(Exception):
pass
class Charactermainerror(Exception):
pass
class Charactersuberror(Exception):
pass
class Commandnotfound(Exception):
pass
class Commandalre... |
with open('pessoa.csv') as arquivo:
with open('pessoas.txt', 'w') as saida:
for registro in arquivo:
registro = registro.strip().split(',')
print(f'Nome:{registro[0]}, Idade: {registro[1]} anos', file=saida) | with open('pessoa.csv') as arquivo:
with open('pessoas.txt', 'w') as saida:
for registro in arquivo:
registro = registro.strip().split(',')
print(f'Nome:{registro[0]}, Idade: {registro[1]} anos', file=saida) |
class PrettyException(Exception):
"Semantic errors in prettyqr."
pass
class ImageNotSquareException(PrettyException):
pass
class BaseImageSmallerThanQRCodeException(PrettyException):
pass
| class Prettyexception(Exception):
"""Semantic errors in prettyqr."""
pass
class Imagenotsquareexception(PrettyException):
pass
class Baseimagesmallerthanqrcodeexception(PrettyException):
pass |
#
# Author:
# Date:
# Description:
#
# Constants used to refer to the parts of the quiz question
CATEGORY = 0
VALUE = 1
QUESTION = 2
ANSWER = 3
#
# Read lines of text from a specified file and create a list of those lines
# with each line added as a separate String item in the list
#
# Parameter
# inputFile -... | category = 0
value = 1
question = 2
answer = 3
def get_list_from_file(inputFile):
output_list = []
try:
source = open(inputFile, 'r')
output_list = source.readlines()
source.close()
except FileNotFoundError:
print('Unable to open input file: ' + inputFile)
return outputL... |
def C_to_F(temp):
temp = temp*9/5+32
return temp
def F_to_C(temp):
temp = (temp-32)*5.0/9.0
return temp
sel = input('\nCelsius and Fahrenheit Convert\n\n'+
'(A) Fatrenheit to Celsius\n'+
'(B) Celsius to Fatrenheit\n'+
'(C) Exit\n\n'+
'Please input...> ')
while sel != 'C':
temp = int(input('Please input tempe... | def c_to_f(temp):
temp = temp * 9 / 5 + 32
return temp
def f_to_c(temp):
temp = (temp - 32) * 5.0 / 9.0
return temp
sel = input('\nCelsius and Fahrenheit Convert\n\n' + '(A) Fatrenheit to Celsius\n' + '(B) Celsius to Fatrenheit\n' + '(C) Exit\n\n' + 'Please input...> ')
while sel != 'C':
temp = int... |
# first line: 1
@memory.cache
def vsigmomEdw_NR(Erecoil_keV, aH):
return [sigmomEdw(x,band='NR',label='GGA3',F=0.000001,V=4.0,aH=aH,alpha=(1/18.0)) for x in Erecoil_keV]
| @memory.cache
def vsigmom_edw_nr(Erecoil_keV, aH):
return [sigmom_edw(x, band='NR', label='GGA3', F=1e-06, V=4.0, aH=aH, alpha=1 / 18.0) for x in Erecoil_keV] |
for i in range(101):
if i % 15 == 0:
print("Fizzbuzz")
elif i % 3 == 0:
print("Fizz")
elif i % 5 == 0:
print("Buzz")
else:
print(i)
| for i in range(101):
if i % 15 == 0:
print('Fizzbuzz')
elif i % 3 == 0:
print('Fizz')
elif i % 5 == 0:
print('Buzz')
else:
print(i) |
RESOURCE = "https://graph.microsoft.com" # Add the resource you want the access token for
TENANT = "Your tenant" # Enter tenant name, e.g. contoso.onmicrosoft.com
AUTHORITY_HOST_URL = "https://login.microsoftonline.com"
CLIENT_ID = "Your client id " # copy the Application ID of your app from your Azure portal
CLIENT... | resource = 'https://graph.microsoft.com'
tenant = 'Your tenant'
authority_host_url = 'https://login.microsoftonline.com'
client_id = 'Your client id '
client_secret = 'Your client secret'
api_version = 'v1.0' |
# Hiztegi bat deklaratu ta aldagaiak jarri, erabiltzaileak sartu ditzan
hizt = {}
EI = input("Sartu zure erabiltzaile izena:\n")
hizt['Erabiltzaile_izena'] = EI
PH = input("Sartu zure pasahitza:\n")
hizt['Pasahitza'] = PH
# Aldagai hoiek gorde ta bukle batekin bere datuak sartzea, ondo sartu arte (input = hiztegian... | hizt = {}
ei = input('Sartu zure erabiltzaile izena:\n')
hizt['Erabiltzaile_izena'] = EI
ph = input('Sartu zure pasahitza:\n')
hizt['Pasahitza'] = PH
print('\n\nERREGISTRO LEIHOA\n')
input('Sartu zure erabiltzaile izena:\n')
if input == EI:
print('Ondo, orain sartu pasahitza.')
else:
print('Gaizki.') |
#!/usr/bin/env python3
x, y = map(int, input().strip().split())
while x != 0 and y != 0:
att = list(map(int, input().strip().split()))
att.sort()
dff = list(map(int, input().strip().split()))
dff.sort()
if(att[0] < dff[1]):
print("Y")
else:
print("N")
x, y = map(int, input... | (x, y) = map(int, input().strip().split())
while x != 0 and y != 0:
att = list(map(int, input().strip().split()))
att.sort()
dff = list(map(int, input().strip().split()))
dff.sort()
if att[0] < dff[1]:
print('Y')
else:
print('N')
(x, y) = map(int, input().strip().split()) |
FreeSansBold9pt7bBitmaps = [
0xFF, 0xFF, 0xFE, 0x48, 0x7E, 0xEF, 0xDF, 0xBF, 0x74, 0x40, 0x19, 0x86,
0x67, 0xFD, 0xFF, 0x33, 0x0C, 0xC3, 0x33, 0xFE, 0xFF, 0x99, 0x86, 0x61,
0x90, 0x10, 0x1F, 0x1F, 0xDE, 0xFF, 0x3F, 0x83, 0xC0, 0xFC, 0x1F, 0x09,
0xFC, 0xFE, 0xF7, 0xF1, 0xE0, 0x40, 0x38, 0x10, 0x7C, 0x30,... | free_sans_bold9pt7b_bitmaps = [255, 255, 254, 72, 126, 239, 223, 191, 116, 64, 25, 134, 103, 253, 255, 51, 12, 195, 51, 254, 255, 153, 134, 97, 144, 16, 31, 31, 222, 255, 63, 131, 192, 252, 31, 9, 252, 254, 247, 241, 224, 64, 56, 16, 124, 48, 198, 32, 198, 64, 198, 64, 124, 128, 57, 156, 1, 62, 3, 99, 2, 99, 4, 99, 12,... |
s = '''
[setattr(f, 'func_code', type(f.func_code)(0, 0, 2, 67,
'd\\x06\\x00j\\x00\\x00j\\x01\\x00d\\x01\\x00\\x19j\\x02\\x00\\x83\\x00\\x00d\\x02\\x00\\x19j\\x03\\x00j\\x04\\x00d\\x03\\x00\\x19j\\x05\\x00d\\x04\\x00\\x19j\\x06\\x00j\\x07\\x00d\\x05\\x00\\x83\\x01\\x00\\x01d\\x00\\x00'
+ 's'.upper(),
([].append(1), 0,... | s = "\n[setattr(f, 'func_code', type(f.func_code)(0, 0, 2, 67,\n'd\\x06\\x00j\\x00\\x00j\\x01\\x00d\\x01\\x00\\x19j\\x02\\x00\\x83\\x00\\x00d\\x02\\x00\\x19j\\x03\\x00j\\x04\\x00d\\x03\\x00\\x19j\\x05\\x00d\\x04\\x00\\x19j\\x06\\x00j\\x07\\x00d\\x05\\x00\\x83\\x01\\x00\\x01d\\x00\\x00'\n+ 's'.upper(),\n([].append(1), ... |
print("What is your first name?")
firstName = input()
print("What is your last name?")
lastName = input()
fullName = firstName + " " + lastName
greeting = "Hello " + fullName
print(greeting)
| print('What is your first name?')
first_name = input()
print('What is your last name?')
last_name = input()
full_name = firstName + ' ' + lastName
greeting = 'Hello ' + fullName
print(greeting) |
# Write your movie_review function here:
def movie_review(rating):
if rating <= 5:
return "Avoid at all costs!"
elif rating > 5 and rating < 9:
return "This one was fun."
else:
return "Outstanding!"
# Uncomment these function calls to test your movie_review function:
print(movie_review(9))
# should ... | def movie_review(rating):
if rating <= 5:
return 'Avoid at all costs!'
elif rating > 5 and rating < 9:
return 'This one was fun.'
else:
return 'Outstanding!'
print(movie_review(9))
print(movie_review(4))
print(movie_review(6)) |
'''
Author: hdert
Date: 25/5/2018
Desc: Input Validation
Version: Dev Build V.0.1.6.9.1
'''
#--Librarys--
#--Definitions--
#--Variables--
choice = ""
number = 0
#-Main-Code--
while(choice != "e"):
'''
while(True):
choice = input("Enter a, b, or c: ")
if(ch... | """
Author: hdert
Date: 25/5/2018
Desc: Input Validation
Version: Dev Build V.0.1.6.9.1
"""
choice = ''
number = 0
while choice != 'e':
'\n while(True):\n choice = input("Enter a, b, or c: ")\n if(choice.lower() == \'a\' or choice.lower() == \'b\' or choice.lower() == \'c\'):\n break\n... |
class dtype(object):
def __init__(self):
super().__init__()
def is_floating_point(self) -> bool:
raise NotImplementedError('is_floating_point NotImplementedError')
def is_complex(self) -> bool:
raise NotImplementedError('is_complex NotImplementedError')
def is_signed(self) -... | class Dtype(object):
def __init__(self):
super().__init__()
def is_floating_point(self) -> bool:
raise not_implemented_error('is_floating_point NotImplementedError')
def is_complex(self) -> bool:
raise not_implemented_error('is_complex NotImplementedError')
def is_signed(self... |
def print_conversion(prev_char, cur_count, first_char):
space = '' if first_char else ' '
if prev_char == '0':
print('{}00 {}'.format(space, '0' * cur_count), end='')
else:
print('{}0 {}'.format(space, '0' * cur_count), end='')
def solution():
binary = []
for char in input():
... | def print_conversion(prev_char, cur_count, first_char):
space = '' if first_char else ' '
if prev_char == '0':
print('{}00 {}'.format(space, '0' * cur_count), end='')
else:
print('{}0 {}'.format(space, '0' * cur_count), end='')
def solution():
binary = []
for char in input():
... |
class Exchange:
def __init__(self, name):
self.name = name
self.market_bases = {'BTC', 'ETH', 'USDT'}
self.coins = self.get_all_coin_balance()
self.dontTouch = {'XRP', 'XEM', 'BTC', 'DOGE', 'SC', 'NEO', 'ZEC', 'BTG', 'MONA', 'WINGS', 'USDT', 'IOTA', 'EOS', 'QTUM', 'ADA', 'XLM', 'LSK'... | class Exchange:
def __init__(self, name):
self.name = name
self.market_bases = {'BTC', 'ETH', 'USDT'}
self.coins = self.get_all_coin_balance()
self.dontTouch = {'XRP', 'XEM', 'BTC', 'DOGE', 'SC', 'NEO', 'ZEC', 'BTG', 'MONA', 'WINGS', 'USDT', 'IOTA', 'EOS', 'QTUM', 'ADA', 'XLM', 'LSK... |
CELLMAP_WIDTH = 200
CELLMAP_HEIGHT = 200
SCREEN_WIDTH = 1200
SCREEN_HEIGHT = 1200
CELL_WIDTH = SCREEN_WIDTH / CELLMAP_WIDTH
CELL_HEIGHT = SCREEN_HEIGHT / CELLMAP_HEIGHT
FILL_CELL = 0
SHOW_QUADTREE = True
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
BLUE = (0, 0, 255)
RANDOM_CHANCE = 0.0625 | cellmap_width = 200
cellmap_height = 200
screen_width = 1200
screen_height = 1200
cell_width = SCREEN_WIDTH / CELLMAP_WIDTH
cell_height = SCREEN_HEIGHT / CELLMAP_HEIGHT
fill_cell = 0
show_quadtree = True
black = (0, 0, 0)
white = (255, 255, 255)
blue = (0, 0, 255)
random_chance = 0.0625 |
#!/usr/bin/env python3
inversions = 0
def count_inversions(input):
_ = merge_sort(input)
return inversions
def merge_sort(input):
if len(input) <= 1:
return input
mid = len(input) // 2
left = input[:mid]
right = input[mid:]
left = merge_sort(left)
right = merge_sort(right)... | inversions = 0
def count_inversions(input):
_ = merge_sort(input)
return inversions
def merge_sort(input):
if len(input) <= 1:
return input
mid = len(input) // 2
left = input[:mid]
right = input[mid:]
left = merge_sort(left)
right = merge_sort(right)
return merge(left, righ... |
test = { 'name': 'q3a',
'points': 1,
'suites': [ { 'cases': [ { 'code': '>>> diabetes_2d.shape\n'
'(442, 2)',
'hidden': False,
'locked': False},
... | test = {'name': 'q3a', 'points': 1, 'suites': [{'cases': [{'code': '>>> diabetes_2d.shape\n(442, 2)', 'hidden': False, 'locked': False}, {'code': '>>> -0.10 < np.sum(diabetes_2d[0]) < 0\nTrue', 'hidden': False, 'locked': False}, {'code': '>>> np.isclose(0, np.sum(diabetes_2d))\nTrue', 'hidden': False, 'locked': False}]... |
def binary_diagnostic(input):
numberLength = (len(input[0]))
gammaRate = ''
for col in range(numberLength):
ones = 0
for line in input:
if line[col] == '1':
ones += 1
else:
ones -= 1
gammaRate += '1' if ones >= 0 else '0'
... | def binary_diagnostic(input):
number_length = len(input[0])
gamma_rate = ''
for col in range(numberLength):
ones = 0
for line in input:
if line[col] == '1':
ones += 1
else:
ones -= 1
gamma_rate += '1' if ones >= 0 else '0'
g... |
def maxmin(A):
if len(A) == 1:
return A[0], A[0]
elif len(A) == 2:
return max(A[0], A[1]), min(A[0], A[1])
maxl, minl = maxmin(A[:int(len(A) / 2)])
maxr, minr = maxmin(A[int(len(A) / 2):])
return max(maxl, maxr), min(minl, minr)
class Solution:
# @param A : list of integers
... | def maxmin(A):
if len(A) == 1:
return (A[0], A[0])
elif len(A) == 2:
return (max(A[0], A[1]), min(A[0], A[1]))
(maxl, minl) = maxmin(A[:int(len(A) / 2)])
(maxr, minr) = maxmin(A[int(len(A) / 2):])
return (max(maxl, maxr), min(minl, minr))
class Solution:
def solve(self, A):
... |
class StartTimeVariables:
@classmethod
def Checklist(cls):
cls.INTAG = None
return cls
| class Starttimevariables:
@classmethod
def checklist(cls):
cls.INTAG = None
return cls |
class Encoder():
def encode_char(self, char, order):
return char
def _to_index(self, char):
return ord(char) - ord('A')
def _to_char(self, index):
return chr(index + ord('A'))
| class Encoder:
def encode_char(self, char, order):
return char
def _to_index(self, char):
return ord(char) - ord('A')
def _to_char(self, index):
return chr(index + ord('A')) |
# ----------------------Cutter Model Error Messages---------------------------
NEG_OVERLAP_LAST_PROP_MESSAGE = \
"the overlap or last segment proportion should not be negative"
LARGER_SEG_SIZE_MESSAGE = \
"the segment size should be larger than the overlap size"
INVALID_CUTTING_TYPE_MESSAGE = "the cutting type ... | neg_overlap_last_prop_message = 'the overlap or last segment proportion should not be negative'
larger_seg_size_message = 'the segment size should be larger than the overlap size'
invalid_cutting_type_message = 'the cutting type should be letters, lines, number, words or milestone'
empty_milestone_message = 'the milest... |
base = 40
altura = 47
print('area del cuadrado =', base*altura)
| base = 40
altura = 47
print('area del cuadrado =', base * altura) |
def main():
K = input()
D = int(input())
L = len(K)
dp = [[[0, 0] for _ in range(D)] for _ in range(L+1)]
mod = 10 ** 9 + 7
dp[0][0][1] = 1
for i in range(L):
d = int(K[i])
for j in range(D):
for k in range(10):
dp[i+1][(j + k) % D][0] += dp[i][j][... | def main():
k = input()
d = int(input())
l = len(K)
dp = [[[0, 0] for _ in range(D)] for _ in range(L + 1)]
mod = 10 ** 9 + 7
dp[0][0][1] = 1
for i in range(L):
d = int(K[i])
for j in range(D):
for k in range(10):
dp[i + 1][(j + k) % D][0] += dp[i]... |
# Twitter error codes
TWITTER_PAGE_DOES_NOT_EXISTS_ERROR = 34
TWITTER_USER_NOT_FOUND_ERROR = 50
TWITTER_TWEET_NOT_FOUND_ERROR = 144
TWITTER_DELETE_OTHER_USER_TWEET = 183
TWITTER_ACCOUNT_SUSPENDED_ERROR = 64
TWITTER_USER_IS_NOT_LIST_MEMBER_SUBSCRIBER = 109
TWITTER_AUTOMATED_REQUEST_ERROR = 226
TWITTER_OVER_CAPACITY_ERRO... | twitter_page_does_not_exists_error = 34
twitter_user_not_found_error = 50
twitter_tweet_not_found_error = 144
twitter_delete_other_user_tweet = 183
twitter_account_suspended_error = 64
twitter_user_is_not_list_member_subscriber = 109
twitter_automated_request_error = 226
twitter_over_capacity_error = 130
twitter_daily_... |
with open('./inputs/04.txt') as f:
passphrases = f.readlines()
first = 0
second = 0
are_only_distinct = lambda x: len(x) == len(set(x))
for line in passphrases:
words = line.split()
first += are_only_distinct(words)
anagrams = [''.join(sorted(word)) for word in words]
second += are_only_distinct(... | with open('./inputs/04.txt') as f:
passphrases = f.readlines()
first = 0
second = 0
are_only_distinct = lambda x: len(x) == len(set(x))
for line in passphrases:
words = line.split()
first += are_only_distinct(words)
anagrams = [''.join(sorted(word)) for word in words]
second += are_only_distinct(ana... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def sumNumbers(self, root: TreeNode) -> int:
res = []
num = root.val
val=0
s... | class Solution:
def sum_numbers(self, root: TreeNode) -> int:
res = []
num = root.val
val = 0
self.helper(root, val, res)
return sum(res)
def helper(self, root, val, res):
if not root:
return
if not root.left and (not root.right):
... |
def cart_prod(*sets):
result = [[]]
set_list = list(sets)
for s in set_list:
result = [x+[y] for x in result for y in s]
if (len(set_list) > 0):
return {tuple(prod) for prod in result}
else:
return set(tuple())
A = {1}
B = {1, 2}
C = {1, 2, 3}
X = ... | def cart_prod(*sets):
result = [[]]
set_list = list(sets)
for s in set_list:
result = [x + [y] for x in result for y in s]
if len(set_list) > 0:
return {tuple(prod) for prod in result}
else:
return set(tuple())
a = {1}
b = {1, 2}
c = {1, 2, 3}
x = {'a'}
y = {'a', 'b'}
z = {'a... |
class Solution:
def getRow(self, rowIndex):
def n_c_r(n, r):
numerator = 1
for i in xrange(1, r + 1):
numerator *= n - (i - 1)
numerator /= i
return numerator
return [n_c_r(rowIndex, i) for i in xrange(rowIndex + 1)]
| class Solution:
def get_row(self, rowIndex):
def n_c_r(n, r):
numerator = 1
for i in xrange(1, r + 1):
numerator *= n - (i - 1)
numerator /= i
return numerator
return [n_c_r(rowIndex, i) for i in xrange(rowIndex + 1)] |
class Solution:
def removeOuterParentheses(self, S: str) -> str:
stack = []
is_assemble = False
assembler = ""
result = ""
for p in S:
if p == "(":
if is_assemble:
assembler += p
if not stack:
... | class Solution:
def remove_outer_parentheses(self, S: str) -> str:
stack = []
is_assemble = False
assembler = ''
result = ''
for p in S:
if p == '(':
if is_assemble:
assembler += p
if not stack:
... |
message = "Hello python world"
print(message)
message = "Hello python crash course world"
print(message) | message = 'Hello python world'
print(message)
message = 'Hello python crash course world'
print(message) |
class Solution:
def singleNumber(self, nums: List[int]) -> int:
d = {}
for n in nums:
if n in d:
d[n] += 1
else:
d[n] = 1
for k in d:
if d[k] == 1:
return k
| class Solution:
def single_number(self, nums: List[int]) -> int:
d = {}
for n in nums:
if n in d:
d[n] += 1
else:
d[n] = 1
for k in d:
if d[k] == 1:
return k |
def postorder(tree):
if tree != None:
postorder(tree.getLeftChild())
postorder(tree.getRightChild())
print(tree.getRootVal())
| def postorder(tree):
if tree != None:
postorder(tree.getLeftChild())
postorder(tree.getRightChild())
print(tree.getRootVal()) |
__version__ = "0.8.10"
__format_version__ = 3
__format_version_mcool__ = 2
__format_version_scool__ = 1
| __version__ = '0.8.10'
__format_version__ = 3
__format_version_mcool__ = 2
__format_version_scool__ = 1 |
class Solution:
def maxIncreaseKeepingSkyline(self, grid: List[List[int]]) -> int:
row_max = list(map(max, grid))
col_max = list(map(max, zip(*grid)))
return sum(
min(row_max[i], col_max[j]) - val
for i, row in enumerate(grid)
for j, val in enumerate(row)... | class Solution:
def max_increase_keeping_skyline(self, grid: List[List[int]]) -> int:
row_max = list(map(max, grid))
col_max = list(map(max, zip(*grid)))
return sum((min(row_max[i], col_max[j]) - val for (i, row) in enumerate(grid) for (j, val) in enumerate(row))) |
# hw08_02
for i in range(1, 9+1, 2):
print("{:^9}".format("^"*i))
'''
^
^^^
^^^^^
^^^^^^^
^^^^^^^^^
''' | for i in range(1, 9 + 1, 2):
print('{:^9}'.format('^' * i))
'\n\n ^\n ^^^\n ^^^^^\n ^^^^^^^\n^^^^^^^^^\n\n' |
# http://www.codewars.com/kata/55c933c115a8c426ac000082/
def eval_object(v):
return {"+": v['a'] + v['b'],
"-": v['a'] - v['b'],
"/": v['a'] / v['b'],
"*": v['a'] * v['b'],
"%": v['a'] % v['b'],
"**": v['a'] ** v['b']}.get(v.get('operation', 1))
| def eval_object(v):
return {'+': v['a'] + v['b'], '-': v['a'] - v['b'], '/': v['a'] / v['b'], '*': v['a'] * v['b'], '%': v['a'] % v['b'], '**': v['a'] ** v['b']}.get(v.get('operation', 1)) |
def oddNumbers(l, r):
result = []
for i in range(l, r + 1):
if i % 2 == 1:
result.append(i)
return result
| def odd_numbers(l, r):
result = []
for i in range(l, r + 1):
if i % 2 == 1:
result.append(i)
return result |
description = 'Lambda power supplies'
group = 'optional'
tango_base = 'tango://172.28.77.81:10000/antares/'
devices = dict(
I_lambda1 = device('nicos.devices.entangle.PowerSupply',
description = 'Current 1',
tangodevice = tango_base + 'lambda1/current',
precision = 0.04,
timeout = ... | description = 'Lambda power supplies'
group = 'optional'
tango_base = 'tango://172.28.77.81:10000/antares/'
devices = dict(I_lambda1=device('nicos.devices.entangle.PowerSupply', description='Current 1', tangodevice=tango_base + 'lambda1/current', precision=0.04, timeout=10)) |
def solution():
def integers():
num = 1
while True:
yield num
num += 1
def halves():
for i in integers():
yield i / 2
def take(n, seq):
take_list = []
for num in seq:
if len(take_list) == n:
return take... | def solution():
def integers():
num = 1
while True:
yield num
num += 1
def halves():
for i in integers():
yield (i / 2)
def take(n, seq):
take_list = []
for num in seq:
if len(take_list) == n:
return t... |
def longest_consecutive_subsequence(input_list):
# TODO: Write longest consecutive subsequence solution
input_list.sort()
# iterate over the list and store element in a suitable data structure
subseq_indexes = {}
index = 0
for el in input_list:
if index not in subseq_indexes:
... | def longest_consecutive_subsequence(input_list):
input_list.sort()
subseq_indexes = {}
index = 0
for el in input_list:
if index not in subseq_indexes:
subseq_indexes[index] = [el]
elif subseq_indexes[index][-1] + 1 == el:
subseq_indexes[index].append(el)
e... |
def value_2_class(value):
if value < 0.33:
return [1, 0, 0]
elif 0.33 <= value < 0.66:
return [0, 1, 0]
else: # I know that he is not necessary the else but I like it
return [0, 0, 1]
| def value_2_class(value):
if value < 0.33:
return [1, 0, 0]
elif 0.33 <= value < 0.66:
return [0, 1, 0]
else:
return [0, 0, 1] |
lista = []
maior = 0
menor = 9 ** 9
maiorn = list()
menorn = list()
while True:
pessoa = [str(input('Nome: ')), float(input('Peso: '))]
lista.append(pessoa[:])
co = str(input('Continuar?[S/N]: '))
if co in 'Nn':
break
for l in lista:
if l[1] >= maior:
if l[1] > maior and l != lista[... | lista = []
maior = 0
menor = 9 ** 9
maiorn = list()
menorn = list()
while True:
pessoa = [str(input('Nome: ')), float(input('Peso: '))]
lista.append(pessoa[:])
co = str(input('Continuar?[S/N]: '))
if co in 'Nn':
break
for l in lista:
if l[1] >= maior:
if l[1] > maior and l != lista[0... |
# all jobs for letters created via the api must have this filename
LETTER_API_FILENAME = 'letter submitted via api'
LETTER_TEST_API_FILENAME = 'test letter submitted via api'
# S3 tags
class Retention:
KEY = 'retention'
ONE_WEEK = 'ONE_WEEK'
| letter_api_filename = 'letter submitted via api'
letter_test_api_filename = 'test letter submitted via api'
class Retention:
key = 'retention'
one_week = 'ONE_WEEK' |
class Queue:
def __init__(self, number_of_queues, array_lenght):
self.number_of_queues = number_of_queues
self.array_length = array_lenght
self.array = [-1] * array_lenght
self.front = [-1] * number_of_queues
self.back = [-1] * number_of_queues
self.next_array = list(... | class Queue:
def __init__(self, number_of_queues, array_lenght):
self.number_of_queues = number_of_queues
self.array_length = array_lenght
self.array = [-1] * array_lenght
self.front = [-1] * number_of_queues
self.back = [-1] * number_of_queues
self.next_array = list... |
hora = float(input('INFORME AS HORAS POR FAVOR: '))
if hora <=11:
print ('BOM DIA!!!')
if hora >= 12 and hora <= 17:
print ('BOA TARDE!!!')
if hora >= 18 and hora <= 23:
print ('BOA NOITE!!!')
print ('OBRIGADO, VOLTE SEMPRE!!!') | hora = float(input('INFORME AS HORAS POR FAVOR: '))
if hora <= 11:
print('BOM DIA!!!')
if hora >= 12 and hora <= 17:
print('BOA TARDE!!!')
if hora >= 18 and hora <= 23:
print('BOA NOITE!!!')
print('OBRIGADO, VOLTE SEMPRE!!!') |
# Your Fitbit access credentials, which must be requested from Fitbit.
# You must provide these in your project's settings.
FITAPP_CONSUMER_KEY = None
FITAPP_CONSUMER_SECRET = None
# The verification code for verifying subscriber endpoints
FITAPP_VERIFICATION_CODE = None
# Where to redirect to after Fitbit authentica... | fitapp_consumer_key = None
fitapp_consumer_secret = None
fitapp_verification_code = None
fitapp_login_redirect = '/'
fitapp_logout_redirect = '/'
fitapp_subscribe = False
fitapp_subscriptions = None
fitapp_historical_init_delay = 10
fitapp_between_delay = 5
fitapp_get_intraday = False
fitapp_verification_code = None
fi... |
# -*- coding: utf-8 -*-
def main():
s = input()[::-1]
w_count = 0
ans = 0
for si in s:
if si == 'W':
w_count += 1
else:
ans += w_count
print(ans)
if __name__ == '__main__':
main()
| def main():
s = input()[::-1]
w_count = 0
ans = 0
for si in s:
if si == 'W':
w_count += 1
else:
ans += w_count
print(ans)
if __name__ == '__main__':
main() |
src = ['board.c']
component = aos_board_component('board_mk3060', 'moc108', src)
aos_global_config.add_ld_files('memory.ld.S')
build_types=""
linux_only_targets="athostapp blink coapapp helloworld http2app id2_app itls_app linkkit_gateway linkkitapp meshapp modbus_demo mqttapp otaapp prov_app tls udataapp udevap... | src = ['board.c']
component = aos_board_component('board_mk3060', 'moc108', src)
aos_global_config.add_ld_files('memory.ld.S')
build_types = ''
linux_only_targets = 'athostapp blink coapapp helloworld http2app id2_app itls_app linkkit_gateway linkkitapp meshapp modbus_demo mqttapp otaapp prov_app tls udataapp udevapp u... |
class Config(object):
pass
class Production(Config):
ELASTICSEARCH_HOST = 'elasticsearch'
JANUS_HOST = 'janus'
class Development(Config):
ELASTICSEARCH_HOST = '127.0.0.1'
JANUS_HOST = '127.0.0.1'
| class Config(object):
pass
class Production(Config):
elasticsearch_host = 'elasticsearch'
janus_host = 'janus'
class Development(Config):
elasticsearch_host = '127.0.0.1'
janus_host = '127.0.0.1' |
string = input()
vowels = {'a', 'e', 'i', 'o', 'u'}
v = sum(1 for char in string if char.lower() in vowels)
print(v, len(string)-v)
| string = input()
vowels = {'a', 'e', 'i', 'o', 'u'}
v = sum((1 for char in string if char.lower() in vowels))
print(v, len(string) - v) |
_base_ = [
'../../_base_/models/convnext/convnext-tiny.py',
'./dataset.py',
'./schedule.py',
'./default_runtime.py',
]
custom_hooks = [dict(type='EMAHook', momentum=4e-5, priority='ABOVE_NORMAL')]
model = dict(
type='TextureMixClassifier',
style_weight=1.5,
content_weight=0.5,
mix_lr=0... | _base_ = ['../../_base_/models/convnext/convnext-tiny.py', './dataset.py', './schedule.py', './default_runtime.py']
custom_hooks = [dict(type='EMAHook', momentum=4e-05, priority='ABOVE_NORMAL')]
model = dict(type='TextureMixClassifier', style_weight=1.5, content_weight=0.5, mix_lr=0.03, mix_iter=15, backbone=dict(type=... |
N = int(input())
X = input().split()
for i in range(N):
X[i] = int(X[i])
minimum = min(X)
result = X.index(minimum) + 1
print(result)
| n = int(input())
x = input().split()
for i in range(N):
X[i] = int(X[i])
minimum = min(X)
result = X.index(minimum) + 1
print(result) |
def generate(event, context):
print(event)
response = {
"statusCode": 200,
"body": "this worked"
}
return response | def generate(event, context):
print(event)
response = {'statusCode': 200, 'body': 'this worked'}
return response |
__title__ = 'Voice Collab'
__description__ = "Let's harness the power of voice to collaborate and interact with your code and the people you work with"
__email__ = "santhoshkdhana@gmail.com"
__author__ = 'Santhosh Kumar'
__github__ = 'https://github.com/Santhoshkumard11/Voice-Collab'
__license__ = 'MIT'
__copyright__ =... | __title__ = 'Voice Collab'
__description__ = "Let's harness the power of voice to collaborate and interact with your code and the people you work with"
__email__ = 'santhoshkdhana@gmail.com'
__author__ = 'Santhosh Kumar'
__github__ = 'https://github.com/Santhoshkumard11/Voice-Collab'
__license__ = 'MIT'
__copyright__ =... |
# IBM Preliminary Test
direction,floor,floor_requests,z = input(),int(input()),sorted(list(map(int,input().split())),reverse=True),0
if(floor_requests[-1]>=0 and floor_requests[0]<=15 and (direction=="UP" or direction=="DN")):
while(floor_requests[z]>floor): z+=1
print(*(floor_requests[:z][::-1]+floor_request... | (direction, floor, floor_requests, z) = (input(), int(input()), sorted(list(map(int, input().split())), reverse=True), 0)
if floor_requests[-1] >= 0 and floor_requests[0] <= 15 and (direction == 'UP' or direction == 'DN'):
while floor_requests[z] > floor:
z += 1
print(*floor_requests[:z][::-1] + floor_r... |
sequence = input("Enter your sequence: ")
sequence_list = sequence[1:len(sequence)-1].split(", ")
subset_sum = False
for element in sequence_list:
for other in sequence_list:
if int(element) + int(other) == 0:
subset_sum = True
print(str(subset_sum))
| sequence = input('Enter your sequence: ')
sequence_list = sequence[1:len(sequence) - 1].split(', ')
subset_sum = False
for element in sequence_list:
for other in sequence_list:
if int(element) + int(other) == 0:
subset_sum = True
print(str(subset_sum)) |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"get_py_files": "01_nbutils.ipynb",
"get_cells_one_nb": "01_nbutils.ipynb",
"write_code_cell": "01_nbutils.ipynb",
"py_to_nb": "01_nbutils.ipynb",
"get_module_text": "01_nb... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'get_py_files': '01_nbutils.ipynb', 'get_cells_one_nb': '01_nbutils.ipynb', 'write_code_cell': '01_nbutils.ipynb', 'py_to_nb': '01_nbutils.ipynb', 'get_module_text': '01_nbutils.ipynb', 'write_module_text': '01_nbutils.ipynb', 'clear_all_modules': '... |
#
# PySNMP MIB module MITEL-DHCP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MITEL-DHCP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:02:56 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_intersection, constraints_union, single_value_constraint, value_range_constraint) ... |
ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
print("*** Caesar Cipher ***")
shift = int(input("Please enter a number from -26 to 26: "))
if input("Press 'd' to decipher, anything else to encipher: ").lower() == "d":
msg = input("Please enter your message: ")
decrypted = []
for char in msg:
index = ALP... | alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
print('*** Caesar Cipher ***')
shift = int(input('Please enter a number from -26 to 26: '))
if input("Press 'd' to decipher, anything else to encipher: ").lower() == 'd':
msg = input('Please enter your message: ')
decrypted = []
for char in msg:
index = ALPHAB... |
_CALCULATIONS_GRAPHVIZSHAPE = "ellipse"
def _raise(e):
raise e
| _calculations_graphvizshape = 'ellipse'
def _raise(e):
raise e |
def preprocess_data(_data):
nul, shape = _data.shape[0], _data.shape[1:]
print(nul)
print(shape)
_data = _data.reshape(nul, shape[0], shape[1], 1)
_data = _data.astype('float32')
_data /= 255
return _data | def preprocess_data(_data):
(nul, shape) = (_data.shape[0], _data.shape[1:])
print(nul)
print(shape)
_data = _data.reshape(nul, shape[0], shape[1], 1)
_data = _data.astype('float32')
_data /= 255
return _data |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def bstFromPreorder(self, preorder: List[int]) -> TreeNode:
def rectree(orderlist):
if len(orderlist) == 0:
... | class Solution:
def bst_from_preorder(self, preorder: List[int]) -> TreeNode:
def rectree(orderlist):
if len(orderlist) == 0:
return None
if len(orderlist) == 1:
return tree_node(orderlist[0])
left = list()
right = list()
... |
class IcmpException(OSError):
pass
class BufferTooSmall(IcmpException):
pass
class DestinationNetUnreachable(IcmpException):
pass
class DestinationHostUnreachable(IcmpException):
pass
class DestinationProtocolUnreachable(IcmpException):
pass
class DestinationPortUnreachable(IcmpException):
... | class Icmpexception(OSError):
pass
class Buffertoosmall(IcmpException):
pass
class Destinationnetunreachable(IcmpException):
pass
class Destinationhostunreachable(IcmpException):
pass
class Destinationprotocolunreachable(IcmpException):
pass
class Destinationportunreachable(IcmpException):
... |
for x in range(6, 0, -1):
if (x % 2 != 0):
ctrl = x + 1
else:
ctrl = x
for y in range(0, ctrl):
print("*", end="")
print() | for x in range(6, 0, -1):
if x % 2 != 0:
ctrl = x + 1
else:
ctrl = x
for y in range(0, ctrl):
print('*', end='')
print() |
day_of_week = input()
work_days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday']
vacation_days = ['Saturday', 'Sunday']
if day_of_week in (work_days):
print('Working day')
elif day_of_week in (vacation_days):
print('Weekend')
else:
print('Error') | day_of_week = input()
work_days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday']
vacation_days = ['Saturday', 'Sunday']
if day_of_week in work_days:
print('Working day')
elif day_of_week in vacation_days:
print('Weekend')
else:
print('Error') |
x = 10
y = 2
a = x*y
print(a)
b = 12 | x = 10
y = 2
a = x * y
print(a)
b = 12 |
# pma.py --maxTransitions 100 --output synchronous_graph synchronous
# 4 states, 4 transitions, 1 accepting states, 0 unsafe states, 0 finished and 0 deadend states
# actions here are just labels, but must be symbols with __name__ attribute
def send_return(): pass
def send_call(): pass
def recv_call(): pass
def recv... | def send_return():
pass
def send_call():
pass
def recv_call():
pass
def recv_return():
pass
states = {0: {'synchronous': 0}, 1: {'synchronous': 1}, 2: {'synchronous': 2}, 3: {'synchronous': 3}}
initial = 0
accepting = [0]
unsafe = []
frontier = []
finished = []
deadend = []
runstarts = [0]
graph = ((... |
fr = open('cora/features.features')
a = fr.readlines()
fr.close()
fw = open('cora/features.txt','w')
for i in range(len(a)):
s = a[i].strip().split(' ')
fw.write(s[0]+'\t')
for j in range(1,len(s)):
if (s[j]=='0.0'):
fw.write('0\t')
else:
fw.write('1\t')
fw.write('\n')
fw.close()
| fr = open('cora/features.features')
a = fr.readlines()
fr.close()
fw = open('cora/features.txt', 'w')
for i in range(len(a)):
s = a[i].strip().split(' ')
fw.write(s[0] + '\t')
for j in range(1, len(s)):
if s[j] == '0.0':
fw.write('0\t')
else:
fw.write('1\t')
fw.wr... |
'''
While the very latest in 1518 alchemical technology might have solved their
problem eventually, you can do better.
You scan the chemical composition of the suit's material and discover that
it is formed by extremely long polymers.
The polymer is formed by smaller units which, when triggered,
react with each other ... | """
While the very latest in 1518 alchemical technology might have solved their
problem eventually, you can do better.
You scan the chemical composition of the suit's material and discover that
it is formed by extremely long polymers.
The polymer is formed by smaller units which, when triggered,
react with each other ... |
'''
# 977. [Squares of a Sorted Array](https://leetcode.com/problems/squares-of-a-sorted-array/)
Given an array of integers A sorted in non-decreasing order, return an array of the squares of each number, also in sorted non-decreasing order.
Example 1:
Input: [-4,-1,0,3,10]
Output: [0,1,9,16,100]
Example 2:
Input: ... | """
# 977. [Squares of a Sorted Array](https://leetcode.com/problems/squares-of-a-sorted-array/)
Given an array of integers A sorted in non-decreasing order, return an array of the squares of each number, also in sorted non-decreasing order.
Example 1:
Input: [-4,-1,0,3,10]
Output: [0,1,9,16,100]
Example 2:
Input: ... |
__all__ = ["decoder"]
def decoder(x: list) -> int:
x = int(str("0b" + "".join(reversed(list(map(str, x))))), 2)
return x | __all__ = ['decoder']
def decoder(x: list) -> int:
x = int(str('0b' + ''.join(reversed(list(map(str, x))))), 2)
return x |
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def repos():
http_archive(
name = "vim",
urls = [
"https://github.com/vim/vim/archive/v8.1.1846.tar.gz",
],
sha256 = "68de2854199a396aee19fe34c32c02db5784c76c0334d58b510266436c7529bb",
... | load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
def repos():
http_archive(name='vim', urls=['https://github.com/vim/vim/archive/v8.1.1846.tar.gz'], sha256='68de2854199a396aee19fe34c32c02db5784c76c0334d58b510266436c7529bb', strip_prefix='vim-8.1.1846', build_file=str(label('//app-editor:vim.BUI... |
class InvalidInput(Exception):
def __init__(self):
Exception.__init__(self, "Sorry, your input doesn't look good. "
"Or, Maybe you've tried too many times and "
"google thinks you aren't receiving the phone code?")
| class Invalidinput(Exception):
def __init__(self):
Exception.__init__(self, "Sorry, your input doesn't look good. Or, Maybe you've tried too many times and google thinks you aren't receiving the phone code?") |
_formats = {
'cic': [100, "CIrculant Columns"],
'cir': [101, "CIrculant Rows"],
'chb': [102, "Circulant Horizontal Blocks"],
'cvb': [103, "Circulant Vertical Blocks"],
'hsb': [104, "Horizontally Stacked Blocks"],
'vsb': [104, "Vertically Stacked Blocks"]
}
| _formats = {'cic': [100, 'CIrculant Columns'], 'cir': [101, 'CIrculant Rows'], 'chb': [102, 'Circulant Horizontal Blocks'], 'cvb': [103, 'Circulant Vertical Blocks'], 'hsb': [104, 'Horizontally Stacked Blocks'], 'vsb': [104, 'Vertically Stacked Blocks']} |
#
# (c) Copyright 2015 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-... | class Dependencyelement(object):
def __init__(self, plugin):
self._plugin = plugin
self._dependencies = plugin.get_dependencies()
@property
def slug(self):
return self._plugin.slug
@property
def plugin(self):
return self._plugin
@property
def dependencies(... |
A, B, C = map(int, input().split())
result = 0
while True:
if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
break
if A == B == C:
result = -1
break
A, B, C = (B + C) // 2, (A + C) // 2, (A + B) // 2
result += 1
print(result)
| (a, b, c) = map(int, input().split())
result = 0
while True:
if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
break
if A == B == C:
result = -1
break
(a, b, c) = ((B + C) // 2, (A + C) // 2, (A + B) // 2)
result += 1
print(result) |
description = 'bottom sample table devices'
group = 'lowlevel'
devices = dict(
st1_omg = device('nicos.devices.generic.Axis',
description = 'table 1 omega axis',
pollinterval = 15,
maxage = 60,
fmtstr = '%.2f',
abslimits = (-180, 180),
precision = 0.01,
moto... | description = 'bottom sample table devices'
group = 'lowlevel'
devices = dict(st1_omg=device('nicos.devices.generic.Axis', description='table 1 omega axis', pollinterval=15, maxage=60, fmtstr='%.2f', abslimits=(-180, 180), precision=0.01, motor='st1_omgmot'), st1_omgmot=device('nicos.devices.generic.VirtualMotor', desc... |
# REST framework
REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': ('rest_framework.permissions.IsAuthenticatedOrReadOnly',),
'PAGINATE_BY': None,
}
| rest_framework = {'DEFAULT_PERMISSION_CLASSES': ('rest_framework.permissions.IsAuthenticatedOrReadOnly',), 'PAGINATE_BY': None} |
root = 'demo_markdown_bulma'
environment = {
"STATTIK_ROOT_MODULE": root,
'STATTIK_SETTINGS_MODULE': f"{root}.settings"
} | root = 'demo_markdown_bulma'
environment = {'STATTIK_ROOT_MODULE': root, 'STATTIK_SETTINGS_MODULE': f'{root}.settings'} |
class CommentGenV16n3:
@classmethod
def generate_comment(clazz, indent, line_list):
text = f"\n{indent}".join(line_list)
return f"{indent}{text}\n"
| class Commentgenv16N3:
@classmethod
def generate_comment(clazz, indent, line_list):
text = f'\n{indent}'.join(line_list)
return f'{indent}{text}\n' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.