content stringlengths 7 1.05M |
|---|
N = int(input())
C = [list(map(int, input().split())) for _ in range(N)]
INF = 10 ** 18
a = INF
i, j = 0, 0
for y in range(N):
for x in range(N):
if C[y][x] >= a:
continue
i, j = y, x
a = C[y][x]
def f(z):
A = [INF] * N
B = [INF] * N
A[i] = z
for x in range(N)... |
{
"targets": [
{
"target_name": "lzh",
"sources": [ "src/binding.cc", "src/lzh.c" ],
"include_dirs": [
"<!(node -e \"require('nan')\")",
"<!(node -e \"require('cpp-debug')\")"
]
}
]
}
|
class TP_Texts:
# __init__()
init_error1 = "Start and End must be of type datetime.datetime!"
init_error2 = "End must be larger than start!"
# start()
start_error1 = "Time must be of type datetime.datetime!"
start_error2 = "start must be smaller than end of Time_Period!"
# end()
... |
help(input)
print(input.__doc__)
def contador(i, f, p):
"""
-> Faz uma contagem e mostra na tela
:param i: início da contagem
:param f: fim da contagem
:param p: passo da contagem
:return: sem retorno
"""
# Doc_string
c = i
while c <= f:
print(f'{c} ', end='')
c... |
#
# PySNMP MIB module CISCO-OTV-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-OTV-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:09:07 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... |
def menu():
print("")
print(f'''<------ MENU ------>
A - para adição
S - para subtração
D - para divisão
M - para múltiplicação
X - para sair''')
def Aritmetica(a, operacao):
arit = {'A': lambda a, b: a + b,
'S': lambda a, b: a - b,
'D': lambda a, b: a / b,
... |
class ServerError(Exception):
def __init__(self, details, model, response):
self.details = details
self.model = model
self.response = response
super(ServerError, self).__init__(self.details)
def encode(self):
return {
"details": self.details,
"exp... |
"""
jsonable.py:
Folder with helper methods that allow for seamless conversion of F prime types to JSON types. This allows us to produce
data in JSON format with ease, assuming that the correct encoder is registered.
Note: JSON types must use only the following data types
1. booleans
2. numbers
3. strings
4. lis... |
# Ariant Treasure Vault Entrance (915020100) => Ariant Treasure Vault
if 2400 <= chr.getJob() <= 2412 and not sm.hasMobsInField():
sm.warp(915020101, 1)
elif sm.hasMobsInField():
sm.chat("Eliminate all of the intruders first.") |
# -*- coding: utf-8 -*-
"""
Most of the jokes are from https://viccfaktor.hu/cimke/programozo-viccek/, and https://gremmedia.hu/programozo-viccek
//
A viccek nagy része a https://viccfaktor.hu/cimke/programozo-viccek/ weboldalról és a https://gremmedia.hu/programozo-viccek weboldalról származik
"""
neutral = [
"-... |
"""This problem was asked by Amazon.
Implement a bit array.
A bit array is a space efficient array that holds a value of 1 or 0 at each index.
• init(size): initialize the array with size
• set(i, val): updates index at i with val where val is either 1 or 0.
• get(i): gets the value at index i.
""" |
# Copyright (c) 2011 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.
{
'targets': [
{
'target_name': 'libflac',
'product_name': 'flac',
'type': 'static_library',
'sources': [
'include/... |
class LUISEmulator(object):
def __init__(self):
self.name='luis'
def normalise_request_json(self,data):
_data = {}
_data["text"]=data['q'][0]
return _data
def normalise_response_json(self,data):
return {
"query": data["text"],
"topScoringInte... |
def test_vm_reconfigured(controller, vm_service, vn_service, vmi_service, vrouter_port_service,
vm_reconfigured_update):
controller.handle_update(vm_reconfigured_update)
vm_service.update_vm_models_interfaces.assert_called_once()
vn_service.update_vns.assert_called_once()
vmi_s... |
"""
Module: 'flowlib.units._adc' on M5 FlowUI v1.4.0-beta
"""
# MCU: (sysname='esp32', nodename='esp32', release='1.11.0', version='v1.11-284-g5d8e1c867 on 2019-08-30', machine='ESP32 module with ESP32')
# Stubber: 1.3.1
ADDRESS = 72
class Adc:
''
def _available():
pass
def _read_u16():
pa... |
with open('lexical.csv') as f:
string=f.read()
arr=string.split('\n')
arr=arr[:10000]
result='\n'.join(arr)
with open('sub.csv','w') as f:
f.write(result) |
# program to restore the original string by entering the compressed string with this rule. However,
# the # character does not appear in the restored character string.
def restore_original_str(a1):
result = ""
ind = 0
end = len(a1)
while ind < end:
if a1[ind] == "#":
result += a1[ind + 2] * int(a1[in... |
# Given an array of integers, every element appears twice except for one. Find that single one.
#
# Note:
# Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
#
# Python, Python3 all accepted.
class SingleNumber:
def singleNumber(self, nums):
"""
... |
def example2(n):
h = lambda : print(n)
return(h)
ourfunc = example2(5)
ourfunc()
|
# -*- coding: utf-8 -*-
""" Platform specific utility functions, dummy version
This has empty implementation of the platutils functions, used for
unsupported operating systems.
Authors
-------
- Ville Vainio <vivainio@gmail.com>
"""
#*****************************************************************************
# ... |
"""Axes behaviour."""
def lines(
*,
base_width=0.5,
line_base_ratio=2.0,
tick_major_base_ratio=1.0,
tick_minor_base_ratio=0.5,
tick_size_width_ratio=3.0,
tick_major_size_min=3.0,
tick_minor_size_min=2.0,
axisbelow=True,
):
"""Adjust linewidth(s) according to a base width."""
... |
#!/usr/bin/env python
"""
Base class and common functions for compressor implementations.
"""
# pylint: disable=W0311
class BaseProcessor(object):
"Base class for compression processors."
def __init__(self, options, is_request, params):
self.options = options
self.is_request = is_request
name = self.... |
# Outputs the sum of the range of all numbers from 1 to n.
# Source: https://pynative.com/python-program-to-calculate-sum-and-average-of-numbers/
def main():
print("\n")
input_string = input('Enter numbers separated by space ')
print("\n")
# Take input numbers into list
numbers = input_string.spli... |
'''
@Author: 咸的
@Date: 2020-03-09 14:35:31
@LastEditTime: 2020-03-10 14:08:05
@Description: In User Settings Edit
'''
txt = '''120 132
261 294
416 429
541 555
680 692
784 799
926 939
1082 1096
1212 1224
1333 1344
1452 1466
1586 1598
1728 1743
1891 1905
2038 2050
2183 2196
2354 2367
2502 2515
2675 2687
2807 2818
2926 2... |
# https://leetcode.com/problems/find-n-unique-integers-sum-up-to-zero/
class Solution:
def sumZero(self, n: int) -> List[int]:
res = []
if n % 2 == 0:
for i in range(1, (n // 2) + 1):
res.append(i)
for i in range(-(n // 2), 0):
res.... |
# 只有把 5 放中间一种类型解法,并且和等于15,不过还是暴力破解看看吧
def check(a):
"""传入九宫格(列表),判定是否破解"""
#print("a=", a)
if a[0]+a[1]+a[2] == a[3]+a[4]+a[5] == a[6]+a[7]+a[8]\
== a[0]+a[3]+a[6] == a[1]+a[4]+a[7] == a[2]+a[5]+a[8]\
== a[0]+a[4]+a[8] == a[2]+a[4]+a[6]:
print(a)
def permute(a_list):
"""闭包处理, 保存了使用方法 f... |
#
# PySNMP MIB module ARBOR-SMI (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ARBOR-SMI
# Produced by pysmi-0.3.4 at Mon Apr 29 17:08:55 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23... |
# default value from class context
class A:
FOO = 1
def foo(self, param=F<ref>OO):
pass
|
class InfectionObserver:
"""
As the output.hdf table for a distributed run has only one row per run,
this data needs to be saved in wide format
For each step, it will have one column for infection prevalence, and one column for infection incidence
"""
def __init__(self):
self.step = 0
... |
class EvaluationTask:
"""EvaluationTask class, containing EvaluationTask information."""
def __init__(self, json, client):
self._json = json
self.id = json["id"]
self.initial_response = getattr(json, "initial_response", None)
self.expected_response = json["expected_response"]
... |
LOREM_IPSUM = """
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum ... |
class Solution:
def climbStairs(self, n: int) -> int:
if n == 1 or n == 0:
return 1
prev, curr = 1, 1
for i in range(2, n + 1):
temp = curr
curr += prev
prev = temp
return curr
|
#Given two cells of a chessboard. If they are painted in one color, print the word YES, and if in a different color - NO.
r = int(input("Row number of the first cell on Chessboard, r = ?"))
if ((r > 8) or (r < 1)):
print("Invalid row number for a Chessboard!")
exit()
c = int(input("The column number for the f... |
[
{
'date': '2022-01-01',
'description': 'Nyårsdagen',
'locale': 'sv-SE',
'notes': '',
'region': '',
'type': 'NF'
},
{
'date': '2022-01-06',
'description': 'Trettondedag jul',
'locale': 'sv-SE',
'notes': '',
'region': ''... |
#!/usr/bin/python3
def sin(x):
"""
sin(x)
"""
return 42
|
# In Python, functions are first class citizens.
# That means that, just like any other value, they can be passed as arguments to functions or assigned to variables.
# Here's a simple (yet not terribly useful) example to illustrate it:
def greet():
print("Hello!")
hello = greet # hello is another name for the ... |
def extractBinhjamin(item):
"""
# Binhjamin
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (vol or chp or frag or postfix):
return False
if ('SRKJ' in item['title'] or 'SRKJ-Sayonara Ryuu' in item['tags']) and (chp or vol):
return buildReleaseMessageWithType(item, 'Sayon... |
def int_to_byte(i):
return i.to_bytes(1, byteorder='big')
def byte_to_int(b):
return int.from_bytes(b, byteorder='big', signed=False)
|
class ServicePrincipal:
def __init__(self, client_id=None, tenant_id=None, credential=None):
self.client_id = client_id
self.tenant_id = tenant_id
self.credential = credential
def from_dict(self, service_principal_dict):
self.client_id = service_principal_dict['client_id']
... |
# -*- coding: utf-8 -*-
"""Drive test constants."""
# Data
DRIVE_ROOT_WORKING = [
{
"drivewsid": "FOLDER::com.apple.CloudDocs::root",
"docwsid": "root",
"zone": "com.apple.CloudDocs",
"name": "",
"etag": "31",
"type": "FOLDER",
"assetQuota": 62418076,
... |
class _MockRouter:
root_viewset_cls = None
class NestedRouteTestCaseMixin:
def wrap_with_parents(self, child_class, *parent_classes):
"""
Wraps the child_class to be a nested route below the given
parent classes, where the last parent class is the "top route"
"""
all_... |
num_inpt = a = 7484
num_inpt_2 = b = 12312
while num_inpt != num_inpt_2: # nod
if num_inpt > num_inpt_2:
num_inpt = num_inpt - num_inpt_2
elif num_inpt_2 > num_inpt:
num_inpt_2 = num_inpt_2 - num_inpt
nok = a * b // num_inpt_2 #nok
print(nok)
|
"""This problem was asked by Dropbox.
Given a list of words, determine whether the words can be chained to form a circle.
A word X can be placed in front of another word Y in a circle if the last character
of X is same as the first character of Y.
For example, the words ['chair', 'height', 'racket', touch', 'tunic'... |
class State:
def __init__(self, element = None):
if element == None:
# create initial state
self.element = self.get_initial_state()
else:
self.element = element
def get_initial_state(self):
"""
Este metodo retorna o estado incial da busca... |
def count_and_print(f, l):
c=0
for e in l:
f.write(e)
f.write("\n")
c+=1
f.close()
return c
|
def readFlat(filename, delimiter):
f = open(filename)
ans = []
for line in f:
ans.append(map(lambda x:float(x), filter(lambda x:len(x)>0,line.split(delimiter))))
return ans
|
#-*-coding:utf8;-*-
#qpy:console
print(5 * '-', 'CONVERSOR DE MOEDAS', 5 * '-')
print('\n')
r = float(input('DIGITE O VALOR EM REAIS: '))
d = r / 5.29
e = r / 6.41
print('\n')
print(' CONVERSÃO - USS: {:.2f} / EURO: {:.2f}'.format(d, e))
|
"""
test_multi_group.py
Author: Jordan Mirocha
Affiliation: University of Colorado at Boulder
Created on: Sun Mar 24 01:04:54 2013
Description:
"""
|
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
def b(x):
msg = "x is %s" % x
print(msg)
|
class DoubleNode:
def __init__(self, value):
self.value = value
self.next = None
self.previous = None
class DoublyLinkedList:
def __init__(self):
self.head = None
self.tail = None
def append(self, value):
if self.head == None:
self.head = DoubleN... |
# Authors: Soledad Galli <solegalli@protonmail.com>
# License: BSD 3 clause
# functions shared across transformers
def _define_variables(variables):
# Check that variable names are passed in a list.
# Can take None as value
if not variables or isinstance(variables, list):
variables = variables
... |
K, A, B = map(int, input().split())
if B-A <= 2:
print(K+1)
exit(0)
if 1+(K-2) < A:
print(K+1)
exit(0)
exchange_times, last = divmod(K-(A-1), 2)
profit = B - A
ans = A + exchange_times * profit + last
print(ans)
|
def foo():
"""
Parameters:
a: foo
Returns:
None
""" |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2021/7/17 8:03 下午
# @Author : Thomas
# @File : URL化.py
# @Description: URL化。编写一种方法,将字符串中的空格全部替换为%20。假定该字符串尾部有足够的空间存放新增字符,并且知道字符串的“真实”长度。
# 示例 1:
#
# 输入:"Mr John Smith ", 13
# 输出:"Mr%20John%20Smith"
# 示例 2:
#
# 输入:" ", 5
# 输出:"%20%20%20%20%... |
"""
Desafio 009
Faça um programa que leia um número inteiro qualquer e mostre
na tela a sua tabuada.
"""
t = int(input('Digite o número para ver sua tabuada: '))
risco = lambda r='-', q=13: print(f"{r}"*q)
risco()
for sla in range(1, 11):
print(f'{t} x {sla:2} = {t*sla}')
risco()
|
m = "sdjlwdd"
c
print(mBytes)
mInt = int.from_bytes(mBytes, byteorder="big")
mBytes2 = mInt.to_bytes(((mInt.bit_length() + 7) // 8), byteorder="big")
m2 = mBytes2.decode("utf-8")
print(m == m2) |
# Q:编写一个程序,它将找到所有这些数字,可被7整除,但不是5的倍数,2000年至3200年(包括在内)。得到的数字应按逗号分隔的顺序打印在一行上。
# HINT:考虑使用range(#begin, #end)方法
l = []
for i in range(2000,3201):
if (i%7==0) and (i%5!=0):
l.append(str(i))
print (l) |
"""
Given the names and grades for each student in a Physics class of N students, store them in a nested list
and print the name(s) of any student(s) having the second lowest grade.
Note: If there are multiple students with the same grade, order their names alphabetically and print each name on a new line.
"""
python... |
# -*- coding: UTF-8 -*-
# vim: ts=4 sts=4 sw=4 tw=100 sta et
class NotInRole(Exception):
pass
def check_role(my_roles, requested_roles):
if not my_roles:
return True
for role in my_roles:
if role in requested_roles:
return True
raise NotInRole()
|
"""Write a program which will find all such numbers which are divisible
by 7 but are not a multiple of 5, between 2000 and 3200 (both included).
The numbers obtained should be printed in a comma-separated sequence on a
single line."""
for num in range(2000, 3201):
if num % 7 == 0 and num % 5 != 0:
prin... |
# -*- coding: utf-8 -*-
{
'name': "odoo-s3",
'summary': """
Stores attachments in Amazon S3 instead of the local drive""",
'description': """
In large deployments, Odoo workers need to share a distributed
filestore. Amazon S3 can store files (e.g. attachments and
pictures),... |
class PingError(Exception):
pass
class TimeExceeded(PingError):
pass
class TimeToLiveExpired(TimeExceeded):
def __init__(self, message="Time exceeded: Time To Live expired.", ip_header=None, icmp_header=None):
self.ip_header = ip_header
self.icmp_header = icmp_header
self.message... |
# -*- coding: utf-8 -*-
description = 'Sample table'
group = 'lowlevel'
devices = dict(
st_phi = device('nicos.devices.generic.VirtualMotor',
unit = 'deg',
abslimits = (-50, 116.1),
speed = 1.5,
visibility = (),
),
co_phi = device('nicos.devices.generic.VirtualCoder',
... |
# demo of looping through the characters of a string, using the sorted and reversed functions
s = input("Enter a string:")
n = len(s)
print("The first character of", s, "is", s[0])
print("The entered string will appear character wise as:")
for i in range(0, n):
print(s[i])
print("The entered string will appear char... |
# ------------------------------------------------------------------------------------
# Tutorial: How to make a recursive function
# A recursive function is a function that calls itself
# ------------------------------------------------------------------------------------
# find the factorial of a user entered numbe... |
class BaseError(Exception):
"""Base Error Class"""
def __init__(self, code=400, message='', status='', field=None):
Exception.__init__(self)
self.code = code
self.message = message
self.status = status
self.field = field
def to_dict(self):
return {'code': se... |
"""
Write a function that takes an integer as input, and returns the number of bits that are equal to one in the binary
representation of that number. You can guarantee that input is non-negative.
Example: The binary representation of 1234 is 10011010010, so the function should return 5 in this case
"""
def count_bit... |
#03_personal-info.py
space= " "
firstName = input("What is your first name?")
lastName = input("What is your last name?")
location = input("What is your location?")
age = input("What is your age?")
print("Hi "+ firstName + space + lastName +"! Your location is "+ location + " and you are "+age + " years old!")
|
class Reply(object):
"""{
"kind": "drive#commentReply",
"replyId": string,
"createdDate": datetime,
"modifiedDate": datetime,
"author": {
"kind": "drive#user",
"displayName": string,
"picture": {
"url": string
},... |
# Space : O(len(word))
# Time : O(n * len(word))
class Solution:
def findAndReplacePattern(self, words: List[str], pattern: str) -> List[str]:
ans = []
pn = len(pattern)
for word in words:
if len(word) != pn:
continue
mem1, mem2 = {}, {}
... |
def indent(string, level=1, lstrip_first=False):
"""Multiline string indent.
Indent each line of the provided string by the specified level.
Args:
string: The string to indent, possibly containing linebreaks.
level: The level to indent (``level * ' '``). Defaults to 1.
lstrip_first... |
'''Crie um programa que leia idade e sexo de varias pessoas
e pergunte se o usuario quer conrinuar
no final mostre
quantas pessoas tem mais de 18 anos
quantos homens foram cadastrados
e quantas mulheres tem menos de 20 anos'''
pessoas_18 = mulher_20 = homen = 0
while True:
idade = int(input('Digite a Idade: '))
... |
class GuidAttribute:
"""
Supplies an explicit System.Guid when an automatic GUID is undesirable.
GuidAttribute(guid: str)
"""
def ZZZ(self):
"""hardcoded/mock instance of the class"""
return GuidAttribute()
instance=ZZZ()
"""hardcoded/returns an instance of the class"""
def __init__(self,*arg... |
# Common use case - File IO
# "Everything not saved will be lost."
#
# Prereq:
# string operations: split(), strip(), format(), join()
# list operations: append()
# built-in functions: len(), open()
#
# Reading:
# open()
# https://docs.python.org/3/library/functions.html#open
# string.strip()
# ht... |
print("Not Hesaplama.. ")
vize1 = int(input("1.Vize notu:"))
while (vize1 < 0 or vize1 > 100):
vize1 = int(input("Hata! 0-100 arası not giriniz:"))
vize2 = int(input("2.Vize notu:"))
while (vize2 < 0 or vize2 > 100):
vize2 = int(input("Hata! 0-100 arası not giriniz:"))
final = int(input("Final notu(0-100... |
class admin():
def __init__(self):
pass
def get_id(self):
pass |
r1 = float(input('Insira o comprimento da primeira reta:'))
r2 = float(input('Insira o comprimento da segunda reta:'))
r3 = float(input('Insira o coprimento da terceira reta: '))
if r1 + r2 > r3 and r2 + r3 > r1 and r1 + r3 > r2:
if r1 == r2 == r3:
print(f'O seu triângulo é Equilátero.')
elif r1 == r2 ... |
def get_hello():
return 'Hello'
class HelloSayer():
def say_hello(self):
print('Hello') |
####################################
### The router base class
class Router(object):
'''Common superclass of routers'''
pass
|
# Global parameter
examples_root = None
process_type_name_ns_to_clean = None
synopsis_maxlen_function = 120
synopsis_class_list = None
|
sum=0
i=0
while i<=4:
if sum<=5000:
item=int(input("Enter the item amount"))
sum=sum+item
i=i+1
print("Total items",i,"selected and total amount is:",sum)
else:
print("Account limit crossed")
break
|
class Coord(tuple):
def __add__(self, other):
if isinstance(other, Coord) and len(self) == len(other):
return Coord(i+j for i, j in zip(self, other))
def trees(inp, step: tuple):
step = Coord(step)
current = step
while current[0] < len(inp):
yield inp[current[0]][current[1]... |
numero = 0
print('------------------------------------------------')
print("PARA SAIR DO PROGRAMA, DIGITE UM VALOR NEGATIVO!")
print('------------------------------------------------')
while True:
numero = int(input('Que número desejas fazer a tabuada? '))
if(numero < 0):
break
else:
for c i... |
DOWNLOAD_CHUNK_SIZE = 32768
FETCH_LIMIT = 200
def count_motions(db, project_ids=None, institution_ids=None, description_filter=None):
count = db.countMotions(None, project_ids, institution_ids, None, None, description_filter)
return count
def fetch_motions(db, project_ids=None, institution_ids=None, description_f... |
# Recursive function to perform pre-order traversal of the tree
def preorder(root):
# return if the current node is empty
if root is None:
return
# Display the data part of the root (or current node)
print(root.data, end=' ')
# Traverse the left subtree
preorder(root.left)
# ... |
# defining object file1 to
# open GeeksforGeeks file in
# read mode
file1 = open('GeeksforGeeks.txt',
'r')
# defining object file2 to
# open GeeksforGeeksUpdated file
# in write mode
file2 = open('GeeksforGeeksUpdated.txt',
'w')
# reading each line from original
# text file
for line in file1.readlin... |
template_string = '''#!/bin/bash
#PBS -S /bin/bash
#PBS -N ${jobname}
#PBS -m n
#PBS -l walltime=$walltime
#PBS -l select=${nodes_per_block}:ncpus=${ncpus}${select_options}
#PBS -o ${submit_script_dir}/${jobname}.submit.stdout
#PBS -e ${submit_script_dir}/${jobname}.submit.stderr
${scheduler_options}
${worker_init}
... |
number = "7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729... |
# This program demonstrates the use of the == operator using numbers
print (5 == 6)
# Using variables
x = 5
y = 8
print(x == y)
|
class Core:
def gen_range(self, StartNumber, EndNumber, GapNumber):
number_range_result = []
row_number_sp = StartNumber
gap = int(EndNumber) - int(StartNumber)
if gap > GapNumber:
for X in range(int(gap / GapNumber)):
temp = []
temp.appen... |
"""
Day 14 - Part 1
https://adventofcode.com/2021/day/14
By NORXND @ 14.12.2021
(C) NORXND 2021 - Under The MIT License
"""
input_file = open("Day14/input.txt", "r")
input_segments = input_file.read().split("\n\n")
template = input_segments[0]
rules = {}
for raw_rule in input_segments[1].splitlines():
rule = raw... |
manager_num1 =10
manager_num2 =11
zhangsan_num1 = 22
num3 = 30
pp = 36
ll = 23
nishuia
|
class FilterModule:
def filters(self):
return {
'user_home': self.user_home
}
def user_home(self, d, username):
for user in d["results"]:
if user["item"] == username:
return user["home"]
return ValueError("Cannot find the home directory f... |
class Solution:
def depthSumInverse(self, nestedList: List[NestedInteger]) -> int:
dic = {}
level = 0
q = collections.deque()
q.append(nestedList)
res = 0
while q:
size = len(q)
level += 1
sums = 0
for _ in range(size):
... |
class Solution:
def reverseWords(self, s: str) -> str:
# Using Python's built-in string manipulation methods
# Split the string into words at the spaces, reverse and join the
# individual words, then rejoin the words with a space
s = s.split(' ')
for i, word in enumerate(s):
... |
KEY_QUESTION_TYPE = 'question_type'
KEY_QUESTION = 'question'
KEY_ANSWER = 'answer'
KEY_OPTIONS = 'options'
KEY_COMPREHENSION = 'comprehension'
KEY_EXPLANATION = 'explanation'
|
def isExistingClassification(t):
pass
def getSrcNodeName(dst):
"""
Get the name of the node connected to the argument dst plug.
"""
pass
def getCollectionsRecursive(parent):
pass
def disconnect(src, dst):
pass
def findVolumeShader(shadingEngine, search='False'):
"""
Returns ... |
# [463] 岛屿的周长
# https://leetcode-cn.com/problems/island-perimeter/description/
# * algorithms
# * Easy (71.50%)
# * Total Accepted: 55.3K
# * Total Submissions: 77.3K
# * Testcase Example: '[[0,1,0,0],[1,1,1,0],[0,1,0,0],[1,1,0,0]]'
# 给定一个包含 0 和 1 的二维网格地图,其中 1 表示陆地 0 表示水域。
# 网格中的格子水平和垂直方向相连(对角线方向不相连)。整个网格被水完全包围,... |
# 1. Property-specific details
# Timezone string follows TZ format (see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
PROP_NAME = "Ascott Raffles Place Singapore"
TIMEZONE = "Asia/Singapore"
# 2. Languages expected to be in use at this property
BABEL_LOCALES = ('en', 'zh', 'ms', 'ta')
BABEL_DEFAULT_LO... |
"""
Ejercicio 17
En un hospital rural existen tres áreas: Ginecología, Pediatría y Traumatología. El presupuesto anual del hospital
se reparte conforme a la siguiente tabla:
Área Porcentaje del presupuesto
Ginecología 40%
Traumatología 30%
Pediatría 30%
Obtener ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.