content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
s=input()
f=0
for x in s:
if x=='H' or x=='Q' or x=='9':
f=1
break
if f==1:
print("YES")
else:
print("NO") | s = input()
f = 0
for x in s:
if x == 'H' or x == 'Q' or x == '9':
f = 1
break
if f == 1:
print('YES')
else:
print('NO') |
class MarketCrash(Exception):
pass
class NotEnoughCoin(Exception):
pass
class DustTrade(Exception):
pass
class InvalidDictionaryKey(Exception):
pass
# -*- coding: utf-8 -*-
def identify_and_raise(error_text):
if 'Total must be at least' in error_text:
raise DustTrade... | class Marketcrash(Exception):
pass
class Notenoughcoin(Exception):
pass
class Dusttrade(Exception):
pass
class Invaliddictionarykey(Exception):
pass
def identify_and_raise(error_text):
if 'Total must be at least' in error_text:
raise dust_trade(error_text)
if 'Not enough' in error_te... |
"""
Print all permutations of a given string
input: ABC
output:
ABC
ACB
BAC
BCA
CAB
CBA
notes:
There are n! permutations
the height of the tree will always be len(a)
"""
def permute(a, l, r):
if l == r:
print("".join(a))
else:
for i in range(l, r+1):
a[l], a[i] = a[i], a[l]
... | """
Print all permutations of a given string
input: ABC
output:
ABC
ACB
BAC
BCA
CAB
CBA
notes:
There are n! permutations
the height of the tree will always be len(a)
"""
def permute(a, l, r):
if l == r:
print(''.join(a))
else:
for i in range(l, r + 1):
(a[l], a[i]) = (a[i], a[l])
... |
{
'service_metadata': {
'service_name': 'tooth',
'service_version': '0.1',
},
'dataset_loader_train': {
'!': 'palladium.R.DatasetLoader',
'scriptname': 'tooth.R',
'funcname': 'dataset',
},
'dataset_loader_test': {
'!': 'palladium.R.DatasetLoader',
... | {'service_metadata': {'service_name': 'tooth', 'service_version': '0.1'}, 'dataset_loader_train': {'!': 'palladium.R.DatasetLoader', 'scriptname': 'tooth.R', 'funcname': 'dataset'}, 'dataset_loader_test': {'!': 'palladium.R.DatasetLoader', 'scriptname': 'tooth.R', 'funcname': 'dataset'}, 'model': {'!': 'sklearn.pipelin... |
even_number = int(input('Enter even number: '))
while not even_number % 2 == 0:
print('The number is not even.')
even_number = int(input('Enter even number: '))
print('Even number entered: ' + str(even_number))
| even_number = int(input('Enter even number: '))
while not even_number % 2 == 0:
print('The number is not even.')
even_number = int(input('Enter even number: '))
print('Even number entered: ' + str(even_number)) |
accuracy_scores = {
'id1': 0.27, 'id2': 0.75, 'id3': 0.61, 'id4': 0.05, 'id5': 0.4,
'id6': 0.67, 'id7': 0.69, 'id8': 0.52, 'id9': 0.7, 'id10': 0.3
}
good_ids = list(____(lambda x: ___ > 0.6, accuracy_scores.___()))
print(good_ids)
| accuracy_scores = {'id1': 0.27, 'id2': 0.75, 'id3': 0.61, 'id4': 0.05, 'id5': 0.4, 'id6': 0.67, 'id7': 0.69, 'id8': 0.52, 'id9': 0.7, 'id10': 0.3}
good_ids = list(____(lambda x: ___ > 0.6, accuracy_scores.___()))
print(good_ids) |
# Databricks notebook source
# MAGIC %run "./TutorialClasses"
# COMMAND ----------
# Azure Storage account name
MagAccount = 'kdd2019magstore'
# MAG container name
MagContainer = 'mag-2019-06-07'
# Shared access signature of MAG Container
MagSAS = ''
# COMMAND ----------
mag = MicrosoftAcademicGraph(container=Mag... | mag_account = 'kdd2019magstore'
mag_container = 'mag-2019-06-07'
mag_sas = ''
mag = microsoft_academic_graph(container=MagContainer, account=MagAccount, sas=MagSAS)
affiliations = mag.getDataframe('Affiliations')
conference_series = mag.getDataframe('ConferenceSeries')
fields_of_study = mag.getDataframe('FieldsOfStudy'... |
cid = 'ID goes here'
secret = 'Secret goes here'
agent = 'python:(name):(version) (by (author))'
user = 'bot username'
password = 'bot password'
subreddit = 'subreddit'
permissions_api = 'api key' # several features use a different API (AppMonsta)
blacklisted_devs = []
| cid = 'ID goes here'
secret = 'Secret goes here'
agent = 'python:(name):(version) (by (author))'
user = 'bot username'
password = 'bot password'
subreddit = 'subreddit'
permissions_api = 'api key'
blacklisted_devs = [] |
"""
@author axiner
@version v1.0.0
@created 2021/12/12 13:14
@abstract
@description
@history
"""
class Versions(object):
ALL = [
('2022.02.21', 'Fix. eg: decompress'),
('2022.02.20', 'Chg.'),
('2022.02.09', 'Chg. eg: global>kvalue'),
('2022.02.08', 'Add. eg: regexp.py, useragent.py... | """
@author axiner
@version v1.0.0
@created 2021/12/12 13:14
@abstract
@description
@history
"""
class Versions(object):
all = [('2022.02.21', 'Fix. eg: decompress'), ('2022.02.20', 'Chg.'), ('2022.02.09', 'Chg. eg: global>kvalue'), ('2022.02.08', 'Add. eg: regexp.py, useragent.py'), ('2022.02.04', 'Add. eg: xlsx.... |
def conv(num):
return(9/5 * celsius + 32)
def convert(num):
return((fahr - 32) * 5/9)
confirm = input("Are we converting celsius or fahrenheit today? ")
if confirm == 'celsius':
celsius = int(input("What is the temperature we are coverting in celsius? "))
fahrenheit = conv(celsius)
print(f"{(round(fahren... | def conv(num):
return 9 / 5 * celsius + 32
def convert(num):
return (fahr - 32) * 5 / 9
confirm = input('Are we converting celsius or fahrenheit today? ')
if confirm == 'celsius':
celsius = int(input('What is the temperature we are coverting in celsius? '))
fahrenheit = conv(celsius)
print(f'{round... |
# Match each number on a ticket to a field; each field must have a valid number.
# Return product of all numbers belonging to departure* fields on my ticket.
# Strategy:
# Make rules dict with rule name as key and array of possible valid numbers as value.
# Make rules_positions dict with rule name as key and set of po... | data = []
index = 0
file = open('input.txt', 'r')
for line in file:
data.append(line.strip())
if line.strip() == 'your ticket:':
ticket_index = index
elif line.strip() == 'nearby tickets:':
nearby_index = index
index += 1
rules = data[:ticket_index - 1]
my_ticket = data[ticket_index + 1]... |
MAXN = 100000+5
MAXI = 1000000+5
n,i = input().split(' ')
n = int(n)
I = int(i)
a = [-1 for i in range(0,n)]
co = [1 for i in range(0,n)]
def F(x):
t = x
while ( a[t] != -1 ):
t = a[t]
if ( ( a[x] != -1 ) & ( a[x] != t ) ):
a[x] = t
#co[t] += co[x]
return t
def U(x,y):
f... | maxn = 100000 + 5
maxi = 1000000 + 5
(n, i) = input().split(' ')
n = int(n)
i = int(i)
a = [-1 for i in range(0, n)]
co = [1 for i in range(0, n)]
def f(x):
t = x
while a[t] != -1:
t = a[t]
if (a[x] != -1) & (a[x] != t):
a[x] = t
return t
def u(x, y):
fx = f(x)
fy = f(y)
if... |
friend_ages = {"Rolf": 24, "Adam": 30, "Anne": 27}
print(friend_ages["Rolf"]) # 24
# friend_ages["Bob"] ERROR
# -- Adding a new key to the dictionary --
friend_ages["Bob"] = 20
print(friend_ages) # {'Rolf': 24, 'Adam': 30, 'Anne': 27, 'Bob': 20}
# -- Modifying existing keys --
friend_ages["Rolf"] = 25
print(fr... | friend_ages = {'Rolf': 24, 'Adam': 30, 'Anne': 27}
print(friend_ages['Rolf'])
friend_ages['Bob'] = 20
print(friend_ages)
friend_ages['Rolf'] = 25
print(friend_ages)
friends = [{'name': 'Rolf Smith', 'age': 24}, {'name': 'Adam Wool', 'age': 30}, {'name': 'Anne Pun', 'age': 27}]
friends = [('Rolf', 24), ('Adam', 30), ('A... |
if node.os != 'ubuntu' and node.os != 'raspbian':
raise Exception('{} {} is not supported by this bundle'.format(node.os, node.os_version))
for username, data in node.metadata['users'].items():
homedir = data.get('home', '/home/{}'.format(username))
dotfiles = data.get('dotfiles', '')
if len(dotfiles) ... | if node.os != 'ubuntu' and node.os != 'raspbian':
raise exception('{} {} is not supported by this bundle'.format(node.os, node.os_version))
for (username, data) in node.metadata['users'].items():
homedir = data.get('home', '/home/{}'.format(username))
dotfiles = data.get('dotfiles', '')
if len(dotfiles)... |
# ===============================================================================
#
# Copyright (c) 2013-2016 Qualcomm Technologies, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#
# ===============================================================================
'''
Create... | """
Created on Apr 7, 2014
@author: hraghav
"""
po_string = 'Offset'
pv_string = 'VAddr'
pp_string = 'PAddr'
pf_string = 'FileSz'
pm_string = 'MemSz'
pa_string = 'Align'
pfl_string = 'Flags' |
"""
Module contains current pmagpy version number.
Version number is displayed by GUIs
and used by setuptools to assign number to pmagpy/pmagpy-cli.
"""
"pmagpy-4.2.93"
version = 'pmagpy-4.2.93'
| """
Module contains current pmagpy version number.
Version number is displayed by GUIs
and used by setuptools to assign number to pmagpy/pmagpy-cli.
"""
'pmagpy-4.2.93'
version = 'pmagpy-4.2.93' |
"""
The class that handles all special action protocols that aren't "basic".
"basic" actions are ones that involves one request and one response,
"special" actions require more communication.
"""
class SpecialActionHandler:
def __init__(self):
pass
async def execute_special_action(self,action,bo... | """
The class that handles all special action protocols that aren't "basic".
"basic" actions are ones that involves one request and one response,
"special" actions require more communication.
"""
class Specialactionhandler:
def __init__(self):
pass
async def execute_special_action(self, action, bot_... |
#
# PySNMP MIB module Unisphere-Data-IGMP-CONF (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Unisphere-Data-IGMP-CONF
# Produced by pysmi-0.3.4 at Mon Apr 29 21:24:14 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_union, value_size_constraint, value_range_constraint, constraints_intersection) ... |
#!/usr/bin/env python
"""A simple exception for the EE library."""
class EEException(Exception):
"""A simple exception for the EE library."""
pass
| """A simple exception for the EE library."""
class Eeexception(Exception):
"""A simple exception for the EE library."""
pass |
# MapCollection
# Copyright (c) Simon Raichl 2019
# MIT License
class MapCollection:
__slots__ = ["__values"]
def __init__(self, iterable=None):
self.__values = []
if isinstance(iterable, list):
for key, value in iterable:
self.set(key, value)
def __setitem_... | class Mapcollection:
__slots__ = ['__values']
def __init__(self, iterable=None):
self.__values = []
if isinstance(iterable, list):
for (key, value) in iterable:
self.set(key, value)
def __setitem__(self, key, value):
self.set(key, value)
def __getit... |
#
# For licensing see accompanying LICENSE file.
# Copyright (C) 2020 Apple Inc. All Rights Reserved.
#
info = {
"ens_6": ["C0", "-", "x", "Line (Ensemble)"],
"ens_6_28": ["C0", "-", "x", r"Line (Ensemble $\alpha=0.2,0.8$)"],
"ens_4": ["C1", "-", "d", "Line (Layerwise, Ensemble)"],
"ens_0": ["C3", "-", ... | info = {'ens_6': ['C0', '-', 'x', 'Line (Ensemble)'], 'ens_6_28': ['C0', '-', 'x', 'Line (Ensemble $\\alpha=0.2,0.8$)'], 'ens_4': ['C1', '-', 'd', 'Line (Layerwise, Ensemble)'], 'ens_0': ['C3', '-', 'o', 'Curve (Ensemble)'], 'ens_1': ['C4', '-', '^', 'Curve (Ensemble)'], 't_6': ['C0', '--', 'x', 'Line'], 't_4': ['C1', ... |
def find_second_f(array, pattern):
"""
Source https://pythontutor.ru/lessons/str/problems/second_occurence/
Condition
Given a string. Find in this line the second occurrence of the letter f,
and print the index of this occurrence.
If the letter f appears in this line only once, print the n... | def find_second_f(array, pattern):
"""
Source https://pythontutor.ru/lessons/str/problems/second_occurence/
Condition
Given a string. Find in this line the second occurrence of the letter f,
and print the index of this occurrence.
If the letter f appears in this line only once, print the number ... |
def binarySearch (arr, l, r, x):
if r >= l:
mid = int((l + r)/2)
if arr[mid] == x:
return mid
elif arr[mid] > x:
return binarySearch(arr, l, mid-1, x)
else:
return binarySearch(arr, mid + 1, r, x)
... | def binary_search(arr, l, r, x):
if r >= l:
mid = int((l + r) / 2)
if arr[mid] == x:
return mid
elif arr[mid] > x:
return binary_search(arr, l, mid - 1, x)
else:
return binary_search(arr, mid + 1, r, x)
else:
return -1
list1 = []
for i ... |
class InvalidTileMatrixIndex(KeyError):
"""Raise when Tile Matrix is not available in TileMatrixSet."""
class InvalidTileIndex(KeyError):
"""Raise when Tile is not available in TileMatrix."""
| class Invalidtilematrixindex(KeyError):
"""Raise when Tile Matrix is not available in TileMatrixSet."""
class Invalidtileindex(KeyError):
"""Raise when Tile is not available in TileMatrix.""" |
def errors_mean(y_pred, y_real):
"""
:param y_pred: list of predicted
:param y_real: list of real
:return:
"""
if len(y_pred) != len(y_real):
print("Error, unmatched number of ys")
return None
tot_err = 0.0
for i in range(len(y_pred)):
tot_err += abs(y_pred[i]-y_... | def errors_mean(y_pred, y_real):
"""
:param y_pred: list of predicted
:param y_real: list of real
:return:
"""
if len(y_pred) != len(y_real):
print('Error, unmatched number of ys')
return None
tot_err = 0.0
for i in range(len(y_pred)):
tot_err += abs(y_pred[i] - y... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
def foo(f):
print("decorating", f.__name__)
print()
return f
# Equivalent to:
#
# def bar():
# ...
#
# bar = foo(bar)
@foo
def bar():
print("hello")
bar()
| def foo(f):
print('decorating', f.__name__)
print()
return f
@foo
def bar():
print('hello')
bar() |
#!/usr/bin/env python3
"""
This document is created by magic at 2018/8/18
"""
| """
This document is created by magic at 2018/8/18
""" |
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 2 01:30:27 2020
#Separating track points in Area 3
"""
#Area 3
test1 = test.drop(index=(test.loc[(test['lon']<=23.7312)].index))
test1 = test1.drop(index=(test1.loc[(test1['lon']>=23.7317)].index))
test1 = test1.drop(index=(test1.loc[(test1['lat']<=37.9918... | """
Created on Wed Sep 2 01:30:27 2020
#Separating track points in Area 3
"""
test1 = test.drop(index=test.loc[test['lon'] <= 23.7312].index)
test1 = test1.drop(index=test1.loc[test1['lon'] >= 23.7317].index)
test1 = test1.drop(index=test1.loc[test1['lat'] <= 37.99185].index)
test1 = test1.drop(index=test1.loc[test1[... |
"""Scripts that are copied into our target repository.
They are stored separately from jinja2 templated files to make them easier to
test.
"""
| """Scripts that are copied into our target repository.
They are stored separately from jinja2 templated files to make them easier to
test.
""" |
def solution(A, B, K):
if A > B or K <= 0:
return 0
excludes = A / K - (0 if A % K else 1)
allDivisibles = B / K
return allDivisibles - excludes
assert 0 == solution(12, 11, 2)
assert 0 == solution(6, 11, 0)
assert 0 == solution(11, 11, 2)
assert 1 == solution(10, 10, 2)
assert 3 == solution(... | def solution(A, B, K):
if A > B or K <= 0:
return 0
excludes = A / K - (0 if A % K else 1)
all_divisibles = B / K
return allDivisibles - excludes
assert 0 == solution(12, 11, 2)
assert 0 == solution(6, 11, 0)
assert 0 == solution(11, 11, 2)
assert 1 == solution(10, 10, 2)
assert 3 == solution(6,... |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"audio_extensions": "00_Core_Signal.ipynb",
"get_audio_files": "00_Core_Signal.ipynb",
"AudioGetter": "00_Core_Signal.ipynb",
"URLs.SPEAKERS10": "00_Core_Signal.ipynb",
"UR... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'audio_extensions': '00_Core_Signal.ipynb', 'get_audio_files': '00_Core_Signal.ipynb', 'AudioGetter': '00_Core_Signal.ipynb', 'URLs.SPEAKERS10': '00_Core_Signal.ipynb', 'URLs.SPEAKERS250': '00_Core_Signal.ipynb', 'URLs.ESC50': '00_Core_Signal.ipynb'... |
ALLOWED_MEHTODS = ['get', 'post', 'put', 'patch', 'delete', 'head', 'options', 'trace']
HTTP_REQUEST_METHODS = tuple((key, key.upper()) for key in ALLOWED_MEHTODS)
| allowed_mehtods = ['get', 'post', 'put', 'patch', 'delete', 'head', 'options', 'trace']
http_request_methods = tuple(((key, key.upper()) for key in ALLOWED_MEHTODS)) |
# Copyright 2017 The Bazel Go Rules Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | def _impl(ctx):
exe = ctx.outputs.out
ctx.actions.write(output=exe, content=' ', is_executable=True)
return [default_info(files=depset([exe]), executable=exe)]
_single_output_test = rule(implementation=_impl, attrs={'dep': attr.label(allow_single_file=True), 'out': attr.output()}, test=True)
def single_out... |
class A:
def __init__(self, a, b=2, c=3):
self.a = a
class B(A):
def __init__(self, a, c):
A.__init__(self, a, c)
| class A:
def __init__(self, a, b=2, c=3):
self.a = a
class B(A):
def __init__(self, a, c):
A.__init__(self, a, c) |
class Chunks:
HEADER = 0x1
TEXTURE = 0x2
VERTICES = 0x3
INDICES = 0x4
SWIDATA = 0x6
VCONTAINER = 0x7
ICONTAINER = 0x8
CHILDREN = 0x9
CHILDREN_L = 0xa
LODDEF2 = 0xb
TREEDEF2 = 0xc
S_BONE_NAMES = 0xd
S_MOTIONS = 0xe
S_SMPARAMS = 0xf
S_IKDATA = 0x10
S_USERDAT... | class Chunks:
header = 1
texture = 2
vertices = 3
indices = 4
swidata = 6
vcontainer = 7
icontainer = 8
children = 9
children_l = 10
loddef2 = 11
treedef2 = 12
s_bone_names = 13
s_motions = 14
s_smparams = 15
s_ikdata = 16
s_userdata = 17
s_desc = 18
... |
"""
MIT License
Copyright (c) 2022 Alpha Zero
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 use, copy, modify, merge, publish, di... | """
MIT License
Copyright (c) 2022 Alpha Zero
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 use, copy, modify, merge, publish, di... |
# The read4 API is already defined for you.
# @param buf, a list of characters
# @return an integer
# def read4(buf):
class Solution(object):
def read(self, buf, n):
"""
:type buf: Destination buffer (List[str])
:type n: Maximum number of characters to read (int)
:rtype: The number ... | class Solution(object):
def read(self, buf, n):
"""
:type buf: Destination buffer (List[str])
:type n: Maximum number of characters to read (int)
:rtype: The number of characters read (int)
"""
ans = []
cnt = 0
temp = [None] * 4
while cnt < n:... |
# Copyright 2017 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | def encode_request(request, module):
if 'metadata' in request:
if 'properties' in request['metadata']:
request['metadata']['properties'] = metadata_encoder(request['metadata']['properties'])
return request
def decode_response(response, module):
if 'metadata' in response:
if 'pro... |
#!/usr/bin/env python
class CountDown(object):
'''Class implementign a counter that goes from a start value to 0'''
def __init__(self, n):
'''Constructor setting the value to count down from'''
self._n = n
self._current = n
@property
def n(self):
'''Returns value that... | class Countdown(object):
"""Class implementign a counter that goes from a start value to 0"""
def __init__(self, n):
"""Constructor setting the value to count down from"""
self._n = n
self._current = n
@property
def n(self):
"""Returns value that this counter will count... |
def get_num_of_cards_in_play(dp_list, hand=[]):
num_in_play = [0] * (len(dp_list) + 1)
for k in dp_list.keys():
num_discarded = dp_list[k][0]
num_in_deck = dp_list[k][1]
num_in_play[k] = num_in_deck - num_discarded
for c in hand:
num_in_play[c.get_value()] -= 1
return(n... | def get_num_of_cards_in_play(dp_list, hand=[]):
num_in_play = [0] * (len(dp_list) + 1)
for k in dp_list.keys():
num_discarded = dp_list[k][0]
num_in_deck = dp_list[k][1]
num_in_play[k] = num_in_deck - num_discarded
for c in hand:
num_in_play[c.get_value()] -= 1
return num... |
class SigNetNode:
""" An object represetation of nodes in a signaling network"""
## constructor
# @param name String representation of the node
# @param nodeType String represetation of the type of a node. Possible
# @param bMeasured
def __init__(self, name, nodeType, bMeasured):... | class Signetnode:
""" An object represetation of nodes in a signaling network"""
def __init__(self, name, nodeType, bMeasured):
self.name = name
self.type = nodeType
self.bMeasured = bMeasured |
'''
Author : @amitrajitbose
'''
def bytelandpopulation(n):
n=n-1
x=(n//26)
remaining=n-(26*x)
if(remaining>=10):
p=[0,0,2**x]
elif(remaining>=2):
p=[0,2**x,0]
else:
p=[2**x,0,0]
print(*p)
def main():
t=int(input())
for _ in range(t):
num=int(input())
bytelandpopulation(num)
if _... | """
Author : @amitrajitbose
"""
def bytelandpopulation(n):
n = n - 1
x = n // 26
remaining = n - 26 * x
if remaining >= 10:
p = [0, 0, 2 ** x]
elif remaining >= 2:
p = [0, 2 ** x, 0]
else:
p = [2 ** x, 0, 0]
print(*p)
def main():
t = int(input())
for _ in ra... |
class MingException(Exception): pass
class MongoGone(MingException): pass
class MingConfigError(MingException): pass
| class Mingexception(Exception):
pass
class Mongogone(MingException):
pass
class Mingconfigerror(MingException):
pass |
class Solution:
def reconstructQueue(self, people: List[List[int]]) -> List[List[int]]:
if not people:
return []
people.sort(key=lambda x: [-x[0], x[1]])
ret = []
for p in people:
ret.insert(p[1], p)
return ret
| class Solution:
def reconstruct_queue(self, people: List[List[int]]) -> List[List[int]]:
if not people:
return []
people.sort(key=lambda x: [-x[0], x[1]])
ret = []
for p in people:
ret.insert(p[1], p)
return ret |
#
# PySNMP MIB module NETSCREEN-QOS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NETSCREEN-QOS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:20:15 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, single_value_constraint, value_size_constraint, constraints_union, value_range_constraint) ... |
subtotal=0
n=1
while n>=0:
idd,qtde,valor = input().split()
subtotal+= int(qtde)*float(valor)
n-=1
print('VALOR A PAGAR: R$ {:.2f}'.format(subtotal)) | subtotal = 0
n = 1
while n >= 0:
(idd, qtde, valor) = input().split()
subtotal += int(qtde) * float(valor)
n -= 1
print('VALOR A PAGAR: R$ {:.2f}'.format(subtotal)) |
# 0 : Sunday ~ 6: Saturday
def getDay(current, days):
return (current + days) % 7
def isLeafYear(year):
if year % 100 == 0:
return True if year % 400 == 0 else False
return year % 4 == 0
DAYS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
def moveNextMonth(currentYear, currentMonth, currentDa... | def get_day(current, days):
return (current + days) % 7
def is_leaf_year(year):
if year % 100 == 0:
return True if year % 400 == 0 else False
return year % 4 == 0
days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
def move_next_month(currentYear, currentMonth, currentDay):
days = DAYS[cur... |
#
# PySNMP MIB module HW-PDUM-MIB (http://pysnmp.sf.net)
# ASN.1 source file:///usr/share/snmp/mibs/HW-PDUM-MIB.txt
# Produced by pysmi-0.1.1 at Mon Apr 3 21:29:04 2017
# On host localhost.localdomain platform Linux version 3.10.0-123.el7.x86_64 by user root
# Using Python version 2.7.5 (default, Nov 6 2016, 00:28:07... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, single_value_constraint, constraints_intersection, value_size_constraint, value_range_constraint) ... |
class AccountSettings(object):
def __init__(self, email, high_quality, public_images, album_privacy, pro_expiration, accepted_gallery_terms,
active_emails, messaging_enabled, blocked_users):
self.email = email
self.high_quality = high_quality
self.public_images = public_ima... | class Accountsettings(object):
def __init__(self, email, high_quality, public_images, album_privacy, pro_expiration, accepted_gallery_terms, active_emails, messaging_enabled, blocked_users):
self.email = email
self.high_quality = high_quality
self.public_images = public_images
self.... |
"""
This is an examples reports_dict.
report_name: Name of report and url path of the report
refresh_rate: How long report data will remain in cache
query: A Google Analyics query.
"""
report_dict = [
{
'report_name': 'top-sources',
'refresh_rate': 60,
'query': {
'ids': 'ga:86930... | """
This is an examples reports_dict.
report_name: Name of report and url path of the report
refresh_rate: How long report data will remain in cache
query: A Google Analyics query.
"""
report_dict = [{'report_name': 'top-sources', 'refresh_rate': 60, 'query': {'ids': 'ga:86930627', 'dimensions': 'ga:source', 'metrics':... |
# coding=utf-8
class Property(object):
def __init__(self, name, is_required, is_credential, system_provided,
property_type, json_schema, provided, tap_mutable):
self.name = name
self.is_required = is_required
self.is_credential = is_credential
self.system_provided = ... | class Property(object):
def __init__(self, name, is_required, is_credential, system_provided, property_type, json_schema, provided, tap_mutable):
self.name = name
self.is_required = is_required
self.is_credential = is_credential
self.system_provided = system_provided
self.pr... |
username = ""
password = ""
do_not_stalk_list = ["person1"]
lookup_dict = {"person name": "email-or-phone-number"}
| username = ''
password = ''
do_not_stalk_list = ['person1']
lookup_dict = {'person name': 'email-or-phone-number'} |
def firstNotRepeatingCharacter(string):
chars = {}
for c in string:
if chars.get(c):
chars[c] += 1
else:
chars[c] = 1
for c in string:
if chars[c] == 1:
return c
return "_"
| def first_not_repeating_character(string):
chars = {}
for c in string:
if chars.get(c):
chars[c] += 1
else:
chars[c] = 1
for c in string:
if chars[c] == 1:
return c
return '_' |
'''
--------------------------------------------------------------------
Maybe Numeric
--------------------------------------------------------------------
Distributed under the BSD 2-clause "Simplified" License.
(See accompanying file LICENSE or copy at
http://opensource.org/licenses/BSD-2-Claus... | """
--------------------------------------------------------------------
Maybe Numeric
--------------------------------------------------------------------
Distributed under the BSD 2-clause "Simplified" License.
(See accompanying file LICENSE or copy at
http://opensource.org/licenses/BSD-2-Claus... |
with open('input') as f:
data = f.read()
cavemap = [[int(height) for height in line] for line in data.splitlines()]
n, m = len(cavemap), len(cavemap[0])
s = 0
for j in range(n):
for i in range(m):
a,b,c,d = (i+1, j),(i, j-1),(i-1, j),(i, j+1)
ha, hb, hc, hd = tuple(cavemap[e[1]][e[0]] if e[0] ... | with open('input') as f:
data = f.read()
cavemap = [[int(height) for height in line] for line in data.splitlines()]
(n, m) = (len(cavemap), len(cavemap[0]))
s = 0
for j in range(n):
for i in range(m):
(a, b, c, d) = ((i + 1, j), (i, j - 1), (i - 1, j), (i, j + 1))
(ha, hb, hc, hd) = tuple((cavem... |
# encoding: utf-8
# module TallyConnector.Exceptions calls itself Exceptions
# from TallyConnector, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
# by generator 1.145
# no doc
# no imports
# no functions
# classes
class ObjectDoesNotExist(Exception, ISerializable, _Exception):
"""
ObjectDo... | class Objectdoesnotexist(Exception, ISerializable, _Exception):
"""
ObjectDoesNotExist()
ObjectDoesNotExist(message: str)
ObjectDoesNotExist(objectType: str, identifier: str, identifiervalue: str, companyname: str)
ObjectDoesNotExist(message: str, innerException: Exception)
"""
def __ini... |
expected_output = {
"vc_id": {
"1": {
"peer_id": {
"1.1.1.1": {
"bandwidth" : {
"total": 500,
"available": 100,
"reserved" : 400,
},
"interface": "T... | expected_output = {'vc_id': {'1': {'peer_id': {'1.1.1.1': {'bandwidth': {'total': 500, 'available': 100, 'reserved': 400}, 'interface': 'Tunnel1'}}}, '2': {'peer_id': {'20.20.20.20': {'interface': 'Tunnel65536'}}}}} |
#/bin/python
'''
Module to manage file textures
'''
# For class
| """
Module to manage file textures
""" |
'''
Helpers and such for Open Toontown Tools
'''
def sleep(duration):
'''
Breaks for a number of seconds. Returns an awaitable.
@LittleToonCat
'''
def __task(task):
if task.time > duration:
return task.done
return task.cont
return taskMgr.add(__task)
| """
Helpers and such for Open Toontown Tools
"""
def sleep(duration):
"""
Breaks for a number of seconds. Returns an awaitable.
@LittleToonCat
"""
def __task(task):
if task.time > duration:
return task.done
return task.cont
return taskMgr.add(__task) |
# You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place are arranged in a circle. That means the first house is the neighbor of the last one. Meanwhile, adjacent houses have security system connected and it will automatically cont... | class Solution:
def rob(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if not nums:
return 0
if len(nums) == 1:
return nums[0]
rob1 = nums[0]
notrob1 = 0
for i in range(1, len(nums) - 1):
tem = rob1
... |
#!/usr/bin/env python3
class Solution:
def trap(self, height):
"""
:type height: List[int]
:rtype: int
"""
lo, hi, water, level = 0, len(height) - 1, 0, 0
while lo < hi:
if height[lo] < height[hi]:
lower = height[lo]
lo += 1... | class Solution:
def trap(self, height):
"""
:type height: List[int]
:rtype: int
"""
(lo, hi, water, level) = (0, len(height) - 1, 0, 0)
while lo < hi:
if height[lo] < height[hi]:
lower = height[lo]
lo += 1
else:... |
#!/usr/bin/python3
print("".format()
.join([chr(i) for i in range(ord('a'), ord('z') + 1)
if chr(i) not in ['q', 'e']]), end="")
| print(''.format().join([chr(i) for i in range(ord('a'), ord('z') + 1) if chr(i) not in ['q', 'e']]), end='') |
def showModules(state, event):
print(event._mf.showModules(with_event=state.all["events"]))
def register(mf):
mf.register_globals({
"events": False
})
mf.register_event('init', showModules, unique=False)
| def show_modules(state, event):
print(event._mf.showModules(with_event=state.all['events']))
def register(mf):
mf.register_globals({'events': False})
mf.register_event('init', showModules, unique=False) |
def axis_diff(direction, rect_start, rect_finish,
boundaries_start, boundaries_finish):
"""
detects if an segment is outside its boundaries and returns the
difference between segment and boundary; if the segment is inside
boundaries returns 0
"""
if direction < 0:
if rect_... | def axis_diff(direction, rect_start, rect_finish, boundaries_start, boundaries_finish):
"""
detects if an segment is outside its boundaries and returns the
difference between segment and boundary; if the segment is inside
boundaries returns 0
"""
if direction < 0:
if rect_start < boundar... |
class PixivError(Exception):
pass
class RetryExhaustedError(PixivError):
def __init__(self, name=None, args=None, kwargs=None):
self.name = name
self.reason = '{}, {}'.format(args, kwargs)
super(PixivError, self).__init__(self, self.reason)
def __str__(self):
return self.r... | class Pixiverror(Exception):
pass
class Retryexhaustederror(PixivError):
def __init__(self, name=None, args=None, kwargs=None):
self.name = name
self.reason = '{}, {}'.format(args, kwargs)
super(PixivError, self).__init__(self, self.reason)
def __str__(self):
return self.r... |
class DocumentTree:
def __init__(self, file_tree, document_list, map_docs_by_paths):
assert isinstance(file_tree, list)
assert isinstance(document_list, list)
assert isinstance(map_docs_by_paths, dict)
self.file_tree = file_tree
self.document_list = document_list
self... | class Documenttree:
def __init__(self, file_tree, document_list, map_docs_by_paths):
assert isinstance(file_tree, list)
assert isinstance(document_list, list)
assert isinstance(map_docs_by_paths, dict)
self.file_tree = file_tree
self.document_list = document_list
sel... |
def board(pos1, pos2):
validate_position(pos1, pos2)
x1, y1 = pos1
x2, y2 = pos2
b = [['_'] * 8 for i in range(8)]
b[x1][y1] = 'W'
b[x2][y2] = 'B'
return [''.join(r) for r in b]
def can_attack(pos1, pos2):
validate_position(pos1, pos2)
x1, y1 = pos1
x2, y2 = pos2
dx = x1 - ... | def board(pos1, pos2):
validate_position(pos1, pos2)
(x1, y1) = pos1
(x2, y2) = pos2
b = [['_'] * 8 for i in range(8)]
b[x1][y1] = 'W'
b[x2][y2] = 'B'
return [''.join(r) for r in b]
def can_attack(pos1, pos2):
validate_position(pos1, pos2)
(x1, y1) = pos1
(x2, y2) = pos2
dx ... |
#
# PySNMP MIB module CISCO-COMMON-ROLES-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-COMMON-ROLES-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:36:18 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, single_value_constraint, constraints_union, value_range_constraint, value_size_constraint) ... |
sum = 0
first_num = 1000
last_num = 1200
num = first_num
while num <= last_num:
if num%2 == 0:
sum += num
num += 1
print(sum)
| sum = 0
first_num = 1000
last_num = 1200
num = first_num
while num <= last_num:
if num % 2 == 0:
sum += num
num += 1
print(sum) |
def isEscapePossible(self, blocked, source, target):
blocked = {tuple(p) for p in blocked}
def bfs(source, target):
bfs, seen = [source], {tuple(source)}
for x0, y0 in bfs:
for i, j in [[0, 1], [1, 0], [-1, 0], [0, -1]]:
x, y = x0 + i, y0 + j
if (
... | def is_escape_possible(self, blocked, source, target):
blocked = {tuple(p) for p in blocked}
def bfs(source, target):
(bfs, seen) = ([source], {tuple(source)})
for (x0, y0) in bfs:
for (i, j) in [[0, 1], [1, 0], [-1, 0], [0, -1]]:
(x, y) = (x0 + i, y0 + j)
... |
"""
A brief demonstration of the hyperoperation sequence.
https://en.wikipedia.org/wiki/Hyperoperation
"""
| """
A brief demonstration of the hyperoperation sequence.
https://en.wikipedia.org/wiki/Hyperoperation
""" |
class Replay:
def __init__(self,
version,
width,
height,
usernames,
generals,
cities,
city_armies,
mountains,
moves,
teams,
map_t... | class Replay:
def __init__(self, version, width, height, usernames, generals, cities, city_armies, mountains, moves, teams, map_title, afks):
self.version = version
self.width = width
self.height = height
self.usernames = usernames
self.generals = generals
self.citie... |
# GENERATED VERSION FILE
# TIME: Sat Apr 11 06:53:14 2020
__version__ = '1.0.rc0+unknown'
short_version = '1.0.rc0'
| __version__ = '1.0.rc0+unknown'
short_version = '1.0.rc0' |
__author__ = 'are'
class PointGroup3D:
groupName = "3D Point Group"
points = []
offset = (0.0, 0.0)
fileName = None
def __init__(self, filename=None):
pass
def LoadFrom(self, filename):
file = open(filename)
pass # to be implemented
file.close()
def SaveT... | __author__ = 'are'
class Pointgroup3D:
group_name = '3D Point Group'
points = []
offset = (0.0, 0.0)
file_name = None
def __init__(self, filename=None):
pass
def load_from(self, filename):
file = open(filename)
pass
file.close()
def save_to(self, filename)... |
class Solution:
# 1st solution
# O(n) time | O(1) space
def islandPerimeter(self, grid: List[List[int]]) -> int:
perimeter = 0
for i in range(len(grid)):
for j in range(len(grid[0])):
if grid[i][j] == 1:
perimeter += 4 - self.counterConnection(... | class Solution:
def island_perimeter(self, grid: List[List[int]]) -> int:
perimeter = 0
for i in range(len(grid)):
for j in range(len(grid[0])):
if grid[i][j] == 1:
perimeter += 4 - self.counterConnection(grid, i, j)
return perimeter
def ... |
a = {2: 4}
b = [2, 4]
print({k + 2: v - 2 for k, v in a.items() if k == 0})
print({element: 2 for element in b if element > 2})
| a = {2: 4}
b = [2, 4]
print({k + 2: v - 2 for (k, v) in a.items() if k == 0})
print({element: 2 for element in b if element > 2}) |
for t in range(int(input())):
one_burle_coins, two_burles_coins = map(int, input().split())
if one_burle_coins > 0:
print(one_burle_coins + 2 * two_burles_coins + 1)
else:
print(1)
| for t in range(int(input())):
(one_burle_coins, two_burles_coins) = map(int, input().split())
if one_burle_coins > 0:
print(one_burle_coins + 2 * two_burles_coins + 1)
else:
print(1) |
class TreeNode:
def __init__(self, val):
self.val = val
self.left = None
self.right = None
def __repr__(self):
return f"TreeNode({self.val})"
# @lc app=leetcode id=226 lang=python3
class Solution:
def invertTree(self, root: 'TreeNode') -> 'TreeNode':
def _recursiveInvertTree(root):
if root is not None... | class Treenode:
def __init__(self, val):
self.val = val
self.left = None
self.right = None
def __repr__(self):
return f'TreeNode({self.val})'
class Solution:
def invert_tree(self, root: 'TreeNode') -> 'TreeNode':
def _recursive_invert_tree(root):
if r... |
def positive_sum(arr):
sum = 0
for num in arr:
if num >= 0:
sum = num + sum
return sum
positive_sum([1, 2, 3, 4, 5])
# 15
positive_sum([1, -2, 3, 4, 5])
# 13
positive_sum([-1, 2, 3, 4, -5])
# 9
# better answer
# def positive_sum(arr):
# return sum(x for x in arr if x > 0)
| def positive_sum(arr):
sum = 0
for num in arr:
if num >= 0:
sum = num + sum
return sum
positive_sum([1, 2, 3, 4, 5])
positive_sum([1, -2, 3, 4, 5])
positive_sum([-1, 2, 3, 4, -5]) |
tsne_embedding_creation = {
"tsne_embedding_data_dir": "YOUR_ORIGINAL_DATA_DIR/tsne_emb/",
"tsne_graph_output_dir": "YOUR_GRAPH_OUTPUT_DATA_DIR/output/",
"apply_adaptation": True,
"using_interaction": False
}
| tsne_embedding_creation = {'tsne_embedding_data_dir': 'YOUR_ORIGINAL_DATA_DIR/tsne_emb/', 'tsne_graph_output_dir': 'YOUR_GRAPH_OUTPUT_DATA_DIR/output/', 'apply_adaptation': True, 'using_interaction': False} |
class Solution:
def uniquePaths(self, m, n):
"""
:type m: int
:type n: int
:rtype: int
"""
dmap = [[0] * n for _ in range(m)]
for i in range(m):
dmap[i][0] = 1
for j in range(n):
dmap[0][j] = 1
for i in range(1, m):
... | class Solution:
def unique_paths(self, m, n):
"""
:type m: int
:type n: int
:rtype: int
"""
dmap = [[0] * n for _ in range(m)]
for i in range(m):
dmap[i][0] = 1
for j in range(n):
dmap[0][j] = 1
for i in range(1, m):
... |
class Solution:
def reverse(self, x):
if x is not 0:
x = int(abs(x) / x) * int(str(abs(x))[::-1])
if abs(x) > pow(2, 31) - 1:
x = 0
return x
| class Solution:
def reverse(self, x):
if x is not 0:
x = int(abs(x) / x) * int(str(abs(x))[::-1])
if abs(x) > pow(2, 31) - 1:
x = 0
return x |
def question_mark(utterances):
res = []
for utterance in utterances:
if utterance.find('?') != -1:
res.append(1)
else:
res.append(0)
return res
def duplicate(utterances):
res = []
for utterance in utterances:
if utterance.find('same') != -1 or uttera... | def question_mark(utterances):
res = []
for utterance in utterances:
if utterance.find('?') != -1:
res.append(1)
else:
res.append(0)
return res
def duplicate(utterances):
res = []
for utterance in utterances:
if utterance.find('same') != -1 or utteran... |
# Problem: Combination Sum
# Difficulty: Medium
# Category: Array
# Leetcode 39: https://leetcode.com/problems/combination-sum/description/
# Description:
"""
Given a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.
The ... | """
Given a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.
The same repeated number may be chosen from C unlimited number of times.
Note:
All numbers (including target) will be positive integers.
The solution set must... |
#!/usr/bin/env python3
"""Words With Duplicate Letters.
Given a common phrase, return False if any individual word in the phrase
contains duplicate letters. Return True otherwise.
Source:
https://edabit.com/challenge/WS6hR6b9EZzuDTD26
"""
def no_duplicate_letters(phrase: str) -> bool:
"""Check if each word has... | """Words With Duplicate Letters.
Given a common phrase, return False if any individual word in the phrase
contains duplicate letters. Return True otherwise.
Source:
https://edabit.com/challenge/WS6hR6b9EZzuDTD26
"""
def no_duplicate_letters(phrase: str) -> bool:
"""Check if each word has distinct letters in phra... |
n = int(input("Enter the number:"))
m = n
c = 0
while n> 0:
n = n//10
c += 1
d = c - 1
print("The last digit of",m,"is",m%10)
print("The first digit of",m,"is",m//(10**d))
| n = int(input('Enter the number:'))
m = n
c = 0
while n > 0:
n = n // 10
c += 1
d = c - 1
print('The last digit of', m, 'is', m % 10)
print('The first digit of', m, 'is', m // 10 ** d) |
patterns = [
r' ', r'\t', r'\n', r'//', r'/\*', r'\*/', r'{', r'}', r'\(', r'\)', r'\+\+', r'\+=', r'\+', r'\-\-',
r'\-=', r'\-', r'\*=', r'\*', r'/=' r'/', r'==', r'=', r'\+=', r'\b[A-Za-z_]\w*', r'\".*\"',
r'\b[-+]?\d+\.\d+', r'\b[-+]?\d+', r'.',
]
keywords = {
'abstract', 'arguments', 'await', 'bool... | patterns = [' ', '\\t', '\\n', '//', '/\\*', '\\*/', '{', '}', '\\(', '\\)', '\\+\\+', '\\+=', '\\+', '\\-\\-', '\\-=', '\\-', '\\*=', '\\*', '/=/', '==', '=', '\\+=', '\\b[A-Za-z_]\\w*', '\\".*\\"', '\\b[-+]?\\d+\\.\\d+', '\\b[-+]?\\d+', '.']
keywords = {'abstract', 'arguments', 'await', 'boolean', 'break', 'byte', 'c... |
"""
footing.constants
~~~~~~~~~~~~~~~~~
Constants for footing
"""
#: The environment variable set when running any footing command. It is set to
#: the name of the command
FOOTING_ENV_VAR = '_FOOTING'
#: The footing config file in each repo
FOOTING_CONFIG_FILE = 'footing.yaml'
#: The Github API token environment va... | """
footing.constants
~~~~~~~~~~~~~~~~~
Constants for footing
"""
footing_env_var = '_FOOTING'
footing_config_file = 'footing.yaml'
github_api_token_env_var = 'GITHUB_API_TOKEN'
gitlab_api_token_env_var = 'GITLAB_API_TOKEN'
footing_docs_url = 'https://github.com/Opus10/footing'
update_branch_name = '_footing_update'
t... |
message= input()
list_of_nonnumbers = []
list_of_numbers = []
for character in message:
if character.isalpha():
list_of_nonnumbers.append(character)
elif character.isdigit():
list_of_numbers.append(int(character))
take_list = []
skip_list = []
for i in range(len(list_of_numbers)):
... | message = input()
list_of_nonnumbers = []
list_of_numbers = []
for character in message:
if character.isalpha():
list_of_nonnumbers.append(character)
elif character.isdigit():
list_of_numbers.append(int(character))
take_list = []
skip_list = []
for i in range(len(list_of_numbers)):
if i % 2 ... |
"""Kata url: https://www.codewars.com/kata/5866fc43395d9138a7000006."""
def ensure_question(s: str) -> str:
return s if s.endswith('?') else f"{s}?"
| """Kata url: https://www.codewars.com/kata/5866fc43395d9138a7000006."""
def ensure_question(s: str) -> str:
return s if s.endswith('?') else f'{s}?' |
#!/usr/bin/env python
"""
Hackerrank Solution
-
Nate B. Wangsutthitham
<@natebwangsut | nate.bwangsut@gmail.com>
"""
__author__ = "Nate B. Wangsutthitham"
__credits__ = ["Nate B. Wangsutthitham"]
__license__ = "MIT"
__version__ = "1.0.0"
__maintainer__ = "Nate B. Wangsutthitham"
__email__ = "nate.bwangsut@gmail.com"
... | """
Hackerrank Solution
-
Nate B. Wangsutthitham
<@natebwangsut | nate.bwangsut@gmail.com>
"""
__author__ = 'Nate B. Wangsutthitham'
__credits__ = ['Nate B. Wangsutthitham']
__license__ = 'MIT'
__version__ = '1.0.0'
__maintainer__ = 'Nate B. Wangsutthitham'
__email__ = 'nate.bwangsut@gmail.com'
count = {}
lines = int(i... |
"""
Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.
Example 1:
Input: "Let's take LeetCode contest"
Output: "s'teL ekat edoCteeL tsetnoc"
Note: In the string, each word is separated by single space and there will not... | """
Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.
Example 1:
Input: "Let's take LeetCode contest"
Output: "s'teL ekat edoCteeL tsetnoc"
Note: In the string, each word is separated by single space and there will not... |
class Solution:
def countElements(self, arr):
count, d = 0, set()
for n in arr:
d.add(n)
for n in arr:
if n+1 in d:
count += 1
return count
"""
Success
Details
Runtime: 44 ms, faster than 39.65% of Python3 online submissions for Counting Ele... | class Solution:
def count_elements(self, arr):
(count, d) = (0, set())
for n in arr:
d.add(n)
for n in arr:
if n + 1 in d:
count += 1
return count
'\nSuccess\nDetails \nRuntime: 44 ms, faster than 39.65% of Python3 online submissions for Count... |
"""
__init__.py
================
Package definition for TextbookTool
This file is a part of RIT Textbook Tool.
Copyright (C) 2015 Steven Mirabito.
Licensed under the Apache License v2.0
http://www.apache.org/licenses/LICENSE-2.0
""" | """
__init__.py
================
Package definition for TextbookTool
This file is a part of RIT Textbook Tool.
Copyright (C) 2015 Steven Mirabito.
Licensed under the Apache License v2.0
http://www.apache.org/licenses/LICENSE-2.0
""" |
"""
This file stores all possible rolls on all dice, for easy reference in main.py.
"""
SUCCESS = {
"success": 1
}
ADVANTAGE = {
"advantage": 1
}
TRIUMPH = {
"success": 1,
"triumph": 1
}
FAILURE = {
"success": -1
}
THREAT = {
"advantage": -1
}
DESPAIR = {
"success": -1,
"despair": ... | """
This file stores all possible rolls on all dice, for easy reference in main.py.
"""
success = {'success': 1}
advantage = {'advantage': 1}
triumph = {'success': 1, 'triumph': 1}
failure = {'success': -1}
threat = {'advantage': -1}
despair = {'success': -1, 'despair': 1}
dark = {'dark': 1}
light = {'light': 1}
blank ... |
n = int(input())
data = {}
for i in range(n):
key = int(input())
if key not in data:
data[key] = 0
data[key] += 1
data_list = []
for key in data:
data_list.append((data[key], -1*key))
data_list.sort(reverse=True)
print(-1*data_list[0][1]) | n = int(input())
data = {}
for i in range(n):
key = int(input())
if key not in data:
data[key] = 0
data[key] += 1
data_list = []
for key in data:
data_list.append((data[key], -1 * key))
data_list.sort(reverse=True)
print(-1 * data_list[0][1]) |
# -*- coding: utf-8 -*-
# "Lato","proxima-nova","Helvetica Neue",Arial,sans-serif
TABLE = '"{}" [label=<<FONT FACE="Helvetica" POINT-SIZE="10"><TABLE BORDER="0" CELLBORDER="1"' \
' CELLPADDING="5" CELLSPACING="0">{}{}</TABLE></FONT>>];'
START_CELL = '<TR><TD ALIGN="LEFT"><FONT>'
FONT_TAGS = '<FONT>{}</FONT>'... | table = '"{}" [label=<<FONT FACE="Helvetica" POINT-SIZE="10"><TABLE BORDER="0" CELLBORDER="1" CELLPADDING="5" CELLSPACING="0">{}{}</TABLE></FONT>>];'
start_cell = '<TR><TD ALIGN="LEFT"><FONT>'
font_tags = '<FONT>{}</FONT>'
row_tags = '<TR><TD{}>{}</TD></TR>'
graph_beginning = ' graph {\n splines=ortho;\n overlap=... |
#
# PySNMP MIB module ChrComPmSonetSNT-S-Current-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ChrComPmSonetSNT-S-Current-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:20:46 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python ... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, single_value_constraint, value_range_constraint, value_size_constraint) ... |
"""
Some wheezy templates.
"""
docker = """\
@require(cidr, interface, containers, networks)
domain ip {
table nat {
chain DOCKER;
chain PREROUTING {
policy ACCEPT;
mod addrtype dst-type LOCAL jump DOCKER;
}
chain OUTPUT {
policy ACCEPT;
... | """
Some wheezy templates.
"""
docker = '@require(cidr, interface, containers, networks)\ndomain ip {\n table nat {\n chain DOCKER;\n chain PREROUTING {\n policy ACCEPT;\n mod addrtype dst-type LOCAL jump DOCKER;\n }\n chain OUTPUT {\n policy ACCEPT;\n ... |
R_c = 10
eta=[1,2,3]
R_s=[7,8]
at_types=['C','H','N','O']
| r_c = 10
eta = [1, 2, 3]
r_s = [7, 8]
at_types = ['C', 'H', 'N', 'O'] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.