content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
EGL_PBUFFER_BIT = 0x0001
EGL_PIXMAP_BIT = 0x0002
EGL_WINDOW_BIT = 0x0004
EGL_VG_COLORSPACE_LINEAR_BIT = 0x0020
EGL_VG_ALPHA_FORMAT_PRE_BIT = 0x0040
EGL_MULTISAMPLE_RESOLVE_BOX_BIT = 0x0200
EGL_SWAP_BEHAVIOR_PRESERVED_BIT = 0x0400
EGL_OPENGL_ES_BIT = 0x0001
EGL_OPENVG_BIT = 0x0002
EGL_OPENGL_ES2_BIT = 0x0004
EGL_OPENGL_... | egl_pbuffer_bit = 1
egl_pixmap_bit = 2
egl_window_bit = 4
egl_vg_colorspace_linear_bit = 32
egl_vg_alpha_format_pre_bit = 64
egl_multisample_resolve_box_bit = 512
egl_swap_behavior_preserved_bit = 1024
egl_opengl_es_bit = 1
egl_openvg_bit = 2
egl_opengl_es2_bit = 4
egl_opengl_bit = 8
egl_opengl_es3_bit = 64
egl_sync_fl... |
# name:afunc
def afunc():
print("afunc called")
return 1
| def afunc():
print('afunc called')
return 1 |
"""
7.1 Write a program that prompts for a file name, then opens that file and reads through the file, and print the contents of the file in upper case.
Use the file words.txt to produce the output below.
You can download the sample data at http://www.py4e.com/code3/words.txt
"""
fname = input("Enter file name: ")
... | """
7.1 Write a program that prompts for a file name, then opens that file and reads through the file, and print the contents of the file in upper case.
Use the file words.txt to produce the output below.
You can download the sample data at http://www.py4e.com/code3/words.txt
"""
fname = input('Enter file name: ')
f... |
"""The quick sort algorithm."""
def quicksort(unsorted, low=0, high=False):
"""Quick sort a list."""
if len(unsorted) < 2:
return unsorted
if high is False:
high = len(unsorted) - 1
if low < high:
swapper = swap(unsorted, low, high)
quicksort(unsorted, low, swapper - ... | """The quick sort algorithm."""
def quicksort(unsorted, low=0, high=False):
"""Quick sort a list."""
if len(unsorted) < 2:
return unsorted
if high is False:
high = len(unsorted) - 1
if low < high:
swapper = swap(unsorted, low, high)
quicksort(unsorted, low, swapper - 1)
... |
class EllysSubstringSorter:
def getMin(self, S, L):
m = "Z" * len(S)
for i in xrange(len(S) - L + 1):
s = S[:i] + "".join(sorted(S[i : i + L])) + S[i + L :]
m = min(m, s)
return m
| class Ellyssubstringsorter:
def get_min(self, S, L):
m = 'Z' * len(S)
for i in xrange(len(S) - L + 1):
s = S[:i] + ''.join(sorted(S[i:i + L])) + S[i + L:]
m = min(m, s)
return m |
def find_superbubble(G, G_rev, s):
queue = set([s])
labels = {}
while True:
v = queue.pop()
labels[v] = "visited"
v_children = list(G.neighbors(v))
if len(v_children) == 0:
return False, "tip"
for u in v_children:
if u == s:
... | def find_superbubble(G, G_rev, s):
queue = set([s])
labels = {}
while True:
v = queue.pop()
labels[v] = 'visited'
v_children = list(G.neighbors(v))
if len(v_children) == 0:
return (False, 'tip')
for u in v_children:
if u == s:
r... |
# -*- coding: utf-8 -*-
def main():
n, m = list(map(int, input().split()))
a = [int(input()) for _ in range(m)]
threads = dict()
used_thread = [False for _ in range(n)]
for index, ai in enumerate(a, 1):
threads[ai] = index
for thread_number, order in sorted(threads.items(... | def main():
(n, m) = list(map(int, input().split()))
a = [int(input()) for _ in range(m)]
threads = dict()
used_thread = [False for _ in range(n)]
for (index, ai) in enumerate(a, 1):
threads[ai] = index
for (thread_number, order) in sorted(threads.items(), key=lambda x: x[1], reverse=Tru... |
"""
@no 22
@name Generate Parenthesis
"""
class Solution:
def generateParenthesis(self, n):
"""
:type n: int
:rtype: List[str]
"""
ans = []
self.test('', 0, 0, ans, n)
return ans
def test(self, string, left_num, right_num, ans, n):
if len(string) ... | """
@no 22
@name Generate Parenthesis
"""
class Solution:
def generate_parenthesis(self, n):
"""
:type n: int
:rtype: List[str]
"""
ans = []
self.test('', 0, 0, ans, n)
return ans
def test(self, string, left_num, right_num, ans, n):
if len(strin... |
'''
Find the Access Codes
=====================
In order to destroy Commander Lambda's LAMBCHOP doomsday device, you'll need access to it.
But the only door leading to the LAMBCHOP chamber is secured with a unique lock system whose
number of passcodes changes daily. Commander Lambda gets a report every day that incl... | """
Find the Access Codes
=====================
In order to destroy Commander Lambda's LAMBCHOP doomsday device, you'll need access to it.
But the only door leading to the LAMBCHOP chamber is secured with a unique lock system whose
number of passcodes changes daily. Commander Lambda gets a report every day that incl... |
rainfall = [68, 58, 0, 99, 200, 39, 73, 43, 68, 0, 19]
min_rainfall = min(rainfall)
max_rainfall = max(rainfall)
average_rainfall = sum(rainfall) / len(rainfall)
print('minimum rainfal:', min_rainfall)
print('maximum rainfal:', max_rainfall)
print('average rainfall:', average_rainfall)
print(sorted(rainfall,reverse=T... | rainfall = [68, 58, 0, 99, 200, 39, 73, 43, 68, 0, 19]
min_rainfall = min(rainfall)
max_rainfall = max(rainfall)
average_rainfall = sum(rainfall) / len(rainfall)
print('minimum rainfal:', min_rainfall)
print('maximum rainfal:', max_rainfall)
print('average rainfall:', average_rainfall)
print(sorted(rainfall, reverse=Tr... |
def soma_listas(l1, l2):
saida = []
for i, j in zip(l1, l2):
saida.append(i+j)
return saida
def soma_listas2(l1, l2):
return [i+j for i, j in zip(l1, l2)]
| def soma_listas(l1, l2):
saida = []
for (i, j) in zip(l1, l2):
saida.append(i + j)
return saida
def soma_listas2(l1, l2):
return [i + j for (i, j) in zip(l1, l2)] |
#! /usr/bin/python
ctr=1
while ctr<1000:
pass
ctr | ctr = 1
while ctr < 1000:
pass
ctr |
__author__ = 'Chetan'
class Model(object):
def logic(self):
data = 'Got it!'
print("Model: Crunching data as per business logic")
return data
class View(object):
def update(self, data):
print("View: Updating the view with results: ", data)
class Controller(object):
def __i... | __author__ = 'Chetan'
class Model(object):
def logic(self):
data = 'Got it!'
print('Model: Crunching data as per business logic')
return data
class View(object):
def update(self, data):
print('View: Updating the view with results: ', data)
class Controller(object):
def ... |
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 7 15:14:06 2020
@author: NOTEBOOK
"""
#This program calculats a salesperson's pay
def main():
try:
#Get salesperson's monthly sales
sales = get_sales()
#Get amount of advanced pay
advance = advanced_pay()
#Determine comissi... | """
Created on Tue Jan 7 15:14:06 2020
@author: NOTEBOOK
"""
def main():
try:
sales = get_sales()
advance = advanced_pay()
comm_rate = det_comm_rate(sales)
pay = sales * comm_rate - advance
print('The monthly pay is $', format(pay, '.2f'), sep='')
if pay < 0:
... |
"""
Providers for PureScript.
"""
PureScriptModuleInfo = provider(
doc = "Contains information about a PureScript module",
fields = {
"deps": "A depset of other PureScript modules for this module's dependencies.",
"info": """
A struct containing information about this module.
Has the following... | """
Providers for PureScript.
"""
pure_script_module_info = provider(doc='Contains information about a PureScript module', fields={'deps': "A depset of other PureScript modules for this module's dependencies.", 'info': '\nA struct containing information about this module.\n\nHas the following fields:\n ffi_file: "An... |
n = int(input())
m = int(input())
if (n+m)%2 == 1:
print(0)
else:
print(1)
| n = int(input())
m = int(input())
if (n + m) % 2 == 1:
print(0)
else:
print(1) |
# Crear una funcion que permita ingresar al usuario
#Numero enteros...y strings...
# 1- print -> imprime la lista que se fue cargando hasta el momento...
# 2- append a -> siendo a numero entero
# 3- remove b -> siendo b numero entero
# 4- sort
# 5- reverse
# 6- insert c d -> siendo ambos numeros enteros, c el indice y ... | is_running = True
my_list = []
while isRunning:
user_input = input('Ingrese comando: ')
command = userInput.split()
if userInput == 'exit':
is_running = False
elif command[0] == 'append':
myList.append(int(command[1]))
elif command[0] == 'print':
print(myList)
elif comman... |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
##############################################
# File Name: tools.py
# Author: Xuhao Du
# Email: duxuhao88@gmail.com
##############################################
def readlog(fn,score):
"""read the log and export the selected features combination as lost
Args:
... | def readlog(fn, score):
"""read the log and export the selected features combination as lost
Args:
fn: str, filename
score: int, score of selected feature combination
return:
list: feature combination
"""
with open(fn, 'r') as f:
a = f.readlines()
filelength... |
def s(a, b):
res = 0
for i in xrange(1,a):
res += i**b
return res
def t(a, b):
return a**(b+1) | def s(a, b):
res = 0
for i in xrange(1, a):
res += i ** b
return res
def t(a, b):
return a ** (b + 1) |
class QcValidationResult:
def __init__(self, value: str, passed_qc: bool):
self.value = value
self.passed_qc = passed_qc
| class Qcvalidationresult:
def __init__(self, value: str, passed_qc: bool):
self.value = value
self.passed_qc = passed_qc |
def B():
n , k = map(int,input().split())
s = [int(x) for x in input().split()]
ans = [-1]*n
color = dict()
for i in range(k):
ans[i]=i+1
color[i+1] = [s[i]]
for i in range(n):
if(ans[i]==-1):
for c in color:
if(s[i] not in color[c]):
ans[i] = c
color[c].append(s[i])
break
if(-1... | def b():
(n, k) = map(int, input().split())
s = [int(x) for x in input().split()]
ans = [-1] * n
color = dict()
for i in range(k):
ans[i] = i + 1
color[i + 1] = [s[i]]
for i in range(n):
if ans[i] == -1:
for c in color:
if s[i] not in color[c]:... |
# coding: utf-8
# Contains 15 of IMDB's 250 most popular films of all time, as of 2016,
# from here: http://www.imdb.com/chart/top
IMDBData = {
"Zootopia": {
"Stars": ["Ginnifer Goodwin", "Jason Bateman", "Idris Elba"],
"Rating": 8.1,
"Genre": "Animation",
"Year": 2016,
"URL ... | imdb_data = {'Zootopia': {'Stars': ['Ginnifer Goodwin', 'Jason Bateman', 'Idris Elba'], 'Rating': 8.1, 'Genre': 'Animation', 'Year': 2016, 'URL Link': 'http://www.imdb.com/title/tt2948356/'}, 'Martian': {'Stars': ['Matt Damon', 'Jessica Chastain', 'Kristen Wiig'], 'Rating': 8.0, 'Genre': 'Sci-Fi', 'Year': 2015, 'URL Li... |
UNDERSCORE_NOT_SUPORRTED_ERROR = 'Column names cannot contain `_` symbol'
SPACE_NOT_SUPORRTED_ERROR = 'Column names should not have a space'
def SETUP_PARAMETER_MISSING(paremeter):
return f"The '{paremeter}' is required!"
def DATA_TYPE_ERROR(method):
return f"Parameter passed into method `{method}` must be of type ... | underscore_not_suporrted_error = 'Column names cannot contain `_` symbol'
space_not_suporrted_error = 'Column names should not have a space'
def setup_parameter_missing(paremeter):
return f"The '{paremeter}' is required!"
def data_type_error(method):
return f'Parameter passed into method `{method}` must be of... |
class DashboardChart:
def __init__(self, name, chart=None, datafn=None):
self.name = name
self.chart = chart
self.datafn = datafn
self.state = {}
def get_chart(self, force):
if self.datafn is not None:
chart, new_state = self.datafn(self.state, True)
... | class Dashboardchart:
def __init__(self, name, chart=None, datafn=None):
self.name = name
self.chart = chart
self.datafn = datafn
self.state = {}
def get_chart(self, force):
if self.datafn is not None:
(chart, new_state) = self.datafn(self.state, True)
... |
# Event: LCCS Python Fundamental Skills Workshop
# Date: Dec 2018
# Author: Joe English, PDST
# eMail: computerscience@pdst.ie
# Purpose: A program to demonstrate how to build a dictionary
# Version 2b. A dictionary to store multiple results for a student
results = {}
name = input("Enter student name: ")
re... | results = {}
name = input('Enter student name: ')
results['name'] = name
subject = input('Enter subject name: ')
while subject != '':
mark = input('Enter percentage mark for ' + subject + ': ')
results[subject] = mark
subject = input('Enter subject name: ')
print(results) |
# uninhm
# https://codeforces.com/contest/279/problem/B
# two pointers
n, t = map(int, input().split())
a = list(map(int, input().split()))
answer = 0
count = 0
suma = 0
i = 0
last = 0
while i < n:
if suma + a[i] <= t:
suma += a[i]
count += 1
i += 1
else:
answer = max(answer,... | (n, t) = map(int, input().split())
a = list(map(int, input().split()))
answer = 0
count = 0
suma = 0
i = 0
last = 0
while i < n:
if suma + a[i] <= t:
suma += a[i]
count += 1
i += 1
else:
answer = max(answer, count)
suma -= a[last]
count -= 1
last += 1
answ... |
# T https://leetcode-cn.com/contest/weekly-contest-112/problems/minimum-increment-to-make-array-unique/
class Solution(object):
"""
A -> res
A[0] == res[0]
A[2] > res[2]
A[6] < res[6]
"""
# @hetang
def minIncrementForUnique(self, A): # A: 1 3 5 7 7 3 9
... | class Solution(object):
"""
A -> res
A[0] == res[0]
A[2] > res[2]
A[6] < res[6]
"""
def min_increment_for_unique(self, A):
if len(A) == 0:
return 0
A.sort()
bound = A[0]
inc = 0
for a in A:
if a == bound:
... |
# SPDX-License-Identifier: MIT
"""
Files related to ROS for the autonomy_toolkit package
"""
| """
Files related to ROS for the autonomy_toolkit package
""" |
def get_longest_common_subsequence(s1, s2):
# Source: https://rosettacode.org/wiki/Longest_common_subsequence#Dynamic_Programming_8
lengths = [[0 for j in range(len(s2) + 1)] for i in range(len(s1) + 1)]
# row 0 and column 0 are initialized to 0 already
for i, x in enumerate(s1):
for j, y in en... | def get_longest_common_subsequence(s1, s2):
lengths = [[0 for j in range(len(s2) + 1)] for i in range(len(s1) + 1)]
for (i, x) in enumerate(s1):
for (j, y) in enumerate(s2):
if x == y:
lengths[i + 1][j + 1] = lengths[i][j] + 1
else:
lengths[i + 1][... |
teste = []
teste.append('Gustavo')
teste.append(40)
galera = []
galera.append(teste[:])
teste[0] = 'Maria'
teste[1] = 22
galera.append(teste[:])
print(galera)
# print(teste)
| teste = []
teste.append('Gustavo')
teste.append(40)
galera = []
galera.append(teste[:])
teste[0] = 'Maria'
teste[1] = 22
galera.append(teste[:])
print(galera) |
'''
# NEW app:
0. Move app inside project dir
1. Add the app in settings.py (INSTALLED_APPS)
2. Create urls.py with empty `urlpatterns` inside the app
3. Include app's urls.py into project urls.py
'''
| """
# NEW app:
0. Move app inside project dir
1. Add the app in settings.py (INSTALLED_APPS)
2. Create urls.py with empty `urlpatterns` inside the app
3. Include app's urls.py into project urls.py
""" |
i = 0 ; sum =0
list = [1,2,3,4,5,6,7,8,9]
for num in list :
sum = sum + i
i = i + 1
print("the sum of list is : ", sum )
| i = 0
sum = 0
list = [1, 2, 3, 4, 5, 6, 7, 8, 9]
for num in list:
sum = sum + i
i = i + 1
print('the sum of list is : ', sum) |
def getcount(R,L):
if len(R) == 0 or len(L) == 0:
temp = 0
elif len(R) - len(L) == 0:
temp = min(len(R),len(L)) * 2
else:
temp = min(len(R),len(L)) * 2
return temp
def getMaxDeletions(s):
# Write your code here
U = []
D = []
L = []
R = []
for element in ... | def getcount(R, L):
if len(R) == 0 or len(L) == 0:
temp = 0
elif len(R) - len(L) == 0:
temp = min(len(R), len(L)) * 2
else:
temp = min(len(R), len(L)) * 2
return temp
def get_max_deletions(s):
u = []
d = []
l = []
r = []
for element in s:
if element =... |
load("//scala:scala_cross_version.bzl", "extract_major_version")
def _default_scala_version():
"""return the scala version for use in maven coordinates"""
return "2.12.11"
def _store_config(repository_ctx):
scala_version = repository_ctx.os.environ.get(
"SCALA_VERSION",
repository_ctx.attr... | load('//scala:scala_cross_version.bzl', 'extract_major_version')
def _default_scala_version():
"""return the scala version for use in maven coordinates"""
return '2.12.11'
def _store_config(repository_ctx):
scala_version = repository_ctx.os.environ.get('SCALA_VERSION', repository_ctx.attr.scala_version)
... |
class DNSSeed(object):
def __init__(self):
""" @TODO:
Implement DNS SEED
"""
pass
| class Dnsseed(object):
def __init__(self):
""" @TODO:
Implement DNS SEED
"""
pass |
#find the highest and the second highest number in a array
l = [5,5,5,5,5,5,6,5,5,5]
mx = 0
mxt = 0
for i in l:
if i > mx :
mxt = mx
mx = i
else:
if i> mxt and i!=mx :
mxt = i
print(mx,mxt) | l = [5, 5, 5, 5, 5, 5, 6, 5, 5, 5]
mx = 0
mxt = 0
for i in l:
if i > mx:
mxt = mx
mx = i
elif i > mxt and i != mx:
mxt = i
print(mx, mxt) |
# Although it can't AC leetcode test, it's definitely right. However, its pattern may be not as obvious as the one that can AC
def grayCode(n):
res = [0]
seed = 1
for i in range(n - 1):
res += [seed, 3 * seed]
seed = seed << 1
for j in range((seed << 1) - len(res)):
res.append(r... | def gray_code(n):
res = [0]
seed = 1
for i in range(n - 1):
res += [seed, 3 * seed]
seed = seed << 1
for j in range((seed << 1) - len(res)):
res.append(res[j] + seed)
return res |
def remove_consecutive_duplicates(s):
words = s.split()
return " ".join(set(words))
print(remove_consecutive_duplicates('alpha beta beta gamma gamma gamma delta alpha beta beta gamma gamma gamma delta'))
| def remove_consecutive_duplicates(s):
words = s.split()
return ' '.join(set(words))
print(remove_consecutive_duplicates('alpha beta beta gamma gamma gamma delta alpha beta beta gamma gamma gamma delta')) |
#!/usr/lib/python2.7
#Group member: Haonan Li
def reverse(read):
reverse_read = ""
read = read[::-1] #reverse the read
# get comlimentary read
for i in range(len(read)):
if read[i] == 'A':
reverse_read += 'T'
elif read[i] == 'T':
reverse_read += 'A'
eli... | def reverse(read):
reverse_read = ''
read = read[::-1]
for i in range(len(read)):
if read[i] == 'A':
reverse_read += 'T'
elif read[i] == 'T':
reverse_read += 'A'
elif read[i] == 'G':
reverse_read += 'C'
elif read[i] == 'C':
reve... |
n, q = map(int, input().split())
road = [list(map(int, input().split())) for i in range(n - 1)]
queries = [list(map(int, input().split())) for i in range(q)]
edges = [[] for i in range(n + 1)]
for i in road:
edges[i[0]].append(i[1])
edges[i[1]].append(i[0])
stack = [1]
inf = 10**5
d = [-1 for i in range(n + 1)]... | (n, q) = map(int, input().split())
road = [list(map(int, input().split())) for i in range(n - 1)]
queries = [list(map(int, input().split())) for i in range(q)]
edges = [[] for i in range(n + 1)]
for i in road:
edges[i[0]].append(i[1])
edges[i[1]].append(i[0])
stack = [1]
inf = 10 ** 5
d = [-1 for i in range(n +... |
"""
C200B40A82 finds the sum of 1 and 2, resulting in the value 3.
04005AC33890 finds the product of 6 and 9, resulting in the value 54.
880086C3E88112 finds the minimum of 7, 8, and 9, resulting in the value 7.
CE00C43D881120 finds the maximum of 7, 8, and 9, resulting in the value 9.
D8005AC2A8F0 produces 1, because ... | """
C200B40A82 finds the sum of 1 and 2, resulting in the value 3.
04005AC33890 finds the product of 6 and 9, resulting in the value 54.
880086C3E88112 finds the minimum of 7, 8, and 9, resulting in the value 7.
CE00C43D881120 finds the maximum of 7, 8, and 9, resulting in the value 9.
D8005AC2A8F0 produces 1, because ... |
def migratoryBirds(arr):
birds = [0,0,0,0,0]
for obj in arr:
birds[obj-1] += 1
return birds.index(max(birds)) + 1 | def migratory_birds(arr):
birds = [0, 0, 0, 0, 0]
for obj in arr:
birds[obj - 1] += 1
return birds.index(max(birds)) + 1 |
##########################################################################################################
## File created on 31-03-2016 to be used in creating waypoint mission file for Pixhawk FC ##
## By Naitik Shukla fir ISS-Drone ##
## Sample file taken from http://qgroundcontrol.org/mavlink/waypoint_proto... | list1 = [(123, 456), (234, 567), (345, 678)]
version = '1.1'
mission_file = 'C:\\Users\\naiti\\Desktop\\mission.txt'
altitude = 10
f = open(missionFile, 'w')
f.write('QGC\tWPL\t%s\n' % version)
list_len = len(list1)
for i in range(listLen):
lat = list1[i][0]
long = list1[i][1]
f.write('%d\t1\t0\t16\t0.14999... |
# Definition for a binary tree node.
class TreeNode(object):
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution(object):
def traversal(self, lst, root):
if root is None:
return
self.traversal(... | class Treenode(object):
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution(object):
def traversal(self, lst, root):
if root is None:
return
self.traversal(lst, root.left)
lst.append(ro... |
def _git_info(ctx):
repo = "@tensorflow"
root = str(ctx.path(Label("{}//:BUILD".format(repo))))[:-len("BUILD")]
script = Label("{}//tensorflow/tools/git:gen_git_source.py".format(repo))
r = ctx.execute([
"test",
"-f",
"{}/.git/logs/HEAD".format(root),
])
if r.return_code ... | def _git_info(ctx):
repo = '@tensorflow'
root = str(ctx.path(label('{}//:BUILD'.format(repo))))[:-len('BUILD')]
script = label('{}//tensorflow/tools/git:gen_git_source.py'.format(repo))
r = ctx.execute(['test', '-f', '{}/.git/logs/HEAD'.format(root)])
if r.return_code == 0:
ctx.path(label('/... |
# -*- encoding: utf-8
class StorageServiceException(Exception):
"""Base class for all storage service exceptions."""
pass
class IngestNotFound(StorageServiceException):
"""Raised if you try to get an ingest that doesn't exist."""
pass
class BagNotFound(StorageServiceException):
"""Raised if ... | class Storageserviceexception(Exception):
"""Base class for all storage service exceptions."""
pass
class Ingestnotfound(StorageServiceException):
"""Raised if you try to get an ingest that doesn't exist."""
pass
class Bagnotfound(StorageServiceException):
"""Raised if you try to get a bag that do... |
"""
If the numbers 1 to 5 are written out in words: one, two, three, four, five,
then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.
If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words,
how many letters would be used?
NOTE: Do not count spaces or hyphens. For example,
342 (th... | """
If the numbers 1 to 5 are written out in words: one, two, three, four, five,
then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.
If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words,
how many letters would be used?
NOTE: Do not count spaces or hyphens. For example,
342 (th... |
# Time: O(n)
# Space: O(1)
class Solution:
def rob(self, nums: List[int]) -> int:
"""
"""
if not nums:
return 0
if len(nums)==1:
return nums[0]
return max(self.util(nums[:-1]), self.util(nums[1:]))
def util(self, nums):
# Linear Space
... | class Solution:
def rob(self, nums: List[int]) -> int:
"""
"""
if not nums:
return 0
if len(nums) == 1:
return nums[0]
return max(self.util(nums[:-1]), self.util(nums[1:]))
def util(self, nums):
prev_max = nums[0]
pp_max = 0
... |
'''
import json
import numpy as np
import torch
import torch.nn as nn
import torch.utils.data as data
import torchvision
import torchvision.transforms as transforms
from tqdm import tqdm
import time
BATCH_SIZE = 128
NUM_EPOCHS = 10
with open("./board_cases.json") as f:
board_json = json.load(f)
print(board_json)... | """
import json
import numpy as np
import torch
import torch.nn as nn
import torch.utils.data as data
import torchvision
import torchvision.transforms as transforms
from tqdm import tqdm
import time
BATCH_SIZE = 128
NUM_EPOCHS = 10
with open("./board_cases.json") as f:
board_json = json.load(f)
print(board_json)... |
def mode(list_in):
"""
Calculate the mode
:param list_in: A list
:return: float
"""
value = []
count = []
for val in list_in:
if val in value:
ind = value.index(val)
count[ind] += 1
else:
value.append(val)
count.append(1)... | def mode(list_in):
"""
Calculate the mode
:param list_in: A list
:return: float
"""
value = []
count = []
for val in list_in:
if val in value:
ind = value.index(val)
count[ind] += 1
else:
value.append(val)
count.append(1)
... |
#!/bin/python
# coding: utf-8
##########################################################################################################################################
# A Class to simulate dynamic inheritance of Modules and Classes
class GenericWrapper:
def __init__(self, wrapped):
self.wrapped = wrapped... | class Genericwrapper:
def __init__(self, wrapped):
self.wrapped = wrapped
def __getattr__(self, name):
return getattr(self.wrapped, name) |
class TC:
"""usage: print(f"{TC('sfsf').fg_green.bg_orange} xxxx {TC('sfsfsfds').bold.fg_black.strikethrough.underline.bg_red}")
print(f"{TC('sfsf').fg_green.bg_orange.bold}{TC('sfsfsfds').fg_orange}")"""
def __init__(self, text):
self.text = str(text)
self.c_reset = "\033[0m"
s... | class Tc:
"""usage: print(f"{TC('sfsf').fg_green.bg_orange} xxxx {TC('sfsfsfds').bold.fg_black.strikethrough.underline.bg_red}")
print(f"{TC('sfsf').fg_green.bg_orange.bold}{TC('sfsfsfds').fg_orange}")"""
def __init__(self, text):
self.text = str(text)
self.c_reset = '\x1b[0m'
s... |
h = 0
v = 0
a = 0
for t, x in list(map(lambda x: (x.split(" ")[0], int(x.split(" ")[1])), open("input.txt", "r").readlines())):
if t == "forward":
h += x
v += a * x
elif t == "down":
a += x
elif t == "up":
a -= x
print(t, x, ": ", h, v, a)
print(h * v) | h = 0
v = 0
a = 0
for (t, x) in list(map(lambda x: (x.split(' ')[0], int(x.split(' ')[1])), open('input.txt', 'r').readlines())):
if t == 'forward':
h += x
v += a * x
elif t == 'down':
a += x
elif t == 'up':
a -= x
print(t, x, ': ', h, v, a)
print(h * v) |
def solution(phone_book):
phone_book.sort()
for i in range(len(phone_book) - 1):
if phone_book[i] == phone_book[i + 1][: len(phone_book[i])]:
return False
return True | def solution(phone_book):
phone_book.sort()
for i in range(len(phone_book) - 1):
if phone_book[i] == phone_book[i + 1][:len(phone_book[i])]:
return False
return True |
TYPES = {
"Q15720608" : "Wikidata qualifier",
"Q18608359" : "to indicate a source",
"Q18608871" : "for items about people",
"Q18608993" : "for items about organizations",
"Q18609040" : "for a taxon",
"Q18610173" : "for Commons",
"Q18615010" : "for use as qualifier",
"Q18615777" : "to ind... | types = {'Q15720608': 'Wikidata qualifier', 'Q18608359': 'to indicate a source', 'Q18608871': 'for items about people', 'Q18608993': 'for items about organizations', 'Q18609040': 'for a taxon', 'Q18610173': 'for Commons', 'Q18615010': 'for use as qualifier', 'Q18615777': 'to indicate a location', 'Q18616084': 'for lang... |
# -*- encoding: utf-8 -*-
{
'name': 'project_ulb',
'version': '13.0',
'description': """Manage Project, extend project""",
'depends': [
'base',
'contacts',
'place',
],
'data': [
# assets
# models
# fields
# actions
# reports
... | {'name': 'project_ulb', 'version': '13.0', 'description': 'Manage Project, extend project', 'depends': ['base', 'contacts', 'place'], 'data': ['security/ir.model.access.csv', 'views/project_ulb_module.xml', 'views/project.xml'], 'installable': True, 'auto_install': False, 'application': True} |
nome = ''
while len(nome) <= 3:
nome = input("Informe o nome: ")
if len(nome) <= 3:
print("O nome precisa ter mais que 3 caracteres.")
| nome = ''
while len(nome) <= 3:
nome = input('Informe o nome: ')
if len(nome) <= 3:
print('O nome precisa ter mais que 3 caracteres.') |
class Solution(object):
def numIslands(self, grid):
"""
:type grid: List[List[str]]
:rtype: int
"""
sizes = []
visited = [[False for value in row] for row in grid]
for i in range(len(grid)):
for j in range(len(grid[i])):
if visited[... | class Solution(object):
def num_islands(self, grid):
"""
:type grid: List[List[str]]
:rtype: int
"""
sizes = []
visited = [[False for value in row] for row in grid]
for i in range(len(grid)):
for j in range(len(grid[i])):
if visite... |
#! usr/bin/env python3
class Group(object):
def __init__(self, _name):
self.name = _name
self.groups = []
self.users = []
def add_group(self, group):
self.groups.append(group)
def add_user(self, user):
self.users.append(user)
def get_groups(self):
ret... | class Group(object):
def __init__(self, _name):
self.name = _name
self.groups = []
self.users = []
def add_group(self, group):
self.groups.append(group)
def add_user(self, user):
self.users.append(user)
def get_groups(self):
return self.groups
def... |
x = [None] * 3
y = [None] * 3
for i in range(3):
x[i], y[i] = [a for a in input().split()]
xa = "".join([i for i in x if x.count(i) == 1])
ya = "".join([i for i in y if y.count(i) == 1])
print("%s %s" % (xa, ya)) | x = [None] * 3
y = [None] * 3
for i in range(3):
(x[i], y[i]) = [a for a in input().split()]
xa = ''.join([i for i in x if x.count(i) == 1])
ya = ''.join([i for i in y if y.count(i) == 1])
print('%s %s' % (xa, ya)) |
MODEL_NAME = "cassava_efficient_net.ckpt"
TRAIN_IMAGES_DIR = '../input/cassava-leaf-disease-classification/train_images'
TEST_IMAGES_DIR = '../input/cassava-leaf-disease-classification/test_images'
TRAIN_CSV = '../input/cassava-leaf-disease-classification/train.csv'
PRETRAINED_PATH = 'ml/trained_model/efficientnet-b5.p... | model_name = 'cassava_efficient_net.ckpt'
train_images_dir = '../input/cassava-leaf-disease-classification/train_images'
test_images_dir = '../input/cassava-leaf-disease-classification/test_images'
train_csv = '../input/cassava-leaf-disease-classification/train.csv'
pretrained_path = 'ml/trained_model/efficientnet-b5.p... |
# -*- coding: utf-8 -*-
class Account:
def __init__(self, email, balance, credit, total_records):
self.email = email
self.balance = balance,
self.credit = credit,
self.total_records = total_records
def __repr__(self):
return str(vars(self))
| class Account:
def __init__(self, email, balance, credit, total_records):
self.email = email
self.balance = (balance,)
self.credit = (credit,)
self.total_records = total_records
def __repr__(self):
return str(vars(self)) |
# -*- coding: utf-8 -*-
"""
Django application to demonstrate 'crispy-forms-foundation'
"""
__version__ = '0.5.0'
| """
Django application to demonstrate 'crispy-forms-foundation'
"""
__version__ = '0.5.0' |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def pathSum(self, root: TreeNode, sum: int) -> List[List[int]]:
ret = []
self.dfs(root, sum, [], ret)
return... | class Solution:
def path_sum(self, root: TreeNode, sum: int) -> List[List[int]]:
ret = []
self.dfs(root, sum, [], ret)
return ret
def dfs(self, root, left, cur, ret):
if not root:
return
if not root.left and (not root.right):
if root.val == left:... |
# -*- coding: utf-8 -*-
name = 'ilmbase'
version = '2.2.0'
build_requires = [
'cmake'
]
variants = [['platform-linux', 'arch-x86_64']]
def commands():
appendenv('LD_LIBRARY_PATH', '{root}/lib/')
appendenv('ILMBASE_ROOT', '{root}')
appendenv('PKG_CONFIG_PATH', '{root}/lib/pkgconfi... | name = 'ilmbase'
version = '2.2.0'
build_requires = ['cmake']
variants = [['platform-linux', 'arch-x86_64']]
def commands():
appendenv('LD_LIBRARY_PATH', '{root}/lib/')
appendenv('ILMBASE_ROOT', '{root}')
appendenv('PKG_CONFIG_PATH', '{root}/lib/pkgconfig/') |
a=float(input('Enter Kilometer:'))
b=0.621371*a
print('Miles=%0.2f'%b)
| a = float(input('Enter Kilometer:'))
b = 0.621371 * a
print('Miles=%0.2f' % b) |
def init_cfg(hostname, vm_auth_key, device_group_name, template_name, panorama_ip, dns_ip):
r = f"""
ip-address=
default-gateway=
netmask=
ipv6-address=
ipv6-default-gateway=
hostname={hostname}
vm-auth-key={vm_auth_key}
panorama-server={panorama_ip}
tplname={template_name}
dgname={device_group_name}
dns-primary={... | def init_cfg(hostname, vm_auth_key, device_group_name, template_name, panorama_ip, dns_ip):
r = f'\nip-address=\ndefault-gateway=\nnetmask=\nipv6-address=\nipv6-default-gateway=\nhostname={hostname}\nvm-auth-key={vm_auth_key}\npanorama-server={panorama_ip}\ntplname={template_name}\ndgname={device_group_name}\ndns-p... |
__all__ = [
'closure',
'networks',
'primal_map'
] | __all__ = ['closure', 'networks', 'primal_map'] |
# Constants to convert between python timestamps and NTP 8B binary format [RFC1305]
TIMEOFFSET = 2208988800 # Time Difference from 1-JAN-1900 to 1-JAN-1970 in seconds
ALLBITS = int(0xFFFFFFFF) # To calculate 32bit fraction of the second
DSCP_TABLE = """
============================================================... | timeoffset = 2208988800
allbits = int(4294967295)
dscp_table = '\n============================================================\nDSCP Mapping\n============================================================\nDSCP Name DSCP Value TOS (bin) TOS (hex)\n------------------------------------------------------------... |
#retorna primeiro e ultimo nome
nomecompleto = input("Digite seu nome completo: ")
nomefatiado = nomecompleto.split()
primeironome = nomefatiado[0]
ultimonome = nomefatiado[-1]
print("Primeiro nome: {}\n Ultimo nome: {}". format(primeironome, ultimonome))
| nomecompleto = input('Digite seu nome completo: ')
nomefatiado = nomecompleto.split()
primeironome = nomefatiado[0]
ultimonome = nomefatiado[-1]
print('Primeiro nome: {}\n Ultimo nome: {}'.format(primeironome, ultimonome)) |
def get_file_lines(file_path):
with open(file_path) as file:
lines = file.readlines()
return lines
def write_file(file_path, file_lines):
with open(file_path, "w") as f:
f.writelines(file_lines)
| def get_file_lines(file_path):
with open(file_path) as file:
lines = file.readlines()
return lines
def write_file(file_path, file_lines):
with open(file_path, 'w') as f:
f.writelines(file_lines) |
"""
Given a positive integer n, generate an n x n matrix filled with elements from 1 to n2 in spiral order.
Example 1:
Input: n = 3
Output: [[1,2,3],[8,9,4],[7,6,5]]
Example 2:
Input: n = 1
Output: [[1]]
Constraints:
1 <= n <= 20
"""
class Solution:
def generateMatrix(self, n: int) -> List[List[int]]:
... | """
Given a positive integer n, generate an n x n matrix filled with elements from 1 to n2 in spiral order.
Example 1:
Input: n = 3
Output: [[1,2,3],[8,9,4],[7,6,5]]
Example 2:
Input: n = 1
Output: [[1]]
Constraints:
1 <= n <= 20
"""
class Solution:
def generate_matrix(self, n: int) -> List[List[int]]:
... |
class Node:
def __init__(self, data):
self.data = data
self.next_node = None
class LinkedList:
def __init__(self):
self.head = None
self.num_of_nodes = 0
# O(1)
def insert_start(self, data):
self.num_of_nodes = self.num_of_nodes + 1
new_node = Node(d... | class Node:
def __init__(self, data):
self.data = data
self.next_node = None
class Linkedlist:
def __init__(self):
self.head = None
self.num_of_nodes = 0
def insert_start(self, data):
self.num_of_nodes = self.num_of_nodes + 1
new_node = node(data)
... |
"""
Tipe data dictionary sekedar menghubungkan antara Key dan VALU
KVP = Key Value Pair
Dictionary = Kamus
"""
# kamus_ind_en = {}
# kamus_ind_en['anak'] = 'child'
# kamus_ind_en['istri'] = 'wife'
# kamus_ind_en['ayah'] = 'father'
# kamus_ind_en['ibu'] = 'mother'
#
# print(kamus_ind_en)
# print(kamus_ind_en['ayah'])
#... | """
Tipe data dictionary sekedar menghubungkan antara Key dan VALU
KVP = Key Value Pair
Dictionary = Kamus
"""
print('data ini dikirimkan oleh server gojek untuk memberikan info driver di sekitar pemakai aplikasi')
data_dari_server_gojek = {'tanggal': '2020-06-10', 'driver_list': [{'nama': 'Eko', 'jarak': 10}, {'nama':... |
def default_key(x):
""" Default comparison function."""
return x
def order(seq, key=default_key, reverse=False):
""" Return the order in which to take the items to obtained
a sorted sequence."""
o = list(range(len(seq)))
def wrap_key(x):
x = seq[x]
return key(x)
o.sort(ke... | def default_key(x):
""" Default comparison function."""
return x
def order(seq, key=default_key, reverse=False):
""" Return the order in which to take the items to obtained
a sorted sequence."""
o = list(range(len(seq)))
def wrap_key(x):
x = seq[x]
return key(x)
o.sort(key=... |
class HierarchicalSettingsDefault(object):
"""
Good for dealing with dark matter halos between 10^5 - 10^10 M_sun
with small source sizes <10 pc
"""
def __init__(self):
self.set_aperture_units('ANGLES')
def set_aperture_units(self, units):
self._aperture_units = units
@pr... | class Hierarchicalsettingsdefault(object):
"""
Good for dealing with dark matter halos between 10^5 - 10^10 M_sun
with small source sizes <10 pc
"""
def __init__(self):
self.set_aperture_units('ANGLES')
def set_aperture_units(self, units):
self._aperture_units = units
@pro... |
class WeirdException(Exception):
"""
exception will be used everytime something weird happens, which should not happen.
"""
def __init__(self, message):
"""
call the parent class
:param message:
"""
self.message = message
super(Exception, self).__init__(... | class Weirdexception(Exception):
"""
exception will be used everytime something weird happens, which should not happen.
"""
def __init__(self, message):
"""
call the parent class
:param message:
"""
self.message = message
super(Exception, self).__init__(... |
def test_del_all_group(app, db):
all_group = db.get_group_list()
if len(all_group) == 0:
pass
else:
for x in range(len(all_group)):
app.group.delete_first_group()
| def test_del_all_group(app, db):
all_group = db.get_group_list()
if len(all_group) == 0:
pass
else:
for x in range(len(all_group)):
app.group.delete_first_group() |
class Solution:
def findMaxLength(nums):
maxlen = 0
for start in range(0, len(nums)):
zeroes = 0
ones = 0
for end in range(start, len(nums)):
if nums[end] == 0:
zeroes += 1
else:
ones += 1
... | class Solution:
def find_max_length(nums):
maxlen = 0
for start in range(0, len(nums)):
zeroes = 0
ones = 0
for end in range(start, len(nums)):
if nums[end] == 0:
zeroes += 1
else:
ones += 1
... |
#import numpy as np
class HTMLtable:
"""
HTML Table helper class.
"""
CELLTYPE = 'type'
CELLCONTENTS = 'contents'
CELLSPANDOWN = 'spandown'
CELLSPANRIGHT = 'spanright'
CELLTYPE_NORMAL = 0
CELLTYPE_BEGINSPANRIGHT = 1
CELLTYPE_BEGINSPANDOWN = 2
CELLTYPE_SPANNED ... | class Htmltable:
"""
HTML Table helper class.
"""
celltype = 'type'
cellcontents = 'contents'
cellspandown = 'spandown'
cellspanright = 'spanright'
celltype_normal = 0
celltype_beginspanright = 1
celltype_beginspandown = 2
celltype_spanned = 4
def __init__(self, rows: ... |
student_scores = input(
"Input a list of student scores, separated by spaces:\n").split()
for n in range(0, len(student_scores)):
student_scores[n] = int(student_scores[n])
print(student_scores)
highest_score = 0
for score in student_scores:
if score > highest_score:
highest_score = score
print... | student_scores = input('Input a list of student scores, separated by spaces:\n').split()
for n in range(0, len(student_scores)):
student_scores[n] = int(student_scores[n])
print(student_scores)
highest_score = 0
for score in student_scores:
if score > highest_score:
highest_score = score
print(f'The hig... |
# encoding: utf-8
# module GH_Util.MetaBall calls itself MetaBall
# from GH_Util, Version=1.0.0.0, Culture=neutral, PublicKeyToken=dda4f5ec2cd80803
# by generator 1.145
""" NamespaceTracker represent a CLS namespace. """
# no imports
# no functions
# classes
class GH_CellInfo(object):
"""
GH_CellI... | """ NamespaceTracker represent a CLS namespace. """
class Gh_Cellinfo(object):
"""
GH_CellInfo()
GH_CellInfo(nX: int, nY: int)
GH_CellInfo(nX: int, nY: int, na: float, nb: float, nc: float, nd: float)
"""
def determine_mask(self, threshold):
""" DetermineMask(self: GH_CellInfo, thres... |
def parse_command(data):
direction, steps = data.strip().split(" ")
return (
direction,
int(steps),
)
cmds = []
with open("input") as input:
cmds = list(map(parse_command, input))
horizontal = 0
depth = 0
for direction, steps in cmds:
if direction == "forward":
horizontal ... | def parse_command(data):
(direction, steps) = data.strip().split(' ')
return (direction, int(steps))
cmds = []
with open('input') as input:
cmds = list(map(parse_command, input))
horizontal = 0
depth = 0
for (direction, steps) in cmds:
if direction == 'forward':
horizontal += steps
elif dire... |
class Development(object):
DEBUG = True # Turns on debugging features in Flask
| class Development(object):
debug = True |
class Pai:
def __init__(self, nome, peso):
self.nome = nome
self.peso = peso
class Filha(Pai):
def __init__(self, nome, peso, cabelo):
super().__init__(nome, peso)
self.cabelo = cabelo
pessoa1 = Pai('Alcimar', 95)
filha1 = Filha('Mirella', 13, 'Loiro')
print(filha1.nome)
pri... | class Pai:
def __init__(self, nome, peso):
self.nome = nome
self.peso = peso
class Filha(Pai):
def __init__(self, nome, peso, cabelo):
super().__init__(nome, peso)
self.cabelo = cabelo
pessoa1 = pai('Alcimar', 95)
filha1 = filha('Mirella', 13, 'Loiro')
print(filha1.nome)
print... |
def One(num):
for i in num: # Only creates one variable and that's it so Space Complexity: O(1)
print(i)
One([1, 2, 3, 4, 5]) # Space Complexity: O(1)
def Two(num):
array = [] # Creates array once O(1)
for j in num: # O(1)
array.insert(j, j) # Assigns value to index in array N times so Spa... | def one(num):
for i in num:
print(i)
one([1, 2, 3, 4, 5])
def two(num):
array = []
for j in num:
array.insert(j, j)
return array
print(two([1, 2, 3, 4, 5])) |
def hook_at_step(system, integrator, ar, gt, args, k):
if k == 0:
print('Deactivation reaction 2 3')
ar.get_reaction(2).active = False
ar.get_reaction(3).active = False
if k == 1000000:
print('Deactivate reactions 0, 1')
ar.get_reaction(0).active = False
ar.get_... | def hook_at_step(system, integrator, ar, gt, args, k):
if k == 0:
print('Deactivation reaction 2 3')
ar.get_reaction(2).active = False
ar.get_reaction(3).active = False
if k == 1000000:
print('Deactivate reactions 0, 1')
ar.get_reaction(0).active = False
ar.get_re... |
#!/usr/bin/python3
""" Python lists """
def main():
""" Main func """
# lists can contains multiple elements
# in python these elements can be anything, to fully appreciate this feature you should tune yourself
# to python duck typing mentality :)
li1 = ["list", "set", "dictionary"]
li2 = ["on... | """ Python lists """
def main():
""" Main func """
li1 = ['list', 'set', 'dictionary']
li2 = ['one', '1', 2, 'two', 'three', 4, 5]
li3 = ['str', 'hex', 'dec']
print('Type of li1: %s' % type(li1))
print('Type of li2: %s' % type(li2))
print('Type of li3: %s' % type(li3))
li1.append('added... |
x = 1
class Foo():
z = 3
def __init__(self):
self.y = 2
def bar(self):
print(x)
print(self.x)
print(self.z)
@property
def x(self):
return self.y
if __name__ == '__main__':
Foo().bar()
| x = 1
class Foo:
z = 3
def __init__(self):
self.y = 2
def bar(self):
print(x)
print(self.x)
print(self.z)
@property
def x(self):
return self.y
if __name__ == '__main__':
foo().bar() |
__title__ = "pyNfsClient"
__description__ = "Pure python NFS client"
__version__ = "0.1.5"
__license__ = "MIT"
__url__ = "https://github.com/CharmingYang0/NfsClient"
__author__ = "Cooper Yang"
__author_email__ = "cm_yang@yeah.net"
| __title__ = 'pyNfsClient'
__description__ = 'Pure python NFS client'
__version__ = '0.1.5'
__license__ = 'MIT'
__url__ = 'https://github.com/CharmingYang0/NfsClient'
__author__ = 'Cooper Yang'
__author_email__ = 'cm_yang@yeah.net' |
class Project:
"""
INCEpTION's Project object
"""
def __init__(self, project_id: int, project_name: str):
self.project_id = project_id
self.project_name = project_name
def __eq__(self, other):
return isinstance(other, Project) and \
other.project_id == self.p... | class Project:
"""
INCEpTION's Project object
"""
def __init__(self, project_id: int, project_name: str):
self.project_id = project_id
self.project_name = project_name
def __eq__(self, other):
return isinstance(other, Project) and other.project_id == self.project_id and (ot... |
"""
The latest way to print to the screen in Python (>= 3.6) is with f-strings.
In this Bite we'll get you to calculate whether a person is able to drive or not based on their minimum age which is stored in the constant MIN_DRIVING_AGE.
Print name is allowed to drive or name is not allowed to drive based on the age b... | """
The latest way to print to the screen in Python (>= 3.6) is with f-strings.
In this Bite we'll get you to calculate whether a person is able to drive or not based on their minimum age which is stored in the constant MIN_DRIVING_AGE.
Print name is allowed to drive or name is not allowed to drive based on the age b... |
# Copyright (c) 2014 The Sippet Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'All',
'type': 'none',
'dependencies': [
'sippet.gyp:*',
'sippet_phone.g... | {'targets': [{'target_name': 'All', 'type': 'none', 'dependencies': ['sippet.gyp:*', 'sippet_phone.gyp:*'], 'conditions': [['OS != "ios"', {'dependencies': ['sippet_tests.gyp:*', 'sippet_examples.gyp:*']}]]}]} |
def get_optimizer_lr_str(cfg, optimizer):
if cfg.log.only_base_lr is False:
lr_strs = ['{:.6f}'.format(g['lr']).rstrip('0') for g in optimizer.param_groups]
lr_str = ', '.join(lr_strs)
else:
lr_str = '{:.6f}'.format(optimizer.param_groups[0]['lr'])
return lr_str
| def get_optimizer_lr_str(cfg, optimizer):
if cfg.log.only_base_lr is False:
lr_strs = ['{:.6f}'.format(g['lr']).rstrip('0') for g in optimizer.param_groups]
lr_str = ', '.join(lr_strs)
else:
lr_str = '{:.6f}'.format(optimizer.param_groups[0]['lr'])
return lr_str |
#!/usr/bin/python
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def partition(self, head, x):
"""
:type head: ListNode
:type x: int
:rtype: ListNode
"""
if not head or not head.next:
... | class Solution(object):
def partition(self, head, x):
"""
:type head: ListNode
:type x: int
:rtype: ListNode
"""
if not head or not head.next:
return head
dummyhead = list_node(0)
tails = dummyhead
prev = list_node(0)
prev.next = head
curr... |
"""
Constants.
Constants for feeds and feed entries.
"""
ATTR_ID = "id"
ATTR_GUID = "guid"
ATTR_PUB_DATE = "pubDate"
ATTR_TIME = "time"
ATTR_TITLE = "title"
ATTR_UPDATED = "updated"
| """
Constants.
Constants for feeds and feed entries.
"""
attr_id = 'id'
attr_guid = 'guid'
attr_pub_date = 'pubDate'
attr_time = 'time'
attr_title = 'title'
attr_updated = 'updated' |
class Solution:
def bitwiseComplement(self, N: int) -> int:
n = bin(N)
return 2 ** (len(n) - 2) - 1 - N
if __name__ == "__main__":
s = Solution()
print(s.bitwiseComplement(5))
| class Solution:
def bitwise_complement(self, N: int) -> int:
n = bin(N)
return 2 ** (len(n) - 2) - 1 - N
if __name__ == '__main__':
s = solution()
print(s.bitwiseComplement(5)) |
x1=int(input("enter a x1 value:"))
x2=int(input("enter a x2 value:"))
y1=int(input("enter a y1 value:"))
y2=int(input("enter a y2 value:"))
result= ((((x2-x1)**2)+((y2-y1)**2))**0.5)
print("distance between two points",result) | x1 = int(input('enter a x1 value:'))
x2 = int(input('enter a x2 value:'))
y1 = int(input('enter a y1 value:'))
y2 = int(input('enter a y2 value:'))
result = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5
print('distance between two points', result) |
server_ip = "192.168.1.10"
port_drone_control = 20001
port_drone_video = 20006
port_operator_control = 20000
port_operator_video = 20005
CMD_START = 'start'
CMD_STOP = 'stop'
| server_ip = '192.168.1.10'
port_drone_control = 20001
port_drone_video = 20006
port_operator_control = 20000
port_operator_video = 20005
cmd_start = 'start'
cmd_stop = 'stop' |
# -*- coding: utf-8 -*-
"""
PM status data structure module.
Provides a orderable data structure for point mutation status.
e.g. Y > Conserved is True; Y(aa_pm=0) > Y(aa_pm=None) is True.
NOTE:
PM status objects with inconsistent stdseq are not orderable,
and it regards sequences which gaps, '-', has been re... | """
PM status data structure module.
Provides a orderable data structure for point mutation status.
e.g. Y > Conserved is True; Y(aa_pm=0) > Y(aa_pm=None) is True.
NOTE:
PM status objects with inconsistent stdseq are not orderable,
and it regards sequences which gaps, '-', has been removed from
the orign... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.