content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
entries = [
{
'env-title': 'atari-alien',
'env-variant': 'No-op start',
'score': 6163,
'stddev': 1077,
},
{
'env-title': 'atari-amidar',
'env-variant': 'No-op start',
'score': 2296,
'stddev': 154,
},
{
'env-title': 'atari-assaul... | entries = [{'env-title': 'atari-alien', 'env-variant': 'No-op start', 'score': 6163, 'stddev': 1077}, {'env-title': 'atari-amidar', 'env-variant': 'No-op start', 'score': 2296, 'stddev': 154}, {'env-title': 'atari-assault', 'env-variant': 'No-op start', 'score': 8010, 'stddev': 381}, {'env-title': 'atari-asterix', 'env... |
class Tree(object):
def __init__(self):
self.__struct = {}
def add(self, item):
p = 1
b = "1"
if len(self.__struct) == 0:
self.__struct[1] = item
else:
found = False
while not found:
if item < self.__struct[p]:
b += "0"
else:
b += "1"
p = int(b,2)
i... | class Tree(object):
def __init__(self):
self.__struct = {}
def add(self, item):
p = 1
b = '1'
if len(self.__struct) == 0:
self.__struct[1] = item
else:
found = False
while not found:
if item < self.__struct[p]:
... |
def main():
N = int(input())
X, Y = map(int, input().split())
As =[0]*N
Bs = [0]*N
for i in range(N):
As[i], Bs[i] = map(int, input().split())
if __name__ == '__main__':
main()
| def main():
n = int(input())
(x, y) = map(int, input().split())
as = [0] * N
bs = [0] * N
for i in range(N):
(As[i], Bs[i]) = map(int, input().split())
if __name__ == '__main__':
main() |
class User(object):
def __init__(self, **kwargs):
# TODO: prevent bad usernames or passwords (too small, etc)
if "username" in kwargs:
self.username = kwargs["username"]
if "user_name" in kwargs:
self.username = kwargs["user_name"]
if "password" in kwargs:
... | class User(object):
def __init__(self, **kwargs):
if 'username' in kwargs:
self.username = kwargs['username']
if 'user_name' in kwargs:
self.username = kwargs['user_name']
if 'password' in kwargs:
self.password = kwargs['password']
self.role = 'st... |
# Dictionary of ASCII characters and a creative name for each of them
# TODO: give the items that don't have a # at the end a creative name!
# Regex: .*(?<!#)$
ingredients_dictionary = {
# '\n' : 'new lines', #
' ' : 'air', #
'!' : 'gunpowder', #
'"' : 'ice', #
'#' : 'hashbrowns', #
'$' : 'gold', #
'%'... | ingredients_dictionary = {' ': 'air', '!': 'gunpowder', '"': 'ice', '#': 'hashbrowns', '$': 'gold', '%': 'sunscreen', '&': 'glue', "'": 'apple juice', '(': 'salt', ')': 'pepper', '*': 'sprinkles', '+': 'plusses', ',': 'food coloring', '-': 'hyphens', '.': 'bread crumbs', '/': 'laxative', '0': 'olives', '1': 'eggnog', '... |
puzzleInput = open('AdventOfCode_08.txt').read().strip().split()
puzzleInput = [int(i) for i in puzzleInput]
metaSum = pos = 0
def readMetaData():
global metaSum, pos
anzChilds = puzzleInput[pos]
anzMeta = puzzleInput[pos+1]
pos += 2
for i in range(anzChilds):
readMetaData()
for i in range(anzMeta):
... | puzzle_input = open('AdventOfCode_08.txt').read().strip().split()
puzzle_input = [int(i) for i in puzzleInput]
meta_sum = pos = 0
def read_meta_data():
global metaSum, pos
anz_childs = puzzleInput[pos]
anz_meta = puzzleInput[pos + 1]
pos += 2
for i in range(anzChilds):
read_meta_data()
... |
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... |
{
'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 = [] |
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' |
#
# 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) ... |
# 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 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 ... |
#!/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() |
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)) |
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
... |
# 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... |
'''
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.... |
# 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... |
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) |
#!/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) |
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)
... |
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 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... |
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... |
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 ... |
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) ... |
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'] |
def build_errors(resp: dict, errors: Exception) -> dict:
resp["statusCode"] = 500
resp["status"] = f"Internal Server Error: {errors}"
return resp
def build_data_dict(status: str, status_code: int, data: bool) -> dict:
data_dict = {
"statusCode": status_code,
"status": status,
} ... | def build_errors(resp: dict, errors: Exception) -> dict:
resp['statusCode'] = 500
resp['status'] = f'Internal Server Error: {errors}'
return resp
def build_data_dict(status: str, status_code: int, data: bool) -> dict:
data_dict = {'statusCode': status_code, 'status': status}
if data:
data_d... |
class Solution:
def isPrefixOfWord(self, sentence: str, searchWord: str) -> int:
words = sentence.split()
for index, word in enumerate(words):
if word.startswith(searchWord):
return index + 1
return -1 | class Solution:
def is_prefix_of_word(self, sentence: str, searchWord: str) -> int:
words = sentence.split()
for (index, word) in enumerate(words):
if word.startswith(searchWord):
return index + 1
return -1 |
x=[]
s=0
n=int(input("enter the number of elements"))
for y in range(n):
d=int(input("enter the elements"))
x.append(d)
c=0
for j in x:
c=0
for b in x:
if j==b:
c+=1
if c==1:
s=s+j
print("sum",s)
| x = []
s = 0
n = int(input('enter the number of elements'))
for y in range(n):
d = int(input('enter the elements'))
x.append(d)
c = 0
for j in x:
c = 0
for b in x:
if j == b:
c += 1
if c == 1:
s = s + j
print('sum', s) |
#
# PySNMP MIB module CISCO-COPS-CLIENT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-COPS-CLIENT-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:36:39 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_intersection, constraints_union, single_value_constraint, value_size_constraint) ... |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
# @param {ListNode} head
# @return {ListNode}
def swapPairs(self, head):
pre = p = head
while(p and p.next):
np = p.next
... | class Solution:
def swap_pairs(self, head):
pre = p = head
while p and p.next:
np = p.next
p.next = np.next
np.next = p
if pre == head:
head = np
else:
pre.next = np
pre = p
p = p.nex... |
'''
Determine if a 9 x 9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules:
Each row must contain the digits 1-9 without repetition.
Each column must contain the digits 1-9 without repetition.
Each of the nine 3 x 3 sub-boxes of the grid must contain the digits 1-9 wit... | """
Determine if a 9 x 9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules:
Each row must contain the digits 1-9 without repetition.
Each column must contain the digits 1-9 without repetition.
Each of the nine 3 x 3 sub-boxes of the grid must contain the digits 1-9 wit... |
def inputFileIntro(numberOfPoints):
result = "-- Input geometry blade\n"
result += str(numberOfPoints)
result += " ! NSPANB\n"
result += " r chord twist xaer zaer\n"
return result
def writeInput(r,chord,twist):
f = open("geomb.inp","w")
f.write(inputFileIntro(len(r)))
... | def input_file_intro(numberOfPoints):
result = '-- Input geometry blade\n'
result += str(numberOfPoints)
result += ' ! NSPANB\n'
result += ' r chord twist xaer zaer\n'
return result
def write_input(r, chord, twist):
f = open('geomb.inp', 'w')
f.write(input_file_intro(len(r)... |
_base_ = [
'../_base_/models/hv_pointpillars_secfpn_kitti.py',
'../_base_/datasets/kitti-3d-3class.py',
'../_base_/schedules/cyclic_40e.py', '../_base_/default_runtime.py'
]
point_cloud_range = [-51.2, -51.2, -4, 51.2, 51.2, 1]
anchor_generator=dict(
type='Anchor3DRangeGenerator',
... | _base_ = ['../_base_/models/hv_pointpillars_secfpn_kitti.py', '../_base_/datasets/kitti-3d-3class.py', '../_base_/schedules/cyclic_40e.py', '../_base_/default_runtime.py']
point_cloud_range = [-51.2, -51.2, -4, 51.2, 51.2, 1]
anchor_generator = dict(type='Anchor3DRangeGenerator', ranges=[[-50, -50, -2.6, 50, 50, -2.6],... |
def perf_ans_calc(L1, L2, C1, C2, C_max):
vals = [0] * len(L1)
wts = [0] * len(L1)
W = C_max - sum(C1)
for jj, (l1, l2, c1, c2) in enumerate(zip(L1, L2, C1, C2)):
vals[jj] = l2 - l1
wts[jj] = c2 - c1
def dp(W, wt, val, n):
k = [[0 for x in range(W + 1)] for x in range(n + 1)... | def perf_ans_calc(L1, L2, C1, C2, C_max):
vals = [0] * len(L1)
wts = [0] * len(L1)
w = C_max - sum(C1)
for (jj, (l1, l2, c1, c2)) in enumerate(zip(L1, L2, C1, C2)):
vals[jj] = l2 - l1
wts[jj] = c2 - c1
def dp(W, wt, val, n):
k = [[0 for x in range(W + 1)] for x in range(n + ... |
class Tree:
def __init__(self, key=None, children=None):
if children is None:
children = []
self.root = key
self.children = children
def get_root(self):
return self.root
def set_root(self, key):
self.root = key
def get_children(self):
return... | class Tree:
def __init__(self, key=None, children=None):
if children is None:
children = []
self.root = key
self.children = children
def get_root(self):
return self.root
def set_root(self, key):
self.root = key
def get_children(self):
retur... |
def describe_list():
def describe_GET():
def it_returns_all_fonts(expect, client):
request, response = client.get("/fonts")
expect(len(response.json)) == 6
def describe_detail():
def describe_GET():
def it_includes_filename(expect, client):
request, response... | def describe_list():
def describe_get():
def it_returns_all_fonts(expect, client):
(request, response) = client.get('/fonts')
expect(len(response.json)) == 6
def describe_detail():
def describe_get():
def it_includes_filename(expect, client):
(request, re... |
# Set DEVELOPER_KEY to the API key value from the APIs & auth > Registered apps
# tab of
# https://cloud.google.com/console
# Please ensure that you have enabled the YouTube Data API for your project.
DEVELOPER_KEY = "AIzaSyAB6p3VGqOsDBL_q-c4rNDRjTPMfMBPsDA"
YOUTUBE_API_SERVICE_NAME = "youtube"
YOUTUBE_API_VERSION = ... | developer_key = 'AIzaSyAB6p3VGqOsDBL_q-c4rNDRjTPMfMBPsDA'
youtube_api_service_name = 'youtube'
youtube_api_version = 'v3' |
#
# PySNMP MIB module ZHONE-GEN-INTERFACE-CONFIG-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZHONE-GEN-INTERFACE-CONFIG-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:47:34 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python ... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_union, value_range_constraint, single_value_constraint, constraints_intersection) ... |
class Solution:
def traverse(self, prov: int, visited, isConnected: List[List[int]]):
visited[prov] = True
for i in range(0, len(isConnected)):
if isConnected[prov][i] and not visited[i]:
self.traverse(i, visited, isConnected)
def findCircleNum(self, isConnected: Lis... | class Solution:
def traverse(self, prov: int, visited, isConnected: List[List[int]]):
visited[prov] = True
for i in range(0, len(isConnected)):
if isConnected[prov][i] and (not visited[i]):
self.traverse(i, visited, isConnected)
def find_circle_num(self, isConnected... |
def readint(msg):
ok = False
value = 0
while True:
n1 = str(input(msg))
if n1.isdigit():
value = int(n1)
ok = True
else:
print('\033[0;31mError! Please enter a valid INTEGER number. \033[m')
if ok:
break
return value
def r... | def readint(msg):
ok = False
value = 0
while True:
n1 = str(input(msg))
if n1.isdigit():
value = int(n1)
ok = True
else:
print('\x1b[0;31mError! Please enter a valid INTEGER number. \x1b[m')
if ok:
break
return value
def re... |
#!/usr/bin/python3
def test_sequence():
assert 2 + 2 == 4
| def test_sequence():
assert 2 + 2 == 4 |
def check_while_exit_condition():
num1 = 1
while num1 <= 5:
# 1
# 2
# 3
# 4
# 5
print(num1)
num1 = num1 + 1
print("\n")
num2 = 10
while num2 <= 5:
print(num2)
num2 = num2 + 1
return
def let_user_choose_when_exit():
pr... | def check_while_exit_condition():
num1 = 1
while num1 <= 5:
print(num1)
num1 = num1 + 1
print('\n')
num2 = 10
while num2 <= 5:
print(num2)
num2 = num2 + 1
return
def let_user_choose_when_exit():
print("Welcome. \nEnter 'quit' to end the program.")
prompt ... |
author = "Palguno Wicaksono"
def antiTamper(author):
dataList = author.split(" ")
b = len(dataList[0])
c = len(dataList[1])
d = b**2 - 4*c
x = list(bin(d))
y = len(bin(d))
while True:
try:
try:
x = len("Palguno Wicaksono")/int(x[y-1])
... | author = 'Palguno Wicaksono'
def anti_tamper(author):
data_list = author.split(' ')
b = len(dataList[0])
c = len(dataList[1])
d = b ** 2 - 4 * c
x = list(bin(d))
y = len(bin(d))
while True:
try:
try:
x = len('Palguno Wicaksono') / int(x[y - 1])
... |
n = int(input())
a = list(map(lambda x: int(x) % n, input().split()))
b = [ True for i in range(n) ]
flag = True
for x in a:
if b[x] == False:
flag = False
break
b[x] = False
print("YES" if flag else "NO") | n = int(input())
a = list(map(lambda x: int(x) % n, input().split()))
b = [True for i in range(n)]
flag = True
for x in a:
if b[x] == False:
flag = False
break
b[x] = False
print('YES' if flag else 'NO') |
# https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/
# Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.
#
# The function twoSum should return indices of the two numbers such that they add up to the target, where index1... | class Solution(object):
def two_sum(self, numbers, target):
left = 0
right = len(numbers) - 1
while left < right:
sum = numbers[left] + numbers[right]
if sum < target:
left += 1
elif sum > target:
right -= 1
els... |
class Monitor:
name = 'Samsung'
matrix = 'VA'
res = 'WQHD'
freq = 60
class Headphones:
name = 'Sony'
sensitivity = 108
micro = True
mon1 = Monitor
mon1.freq = 75
mon2 = Monitor
mon2.freq = 144
mon3 = Monitor
mon3.freq = 280
mon4 = Monitor
mon4.freq = 360
hd1 = Headphones
hd2 = Headphone... | class Monitor:
name = 'Samsung'
matrix = 'VA'
res = 'WQHD'
freq = 60
class Headphones:
name = 'Sony'
sensitivity = 108
micro = True
mon1 = Monitor
mon1.freq = 75
mon2 = Monitor
mon2.freq = 144
mon3 = Monitor
mon3.freq = 280
mon4 = Monitor
mon4.freq = 360
hd1 = Headphones
hd2 = Headphones
hd... |
__all__ = [
'aiohttp_session',
'curio_asks_session',
'trio_asks_session',
'abc'
] | __all__ = ['aiohttp_session', 'curio_asks_session', 'trio_asks_session', 'abc'] |
def matching_random_motif(N, gc_content, seq):
GC_count=0
AT_count=0
for i in range(len(seq)):
if(seq[i]=='G' or seq[i]=='C'):
GC_count+=1
else:
AT_count+=1
prob_seq = (gc_content/2)**GC_count*((1-gc_content)/2)**AT_count
prob_not_motif = (1-... | def matching_random_motif(N, gc_content, seq):
gc_count = 0
at_count = 0
for i in range(len(seq)):
if seq[i] == 'G' or seq[i] == 'C':
gc_count += 1
else:
at_count += 1
prob_seq = (gc_content / 2) ** GC_count * ((1 - gc_content) / 2) ** AT_count
prob_not_motif ... |
#
# @lc app=leetcode id=154 lang=python3
#
# [154] Find Minimum in Rotated Sorted Array II
#
# @lc code=start
class Solution:
def findMin(self, nums):
for i in range(len(nums) - 1):
if nums[i] > nums[i + 1]:
return nums[i + 1]
return nums[0]
# @lc code=end
| class Solution:
def find_min(self, nums):
for i in range(len(nums) - 1):
if nums[i] > nums[i + 1]:
return nums[i + 1]
return nums[0] |
#
# PySNMP MIB module Juniper-Frame-Relay-CONF (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-Frame-Relay-CONF
# Produced by pysmi-0.3.4 at Wed May 1 14:02:48 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, constraints_intersection, constraints_union, value_range_constraint) ... |
#
# @lc app=leetcode id=260 lang=python3
#
# [260] Single Number III
#
# @lc code=start
class Solution:
def singleNumber(self, nums: List[int]) -> List[int]:
digist = {}
for num in nums:
digist[num] = digist.get(num, 0) + 1
res = [num for num in digist.keys() if digist[num] =... | class Solution:
def single_number(self, nums: List[int]) -> List[int]:
digist = {}
for num in nums:
digist[num] = digist.get(num, 0) + 1
res = [num for num in digist.keys() if digist[num] == 1]
return res |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.