content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
def moneyput(text):
valid = False
while not valid:
input_ = input(text).replace(',', '.').strip()
if input_.isalpha() or input_ == '':
print('\033[31mERROR! Value not monetary.\033[m')
else:
valid = True
return float(input_)
def floatput(text):
"... | def moneyput(text):
valid = False
while not valid:
input_ = input(text).replace(',', '.').strip()
if input_.isalpha() or input_ == '':
print('\x1b[31mERROR! Value not monetary.\x1b[m')
else:
valid = True
return float(input_)
def floatput(text):
""... |
class Solution:
def minOperations(self, nums: List[int]) -> int:
cm = nums[0]
i = 1
ops = 0
while i < len(nums):
if nums[i] > cm:
cm = nums[i]
i += 1
else:
cm += 1
ops += cm - num... | class Solution:
def min_operations(self, nums: List[int]) -> int:
cm = nums[0]
i = 1
ops = 0
while i < len(nums):
if nums[i] > cm:
cm = nums[i]
i += 1
else:
cm += 1
ops += cm - nums[i]
... |
r = range(0, 30)
print(type(r))
print(type(10))
print(type('a'))
print(type("Hi there"))
class Car:
pass
class Truck():
pass
c = Car()
convert = Car()
t = Truck()
print(type(c))
print(type(t))
print(type(c) == type(t))
print(type(c) == type(convert))
print(isinstance(c, Car))
print(isinstance(t, Car))
if i... | r = range(0, 30)
print(type(r))
print(type(10))
print(type('a'))
print(type('Hi there'))
class Car:
pass
class Truck:
pass
c = car()
convert = car()
t = truck()
print(type(c))
print(type(t))
print(type(c) == type(t))
print(type(c) == type(convert))
print(isinstance(c, Car))
print(isinstance(t, Car))
if isinst... |
# -*- coding: utf-8 -*-
""" anydo.lib.error """
class AnyDoAPIBinderError(Exception):
"""An AnyDoAPIBinder error occured."""
def __init__(self, msg):
super(AnyDoAPIBinderError, self).__init__(msg)
self.msg = msg
def __str__(self):
return self.msg
| """ anydo.lib.error """
class Anydoapibindererror(Exception):
"""An AnyDoAPIBinder error occured."""
def __init__(self, msg):
super(AnyDoAPIBinderError, self).__init__(msg)
self.msg = msg
def __str__(self):
return self.msg |
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def swapPairs(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
# dummy data at the beginning of h... | class Solution(object):
def swap_pairs(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
prev = list_node(0)
curr = head
new_head = next_node = head.next
while curr.next is not None:
temp = next_node.next
next_node.nex... |
# -*- coding: utf-8 -*-
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
},
}
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'TIMEOUT': 36000,
'KEY_PREFIX': 'post-office',
},
'post_office': {
'BACKEND'... | databases = {'default': {'ENGINE': 'django.db.backends.sqlite3'}}
caches = {'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', 'TIMEOUT': 36000, 'KEY_PREFIX': 'post-office'}, 'post_office': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', 'TIMEOUT': 36000, 'KEY_PREFIX': 'post-office'}}
... |
b, n, m = map(int, input().split())
keyboards = list(map(int, input().rstrip().split()))
drives = list(map(int, input().rstrip().split()))
most_expensive = -1
for i in range(len(keyboards)):
for j in range(len(drives)):
if most_expensive < keyboards[i]+drives[j] and keyboards[i]+drives[j] <= b:
... | (b, n, m) = map(int, input().split())
keyboards = list(map(int, input().rstrip().split()))
drives = list(map(int, input().rstrip().split()))
most_expensive = -1
for i in range(len(keyboards)):
for j in range(len(drives)):
if most_expensive < keyboards[i] + drives[j] and keyboards[i] + drives[j] <= b:
... |
"""
This is a cost that's able to train the circuit when the output is a measurement of a swap test.
"""
def fid_func(output):
# Implemented as the Fidelity Loss
# output[0] because we take the probability that the state after the
# SWAP test is ket(0), like the reference state
fidelity_loss = 1 / out... | """
This is a cost that's able to train the circuit when the output is a measurement of a swap test.
"""
def fid_func(output):
fidelity_loss = 1 / output[0]
return fidelity_loss
def sw_cost(encoder_params, input_data, circuit, reinit_state=None):
"""
:encoder parameters:
:X:
"""
loss = 0.... |
module_var = 12
def module_function():
print(module_var)
# module_var = 13
# print(module_var)
class MyClass():
def method(self):
print(module_var)
# module_var = 13
# print(module_var)
"""
-> As long as access to a module variable is only reading, it can be accessed
just ... | module_var = 12
def module_function():
print(module_var)
class Myclass:
def method(self):
print(module_var)
"\n-> As long as access to a module variable is only reading, it can be accessed \njust fine. But if access is writing within the function, the variable is \nconsidered local. If you want writi... |
clothes_in_the_box = [int(_)for _ in input().split()]
rack_capacity = int(input())
rack_count = 0
while len(clothes_in_the_box) > 0:
current_rack = 0
while current_rack <= rack_capacity:
current_clothes = clothes_in_the_box[-1]
if current_rack + current_clothes <= rack_capacity:
cu... | clothes_in_the_box = [int(_) for _ in input().split()]
rack_capacity = int(input())
rack_count = 0
while len(clothes_in_the_box) > 0:
current_rack = 0
while current_rack <= rack_capacity:
current_clothes = clothes_in_the_box[-1]
if current_rack + current_clothes <= rack_capacity:
cur... |
INPUT = [
"FBFFBFFRLL",
"BFFBFBBLRR",
"FFFBFBFLLR",
"BBFFFBBRRR",
"FBFFFFBLLR",
"BFFFFBFRLL",
"FBBFFBBRRL",
"BFBBBBFLLR",
"BBBFFFBLLL",
"BBFFFBBLRL",
"FFFBFFFLRL",
"FFBFBBBLRL",
"FFFBBBBLRL",
"BFFBBBFRLR",
"FBFFBFBLLR",
"BBBFBBFLRL",
"BFFBBFBLLR",
... | input = ['FBFFBFFRLL', 'BFFBFBBLRR', 'FFFBFBFLLR', 'BBFFFBBRRR', 'FBFFFFBLLR', 'BFFFFBFRLL', 'FBBFFBBRRL', 'BFBBBBFLLR', 'BBBFFFBLLL', 'BBFFFBBLRL', 'FFFBFFFLRL', 'FFBFBBBLRL', 'FFFBBBBLRL', 'BFFBBBFRLR', 'FBFFBFBLLR', 'BBBFBBFLRL', 'BFFBBFBLLR', 'FBBFBFFRRL', 'FBFFBBFLLL', 'BFBFFBBRLL', 'FBBFFBFRLR', 'BFFFFFBLLL', 'FB... |
#!usr/bin/env python
a="Vivo en Madrid"
for i in a:
print(i)
| a = 'Vivo en Madrid'
for i in a:
print(i) |
def sum(x,y):
total=x+y
print(total)
a=3
b=6
operation = sum
print(operation(a,b))
| def sum(x, y):
total = x + y
print(total)
a = 3
b = 6
operation = sum
print(operation(a, b)) |
'''
Give an example of a software application in which adaptability can mean
the difference between a prolonged lifetime of sales and bankruptcy
The point of sales system that wont be able to change tax rate
''' | """
Give an example of a software application in which adaptability can mean
the difference between a prolonged lifetime of sales and bankruptcy
The point of sales system that wont be able to change tax rate
""" |
def function_scope():
number1 = 56
string1 = "Hello, I am scoped string1 variable in side function"
print("I am local number1 variable inside function: " + str(number1))
print(string1)
number1 = 24
string1 = "Hello, I am global string1 variable"
print("I am global number1 variable : " + str(number1)... | def function_scope():
number1 = 56
string1 = 'Hello, I am scoped string1 variable in side function'
print('I am local number1 variable inside function: ' + str(number1))
print(string1)
number1 = 24
string1 = 'Hello, I am global string1 variable'
print('I am global number1 variable : ' + str(number1))
pr... |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode:
"""
Assume there is an intersection, the distance between
headA ... | class Solution:
def get_intersection_node(self, headA: ListNode, headB: ListNode) -> ListNode:
"""
Assume there is an intersection, the distance between
headA to intersection is m1, headB to intersection is m2,
the rest distance is n
Make the first pointer start at headA, a... |
#
# PySNMP MIB module TIMETRA-SAS-SYSTEM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TIMETRA-SAS-SYSTEM-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:15:00 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_range_constraint, single_value_constraint, value_size_constraint, constraints_intersection) ... |
TEXT = 'TX'
MARKDOWN = 'MD'
HTML = 'HT'
FORMATS = (
(MARKDOWN, 'Markdown'),
(TEXT, 'Plain text'),
(HTML, 'HTML')
)
DEFAULT = MARKDOWN
| text = 'TX'
markdown = 'MD'
html = 'HT'
formats = ((MARKDOWN, 'Markdown'), (TEXT, 'Plain text'), (HTML, 'HTML'))
default = MARKDOWN |
#!/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
# EASY-INSTALL-SCRIPT: 'Pillow==2.8.1','pilfont.py'
__requires__ = 'Pillow==2.8.1'
__import__('pkg_resources').run_script('Pillow==2.8.1', 'pilfont.py')
| __requires__ = 'Pillow==2.8.1'
__import__('pkg_resources').run_script('Pillow==2.8.1', 'pilfont.py') |
begin_unit
comment|'# Licensed under the Apache License, Version 2.0 (the "License"); you may'
nl|'\n'
comment|'# not use this file except in compliance with the License. You may obtain'
nl|'\n'
comment|'# a copy of the License at'
nl|'\n'
comment|'#'
nl|'\n'
comment|'# http://www.apache.org/licenses/L... | begin_unit
comment | '# Licensed under the Apache License, Version 2.0 (the "License"); you may'
nl | '\n'
comment | '# not use this file except in compliance with the License. You may obtain'
nl | '\n'
comment | '# a copy of the License at'
nl | '\n'
comment | '#'
nl | '\n'
comment | '# http://www.apa... |
sample = ['bob', 7, 'joe']
test = "BOB"
print("joe" not in sample)
print(test.lower() in sample)
print(3 > 1 and 2*3 == 5)
print(2<=1 or 3-2 == 1)
| sample = ['bob', 7, 'joe']
test = 'BOB'
print('joe' not in sample)
print(test.lower() in sample)
print(3 > 1 and 2 * 3 == 5)
print(2 <= 1 or 3 - 2 == 1) |
#!/usr/bin/env python3
# HAGrid Version
__version__ = "0.1.8"
if __name__ == "__main__":
print(__version__)
| __version__ = '0.1.8'
if __name__ == '__main__':
print(__version__) |
'''
Rock, Paper, Scissors
'''
print('Hell and welcome to the rock, paper, scissors game!')
| """
Rock, Paper, Scissors
"""
print('Hell and welcome to the rock, paper, scissors game!') |
# FLOW014
for i in range(int(input())):
h,c,t=map(float,input().split())
if h>50 and c<0.7 and t>5600: print("10")
elif h>50 and c<0.7: print("9")
elif c<0.7 and t>5600: print("8")
elif h>50 and t>5600: print("7")
elif h>50 or c<0.7 or t>5600: print("6")
else: print("5") | for i in range(int(input())):
(h, c, t) = map(float, input().split())
if h > 50 and c < 0.7 and (t > 5600):
print('10')
elif h > 50 and c < 0.7:
print('9')
elif c < 0.7 and t > 5600:
print('8')
elif h > 50 and t > 5600:
print('7')
elif h > 50 or c < 0.7 or t > 560... |
class C:
def f(self): pass
f1 = C.f
c = C()
f2 = c.f
| class C:
def f(self):
pass
f1 = C.f
c = c()
f2 = c.f |
# Your Datadog API Key
API_KEY = ""
# Your Datadog Application Key
APP_KEY = ""
# A list of metric names, values should match metrics present in your account
METRICS_TO_EVAL = ["system.cpu.user", "system.disk.in_use"]
### ADVANCED CONFIGS
# the filename where dashboard api responses are stored to avoid duplicate re... | api_key = ''
app_key = ''
metrics_to_eval = ['system.cpu.user', 'system.disk.in_use']
db_cache_path = 'db_cache.txt'
json_output_path = 'results/report.json'
csv_output_path = 'results/report.csv'
markdown_output_path = 'results/report.md' |
the_count = [1, 2, 3, 4, 5]
fruits = ['apples', 'oranges', 'pears', 'apricots']
change = [1, 'pennies', 2, 'dimes', 3, 'quarters']
# this first kind of for-loop goes through a list
for number in the_count:
print(f"This is count {number}")
# same as above
for fruit in fruits:
print(f"A fruit of type: {fruit}"... | the_count = [1, 2, 3, 4, 5]
fruits = ['apples', 'oranges', 'pears', 'apricots']
change = [1, 'pennies', 2, 'dimes', 3, 'quarters']
for number in the_count:
print(f'This is count {number}')
for fruit in fruits:
print(f'A fruit of type: {fruit}')
for i in change:
print(f'I got {i}')
elements = []
for i in ran... |
__all__ = ['MQTT_API_KEY',
'MQTT_WRITE_API_KEY',
'CHANNEL',
'wifi_ssid',
'wifi_pw']
MQTT_API_KEY = ""
MQTT_WRITE_API_KEY = ""
CHANNEL = ""
wifi_ssid = ''
wifi_pw = ''
| __all__ = ['MQTT_API_KEY', 'MQTT_WRITE_API_KEY', 'CHANNEL', 'wifi_ssid', 'wifi_pw']
mqtt_api_key = ''
mqtt_write_api_key = ''
channel = ''
wifi_ssid = ''
wifi_pw = '' |
class Settings:
def __init__(self):
"""Stores all the settings"""
# Weather settings
self.WEATHER_TOKEN = 'AEelEAvZsbohTPic5CXFS2hXaL1QUatV'
self.weather_language = 'de-de'
self.weather_city = 'Brixen'
# data settings
self.directory_path = 'weather_data'
... | class Settings:
def __init__(self):
"""Stores all the settings"""
self.WEATHER_TOKEN = 'AEelEAvZsbohTPic5CXFS2hXaL1QUatV'
self.weather_language = 'de-de'
self.weather_city = 'Brixen'
self.directory_path = 'weather_data'
self.csv_file = 'weatherdata.csv' |
# this segment tree will support two operations:
# 1. apply min or max with value h on interval [r, v)
# 2. find min of elements in interval [r, l)
# For our lazy updates we will keep pairs [h_max, h_min], where
# operation max was applied with h_max and min with h_min. It can be proven
# that we always can keep pairs ... | class Segmenttree:
def __init__(self, N):
self.N = N
self.H = 1
while 1 << self.H < N:
self.H += 1
self.size = 1 << self.H
self.ZERO = float('inf')
self.NO_OPERATION = (1, 0)
self.T = [0] * (2 * self.size - 1)
self.L = [self.NO_OPERATION] ... |
zbr = "bar"
assert zbr
| zbr = 'bar'
assert zbr |
class Solution:
"""
@param a: An integer
@param b: An integer
@return: The sum of a and b
"""
def aplusb(self, a, b):
# write your code here
return a + b
| class Solution:
"""
@param a: An integer
@param b: An integer
@return: The sum of a and b
"""
def aplusb(self, a, b):
return a + b |
DEFAULT_STATUS_CODE = 400
DB_DEFAULT_STATUS_CODE = 500
NOT_FOUNT_STATUS_CODE = 404
UNAUTHORIZED_STATUS_CODE = 401
DB_NAME = "users"
DB_USER = "root"
DB_PASSWORD = "test123"
| default_status_code = 400
db_default_status_code = 500
not_fount_status_code = 404
unauthorized_status_code = 401
db_name = 'users'
db_user = 'root'
db_password = 'test123' |
class Node(object):
def __init__(self, data, prev, next):
self.data = data
self.prev = prev
self.next = next
class ListOne(object):
head = None
tail = None
size = 0
def display(self):
current_node = self.head
while current_node is not None:
pri... | class Node(object):
def __init__(self, data, prev, next):
self.data = data
self.prev = prev
self.next = next
class Listone(object):
head = None
tail = None
size = 0
def display(self):
current_node = self.head
while current_node is not None:
prin... |
"""
/*
A crew of N players played a game for one time, and got some scores.
They have to stand in the same positions after they played the game.
There is a constraint that, the player-K score, should not be greater or smaller
than both of his neighbors.
To achieve this constraint, there are few steps to be followed a... | """
/*
A crew of N players played a game for one time, and got some scores.
They have to stand in the same positions after they played the game.
There is a constraint that, the player-K score, should not be greater or smaller
than both of his neighbors.
To achieve this constraint, there are few steps to be followed a... |
class UserPlofile:
dir_path = 'user_plofile'
class ColabPath:
train = 'https://colab.research.google.com/drive/1padoMj3dW0lr9nkko2384XXXD37dVhDE'
evacuate = 'https://colab.research.google.com/drive/1idRwx4c_5PcxpLmj0ZIyIG9BaLXnQAS8'
| class Userplofile:
dir_path = 'user_plofile'
class Colabpath:
train = 'https://colab.research.google.com/drive/1padoMj3dW0lr9nkko2384XXXD37dVhDE'
evacuate = 'https://colab.research.google.com/drive/1idRwx4c_5PcxpLmj0ZIyIG9BaLXnQAS8' |
def func(arg, **kwargs):
"""main docstring. (only document this description!)"""
return 1
class A:
def foo(self, s):
return
| def func(arg, **kwargs):
"""main docstring. (only document this description!)"""
return 1
class A:
def foo(self, s):
return |
class Actor:
def __init__(self, actor_full_name: str):
if actor_full_name == "" or type(actor_full_name) is not str:
self.full_name = None
else:
self.full_name = actor_full_name.strip()
self.colleagues = []
def __repr__(self):
return f"<Actor {self.full_... | class Actor:
def __init__(self, actor_full_name: str):
if actor_full_name == '' or type(actor_full_name) is not str:
self.full_name = None
else:
self.full_name = actor_full_name.strip()
self.colleagues = []
def __repr__(self):
return f'<Actor {self.full_... |
"""
1273. Delete Tree Nodes
Medium
A tree rooted at node 0 is given as follows:
The number of nodes is nodes;
The value of the i-th node is value[i];
The parent of the i-th node is parent[i].
Remove every subtree whose sum of values of nodes is zero.
After doing so, return the number of nodes remaining in the tree.
... | """
1273. Delete Tree Nodes
Medium
A tree rooted at node 0 is given as follows:
The number of nodes is nodes;
The value of the i-th node is value[i];
The parent of the i-th node is parent[i].
Remove every subtree whose sum of values of nodes is zero.
After doing so, return the number of nodes remaining in the tree.
... |
'''
Python program to calculate body mass index
'''
height = float(input("Input your height in Feet: "))
weight = float(input("Input your weight in Kilogram: "))
print("Your body mass index is: ", round(weight / (height ** 2), 2))
| """
Python program to calculate body mass index
"""
height = float(input('Input your height in Feet: '))
weight = float(input('Input your weight in Kilogram: '))
print('Your body mass index is: ', round(weight / height ** 2, 2)) |
def superCalc(n1, n2):
print(n1 + n2)
print(n1 - n2)
print(n1 * n2)
print(n1 / n2)
n1 = int(input("enter n1: "))
n2 = int(input("enter n2: "))
superCalc(n1, n2)
| def super_calc(n1, n2):
print(n1 + n2)
print(n1 - n2)
print(n1 * n2)
print(n1 / n2)
n1 = int(input('enter n1: '))
n2 = int(input('enter n2: '))
super_calc(n1, n2) |
i = 2
a, b = 1, 1
while True:
c = a + b
a = b
b = c
i = i + 1
if len(str(c)) == 1000:
print(c)
break
print(i) | i = 2
(a, b) = (1, 1)
while True:
c = a + b
a = b
b = c
i = i + 1
if len(str(c)) == 1000:
print(c)
break
print(i) |
def twoStacks(x, a, b):
score = 0
total = 0
while total < x:
if a != [] and b != []:
if a[0] < b[0]:
if total+a[0] < x:
total += a.pop(0)
score += 1
else:
break
else:
i... | def two_stacks(x, a, b):
score = 0
total = 0
while total < x:
if a != [] and b != []:
if a[0] < b[0]:
if total + a[0] < x:
total += a.pop(0)
score += 1
else:
break
elif total + b[0] < ... |
"""
1,2,9 9,2,1
1,3,8 8,3,1
1,4,7 7,4,1
1,5,6 6,5,1
2,8,2
2,3,7 7,3,2
2,4,6 6,4,2
5,2,5
3,6,3
3,4,5 ... | """
1,2,9 9,2,1
1,3,8 8,3,1
1,4,7 7,4,1
1,5,6 6,5,1
2,8,2
2,3,7 7,3,2
2,4,6 6,4,2
5,2,5
3,6,3
3,4,5 ... |
class Parser(object):
"""
The base class for all parsers.
"""
def __init__(self, token_list):
self.token_list = token_list
self._reset()
def _reset(self):
self.offset = 0
self.line = 0
self.error = ''
def _get_next_token(self):
if len(self.input... | class Parser(object):
"""
The base class for all parsers.
"""
def __init__(self, token_list):
self.token_list = token_list
self._reset()
def _reset(self):
self.offset = 0
self.line = 0
self.error = ''
def _get_next_token(self):
if len(self.input... |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
INCLUDES = """
#include <openssl/ecdsa.h>
"""
TYPES = """
"""
FUNCTIONS = """
int ECDSA_sign(int, const unsigned char *, int, unsigned c... | includes = '\n#include <openssl/ecdsa.h>\n'
types = '\n'
functions = '\nint ECDSA_sign(int, const unsigned char *, int, unsigned char *,\n unsigned int *, EC_KEY *);\nint ECDSA_verify(int, const unsigned char *, int, const unsigned char *, int,\n EC_KEY *);\nint ECDSA_size(const EC_KEY *);... |
def getCensusPoints(sf, show=False):
fields = sf.fields
if show:
print("Fields -> {0}".format(fields))
ipop=None
for i,val in enumerate(fields):
if val[0] == "DP0010001":
ipop = i-1
break
ihouse=None
for i,val in enumerate(fields):
if val[0] ... | def get_census_points(sf, show=False):
fields = sf.fields
if show:
print('Fields -> {0}'.format(fields))
ipop = None
for (i, val) in enumerate(fields):
if val[0] == 'DP0010001':
ipop = i - 1
break
ihouse = None
for (i, val) in enumerate(fields):
if... |
# Copyright 2018 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# These devices are ina3221 (3-channels/i2c address) devices
inas = [
# drvname, child, name, nom, sense, mux, is_calib
('in... | inas = [('ina3221', '0x40:0', 'pp3300_a', 3.3, 0.02, 'rem', True), ('ina3221', '0x40:1', 'pp5000_a', 5.0, 0.02, 'rem', True), ('ina3221', '0x40:2', 'pp1800_a', 1.8, 0.02, 'rem', True), ('ina3221', '0x41:0', 'pp1200_vddq', 1.2, 0.005, 'rem', True), ('ina3221', '0x41:1', 'ppvar_vddcr_nb', 0.875, 0.005, 'rem', True), ('in... |
for _ in range(int(input())):
n,m=input().split()
n,m=int(n),int(m)
green='G'
red='R'
gcost=3
rcost=5
arr=[]
array1=[]
array2=[]
gcheck=[]
rcheck=[]
i=0
while(i<m):
if(i%2==1):
array1.append(red)
array2.append(green)
else:
... | for _ in range(int(input())):
(n, m) = input().split()
(n, m) = (int(n), int(m))
green = 'G'
red = 'R'
gcost = 3
rcost = 5
arr = []
array1 = []
array2 = []
gcheck = []
rcheck = []
i = 0
while i < m:
if i % 2 == 1:
array1.append(red)
arr... |
# Solution to part 2 of day 3 of AOC 2020, Toboggan Trajectory.
# https://adventofcode.com/2020/day/3
f = open('input.txt')
whole_text = (f.read())
grid = whole_text.split() # Split string by any whitespace.
tree_product = 1
for delta_x, delta_y in [(1, 1), (3, 1), (5, 1), (7, 1), (1, ... | f = open('input.txt')
whole_text = f.read()
grid = whole_text.split()
tree_product = 1
for (delta_x, delta_y) in [(1, 1), (3, 1), (5, 1), (7, 1), (1, 2)]:
row_num = 0
col_num = 0
trees = 0
for this_row in grid[::delta_y]:
if row_num != 0:
if this_row[col_num] == '#':
... |
# We want make a package of goal kilos of chocolate.
# We have small bars (1 kilo each) and big bars (5 kilos each).
# Return the number of small bars to use,
# assuming we always use big bars before small bars.
# Return -1 if it can't be done.
def make_chocolate(small, big, goal):
needed = goal - big * 5
... | def make_chocolate(small, big, goal):
needed = goal - big * 5
if needed > 0:
return small
elif needed == 0:
return small
elif needed < 0:
return goal % 5
else:
-1
x = make_chocolate(4, 5, 9)
print(x) |
# Copyright 2015 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Copyright 2015 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# GYP file for codec project.
{
'targets': [
{
... | {'targets': [{'target_name': 'codec', 'product_name': 'skia_codec', 'type': 'static_library', 'standalone_static_library': 1, 'dependencies': ['core.gyp:*', 'giflib.gyp:giflib', 'libjpeg-turbo-selector.gyp:libjpeg-turbo-selector', 'libpng.gyp:libpng', 'libwebp.gyp:libwebp'], 'cflags': ['-Wno-clobbered -Wno-error'], 'in... |
"""
Scoped CSS Styles for the graphs page
"""
PAGE_STYLE = {
"paddingBottom": "5em"
}
TITLE_STYLE = {
"margin": "0.5em"
}
CHART_ITEM_STYLE = {
"margin": "2em",
}
| """
Scoped CSS Styles for the graphs page
"""
page_style = {'paddingBottom': '5em'}
title_style = {'margin': '0.5em'}
chart_item_style = {'margin': '2em'} |
class DeckNotFoundError(Exception):
'''No deck with given id.'''
class CardNotFoundError(Exception):
'''No card with given id.'''
class CardAlreadyExists(Exception):
'''There is a card with the same question.'''
| class Decknotfounderror(Exception):
"""No deck with given id."""
class Cardnotfounderror(Exception):
"""No card with given id."""
class Cardalreadyexists(Exception):
"""There is a card with the same question.""" |
print("THIS CODE IS SHIT AND MAKES THE DATA 30% BIGGER")
print("read the comment below to get the idea")
exit()
##
#
# This script groups repetitions of characters
#
# methode:
# encode the character and repetitions into 4bit as following:
# 0bXXYY where
# XX=number of repetitions: 0b00=1, 0b01=2, 0b10=3, 0b11=4
# Y... | print('THIS CODE IS SHIT AND MAKES THE DATA 30% BIGGER')
print('read the comment below to get the idea')
exit()
input_file = open('moderna_sequence_raw.fasta', 'r')
characters = input_file.read()
characters.replace('\n', '')
input_file.close()
length_total = len(characters)
print(length_total)
print('compress:')
i = 0
... |
'''
implement Pascal's triangle by using generator
1
/ \
1 1
/ \ / \
1 2 1
/ \ / \ / \
1 3 3 1
/ \ / \ / \ / \
1 4 6 4 1
/ \ / \ / \ / \ / \
1 5 10 10 5 1
https://en.wikipedia.org/wiki/Pascal%27s_triangle
'''
def triangles(n, line_num... | """
implement Pascal's triangle by using generator
1
/ 1 1
/ \\ / 1 2 1
/ \\ / \\ / 1 3 3 1
/ \\ / \\ / \\ / 1 4 6 4 1
/ \\ / \\ / \\ / \\ / 1 5 10 10 5 1
https://en.wikipedia.org/wiki/Pascal%27s_triangle
"""
def triangles(n, line_num... |
# Helper function to get the stop sign performance with moving left.
def StopSignLeft(stopPlace, flag, x, y, Speed, prev_perf):
place = stopPlace[1][0]
Boundary1 = [[stopPlace[0][0], stopPlace[0][1]], [place-13, place-3]]
Boundary2 = [[stopPlace[0][0], stopPlace[0][1]], [place-36, place-26]]
Boundary3 ... | def stop_sign_left(stopPlace, flag, x, y, Speed, prev_perf):
place = stopPlace[1][0]
boundary1 = [[stopPlace[0][0], stopPlace[0][1]], [place - 13, place - 3]]
boundary2 = [[stopPlace[0][0], stopPlace[0][1]], [place - 36, place - 26]]
boundary3 = [[stopPlace[0][0], stopPlace[0][1]], [place - 51, place - ... |
"""Classed and methods for comparing expected and published items in DBs"""
class DBAssert:
@classmethod
def count_of_types(cls, dbcon, queried_type, expected, **kwargs):
"""Queries 'dbcon' and counts documents of type 'queried_type'
Args:
dbcon (AvalonMongoDB)
... | """Classed and methods for comparing expected and published items in DBs"""
class Dbassert:
@classmethod
def count_of_types(cls, dbcon, queried_type, expected, **kwargs):
"""Queries 'dbcon' and counts documents of type 'queried_type'
Args:
dbcon (AvalonMongoDB)
... |
''' Day 5: Sunny with a Chance of Asteroids '''
def parse_intcode(intcode, input):
i = 0
while i < len(intcode):
if intcode[i] not in (1, 2, 3, 4, 5, 6, 7, 8, 99):
instruction = int(str(intcode[i])[-2:])
if instruction in (1, 2, 4, 5, 6, 7, 8):
param = list()
... | """ Day 5: Sunny with a Chance of Asteroids """
def parse_intcode(intcode, input):
i = 0
while i < len(intcode):
if intcode[i] not in (1, 2, 3, 4, 5, 6, 7, 8, 99):
instruction = int(str(intcode[i])[-2:])
if instruction in (1, 2, 4, 5, 6, 7, 8):
param = list()
... |
"""
Module for jenkinsapi Plugin
"""
class Plugin(object):
"""
Plugin class
"""
def __init__(self, plugin_dict):
assert(isinstance(plugin_dict, dict))
self.__dict__ = plugin_dict
def __eq__(self, other):
return self.__dict__ == other.__dict__
| """
Module for jenkinsapi Plugin
"""
class Plugin(object):
"""
Plugin class
"""
def __init__(self, plugin_dict):
assert isinstance(plugin_dict, dict)
self.__dict__ = plugin_dict
def __eq__(self, other):
return self.__dict__ == other.__dict__ |
number_of_cards = int(input())
cards_values = list(map(int, input().split()))
i = 0
j = number_of_cards - 1
k = 0
scores = [0, 0]
while i <= j:
if cards_values[i] > cards_values[j]:
scores[k % 2] += cards_values[i]
i += 1
k += 1
else:
scores[k % 2] += cards_values[j]
... | number_of_cards = int(input())
cards_values = list(map(int, input().split()))
i = 0
j = number_of_cards - 1
k = 0
scores = [0, 0]
while i <= j:
if cards_values[i] > cards_values[j]:
scores[k % 2] += cards_values[i]
i += 1
k += 1
else:
scores[k % 2] += cards_values[j]
j -=... |
# parsetab.py
# This file is automatically generated. Do not edit.
_tabversion = '3.2'
_lr_method = 'LALR'
_lr_signature = '8HR\xee\xd8K\xc1gX\xbc\x8cr\x1fy\xf4#'
_lr_action_items = {'PEEK':([115,157,159,173,202,225,257,315,330,334,356,358,359,360,362,366,367,],[142,142,-90,-75,-74,-81,-89,-82,-87,-91,-83,-85,-... | _tabversion = '3.2'
_lr_method = 'LALR'
_lr_signature = '8HRîØKÁgX¼\x8cr\x1fyô#'
_lr_action_items = {'PEEK': ([115, 157, 159, 173, 202, 225, 257, 315, 330, 334, 356, 358, 359, 360, 362, 366, 367], [142, 142, -90, -75, -74, -81, -89, -82, -87, -91, -83, -85, -92, -93, -86, -84, -88]), 'STAR': ([4, 19, 21, 57, 72, 144, 1... |
"""
Copyright 2018-present, Facebook, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,... | """
Copyright 2018-present, Facebook, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,... |
def for_R():
"""We are creating user defined function for alphabetical pattern of capital R with "*" symbol"""
row=7
col=5
for i in range(row):
for j in range(col):
if j==0 or ((i==0 or i==3)and j<4) or j==4 and i>0 and i<3 or i-j==2:
print("*",end=" ")
... | def for_r():
"""We are creating user defined function for alphabetical pattern of capital R with "*" symbol"""
row = 7
col = 5
for i in range(row):
for j in range(col):
if j == 0 or ((i == 0 or i == 3) and j < 4) or (j == 4 and i > 0 and (i < 3)) or (i - j == 2):
prin... |
if person.bored():
x = [0]
for j in range(100):
step_x = random.randint(0,1)
if step_x == 1:
x.append(x[j] + 1 + 0.05*np.random.normal())
else:
x.append(x[j] - 1 + 0.05*np.random.normal())
y = [0.05*np.random.normal() for j in range(len(x))]
trace1 = go.Scatter(
x=... | if person.bored():
x = [0]
for j in range(100):
step_x = random.randint(0, 1)
if step_x == 1:
x.append(x[j] + 1 + 0.05 * np.random.normal())
else:
x.append(x[j] - 1 + 0.05 * np.random.normal())
y = [0.05 * np.random.normal() for j in range(len(x))]
trace1 ... |
def main():
print(sum(list(range(5))))
print(pow(2,3))
def exp(root,power):
""" root^power returns string of equation"""
base = " x ".join(str(root)*power)
print( chr(ord('c')))
return f"{base} = {pow(root,power)}"
def enumerate_():
l = ["aff","adasf","asdasc"]
print(list(enumerate... | def main():
print(sum(list(range(5))))
print(pow(2, 3))
def exp(root, power):
""" root^power returns string of equation"""
base = ' x '.join(str(root) * power)
print(chr(ord('c')))
return f'{base} = {pow(root, power)}'
def enumerate_():
l = ['aff', 'adasf', 'asdasc']
print(list(enumera... |
b2bi_strings = {
19: "fK4vQqsDwbXp/Hyjlc2EsVthXQCr/wdvCo5ZwrlpJB5eCoDdhJpZkkL+5XbQS5CqG0dz/bvErrAAQzAh2GYKIN7I/fswVYOFBoz5JcJbzv+c00ChoGMsuxzki1iTfyCVuXG8P5zg7FhiLtKUAlNusocKFGkL3dfwvbKNXGUgRGRdOpp5TCAFj7rZOgrMApz5lzdkxBlb4mKBqqdP2MFEIMsKEPE96rCSRvvuYddLTzQx42yoCg49L2yDyd7Fx2p36v3Khz8NtO9ozeigXYULYMzmojkHnkQ6Zi6gUvzd... | b2bi_strings = {19: 'fK4vQqsDwbXp/Hyjlc2EsVthXQCr/wdvCo5ZwrlpJB5eCoDdhJpZkkL+5XbQS5CqG0dz/bvErrAAQzAh2GYKIN7I/fswVYOFBoz5JcJbzv+c00ChoGMsuxzki1iTfyCVuXG8P5zg7FhiLtKUAlNusocKFGkL3dfwvbKNXGUgRGRdOpp5TCAFj7rZOgrMApz5lzdkxBlb4mKBqqdP2MFEIMsKEPE96rCSRvvuYddLTzQx42yoCg49L2yDyd7Fx2p36v3Khz8NtO9ozeigXYULYMzmojkHnkQ6Zi6gUvzdQAz... |
#! /usr/bin/python3.7
def les():
def slope():
y1 = float(input('What is y1?: '))
y2 = float(input('What is y2?: '))
x1 = float(input('What is x1?: '))
x2 = float(input('What is x2?: '))
slope = (y2 - y1)/(x2 - x1)
b = ((slope * x1)*-1) + y1
print('y = {}x + {}... | def les():
def slope():
y1 = float(input('What is y1?: '))
y2 = float(input('What is y2?: '))
x1 = float(input('What is x1?: '))
x2 = float(input('What is x2?: '))
slope = (y2 - y1) / (x2 - x1)
b = slope * x1 * -1 + y1
print('y = {}x + {}'.format(slope, b))
... |
"""
Copyright Government of Canada 2020
Written by: Eric Marinier, National Microbiology Laboratory,
Public Health Agency of Canada
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this work except in compliance with the License. You may obtain a copy of the
License at:
htt... | """
Copyright Government of Canada 2020
Written by: Eric Marinier, National Microbiology Laboratory,
Public Health Agency of Canada
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this work except in compliance with the License. You may obtain a copy of the
License at:
htt... |
a=int(input("Enter first number\n"))
b=int(input("Enter second number\n"))
c=int(input("Enter third number\n"))
d=int(input("Enter fourth number\n"))
e=int(input("Enter fifth number\n"))
add=a+b+c+d+e
print("The sum of first 5 even numbers is",add)
| a = int(input('Enter first number\n'))
b = int(input('Enter second number\n'))
c = int(input('Enter third number\n'))
d = int(input('Enter fourth number\n'))
e = int(input('Enter fifth number\n'))
add = a + b + c + d + e
print('The sum of first 5 even numbers is', add) |
class EncryptedUser(object):
""" EncryptedUser class """
def __init__(self, username, roles, secret = None, algorithm = None, salt = None):
""" Init User class """
self.username = username
self.roles = roles
self.salt = salt
self.secret = secret
self.algorit... | class Encrypteduser(object):
""" EncryptedUser class """
def __init__(self, username, roles, secret=None, algorithm=None, salt=None):
""" Init User class """
self.username = username
self.roles = roles
self.salt = salt
self.secret = secret
self.algorithm = algori... |
class Solution:
def numTeams(self, rating: List[int]) -> int:
lless_rcd = {}
rless_rcd = {}
lgreater_rcd = {}
rgreater_rcd = {}
for i in range(len(rating)):
lless_rcd[i] = 0
lgreater_rcd[i] = 0
rless_rcd[i] = 0
rgreater_rcd[i] =... | class Solution:
def num_teams(self, rating: List[int]) -> int:
lless_rcd = {}
rless_rcd = {}
lgreater_rcd = {}
rgreater_rcd = {}
for i in range(len(rating)):
lless_rcd[i] = 0
lgreater_rcd[i] = 0
rless_rcd[i] = 0
rgreater_rcd[i]... |
# Solution
def even_after_odd(head):
if head is None:
return head
even = None
odd = None
even_tail = None
head_tail = None
while head:
next_node = head.next
if head.data % 2 == 0:
if even is None:
even = head
... | def even_after_odd(head):
if head is None:
return head
even = None
odd = None
even_tail = None
head_tail = None
while head:
next_node = head.next
if head.data % 2 == 0:
if even is None:
even = head
even_tail = even
e... |
"""
# Definition for a Node.
class Node:
def __init__(self, val=None, children=None):
self.val = val
self.children = children
"""
class Solution:
def postorder(self, root: 'Node') -> List[int]:
if root is None:
return []
stack, output = [root, ], []
while sta... | """
# Definition for a Node.
class Node:
def __init__(self, val=None, children=None):
self.val = val
self.children = children
"""
class Solution:
def postorder(self, root: 'Node') -> List[int]:
if root is None:
return []
(stack, output) = ([root], [])
while ... |
# -*- coding: utf-8 -*-
"""
A set of Python functions that have mixed input and output expectations
Created on Thu Sep 3 11:30:28 2015
@author: djc
"""
# Lowercases an input string
def toLower(s):
if type(s) is not str:
raise ValueError("Wrong input type: the parameter must be a string");
... | """
A set of Python functions that have mixed input and output expectations
Created on Thu Sep 3 11:30:28 2015
@author: djc
"""
def to_lower(s):
if type(s) is not str:
raise value_error('Wrong input type: the parameter must be a string')
return s.lower()
def to_upper(s):
if type(s) is not str:
... |
class Spam(object):
def __init__(self,value):
self.value = value
class Eggs(object):
def __init__(self,value):
self.value = value
s = Spam(1)
e = Eggs(2)
if isinstance(s,Spam):
print("s is Spam - correct")
if isinstance(s,Eggs):
print("s is Eggs - incorrect")
if isinstance(e,Spam... | class Spam(object):
def __init__(self, value):
self.value = value
class Eggs(object):
def __init__(self, value):
self.value = value
s = spam(1)
e = eggs(2)
if isinstance(s, Spam):
print('s is Spam - correct')
if isinstance(s, Eggs):
print('s is Eggs - incorrect')
if isinstance(e, Spam... |
"""
Given a singly linked list, determine if it is a palindrome.
Example 1:
Input: 1->2
Output: false
Example 2:
Input: 1->2->2->1
Output: true
Follow up:
Could you do it in O(n) time and O(1) space?
"""
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val ... | """
Given a singly linked list, determine if it is a palindrome.
Example 1:
Input: 1->2
Output: false
Example 2:
Input: 1->2->2->1
Output: true
Follow up:
Could you do it in O(n) time and O(1) space?
"""
class Solution(object):
def is_palindrome(self, head):
"""
:type head: ListNode
:rt... |
class RebarHookOrientation(Enum,IComparable,IFormattable,IConvertible):
"""
Orientation of a rebar hook relative to the path of the Rebar Shape.
enum RebarHookOrientation,values: Left (1),Right (-1)
"""
def __eq__(self,*args):
""" x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq__(y) <==> x==y """
... | class Rebarhookorientation(Enum, IComparable, IFormattable, IConvertible):
"""
Orientation of a rebar hook relative to the path of the Rebar Shape.
enum RebarHookOrientation,values: Left (1),Right (-1)
"""
def __eq__(self, *args):
""" x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq__(y) <==> x=... |
i = 28
print(f"i is {i}")
f = 2.8
print(f"f is {f}")
b = True # False
print(f"b is {b}")
n = None # Idea that variable have NO_VALUE
print(f"n is {n}")
| i = 28
print(f'i is {i}')
f = 2.8
print(f'f is {f}')
b = True
print(f'b is {b}')
n = None
print(f'n is {n}') |
""" Given a 2D board and a list of words from the dictionary, find all words in
the board.
Each word must be constructed from letters of sequentially adjacent cell,
where "adjacent" cells are those horizontally or vertically neighboring. The
same letter cell may not be used more than once in a word.
... | """ Given a 2D board and a list of words from the dictionary, find all words in
the board.
Each word must be constructed from letters of sequentially adjacent cell,
where "adjacent" cells are those horizontally or vertically neighboring. The
same letter cell may not be used more than once in a word.
... |
# Time: O(n^2)
# Space: O(n)
class Solution(object):
def transformArray(self, arr):
"""
:type arr: List[int]
:rtype: List[int]
"""
def is_changable(arr):
return any(arr[i-1] > arr[i] < arr[i+1] or
arr[i-1] < arr[i] > arr[i+1]
... | class Solution(object):
def transform_array(self, arr):
"""
:type arr: List[int]
:rtype: List[int]
"""
def is_changable(arr):
return any((arr[i - 1] > arr[i] < arr[i + 1] or arr[i - 1] < arr[i] > arr[i + 1] for i in xrange(1, len(arr) - 1)))
while is_cha... |
def make_sNum(niz):
sNum = []
for z in niz:
if z in ["[", "]"]:
sNum.append(z)
elif z == ",":
continue
else:
sNum.append(int(z))
return sNum
def add_sNum(s1, s2):
return ["["] + s1 + s2 + ["]"]
def explode(s):
levi_zak = 0
for i in r... | def make_s_num(niz):
s_num = []
for z in niz:
if z in ['[', ']']:
sNum.append(z)
elif z == ',':
continue
else:
sNum.append(int(z))
return sNum
def add_s_num(s1, s2):
return ['['] + s1 + s2 + [']']
def explode(s):
levi_zak = 0
for i in... |
name = 'Mike'
age = 33
money = 9.75
# print using concatination
print(name + ' is ' + str(age) + ' and has $' + str(money) + ' dollars.')
# print using the .format() method for strings
print("{0} is {1} and has ${2} dollars.".format(name, age, money))
# print using f-strings
print(f'{name} is {age} and has ${money} ... | name = 'Mike'
age = 33
money = 9.75
print(name + ' is ' + str(age) + ' and has $' + str(money) + ' dollars.')
print('{0} is {1} and has ${2} dollars.'.format(name, age, money))
print(f'{name} is {age} and has ${money} dollars.') |
class BaseParser(object):
def __init__(self):
pass
def parse(self, url, hxs, index):
return None
def parse_relative(self, url, hxs):
pass
def parse_paginate(self, url, hxs, cache_db):
pass
def get_value_from_response(self, hxs, query, index, default=""):
_... | class Baseparser(object):
def __init__(self):
pass
def parse(self, url, hxs, index):
return None
def parse_relative(self, url, hxs):
pass
def parse_paginate(self, url, hxs, cache_db):
pass
def get_value_from_response(self, hxs, query, index, default=''):
... |
load("//:compile.bzl", "proto_compile")
load("//:plugin.bzl", "proto_plugin")
def d_proto_compile(**kwargs):
# If package specified, declare a custom plugin that should correctly
# predict the output location.
package = kwargs.get("package")
if package and not kwargs.get("plugins"):
name = kwar... | load('//:compile.bzl', 'proto_compile')
load('//:plugin.bzl', 'proto_plugin')
def d_proto_compile(**kwargs):
package = kwargs.get('package')
if package and (not kwargs.get('plugins')):
name = kwargs.get('name')
name_plugin = name + '_plugin'
proto_plugin(name=name_plugin, outputs=['{pac... |
class FetchResourceError(Exception):
def __init__(self, msg):
super(FetchResourceError, self).__init__(
"error fetching resource: " + str(msg)
)
| class Fetchresourceerror(Exception):
def __init__(self, msg):
super(FetchResourceError, self).__init__('error fetching resource: ' + str(msg)) |
#Written by: Karim shoair - D4Vinci ( Dr0p1t-Framework )
#This is a persistence script aims to to add your exe file to startup registry key
#Start
def F7212(exe):
fp = get_output("echo %CD%")
new_name = get_output("echo %random%%random%").strip() + ".exe"
new_file_path = fp + "\\" + new_name
try:
command = 'REG ... | def f7212(exe):
fp = get_output('echo %CD%')
new_name = get_output('echo %random%%random%').strip() + '.exe'
new_file_path = fp + '\\' + new_name
try:
command = 'REG ADD HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run /v "Windows.NET service" /t REG_SZ /f /d "{}"'
x1 = subprocess... |
# Python program Tabulated (bottom up) version
def fib(n):
# array declaration
f = [0]*(n+1)
# base case assignment
f[1] = 1
# calculating the fibonacci and storing the values
for i in range(2 , n+1):
f[i] = f[i-1] + f[i-2]
return f[n]
# Driver program to test the above function
def main():
n =... | def fib(n):
f = [0] * (n + 1)
f[1] = 1
for i in range(2, n + 1):
f[i] = f[i - 1] + f[i - 2]
return f[n]
def main():
n = 9
print('Fibonacci number is ', fib(n))
if __name__ == '__main__':
main() |
def test_complex_fields(user_advance_dataclass):
data = {
"name": "juan",
"age": 20,
"pets": ["dog"],
"accounts": {"ing": 100},
"has_car": True,
"favorite_colors": "GREEN",
"md5": b"u00ffffffffffffx",
}
expected_data = {
"name": "juan",
... | def test_complex_fields(user_advance_dataclass):
data = {'name': 'juan', 'age': 20, 'pets': ['dog'], 'accounts': {'ing': 100}, 'has_car': True, 'favorite_colors': 'GREEN', 'md5': b'u00ffffffffffffx'}
expected_data = {'name': 'juan', 'age': 20, 'pets': ['dog'], 'accounts': {'ing': 100}, 'has_car': True, 'favorit... |
class DataView(object):
def __init__(self, view_id, name, description, datasets=[], column_names=[], columns=[]):
"""
Constructor.
:param view_id: The ID of the data view
:type view_id: str
:param name: The name of the data view
:type name: str
:param descri... | class Dataview(object):
def __init__(self, view_id, name, description, datasets=[], column_names=[], columns=[]):
"""
Constructor.
:param view_id: The ID of the data view
:type view_id: str
:param name: The name of the data view
:type name: str
:param descri... |
TRAIN_MODE = False
MODELPATH = './engine/data/trained_model/rel_first_model.pth'
NUM_EPOCHS = 10000
BATCH_SIZE = 30
RELATION_FILE = "./engine/data/refer/relation_train.txt"
GENOME_DICT = "./engine/data/procdata/genome_rel_dict.pkl"
IMG_WIDTH = 800
TRAIN_PROC_MAX = 10000
VALID_PROC_MAX = 1000
DATA_SHUFFLE = True
LEARN_... | train_mode = False
modelpath = './engine/data/trained_model/rel_first_model.pth'
num_epochs = 10000
batch_size = 30
relation_file = './engine/data/refer/relation_train.txt'
genome_dict = './engine/data/procdata/genome_rel_dict.pkl'
img_width = 800
train_proc_max = 10000
valid_proc_max = 1000
data_shuffle = True
learn_v... |
# -*- coding: utf-8 -*-
# MinIO Python Library for Amazon S3 Compatible Cloud Storage, (C)
# 2017 MinIO, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/lic... | """
minio.fold_case_dict
This module implements a case insensitive dictionary.
:copyright: (c) 2017 by MinIO, Inc.
:license: Apache 2.0, see LICENSE for more details.
"""
class Foldcasedict(dict):
def __init__(self, dictionary={}):
self._data = self.__create(dictionary)
def __create(self, value):
... |
supported_aminoacids = ["ALA", "ARG", "ASH", "ASN", "ASP", "CYS", "CYT", "GLH",
"GLN", "GLU", "GLY", "HID", "HIE", "HIS", "HIP", "ILE",
"LEU", "LYS", "LYN", "MET", "PHE", "PRO", "SER", "TRP",
"THR", "TYR", "VAL", "ACE", "NMA"]
aminoacids_3letter = ... | supported_aminoacids = ['ALA', 'ARG', 'ASH', 'ASN', 'ASP', 'CYS', 'CYT', 'GLH', 'GLN', 'GLU', 'GLY', 'HID', 'HIE', 'HIS', 'HIP', 'ILE', 'LEU', 'LYS', 'LYN', 'MET', 'PHE', 'PRO', 'SER', 'TRP', 'THR', 'TYR', 'VAL', 'ACE', 'NMA']
aminoacids_3letter = ['ALA', 'ARG', 'ASH', 'ASN', 'ASP', 'CYS', 'GLH', 'GLN', 'GLU', 'GLY', '... |
def get_r_string_samples_by_sample_group(order_list,samples_by_sample_groups):
samples_by_sample_group_r_string = []
for sample_group in order_list:
sample_group_samples = samples_by_sample_groups[sample_group]
samples_by_sample_group_r_string.append("c(\"" + "\",\"".join(sample_group_samples)... | def get_r_string_samples_by_sample_group(order_list, samples_by_sample_groups):
samples_by_sample_group_r_string = []
for sample_group in order_list:
sample_group_samples = samples_by_sample_groups[sample_group]
samples_by_sample_group_r_string.append('c("' + '","'.join(sample_group_samples) + '... |
"""
The 5-digit number, 16807=75, is also a fifth power. Similarly, the 9-digit number,
134217728=89, is a ninth power.
How many n-digit positive integers exist which are also an nth power?
"""
"""
The maximum base can be 9 because all n-digit numbers < 10^n.
Now 9**23 has 22 digits so the maximum power can be... | """
The 5-digit number, 16807=75, is also a fifth power. Similarly, the 9-digit number,
134217728=89, is a ninth power.
How many n-digit positive integers exist which are also an nth power?
"""
'\nThe maximum base can be 9 because all n-digit numbers < 10^n.\nNow 9**23 has 22 digits so the maximum power can be 22.\nUsi... |
# Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
# This file is autogenerated and should not be modified manually.
# Update versions/UpdateVersions.hs instead.
sdk_versions = [
"1.0.0",
"1.0.1",
"1.1.1",
"1.2.0",
... | sdk_versions = ['1.0.0', '1.0.1', '1.1.1', '1.2.0', '1.3.0', '1.4.0', '1.5.0', '1.6.0-snapshot.20200908.5166.0.1623baec', '1.6.0-snapshot.20200915.5208.0.09014dc6', '0.0.0']
platform_versions = ['1.0.0', '1.0.1', '1.1.1', '1.2.0', '1.3.0', '1.4.0', '1.5.0', '1.6.0-snapshot.20200908.5166.0.1623baec', '1.6.0-snapshot.202... |
N = int(input())
c = 1
for i in range(1, 10):
for j in range(1, 10):
if c != N:
c += 1
continue
print(str(j) * i)
exit()
| n = int(input())
c = 1
for i in range(1, 10):
for j in range(1, 10):
if c != N:
c += 1
continue
print(str(j) * i)
exit() |
'''
## s3_enable_encryption
What it does: Turns on encryption on the target bucket.
Usage: AUTO: s3_enable_encryption <encryption_type> <kms-key-arn> (<kms-key-arn> should be provided only if <encryption_type> is KMS)
Note: <encryption_type> can be one of the following:
1. s3 (for s3-managed keys)
2. kms (for customer ... | """
## s3_enable_encryption
What it does: Turns on encryption on the target bucket.
Usage: AUTO: s3_enable_encryption <encryption_type> <kms-key-arn> (<kms-key-arn> should be provided only if <encryption_type> is KMS)
Note: <encryption_type> can be one of the following:
1. s3 (for s3-managed keys)
2. kms (for customer ... |
def main():
with open('adventofcode/twentytwenty/static_data/day5.txt', 'r') as f:
lines = f.readlines()
max_id, missing_ids = find_seat_numbers(lines)
print('Max ID:', max_id)
print('Missing IDs:', missing_ids)
def find_seat_numbers(boarding_passes):
"""Determines the seat number of a boa... | def main():
with open('adventofcode/twentytwenty/static_data/day5.txt', 'r') as f:
lines = f.readlines()
(max_id, missing_ids) = find_seat_numbers(lines)
print('Max ID:', max_id)
print('Missing IDs:', missing_ids)
def find_seat_numbers(boarding_passes):
"""Determines the seat number of a bo... |
pkgname = "libplist"
pkgver = "2.2.0"
pkgrel = 0
build_style = "gnu_configure"
configure_args = ["--disable-static"] # prevent building python binding .a
hostmakedepends = ["pkgconf", "automake", "libtool", "python", "python-cython"]
makedepends = ["python-devel", "libglib-devel", "libxml2-devel"]
pkgdesc = "Apple Prop... | pkgname = 'libplist'
pkgver = '2.2.0'
pkgrel = 0
build_style = 'gnu_configure'
configure_args = ['--disable-static']
hostmakedepends = ['pkgconf', 'automake', 'libtool', 'python', 'python-cython']
makedepends = ['python-devel', 'libglib-devel', 'libxml2-devel']
pkgdesc = 'Apple Property List library'
maintainer = 'q66 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.