content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
st=input()
k=list(st)
print(k)
def equal(s):
n=len(s)
sh=0
tr=0
for i in s:
if(i=='s'):
sh+=1
if(i=='t'):
tr+=1
if(sh==tr):
return 1
else:
return 0
def equal_s_t(st):
maxi=0
n=len(st)
for i in range(n):
for j in range(i,n):
if(equal(st[i:j+1])... | st = input()
k = list(st)
print(k)
def equal(s):
n = len(s)
sh = 0
tr = 0
for i in s:
if i == 's':
sh += 1
if i == 't':
tr += 1
if sh == tr:
return 1
else:
return 0
def equal_s_t(st):
maxi = 0
n = len(st)
for i in range(n):
... |
def linha():
print()
print('=' * 80)
print()
linha()
num = 0
soma = 0
cont = 0
while not num == 999:
num = int(input('Valor: '))
if num != 999:
soma += num
cont += 1
print()
print(f'Valores digitados: {cont}')
print(f'Soma dos valores: {soma}')
linha()
| def linha():
print()
print('=' * 80)
print()
linha()
num = 0
soma = 0
cont = 0
while not num == 999:
num = int(input('Valor: '))
if num != 999:
soma += num
cont += 1
print()
print(f'Valores digitados: {cont}')
print(f'Soma dos valores: {soma}')
linha() |
CDNX_POS_PERMISSIONS = {
'operator': [
'list_subcategory',
'list_productfinal',
'list_productfinaloption',
],
}
| cdnx_pos_permissions = {'operator': ['list_subcategory', 'list_productfinal', 'list_productfinaloption']} |
#!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2020 FABRIC Testbed
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to ... | class Configurationmapping:
def __init__(self):
self.type = None
self.class_name = None
self.properties = None
self.module_name = None
def __getstate__(self):
state = self.__dict__.copy()
return state
def __setstate__(self, state):
self.__dict__.upd... |
#!/usr/bin/python3
def multiple_returns(sentence):
if len(sentence) == 0:
return (0, None)
return (len(sentence), sentence[0])
| def multiple_returns(sentence):
if len(sentence) == 0:
return (0, None)
return (len(sentence), sentence[0]) |
#Instructions
#Create an empty list named misspelled_words.
#Write a for loop that:
#iterates over tokenized_story,
#uses an if statement that returns True if the current token is not in tokenized_vocabulary and if so, appends the current token to misspelled_words.
#Print misspelled_words.
#In this code, we're going t... | def clean_text(text_string, special_characters):
cleaned_string = text_string
for string in special_characters:
cleaned_string = cleaned_string.replace(string, '')
cleaned_string = cleaned_string.lower()
return cleaned_string
def tokenize(text_string, special_characters):
cleaned_story = cl... |
def escreva(texto):
print('~' * (len(texto) + 4))
print(f' {texto}')
print('~' * (len(texto) + 4))
# Programa Principal
text = str(input('Digite: '))
escreva(text)
escreva('Gustavo Guanabara')
escreva('Curso de Python no Youtube')
escreva('CeV')
| def escreva(texto):
print('~' * (len(texto) + 4))
print(f' {texto}')
print('~' * (len(texto) + 4))
text = str(input('Digite: '))
escreva(text)
escreva('Gustavo Guanabara')
escreva('Curso de Python no Youtube')
escreva('CeV') |
# generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/home/shams3049/catkin_ws/install/include;/usr/local/cuda-9.0/include".split(';') if "/home/shams3049/catkin_ws/install/include;/usr/local/cuda-9.0/include" != "" else []
PROJECT_CATKIN_DEPENDS = "".re... | catkin_package_prefix = ''
project_pkg_config_include_dirs = '/home/shams3049/catkin_ws/install/include;/usr/local/cuda-9.0/include'.split(';') if '/home/shams3049/catkin_ws/install/include;/usr/local/cuda-9.0/include' != '' else []
project_catkin_depends = ''.replace(';', ' ')
pkg_config_libraries_with_prefix = '-lkin... |
'''
.remove(x)
This operation removes element from the set.
If element does not exist, it raises a KeyError.
The .remove(x) operation returns None.
Example
>>> s = set([1, 2, 3, 4, 5, 6, 7, 8, 9])
>>> s.remove(5)
>>> print s
set([1, 2, 3, 4, 6, 7, 8, 9])
>>> print s.remove(4)
None
>>> print s
set([1, 2, 3, 6, 7, 8... | """
.remove(x)
This operation removes element from the set.
If element does not exist, it raises a KeyError.
The .remove(x) operation returns None.
Example
>>> s = set([1, 2, 3, 4, 5, 6, 7, 8, 9])
>>> s.remove(5)
>>> print s
set([1, 2, 3, 4, 6, 7, 8, 9])
>>> print s.remove(4)
None
>>> print s
set([1, 2, 3, 6, 7, 8... |
ERR_SUCCESSFUL = 0
ERR_AUTHENTICATION_FAILED = 1
ERR_DUPLICATE_MODEL = 2
ERR_DOT_NOT_EXIST = 3
ERR_PERMISSION_DENIED = 4
ERR_INVALID_CREDENTIALS = 5
ERR_AUTHENTICATION_FAILED = 6
ERR_USER_IS_INACTIVE = 7
ERR_NOT_AUTHENTICATED = 8
ERR_INPUT_VALIDATION = 9
ERR_PARSE = 10
ERR_UNSUPPORTED_MEDIA = 11
ERR_METHOD_NOT_ALLOWED ... | err_successful = 0
err_authentication_failed = 1
err_duplicate_model = 2
err_dot_not_exist = 3
err_permission_denied = 4
err_invalid_credentials = 5
err_authentication_failed = 6
err_user_is_inactive = 7
err_not_authenticated = 8
err_input_validation = 9
err_parse = 10
err_unsupported_media = 11
err_method_not_allowed ... |
# Bottom-Up Dynamic Programming (Tabulation)
class Solution:
def minCostClimbingStairs(self, cost: list[int]) -> int:
# The array's length should be 1 longer than the length of cost
# This is because we can treat the "top floor" as a step to reach
minimum_cost = [0] * (len(cost) + 1)
... | class Solution:
def min_cost_climbing_stairs(self, cost: list[int]) -> int:
minimum_cost = [0] * (len(cost) + 1)
for i in range(2, len(cost) + 1):
take_one_step = minimum_cost[i - 1] + cost[i - 1]
take_two_steps = minimum_cost[i - 2] + cost[i - 2]
minimum_cost[i]... |
nterms = int(input())
n1=0
n2=1
count=0
if nterms <= 0:
print("please enter a positive integer")
elif nterms==1:
print("Fibonacci sequence upto",nterms,":")
print(n1)
else:
print("Fibonacci sequence:")
while count < nterms:
print(n1)
nth=n1+n2
n1=n2
n2=nth
co... | nterms = int(input())
n1 = 0
n2 = 1
count = 0
if nterms <= 0:
print('please enter a positive integer')
elif nterms == 1:
print('Fibonacci sequence upto', nterms, ':')
print(n1)
else:
print('Fibonacci sequence:')
while count < nterms:
print(n1)
nth = n1 + n2
n1 = n2
n2... |
def load(h):
return ({'abbr': 0,
'code': 0,
'title': 'Parcel lifted index (to 500 hPa)',
'units': 'K'},
{'abbr': 1,
'code': 1,
'title': 'Best lifted index (to 500 hPa)',
'units': 'K'},
{'abbr': 2, 'code': 2, 'title... | def load(h):
return ({'abbr': 0, 'code': 0, 'title': 'Parcel lifted index (to 500 hPa)', 'units': 'K'}, {'abbr': 1, 'code': 1, 'title': 'Best lifted index (to 500 hPa)', 'units': 'K'}, {'abbr': 2, 'code': 2, 'title': 'K index', 'units': 'K'}, {'abbr': 3, 'code': 3, 'title': 'KO index', 'units': 'K'}, {'abbr': 4, 'c... |
# channel.py
# ~~~~~~~~~
# This module implements the Channel class.
# :authors: Justin Karneges, Konstantin Bokarius.
# :copyright: (c) 2015 by Fanout, Inc.
# :license: MIT, see LICENSE for more details.
# The Channel class is used to represent a channel in a GRIP proxy and
# tracks the previous ID ... | class Channel(object):
def __init__(self, name, prev_id=None):
self.name = name
self.prev_id = prev_id
self.filters = [] |
def main():
st = input("")
print(min(st))
main()
| def main():
st = input('')
print(min(st))
main() |
def sum_of_digits(digits) -> str:
if not str(digits).isdecimal():
return ''
else:
return f'{" + ".join([i for i in str(digits)])} = {sum([int(i) for i in str(digits)])}'
| def sum_of_digits(digits) -> str:
if not str(digits).isdecimal():
return ''
else:
return f"{' + '.join([i for i in str(digits)])} = {sum([int(i) for i in str(digits)])}" |
str = 'Hello World!'
print(str) # Prints complete string
print(str[0]) # Prints first character of the string
print(str[2:5]) # Prints characters starting from 3rd to 5th
print(str[2:]) # Prints string starting from 3rd character
print(str * 2) # Prints string two times
print(str + "TEST") ... | str = 'Hello World!'
print(str)
print(str[0])
print(str[2:5])
print(str[2:])
print(str * 2)
print(str + 'TEST') |
#D&D D12 die with 12 pentagonal faces
af = 7
textH = 2
textD = 0.3
faces = {"1":(0,0), "2":(60,72), "3":(60,72*2), "4":(60,72*3), "5":(60,72*4), "6":(60,0),
"C":(180,0),"B":(120,72*3+36),"A":(120,72*4+36),"9":(120,36),"8":(120,72+36),"7":(120,72*2+36)}
a = cq.Workplane("XY").sphere(5)
for ... | af = 7
text_h = 2
text_d = 0.3
faces = {'1': (0, 0), '2': (60, 72), '3': (60, 72 * 2), '4': (60, 72 * 3), '5': (60, 72 * 4), '6': (60, 0), 'C': (180, 0), 'B': (120, 72 * 3 + 36), 'A': (120, 72 * 4 + 36), '9': (120, 36), '8': (120, 72 + 36), '7': (120, 72 * 2 + 36)}
a = cq.Workplane('XY').sphere(5)
for k in faces.keys()... |
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# ! Please change the following two path strings to you own one !
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ELINA_PYTHON_INTERFACE_PATH = '/home/xxxxx/pkgs/ELINA/python_interface'
DEEPG_CODE_PATH = '/home/xxxxx/pkgs/deepg/code'
... | elina_python_interface_path = '/home/xxxxx/pkgs/ELINA/python_interface'
deepg_code_path = '/home/xxxxx/pkgs/deepg/code'
norm_types = ['0', '1', '2', 'inf']
datasets = ['imagenet', 'cifar10', 'mnist']
method_list = ['Clean', 'PGD', 'CW', 'MILP', 'FastMILP', 'PercySDP', 'FazlybSDP', 'AI2', 'RefineZono', 'LPAll', 'kReLU',... |
def FlagsForFile( filename ):
return { 'flags': [
'-Wall',
'-Wextra',
'-Werror',
'-std=c++11',
'-x', 'c++',
'-isystem', '/usr/include/c++/10',
'-isystem', '/usr/include/c++/10/backward',
'-isystem', '/usr/local/include',
'-isystem', '/usr/include',
] }
| def flags_for_file(filename):
return {'flags': ['-Wall', '-Wextra', '-Werror', '-std=c++11', '-x', 'c++', '-isystem', '/usr/include/c++/10', '-isystem', '/usr/include/c++/10/backward', '-isystem', '/usr/local/include', '-isystem', '/usr/include']} |
def increaseNumberRoundness(n):
gotToSignificant = False
while n > 0:
if n % 10 == 0 and gotToSignificant:
return True
elif n % 10 != 0:
gotToSignificant = True
n /= 10
return False
| def increase_number_roundness(n):
got_to_significant = False
while n > 0:
if n % 10 == 0 and gotToSignificant:
return True
elif n % 10 != 0:
got_to_significant = True
n /= 10
return False |
fname = input('please enter a file name: ')
fhand = open('romeo.txt')
new_list = list()
for line in fhand:
word = line.split()
for element in word:
if element not in new_list:
new_list.append(element)
new_list.sort()
print(new_list)
| fname = input('please enter a file name: ')
fhand = open('romeo.txt')
new_list = list()
for line in fhand:
word = line.split()
for element in word:
if element not in new_list:
new_list.append(element)
new_list.sort()
print(new_list) |
# Copyright 2015-2018 Camptocamp SA, Damien Crier
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Colorize field in tree views",
"summary": "Allows you to dynamically color fields on tree views",
"category": "Hidden/Dependency",
"version": "14.0.1.0.0",
"depends": ["w... | {'name': 'Colorize field in tree views', 'summary': 'Allows you to dynamically color fields on tree views', 'category': 'Hidden/Dependency', 'version': '14.0.1.0.0', 'depends': ['web'], 'author': 'Camptocamp, Therp BV, Odoo Community Association (OCA)', 'license': 'AGPL-3', 'website': 'https://github.com/OCA/web', 'dem... |
# EDA: Target - Q1
print("Number of unique cities in the data set:\n", df_tar['Target City'].nunique())
print("---------------------------------------")
most_frequent_cities = df_tar['Target City'].value_counts().sort_values(ascending=False)[:15]
print("Most frequent cities:\n", most_frequent_cities)
print("----------... | print('Number of unique cities in the data set:\n', df_tar['Target City'].nunique())
print('---------------------------------------')
most_frequent_cities = df_tar['Target City'].value_counts().sort_values(ascending=False)[:15]
print('Most frequent cities:\n', most_frequent_cities)
print('------------------------------... |
class ScreenIdError(ValueError):
pass
class UssdNamespaceError(RuntimeError):
pass | class Screeniderror(ValueError):
pass
class Ussdnamespaceerror(RuntimeError):
pass |
def matchParenthesis(string):
parenthesis = 0
brackets = 0
curlyBrackets = 0
for i in range(len(string)):
l = string[i]
if l == '(':
if i > 0:
if not string[i-1] == ':' and not string[i-1] == ';':
parenthesis += 1
else:
... | def match_parenthesis(string):
parenthesis = 0
brackets = 0
curly_brackets = 0
for i in range(len(string)):
l = string[i]
if l == '(':
if i > 0:
if not string[i - 1] == ':' and (not string[i - 1] == ';'):
parenthesis += 1
else:
... |
_base_ = [
'../_base_/datasets/imagenet_bs128.py',
'../_base_/schedules/imagenet_bs1024.py', '../_base_/default_runtime.py'
]
model = dict(
type='ImageClassifier',
backbone=dict(
type='ResArch',
arch='IRNet-18',
num_stages=4,
out_indices=(1,2,3),
styl... | _base_ = ['../_base_/datasets/imagenet_bs128.py', '../_base_/schedules/imagenet_bs1024.py', '../_base_/default_runtime.py']
model = dict(type='ImageClassifier', backbone=dict(type='ResArch', arch='IRNet-18', num_stages=4, out_indices=(1, 2, 3), style='pytorch'), neck=dict(type='MultiLevelFuse', in_channels=[128, 256, 5... |
a = 2
b = 0
try:
print(a/b)
except ZeroDivisionError:
print('Division by zero is not allowed') | a = 2
b = 0
try:
print(a / b)
except ZeroDivisionError:
print('Division by zero is not allowed') |
# Problem Set 2, Question 3
# These hold the values of the balance.
balance = 320000
origBalance = balance
# These hold the values of the annual and monthly interest rates.
annualInterestRate = 0.2
monthlyInterestRate = annualInterestRate / 12
lowerBound = balance / 12
upperBound = (balance * (1 + monthlyInterestRat... | balance = 320000
orig_balance = balance
annual_interest_rate = 0.2
monthly_interest_rate = annualInterestRate / 12
lower_bound = balance / 12
upper_bound = balance * (1 + monthlyInterestRate) ** 12 / 12.0
while abs(balance) > 0.01:
balance = origBalance
payment = (upperBound - lowerBound) / 2 + lowerBound
f... |
# Advent of code 2018
# Antti "Waitee" Auranen
# Day 4
# Example of the datetime part of the logs:
# [1518-10-12 00:15]
#
# Examples of the message part of the logs:
# Guard #1747 begins shift
# falls asleep
# wakes up
def main():
inputs = []
guards = []
while(True):
s = input("> ")
#sp... | def main():
inputs = []
guards = []
while True:
s = input('> ')
if len(s) > 0:
line = (s[1:17], s[19:])
inputs.append(line)
else:
break
inputs = quick_sort(inputs)
for a in inputs:
if a[1][:5] == 'Guard':
guard = a[1][s.... |
class Solution:
def validMountainArray(self, arr: List[int]) -> bool:
if len(arr) < 3:
return False
steps = 0
# Walk upwards, counting steps until first slope down
while steps + 1 < len(arr) and arr[steps] < arr[steps + 1]:
steps += 1
... | class Solution:
def valid_mountain_array(self, arr: List[int]) -> bool:
if len(arr) < 3:
return False
steps = 0
while steps + 1 < len(arr) and arr[steps] < arr[steps + 1]:
steps += 1
if steps == 0 or steps == len(arr) - 1:
return False
whi... |
def run(proj_path, target_name, params):
return {
"project_name": "Sample",
"build_types": ["Debug", "Release"],
"archs": [
{
"arch": "x86_64",
"conan_arch": "x86_64",
"conan_profile": "ezored_windows_app_profile",
}
... | def run(proj_path, target_name, params):
return {'project_name': 'Sample', 'build_types': ['Debug', 'Release'], 'archs': [{'arch': 'x86_64', 'conan_arch': 'x86_64', 'conan_profile': 'ezored_windows_app_profile'}]} |
def feature_extraction(cfg,Z,N) : #function Descriptors=feature_extraction(Z,N)
#
#% The features are the magnitude of the Zernike moments.
... | def feature_extraction(cfg, Z, N):
f = cfg.zeros(N + 1, N + 1) + cfg.NaN
for n in cfg.rng(0, N):
for l in cfg.rng(0, n):
if cfg.mod(n - l, 2) == 0:
aux_1 = Z[n, l, 0:l + 1]
if l > 0:
aux_2 = cfg.conj(aux_1[1:l + 1])
for ... |
#!/usr/bin/env python3
'''
Given a string, write a function to check if it is a permutation of a palindrome.
A palindrome is a word or phrase that is the same forwards and backwards.
A permutation is a rearrangement of letters.
The palindrome does not need to be limited to just dictionary words
'''
def palindrome_per... | """
Given a string, write a function to check if it is a permutation of a palindrome.
A palindrome is a word or phrase that is the same forwards and backwards.
A permutation is a rearrangement of letters.
The palindrome does not need to be limited to just dictionary words
"""
def palindrome_permutation(string):
if... |
# ../../../../goal/translate.py --gcrootfinder=asmgcc --gc=semispace src8
class A:
pass
def foo(rec, a1, a2, a3, a4, a5, a6):
if rec > 0:
b = A()
foo(rec-1, b, b, b, b, b, b)
foo(rec-1, b, b, b, b, b, b)
foo(rec-1, a6, a5, a4, a3, a2, a1)
# __________ Entry point __________
... | class A:
pass
def foo(rec, a1, a2, a3, a4, a5, a6):
if rec > 0:
b = a()
foo(rec - 1, b, b, b, b, b, b)
foo(rec - 1, b, b, b, b, b, b)
foo(rec - 1, a6, a5, a4, a3, a2, a1)
def entry_point(argv):
foo(5, a(), a(), a(), a(), a(), a())
return 0
def target(*args):
return... |
# by Kami Bigdely
# Split temporary variable
patty = 70 # [gr]
pickle = 20 # [gr]
tomatoes = 25 # [gr]
lettuce = 15 # [gr]
buns = 95 # [gr]
kimchi = 30 # [gr]
mayo = 5 # [gr]
golden_fried_onion = 20 # [gr]
ny_burger_weight = (2 * patty + 4 * pickle + 3 *
tomatoes + 2 * lettuce + 2 * buns)
... | patty = 70
pickle = 20
tomatoes = 25
lettuce = 15
buns = 95
kimchi = 30
mayo = 5
golden_fried_onion = 20
ny_burger_weight = 2 * patty + 4 * pickle + 3 * tomatoes + 2 * lettuce + 2 * buns
kimchi_burger_weight = 2 * patty + 4 * pickle + 3 * tomatoes + kimchi + mayo + golden_fried_onion + 2 * buns
if __name__ == '__main__... |
def get_nonempty_wallets_number_query():
pipeline = [
{'$match': {'balance': {'$gt': 0}}
},
{'$group': {
'_id': 'null',
'count': {'$sum': 1}
}
},
{'$project': {
'_id': 0,
'count': 1
}
}
]
return ... | def get_nonempty_wallets_number_query():
pipeline = [{'$match': {'balance': {'$gt': 0}}}, {'$group': {'_id': 'null', 'count': {'$sum': 1}}}, {'$project': {'_id': 0, 'count': 1}}]
return pipeline
def get_highest_block_number_in_db_query():
pipeline = [{'$sort': {'height': -1}}, {'$limit': 1}, {'$project': {... |
class ship:
name = "Unknown"
maelstrom_location_data = None
quadrant = ''
sector = ''
def __init__(self, name = "Unknown", maelstrom_location_data = None):
self.name = name
self.maelstrom_location_data = maelstrom_location_data
def getMaelstromLocationData(self):
retu... | class Ship:
name = 'Unknown'
maelstrom_location_data = None
quadrant = ''
sector = ''
def __init__(self, name='Unknown', maelstrom_location_data=None):
self.name = name
self.maelstrom_location_data = maelstrom_location_data
def get_maelstrom_location_data(self):
return ... |
def pow(x,y):
if y==0:
return 1
else:
temp = pow(x,int(y/2))
mult = x if y>0 else 1/x
if y%2==1:
return mult * temp * temp
else:
return temp * temp
if __name__ == "__main__":
x = 2
y = 5
res = pow(x,y)
print(res)
x = 3
y =... | def pow(x, y):
if y == 0:
return 1
else:
temp = pow(x, int(y / 2))
mult = x if y > 0 else 1 / x
if y % 2 == 1:
return mult * temp * temp
else:
return temp * temp
if __name__ == '__main__':
x = 2
y = 5
res = pow(x, y)
print(res)
... |
class Person:
def say_hi(self):
print('Hello, how are you?')
vinit = Person() # object created
vinit.say_hi() # object calls class method.
| class Person:
def say_hi(self):
print('Hello, how are you?')
vinit = person()
vinit.say_hi() |
# Implementation of the queue data structure.
# A list is used to store queue elements, where the tail
# of the queue is element 0, and the head is
# the last element
class Queue:
'''
Constructor. Initializes the list items
'''
def __init__(self):
self.items = []
'''
Returns true... | class Queue:
"""
Constructor. Initializes the list items
"""
def __init__(self):
self.items = []
'\n Returns true if queue is empty, false otherwise\n '
def is_empty(self):
return self.items == []
'\n Enqueue: Add item to end (tail) of the queue\n '
def en... |
filename = 'programing.txt'
with open(filename, 'a') as f:
f.write('I also like data science\n')
f.write('I\'m James Noria.\n') #add new things
| filename = 'programing.txt'
with open(filename, 'a') as f:
f.write('I also like data science\n')
f.write("I'm James Noria.\n") |
# generated from genmsg/cmake/pkg-genmsg.context.in
messages_str = ""
services_str = "/home/gabriel/Cyton_ROS/Cyton-Gamma-1500/catkin_ws/src/cyton_gamma_300-1500_operation_and_simulation/dynamixel_motor-master/dynamixel_controllers/srv/RestartController.srv;/home/gabriel/Cyton_ROS/Cyton-Gamma-1500/catkin_ws/src/cyton_... | messages_str = ''
services_str = '/home/gabriel/Cyton_ROS/Cyton-Gamma-1500/catkin_ws/src/cyton_gamma_300-1500_operation_and_simulation/dynamixel_motor-master/dynamixel_controllers/srv/RestartController.srv;/home/gabriel/Cyton_ROS/Cyton-Gamma-1500/catkin_ws/src/cyton_gamma_300-1500_operation_and_simulation/dynamixel_mot... |
#-- THIS LINE SHOULD BE THE FIRST LINE OF YOUR SUBMISSION! --#
def is_divisible_by(n, numbers):
if not numbers or 0 in numbers:
raise ValueError
for num in numbers:
if n % num != 0:
return False
return True
#-- THIS LINE SHOULD BE THE LAST LINE OF YOUR SUBMISSION! ---#
#... | def is_divisible_by(n, numbers):
if not numbers or 0 in numbers:
raise ValueError
for num in numbers:
if n % num != 0:
return False
return True
assert is_divisible_by(30, [3, 6, 15])
assert not is_divisible_by(30, [3, 6, 29])
try:
is_divisible_by(30, [0, 6, 29])
assert Fa... |
registry_repositories = [
{
"registry_name": "resoto-do-plugin-test",
"name": "hw",
"tag_count": 1,
"manifest_count": 1,
"latest_manifest": {
"digest": "sha256:2ce85c6b306674dcab6eae5fda252037d58f78b0e1bbd41aabf95de6cd7e4a9e",
"registry_name": "resoto-... | registry_repositories = [{'registry_name': 'resoto-do-plugin-test', 'name': 'hw', 'tag_count': 1, 'manifest_count': 1, 'latest_manifest': {'digest': 'sha256:2ce85c6b306674dcab6eae5fda252037d58f78b0e1bbd41aabf95de6cd7e4a9e', 'registry_name': 'resoto-do-plugin-test', 'repository': 'hw', 'compressed_size_bytes': 5164, 'si... |
def OnEditApart(s1, s2):
if abs(len(s1) - len(s2)) > 1:
return False
if s1 in s2 or s2 in s1:
return True
mismatch = 0
for i in range(len(s1)):
if s1[i]!=s2[i]:
mismatch+=1
if mismatch > 1:
return False
return True
| def on_edit_apart(s1, s2):
if abs(len(s1) - len(s2)) > 1:
return False
if s1 in s2 or s2 in s1:
return True
mismatch = 0
for i in range(len(s1)):
if s1[i] != s2[i]:
mismatch += 1
if mismatch > 1:
return False
return True |
S = list(map(str, input()))
if '7' in S:
print('Yes')
else:
print('No') | s = list(map(str, input()))
if '7' in S:
print('Yes')
else:
print('No') |
# python3
class JobQueue:
def read_data(self):
self.num_workers, m = map(int, input().split())
self.array = [[0]*2 for i in range(self.num_workers)]
self.jobs = list(map(int, input().split()))
assert m == len(self.jobs)
self.workers = [None] * len(self.jobs)
self.sta... | class Jobqueue:
def read_data(self):
(self.num_workers, m) = map(int, input().split())
self.array = [[0] * 2 for i in range(self.num_workers)]
self.jobs = list(map(int, input().split()))
assert m == len(self.jobs)
self.workers = [None] * len(self.jobs)
self.start = [... |
# https://leetcode.com/problems/queue-reconstruction-by-height
class Solution:
def reconstructQueue(self, people: List[List[int]]) -> List[List[int]]:
people.sort(key=lambda x: (-x[0], x[1]))
output = []
for p in people:
output.insert(p[1], p)
return output
| class Solution:
def reconstruct_queue(self, people: List[List[int]]) -> List[List[int]]:
people.sort(key=lambda x: (-x[0], x[1]))
output = []
for p in people:
output.insert(p[1], p)
return output |
# Have the function KaprekarsConstant(num) take the num parameter being passed which will be a 4-digit number with at least two distinct digits. Your program should perform the following routine on the number: Arrange the digits in descending order and in ascending order (adding zeroes to fit it to a 4-digit number), a... | def kaprekars_constant(str):
return str |
try:
f = open("textfile", "r")
f.write("write a TEST LINE ")
except TypeError:
print("There was a type error")
except OSError:
print("Hey you have an OS error")
except:
print("All other exception")
finally:
print("I always run") | try:
f = open('textfile', 'r')
f.write('write a TEST LINE ')
except TypeError:
print('There was a type error')
except OSError:
print('Hey you have an OS error')
except:
print('All other exception')
finally:
print('I always run') |
def selectionSort(alist):
for slot in range(len(alist) - 1, 0, -1):
iMax = 0
for index in range(1, slot + 1):
if alist[index] > alist[iMax]:
iMax = index
alist[slot], alist[iMax] = alist[iMax], alist[slot]
| def selection_sort(alist):
for slot in range(len(alist) - 1, 0, -1):
i_max = 0
for index in range(1, slot + 1):
if alist[index] > alist[iMax]:
i_max = index
(alist[slot], alist[iMax]) = (alist[iMax], alist[slot]) |
src = Glob('*.c')
component = aos_component('libid2', src)
component.add_global_includes('include')
component.add_comp_deps('security/plat_gen', 'security/libkm')
component.add_global_macros('CONFIG_AOS_SUPPORT=1')
component.add_prebuilt_libs('lib/' + component.get_arch() + '/libid2.a')
| src = glob('*.c')
component = aos_component('libid2', src)
component.add_global_includes('include')
component.add_comp_deps('security/plat_gen', 'security/libkm')
component.add_global_macros('CONFIG_AOS_SUPPORT=1')
component.add_prebuilt_libs('lib/' + component.get_arch() + '/libid2.a') |
my_list = [1, 2, 3, 4, 5]
def sqr(x):
return x ** 2;
def map(list_, f):
return [f(x) for x in list_]
def map_iter(list_, f):
new_list = []
for i in list_:
new_list.append(f(i))
return new_list
| my_list = [1, 2, 3, 4, 5]
def sqr(x):
return x ** 2
def map(list_, f):
return [f(x) for x in list_]
def map_iter(list_, f):
new_list = []
for i in list_:
new_list.append(f(i))
return new_list |
# https://www.codewars.com/kata/returning-strings/train/python
# My solution
def greet(name):
return "Hello, %s how are you doing today?" % name
# ...
def greet(name):
return f'Hello, {name} how are you doing today?'
# ...
def greet(name):
return "Hello, {} how are you doing today?".format(name)
... | def greet(name):
return 'Hello, %s how are you doing today?' % name
def greet(name):
return f'Hello, {name} how are you doing today?'
def greet(name):
return 'Hello, {} how are you doing today?'.format(name) |
def envelopeHiBounds(valueList, wnd):
return envelopeBounds(valueList, wnd, 0.025)
def envelopeLoBounds(valueList, wnd):
return envelopeBounds(valueList, wnd, 0.025)
def envelopeBounds(valueList, wnd, ratio):
return valueList.ewm(wnd).mean() * (1 + ratio)
| def envelope_hi_bounds(valueList, wnd):
return envelope_bounds(valueList, wnd, 0.025)
def envelope_lo_bounds(valueList, wnd):
return envelope_bounds(valueList, wnd, 0.025)
def envelope_bounds(valueList, wnd, ratio):
return valueList.ewm(wnd).mean() * (1 + ratio) |
# test lists
assert 3 in [1, 2, 3]
assert 3 not in [1, 2]
assert not (3 in [1, 2])
assert not (3 not in [1, 2, 3])
# test strings
assert "foo" in "foobar"
assert "whatever" not in "foobar"
# test bytes
# TODO: uncomment this when bytes are implemented
# assert b"foo" in b"foobar"
# assert b"whatever" not in b"foobar... | assert 3 in [1, 2, 3]
assert 3 not in [1, 2]
assert not 3 in [1, 2]
assert not 3 not in [1, 2, 3]
assert 'foo' in 'foobar'
assert 'whatever' not in 'foobar'
assert b'1' < b'2'
assert b'1' <= b'2'
assert b'5' <= b'5'
assert b'4' > b'2'
assert not b'1' >= b'2'
assert b'10' >= b'10'
try:
bytes() > 2
except TypeError:
... |
# coding=utf-8
__author__ = 'mlaptev'
if __name__ == "__main__":
matrix = []
line = input()
while line != 'end':
matrix.append([int(i) for i in line.split()])
line = input()
for i in range(len(matrix)):
for j in range(len(matrix[i])):
print(matrix[i-1][j] + matrix[(i... | __author__ = 'mlaptev'
if __name__ == '__main__':
matrix = []
line = input()
while line != 'end':
matrix.append([int(i) for i in line.split()])
line = input()
for i in range(len(matrix)):
for j in range(len(matrix[i])):
print(matrix[i - 1][j] + matrix[(i + 1) % len(ma... |
def nonstring_iterable(obj):
try: iter(obj)
except TypeError: return False
else: return not isinstance(obj, basestring)
| def nonstring_iterable(obj):
try:
iter(obj)
except TypeError:
return False
else:
return not isinstance(obj, basestring) |
# If the list grows large, it might be worth using a dictionary
isps = ('gmail.', 'yahoo.', 'earthlink.', 'comcast.', 'att.', 'movistar.', 'hotmail.', 'mail.', 'googlemail.',
'msn.', 'bellsouth.', 'telus.', 'optusnet.', 'qq.', 'sky.', 'icloud.', 'mac.', 'sympatico.',
'xtra.', 'web.', 'cox.', 'ymail.', '... | isps = ('gmail.', 'yahoo.', 'earthlink.', 'comcast.', 'att.', 'movistar.', 'hotmail.', 'mail.', 'googlemail.', 'msn.', 'bellsouth.', 'telus.', 'optusnet.', 'qq.', 'sky.', 'icloud.', 'mac.', 'sympatico.', 'xtra.', 'web.', 'cox.', 'ymail.', 'aim.', 'rogers.', 'verizon.', 'rocketmail.', 'google.', 'optonline.', 'sbcglobal... |
class Solution:
def isPalindrome(self, s: str) -> bool:
l1 = ord('a')
r1 = ord('z')
l2 = ord('A')
r2 = ord('Z')
l3 = ord('0')
r3 = ord('9')
diff = ord('a') - ord('A')
seq = [
chr(ord(ch) - diff) if l1 <= ord(ch)... | class Solution:
def is_palindrome(self, s: str) -> bool:
l1 = ord('a')
r1 = ord('z')
l2 = ord('A')
r2 = ord('Z')
l3 = ord('0')
r3 = ord('9')
diff = ord('a') - ord('A')
seq = [chr(ord(ch) - diff) if l1 <= ord(ch) <= r1 else ch for ch in s if l1 <= ord(... |
# -*- coding: utf-8 -*-
__author__ = 'Audrey Roy Greenfeld'
__email__ = 'aroy@alum.mit.edu'
__version__ = '0.1.0'
| __author__ = 'Audrey Roy Greenfeld'
__email__ = 'aroy@alum.mit.edu'
__version__ = '0.1.0' |
def number_of_divisors(divisor: int) -> int:
global requests
global divisors
if divisor in divisors:
return divisors[divisor]
requests.add(divisor)
count = 2
for i in range(2, int(divisor**0.5) + 1):
if not (divisor % i):
count += 2
divisors[divisor] ... | def number_of_divisors(divisor: int) -> int:
global requests
global divisors
if divisor in divisors:
return divisors[divisor]
requests.add(divisor)
count = 2
for i in range(2, int(divisor ** 0.5) + 1):
if not divisor % i:
count += 2
divisors[divisor] = count
r... |
class Solution:
def canCompleteCircuit(self, gas: List[int], cost: List[int]) -> int:
totalRemain = 0
remainFromStart = 0
start = None
for i in range(len(gas)):
remain = gas[i] - cost[i] # remain when cross the station
remainFromStart += remain
if ... | class Solution:
def can_complete_circuit(self, gas: List[int], cost: List[int]) -> int:
total_remain = 0
remain_from_start = 0
start = None
for i in range(len(gas)):
remain = gas[i] - cost[i]
remain_from_start += remain
if remainFromStart < 0:
... |
# Membaca file hello.txt dengan fungsi readlines()
print(">>> Membaca file hello.txt dengan fungsi readlines()")
file = open("hello.txt", "r")
all_lines = file.readlines()
file.close()
print(all_lines)
# Membaca file hello.txt dengan menerapkan looping
print(">>> Membaca file hello.txt dengan menerapkan looping")
file ... | print('>>> Membaca file hello.txt dengan fungsi readlines()')
file = open('hello.txt', 'r')
all_lines = file.readlines()
file.close()
print(all_lines)
print('>>> Membaca file hello.txt dengan menerapkan looping')
file = open('hello.txt', 'r')
for line in file:
print(line)
file.close() |
class Person(object):
def __init__(self, name, age):
self.name = name
self.age = age
def get_person(self):
return '<Person ({0}, {1})'.format(self.name, self.age)
p = Person('Manuel', 21)
print('Type of Object: {0}, Memory Address: {1}'.format(type(p), id(p))) | class Person(object):
def __init__(self, name, age):
self.name = name
self.age = age
def get_person(self):
return '<Person ({0}, {1})'.format(self.name, self.age)
p = person('Manuel', 21)
print('Type of Object: {0}, Memory Address: {1}'.format(type(p), id(p))) |
class Solution:
def countAndSay(self, n: int) -> str:
say = '1'
while n > 1 :
n -= 1
temp = say
tag = temp[0]
count = 1
say = ''
for j in range(1, len(temp)):
if temp[j] == tag:
count += 1
... | class Solution:
def count_and_say(self, n: int) -> str:
say = '1'
while n > 1:
n -= 1
temp = say
tag = temp[0]
count = 1
say = ''
for j in range(1, len(temp)):
if temp[j] == tag:
count += 1
... |
# v1
# can only buy then sell once
def max_profit_1(prices):
if not prices: return 0
low = prices[0] # lowest price so far
profit = 0
for price in prices:
if low >= price:
low = price
else:
profit = max(profit, price - low)
return profit
# O(n) time and spac... | def max_profit_1(prices):
if not prices:
return 0
low = prices[0]
profit = 0
for price in prices:
if low >= price:
low = price
else:
profit = max(profit, price - low)
return profit
def max_profit_3(prices):
if not prices:
return 0
prof... |
def preorderTraversal(root):
if root is None:
return []
nodes = []
def visit(node, nodes):
if node is None:
return
nodes.append(node.val)
visit(node.left, nodes)
visit(node.right, nodes)
visit(root, nodes)
return nodes
| def preorder_traversal(root):
if root is None:
return []
nodes = []
def visit(node, nodes):
if node is None:
return
nodes.append(node.val)
visit(node.left, nodes)
visit(node.right, nodes)
visit(root, nodes)
return nodes |
def encrypt(input, key):
encrypted = []
for i in range(0, len(input)):
a = ord(input[i])
for j in range (0, key):
a = a + 1
if (a>122):
a = 97
encrypted.append(chr(a))
return "".join(encrypted)
def decrypt(input, key):
de... | def encrypt(input, key):
encrypted = []
for i in range(0, len(input)):
a = ord(input[i])
for j in range(0, key):
a = a + 1
if a > 122:
a = 97
encrypted.append(chr(a))
return ''.join(encrypted)
def decrypt(input, key):
decrypted = []
fo... |
number_of_input_bits = 1
mux_x = 0.002 # in m
mux_y = 0.0012 # in m
for i in range(number_of_input_bits):
positionx = 0.0 + mux_x * i
line = "Mux1" + str(i) + "\t" + str(mux_x) + "\t" + str(mux_y) + "\t"
line += str(round(positionx, 8)) + "\t"
positiony = 0.0
line += str(round(positiony, 8))
... | number_of_input_bits = 1
mux_x = 0.002
mux_y = 0.0012
for i in range(number_of_input_bits):
positionx = 0.0 + mux_x * i
line = 'Mux1' + str(i) + '\t' + str(mux_x) + '\t' + str(mux_y) + '\t'
line += str(round(positionx, 8)) + '\t'
positiony = 0.0
line += str(round(positiony, 8))
print(line)
l... |
k,s=map(int,input().split())
x=list(input())
for i in range(s):
if x[i].isalpha() and x[i].isupper():
print(chr(ord('A')+(ord(x[i])-ord('A')+k)%26),end='')
elif x[i].isalpha():
print(chr(ord('a')+(ord(x[i])-ord('a')+k)%26),end='')
else:
print(x[i],end='') | (k, s) = map(int, input().split())
x = list(input())
for i in range(s):
if x[i].isalpha() and x[i].isupper():
print(chr(ord('A') + (ord(x[i]) - ord('A') + k) % 26), end='')
elif x[i].isalpha():
print(chr(ord('a') + (ord(x[i]) - ord('a') + k) % 26), end='')
else:
print(x[i], end='') |
def reverse(string):
string = "".join(reversed(string)) #used reversed function for reversing the String
return string
str = input("Enter A String:")
print ("The Entered String is : ",end="") #end is used here so that output will be in same line.
print (str)
print ("The Reversed String is : ",end... | def reverse(string):
string = ''.join(reversed(string))
return string
str = input('Enter A String:')
print('The Entered String is : ', end='')
print(str)
print('The Reversed String is : ', end='')
print(reverse(str)) |
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
hashMap = {}
for idx in range(len(nums)):
currentNum = nums[idx]
difference = target-currentNum
if difference not in hashMap and currentNum not in hashMap:
hashMap[differe... | class Solution:
def two_sum(self, nums: List[int], target: int) -> List[int]:
hash_map = {}
for idx in range(len(nums)):
current_num = nums[idx]
difference = target - currentNum
if difference not in hashMap and currentNum not in hashMap:
hashMap[d... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'My Farm',
'version' : '1.1',
'category': 'Services',
'installable': True,
'application': True,
'depends': ['project'],
'data': [
'data/res.country.state.csv',
'data/s... | {'name': 'My Farm', 'version': '1.1', 'category': 'Services', 'installable': True, 'application': True, 'depends': ['project'], 'data': ['data/res.country.state.csv', 'data/seq.xml', 'security/ir.model.access.csv', 'views/farm_configuration_farm_locations.xml', 'views/farm_configuration_fleets.xml', 'views/farm_configu... |
i = 2
S = 1
while i <= 100:
S = S + (1 / i)
i += 1
print('{:.2f}'.format(S)) | i = 2
s = 1
while i <= 100:
s = S + 1 / i
i += 1
print('{:.2f}'.format(S)) |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# This is a dummy grpcio==1.35.0 package used for E2E
# testing in Azure Functions Python Worker.
__version__ = '1.35.0'
| __version__ = '1.35.0' |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( arr , n ) :
count = 0
arr.sort ( )
for i in range ( 0 , n - 1 ) :
if ( arr [ i ] != arr [ i + 1... | def f_gold(arr, n):
count = 0
arr.sort()
for i in range(0, n - 1):
if arr[i] != arr[i + 1] and arr[i] != arr[i + 1] - 1:
count += arr[i + 1] - arr[i] - 1
return count
if __name__ == '__main__':
param = [([4, 4, 5, 7, 7, 9, 13, 15, 18, 19, 25, 27, 27, 29, 32, 36, 48, 51, 53, 53, 5... |
board = ["-","-","-","-","-","-","-","-","-"]
gamegoing = True
winner = None
current_player = "X"
def disp_board():
print(board[0]+ "|" + board[1] + "|" + board[2])
print(board[3]+ "|" + board[4] + "|" + board[5])
print(board[6]+ "|" + board[7] + "|" + board[8])
def play_game():
disp_board()
while gamegoing... | board = ['-', '-', '-', '-', '-', '-', '-', '-', '-']
gamegoing = True
winner = None
current_player = 'X'
def disp_board():
print(board[0] + '|' + board[1] + '|' + board[2])
print(board[3] + '|' + board[4] + '|' + board[5])
print(board[6] + '|' + board[7] + '|' + board[8])
def play_game():
disp_board(... |
'''
Created on Feb 9, 2018
@author: gongyo
'''
colors = ["red", 'yellow']
colors.append("black")
def compare(c1="str", c2="str"):
return c1 < c2
compare2 = lambda c1, c2: (c1 < c2);
colors.sort(cmp=compare2, key=None, reverse=False)
| """
Created on Feb 9, 2018
@author: gongyo
"""
colors = ['red', 'yellow']
colors.append('black')
def compare(c1='str', c2='str'):
return c1 < c2
compare2 = lambda c1, c2: c1 < c2
colors.sort(cmp=compare2, key=None, reverse=False) |
def extractCwastranslationsWordpressCom(item):
'''
Parser for 'cwastranslations.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('tsifb', ... | def extract_cwastranslations_wordpress_com(item):
"""
Parser for 'cwastranslations.wordpress.com'
"""
(vol, chp, frag, postfix) = extract_vol_chapter_fragment_postfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
tagmap = [('tsifb', 'Transmigrated into a... |
# version scheme: (major, minor, micro, release_level)
#
# major:
# 0 .. not all planned features done
# 1 .. all features available
# 2 .. if significant API change (2, 3, ...)
#
# minor:
# changes with new features or minor API changes
#
# micro:
# changes with bug fixes, maybe also minor API changes
#
# re... | version = (0, 15, 2, 'b0')
__version__ = '0.15.2b0' |
class UVMDefaultServer:
def __init__(self):
self.m_quit_count = 0
self.m_max_quit_count = 0
self.max_quit_overridable = True
self.m_severity_count = {}
self.m_id_count = {}
## uvm_tr_database m_message_db;
## uvm_tr_stream m_streams[string][string]; // ro.na... | class Uvmdefaultserver:
def __init__(self):
self.m_quit_count = 0
self.m_max_quit_count = 0
self.max_quit_overridable = True
self.m_severity_count = {}
self.m_id_count = {} |
#Factorial of number
n = int(input("enter a number "))
f = 1
if (n < 0):
print("number is negative")
elif (n == 0):
print("factorial=",1)
else:
for i in range(1,n+1):
f = f * i
print("factorial =",f) | n = int(input('enter a number '))
f = 1
if n < 0:
print('number is negative')
elif n == 0:
print('factorial=', 1)
else:
for i in range(1, n + 1):
f = f * i
print('factorial =', f) |
# dimensions of our images.
img_width, img_height = 150, 150
train_data_dir = 'data/train'
validation_data_dir = 'data/validation'
nb_train_samples = 5005
nb_validation_samples = 218
epochs = 1
batch_size = 16
| (img_width, img_height) = (150, 150)
train_data_dir = 'data/train'
validation_data_dir = 'data/validation'
nb_train_samples = 5005
nb_validation_samples = 218
epochs = 1
batch_size = 16 |
# -*- coding: utf-8 -
__VERSION__ = (0, 4, 7)
__SERVER_NAME__ = 'lin/{}.{}.{}'.format(*__VERSION__)
| __version__ = (0, 4, 7)
__server_name__ = 'lin/{}.{}.{}'.format(*__VERSION__) |
f=open("./matrix.txt","r") #create the dictionary for the score
diz={}
matrix=[]
for line in f:
line=line.rstrip()
line=line.split()
matrix.append(line)
for i in range(len(matrix[0])):
for j in range(1,len(matrix)):
diz[matrix[0][i]+matrix[j][0]]=int(matrix[i+1][j])
mat=diz
seq1="ACACT"
seq2=... | f = open('./matrix.txt', 'r')
diz = {}
matrix = []
for line in f:
line = line.rstrip()
line = line.split()
matrix.append(line)
for i in range(len(matrix[0])):
for j in range(1, len(matrix)):
diz[matrix[0][i] + matrix[j][0]] = int(matrix[i + 1][j])
mat = diz
seq1 = 'ACACT'
seq2 = 'AAT'
def score... |
# Set this to your GitHub auth token
GitHubAuthToken = 'add_here_your_token'
# Set this to the path of the git executable
gitExecutablePath = 'git'
# Set this to true to download also private repos if the token has private repo rights
include_private_repos = False
# Set this to False to skip existing repos
... | git_hub_auth_token = 'add_here_your_token'
git_executable_path = 'git'
include_private_repos = False
update_existing_repos = True
verbose = 1
always_write_to_disk = True
use_database = 'disk'
data_folder_path = 'data'
database_host_and_port = 'mongodb://localhost:27017/'
num_bulk_operations = 1000
download_issues = Tru... |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'includes': [
'../../../build/common.gypi',
],
'variables': {
'irt_sources': [
# irt_support_sources
'irt_entry.c',
'irt_inte... | {'includes': ['../../../build/common.gypi'], 'variables': {'irt_sources': ['irt_entry.c', 'irt_interfaces.c', 'irt_malloc.c', 'irt_private_pthread.c', 'irt_private_tls.c', 'irt_query_list.c', 'irt_basic.c', 'irt_code_data_alloc.c', 'irt_fdio.c', 'irt_filename.c', 'irt_memory.c', 'irt_dyncode.c', 'irt_thread.c', 'irt_fu... |
# b1 - bought stock once
# s1 - bought stock and then sold once
# b2 - bought stock the second time
# s2 - bought and sold twice
class Solution:
def maxProfit(self, prices: List[int]) -> int:
b1 = s1 = b2 = s2 = float('-inf')
for p in prices:
b1, s1, b2, s2 = max(b1, - p), max(s1, b1 +... | class Solution:
def max_profit(self, prices: List[int]) -> int:
b1 = s1 = b2 = s2 = float('-inf')
for p in prices:
(b1, s1, b2, s2) = (max(b1, -p), max(s1, b1 + p), max(b2, s1 - p), max(s2, b2 + p))
return max(0, s1, s2) |
load("//:import_external.bzl", import_external = "safe_wix_scala_maven_import_external")
def dependencies():
import_external(
name = "org_apache_kafka_kafka_2_12",
artifact = "org.apache.kafka:kafka_2.12:1.1.1",
artifact_sha256 = "d7b77e3b150519724d542dfb5da1584b9cba08fb1272ff1e3b3d735937e22632",
... | load('//:import_external.bzl', import_external='safe_wix_scala_maven_import_external')
def dependencies():
import_external(name='org_apache_kafka_kafka_2_12', artifact='org.apache.kafka:kafka_2.12:1.1.1', artifact_sha256='d7b77e3b150519724d542dfb5da1584b9cba08fb1272ff1e3b3d735937e22632', srcjar_sha256='2a1a9ed91ad... |
(_, d) = tuple(map(int, input().strip().split(' ')))
arr = list(map(int, input().strip().split(' ')))
new_arr = arr[d:] + arr[:d]
print(' '.join(map(str, new_arr)))
| (_, d) = tuple(map(int, input().strip().split(' ')))
arr = list(map(int, input().strip().split(' ')))
new_arr = arr[d:] + arr[:d]
print(' '.join(map(str, new_arr))) |
class DebugConfig:
# base
SECRET_KEY = b'IL_PROGRAMMATORE_RESPONSABILE_MI_CAMBIERA! OVVIO AMO!'
SERVER_NAME = 'localhost:5000'
# database
MYSQL_DATABASE_HOST = 'localhost'
MYSQL_DATABASE_PORT = 3306
MYSQL_DATABASE_USER = 'root'
MYSQL_DATABASE_PASSWORD = ''
MYSQL_DATABASE_DB = 'inge... | class Debugconfig:
secret_key = b'IL_PROGRAMMATORE_RESPONSABILE_MI_CAMBIERA! OVVIO AMO!'
server_name = 'localhost:5000'
mysql_database_host = 'localhost'
mysql_database_port = 3306
mysql_database_user = 'root'
mysql_database_password = ''
mysql_database_db = 'ingegneria'
bcrypt_handle_lo... |
# Exercise 1: Squaring Numbers
numbers = [1,1,2,3,5,8,13,21,34,55]
squared_numbers = [number**2 for number in numbers]
print(squared_numbers) | numbers = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
squared_numbers = [number ** 2 for number in numbers]
print(squared_numbers) |
LIST_ALGORITHMS_TOPIC = 'list_algorithms'
SET_ALGORITHM_TOPIC = 'set_algorithm'
GET_SAMPLE_LIST_TOPIC = 'get_sample_list'
TAKE_SAMPLE_TOPIC = 'take_sample'
REMOVE_SAMPLE_TOPIC = 'remove_sample'
COMPUTE_CALIBRATION_TOPIC = 'compute_calibration'
SAVE_CALIBRATION_TOPIC = 'save_calibration'
CHECK_STARTING_POSE_TOPIC = 'c... | list_algorithms_topic = 'list_algorithms'
set_algorithm_topic = 'set_algorithm'
get_sample_list_topic = 'get_sample_list'
take_sample_topic = 'take_sample'
remove_sample_topic = 'remove_sample'
compute_calibration_topic = 'compute_calibration'
save_calibration_topic = 'save_calibration'
check_starting_pose_topic = 'che... |
items = [{'id': 1, 'name': 'laptop', 'value': 1000},
{'id': 2, 'name': 'chair', 'value': 300},
{'id': 3, 'name': 'book', 'value': 20}]
def duplicate_items(items):
return [{key: value for key, value in x.items()} for x in items]
| items = [{'id': 1, 'name': 'laptop', 'value': 1000}, {'id': 2, 'name': 'chair', 'value': 300}, {'id': 3, 'name': 'book', 'value': 20}]
def duplicate_items(items):
return [{key: value for (key, value) in x.items()} for x in items] |
DEPS = [
'recipe_engine/path',
'recipe_engine/properties',
'recipe_engine/python',
'recipe_engine/step',
]
# TODO(phajdan.jr): provide coverage (http://crbug.com/693058).
DISABLE_STRICT_COVERAGE = True
| deps = ['recipe_engine/path', 'recipe_engine/properties', 'recipe_engine/python', 'recipe_engine/step']
disable_strict_coverage = True |
{
'name': 'eCommerce',
'category': 'Website/Website',
'sequence': 55,
'summary': 'Sell your products online',
'website': 'https://www.odoo.com/page/e-commerce',
'version': '1.0',
'description': "",
'depends': ['website', 'sale', 'website_payment', 'website_mail', 'website_form', 'website... | {'name': 'eCommerce', 'category': 'Website/Website', 'sequence': 55, 'summary': 'Sell your products online', 'website': 'https://www.odoo.com/page/e-commerce', 'version': '1.0', 'description': '', 'depends': ['website', 'sale', 'website_payment', 'website_mail', 'website_form', 'website_rating', 'digest'], 'data': ['se... |
class Bola:
def __init__(self, cor, circunferencia, material):
self.cor = cor
self.circunferencia = circunferencia
self.material = material
def troca_cor(self, n_cor):
self.cor = n_cor
def mostrar_cor(self):
return self.cor
bola = Bola('preta', 25,'couro')
print(b... | class Bola:
def __init__(self, cor, circunferencia, material):
self.cor = cor
self.circunferencia = circunferencia
self.material = material
def troca_cor(self, n_cor):
self.cor = n_cor
def mostrar_cor(self):
return self.cor
bola = bola('preta', 25, 'couro')
print(b... |
soma = 0
for i in range(100):
num = i + 1
print(num)
soma += num ** 2
print(soma)
| soma = 0
for i in range(100):
num = i + 1
print(num)
soma += num ** 2
print(soma) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.