content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class Player():
def __init__(self, name, start=False, ai_switch=False):
self.ai = ai_switch
self.values = {0:.5}
self.name = name
self.turn = start
self.epsilon = 1
| class Player:
def __init__(self, name, start=False, ai_switch=False):
self.ai = ai_switch
self.values = {0: 0.5}
self.name = name
self.turn = start
self.epsilon = 1 |
CONFIG_FILE_PATH = 'TypeRacerStats/src/config.json'
ACCOUNTS_FILE_PATH = 'TypeRacerStats/src/accounts.json'
ALIASES_FILE_PATH = 'TypeRacerStats/src/commands.json'
PREFIXES_FILE_PATH = 'TypeRacerStats/src/prefixes.json'
SUPPORTERS_FILE_PATH = 'TypeRacerStats/src/supporter_colors.json'
UNIVERSES_FILE_PATH = 'TypeRacerSta... | config_file_path = 'TypeRacerStats/src/config.json'
accounts_file_path = 'TypeRacerStats/src/accounts.json'
aliases_file_path = 'TypeRacerStats/src/commands.json'
prefixes_file_path = 'TypeRacerStats/src/prefixes.json'
supporters_file_path = 'TypeRacerStats/src/supporter_colors.json'
universes_file_path = 'TypeRacerSta... |
#
# PySNMP MIB module HP-ICF-VRRP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HP-ICF-VRRP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:23:26 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, value_size_constraint, constraints_union, single_value_constraint, constraints_intersection) ... |
def pytest_addoption(parser):
parser.addoption('--integration_tests', action='store_true', dest="integration_tests",
default=False, help="enable integration tests")
def pytest_configure(config):
if not config.option.integration_tests:
setattr(config.option, 'markexpr', 'not integration... | def pytest_addoption(parser):
parser.addoption('--integration_tests', action='store_true', dest='integration_tests', default=False, help='enable integration tests')
def pytest_configure(config):
if not config.option.integration_tests:
setattr(config.option, 'markexpr', 'not integration_tests') |
class CountdownCancelAll:
def __init__(self):
self.symbol = ""
self.countdownTime = 0
@staticmethod
def json_parse(json_data):
result = CountdownCancelAll()
result.symbol = json_data.get_string("symbol")
result.countdownTime = json_data.get_int("countdownT... | class Countdowncancelall:
def __init__(self):
self.symbol = ''
self.countdownTime = 0
@staticmethod
def json_parse(json_data):
result = countdown_cancel_all()
result.symbol = json_data.get_string('symbol')
result.countdownTime = json_data.get_int('countdownTime')
... |
"""Contains all variable for custom scripts"""
ENVS = {
"staging": {
"app": "sparte-staging",
"region": "osc-fr1",
},
"prod": {
"app": "sparte",
"region": "osc-secnum-fr1",
},
}
| """Contains all variable for custom scripts"""
envs = {'staging': {'app': 'sparte-staging', 'region': 'osc-fr1'}, 'prod': {'app': 'sparte', 'region': 'osc-secnum-fr1'}} |
def fn1(a,b):
print("Subtraction=",a-b)
def fn2(c):
print(c) | def fn1(a, b):
print('Subtraction=', a - b)
def fn2(c):
print(c) |
#taking values through keyboard
a,b=[int(i) for i in input('enter two numbers:').split(',')]
if(a>b):
print(a,'is big')
elif(a<b):
print(b,'is big')
else:
print('both are equal')
#taking values directly
a=5
b=3
if(a>b):
print(a,'is big')
elif(b>a):
print(b,'is big')
else:
print('both are equa... | (a, b) = [int(i) for i in input('enter two numbers:').split(',')]
if a > b:
print(a, 'is big')
elif a < b:
print(b, 'is big')
else:
print('both are equal')
a = 5
b = 3
if a > b:
print(a, 'is big')
elif b > a:
print(b, 'is big')
else:
print('both are equal') |
"""This file holds the payload yaml validator/definition template."""
VALIDATOR = {
"specification": {
"type": dict,
"required": True,
"childs": {
"payload": {
"type": str,
"required": True,
"allowed": "^(cmd)$",
"c... | """This file holds the payload yaml validator/definition template."""
validator = {'specification': {'type': dict, 'required': True, 'childs': {'payload': {'type': str, 'required': True, 'allowed': '^(cmd)$', 'childs': {}}, 'type': {'type': str, 'required': True, 'allowed': '^(revshell|bindshell)$', 'childs': {}}, 'ver... |
# Define a python class to execute sequencial action during a SOT execution.
#
# Examples would be:
# attime(1800,lambda: sigset(sot.damping,0.9))
# attime(1920,lambda: sigset(sot.damping,0.1))
# attime(1920,lambda: pop(tw))
# attime(850,lambda: sigset(taskSupportSmall.controlGain,0.01))
# @attime(400)
# def action400(... | class Attimealways:
None
always = attime_always()
class Attimestop:
None
stop = attime_stop()
class Calendar:
def __init__(self):
self.events = dict()
self.ping = list()
def __repr__(self):
res = ''
for (iter, funpairs) in sorted(self.events.iteritems()):
... |
def flatten(lst):
if lst:
car,*cdr=lst
if isinstance(car,(list,tuple)):
if cdr: return flatten(car) + flatten(cdr)
return flatten(car)
if cdr: return [car] + flatten(cdr)
return [car]
| def flatten(lst):
if lst:
(car, *cdr) = lst
if isinstance(car, (list, tuple)):
if cdr:
return flatten(car) + flatten(cdr)
return flatten(car)
if cdr:
return [car] + flatten(cdr)
return [car] |
class Solution:
def threeSum(self, nums: List[int]) -> List[List[int]]:
res = []
nums.sort()
n = len(nums)
for i in range(n-2):
if i > 0 and nums[i] == nums[i-1]:
continue
j, k = i + 1, n - 1
while j < k:
_sum = nums... | class Solution:
def three_sum(self, nums: List[int]) -> List[List[int]]:
res = []
nums.sort()
n = len(nums)
for i in range(n - 2):
if i > 0 and nums[i] == nums[i - 1]:
continue
(j, k) = (i + 1, n - 1)
while j < k:
_... |
def min_rooms_required(intervals):
'''Returns the minimum amount of rooms necessary.
Input consists of a list of time-intervals (start, stop):
>>> min_rooms_required([(10, 20), (15, 25)])
2
>>> min_rooms_required([(10, 20), (20, 30)])
1
'''
# transform intervals
# [(10, 20), (15, 25... | def min_rooms_required(intervals):
"""Returns the minimum amount of rooms necessary.
Input consists of a list of time-intervals (start, stop):
>>> min_rooms_required([(10, 20), (15, 25)])
2
>>> min_rooms_required([(10, 20), (20, 30)])
1
"""
times = []
for interval in intervals:
... |
class Solution:
def removeCoveredIntervals(self, intervals: List[List[int]]) -> int:
intervals.sort(reverse=True,key=lambda x:(x[1],-x[0]))
# print(intervals)
slen = len(intervals)
count = slen
for i in range(slen-1):
# print(intervals[i],intervals[i+1])
... | class Solution:
def remove_covered_intervals(self, intervals: List[List[int]]) -> int:
intervals.sort(reverse=True, key=lambda x: (x[1], -x[0]))
slen = len(intervals)
count = slen
for i in range(slen - 1):
if intervals[i][0] <= intervals[i + 1][0] and intervals[i][1] >= ... |
# 312. Burst Balloons
# Runtime: 8448 ms, faster than 44.62% of Python3 online submissions for Burst Balloons.
# Memory Usage: 19.9 MB, less than 38.33% of Python3 online submissions for Burst Balloons.
class Solution:
def maxCoins(self, nums: list[int]) -> int:
n = len(nums)
# Edge case
... | class Solution:
def max_coins(self, nums: list[int]) -> int:
n = len(nums)
nums = [1] + nums + [1]
scores = [[0 for _ in range(len(nums))] for _ in range(len(nums))]
for i in range(n, -1, -1):
for j in range(i + 1, n + 2):
for k in range(i + 1, j):
... |
## Implementation of a recursive fibonacci series. Extremely inefficient though.
## Author: AJ
class fibonacci:
def __init__(self):
self.number = 0
self.series = []
def fib_series(self, num):
if num <=2:
if 1 not in self.series:
self.series.append(1)
... | class Fibonacci:
def __init__(self):
self.number = 0
self.series = []
def fib_series(self, num):
if num <= 2:
if 1 not in self.series:
self.series.append(1)
return 1
next = self.fib_series(num - 1) + self.fib_series(num - 2)
if ne... |
#inherits , extend , override
class Employee:
def __init__(self , name , age , salary):
self.name = name
self.age = age
self.salary = salary
def work(self):
print( f"{self.name} is working..." )
class SoftwareEngineer(Employee):
def __init__(self , name , age , salary , le... | class Employee:
def __init__(self, name, age, salary):
self.name = name
self.age = age
self.salary = salary
def work(self):
print(f'{self.name} is working...')
class Softwareengineer(Employee):
def __init__(self, name, age, salary, level):
super(SoftwareEngineer, ... |
MODULE_CONTEXT = {'metadata':{'module':'ANUVAAD-NMT-MODELS'}}
def init():
global app_context
app_context = {
'application_context' : None
} | module_context = {'metadata': {'module': 'ANUVAAD-NMT-MODELS'}}
def init():
global app_context
app_context = {'application_context': None} |
class TestStackiBoxInfo:
def test_no_name(self, run_ansible_module):
result = run_ansible_module("stacki_box_info")
assert result.status == "SUCCESS"
assert result.data["changed"] == False
assert len(result.data["boxes"]) == 2
def test_with_name(self, run_ansible_module):
result = run_ansible_module("sta... | class Teststackiboxinfo:
def test_no_name(self, run_ansible_module):
result = run_ansible_module('stacki_box_info')
assert result.status == 'SUCCESS'
assert result.data['changed'] == False
assert len(result.data['boxes']) == 2
def test_with_name(self, run_ansible_module):
... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Indian - Purchase Report(GST)',
'version': '1.0',
'description': """GST Purchase Report""",
'category': 'Accounting',
'depends': [
'l10n_in',
'purchase',
],
'data': ... | {'name': 'Indian - Purchase Report(GST)', 'version': '1.0', 'description': 'GST Purchase Report', 'category': 'Accounting', 'depends': ['l10n_in', 'purchase'], 'data': ['views/report_purchase_order.xml'], 'installable': True, 'application': False, 'auto_install': True} |
# Dictionaries
# https://www.freecodecamp.org/learn/scientific-computing-with-python/python-for-everybody/python-dictionaries
# A collection of values each with their own key identifiers - like a java hashmap
ddd = dict()
ddd['age'] = 21
ddd['course'] = 182
print(ddd)
ddd['age'] = 27
print(ddd)
# Literals
jjj = {'nam... | ddd = dict()
ddd['age'] = 21
ddd['course'] = 182
print(ddd)
ddd['age'] = 27
print(ddd)
jjj = {'name': 'bob', 'age': 21}
print(jjj)
ccc = dict()
ccc['count1'] = 1
ccc['count2'] = 1
print(ccc)
ccc['count1'] = ccc['count1'] + 1
print(ccc)
counts = dict()
names = ['bob', 'bob6', 'bob4', 'bob2', 'bob', 'bob6']
for name in n... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# this is a windows documentation stub, actual code lives in the .ps1
# file of the same name
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | ansible_metadata = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'}
documentation = "\n---\nmodule: win_wait_for_process\nversion_added: '2.7'\nshort_description: Waits for a process to exist or not exist before continuing.\ndescription:\n- Waiting for a process to start or stop.\n- This ... |
file = 'fer2018surprise.csv'
file_path = '../data/original/'+file
new_file_path = '../data/converted/'+file
num = 0
with open(file_path, 'r') as fp:
with open(new_file_path, 'w') as fp2:
num = num + 1
line = fp.readline()
while line:
lineWithCommas = line.replace(' ', ',')
... | file = 'fer2018surprise.csv'
file_path = '../data/original/' + file
new_file_path = '../data/converted/' + file
num = 0
with open(file_path, 'r') as fp:
with open(new_file_path, 'w') as fp2:
num = num + 1
line = fp.readline()
while line:
line_with_commas = line.replace(' ', ',')
... |
__author__ = 'BeyondSky'
class Solution:
def climbStairs_dp(self, n):
if n < 2:
return 1
steps = []
steps.append(1)
steps.append(2)
for i in range(2,n):
steps.append(steps[i-1] + steps[i-2])
return steps[n-1]
def main():
outer = Soluti... | __author__ = 'BeyondSky'
class Solution:
def climb_stairs_dp(self, n):
if n < 2:
return 1
steps = []
steps.append(1)
steps.append(2)
for i in range(2, n):
steps.append(steps[i - 1] + steps[i - 2])
return steps[n - 1]
def main():
outer = ... |
# Maximum Erasure Value
'''
You are given an array of positive integers nums and want to erase a subarray containing unique elements. The score you get by erasing the subarray is equal to the sum of its elements.
Return the maximum score you can get by erasing exactly one subarray.
An array b is called to be a suba... | """
You are given an array of positive integers nums and want to erase a subarray containing unique elements. The score you get by erasing the subarray is equal to the sum of its elements.
Return the maximum score you can get by erasing exactly one subarray.
An array b is called to be a subarray of a if it forms a c... |
# class Queue(object):
# def __init__(self):
# """
# initialize your data structure here.
# """
# self.stack1 = []
# self.stack2 = []
#
#
# def push(self, x):
# """
# :type x: int
# :rtype: nothing
# """
# while len(self.stack1) > 0... | class Queue(object):
def __init__(self):
"""
initialize your data structure here.
"""
self.main_stack = []
self.temp_stack = []
def push(self, x):
"""
:type x: int
:rtype: nothing
"""
self.main_stack.append(x)
def pop(self):
... |
# --------------------------------------------------------------
class ModelSimilarity:
'''
Uses a model (e.g. Word2Vec model) to calculate the similarity between two terms.
'''
def __init__( self, model ):
self.model = model
def similarity( self, ranking_i, ranking_j ):
sim = 0.0
pairs = 0
for term_i ... | class Modelsimilarity:
"""
Uses a model (e.g. Word2Vec model) to calculate the similarity between two terms.
"""
def __init__(self, model):
self.model = model
def similarity(self, ranking_i, ranking_j):
sim = 0.0
pairs = 0
for term_i in ranking_i:
for term_j ... |
xs1 = ys[42:
5:
-1]
xs2 = ys[:
2:
3]
xs3 = ys[::
3]
| xs1 = ys[42:5:-1]
xs2 = ys[:2:3]
xs3 = ys[::3] |
class Stack:
topNode = None
class Node:
def __init__(self, value):
self.value = value
self.nextNode = None
def __repr__(self):
return "[{}]".format(self.value)
def __init__(self, iterable):
if len(iterable) != 0:
for k... | class Stack:
top_node = None
class Node:
def __init__(self, value):
self.value = value
self.nextNode = None
def __repr__(self):
return '[{}]'.format(self.value)
def __init__(self, iterable):
if len(iterable) != 0:
for k in iterable:... |
# Multicollinearity solution using VIF 26/6/19
def calculate_vif_(X, thresh=5.0):
"""
Linear variational inflation factor for multi-colinearity solutions
Removes colinear features with messages
X is patients by features DataFrame
Good idea to inspect the VIFs for all data and consider threshold c... | def calculate_vif_(X, thresh=5.0):
"""
Linear variational inflation factor for multi-colinearity solutions
Removes colinear features with messages
X is patients by features DataFrame
Good idea to inspect the VIFs for all data and consider threshold changes?
Returns remaining X without the omit... |
'''
'''
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License");... | """
"""
Test.Summary = 'Testing ATS active timeout'
Test.SkipUnless(Condition.HasCurlFeature('http2'))
ts = Test.MakeATSProcess('ts', select_ports=True, enable_tls=True)
server = Test.MakeOriginServer('server', delay=8)
request_header = {'headers': 'GET /file HTTP/1.1\r\nHost: *\r\n\r\n', 'timestamp': '5678', 'body': '... |
class take_skip:
def __init__(self, step, count):
self.step = step
self.count = count
self.start = 0
self.end = step * count
def __iter__(self):
return self
def __next__(self):
index = self.start
if index >= self.end:
raise StopIteration
... | class Take_Skip:
def __init__(self, step, count):
self.step = step
self.count = count
self.start = 0
self.end = step * count
def __iter__(self):
return self
def __next__(self):
index = self.start
if index >= self.end:
raise StopIteration... |
class Solution:
def longestCommonPrefix(self, strs: List[str]) -> str:
if len(strs) == 0:
return ''
def getCommonPrefix(s1, s2):
result = []
for i in range(min(len(s1), len(s2))):
if s1[i] == s2[i]:
result.append(s1[i])
... | class Solution:
def longest_common_prefix(self, strs: List[str]) -> str:
if len(strs) == 0:
return ''
def get_common_prefix(s1, s2):
result = []
for i in range(min(len(s1), len(s2))):
if s1[i] == s2[i]:
result.append(s1[i])
... |
n = int(input())
a = list(map(int, input().split()))
xor = a[0]
for x in a[1:]:
xor ^= x
ans = print(*[xor ^ x for x in a]) | n = int(input())
a = list(map(int, input().split()))
xor = a[0]
for x in a[1:]:
xor ^= x
ans = print(*[xor ^ x for x in a]) |
class DictTrafo(object):
def __init__(self, trafo_dict=None, prefix=None):
if trafo_dict is None:
trafo_dict = {}
self.trafo_dict = trafo_dict
if type(prefix) is str:
self.prefix = (prefix,)
elif type(prefix) is tuple:
self.prefix = prefix
... | class Dicttrafo(object):
def __init__(self, trafo_dict=None, prefix=None):
if trafo_dict is None:
trafo_dict = {}
self.trafo_dict = trafo_dict
if type(prefix) is str:
self.prefix = (prefix,)
elif type(prefix) is tuple:
self.prefix = prefix
... |
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Python port of legacy_unit_info.html. This is a mapping of various units
# reported by gtest perf tests to histogram units, including improvement
# directi... | improvement_direction_dont_care = ''
improvement_direction_smaller_is_better = '_smallerIsBetter'
improvement_direction_bigger_is_better = '_biggerIsBetter'
class Legacyunit(object):
"""Simple object for storing data to improve readability."""
def __init__(self, name, improvement_direction, conversion_factor=... |
"""
This module demonstrates OVERLOADING the + symbol:
-- With numbers as operands, it means addition (as in arithmetic)
-- With sequences as operands, it means concatenation, that is,
forming a new sequence that stitches together its operands.
This module also demonstrates the STR function.
Authors... | """
This module demonstrates OVERLOADING the + symbol:
-- With numbers as operands, it means addition (as in arithmetic)
-- With sequences as operands, it means concatenation, that is,
forming a new sequence that stitches together its operands.
This module also demonstrates the STR function.
Authors... |
filename = 'full_text_small.txt'
def file_write(filename):
with open(filename, 'r') as f:
n = 0
for line in f:
n += 1
if n <= 5:
print(line)
return(line)
file_write(filename)
| filename = 'full_text_small.txt'
def file_write(filename):
with open(filename, 'r') as f:
n = 0
for line in f:
n += 1
if n <= 5:
print(line)
return line
file_write(filename) |
a = 1
b = 0
c = a & b
d = a | b
e = a ^ b
print(c+d+e)
my_list = [[1,2,3,4] for i in range(2)]
print(my_list[1][0])
x =2
x = x==x
print(x)
my_list = [1,2,3]
for v in range(len(my_list)):
my_list.insert(1, my_list[v])
print(my_list) | a = 1
b = 0
c = a & b
d = a | b
e = a ^ b
print(c + d + e)
my_list = [[1, 2, 3, 4] for i in range(2)]
print(my_list[1][0])
x = 2
x = x == x
print(x)
my_list = [1, 2, 3]
for v in range(len(my_list)):
my_list.insert(1, my_list[v])
print(my_list) |
n = int(input())
ans = 0
for i in range(n):
l, c = map(int, input().split())
if l > c:
ans += c
else:
continue
print(ans) | n = int(input())
ans = 0
for i in range(n):
(l, c) = map(int, input().split())
if l > c:
ans += c
else:
continue
print(ans) |
_base_ = [
'../_base_/models/faster_rcnn_r50_fpn_moco.py',
'../_base_/datasets/vocdataset_voc0712.py',
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
]
optimizer = dict(type='SGD', lr=0.02/16, momentum=0.9, weight_decay=0.0001) | _base_ = ['../_base_/models/faster_rcnn_r50_fpn_moco.py', '../_base_/datasets/vocdataset_voc0712.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py']
optimizer = dict(type='SGD', lr=0.02 / 16, momentum=0.9, weight_decay=0.0001) |
_base_ = ['./mswin_par_small_patch4_512x512_160k_ade20k_pretrain_224x224_1K.py']
model = dict(
decode_head=dict(
mode='seq',
))
data = dict(samples_per_gpu=10)
| _base_ = ['./mswin_par_small_patch4_512x512_160k_ade20k_pretrain_224x224_1K.py']
model = dict(decode_head=dict(mode='seq'))
data = dict(samples_per_gpu=10) |
def merge_sort(arr):
n = len(arr)
if (n >= 2):
A = merge_sort(arr[:int(n/2)])
B = merge_sort(arr[int(n/2):])
i = 0
j = 0
for k in range(0, n):
if i < int(n/2) and (j == len(B) or A[i] <= B[j]):
arr[k] = A[i]
i = i + 1
... | def merge_sort(arr):
n = len(arr)
if n >= 2:
a = merge_sort(arr[:int(n / 2)])
b = merge_sort(arr[int(n / 2):])
i = 0
j = 0
for k in range(0, n):
if i < int(n / 2) and (j == len(B) or A[i] <= B[j]):
arr[k] = A[i]
i = i + 1
... |
# --------------
# Code starts here
class_1 = ['Geoffrey Hinton','Andrew Ng','Sebastian Raschka','Yoshua Bengio']
class_2 = ['Hilary Mason','Carla Gentry','Corinna Cortes']
new_class = class_1 + class_2
print(new_class)
new_class.append('Peter Warden')
print(new_class)
new_class.remove('Carla Gentry')
print(new_class)
... | class_1 = ['Geoffrey Hinton', 'Andrew Ng', 'Sebastian Raschka', 'Yoshua Bengio']
class_2 = ['Hilary Mason', 'Carla Gentry', 'Corinna Cortes']
new_class = class_1 + class_2
print(new_class)
new_class.append('Peter Warden')
print(new_class)
new_class.remove('Carla Gentry')
print(new_class)
courses = {'Math': 65, 'English... |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( x , y , z ) :
if ( not ( y / x ) ) :
return y if ( not ( y / z ) ) else z
return x if ( not ( x / z... | def f_gold(x, y, z):
if not y / x:
return y if not y / z else z
return x if not x / z else z
if __name__ == '__main__':
param = [(48, 63, 56), (11, 55, 84), (50, 89, 96), (21, 71, 74), (94, 39, 42), (22, 44, 86), (3, 41, 68), (67, 62, 94), (59, 2, 83), (50, 11, 1)]
n_success = 0
for (i, para... |
config = {
'lr': (1.5395901937079718e-05, 4.252664987376195e-05, 9.011700881717918e-05, 0.00026653695086486183),
'target_stepsize': 0.07688144983085089,
'feedback_wd': 5.751527315358352e-07,
'beta1': 0.9,
'beta2': 0.999,
'epsilon': (7.952762675272583e-06, 3.573159556208438e-06, 1.0425400798717413e-08, 2.023264400953111... | config = {'lr': (1.5395901937079718e-05, 4.252664987376195e-05, 9.011700881717918e-05, 0.00026653695086486183), 'target_stepsize': 0.07688144983085089, 'feedback_wd': 5.751527315358352e-07, 'beta1': 0.9, 'beta2': 0.999, 'epsilon': (7.952762675272583e-06, 3.573159556208438e-06, 1.0425400798717413e-08, 2.0232644009531115... |
# constants related to the matchers
# all the types of matches
MATCH_TYPE_NONE = 0
MATCH_TYPE_RESET = 1
MATCH_TYPE_NMI = 2
MATCH_TYPE_WAIT_START = 3
MATCH_TYPE_WAIT_END = 4
MATCH_TYPE_BITS = 6 # number of bits required to represent the above (max 8)
NUM_MATCHERS = 32 # how many match engines are there?
MATCHER_BITS ... | match_type_none = 0
match_type_reset = 1
match_type_nmi = 2
match_type_wait_start = 3
match_type_wait_end = 4
match_type_bits = 6
num_matchers = 32
matcher_bits = 5 |
def get_initial(name, force_uppercase=True):
if force_uppercase:
initial = name[0:1].upper()
else:
initial = name[0:1].lower()
return initial
first_name = input('Enter your first name: ')
# initial = get_initial(first_name)
initial = get_initial(force_uppercase=False, name=first_name)
prin... | def get_initial(name, force_uppercase=True):
if force_uppercase:
initial = name[0:1].upper()
else:
initial = name[0:1].lower()
return initial
first_name = input('Enter your first name: ')
initial = get_initial(force_uppercase=False, name=first_name)
print('Your initial is: ' + initial) |
INPUT_PATH = "./input.txt"
input_file = open(INPUT_PATH, "r")
lines = input_file.readlines()
input_file.close()
divided_input = [[[set(x) for x in x.split()] for x in line.split(" | ")] for line in lines]
# Part 1
print("Part 1: ", sum([len([x for x in entry[1] if len(x) in [2, 3, 4, 7]]) for entry in divided_input... | input_path = './input.txt'
input_file = open(INPUT_PATH, 'r')
lines = input_file.readlines()
input_file.close()
divided_input = [[[set(x) for x in x.split()] for x in line.split(' | ')] for line in lines]
print('Part 1: ', sum([len([x for x in entry[1] if len(x) in [2, 3, 4, 7]]) for entry in divided_input]))
total_sum... |
#Python Lists
mylist = [ "banana", "abacate", "manga"]
print(mylist) | mylist = ['banana', 'abacate', 'manga']
print(mylist) |
# working on final project to combine all the learnt concepts into 1
# problem statement.
#The CTO wants to monitor all the computer usage by all engineers. Using Python ,
# write an automation script that will produce a report when each user logged in and out,
# and how long each user used the computers.
# writing ... | def get_event_date(event):
return event.date
def get_event_date(event):
return event.date
def get_event_date(event):
return event.date
def current_users(events):
events.sort(key=get_event_date)
machines = {}
for event in events:
if event.machine not in machines:
machines[e... |
class RockartExamplesException(Exception):
pass
class RockartExamplesIndexError(RockartExamplesException, IndexError):
pass
class RockartExamplesValueError(RockartExamplesException, ValueError):
pass
| class Rockartexamplesexception(Exception):
pass
class Rockartexamplesindexerror(RockartExamplesException, IndexError):
pass
class Rockartexamplesvalueerror(RockartExamplesException, ValueError):
pass |
print("Kinjal Raykarmakar\nSec: CSE2H\tRoll: 29\n")
row = int(input("Enter the number of rows: "))
for i in range(1, row+1):
for j in range(i):
print("*", end=" ")
print()
for i in range(row+1, 0, -1):
for j in range(i):
print("*", end=" ")
print() | print('Kinjal Raykarmakar\nSec: CSE2H\tRoll: 29\n')
row = int(input('Enter the number of rows: '))
for i in range(1, row + 1):
for j in range(i):
print('*', end=' ')
print()
for i in range(row + 1, 0, -1):
for j in range(i):
print('*', end=' ')
print() |
#!/usr/bin/env python3
for hour_offset in range(0, 24, 6):
train = open('data/train_b{:02}.csv'.format(hour_offset), 'w', newline='')
test = open('data/test_b{:02}.csv'.format(hour_offset), 'w', newline='')
data = open('data/data.txt')
t = int(next(data))
n, m = tuple(map(int, next(data).split()))... | for hour_offset in range(0, 24, 6):
train = open('data/train_b{:02}.csv'.format(hour_offset), 'w', newline='')
test = open('data/test_b{:02}.csv'.format(hour_offset), 'w', newline='')
data = open('data/data.txt')
t = int(next(data))
(n, m) = tuple(map(int, next(data).split()))
for (line_num, lin... |
p = [1,2,3,4,5,6,7,8,9]
del p[1:3]
print(p[:])
p.remove(8)
print(p[:])
print(p.pop())
p.clear()
print(p[:])
l=[1,3,4,5,6,7]
l.remove(3)
print(l[:])
l.sort()
print(l[:])
l.reverse()
print(l[:])
l.clear()
print(l[:])
| p = [1, 2, 3, 4, 5, 6, 7, 8, 9]
del p[1:3]
print(p[:])
p.remove(8)
print(p[:])
print(p.pop())
p.clear()
print(p[:])
l = [1, 3, 4, 5, 6, 7]
l.remove(3)
print(l[:])
l.sort()
print(l[:])
l.reverse()
print(l[:])
l.clear()
print(l[:]) |
# Copyright 2017 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... | """Skylark rules for Swift."""
load('@bazel_skylib//lib:collections.bzl', 'collections')
load('@build_bazel_rules_apple//apple/bundling:apple_bundling_aspect.bzl', 'apple_bundling_aspect')
load('@build_bazel_rules_apple//apple:providers.bzl', 'AppleResourceInfo', 'AppleResourceSet', 'SwiftInfo')
load('@build_bazel_rule... |
# -*- coding: utf-8 -*-
CSRF_ENABLED = True
SECRET_KEY = "208h3oiushefo9823liukhso8dyfhsdklihf"
debug = False
| csrf_enabled = True
secret_key = '208h3oiushefo9823liukhso8dyfhsdklihf'
debug = False |
def getLate():
v = Late(**{})
return v
class Late():
value = 'late'
| def get_late():
v = late(**{})
return v
class Late:
value = 'late' |
formatter = "{} {} {} {}"
print(formatter.format(1, 2, 3, 4))
print(formatter.format("one", "two", "three", "four"))
print(formatter.format(True, False, False, True))
print(formatter.format(formatter, formatter, formatter, formatter))
print(formatter.format(
"I had this thing.",
"That you could type up right."... | formatter = '{} {} {} {}'
print(formatter.format(1, 2, 3, 4))
print(formatter.format('one', 'two', 'three', 'four'))
print(formatter.format(True, False, False, True))
print(formatter.format(formatter, formatter, formatter, formatter))
print(formatter.format('I had this thing.', 'That you could type up right.', "But it ... |
# Copyright 2014 PDFium authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Original code from V8, original license was:
# Copyright 2014 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style ... | {'targets': [{'target_name': 'gtest', 'toolsets': ['host', 'target'], 'type': 'static_library', 'sources': ['gtest/include/gtest/gtest-death-test.h', 'gtest/include/gtest/gtest-message.h', 'gtest/include/gtest/gtest-param-test.h', 'gtest/include/gtest/gtest-printers.h', 'gtest/include/gtest/gtest-spi.h', 'gtest/include... |
activate_mse = 1
activate_adaptation_imp = 1
activate_adaptation_d1 = 1
weight_d2 = 1.0
weight_mse = 1.0
refinement = 1
n_epochs_refinement = 10
lambda_regul = [0.01]
lambda_regul_s = [0.01]
threshold_value = [0.95]
compute_variance = False
random_seed = [1985] if not compute_variance else [1985, 2184, 51, 12, 465]
... | activate_mse = 1
activate_adaptation_imp = 1
activate_adaptation_d1 = 1
weight_d2 = 1.0
weight_mse = 1.0
refinement = 1
n_epochs_refinement = 10
lambda_regul = [0.01]
lambda_regul_s = [0.01]
threshold_value = [0.95]
compute_variance = False
random_seed = [1985] if not compute_variance else [1985, 2184, 51, 12, 465]
cl... |
# encoding: utf-8
# module cv2.xphoto
# from /home/davtoh/anaconda3/envs/rrtools/lib/python3.5/site-packages/cv2.cpython-35m-x86_64-linux-gnu.so
# by generator 1.144
# no doc
# no imports
# Variables with simple values
BM3D_STEP1 = 1
BM3D_STEP2 = 2
BM3D_STEPALL = 0
HAAR = 0
INPAINT_SHIFTMAP = 0
__loader__ = None
... | bm3_d_step1 = 1
bm3_d_step2 = 2
bm3_d_stepall = 0
haar = 0
inpaint_shiftmap = 0
__loader__ = None
__spec__ = None
def apply_channel_gains(src, gainB, gainG, gainR, dst=None):
""" applyChannelGains(src, gainB, gainG, gainR[, dst]) -> dst """
pass
def bm3d_denoising(src, dstStep1, dstStep2=None, h=None, templat... |
# flopy version file automatically created using...pre-commit.py
# created on...March 20, 2018 17:03:11
major = 3
minor = 2
micro = 9
build = 60
commit = 2731
__version__ = '{:d}.{:d}.{:d}'.format(major, minor, micro)
__build__ = '{:d}.{:d}.{:d}.{:d}'.format(major, minor, micro, build)
__git_commit__ = '{:d}'.format(... | major = 3
minor = 2
micro = 9
build = 60
commit = 2731
__version__ = '{:d}.{:d}.{:d}'.format(major, minor, micro)
__build__ = '{:d}.{:d}.{:d}.{:d}'.format(major, minor, micro, build)
__git_commit__ = '{:d}'.format(commit) |
#!/usr/bin/env python3
def main():
with open("dnsservers.txt", "r") as dnsfile:
for svr in dnsfile:
svr = svr.rstrip('\n') # remove newline char if exists
# would exists on all but last line
# IF the string svr ends with 'org'
if svr.endswith('org'):
... | def main():
with open('dnsservers.txt', 'r') as dnsfile:
for svr in dnsfile:
svr = svr.rstrip('\n')
if svr.endswith('org'):
with open('org-domain.txt', 'a') as srvfile:
srvfile.write(svr + '\n')
elif svr.endswith('com'):
... |
a, b = map(int, input('').split(' '))
n = int(input(''))
ans = 0
for i in range(n):
shop = [int(i) for i in input('').split(' ') if abs(int(i)) == a or b]
if shop.count(a) > shop.count(-a) and shop.count(b) > shop.count(-b):
ans += 1
print(ans) | (a, b) = map(int, input('').split(' '))
n = int(input(''))
ans = 0
for i in range(n):
shop = [int(i) for i in input('').split(' ') if abs(int(i)) == a or b]
if shop.count(a) > shop.count(-a) and shop.count(b) > shop.count(-b):
ans += 1
print(ans) |
# Break Statement :
greetings = ["Hello","World","!!!"]
for x in greetings:
print(x)
if (x == "World"):
break #Breaks the loop when condition matches
print()
for x in range (0,22,2):
if (x == 10):
continue #Skips the current iteration when condition matches
print(x)... | greetings = ['Hello', 'World', '!!!']
for x in greetings:
print(x)
if x == 'World':
break
print()
for x in range(0, 22, 2):
if x == 10:
continue
print(x)
input('Press Enter key to exit ') |
HOST = '127.0.0.1'
USERNAME = 'guest'
PASSWORD = 'guest'
URI = 'amqp://guest:guest@127.0.0.1:5672/%2F'
HTTP_URL = 'http://127.0.0.1:15672'
| host = '127.0.0.1'
username = 'guest'
password = 'guest'
uri = 'amqp://guest:guest@127.0.0.1:5672/%2F'
http_url = 'http://127.0.0.1:15672' |
load("@bazel_skylib//lib:paths.bzl", "paths")
def _add_data_impl(ctx):
(_, extension) = paths.split_extension(ctx.executable.executable.path)
executable = ctx.actions.declare_file(
ctx.label.name + extension,
)
ctx.actions.symlink(
output = executable,
target_file = ctx.executab... | load('@bazel_skylib//lib:paths.bzl', 'paths')
def _add_data_impl(ctx):
(_, extension) = paths.split_extension(ctx.executable.executable.path)
executable = ctx.actions.declare_file(ctx.label.name + extension)
ctx.actions.symlink(output=executable, target_file=ctx.executable.executable, is_executable=True)
... |
""" """
def words_to_snake_case(s):
components = s.split(' ')
return '_'.join(x.lower() for x in components)
| """ """
def words_to_snake_case(s):
components = s.split(' ')
return '_'.join((x.lower() for x in components)) |
#What will this script produce?
#A: 3
a = 1
a = 2
a = 3
print(a)
| a = 1
a = 2
a = 3
print(a) |
#addintersert3.py
def addInterest(balances, rate):
for i in range(len(balances)):
balances[i] = balances[i] * (1 + rate)
def main():
amounts = [1000, 105, 3500, 739]
rate = 0.05
addInterest(amounts, rate)
print(amounts)
main() | def add_interest(balances, rate):
for i in range(len(balances)):
balances[i] = balances[i] * (1 + rate)
def main():
amounts = [1000, 105, 3500, 739]
rate = 0.05
add_interest(amounts, rate)
print(amounts)
main() |
# INTERNAL_ONLY_PROPERTIES defines the properties in the config that, while settable, should
# not be documented for external users. These will generally be used for internal test or only
# given to customers when they have been briefed on the side effects of using them.
INTERNAL_ONLY_PROPERTIES = {
"__module__",
... | internal_only_properties = {'__module__', '__doc__', 'create_transaction', 'SESSION_COOKIE_NAME', 'SESSION_COOKIE_HTTPONLY', 'SESSION_COOKIE_SAMESITE', 'DATABASE_SECRET_KEY', 'V22_NAMESPACE_BLACKLIST', 'MAXIMUM_CNR_LAYER_SIZE', 'OCI_NAMESPACE_WHITELIST', 'FEATURE_GENERAL_OCI_SUPPORT', 'FEATURE_HELM_OCI_SUPPORT', 'FEATU... |
# example file for submodule imports
def divide_me_by_2(x):
return x/2
| def divide_me_by_2(x):
return x / 2 |
class Solution:
def connect(self, root):
nodes = [[root], []]
x = 0
while (nodes[0] and nodes[0][0]) or (nodes[1] and nodes[1][0]):
for i in range(len(nodes[x])):
nodes[x][i].next = None if i == len(nodes[x]) - 1 else nodes[x][i+1]
nodes[(1 + x) % ... | class Solution:
def connect(self, root):
nodes = [[root], []]
x = 0
while nodes[0] and nodes[0][0] or (nodes[1] and nodes[1][0]):
for i in range(len(nodes[x])):
nodes[x][i].next = None if i == len(nodes[x]) - 1 else nodes[x][i + 1]
nodes[(1 + x) %... |
CELERY_TIMEZONE = 'Europe/Rome'
# The backend used to store task results
CELERY_RESULT_BACKEND = 'rpc://'
# If set to True, result messages will be persistent. This means the messages will not be lost after a broker restart
CELERY_RESULT_PERSISTENT = True
CELERY_ACCEPT_CONTENT=['json', 'pickle']
CELERY_TASK_SERIALI... | celery_timezone = 'Europe/Rome'
celery_result_backend = 'rpc://'
celery_result_persistent = True
celery_accept_content = ['json', 'pickle']
celery_task_serializer = 'json'
celery_result_serializer = 'json'
broker_url = 'amqp://guest:guest@localhost:5672//'
broker_heartbeat = 10.0
broker_heartbeat_checkrate = 2.0
celery... |
def checkIfMessagerIsBooster(self, user):
"""
Function would be called by Robot class
:param self: instance from Robot
:param user: instance from Discord.User
:return: True if user is a booster
"""
for role in user.roles:
if role == self.boostedRole:
return True
retu... | def check_if_messager_is_booster(self, user):
"""
Function would be called by Robot class
:param self: instance from Robot
:param user: instance from Discord.User
:return: True if user is a booster
"""
for role in user.roles:
if role == self.boostedRole:
return True
r... |
class InputBroker:
"""Abstract class responsible for providing raw values when considering scores"""
def get_input_value(self, consideration, context):
raise NotImplementedError()
| class Inputbroker:
"""Abstract class responsible for providing raw values when considering scores"""
def get_input_value(self, consideration, context):
raise not_implemented_error() |
# colorcodingfor rows(...)
def colornumber(color):
if color == 'd':
return 0
elif color == 'e':
return 1
elif color == 'f':
return 2
elif color == 'g':
return 3
elif color == 'h':
return 4
elif color == 'i':
return 5
elif color ==... | def colornumber(color):
if color == 'd':
return 0
elif color == 'e':
return 1
elif color == 'f':
return 2
elif color == 'g':
return 3
elif color == 'h':
return 4
elif color == 'i':
return 5
elif color == 'j':
return 6
elif color == ... |
class Solution:
def isIdealPermutation(self, A):
"""
:type A: List[int]
:rtype: bool
"""
size, m = len(A), 0
for i in range(size - 2):
m = max(m, A[i])
if m > A[i + 2]:
return False
return True
| class Solution:
def is_ideal_permutation(self, A):
"""
:type A: List[int]
:rtype: bool
"""
(size, m) = (len(A), 0)
for i in range(size - 2):
m = max(m, A[i])
if m > A[i + 2]:
return False
return True |
[
{
'date': '2018-01-01',
'description': "New Year's Day",
'locale': 'en-US',
'notes': '',
'region': '',
'type': 'NF'
},
{
'date': '2018-01-15',
'description': 'Birthday of Martin Luther King, Jr.',
'locale': 'en-US',
'notes': '... | [{'date': '2018-01-01', 'description': "New Year's Day", 'locale': 'en-US', 'notes': '', 'region': '', 'type': 'NF'}, {'date': '2018-01-15', 'description': 'Birthday of Martin Luther King, Jr.', 'locale': 'en-US', 'notes': '', 'region': '', 'type': 'NV'}, {'date': '2018-02-19', 'description': "Washington's Birthday", '... |
# A function to get the desired metrics while working with multiple model training procedures
def print_classification_metrics(y_train, train_pred, y_test, test_pred, return_performance=True):
dict_performance = {'Training Accuracy: ': accuracy_score(y_train, train_pred),
'Training f1-score:... | def print_classification_metrics(y_train, train_pred, y_test, test_pred, return_performance=True):
dict_performance = {'Training Accuracy: ': accuracy_score(y_train, train_pred), 'Training f1-score: ': f1_score(y_train, train_pred), 'Accuracy: ': accuracy_score(y_test, test_pred), 'Precision: ': precision_score(y_t... |
#!/usr/bin/env python
def part_one(values: list[int]) -> int:
count = sum(values[index] < values[index + 1] for index in range(len(values) - 1))
return count
def part_two(values: list[int]) -> int:
summed_list = list(sum(three) for three in zip(values, values[1:], values[2:]))
count = sum(summed_list... | def part_one(values: list[int]) -> int:
count = sum((values[index] < values[index + 1] for index in range(len(values) - 1)))
return count
def part_two(values: list[int]) -> int:
summed_list = list((sum(three) for three in zip(values, values[1:], values[2:])))
count = sum((summed_list[index] < summed_li... |
"""Top-level package for Client 1C for Time Sheet."""
__author__ = """Nick K Sabinin"""
__email__ = 'sabnk@optictelecom.ru'
__version__ = '0.1.0'
| """Top-level package for Client 1C for Time Sheet."""
__author__ = 'Nick K Sabinin'
__email__ = 'sabnk@optictelecom.ru'
__version__ = '0.1.0' |
# Usage: gunicorn ProductCatalog.wsgi --bind 0.0.0.0:$PORT --config deploy/gunicorn.conf.py
# Max number of pending connections.
backlog = 1024
# Number of workers spawned for request handling.
workers = 1
# Standard type of workers.
worker_class = 'sync'
# Kill worker if it does not notify the master process in this ... | backlog = 1024
workers = 1
worker_class = 'sync'
timeout = 30
logfile = '/var/log/productcatalog-gunicorn.log'
loglevel = 'info' |
# NOTE: This objects are used directly in the external-notification-data and vulnerability-service
# on the frontend, so be careful with changing their existing keys.
PRIORITY_LEVELS = {
"Unknown": {
"title": "Unknown",
"value": "Unknown",
"index": 5,
"level": "info",
"color"... | priority_levels = {'Unknown': {'title': 'Unknown', 'value': 'Unknown', 'index': 5, 'level': 'info', 'color': '#9B9B9B', 'score': 0, 'description': 'Unknown is either a security problem that has not been assigned to a priority' + ' yet or a priority that our system did not recognize', 'banner_required': False}, 'Negligi... |
# Definition for a binary tree node.
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def sumEvenGrandparent(self, root):
"""
:type root: TreeNode
:rtype: int
"""
res = [0]
... | class Treenode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def sum_even_grandparent(self, root):
"""
:type root: TreeNode
:rtype: int
"""
res = [0]
self.traverse(root, None, Non... |
class solution:
def findNumbers(self, nums=[]):
even = 0
for num in nums:
numString = str(num)
if len(numString) % 2 == 0:
even += 1
return even
if __name__ == "__main__":
sol = solution()
_ = [int(n) for n in input().split()]
print(sol.fin... | class Solution:
def find_numbers(self, nums=[]):
even = 0
for num in nums:
num_string = str(num)
if len(numString) % 2 == 0:
even += 1
return even
if __name__ == '__main__':
sol = solution()
_ = [int(n) for n in input().split()]
print(sol.... |
pressure_arr = [80, 90, 100, 150, 120, 110, 160, 110, 100]
sum = 0
for pressure in pressure_arr:
sum = pressure + sum
length = len(pressure_arr)
mean = sum / length
print("The mean is", mean)
| pressure_arr = [80, 90, 100, 150, 120, 110, 160, 110, 100]
sum = 0
for pressure in pressure_arr:
sum = pressure + sum
length = len(pressure_arr)
mean = sum / length
print('The mean is', mean) |
n = int(input())
families = map(int, input().split())
families = sorted(families)
for i in range(len(families)):
if(i!=len(families)-1):
if(families[i]!=families[i - 1] and families[i]!=families[i + 1]):
print(families[i])
break
else:
print(families[i])
| n = int(input())
families = map(int, input().split())
families = sorted(families)
for i in range(len(families)):
if i != len(families) - 1:
if families[i] != families[i - 1] and families[i] != families[i + 1]:
print(families[i])
break
else:
print(families[i]) |
class Solution:
def expand(self, S: str) -> List[str]:
return sorted(self.dfs(S, ['']))
def dfs(self, s, prev):
if not s:
return prev
n = len(s)
cur = ''
found = False
result = []
for i in range(n):
if s[i].is... | class Solution:
def expand(self, S: str) -> List[str]:
return sorted(self.dfs(S, ['']))
def dfs(self, s, prev):
if not s:
return prev
n = len(s)
cur = ''
found = False
result = []
for i in range(n):
if s[i].isalpha():
... |
def translate(data, char, replacement):
result = data.replace(char, replacement)
print(result)
return result
def includes(data, string):
if string in data:
return True
return False
def start(data, string):
counter = 0
is_it = False
for char in string:
if char == data[cou... | def translate(data, char, replacement):
result = data.replace(char, replacement)
print(result)
return result
def includes(data, string):
if string in data:
return True
return False
def start(data, string):
counter = 0
is_it = False
for char in string:
if char == data[co... |
L = 25
with open('input') as f:
nums = list(map(int, f.read().split()))
# Part 1
for i in range(L, len(nums)):
pre = nums[i - L:i]
n = nums[i]
d = {}
for p in pre:
if p in d and p != d[p]:
break
d[n - p] = p
else:
print(n)
break
# Part 2
i = 0
j = 2... | l = 25
with open('input') as f:
nums = list(map(int, f.read().split()))
for i in range(L, len(nums)):
pre = nums[i - L:i]
n = nums[i]
d = {}
for p in pre:
if p in d and p != d[p]:
break
d[n - p] = p
else:
print(n)
break
i = 0
j = 2
while j < len(nums):... |
class UnexpectedMode(ValueError):
def __init__(self, mode: str) -> None:
super().__init__(
f"Unexpected mode - found '{mode}' but must be 'image' or 'mesh'"
)
| class Unexpectedmode(ValueError):
def __init__(self, mode: str) -> None:
super().__init__(f"Unexpected mode - found '{mode}' but must be 'image' or 'mesh'") |
# -*- coding: utf-8 -*-
"""
Jaccard Index Implementation
@author: AniruddhaMaheshDave
"""
def jaccard_index(str1, str2, n_gram = 2):
"""
Computes the Jaccard Index between two strings
`str1` and `str2`.
#TODO : Write details about Jaccard Index
"""
if str1 == str2:
return 1
len1, len2 = len(str1), len(str2... | """
Jaccard Index Implementation
@author: AniruddhaMaheshDave
"""
def jaccard_index(str1, str2, n_gram=2):
"""
Computes the Jaccard Index between two strings
`str1` and `str2`.
#TODO : Write details about Jaccard Index
"""
if str1 == str2:
return 1
(len1, len2) = (len(str1), len(str2))
if ... |
# Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project au... | {'includes': ['../../../../../../common_settings.gypi'], 'targets': [{'target_name': 'iLBC', 'type': '<(library)', 'dependencies': ['../../../../../../common_audio/signal_processing_library/main/source/spl.gyp:spl'], 'include_dirs': ['../interface'], 'direct_dependent_settings': {'include_dirs': ['../interface']}, 'sou... |
# generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/home/lzh/racecar_ws/devel/include;/home/lzh/racecar_ws/src/navigation-melodic-devel/dwa_local_planner/include".split(';') if "/home/lzh/racecar_ws/devel/include;/home/lzh/racecar_ws/src/navigation-mel... | catkin_package_prefix = ''
project_pkg_config_include_dirs = '/home/lzh/racecar_ws/devel/include;/home/lzh/racecar_ws/src/navigation-melodic-devel/dwa_local_planner/include'.split(';') if '/home/lzh/racecar_ws/devel/include;/home/lzh/racecar_ws/src/navigation-melodic-devel/dwa_local_planner/include' != '' else []
proje... |
nome = input("Digite seu nome ").strip().lower()
confirmacao = 'silva' in nome
print(f"Seu nome tem silva {confirmacao}") | nome = input('Digite seu nome ').strip().lower()
confirmacao = 'silva' in nome
print(f'Seu nome tem silva {confirmacao}') |
# *****************************
# Environment specific settings
# *****************************
# DO NOT use "DEBUG = True" in production environments
DEBUG = True
# DO NOT use Unsecure Secrets in production environments
# Generate a safe one with:
# python -c "import os; print repr(os.urandom(24));"
... | debug = True
secret_key = 'This is an UNSECURE Secret. CHANGE THIS for production environments.'
sqlalchemy_database_uri = 'sqlite:///../app.sqlite'
sqlalchemy_track_modifications = False |
"""
Given a column title as appear in an Excel sheet, return its corresponding column number.
For example:
A -> 1
B -> 2
C -> 3
...
Z -> 26
AA -> 27
AB -> 28
...
Example 1:
Input: "A"
Output: 1
Example 2:
Input: "AB"
Output: 28
Example 3:
Input: "ZY"
Output: 701
"""
class Solutio... | """
Given a column title as appear in an Excel sheet, return its corresponding column number.
For example:
A -> 1
B -> 2
C -> 3
...
Z -> 26
AA -> 27
AB -> 28
...
Example 1:
Input: "A"
Output: 1
Example 2:
Input: "AB"
Output: 28
Example 3:
Input: "ZY"
Output: 701
"""
class Solution... |
# coding: utf-8
# # Functions (1) - Creating Functions
# In this lesson we're going to learn about functions in Python. Functions are an important tool when programming and their use can be very complex. It's not the aim of this course to teach you how to implement functional programming, instead, this lesson will g... | def test_function():
print('This is a function')
test_function()
len('abcdefg')
def test_function2(item1, item2):
print('The first item is: ' + str(item1) + ', the second item is: ' + str(item2))
test_function2('abc', 20)
test_function2('howdy', 'partner')
def alternate_list(item1, item2, repeats):
altern... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.