content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
senseiraw = {
"name": "SteelSeries Sensei RAW (Experimental)",
"vendor_id": 0x1038,
"product_id": 0x1369,
"interface_number": 0,
"commands": {
"set_logo_light_effect": {
"description": "Set the logo light effect",
"cli": ["-e", "--logo-light-effect"],
"... | senseiraw = {'name': 'SteelSeries Sensei RAW (Experimental)', 'vendor_id': 4152, 'product_id': 4969, 'interface_number': 0, 'commands': {'set_logo_light_effect': {'description': 'Set the logo light effect', 'cli': ['-e', '--logo-light-effect'], 'command': [7, 1], 'value_type': 'choice', 'choices': {'steady': 1, 'breath... |
def ordering_fries():
print("Can I have some fried potatoes please?")
def countries_papagias_preferes():
print("Albania-Bulgaria-Romania...!")
| def ordering_fries():
print('Can I have some fried potatoes please?')
def countries_papagias_preferes():
print('Albania-Bulgaria-Romania...!') |
'''
Linked List has 2 parts : A node that stores the data and a pointer to the next Node.
So it is handled in 2 classes:
1. Node class with operations:
1. init function to get the data and next node value
2. get_data function to get the data of the node
3. set_data function to set the data of the node
... | """
Linked List has 2 parts : A node that stores the data and a pointer to the next Node.
So it is handled in 2 classes:
1. Node class with operations:
1. init function to get the data and next node value
2. get_data function to get the data of the node
3. set_data function to set the data of the node
... |
# This file was generated by wxPython's wscript.
VERSION_STRING = '4.0.7.post2'
MAJOR_VERSION = 4
MINOR_VERSION = 0
RELEASE_NUMBER = 7
BUILD_TYPE = 'release'
VERSION = (MAJOR_VERSION, MINOR_VERSION, RELEASE_NUMBER, '.post2')
| version_string = '4.0.7.post2'
major_version = 4
minor_version = 0
release_number = 7
build_type = 'release'
version = (MAJOR_VERSION, MINOR_VERSION, RELEASE_NUMBER, '.post2') |
## TASK 1 - here are the expected letter frequencies in the english language - convert them to a byte frequency table
expected_letter_frequencies = {'a': 8.167, 'b': 1.492, 'c': 2.782, 'd': 4.253, 'e': 12.702, 'f': 2.228, 'g': 2.015, 'h': 6.094, 'i': 6.966, 'j': 0.153, 'k': 0.772, 'l': 4.025, 'm': 2.406, 'n': 6.749, '... | expected_letter_frequencies = {'a': 8.167, 'b': 1.492, 'c': 2.782, 'd': 4.253, 'e': 12.702, 'f': 2.228, 'g': 2.015, 'h': 6.094, 'i': 6.966, 'j': 0.153, 'k': 0.772, 'l': 4.025, 'm': 2.406, 'n': 6.749, 'o': 7.507, 'p': 1.929, 'q': 0.095, 'r': 5.987, 's': 6.327, 't': 9.056, 'u': 2.758, 'v': 0.978, 'w': 2.361, 'x': 0.15, '... |
def bracket_check(brackets):
'''function for checking a string of brackets'''
o = [ '{', '[', '(' ]
c = [ '}', ']', ')' ]
l = []
check = 0
for i in brackets:
if i in o:
check += 1
if i in c:
check -= 1
if check == 0:
print('yep')
else... | def bracket_check(brackets):
"""function for checking a string of brackets"""
o = ['{', '[', '(']
c = ['}', ']', ')']
l = []
check = 0
for i in brackets:
if i in o:
check += 1
if i in c:
check -= 1
if check == 0:
print('yep')
else:
... |
class Utils:
@staticmethod
def fastModuloPow(num: int, pow: int, modulo: int) -> int:
result = 1
while pow:
if pow % 2 == 0:
num = (num ** 2) % modulo
pow = pow // 2
else:
result = (num * result) % modulo
pow... | class Utils:
@staticmethod
def fast_modulo_pow(num: int, pow: int, modulo: int) -> int:
result = 1
while pow:
if pow % 2 == 0:
num = num ** 2 % modulo
pow = pow // 2
else:
result = num * result % modulo
pow ... |
# https://leetcode.com/problems/satisfiability-of-equality-equations
class UnionFind:
def __init__(self):
self.node2par = {chr(i + 97): chr(i + 97) for i in range(26)}
def find_par(self, x):
if self.node2par[x] == x:
return x
par = self.find_par(self.node2par[x])
r... | class Unionfind:
def __init__(self):
self.node2par = {chr(i + 97): chr(i + 97) for i in range(26)}
def find_par(self, x):
if self.node2par[x] == x:
return x
par = self.find_par(self.node2par[x])
return par
def unite(self, x, y):
(x, y) = (self.find_par(... |
#
# PySNMP MIB module A3COM-HUAWEI-DHCPSNOOP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/A3COM-HUAWEI-DHCPSNOOP-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:04:11 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version ... | (hwdot1q_vlan_index,) = mibBuilder.importSymbols('A3COM-HUAWEI-LswVLAN-MIB', 'hwdot1qVlanIndex')
(h3c_common,) = mibBuilder.importSymbols('A3COM-HUAWEI-OID-MIB', 'h3cCommon')
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mib... |
#Copyright (c) 2020 Jan Kiefer
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES... | class Chatusr:
def __init__(self, utfmsg):
self.wob_id = utfmsg.get_int_arg(1)
self.message = utfmsg.get_string_arg(2)
self.type = utfmsg.get_int_list_arg(0)[2]
self.mode = 0 if utfmsg.get_arg_count() <= 3 else utfmsg.get_int_arg(3)
self.overheard = False if utfmsg.get_arg_c... |
ast = int(input("Ingrese numero de asteroides"))
nom =input("Ingrese nombre de asteroides")
print("Los",ast,"asteroides",nom,"caen del cielo") | ast = int(input('Ingrese numero de asteroides'))
nom = input('Ingrese nombre de asteroides')
print('Los', ast, 'asteroides', nom, 'caen del cielo') |
#!/usr/bin/env python
compsys={
'Artisan':{
'db':'file-store',
'objects':['Artisan','Product','Order','Customer'],
},
'Central Office user':{
'db':'file-store',
'objects':['Artisan','Product','Order','Customer'],
},
}
| compsys = {'Artisan': {'db': 'file-store', 'objects': ['Artisan', 'Product', 'Order', 'Customer']}, 'Central Office user': {'db': 'file-store', 'objects': ['Artisan', 'Product', 'Order', 'Customer']}} |
def main():
my_integ_loop.getIntegrator( trick.Runge_Kutta_2, 4)
trick.stop(300.0)
if __name__ == "__main__":
main()
| def main():
my_integ_loop.getIntegrator(trick.Runge_Kutta_2, 4)
trick.stop(300.0)
if __name__ == '__main__':
main() |
S_ASK_DOWNLOAD = 0
C_ANSWER_YES = 1
C_ANSWER_NO = 2
S_ASK_UPLOAD = 3
S_ASK_WAIT = 4
S_BEGIN = 5
| s_ask_download = 0
c_answer_yes = 1
c_answer_no = 2
s_ask_upload = 3
s_ask_wait = 4
s_begin = 5 |
#!/usr/bin/env python3
n = 4
A = [[0.1, 0.5, 3, 0.25], [1.2, 0.2, 0.25, 0.2], [-1, 0.25, 0.3, 2],
[2, 0.00001, 1, 0.4]]
b = [0, 1, 2, 3]
# Gauss elim
for i in range(n):
pivot = A[i][i]
b[i] /= pivot
for j in range(n):
A[i][j] /= pivot
for j in range(i + 1, n):
times = A[j][i]
... | n = 4
a = [[0.1, 0.5, 3, 0.25], [1.2, 0.2, 0.25, 0.2], [-1, 0.25, 0.3, 2], [2, 1e-05, 1, 0.4]]
b = [0, 1, 2, 3]
for i in range(n):
pivot = A[i][i]
b[i] /= pivot
for j in range(n):
A[i][j] /= pivot
for j in range(i + 1, n):
times = A[j][i]
b[j] -= times * b[i]
for k in ran... |
#Pat McDonald - 8/2/2018
#Exercise 3: Collatz conjecture
#Week 3 of Programming and Scripting
#Inspired by Reddit!: https://www.reddit.com/r/Python/comments/57r6bf/collatz_conjecture_program/?st=jdhil1j5&sh=ba8fd995
n = int(input("Type an integer: "))
print(n)
while n != 1:
if (n % 2 == 0):
#(n / 2) outputs a floa... | n = int(input('Type an integer: '))
print(n)
while n != 1:
if n % 2 == 0:
n = n // 2
print(n)
else:
n = 3 * n + 1
print(n) |
n = int(input())
lista = [int(x) for x in input().split()]
qtde = lista.count(0)
indice = []
for i in range(0,qtde):
indice.append(lista.index(0))
lista[indice[i]] = 2
for i in range(0,n):
menor = 100000
for j in range(0,len(indice)):
temp = abs(i - indice[j])
if(temp < menor):
... | n = int(input())
lista = [int(x) for x in input().split()]
qtde = lista.count(0)
indice = []
for i in range(0, qtde):
indice.append(lista.index(0))
lista[indice[i]] = 2
for i in range(0, n):
menor = 100000
for j in range(0, len(indice)):
temp = abs(i - indice[j])
if temp < menor:
... |
N = int(input())
S = str(input())
flag = False
half = (N+1) // 2
if S[:half] == S[half:N]:
flag = True
if flag:
print("Yes")
else:
print("No") | n = int(input())
s = str(input())
flag = False
half = (N + 1) // 2
if S[:half] == S[half:N]:
flag = True
if flag:
print('Yes')
else:
print('No') |
#!/usr/bin/env python
weight = input("your weight is? ")
height = input("your height is? ")
bmi = float(weight) / ( float(height) ** 2 )
print(f"your bmi: {bmi:.2f}")
if bmi <= 18.5:
print("you are so thin!")
elif bmi <= 25 and bmi > 18.5:
print("well, you are fit.")
elif bmi <= 28 and bmi > 25:
print("it l... | weight = input('your weight is? ')
height = input('your height is? ')
bmi = float(weight) / float(height) ** 2
print(f'your bmi: {bmi:.2f}')
if bmi <= 18.5:
print('you are so thin!')
elif bmi <= 25 and bmi > 18.5:
print('well, you are fit.')
elif bmi <= 28 and bmi > 25:
print('it looks you are a little heav... |
#!/usr/bin/env conda-execute
# conda execute
# env:
# - python ==3.5
# - conda-build
# - pygithub >=1.29
# - pyyaml
# - requests
# - setuptools
# - tqdm
# channels:
# - conda-forge
# run_with: python
# TODO take package or list of packages
# TODO take github url or github urls
# TODO If user doesn't have a fo... | def main():
return
if __init__ == '__main__':
main() |
#! env\bin\python
# Ryan Simmons
# Coffee Machine Project
class CoffeeMachine:
# the values in supplies refers to 1-1 with this
supply_str = ['water', 'milk', 'coffee beans', 'disposable cups', 'money']
def __init__(self, supplies):
self.supplies = supplies
def supply_checker(self, drink)... | class Coffeemachine:
supply_str = ['water', 'milk', 'coffee beans', 'disposable cups', 'money']
def __init__(self, supplies):
self.supplies = supplies
def supply_checker(self, drink):
for i in range(len(drink)):
if drink[i] > self.supplies[i]:
print(f'Sorry not ... |
# Write a program to print the pattern
def pattern(a):
print("Output :")
for i in range(1, a+1):
c = 1
for k in range(a, i, -1):
print(" ", end="")
for j in range(1, 2*i):
if j < i:
print(c, end="")
c += 1
els... | def pattern(a):
print('Output :')
for i in range(1, a + 1):
c = 1
for k in range(a, i, -1):
print(' ', end='')
for j in range(1, 2 * i):
if j < i:
print(c, end='')
c += 1
else:
print(c, end='')
... |
# O(n ^ 4)
# class Solution:
# def countQuadruplets(self, nums: List[int]) -> int:
# n = len(nums)
# ans = 0
# for a in range(n - 3):
# for b in range(a + 1, n - 2):
# for c in range(b + 1, n -1):
# for d in range(c + 1, n):
# ... | class Solution:
def count_quadruplets(self, nums: List[int]) -> int:
n = len(nums)
cnt = defaultdict(int)
ans = 0
for b in range(n - 3, 0, -1):
for d in range(b + 2, n):
cnt[nums[d] - nums[b + 1]] += 1
for a in range(b):
ans +=... |
# Constants
#
# Device Variables
VAR_BILLINGPERIODDURATION = 'zigbee:BillingPeriodDuration'
VAR_BILLINGPERIODSTART = 'zigbee:BillingPeriodStart'
VAR_BLOCK1PRICE = 'zigbee:Block1Price'
VAR_BLOCK1THRESHOLD = 'zigbee:Block1Threshold'
VAR_BLOCK2PRICE = 'zigbee:Block2Price'
VAR_BLOCK2THRESHOLD = 'zigbee:Block2Threshold'
V... | var_billingperiodduration = 'zigbee:BillingPeriodDuration'
var_billingperiodstart = 'zigbee:BillingPeriodStart'
var_block1_price = 'zigbee:Block1Price'
var_block1_threshold = 'zigbee:Block1Threshold'
var_block2_price = 'zigbee:Block2Price'
var_block2_threshold = 'zigbee:Block2Threshold'
var_block3_price = 'zigbee:Block... |
def load_file_list(f_list):
lines=[]
for fp in f_list:
with open(fp,'r',encoding='utf-8') as f:
for line in f:
strs=line.strip().split('\t')
lines.append([float(strs[0]),len(lines),strs[1]])
return lines
def build_id_dict(list):
dic={}
for l in l... | def load_file_list(f_list):
lines = []
for fp in f_list:
with open(fp, 'r', encoding='utf-8') as f:
for line in f:
strs = line.strip().split('\t')
lines.append([float(strs[0]), len(lines), strs[1]])
return lines
def build_id_dict(list):
dic = {}
f... |
# -------------
# netrecon info
# --------------
__name__ = 'netrecon'
__version__ = 0.19
__author__ = 'Avery Rozar: avery.rozar@trolleyesecurity.com'
| __name__ = 'netrecon'
__version__ = 0.19
__author__ = 'Avery Rozar: avery.rozar@trolleyesecurity.com' |
def read_puzzle(path):
with open(path, 'r+') as file:
return file.read().split('\n')
class Submarine:
horizontal = 0
depth = 0
aim = 0
def forward(self, x):
self.horizontal = self.horizontal + x
self.depth = self.depth + self.aim * x
def down(self, y):
self.ai... | def read_puzzle(path):
with open(path, 'r+') as file:
return file.read().split('\n')
class Submarine:
horizontal = 0
depth = 0
aim = 0
def forward(self, x):
self.horizontal = self.horizontal + x
self.depth = self.depth + self.aim * x
def down(self, y):
self.aim... |
for t in range(int(input())):
N = int(input())
A = list(map(int, input().split()))
counter = 0
flag = False
result = True
for i in A:
if i == 1 and not flag:
counter = 1
flag = True
elif i == 1 and counter < 6 :
result = False
br... | for t in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
counter = 0
flag = False
result = True
for i in A:
if i == 1 and (not flag):
counter = 1
flag = True
elif i == 1 and counter < 6:
result = False
brea... |
# https://leetcode.com/problems/longest-substring-of-all-vowels-in-order/
class Solution:
def longestBeautifulSubstring(self, word: str) -> int:
dp = [0] * len(word)
dic = {'a': 0, 'e': 1, 'i': 2, 'o': 3, 'u': 4}
dp[0] = 1 if word[0] == 'a' else 0
for i in range(1, len(word)):
... | class Solution:
def longest_beautiful_substring(self, word: str) -> int:
dp = [0] * len(word)
dic = {'a': 0, 'e': 1, 'i': 2, 'o': 3, 'u': 4}
dp[0] = 1 if word[0] == 'a' else 0
for i in range(1, len(word)):
if 0 <= dic[word[i]] - dic[word[i - 1]] <= 1 and dp[i - 1] > 0:
... |
# flake8: noqa
def foo():
def inner():
x = __test_source()
__test_sink(x)
def inner_with_model():
return __test_source()
| def foo():
def inner():
x = __test_source()
__test_sink(x)
def inner_with_model():
return __test_source() |
with open("3.txt") as f:
nums = [x for x in f.read().split("\n")]
totals = [0] * len(nums[0])
for n in nums:
for i, c in enumerate(n):
totals[i] += 1 if c == "1" else -1
gamma = int("".join(map(lambda x: "1" if x > 0 else "0", totals)), 2)
epsilon = int("".join(map(lambda x: "1" ... | with open('3.txt') as f:
nums = [x for x in f.read().split('\n')]
totals = [0] * len(nums[0])
for n in nums:
for (i, c) in enumerate(n):
totals[i] += 1 if c == '1' else -1
gamma = int(''.join(map(lambda x: '1' if x > 0 else '0', totals)), 2)
epsilon = int(''.join(map(lambda x: '1... |
count = 0
count2 = 0
while True:
questions = set()
# 2nd part
everyone = set()
fst = True
try:
person = input()
while person != "":
for x in person:
questions.add(x)
if fst:
for x in person:
everyone.add(... | count = 0
count2 = 0
while True:
questions = set()
everyone = set()
fst = True
try:
person = input()
while person != '':
for x in person:
questions.add(x)
if fst:
for x in person:
everyone.add(x)
else... |
class SerializerError(Exception):
def __init__(self, message):
self._message = message
class ValidationError(SerializerError):
pass
class InvalidSerializer(SerializerError):
pass
| class Serializererror(Exception):
def __init__(self, message):
self._message = message
class Validationerror(SerializerError):
pass
class Invalidserializer(SerializerError):
pass |
n = int(input())
a = [['' for j in range(n)] for i in range(n)]
for i in range(n):
f = 0
for j in range(i, n):
a[i][j] = str(f)
f += 1
f = i
for j in range(i):
a[i][j] = str(f)
f -= 1
for row in a:
print(' '.join(row))
# For the record, I feel dumb because it coul... | n = int(input())
a = [['' for j in range(n)] for i in range(n)]
for i in range(n):
f = 0
for j in range(i, n):
a[i][j] = str(f)
f += 1
f = i
for j in range(i):
a[i][j] = str(f)
f -= 1
for row in a:
print(' '.join(row)) |
#!/usr/bin/env python3
# https://abc102.contest.atcoder.jp/tasks/abc102_b
n = int(input())
a = [int(x) for x in input().split()]
a.sort()
print(a[-1] - a[0])
| n = int(input())
a = [int(x) for x in input().split()]
a.sort()
print(a[-1] - a[0]) |
# Spiegelmann (9071005) | In Monster Park Maps
response = sm.sendAskYesNo("Do you want to leave?")
if response:
sm.warpInstanceOut(951000000)
| response = sm.sendAskYesNo('Do you want to leave?')
if response:
sm.warpInstanceOut(951000000) |
#!/usr/local/bin/python3
def main():
# Test suite
tests = [
[None, None], # Should throw a TypeError
[-1, None], # Should throw a ValueError
[0, 0],
[9, 9],
[138, 3],
[65536, 7]
]
print('Testing add_digits')
for item in tests:
try:
... | def main():
tests = [[None, None], [-1, None], [0, 0], [9, 9], [138, 3], [65536, 7]]
print('Testing add_digits')
for item in tests:
try:
temp_result = add_digits(item[0])
if temp_result == item[1]:
print('PASSED: add_digits({}) returned {}'.format(item[0], tem... |
#Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Most digits
#Problem level: 7 kyu
def find_longest(arr):
return arr[[len(str(x)) for x in arr].index(max([len(str(x)) for x in arr]))]
| def find_longest(arr):
return arr[[len(str(x)) for x in arr].index(max([len(str(x)) for x in arr]))] |
#!/usr/bin/env python3
def main():
# initialize round counter to 0 and answer to blank
round = 0
answer = " "
# set up loop
while round < 3 and (answer.lower() != "brian" and answer.lower() != "shrubbery"):
# increment round
round += 1
answer = input("Finish the movie ti... | def main():
round = 0
answer = ' '
while round < 3 and (answer.lower() != 'brian' and answer.lower() != 'shrubbery'):
round += 1
answer = input('Finish the movie title, "Monty Python\'s The Life of ______: ')
if answer.lower() == 'brian':
print('Correct')
elif ans... |
def sentence_maker(phrase):
interrogatives = ("why","how","what")
capitalized = phrase.capitalize()
#startswith function checks whether the string starts with the given values
if phrase.startswith(interrogatives):
return f"{capitalized}?"
else:
return f"{capitalized}."
conversation... | def sentence_maker(phrase):
interrogatives = ('why', 'how', 'what')
capitalized = phrase.capitalize()
if phrase.startswith(interrogatives):
return f'{capitalized}?'
else:
return f'{capitalized}.'
conversation = []
while True:
user_input = input('Say something: ')
if userInput == ... |
# https://www.algoexpert.io/questions/Search%20In%20Sorted%20Matrix
# O(n + m) time | O(1) space
# where 'n' is the length of row and 'm' is the length on column
def search_in_sorted_matrix(matrix, target):
row = 0
col = len(matrix[0]) - 1
while row < len(matrix) and col >= 0:
if matrix[row][col]... | def search_in_sorted_matrix(matrix, target):
row = 0
col = len(matrix[0]) - 1
while row < len(matrix) and col >= 0:
if matrix[row][col] > target:
col -= 1
elif matrix[row][col] < row:
row += 1
else:
return [row, col]
return [-1, -1] |
def get_variables():
return {
'SPECIAL_FUNC': {'hoge': 'fuga'}
}
| def get_variables():
return {'SPECIAL_FUNC': {'hoge': 'fuga'}} |
n=int(input())
numSwaps=0
a=list(map(int, input().strip().split()))
for i in range(n-1):
for j in range(n-i-1):
if (a[j]>a[j+1]):
a[j],a[j+1]=a[j+1],a[j]
numSwaps+=1
print(f"Array is Sorted in {numSwaps} swaps")
print(f"First Element: {a[j]}")
print(f"Last Element: {a[j... | n = int(input())
num_swaps = 0
a = list(map(int, input().strip().split()))
for i in range(n - 1):
for j in range(n - i - 1):
if a[j] > a[j + 1]:
(a[j], a[j + 1]) = (a[j + 1], a[j])
num_swaps += 1
print(f'Array is Sorted in {numSwaps} swaps')
print(f'First Element: {a[j]}')
print(f'La... |
# Has the same id
a = [1, 2, 3]
c = a
print(id(a), id(c))
# Has a different id
b = 42
print(id(b))
b = '42'
print(id(b))
| a = [1, 2, 3]
c = a
print(id(a), id(c))
b = 42
print(id(b))
b = '42'
print(id(b)) |
class Score:
def __init__(self, name, loader):
self.name = name
self.metrics = ['F', 'M']
self.highers = [1, 0]
self.scores = [0. if higher else 1. for higher in self.highers]
self.best = self.scores
self.best_epoch = [0] * len(self.scores)
self.present = self... | class Score:
def __init__(self, name, loader):
self.name = name
self.metrics = ['F', 'M']
self.highers = [1, 0]
self.scores = [0.0 if higher else 1.0 for higher in self.highers]
self.best = self.scores
self.best_epoch = [0] * len(self.scores)
self.present = s... |
mysql = {
'user': 'scott',
'password': 'password',
'host': '127.0.0.1',
'database': 'employees',
'raise_on_warnings': True,
}
| mysql = {'user': 'scott', 'password': 'password', 'host': '127.0.0.1', 'database': 'employees', 'raise_on_warnings': True} |
# Author: allannozomu
# Runtime: 544 ms
# Memory: 19.8 MB
class Solution:
def isMonotonic(self, A: List[int]) -> bool:
if (A[0] < A[-1]):
ordered = sorted(A)
else:
ordered = sorted(A, reverse = True)
return ordered == A
| class Solution:
def is_monotonic(self, A: List[int]) -> bool:
if A[0] < A[-1]:
ordered = sorted(A)
else:
ordered = sorted(A, reverse=True)
return ordered == A |
def szyfr(slowa):
wynik = []
for slowo in slowa:
wynik.append(slimak(slowo))
return wynik
def slimak(slowo):
ukl = [[" " for _ in range(len(slowo))] for _ in range(len(slowo))]
kon = [1,2,2,2] + [j for j in range(3, 20)] + [j for j in range(3, 20)]
kon.sort()
pivot = int(len(slowo) ... | def szyfr(slowa):
wynik = []
for slowo in slowa:
wynik.append(slimak(slowo))
return wynik
def slimak(slowo):
ukl = [[' ' for _ in range(len(slowo))] for _ in range(len(slowo))]
kon = [1, 2, 2, 2] + [j for j in range(3, 20)] + [j for j in range(3, 20)]
kon.sort()
pivot = int(len(slow... |
class Error(Exception):
pass
class InvalidTypeError(Error):
pass
class InvalidArgumentError(Error):
pass
| class Error(Exception):
pass
class Invalidtypeerror(Error):
pass
class Invalidargumenterror(Error):
pass |
#********************************************************************
# Filename: FibonacciSearch.py
# Author: Javier Montenegro (https://javiermontenegro.github.io/)
# Copyright:
# Details: This code is the implementation of the fibonacci search algorithm.
#*******************************************************... | def fibonacci_search(arr, val):
fib_n_2 = 0
fib_n_1 = 1
fib_next = fib_N_1 + fib_N_2
length = len(arr)
if length == 0:
return 0
while fibNext < len(arr):
fib_n_2 = fib_N_1
fib_n_1 = fibNext
fib_next = fib_N_1 + fib_N_2
index = -1
while fibNext > 1:
... |
class HostAssignedStorageVolumes(object):
def read_get(self, name, idx_name, unity_client):
return unity_client.get_host_assigned_volumes(idx_name)
class HostAssignedStorageVolumesColumn(object):
def get_idx(self, name, idx, unity_client):
return unity_client.get_hosts()
| class Hostassignedstoragevolumes(object):
def read_get(self, name, idx_name, unity_client):
return unity_client.get_host_assigned_volumes(idx_name)
class Hostassignedstoragevolumescolumn(object):
def get_idx(self, name, idx, unity_client):
return unity_client.get_hosts() |
def checkBingo(c):
for x in range(5):
if c[(x * 5) + 0] == c[(x * 5) + 1] == c[(x * 5) + 2] == c[(x * 5) + 3] == c[(x * 5) + 4] == True:
return True
if c[x + 0] == c[x + 5] == c[x + 10] == c[x + 15] == c[x + 20] == True:
return True
return False
def part2(path):
p_in... | def check_bingo(c):
for x in range(5):
if c[x * 5 + 0] == c[x * 5 + 1] == c[x * 5 + 2] == c[x * 5 + 3] == c[x * 5 + 4] == True:
return True
if c[x + 0] == c[x + 5] == c[x + 10] == c[x + 15] == c[x + 20] == True:
return True
return False
def part2(path):
p_input = []
... |
# 207-course-schedule.py
#
# Copyright (C) 2019 Sang-Kil Park <likejazz@gmail.com>
# All rights reserved.
#
# This software may be modified and distributed under the terms
# of the BSD license. See the LICENSE file for details.
class Solution:
def canFinish(self, numCourses: int, prerequisites: List[List[int]]) ->... | class Solution:
def can_finish(self, numCourses: int, prerequisites: List[List[int]]) -> bool:
graph = {k[1]: [] for k in prerequisites}
for pr in prerequisites:
graph[pr[1]].append(pr[0])
visited = set()
traced = set()
def visit(vertex):
if vertex i... |
def main():
n = int(input("Enter a number: "))
for i in range(3, n + 1):
is_prime = True
for j in range(2, i):
if i % j == 0:
is_prime = False
break
if is_prime: print(f"{i} ", end="")
print()
if __name__ == '__main__':
main()
| def main():
n = int(input('Enter a number: '))
for i in range(3, n + 1):
is_prime = True
for j in range(2, i):
if i % j == 0:
is_prime = False
break
if is_prime:
print(f'{i} ', end='')
print()
if __name__ == '__main__':
main... |
class Registry(object):
def __init__(self, name):
super(Registry, self).__init__()
self._name = name
self._module_dict = dict()
@property
def name(self):
return self._name
@property
def module_dict(self):
return self._module_dict
def __len__(self):
return len(self.module_dict)
def get(self, ke... | class Registry(object):
def __init__(self, name):
super(Registry, self).__init__()
self._name = name
self._module_dict = dict()
@property
def name(self):
return self._name
@property
def module_dict(self):
return self._module_dict
def __len__(self):
... |
'''
293. Flip Game
=========
You are playing the following Flip Game with your friend: Given a string that
contains only these two characters: + and -, you and your friend take turns to
flip two consecutive "++" into "--". The game ends when a person can no longer
make a move and therefore the other person will be the ... | """
293. Flip Game
=========
You are playing the following Flip Game with your friend: Given a string that
contains only these two characters: + and -, you and your friend take turns to
flip two consecutive "++" into "--". The game ends when a person can no longer
make a move and therefore the other person will be the ... |
test_patterns = '''
Given source text and a list of pattens,
look for matches for each patterns within the
text and print them to stdout'''
# Look for each pattern in the text and print the results.
| test_patterns = '\nGiven source text and a list of pattens,\nlook for matches for each patterns within the\ntext and print them to stdout' |
# Source : https://leetcode.com/problems/range-sum-of-bst/
# Author : foxfromworld
# Date : 27/04/2021
# Second attempt (recursive)
class Solution:
def rangeSumBST(self, root: TreeNode, low: int, high: int) -> int:
self.retV = 0
def sub_rangeSumBST(root):
if root:
if low <= root.val <= high:
... | class Solution:
def range_sum_bst(self, root: TreeNode, low: int, high: int) -> int:
self.retV = 0
def sub_range_sum_bst(root):
if root:
if low <= root.val <= high:
self.retV += root.val
if low < root.val:
sub_rang... |
class IntegerString:
def __init__(self) -> None:
self.digits = bytearray([0])
self._length = 0
def __init__(self, digits: bytearray) -> None:
self.digits = digits
self._length = len(self.digits)
@property
def length(self):
return self._length
def add(se... | class Integerstring:
def __init__(self) -> None:
self.digits = bytearray([0])
self._length = 0
def __init__(self, digits: bytearray) -> None:
self.digits = digits
self._length = len(self.digits)
@property
def length(self):
return self._length
def add(self)... |
# format the date in January 1, 2022 form
def format_date(date):
return date.strftime('%B %d, %Y')
# format plural word
def format_plural(total, word):
if total != 1:
return word + 's'
return word
| def format_date(date):
return date.strftime('%B %d, %Y')
def format_plural(total, word):
if total != 1:
return word + 's'
return word |
# -*- coding: utf-8 -*-
class Visitor:
def visit(self, manager):
self.begin_visit(manager)
manager.visit(self)
return self.end_visit(manager)
def begin_visit(self, manager):
pass
def end_visit(self, manager):
pass
def begin_chapter(self, chapter):
pas... | class Visitor:
def visit(self, manager):
self.begin_visit(manager)
manager.visit(self)
return self.end_visit(manager)
def begin_visit(self, manager):
pass
def end_visit(self, manager):
pass
def begin_chapter(self, chapter):
pass
def end_chapter(se... |
# 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 rightSideView(self, root: Optional[TreeNode]) -> List[int]:
if not root:
return []
... | class Solution:
def right_side_view(self, root: Optional[TreeNode]) -> List[int]:
if not root:
return []
output = []
stack = [(root, 0)]
prev_depth = 0
while stack:
(node, depth) = stack.pop(0)
if depth != prev_depth:
outpu... |
_base_ = ["./common_base.py", "./renderer_base.py"]
# -----------------------------------------------------------------------------
# base model cfg for self6d-v2
# -----------------------------------------------------------------------------
refiner_cfg_path = "configs/_base_/self6dpp_refiner_base.py"
MODEL = dict(
... | _base_ = ['./common_base.py', './renderer_base.py']
refiner_cfg_path = 'configs/_base_/self6dpp_refiner_base.py'
model = dict(DEVICE='cuda', WEIGHTS='', REFINER_WEIGHTS='', PIXEL_MEAN=[0, 0, 0], PIXEL_STD=[255.0, 255.0, 255.0], SELF_TRAIN=False, FREEZE_BN=False, WITH_REFINER=False, LOAD_DETS_TRAIN=False, LOAD_DETS_TRAI... |
#
# PySNMP MIB module RADLAN-SOCKET-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RADLAN-SOCKET-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:49:20 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_intersection, constraints_union, value_range_constraint, single_value_constraint) ... |
RATING_DATE = 'rating_date'
ANALYSTS_MIN_MEAN_SUCCESS_RATE = 'ANALYSTS_MIN_MEAN_SUCCESS_RATE'
DAYS_SINCE_ANALYSTS_ALERT = 'DAYS_SINCE_ANALYSTS_ALERT'
QUESTIONABLE_SOURCES = []
EMISSIONS = 'emissions'
| rating_date = 'rating_date'
analysts_min_mean_success_rate = 'ANALYSTS_MIN_MEAN_SUCCESS_RATE'
days_since_analysts_alert = 'DAYS_SINCE_ANALYSTS_ALERT'
questionable_sources = []
emissions = 'emissions' |
# Source and destination file names.
test_source = "cyrillic.txt"
test_destination = "xetex-cyrillic.tex"
# Keyword parameters passed to publish_file.
writer_name = "xetex"
# Settings
settings_overrides['language_code'] = 'ru'
# use "smartquotes" transition:
settings_overrides['smart_quotes'] = True
| test_source = 'cyrillic.txt'
test_destination = 'xetex-cyrillic.tex'
writer_name = 'xetex'
settings_overrides['language_code'] = 'ru'
settings_overrides['smart_quotes'] = True |
# Leetcode 101. Symmetric Tree
#
# Link: https://leetcode.com/problems/symmetric-tree/
# Difficulty: Easy
# Complexity:
# O(N) time | where N represent the number of nodes in the tree
# O(N) space | where N represent the number of nodes in the tree
# Definition for a binary tree node.
# class TreeNode:
# def _... | class Solution:
def is_symmetric(self, root: Optional[TreeNode]) -> bool:
def is_mirror(root1, root2):
if not root1 and (not root2):
return True
if root1 and root2:
if root1.val == root2.val:
return is_mirror(root1.left, root2.rig... |
# !/usr/bin/env python3
# Author: C.K
# Email: theck17@163.com
# DateTime:2021-07-09 19:40:06
# Description:
class Solution:
def isValid(self, s: str) -> bool:
n = len(s)
if n == 0:
return True
if n % 2 != 0:
return False
while '()' in ... | class Solution:
def is_valid(self, s: str) -> bool:
n = len(s)
if n == 0:
return True
if n % 2 != 0:
return False
while '()' in s or '{}' in s or '[]' in s:
s = s.replace('{}', '').replace('()', '').replace('[]', '')
if s == '':
... |
'''
Numerical validations.
All functions are boolean.
'''
def is_int(string: str) -> bool:
'''
Returns True if the string argument represents a valid integer.
'''
try:
int(string)
except ValueError:
return False
else:
return True
def is_float(string: str) -> bool:
... | """
Numerical validations.
All functions are boolean.
"""
def is_int(string: str) -> bool:
"""
Returns True if the string argument represents a valid integer.
"""
try:
int(string)
except ValueError:
return False
else:
return True
def is_float(string: str) -> bool:
... |
class DumbCRC32(object):
def __init__(self):
self._remainder = 0xffffffff
self._reversed_polynomial = 0xedb88320
self._final_xor = 0xffffffff
def update(self, data):
bit_count = len(data) * 8
for bit_n in range(bit_count):
bit_in = data[bit_n >> 3] & (1 << (bit_n & 7))
self._remainder ^= 1 if bit_in... | class Dumbcrc32(object):
def __init__(self):
self._remainder = 4294967295
self._reversed_polynomial = 3988292384
self._final_xor = 4294967295
def update(self, data):
bit_count = len(data) * 8
for bit_n in range(bit_count):
bit_in = data[bit_n >> 3] & 1 << (b... |
# Leetcode 36. Valid Sudoku
#
# Link: https://leetcode.com/problems/valid-sudoku/
# Difficulty: Medium
# Complexity:
# O(9^2) time
# O(9^2) space
class Solution:
def isValidSudoku(self, board: List[List[str]]) -> bool:
width, height = len(board[0]), len(board)
rows = collections.defaultdict(set)
... | class Solution:
def is_valid_sudoku(self, board: List[List[str]]) -> bool:
(width, height) = (len(board[0]), len(board))
rows = collections.defaultdict(set)
cols = collections.defaultdict(set)
boxs = collections.defaultdict(set)
for row in range(height):
for col ... |
filename="data2.txt"
file=open(filename, "r")
rs=file.read()
fs=rs.split(",")
il=[]
for i in fs:
il.append(int(i))
i=0
while i<len(il):
moved=False
if il[i]==1:
il[il[i+3]]=il[il[i+1]]+il[il[i+2]]
moved=True
elif il[i]==2:
il[il[i+3]]=il[il[i+1]]*il[il[i+2]]
moved=Tru... | filename = 'data2.txt'
file = open(filename, 'r')
rs = file.read()
fs = rs.split(',')
il = []
for i in fs:
il.append(int(i))
i = 0
while i < len(il):
moved = False
if il[i] == 1:
il[il[i + 3]] = il[il[i + 1]] + il[il[i + 2]]
moved = True
elif il[i] == 2:
il[il[i + 3]] = il[il[i +... |
class Post:
def __init__(self, index, title, subtitle, body):
self.id = index
self.title = title
self.subtitle = subtitle
self.body = body | class Post:
def __init__(self, index, title, subtitle, body):
self.id = index
self.title = title
self.subtitle = subtitle
self.body = body |
# Rwapple -
#Lesson 1: saying hello
# Chapter one of the book.
Print ('Hello, World!')
| print('Hello, World!') |
# Write your solution here
word = input("Please type in a word: ")
char = input("Please type in a character: ")
index = word.find(char)
if (char in word and index < len(word)-2):
print(word[index:index+3]) | word = input('Please type in a word: ')
char = input('Please type in a character: ')
index = word.find(char)
if char in word and index < len(word) - 2:
print(word[index:index + 3]) |
def multi_bracket_validation(str):
open_brackets = tuple('({[')
close_brackets = tuple(')}]')
map = dict(zip(open_brackets, close_brackets))
queue = []
for i in str:
if i in open_brackets:
queue.append(map[i])
elif i in close_brackets:
if not queue o... | def multi_bracket_validation(str):
open_brackets = tuple('({[')
close_brackets = tuple(')}]')
map = dict(zip(open_brackets, close_brackets))
queue = []
for i in str:
if i in open_brackets:
queue.append(map[i])
elif i in close_brackets:
if not queue or i != que... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Author: illuz <iilluzen[at]gmail.com>
# File: AC_simulation_1.py
# Create Date: 2015-03-02 23:19:56
# Usage: AC_simulation_1.py
# Descripton:
class Solution:
# @return an integer
def romanToInt(self, s):
val = {'I': 1, 'V': 5, 'X': 10, '... | class Solution:
def roman_to_int(self, s):
val = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}
ret = 0
for i in range(len(s)):
if i > 0 and val[s[i]] > val[s[i - 1]]:
ret += val[s[i]] - 2 * val[s[i - 1]]
else:
ret +... |
__version__ = "0.7.1"
def version():
return __version__
| __version__ = '0.7.1'
def version():
return __version__ |
lista = [1, 3, 5, 7]
lista_animal = ['cachorro', 'gato', 'elefante']
print(lista)
print(type(lista))
print(lista_animal[1]) | lista = [1, 3, 5, 7]
lista_animal = ['cachorro', 'gato', 'elefante']
print(lista)
print(type(lista))
print(lista_animal[1]) |
# The version number is stored here here so that:
# 1) we don't load dependencies by storing it in the actual project
# 2) we can import it in setup.py for the same reason as 1)
# 3) we can import it into all other modules
__version__ = '0.0.1'
| __version__ = '0.0.1' |
class Solution:
def isConvex(self, points):
def direction(a, b, c): return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0])
d, n = 0, len(points)
for i in range(n):
a = direction(points[i], points[(i + 1) % n], points[(i + 2) % n])
if not d: d = a
... | class Solution:
def is_convex(self, points):
def direction(a, b, c):
return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0])
(d, n) = (0, len(points))
for i in range(n):
a = direction(points[i], points[(i + 1) % n], points[(i + 2) % n])
if n... |
#! -*- coding: utf-8 -*-
SIGBITS = 5
RSHIFT = 8 - SIGBITS
MAX_ITERATION = 1000
FRACT_BY_POPULATIONS = 0.75
| sigbits = 5
rshift = 8 - SIGBITS
max_iteration = 1000
fract_by_populations = 0.75 |
def in_radius(signal, lag=6):
n = len(signal) - 6
r = []
for m in range(n):
a = sqrt((signal[m] - signal[m + 2]) ** 2 + (signal[m + 1] - signal[m + 3]) ** 2)
b = sqrt((signal[m] - signal[m + 4]) ** 2 + (signal[m + 1] - signal[m + 5]) ** 2)
c = sqrt((signal[m + 2] - signal[m + 4]) **... | def in_radius(signal, lag=6):
n = len(signal) - 6
r = []
for m in range(n):
a = sqrt((signal[m] - signal[m + 2]) ** 2 + (signal[m + 1] - signal[m + 3]) ** 2)
b = sqrt((signal[m] - signal[m + 4]) ** 2 + (signal[m + 1] - signal[m + 5]) ** 2)
c = sqrt((signal[m + 2] - signal[m + 4]) ** ... |
# Determine the sign of number
n = float(input("Enter a number: "))
if n > 0:
print("Positive.")
elif n < 0:
print("Negative.")
else:
print("STRAIGHT AWAY ZERROOO.")
| n = float(input('Enter a number: '))
if n > 0:
print('Positive.')
elif n < 0:
print('Negative.')
else:
print('STRAIGHT AWAY ZERROOO.') |
# https://codeforces.com/problemset/problem/520/A
n = int(input())
s = sorted(set(list(input().upper())))
flag = 0
if len(s) == 26:
for i in range(len(s)):
if chr(65 + i) != s[i]:
flag = 1
break
print("YES") if flag == 0 else print("NO")
else:
print("NO") | n = int(input())
s = sorted(set(list(input().upper())))
flag = 0
if len(s) == 26:
for i in range(len(s)):
if chr(65 + i) != s[i]:
flag = 1
break
print('YES') if flag == 0 else print('NO')
else:
print('NO') |
{
'targets':[
{
'target_name': 'native_module',
'sources': [
'src/native_module.cc',
'src/native.cc'
],
'conditions': [
['OS=="linux"', {
'cflags_cc': [ '-std=c++0x' ]
}]
]
} ... | {'targets': [{'target_name': 'native_module', 'sources': ['src/native_module.cc', 'src/native.cc'], 'conditions': [['OS=="linux"', {'cflags_cc': ['-std=c++0x']}]]}]} |
level = 3
name = 'Pacet'
capital = 'Cikitu'
area = 91.94
| level = 3
name = 'Pacet'
capital = 'Cikitu'
area = 91.94 |
# Function to calculate the mask of a number.
def split(n):
b = []
# Iterating the number by digits.
while n > 0:
# If the digit is lucky digit it is appended to the list.
if n % 10 == 4 or n % 10 == 7:
b.append(n % 10)
n //= 10
# Return the mask.
return b
# Inp... | def split(n):
b = []
while n > 0:
if n % 10 == 4 or n % 10 == 7:
b.append(n % 10)
n //= 10
return b
(x, y) = [int(x) for x in input().split()]
a = split(y)
for i in range(x + 1, 1000000):
if split(i) == a:
print(i)
break |
## Model parameters
model_hidden_size = 256
model_embedding_size = 256
model_num_layers = 3
## Training parameters
learning_rate_init = 1e-4
#speakers_per_batch = 64
speakers_per_batch = 128
utterances_per_speaker = 10
| model_hidden_size = 256
model_embedding_size = 256
model_num_layers = 3
learning_rate_init = 0.0001
speakers_per_batch = 128
utterances_per_speaker = 10 |
fyrst_number = int(input())
second_number = int(input())
third_number = int(input())
if fyrst_number > second_number and fyrst_number > third_number:
print(fyrst_number)
elif second_number > fyrst_number and second_number > third_number:
print(second_number)
else:
print(third_number)
| fyrst_number = int(input())
second_number = int(input())
third_number = int(input())
if fyrst_number > second_number and fyrst_number > third_number:
print(fyrst_number)
elif second_number > fyrst_number and second_number > third_number:
print(second_number)
else:
print(third_number) |
s1 = input().upper()
s2 = input().upper()
def sol(s1, s2):
i = 0
while i < len(s1):
if ord(s1[i]) < ord(s2[i]):
return -1
elif ord(s1[i]) > ord(s2[i]):
return 1
i += 1
return 0
print(sol(s1, s2)) | s1 = input().upper()
s2 = input().upper()
def sol(s1, s2):
i = 0
while i < len(s1):
if ord(s1[i]) < ord(s2[i]):
return -1
elif ord(s1[i]) > ord(s2[i]):
return 1
i += 1
return 0
print(sol(s1, s2)) |
lexy_copts = select({
"@bazel_tools//src/conditions:windows": ["/std:c++latest"],
"@bazel_tools//src/conditions:windows_msvc": ["/std:c++latest"],
"//conditions:default": ["-std=c++20"],
})
| lexy_copts = select({'@bazel_tools//src/conditions:windows': ['/std:c++latest'], '@bazel_tools//src/conditions:windows_msvc': ['/std:c++latest'], '//conditions:default': ['-std=c++20']}) |
class URLInfo:
def __init__(self, domain, subject):
self.domain = domain
self.subject = subject
def __str__(self):
result = ""
result += f"domain: {self.domain}\n"
result += f"subject: {self.subject}\n"
return result
| class Urlinfo:
def __init__(self, domain, subject):
self.domain = domain
self.subject = subject
def __str__(self):
result = ''
result += f'domain: {self.domain}\n'
result += f'subject: {self.subject}\n'
return result |
def insertion_sorting(input_array):
for i in range(len(input_array)):
value, position = input_array[i], i
while position > 0 and input_array[position-1] > value:
input_array[position] = input_array[position - 1]
position = position - 1
input_array[position] = value
... | def insertion_sorting(input_array):
for i in range(len(input_array)):
(value, position) = (input_array[i], i)
while position > 0 and input_array[position - 1] > value:
input_array[position] = input_array[position - 1]
position = position - 1
input_array[position] = va... |
A=[3,5,7]
B=[1,8]
C=[]
counter=0
while len(A)>0 and len(B)>0:
if A[0] <= B[0]:
C[counter]=A[0]
A=A[1:]
counter=counter+1
else:
C[counter]=B[0]
B=B[1:]
counter=counter+1
print(C)
| a = [3, 5, 7]
b = [1, 8]
c = []
counter = 0
while len(A) > 0 and len(B) > 0:
if A[0] <= B[0]:
C[counter] = A[0]
a = A[1:]
counter = counter + 1
else:
C[counter] = B[0]
b = B[1:]
counter = counter + 1
print(C) |
name = str(input('digite seu name: ')).upper()
if name == 'LUZIA':
print(f'{name} good night')
else:
print(f'hello {name}')
| name = str(input('digite seu name: ')).upper()
if name == 'LUZIA':
print(f'{name} good night')
else:
print(f'hello {name}') |
# All participants who ranked A-th or higher get a T-shirt.
# Additionally, from the participants who ranked between
# (A+1)-th and B-th (inclusive), C participants chosen uniformly at random get a T-shirt.
A, B, C, X = map(int, input().split())
if(X <= A):
print(1.000000000000)
elif(X > A and X <= B):
print(... | (a, b, c, x) = map(int, input().split())
if X <= A:
print(1.0)
elif X > A and X <= B:
print(C / (B - A))
else:
print(0.0) |
cifar10_config = {
'num_clients': 100,
'model_name': 'Cifar10Net', # Model type
'round': 1000,
'save_period': 200,
'weight_decay': 1e-3,
'batch_size': 50,
'test_batch_size': 256, # no this param in official code
'lr_decay_per_round': 1,
'epochs': 5,
'lr': 0.1,
'print_freq':... | cifar10_config = {'num_clients': 100, 'model_name': 'Cifar10Net', 'round': 1000, 'save_period': 200, 'weight_decay': 0.001, 'batch_size': 50, 'test_batch_size': 256, 'lr_decay_per_round': 1, 'epochs': 5, 'lr': 0.1, 'print_freq': 5, 'alpha_coef': 0.01, 'max_norm': 10, 'sample_ratio': 1, 'partition': 'iid', 'dataset': 'c... |
# OpenWeatherMap API Key
weather_api_key = "9cfaeb3dbd4832137f0fb5f0e12ca0f4"
# Google API Key
g_key = "AIzaSyBwiWBdcMksrxnWzcOvCM1cjxhqV8017_A"
| weather_api_key = '9cfaeb3dbd4832137f0fb5f0e12ca0f4'
g_key = 'AIzaSyBwiWBdcMksrxnWzcOvCM1cjxhqV8017_A' |
class Shape:
def __init__(self):
pass
def area(self):
return 0
class Square(Shape):
def __init__(self, length):
self.length = length
def area(self):
return self.length * self.length
unittest = Square(88)
print(unittest.area())
unittest2 = Shape()
print((unittest2.area... | class Shape:
def __init__(self):
pass
def area(self):
return 0
class Square(Shape):
def __init__(self, length):
self.length = length
def area(self):
return self.length * self.length
unittest = square(88)
print(unittest.area())
unittest2 = shape()
print(unittest2.area... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.