content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
fps = 60
game_duration = 120 # in sec
window_width = 1550
window_height = 800
| fps = 60
game_duration = 120
window_width = 1550
window_height = 800 |
class Solution(object):
def maxLength(self, arr):
"""
:type arr: List[str]
:rtype: int
"""
if not arr:
return 0
if len(arr) == 1:
return len(arr[0])
result = [0]
self.max_unique(arr, 0, "", result)
return result[0]
... | class Solution(object):
def max_length(self, arr):
"""
:type arr: List[str]
:rtype: int
"""
if not arr:
return 0
if len(arr) == 1:
return len(arr[0])
result = [0]
self.max_unique(arr, 0, '', result)
return result[0]
... |
def main():
ans = 1
for n in range(1, 501):
ans += f(n)
print(ans)
def f(n):
return 4 * (2 * n + 1)**2 - (12 * n)
if __name__ == '__main__':
main()
| def main():
ans = 1
for n in range(1, 501):
ans += f(n)
print(ans)
def f(n):
return 4 * (2 * n + 1) ** 2 - 12 * n
if __name__ == '__main__':
main() |
# -*- coding: utf-8 -*-
__all__ = [
"StorageBackend"
]
class StorageBackend(object):
"""Base class for storage backends."""
async def store_stats(self, stats):
raise NotImplementedError
| __all__ = ['StorageBackend']
class Storagebackend(object):
"""Base class for storage backends."""
async def store_stats(self, stats):
raise NotImplementedError |
"""
discpy.types
~~~~~~~~~~~~~~
Typings for the Discord API
:copyright: (c) 2021 The DiscPy Developers (c) 2015-2021 Rapptz
:license: MIT, see LICENSE for more details.
"""
| """
discpy.types
~~~~~~~~~~~~~~
Typings for the Discord API
:copyright: (c) 2021 The DiscPy Developers (c) 2015-2021 Rapptz
:license: MIT, see LICENSE for more details.
""" |
def get_param_dict(self):
"""Get the parameters dict from ELUT
Parameters
----------
self : ELUT
an ELUT object
Returns
----------
param_dict : dict
a Dict object
"""
param_dict = {"R1": self.R1, "L1": self.L1, "T1_ref": self.T1_ref}
return param_dict
| def get_param_dict(self):
"""Get the parameters dict from ELUT
Parameters
----------
self : ELUT
an ELUT object
Returns
----------
param_dict : dict
a Dict object
"""
param_dict = {'R1': self.R1, 'L1': self.L1, 'T1_ref': self.T1_ref}
return param_dict |
class A(object):
pass
print(A.__sizeof__)
# <ref> | class A(object):
pass
print(A.__sizeof__) |
#Write a Python program to print the following floating numbers upto 2 decimal places with a sign.
x = 3.1415926
y = 12.9999
a = float(+x)
b = float(-y)
print(round(a,2))
print(round(b,2)) | x = 3.1415926
y = 12.9999
a = float(+x)
b = float(-y)
print(round(a, 2))
print(round(b, 2)) |
# A place for secret local/dev environment settings
UNIFIED_DB = {
'ENGINE': 'django.db.backends.oracle',
'NAME': 'DB_NAME',
'USER': 'username',
'PASSWORD': 'password',
}
MONGODB_DATABASES = {
'default': {
'NAME': 'wtc-console',
'USER': 'root',
'PASSWORD': 'root',
}
}
| unified_db = {'ENGINE': 'django.db.backends.oracle', 'NAME': 'DB_NAME', 'USER': 'username', 'PASSWORD': 'password'}
mongodb_databases = {'default': {'NAME': 'wtc-console', 'USER': 'root', 'PASSWORD': 'root'}} |
# Definition for a binary tree node.
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def pseudoPalindromicPaths (self, root: TreeNode) -> int:
s = set()
def dfs(root):
... | class Treenode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def pseudo_palindromic_paths(self, root: TreeNode) -> int:
s = set()
def dfs(root):
if not root:
return 0
... |
'''For 18 points, answer the following questions:
"Recursion" is when a function solves a problem by calling itself.
Recursive functions have at least 2 parts:
1. Base case - This is where the function is finished.
2. Recursive case (aka Induction case) - this is where the
function calls itself and gets clo... | """For 18 points, answer the following questions:
"Recursion" is when a function solves a problem by calling itself.
Recursive functions have at least 2 parts:
1. Base case - This is where the function is finished.
2. Recursive case (aka Induction case) - this is where the
function calls itself and gets clos... |
'''
Problem 1
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
Solution:
Copyright 2017 Dave Cuthbert
License MIT
'''
def find_multiples(factor, limit):
list_of_factors = []... | """
Problem 1
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
Solution:
Copyright 2017 Dave Cuthbert
License MIT
"""
def find_multiples(factor, limit):
list_of_factors = []... |
# Time: O(n)
# Space: O(1)
class Solution(object):
def insert(self, intervals, newInterval):
"""
:type intervals: List[List[int]]
:type newInterval: List[int]
:rtype: List[List[int]]
"""
result = []
i = 0
while i < len(intervals) and newInterval[0] >... | class Solution(object):
def insert(self, intervals, newInterval):
"""
:type intervals: List[List[int]]
:type newInterval: List[int]
:rtype: List[List[int]]
"""
result = []
i = 0
while i < len(intervals) and newInterval[0] > intervals[i][1]:
... |
d1=['13CS10001','12CS30016','12CS30043','12CS30042','12CS30043','13CS10038','12CS30017','12CS30044','13CS10041','12CS30041','12CS30010',
'13CS10020','12CS30025','12CS30027','12CS30032','13CS10035','12CS30003','12CS30044','12CS30016','13CS10038','13CS10021','12CS30028',
'12CS30016','13CS10006','13CS10046','13CS10034','1... | d1 = ['13CS10001', '12CS30016', '12CS30043', '12CS30042', '12CS30043', '13CS10038', '12CS30017', '12CS30044', '13CS10041', '12CS30041', '12CS30010', '13CS10020', '12CS30025', '12CS30027', '12CS30032', '13CS10035', '12CS30003', '12CS30044', '12CS30016', '13CS10038', '13CS10021', '12CS30028', '12CS30016', '13CS10006', '1... |
# -*- coding: utf-8 -*-
def includeme(config):
config.add_route('index', '')
config.include(admin_include, '/admin')
config.include(post_include, '/post')
config.add_route('firework', '/firework')
config.add_route('baymax', '/baymax')
def admin_include(config):
config.add_route('login', '/log... | def includeme(config):
config.add_route('index', '')
config.include(admin_include, '/admin')
config.include(post_include, '/post')
config.add_route('firework', '/firework')
config.add_route('baymax', '/baymax')
def admin_include(config):
config.add_route('login', '/login')
config.add_route(... |
def ada_int(f, a, b, tol=1.0e-6, n=5, N=10):
area = trapezoid(f, a, b, N)
check = trapezoid(f, a, b, n)
if abs(area - check) > tol:
# bad accuracy, add more points to interval
m = (b + a) / 2.0
area = ada_int(f, a, m) + ada_int(f, m, b)
return area
| def ada_int(f, a, b, tol=1e-06, n=5, N=10):
area = trapezoid(f, a, b, N)
check = trapezoid(f, a, b, n)
if abs(area - check) > tol:
m = (b + a) / 2.0
area = ada_int(f, a, m) + ada_int(f, m, b)
return area |
# -*- coding:utf-8 -*-
# @Script: array_partition_1.py
# @Author: Pradip Patil
# @Contact: @pradip__patil
# @Created: 2019-03-20 23:06:35
# @Last Modified By: Pradip Patil
# @Last Modified: 2019-03-21 21:07:13
# @Description: https://leetcode.com/problems/array-partition-i/
'''
Given an array of 2n integers, your task... | """
Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as large as possible.
Example 1:
Input: [1,4,3,2]
Output: 4
Explanation: n is 2, and the maximum sum of pairs is 4 = min(1, 2) + m... |
# Options
class SimpleOpt():
def __init__(self):
self.method = 'gvae'
self.graph_type = 'ENZYMES'
self.data_dir = './data/ENZYMES_20-50_res.graphs'
self.emb_size = 8
self.encode_dim = 32
self.layer_num = 3
self.decode_dim = 32
self.dropout = 0.5
... | class Simpleopt:
def __init__(self):
self.method = 'gvae'
self.graph_type = 'ENZYMES'
self.data_dir = './data/ENZYMES_20-50_res.graphs'
self.emb_size = 8
self.encode_dim = 32
self.layer_num = 3
self.decode_dim = 32
self.dropout = 0.5
self.logi... |
set_name(0x8013570C, "PresOnlyTestRoutine__Fv", SN_NOWARN)
set_name(0x80135734, "FeInitBuffer__Fv", SN_NOWARN)
set_name(0x80135760, "FeAddEntry__Fii8TXT_JUSTUsP7FeTableP5CFont", SN_NOWARN)
set_name(0x801357E4, "FeAddTable__FP11FeMenuTablei", SN_NOWARN)
set_name(0x80135860, "FeAddNameTable__FPUci", SN_NOWARN)
set_name(0... | set_name(2148751116, 'PresOnlyTestRoutine__Fv', SN_NOWARN)
set_name(2148751156, 'FeInitBuffer__Fv', SN_NOWARN)
set_name(2148751200, 'FeAddEntry__Fii8TXT_JUSTUsP7FeTableP5CFont', SN_NOWARN)
set_name(2148751332, 'FeAddTable__FP11FeMenuTablei', SN_NOWARN)
set_name(2148751456, 'FeAddNameTable__FPUci', SN_NOWARN)
set_name(2... |
APKG_COL = r'''
INSERT INTO col VALUES(
null,
:creation_time,
:modification_time,
:modification_time,
11,
0,
0,
0,
'{
"activeDecks": [
1
],
"addToCur": true,
"collapseTime": 1200,
"curDeck": 1,
"curModel": "' || :modificatio... | apkg_col = '\nINSERT INTO col VALUES(\n null,\n :creation_time,\n :modification_time,\n :modification_time,\n 11,\n 0,\n 0,\n 0,\n \'{\n "activeDecks": [\n 1\n ],\n "addToCur": true,\n "collapseTime": 1200,\n "curDeck": 1,\n "curModel": "\'... |
def sum_numbers(text: str) -> int:
return sum([int(x) for x in text.split() if x.isnumeric()])
if __name__ == '__main__':
print("Example:")
print(sum_numbers('hi'))
# These "asserts" are used for self-checking and not for an auto-testing
assert sum_numbers('hi') == 0
assert sum_numbers('who i... | def sum_numbers(text: str) -> int:
return sum([int(x) for x in text.split() if x.isnumeric()])
if __name__ == '__main__':
print('Example:')
print(sum_numbers('hi'))
assert sum_numbers('hi') == 0
assert sum_numbers('who is 1st here') == 0
assert sum_numbers('my numbers is 2') == 2
assert sum_... |
class snake:
poison='venom' # shared by all instances
def __init__(self, name):
self.name=name # instance variable unique to each instance
def change_name(self, new_name):
self.name=new_name
cobra= snake('cobra')
print(cobra.name)
| class Snake:
poison = 'venom'
def __init__(self, name):
self.name = name
def change_name(self, new_name):
self.name = new_name
cobra = snake('cobra')
print(cobra.name) |
name = input("Enter Your Username: ")
age = int(input("Enter Your Age: "))
print(type(age))
if type(age) == int:
print("Name :" ,name)
print("Age :", age)
else:
print("Enter a valid Username or Age") | name = input('Enter Your Username: ')
age = int(input('Enter Your Age: '))
print(type(age))
if type(age) == int:
print('Name :', name)
print('Age :', age)
else:
print('Enter a valid Username or Age') |
# glob.py
viewPortX = None
viewPortY = None
| view_port_x = None
view_port_y = None |
'''
Given an array of ints, return True if 6 appears as either the first or last
element in the array. The array will be length 1 or more.
'''
def first_last6(nums):
return nums[0] == 6 or nums[-1] == 6
| """
Given an array of ints, return True if 6 appears as either the first or last
element in the array. The array will be length 1 or more.
"""
def first_last6(nums):
return nums[0] == 6 or nums[-1] == 6 |
def insertion_sort(lst):
for i in range(len(lst)):
j = (i - 1)
temp = lst[i]
while j >= 0 and temp < lst[j]:
lst[j+1] = lst[j]
j = j-1
lst[j + 1] = temp
return lst
| def insertion_sort(lst):
for i in range(len(lst)):
j = i - 1
temp = lst[i]
while j >= 0 and temp < lst[j]:
lst[j + 1] = lst[j]
j = j - 1
lst[j + 1] = temp
return lst |
# the public parameters are passed as they are known globally
def attacker(prime, root, alicepublic, bobpublic):
attacksecret1=int(input("Enter a secret number1 for attacker: "))
attacksecret2=int(input("Enter a secret number2 for attacker: "))
print('\n')
print ("Attacker's public key -> C=root^... | def attacker(prime, root, alicepublic, bobpublic):
attacksecret1 = int(input('Enter a secret number1 for attacker: '))
attacksecret2 = int(input('Enter a secret number2 for attacker: '))
print('\n')
print("Attacker's public key -> C=root^attacksecret(mod(prime))")
attackpublic1 = root ** attacksecr... |
REC1 = b"""cam a22002051 4500001001300000003000400013005001700017008004100034010001700075035001900092040001800111050001600129100003500145245017600180260004300356300001900399500002600418650002100444650004900465 00000002 DLC20040505165105.0800108s1899 ilu 000 0 eng a 00000002 a(OCoLC)585314... | rec1 = b'cam a22002051 4500001001300000003000400013005001700017008004100034010001700075035001900092040001800111050001600129100003500145245017600180260004300356300001900399500002600418650002100444650004900465\x1e 00000002 \x1eDLC\x1e20040505165105.0\x1e800108s1899 ilu 000 0 eng \x1e \x1fa 00000002 \x... |
"""A bunch of click related tools / helpers / patterns
that have a potential of reuse across clis.
TODO: We would improve sharing by moving these to a separate
re-usable repository instead of copying.
"""
| """A bunch of click related tools / helpers / patterns
that have a potential of reuse across clis.
TODO: We would improve sharing by moving these to a separate
re-usable repository instead of copying.
""" |
''' your local settings.
Note that if you install using setuptools, change this
module first before running setup.py install.
'''
oauthkey = '7dkss6x9fn5v'
secret = 't5f28uhdmct7zhdr'
country = 'US'
| """ your local settings.
Note that if you install using setuptools, change this
module first before running setup.py install.
"""
oauthkey = '7dkss6x9fn5v'
secret = 't5f28uhdmct7zhdr'
country = 'US' |
#!/usr/bin/env python3
# Conditional Statements
def drink(money):
if (money >= 2):
return "You've got yourself a drink!"
else:
return "NO drink for you!"
print(drink(3))
print(drink(1))
def alcohol(age, money):
if (age >= 21) and (money >= 5): # if statement
ret... | def drink(money):
if money >= 2:
return "You've got yourself a drink!"
else:
return 'NO drink for you!'
print(drink(3))
print(drink(1))
def alcohol(age, money):
if age >= 21 and money >= 5:
return "we're getting a drink!"
elif age >= 21 and money < 5:
return 'Come back w... |
def getUniqueID(inArray):
'''
Given an int array that contains many duplicates and a single
unique ID, find it and return it.
'''
pairDictionary = {}
for quadID in inArray:
# print(quadID)
# print(pairDictionary)
if quadID in pairDictionary:
del pairDic... | def get_unique_id(inArray):
"""
Given an int array that contains many duplicates and a single
unique ID, find it and return it.
"""
pair_dictionary = {}
for quad_id in inArray:
if quadID in pairDictionary:
del pairDictionary[quadID]
else:
pairDictionary[q... |
# create a dictionary from two lists using zip()
# More information using help('zip') and help('dict')
# create two lists
dict_keys = ['bananas', 'bread flour', 'cheese', 'milk']
dict_values = [2, 1, 4, 3]
# iterate over lists using zip
iterator_using_zip = zip(dict_keys, dict_values)
# create the dictionary from th... | dict_keys = ['bananas', 'bread flour', 'cheese', 'milk']
dict_values = [2, 1, 4, 3]
iterator_using_zip = zip(dict_keys, dict_values)
dictionary_from_zip = dict(iterator_using_zip)
print(dictionary_from_zip) |
p = int(input())
q = int(input())
for i in range(1, 101):
if i % p == q:
print(i) | p = int(input())
q = int(input())
for i in range(1, 101):
if i % p == q:
print(i) |
# PATH
UPLOAD_FOLDER = './upload_file'
GENERATE_PATH = './download_file'
# DATABASE
DATABASE = 'mysql'
DATABASE_URL = 'localhost:3306'
USERNAME = 'root'
PASSWORD = 'root'
| upload_folder = './upload_file'
generate_path = './download_file'
database = 'mysql'
database_url = 'localhost:3306'
username = 'root'
password = 'root' |
# TODO - bisect operations
class SortedDictCore:
def __init__(self, *a, **kw):
self._items = []
self.dict = dict(*a,**kw)
##
def __setitem__(self,k,v):
self._items = []
self.dict[k]=v
def __getitem__(self,k):
return self.dict[k]
def __delitem__(self,k):
self._items = []
del self.dict[k]
##... | class Sorteddictcore:
def __init__(self, *a, **kw):
self._items = []
self.dict = dict(*a, **kw)
def __setitem__(self, k, v):
self._items = []
self.dict[k] = v
def __getitem__(self, k):
return self.dict[k]
def __delitem__(self, k):
self._items = []
... |
n = 2001
number = 1
while n < 2101:
if number % 10 == 0:
print("\n")
number += 1
if n % 100 == 0:
if n % 400 == 0:
print(n, end=" ")
n += 1
number += 1
continue
else:
n += 1
continue
else:
if n % ... | n = 2001
number = 1
while n < 2101:
if number % 10 == 0:
print('\n')
number += 1
if n % 100 == 0:
if n % 400 == 0:
print(n, end=' ')
n += 1
number += 1
continue
else:
n += 1
continue
elif n % 4 == 0:
... |
# Python - 3.6.0
def high_and_low(numbers):
lst = [*map(int, numbers.split(' '))]
return f'{max(lst)} {min(lst)}'
| def high_and_low(numbers):
lst = [*map(int, numbers.split(' '))]
return f'{max(lst)} {min(lst)}' |
online_store = {
"keychain": 0.75,
"tshirt": 8.50,
"bottle": 10.00
}
choicekey = int(input("How many keychains will you be purchasing? If not purchasing keychains, enter 0. "))
choicetshirt = int(input("How many t-shirts will you be purchasing? If not purchasing t-shirts, enter 0. "))
choicebottle = in... | online_store = {'keychain': 0.75, 'tshirt': 8.5, 'bottle': 10.0}
choicekey = int(input('How many keychains will you be purchasing? If not purchasing keychains, enter 0. '))
choicetshirt = int(input('How many t-shirts will you be purchasing? If not purchasing t-shirts, enter 0. '))
choicebottle = int(input('How many t-s... |
# -*- coding: utf-8 -*-
config = {}
config['log_name'] = 'app_log.log'
config['log_format'] = '%(asctime)s - %(levelname)s: %(message)s'
config['log_date_format'] = '%Y-%m-%d %I:%M:%S'
config['format'] = 'json'
config['source_dir'] = 'data'
config['output_dir'] = 'export'
config['source_glob'] = 'monitoraggio_serviz_co... | config = {}
config['log_name'] = 'app_log.log'
config['log_format'] = '%(asctime)s - %(levelname)s: %(message)s'
config['log_date_format'] = '%Y-%m-%d %I:%M:%S'
config['format'] = 'json'
config['source_dir'] = 'data'
config['output_dir'] = 'export'
config['source_glob'] = 'monitoraggio_serviz_controllo_giornaliero_*.pd... |
_mods = []
def get():
return _mods
def add(mod):
_mods.append(mod)
| _mods = []
def get():
return _mods
def add(mod):
_mods.append(mod) |
n = int(input())
lst = [list(map(int, input().split())) for _ in range(n)]
dp = [[0]*3 for _ in range(n)]
for i in range(3):
dp[0][i] = lst[0][i]
for i in range(1, n):
dp[i][0] = max(dp[i-1][1], dp[i-1][2])+lst[i][0]
dp[i][1] = max(dp[i-1][0], dp[i-1][2])+lst[i][1]
dp[i][2] = max(dp[i-1][0], dp[i-1][... | n = int(input())
lst = [list(map(int, input().split())) for _ in range(n)]
dp = [[0] * 3 for _ in range(n)]
for i in range(3):
dp[0][i] = lst[0][i]
for i in range(1, n):
dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + lst[i][0]
dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + lst[i][1]
dp[i][2] = max(dp[i - 1]... |
# cases where FunctionAchievement should not unlock
# >> CASE
def test():
pass
# >> CASE
def func():
pass
func
# >> CASE
def func():
pass
f = func
f()
# >> CASE
func()
# >> CASE
func
| def test():
pass
def func():
pass
func
def func():
pass
f = func
f()
func()
func |
"""
Tools to validate schema of python objects
"""
class RoyalValidationError(Exception):
pass
class SchemaValidator(object):
def __init__(self, **kwargs):
self.schema = kwargs
self.checks = []
def validate(self, obj):
for key in self.schema:
if key not in obj:
raise RoyalValidationError("Expecte... | """
Tools to validate schema of python objects
"""
class Royalvalidationerror(Exception):
pass
class Schemavalidator(object):
def __init__(self, **kwargs):
self.schema = kwargs
self.checks = []
def validate(self, obj):
for key in self.schema:
if key not in obj:
... |
class Solution:
def removeDuplicates(self, nums: List[int]) -> int:
return len(nums) if len(nums) < 2 else self.calculate(nums)
@staticmethod
def calculate(nums):
result = 0
for i in range(1, len(nums)):
if nums[i] != nums[result]:
result += 1
... | class Solution:
def remove_duplicates(self, nums: List[int]) -> int:
return len(nums) if len(nums) < 2 else self.calculate(nums)
@staticmethod
def calculate(nums):
result = 0
for i in range(1, len(nums)):
if nums[i] != nums[result]:
result += 1
... |
# function with large number of arguments
def fun(a, b, c, d, e, f, g):
return a + b + c * d + e * f * g
print(fun(1, 2, 3, 4, 5, 6, 7))
| def fun(a, b, c, d, e, f, g):
return a + b + c * d + e * f * g
print(fun(1, 2, 3, 4, 5, 6, 7)) |
# Input: nums = [0,1,2,2,3,0,4,2], val = 2
# Output: 5, nums = [0,1,4,0,3]
# Explanation: Your function should return length = 5,
# with the first five elements of nums containing 0, 1, 3, 0, and 4.
# Note that the order of those five elements can be arbitrary.
# It doesn't matter what values are set beyond the returne... | class Solution:
def remove_element(self, nums: List[int], val: int) -> int:
try:
while True:
nums.remove(val)
finally:
return len(nums) |
"""Top-level package for py_tutis."""
__author__ = """Chidozie C. Okafor"""
__email__ = "chidosiky2015@gmail.com"
__version__ = "0.1.0"
| """Top-level package for py_tutis."""
__author__ = 'Chidozie C. Okafor'
__email__ = 'chidosiky2015@gmail.com'
__version__ = '0.1.0' |
# Copyright 2021 The Bazel 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 applicable la... | """Partial implementation for Swift frameworks with third party interfaces."""
load('@build_bazel_rules_apple//apple/internal:processor.bzl', 'processor')
load('@build_bazel_rules_apple//apple/internal:swift_info_support.bzl', 'swift_info_support')
load('@bazel_skylib//lib:partial.bzl', 'partial')
load('@bazel_skylib//... |
class Solution:
def firstMissingPositive(self, nums: List[int], res: int = 1) -> int:
for num in sorted(nums):
res += num == res
return res
| class Solution:
def first_missing_positive(self, nums: List[int], res: int=1) -> int:
for num in sorted(nums):
res += num == res
return res |
#
# PySNMP MIB module Wellfleet-AOT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Wellfleet-AOT-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:32:37 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_intersection, constraints_union, value_range_constraint, value_size_constraint) ... |
# absoluteimports/__init__.py
print("inside absoluteimports/__init__.py")
| print('inside absoluteimports/__init__.py') |
'''
5 - Remapping categories
To better understand survey respondents from airlines, you want to find out if
there is a relationship between certain responses and the day of the week and
wait time at the gate.
The airlines DataFrame contains the day and wait_min columns, which are categorical and
numerical respectiv... | """
5 - Remapping categories
To better understand survey respondents from airlines, you want to find out if
there is a relationship between certain responses and the day of the week and
wait time at the gate.
The airlines DataFrame contains the day and wait_min columns, which are categorical and
numerical respectiv... |
def read_file():
file_input = open("data/file_input_data.txt", 'r')
file_data = file_input.readlines()
file_input.close()
return file_data
if __name__ == "__main__":
data = read_file()
print(type(data))
print(data)
for line in data:
print(line)
| def read_file():
file_input = open('data/file_input_data.txt', 'r')
file_data = file_input.readlines()
file_input.close()
return file_data
if __name__ == '__main__':
data = read_file()
print(type(data))
print(data)
for line in data:
print(line) |
def is_armstrong_number(number):
digits = [int(i) for i in str(number)]
d_len = len(digits)
d_sum = 0
for digit in digits:
d_sum += digit ** d_len
return d_sum == number
| def is_armstrong_number(number):
digits = [int(i) for i in str(number)]
d_len = len(digits)
d_sum = 0
for digit in digits:
d_sum += digit ** d_len
return d_sum == number |
# Preprocessing config
SAMPLING_RATE = 22050
FFT_WINDOW_SIZE = 1024
HOP_LENGTH = 512
N_MELS = 80
F_MIN = 27.5
F_MAX = 8000
AUDIO_MAX_LENGTH = 90 # in seconds
# Data augmentation config
MAX_SHIFTING_PITCH = 0.3
MAX_STRETCHING = 0.3
MAX_LOUDNESS_DB = 10
BLOCK_MIXING_MIN = 0.2
BLOCK_MIXING_MAX = 0.5
# Model config
... | sampling_rate = 22050
fft_window_size = 1024
hop_length = 512
n_mels = 80
f_min = 27.5
f_max = 8000
audio_max_length = 90
max_shifting_pitch = 0.3
max_stretching = 0.3
max_loudness_db = 10
block_mixing_min = 0.2
block_mixing_max = 0.5
loss = 'binary_crossentropy'
metrics = ['binary_accuracy', 'categorical_accuracy']
cl... |
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def repo():
http_archive(
name = "fmt",
strip_prefix = "fmt-7.1.3",
urls = ["https://github.com/fmtlib/fmt/releases/download/7.1.3/fmt-7.1.3.zip"],
sha256 = "5d98c504d0205f912e22449ecdea776b78ce0bb096927334f80781e7... | load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
def repo():
http_archive(name='fmt', strip_prefix='fmt-7.1.3', urls=['https://github.com/fmtlib/fmt/releases/download/7.1.3/fmt-7.1.3.zip'], sha256='5d98c504d0205f912e22449ecdea776b78ce0bb096927334f80781e720084c9f', build_file='@//third_party/fmt... |
"""Constants and variables common to the whole program
@var VISUALIZE: whether to generate video
@var PRECONDITIONER_CLASS: class or function that returns preconditioner object (1-parameter callable object) for CG, see L{SGSPreconditioner} for example
@var PRECONDITIONER: preconditioner object (1-parameter callable o... | """Constants and variables common to the whole program
@var VISUALIZE: whether to generate video
@var PRECONDITIONER_CLASS: class or function that returns preconditioner object (1-parameter callable object) for CG, see L{SGSPreconditioner} for example
@var PRECONDITIONER: preconditioner object (1-parameter callable ob... |
"""
In a given integer array nums, there is always exactly one largest element.
Find whether the largest element in the array is at least twice as much as every other number in the array.
If it is, return the index of the largest element, otherwise return -1.
Your runtime beats 80.31 % of python submissions.
"""
c... | """
In a given integer array nums, there is always exactly one largest element.
Find whether the largest element in the array is at least twice as much as every other number in the array.
If it is, return the index of the largest element, otherwise return -1.
Your runtime beats 80.31 % of python submissions.
"""
cl... |
# 1 - push
# 2 - pop
# 3 - print max element
# 4 - print max element
# last - print all elements
n = int(input())
query = []
for _ in range(n):
num = input().split()
if num[0] == "1":
query.append(int(num[1]))
elif num[0] == "2":
if query:
query.pop()
continue
el... | n = int(input())
query = []
for _ in range(n):
num = input().split()
if num[0] == '1':
query.append(int(num[1]))
elif num[0] == '2':
if query:
query.pop()
continue
elif num[0] == '3':
if query:
print(max(query))
elif num[0] == '4':
if q... |
# Constants for the image
IMAGE_URL = str(input("Enter a valid image URL: "))
IMAGE_WIDTH = 280
IMAGE_HEIGHT = 200
blueUpFactor = int(input("How much more blue do you want this image | Enter a value between 1 and 255"))
maxPixelValue = 255
image = Image(IMAGE_URL)
image.set_position(70, 70)
image.set_size(IMAGE_WIDTH,... | image_url = str(input('Enter a valid image URL: '))
image_width = 280
image_height = 200
blue_up_factor = int(input('How much more blue do you want this image | Enter a value between 1 and 255'))
max_pixel_value = 255
image = image(IMAGE_URL)
image.set_position(70, 70)
image.set_size(IMAGE_WIDTH, IMAGE_HEIGHT)
add(imag... |
class Solution:
def reverseOnlyLetters(self, S: str) -> str:
alpha = set([chr(i) for i in list(range(ord('a'), ord('z')+1)) +
list(range(ord('A'), ord('Z')+1))])
words, res = [], list(S)
for char in res:
if char in alpha:
words.append(char)
... | class Solution:
def reverse_only_letters(self, S: str) -> str:
alpha = set([chr(i) for i in list(range(ord('a'), ord('z') + 1)) + list(range(ord('A'), ord('Z') + 1))])
(words, res) = ([], list(S))
for char in res:
if char in alpha:
words.append(char)
for ... |
# SPDX-FileCopyrightText: 2020 Splunk Inc.
#
# SPDX-License-Identifier: Apache-2.0
def normalize_to_unicode(value):
"""
string convert to unicode
"""
if hasattr(value, "decode") and not isinstance(value, str):
return value.decode("utf-8")
return value
def normalize_to_str(value):
"""
... | def normalize_to_unicode(value):
"""
string convert to unicode
"""
if hasattr(value, 'decode') and (not isinstance(value, str)):
return value.decode('utf-8')
return value
def normalize_to_str(value):
"""
unicode convert to string
"""
if hasattr(value, 'encode') and isinstanc... |
number = int(input())
while number < 1 or number > 100:
print('Invalid number')
number = int(input())
print(f'The number is: {number}') | number = int(input())
while number < 1 or number > 100:
print('Invalid number')
number = int(input())
print(f'The number is: {number}') |
class Configuration(object):
config={}
def __str__(self):
return str(Configuration.config)
@staticmethod
def defaults():
Configuration.config['api_base_link'] = 'https://api.twitch.tv/kraken/'
@staticmethod
def load(file=None):
if file:
with open (file, ... | class Configuration(object):
config = {}
def __str__(self):
return str(Configuration.config)
@staticmethod
def defaults():
Configuration.config['api_base_link'] = 'https://api.twitch.tv/kraken/'
@staticmethod
def load(file=None):
if file:
with open(file, 'r... |
# By Taiwo Kareem <taiwo.kareem36@gmail.com>
# Github <https://github.com/tushortz>
# Last updated (08-February-2016)
# Card class
class Card:
# Initialize necessary field variables
def __init__(self, *code):
# Accept two character arguments
if len(code) == 2:
rank = code[0]
suit = code[1]
# Can also ac... | class Card:
def __init__(self, *code):
if len(code) == 2:
rank = code[0]
suit = code[1]
elif len(code) == 1:
if len(code[0]) == 2:
rank = code[0][0]
suit = code[0][1]
else:
raise value_error('card codes ... |
""" ______ __
____ ____/ / __/ ____ ____ ____ ___ _________ _/ /_____ _____
/ __ \/ __ / /_ / __ `/ _ \/ __ \/ _ \/ ___/ __ `/ __/ __ \/ ___/
/ /_/ / /_/ / __/ / /_/ / __/ / / / __/ / / /_/ / /_/ /_/ / /
/ .___/\__,_/_/_____\__, /\___/... | """ ______ __
____ ____/ / __/ ____ ____ ____ ___ _________ _/ /_____ _____
/ __ \\/ __ / /_ / __ `/ _ \\/ __ \\/ _ \\/ ___/ __ `/ __/ __ \\/ ___/
/ /_/ / /_/ / __/ / /_/ / __/ / / / __/ / / /_/ / /_/ /_/ / /
/ .___/\\__,_/_/_____\\__,... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def getMinimumDifference(self, root: TreeNode) -> int:
def dfs(root):
if not root:
return
... | class Solution:
def get_minimum_difference(self, root: TreeNode) -> int:
def dfs(root):
if not root:
return
dfs(root.left)
nums.append(root.val)
dfs(root.right)
nums = []
dfs(root)
res = float('inf')
for i in r... |
# -*- coding: utf-8 -*-
__author__ = 'Andile Jaden Mbele'
__email__ = 'andilembele020@gmail.com'
__github__ = 'https://github.com/xeroxzen/genuine-fake'
__package__ = 'genuine-fake'
__version__ = '1.2.20'
| __author__ = 'Andile Jaden Mbele'
__email__ = 'andilembele020@gmail.com'
__github__ = 'https://github.com/xeroxzen/genuine-fake'
__package__ = 'genuine-fake'
__version__ = '1.2.20' |
def b2d(number):
decimal_number = 0
i = 0
while number > 0:
decimal_number += number % 10*(2**i)
number = int(number / 10)
i += 1
return decimal_number
def d2b(number):
binary_number = 0
i = 0
while number > 0:
binary_number += number % 2*(10**i)
nu... | def b2d(number):
decimal_number = 0
i = 0
while number > 0:
decimal_number += number % 10 * 2 ** i
number = int(number / 10)
i += 1
return decimal_number
def d2b(number):
binary_number = 0
i = 0
while number > 0:
binary_number += number % 2 * 10 ** i
... |
'''
06 - Treating duplicates
In the last exercise, you were able to verify that the new update
feeding into ride_sharing contains a bug generating both complete
and incomplete duplicated rows for some values of the ride_id column,
with occasional discrepant values for the user_birth_year and duration
colu... | """
06 - Treating duplicates
In the last exercise, you were able to verify that the new update
feeding into ride_sharing contains a bug generating both complete
and incomplete duplicated rows for some values of the ride_id column,
with occasional discrepant values for the user_birth_year and duration
colu... |
{
"name": """Website login background""",
"summary": """Random background image to your taste at the website login page""",
"category": "Website",
"images": ["images/5.png"],
"version": "14.0.1.0.3",
"author": "IT-Projects LLC",
"support": "help@itpp.dev",
"website": "https://twitter.com... | {'name': 'Website login background', 'summary': 'Random background image to your taste at the website login page', 'category': 'Website', 'images': ['images/5.png'], 'version': '14.0.1.0.3', 'author': 'IT-Projects LLC', 'support': 'help@itpp.dev', 'website': 'https://twitter.com/OdooFree', 'license': 'Other OSI approve... |
"""
This file will host global variables of config strings for the sims.
We will only be varying one or two parameters, but we will need to write several copies of the all the parameters we
have to specify. I believe this is the easiest way to do that.
"""
# NOTE with the class python wrapper this one is not necessar... | """
This file will host global variables of config strings for the sims.
We will only be varying one or two parameters, but we will need to write several copies of the all the parameters we
have to specify. I believe this is the easiest way to do that.
"""
class_config = '\n*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*\n* CLASS i... |
""" impyute.util.errors """
class BadInputError(Exception):
"Error thrown when input args don't match spec"
pass
| """ impyute.util.errors """
class Badinputerror(Exception):
"""Error thrown when input args don't match spec"""
pass |
print("Welcome to RollerCoaster")
height = int(input("Enter your height in cm : "))
bill = 0
# Comparison operators are used more > , <= , == , > , >= , !=
if height >= 120 :
print("You can ride the RollerCoaster")
age = int(input("Enter your age : "))
if age < 12 :
bill = 5
print("Childe... | print('Welcome to RollerCoaster')
height = int(input('Enter your height in cm : '))
bill = 0
if height >= 120:
print('You can ride the RollerCoaster')
age = int(input('Enter your age : '))
if age < 12:
bill = 5
print('Childeren tickets are $5')
elif age <= 18:
bill = 7
p... |
class Revoked(Exception):
pass
class MintingNotAllowed(Exception):
pass
| class Revoked(Exception):
pass
class Mintingnotallowed(Exception):
pass |
class Time:
def __init__(self):
self.hours=0
self.minutes=0
self.seconds=0
def input_values(self):
self.hours=int(input('Enter the hours: '))
self.minutes=int(input('Enter the minutes: '))
self.seconds=int(input('Enter the seconds: '))
def print_details(self):
print(self.hours,':',self.minutes,':',self... | class Time:
def __init__(self):
self.hours = 0
self.minutes = 0
self.seconds = 0
def input_values(self):
self.hours = int(input('Enter the hours: '))
self.minutes = int(input('Enter the minutes: '))
self.seconds = int(input('Enter the seconds: '))
def print... |
#!/usr/bin/env python
# encoding: utf-8
"""
__init__.py
Creating models for testing. See ticket for more detail.
http://code.djangoproject.com/ticket/7835
"""
| """
__init__.py
Creating models for testing. See ticket for more detail.
http://code.djangoproject.com/ticket/7835
""" |
#!/usr/bin/python
# -*- coding : utf-8 -*-
"""
pattern:
Factory method:
Define an interface for creating an object,
but let subclasses decide which class to
instantiate.Factory Method lets a class defer
instantiation to subclasses.
AbstractProduct1 < = > AbstractProduct2
| | ... | """
pattern:
Factory method:
Define an interface for creating an object,
but let subclasses decide which class to
instantiate.Factory Method lets a class defer
instantiation to subclasses.
AbstractProduct1 < = > AbstractProduct2
| | | |
ProductA1 P... |
# Shape of number 2 using fucntions
def for_2():
""" *'s printed in the shape of number 2 """
for row in range(9):
for col in range(9):
if row ==8 or row+col ==8 and row !=0 or row ==0 and col%8 !=0 or row ==1 and col ==0 or row ==2 and col ==0:
print('*',end =' ')
... | def for_2():
""" *'s printed in the shape of number 2 """
for row in range(9):
for col in range(9):
if row == 8 or (row + col == 8 and row != 0) or (row == 0 and col % 8 != 0) or (row == 1 and col == 0) or (row == 2 and col == 0):
print('*', end=' ')
else:
... |
""" You are given an array of intervals, where intervals[i] = [starti, endi] and
each starti is unique. The right interval for an interval i is an interval j
such that startj >= endi and startj is minimized. Return an array of right
interval indices for each interval i. If no right interval exists for
int... | """ You are given an array of intervals, where intervals[i] = [starti, endi] and
each starti is unique. The right interval for an interval i is an interval j
such that startj >= endi and startj is minimized. Return an array of right
interval indices for each interval i. If no right interval exists for
int... |
class Solution:
def wiggleSort(self, nums: List[int]) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
nums.sort()
ans = nums[:]
for i in range(1, len(nums), 2):
nums[i] = ans.pop()
for i in range(0, len(nums), 2):
... | class Solution:
def wiggle_sort(self, nums: List[int]) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
nums.sort()
ans = nums[:]
for i in range(1, len(nums), 2):
nums[i] = ans.pop()
for i in range(0, len(nums), 2):
... |
PANEL_GROUP = 'default'
PANEL_DASHBOARD = 'billing'
PANEL = 'billing_invoices'
# Python panel class of the PANEL to be added.
ADD_PANEL = 'astutedashboard.dashboards.billing.invoices.panel.BillingInvoices'
| panel_group = 'default'
panel_dashboard = 'billing'
panel = 'billing_invoices'
add_panel = 'astutedashboard.dashboards.billing.invoices.panel.BillingInvoices' |
def isPrime(n):
if n <= 1: return False
for i in range(2,int(n**.5)+1):
if n % i == 0: return False
return True
def findPrime(n):
k=1
for i in range(n):
if isPrime(i):
if(k>=10001):return i
k+=1
print(findPrime(300000))
| def is_prime(n):
if n <= 1:
return False
for i in range(2, int(n ** 0.5) + 1):
if n % i == 0:
return False
return True
def find_prime(n):
k = 1
for i in range(n):
if is_prime(i):
if k >= 10001:
return i
k += 1
print(find_pr... |
dict={'A': ['B', 'CB', 'D', 'E', 'F', 'GD', 'H', 'IE'],
'B': ['A', 'C', 'D', 'E', 'F', 'G', 'HE', 'I'],
'C': ['AB', 'GE', 'D', 'E', 'F', 'B', 'H', 'IF'],
'D': ['A', 'B', 'C', 'E', 'FE', 'G', 'H', 'I'],
'E': ['A', 'B', 'C', 'D', 'F', 'G', 'H', 'I'],
'F': ['A', 'B', 'C', 'DE', 'E', 'G',... | dict = {'A': ['B', 'CB', 'D', 'E', 'F', 'GD', 'H', 'IE'], 'B': ['A', 'C', 'D', 'E', 'F', 'G', 'HE', 'I'], 'C': ['AB', 'GE', 'D', 'E', 'F', 'B', 'H', 'IF'], 'D': ['A', 'B', 'C', 'E', 'FE', 'G', 'H', 'I'], 'E': ['A', 'B', 'C', 'D', 'F', 'G', 'H', 'I'], 'F': ['A', 'B', 'C', 'DE', 'E', 'G', 'H', 'I'], 'G': ['AD', 'B', 'CE'... |
test = { 'name': 'q4c',
'points': 10,
'suites': [ { 'cases': [ { 'code': '>>> len(prophet_forecast) == '
'5863\n'
'True',
'hidden': False,
... | test = {'name': 'q4c', 'points': 10, 'suites': [{'cases': [{'code': '>>> len(prophet_forecast) == 5863\nTrue', 'hidden': False, 'locked': False}, {'code': '>>> len(prophet_forecast_holidays) == 5863\nTrue', 'hidden': False, 'locked': False}], 'scored': True, 'setup': '', 'teardown': '', 'type': 'doctest'}]} |
def read_blob(blob, bucket):
return bucket.blob(blob).download_as_string().decode("utf-8", errors="ignore")
def download_blob(blob, file_obj, bucket):
return bucket.blob(blob).download_to_file(file_obj)
def write_blob(key, file_obj, bucket):
return bucket.blob(key).upload_from_file(file_obj)
| def read_blob(blob, bucket):
return bucket.blob(blob).download_as_string().decode('utf-8', errors='ignore')
def download_blob(blob, file_obj, bucket):
return bucket.blob(blob).download_to_file(file_obj)
def write_blob(key, file_obj, bucket):
return bucket.blob(key).upload_from_file(file_obj) |
'''
Given an array A of non-negative integers, return an array consisting of all the even elements of A, followed by all the odd elements of A.
You may return any answer array that satisfies this condition.
Example 1:
Input: [3,1,2,4]
Output: [2,4,3,1]
The outputs [4,2,3,1], [2,4,1,3], and [4,2,1,3] wo... | """
Given an array A of non-negative integers, return an array consisting of all the even elements of A, followed by all the odd elements of A.
You may return any answer array that satisfies this condition.
Example 1:
Input: [3,1,2,4]
Output: [2,4,3,1]
The outputs [4,2,3,1], [2,4,1,3], and [4,2,1,3] would also be... |
# https://www.hackerrank.com/challenges/compare-the-triplets/problem?h_r=internal-search
A = input().split()
B = input().split()
def compare(a, b):
alice = 0
bob = 0
x = len(a)
for i in range(x):
if int(a[i]) > int(b[i]):
alice += 1
elif int(a[i]) < int(b[i]):
b... | a = input().split()
b = input().split()
def compare(a, b):
alice = 0
bob = 0
x = len(a)
for i in range(x):
if int(a[i]) > int(b[i]):
alice += 1
elif int(a[i]) < int(b[i]):
bob += 1
elif a[i] == b[i]:
alice += 0
bob += 0
pas... |
class Attachment:
def __init__(
self,
fallback: str,
color: str = None,
pretext: str = None,
text: str = None,
author_name: str = None,
author_link: str = None,
author_icon: str = None,
title: str = None,
title_link: str = None,
... | class Attachment:
def __init__(self, fallback: str, color: str=None, pretext: str=None, text: str=None, author_name: str=None, author_link: str=None, author_icon: str=None, title: str=None, title_link: str=None, fields: list=None, image_url: str=None, thumb_url: str=None):
self.fallback = fallback
... |
infile = open("sud3_results.csv","r")
outfile = open("sud4_results.csv","w")
keywords = infile.readline().strip().split(",")[1:]
outfile.write("%s, %s" % ("filename", ",".join("Environment+Social+Economic", "Environment+Social+Economic+Cultural", "Environment+Social+Economic+Cultural+Institutional")))
three_pillars_k... | infile = open('sud3_results.csv', 'r')
outfile = open('sud4_results.csv', 'w')
keywords = infile.readline().strip().split(',')[1:]
outfile.write('%s, %s' % ('filename', ','.join('Environment+Social+Economic', 'Environment+Social+Economic+Cultural', 'Environment+Social+Economic+Cultural+Institutional')))
three_pillars_k... |
class EnvInfo(object):
def __init__(self, frame_id, time_stamp, road_path, obstacle_array):
# default params
self.frame_id = frame_id
self.time_stamp = time_stamp
self.road_path = road_path
self.obstacle_array = obstacle_array | class Envinfo(object):
def __init__(self, frame_id, time_stamp, road_path, obstacle_array):
self.frame_id = frame_id
self.time_stamp = time_stamp
self.road_path = road_path
self.obstacle_array = obstacle_array |
# Module for implementing gradients used in the autograd system
__all__ = ["GradFunc"]
def forward_grad(tensor):
## tensor here should be an AutogradTensor or a Tensor where we can set .grad
try:
grad_fn = tensor.grad_fn
except AttributeError:
return None
# If a tensor doesn't have ... | __all__ = ['GradFunc']
def forward_grad(tensor):
try:
grad_fn = tensor.grad_fn
except AttributeError:
return None
if grad_fn is None and tensor.requires_grad:
return accumulate(tensor)
else:
return grad_fn
class Gradfunc:
def __init__(self, *args):
self.nex... |
class KeywordsOnlyMeta(type):
def __call__(cls, *args, **kwargs):
if args:
raise TypeError("Constructor for class {!r} does not accept positional arguments.".format(cls))
return super().__call__(cls, **kwargs)
class ConstrainedToKeywords(metaclass=KeywordsOnlyMeta):
def __init__... | class Keywordsonlymeta(type):
def __call__(cls, *args, **kwargs):
if args:
raise type_error('Constructor for class {!r} does not accept positional arguments.'.format(cls))
return super().__call__(cls, **kwargs)
class Constrainedtokeywords(metaclass=KeywordsOnlyMeta):
def __init__(... |
if __name__ == "__main__":
ans = ""
for n in range(2, 10):
for i in range(1, 10**(9 // n)):
s = "".join(str(i * j) for j in range(1, n + 1))
if "".join(sorted(s)) == "123456789":
ans = max(s, ans)
print(ans)
| if __name__ == '__main__':
ans = ''
for n in range(2, 10):
for i in range(1, 10 ** (9 // n)):
s = ''.join((str(i * j) for j in range(1, n + 1)))
if ''.join(sorted(s)) == '123456789':
ans = max(s, ans)
print(ans) |
"""
The module identify push-down method refactoring opportunities in Java projects
"""
# Todo: Implementing a decent push-down method identification algorithm.
| """
The module identify push-down method refactoring opportunities in Java projects
""" |
COLORS = {
'Black': u'\u001b[30m',
'Red': u'\u001b[31m',
'Green': u'\u001b[32m',
'Yellow': u'\u001b[33m',
'Blue': u'\u001b[34m',
'Magenta': u'\u001b[35m',
'Cyan': u'\u001b[36m',
'White': u'\u001b[37m',
'Reset': u'\u001b[0m',
}
| colors = {'Black': u'\x1b[30m', 'Red': u'\x1b[31m', 'Green': u'\x1b[32m', 'Yellow': u'\x1b[33m', 'Blue': u'\x1b[34m', 'Magenta': u'\x1b[35m', 'Cyan': u'\x1b[36m', 'White': u'\x1b[37m', 'Reset': u'\x1b[0m'} |
def mmc(x, y):
if a == 0 or b == 0:
return 0
return a * b // mdc(a, b)
def mdc(a, b):
if b == 0:
return a
return mdc(b, a % b)
a, b = input().split()
a, b = int(a), int(b)
while a >= 0 and b >= 0:
print(mmc(a, b))
a, b = input().split()
a, b = int(a), int(b)
| def mmc(x, y):
if a == 0 or b == 0:
return 0
return a * b // mdc(a, b)
def mdc(a, b):
if b == 0:
return a
return mdc(b, a % b)
(a, b) = input().split()
(a, b) = (int(a), int(b))
while a >= 0 and b >= 0:
print(mmc(a, b))
(a, b) = input().split()
(a, b) = (int(a), int(b)) |
# Puzzle Input
with open('Day20_Input.txt') as puzzle_input:
tiles = puzzle_input.read().split('\n\n')
# Parse the tiles: Separate the ID and get the 4 sides:
parsed_tiles = []
tiles_IDs = []
for original_tile in tiles: # For every tile:
original_tile = original_tile.split('\n') # Spl... | with open('Day20_Input.txt') as puzzle_input:
tiles = puzzle_input.read().split('\n\n')
parsed_tiles = []
tiles_i_ds = []
for original_tile in tiles:
original_tile = original_tile.split('\n')
tiles_i_ds += [int(original_tile[0][5:-1])]
parsed_tiles += [[]]
left_side = ''
right_side = ''
for ... |
"""Contains the package version number
"""
__version__ = '0.1.0-dev'
| """Contains the package version number
"""
__version__ = '0.1.0-dev' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.