content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# this contains some predefined pair outputs .
def fixedpair(inp):
if inp == "who?":
pair = "I am TS3000."
elif inp == "who ?" :
pair = "I m bitch"
return pair
| def fixedpair(inp):
if inp == 'who?':
pair = 'I am TS3000.'
elif inp == 'who ?':
pair = 'I m bitch'
return pair |
'''
05 - Putting a list of dates in order
Much like numbers and strings, date objects in Python can be put
in order. Earlier dates come before later ones, and so we can sort
a list of date objects from earliest to latest.
What if our Florida hurricane dates had been scrambled? We've gone
ahead and shuffl... | """
05 - Putting a list of dates in order
Much like numbers and strings, date objects in Python can be put
in order. Earlier dates come before later ones, and so we can sort
a list of date objects from earliest to latest.
What if our Florida hurricane dates had been scrambled? We've gone
ahead and shuffl... |
_base_ = ['./rretinanet_obb_r50_fpn_1x_dota_v3.py']
# switch data path in '../_base_/datasets/dota1_0.py'
angle_version = 'v3'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='LoadAnnotations', with_... | _base_ = ['./rretinanet_obb_r50_fpn_1x_dota_v3.py']
angle_version = 'v3'
img_norm_cfg = dict(mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
train_pipeline = [dict(type='LoadImageFromFile'), dict(type='LoadAnnotations', with_bbox=True), dict(type='RResize', img_scale=(1024, 1024)), dict(type='... |
# O(n) time | O(n) space
# Iterative solution 2
def spiralTraverse(array):
result = []
startRow, endRow = 0, len(array) - 1
startCol, endCol = 0, len(array[0]) - 1
while startRow <= endRow and startCol <= endCol:
for col in range(startCol, endCol + 1):
result.append(array[startRow][... | def spiral_traverse(array):
result = []
(start_row, end_row) = (0, len(array) - 1)
(start_col, end_col) = (0, len(array[0]) - 1)
while startRow <= endRow and startCol <= endCol:
for col in range(startCol, endCol + 1):
result.append(array[startRow][col])
for row in range(start... |
for i in range(5):
ans = 0
coins = []
for i in range(int(input())):
coins.append(int(input()))
avg = sum(coins) // len(coins)
for i in coins:
ans += abs(avg - i)
print(ans // 2)
| for i in range(5):
ans = 0
coins = []
for i in range(int(input())):
coins.append(int(input()))
avg = sum(coins) // len(coins)
for i in coins:
ans += abs(avg - i)
print(ans // 2) |
app_name = 'app004'
urlpatterns = [
] | app_name = 'app004'
urlpatterns = [] |
#
# PySNMP MIB module ZHONE-DISMAN-TRACEROUTE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZHONE-DISMAN-TRACEROUTE-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:41:14 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python versio... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_range_constraint, value_size_constraint, constraints_intersection, constraints_union) ... |
# Given a list of intervals,
# merge all the overlapping intervals to produce a list that has only mutually exclusive intervals.
# Example:
# Intervals: [[1,4], [2,5], [7,9]]
# Output: [[1,5], [7,9]]
# Explanation: Since the first two intervals [1,4] and [2,5] overlap, we merged them into one [1,5].
# O(N) for merg... | class Interval:
def __init__(self, start, end) -> None:
self.start = start
self.end = end
def print_interval(self):
print('[' + str(self.start) + ',' + str(self.end) + ']', end='')
def merge_intervals(arr):
intervals = []
for i in arr:
intervals.append(interval(i[0], i... |
class AlignmentType:
@property
def _alignment_type(self):
return self.record_type
| class Alignmenttype:
@property
def _alignment_type(self):
return self.record_type |
def reverse_number(n):
r = 0
while n > 0:
r *= 10
r += n % 10
n //= 10
return r
def isPrime(n):
flag = False
if(n > 1):
for i in range(2, n):
if(n % i == 0):
flag = True
break
return flag
n = int(input())
flag = Fals... | def reverse_number(n):
r = 0
while n > 0:
r *= 10
r += n % 10
n //= 10
return r
def is_prime(n):
flag = False
if n > 1:
for i in range(2, n):
if n % i == 0:
flag = True
break
return flag
n = int(input())
flag = False
if... |
#
# PySNMP MIB module HPN-ICF-L4RDT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-L4RDT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:39:34 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')
(constraints_union, value_size_constraint, single_value_constraint, value_range_constraint, constraints_intersection) ... |
# -*- coding: utf-8 -*-
# @Time : 2021/1/3
# @Author : handsomezhou
DB_SUFFIX = "db"
DB_SUFFIX_WITH_FULL_STOP = ".db"
| db_suffix = 'db'
db_suffix_with_full_stop = '.db' |
t = int(input())
while t:
N = int(input())
A = list(map(int, input().split()))
l = []
for i in range(N):
for j in range(i+1, N):
l.append(A[i]+A[j])
c = l.count(max(l))
print(c/len(l))
t = t-1 | t = int(input())
while t:
n = int(input())
a = list(map(int, input().split()))
l = []
for i in range(N):
for j in range(i + 1, N):
l.append(A[i] + A[j])
c = l.count(max(l))
print(c / len(l))
t = t - 1 |
#
# 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, software
# ... | email = 'test@example.com'
displayname = 'john smith'
id = '1324'
idp = 'https://test.idp'
class Testshibwrapper(object):
def __init__(self, app, mail=EMAIL):
self.app = app
self.mail = mail
def __call__(self, environ, start_response):
environ['mail'] = self.mail
environ['disp... |
def remove_reads_in_other_fastq(input_fastq, remove_fastq, out_file_name):
out = open(out_file_name, "w")
# Get seq ids to remove
remove_ids = set()
i = 0
for line in open(remove_fastq):
if i % 500000 == 0:
print(i)
i += 1
if line.startswith("@"):
rem... | def remove_reads_in_other_fastq(input_fastq, remove_fastq, out_file_name):
out = open(out_file_name, 'w')
remove_ids = set()
i = 0
for line in open(remove_fastq):
if i % 500000 == 0:
print(i)
i += 1
if line.startswith('@'):
remove_ids.add(line)
i = 0
... |
magic_number = 3
#Your code here...
while True:
guess = int(input("Enter a guess: "))
if guess == magic_number:
print("You got it!")
break
elif guess > magic_number:
print("Too high!")
else:
print("Too low!")
| magic_number = 3
while True:
guess = int(input('Enter a guess: '))
if guess == magic_number:
print('You got it!')
break
elif guess > magic_number:
print('Too high!')
else:
print('Too low!') |
## Shorty
## Copyright 2009 Joshua Roesslein
## See LICENSE
## @url burnurl.com
class Burnurl(Service):
def _test(self):
# all we can test is shrink
turl = self.shrink('http://test.com')
if turl.startswith('http://burnurl.com'):
return True
else:
return Fals... | class Burnurl(Service):
def _test(self):
turl = self.shrink('http://test.com')
if turl.startswith('http://burnurl.com'):
return True
else:
return False
def shrink(self, bigurl):
resp = request('http://burnurl.com/', {'url': bigurl, 'output': 'plain'})
... |
def pairs(digits):
for i in range(len(digits) - 1):
yield digits[i], digits[i+1]
yield digits[-1], digits[0]
def halfway(digits):
half = len(digits) // 2
for i in range(half):
yield digits[i], digits[half+i]
for i in range(half, len(digits)):
yield digits[i], digits[i-hal... | def pairs(digits):
for i in range(len(digits) - 1):
yield (digits[i], digits[i + 1])
yield (digits[-1], digits[0])
def halfway(digits):
half = len(digits) // 2
for i in range(half):
yield (digits[i], digits[half + i])
for i in range(half, len(digits)):
yield (digits[i], digi... |
error_map = {
"abecoando": "abencoando",
"abigos": "amigos",
"abilidade": "habilidade",
"abilidades": "habilidades",
"abisurdo": "absurdo",
"abitual": "habitual",
"abrcs": "abracos",
"abrou": "abriu",
"abss": "abracos",
"abussda": "abusada",
"abussdo": "abusado",
"accept": "aceito",
"account":... | error_map = {'abecoando': 'abencoando', 'abigos': 'amigos', 'abilidade': 'habilidade', 'abilidades': 'habilidades', 'abisurdo': 'absurdo', 'abitual': 'habitual', 'abrcs': 'abracos', 'abrou': 'abriu', 'abss': 'abracos', 'abussda': 'abusada', 'abussdo': 'abusado', 'accept': 'aceito', 'account': 'conta', 'acessor': 'asses... |
'''
There is an undirected star graph consisting of n nodes
labeled from 1 to n. A star graph is a graph where there
is one center node and exactly n - 1 edges that connect
the center node with every other node.
You are given a 2D integer array edges where each
edges[i] = [ui, vi] indicates... | """
There is an undirected star graph consisting of n nodes
labeled from 1 to n. A star graph is a graph where there
is one center node and exactly n - 1 edges that connect
the center node with every other node.
You are given a 2D integer array edges where each
edges[i] = [ui, vi] indicates... |
def Agente_corredor_ex_9():
def __init__(self):
self.cur = 1
def invoca(self):
pos = 0
if pos == 0:
if(self.cur == 0):
return "fica parado"
if(self.cur > pos and self.cur > 1):
self.cur = self.cur - 1
return "andar-"
if... | def agente_corredor_ex_9():
def __init__(self):
self.cur = 1
def invoca(self):
pos = 0
if pos == 0:
if self.cur == 0:
return 'fica parado'
if self.cur > pos and self.cur > 1:
self.cur = self.cur - 1
return 'andar-'
if ... |
[
{
"created_at": "Mon Feb 12 03:41:30 +0000 2018",
"id": 962894403256901632,
"text": "RT @JonAcuff: Dear Olympics commentators, at the beginning of each figure skating couple please let us know if the couple loves each other\u2026",
"user.screen_name": "h0llaJess"
},
{
... | [{'created_at': 'Mon Feb 12 03:41:30 +0000 2018', 'id': 962894403256901632, 'text': 'RT @JonAcuff: Dear Olympics commentators, at the beginning of each figure skating couple please let us know if the couple loves each other…', 'user.screen_name': 'h0llaJess'}, {'created_at': 'Mon Feb 12 03:41:30 +0000 2018', 'id': 9628... |
class BaseMetric(object):
name = None
def get_name(self):
return self.name
class ValueMetric(BaseMetric):
value = None
def get_value(self):
return self.value
class LineChartMetric(BaseMetric):
x = []
y = []
xlabel = 'X Label'
ylabel = 'Y Label'
def get_values(... | class Basemetric(object):
name = None
def get_name(self):
return self.name
class Valuemetric(BaseMetric):
value = None
def get_value(self):
return self.value
class Linechartmetric(BaseMetric):
x = []
y = []
xlabel = 'X Label'
ylabel = 'Y Label'
def get_values(sel... |
nouns = ['account', 'achiever', 'acoustics', 'act', 'action', 'activity', 'actor', 'addition', 'adjustment',
'advertisement', 'advice', 'aftermath', 'afternoon', 'afterthought', 'agreement', 'air', 'airplane', 'airport',
'alarm', 'amount', 'amusement', 'anger', 'angle', 'animal', 'answer', 'ant', 'ant... | nouns = ['account', 'achiever', 'acoustics', 'act', 'action', 'activity', 'actor', 'addition', 'adjustment', 'advertisement', 'advice', 'aftermath', 'afternoon', 'afterthought', 'agreement', 'air', 'airplane', 'airport', 'alarm', 'amount', 'amusement', 'anger', 'angle', 'animal', 'answer', 'ant', 'ants', 'apparatus', '... |
__author__ = 'shukkkur'
'''
https://codeforces.com/problemset/problem/580/A
'''
n = int(input())
values = list(map(int, input().split()))
records = []
count = 1
for i in range(len(values)-1):
if values[i] <= values[i+1]:
count += 1
else:
records.append(count)
... | __author__ = 'shukkkur'
'\nhttps://codeforces.com/problemset/problem/580/A\n'
n = int(input())
values = list(map(int, input().split()))
records = []
count = 1
for i in range(len(values) - 1):
if values[i] <= values[i + 1]:
count += 1
else:
records.append(count)
count = 1
records.append(c... |
# coding=utf-8
global DEBUG_ON # Turn debug ON/OF (True/False)
DEBUG_ON = False
global LEVEL_SYSTEM # Settings for leveling system
LEVEL_SYSTEM = {
'1': {'cap': 0, 'multiplier': 1},
'2': {'cap': 10, 'multiplier': 1},
'3': {'cap': 100, 'multiplier': 2},
'4': {'cap': 500, 'multiplier': 2},
'5': {'cap': 1000, 'mul... | global DEBUG_ON
debug_on = False
global LEVEL_SYSTEM
level_system = {'1': {'cap': 0, 'multiplier': 1}, '2': {'cap': 10, 'multiplier': 1}, '3': {'cap': 100, 'multiplier': 2}, '4': {'cap': 500, 'multiplier': 2}, '5': {'cap': 1000, 'multiplier': 3}, '6': {'cap': 2000, 'multiplier': 3}, '7': {'cap': 5000, 'multiplier': 3},... |
def find_loop_size(target):
loop_size = 0
c = 1
while True:
loop_size += 1
c *= 7
c = c % 20201227
if c == target:
return loop_size
def transform_loop(public, loop_size):
c = 1
for _ in range(loop_size):
c *= public
c = c % 20201227
re... | def find_loop_size(target):
loop_size = 0
c = 1
while True:
loop_size += 1
c *= 7
c = c % 20201227
if c == target:
return loop_size
def transform_loop(public, loop_size):
c = 1
for _ in range(loop_size):
c *= public
c = c % 20201227
re... |
# Fiona Nealon, 2018-04-07
# A function called factorial() which takes a single input and returns it's factorial
def factorial(upto):
# Create a variable that will become the answer
multupto = 1
# Loop through numbers i from 1 to upto
for i in range(1, upto + 1):
# Multiply ans by i, changing ans to that... | def factorial(upto):
multupto = 1
for i in range(1, upto + 1):
multupto = multupto * i
return multupto
print('The multiplication of the values from to 1 to 5 inclusive is', factorial(5))
print('The multiplication of the values from to 1 to 7 inclusive is', factorial(7))
print('The multiplication of ... |
EXPECTED = {'Foo': {'extensibility-implied': False,
'imports': {},
'object-classes': {},
'object-sets': {},
'tags': 'AUTOMATIC',
'types': {'A': {'restricted-to': [('min', 'max')],
'type': 'Constants'},
'B': {'restricted-to': ['unkn... | expected = {'Foo': {'extensibility-implied': False, 'imports': {}, 'object-classes': {}, 'object-sets': {}, 'tags': 'AUTOMATIC', 'types': {'A': {'restricted-to': [('min', 'max')], 'type': 'Constants'}, 'B': {'restricted-to': ['unknown'], 'type': 'Constants'}, 'C': {'restricted-to': [('zero', 'max')], 'type': 'Constants... |
# Code on Python 3.7.4
# Working @ Dec, 2020
# david-boo.github.io
# Define both number and length (13). Then, just check every substring of length 13 and store and print maximum.
num = "73167176531330624919225119674426574742355349194934969835203127745063262395783180169848018694788518438586156078911294949545... | num = '7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629... |
class cesarToTxtClass:
def __init__(self, cesar, offset=None):
self.cesar = cesar.decode("utf-8").upper()
self.alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".decode("utf-8")
if offset != None:
self.offset = offset
def processCesarWithOffset(self):
decrypted = ""
fo... | class Cesartotxtclass:
def __init__(self, cesar, offset=None):
self.cesar = cesar.decode('utf-8').upper()
self.alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.decode('utf-8')
if offset != None:
self.offset = offset
def process_cesar_with_offset(self):
decrypted = ''
... |
class queue:
def __init__(self):
self.main = []
self.max_c = 10
def deque(self):
del self.main[-1]
def enque(self,val):
if len(self.main) == self.max_c:
self.deque()
self.main.insert(0,val)
else:
self.main.insert(0,val)
def show(self):
return self.main
def __getitem__(self,index):
retu... | class Queue:
def __init__(self):
self.main = []
self.max_c = 10
def deque(self):
del self.main[-1]
def enque(self, val):
if len(self.main) == self.max_c:
self.deque()
self.main.insert(0, val)
else:
self.main.insert(0, val)
d... |
__author__ = 'Edwin Cowart, Kevin McDonough'
# The URL that the Test Cases are received from as HTML
TEST_CASES_URL = "http://www.ccs.neu.edu/home/tonyg/cs4500/6.html"
GEN_TEST_STR = 'test_*.py'
# JSON Directory Names
JSON_STREAM_DIR = "json_streams"
JSON_SITUATION_DIR = "json_situations"
JSON_FEEDING_6_DIR = "json... | __author__ = 'Edwin Cowart, Kevin McDonough'
test_cases_url = 'http://www.ccs.neu.edu/home/tonyg/cs4500/6.html'
gen_test_str = 'test_*.py'
json_stream_dir = 'json_streams'
json_situation_dir = 'json_situations'
json_feeding_6_dir = 'json_feedings_6'
json_feeding_7_dir = 'json_feedings_7'
json_feeding_dir = 'json_feedin... |
def calcular(a, b):
if (a > b):
total = a * b
elif (a == b):
total = a * (b + 2)
else:
total = a
print(total)
calcular(10, 10)
| def calcular(a, b):
if a > b:
total = a * b
elif a == b:
total = a * (b + 2)
else:
total = a
print(total)
calcular(10, 10) |
class Ray:
def __init__(self, origin, direction):
self.origin = origin
self.direction = direction.normalize()
| class Ray:
def __init__(self, origin, direction):
self.origin = origin
self.direction = direction.normalize() |
board = [[7,8,0,4,0,0,1,2,0],
[6,0,0,0,7,5,0,0,9],
[0,0,0,6,0,1,0,7,8],
[0,0,7,0,4,0,2,6,0],
[0,0,1,0,5,0,9,3,0],
[9,0,4,0,6,0,0,0,5],
[0,7,0,3,0,0,0,1,2],
[1,2,0,0,0,7,4,0,0],
[0,4,9,2,0,6,0,0,7]]
def solve():
if (checkBoar... | board = [[7, 8, 0, 4, 0, 0, 1, 2, 0], [6, 0, 0, 0, 7, 5, 0, 0, 9], [0, 0, 0, 6, 0, 1, 0, 7, 8], [0, 0, 7, 0, 4, 0, 2, 6, 0], [0, 0, 1, 0, 5, 0, 9, 3, 0], [9, 0, 4, 0, 6, 0, 0, 0, 5], [0, 7, 0, 3, 0, 0, 0, 1, 2], [1, 2, 0, 0, 0, 7, 4, 0, 0], [0, 4, 9, 2, 0, 6, 0, 0, 7]]
def solve():
if check_board():
return... |
def main() -> None:
N = int(input())
assert 2 <= N <= 100
graph = [[] for _ in range(N)]
for _ in range(N - 1):
u, v = map(int, input().split())
assert 1 <= u <= N
assert 1 <= v <= N
assert u != v
u -= 1
v -= 1
graph[u].append(v)
graph... | def main() -> None:
n = int(input())
assert 2 <= N <= 100
graph = [[] for _ in range(N)]
for _ in range(N - 1):
(u, v) = map(int, input().split())
assert 1 <= u <= N
assert 1 <= v <= N
assert u != v
u -= 1
v -= 1
graph[u].append(v)
graph[v]... |
# Merge Sort
def merge(left, right):
result = []
i = j = 0
while i < len(left) and j < len(right):
if left[i] < right[j]:
result.append(left[i])
i += 1
else:
result.append(right[j])
j += 1
result += left[i:]
def mergeSort(arr):
if len... | def merge(left, right):
result = []
i = j = 0
while i < len(left) and j < len(right):
if left[i] < right[j]:
result.append(left[i])
i += 1
else:
result.append(right[j])
j += 1
result += left[i:]
def merge_sort(arr):
if len(arr) <= 1:
... |
# Chess Dictionary Validator Practice Project
# Chapter 5 - Dictionary and Structuing Data (Automate the Boring Stuff with Python)
# Developer: Valeriy B.
def chess_dictionary_validator(inp):
# Creating a blank chess dictionary
chess_dictionary = dict()
# Creating a chess board
chess_board = list... | def chess_dictionary_validator(inp):
chess_dictionary = dict()
chess_board = list()
for number in range(1, 9):
for character in range(97, 105):
chess_board.append(chr(character) + str(number))
chess_dictionary['chess_board'] = chess_board
chess_pieces = ['king', 'queen', 'rook', ... |
# https://leetcode.com/problems/arithmetic-slices/
class Solution:
def numberOfArithmeticSlices(self, nums: list[int]) -> int:
arithmetic_slices = 0
if len(nums) <= 2:
return arithmetic_slices
last_diff = nums[1] - nums[0]
last_increment = 0
for idx in range(2, l... | class Solution:
def number_of_arithmetic_slices(self, nums: list[int]) -> int:
arithmetic_slices = 0
if len(nums) <= 2:
return arithmetic_slices
last_diff = nums[1] - nums[0]
last_increment = 0
for idx in range(2, len(nums)):
curr_diff = nums[idx] - n... |
n,m=map(int,input().split());r=0
while n>0:
r+=n;n//=m
print(r)
| (n, m) = map(int, input().split())
r = 0
while n > 0:
r += n
n //= m
print(r) |
def main(ws, clients):
print("The number of clients is: {}".format(len(clients)))
count = 0
while not ws.closed and count < 5:
message = ws.receive()
ws.send(message)
count += 1
ws.close() | def main(ws, clients):
print('The number of clients is: {}'.format(len(clients)))
count = 0
while not ws.closed and count < 5:
message = ws.receive()
ws.send(message)
count += 1
ws.close() |
#!/usr/bin/env python
def getpi(listb):
lista=[]
listcc=[]
for i in listb:
temp=i/180*3.14
lista.append((temp,i))
listcc.append(temp)
return lista
def getangle(listb):
lista=[]
for i in listb:
temp=i/3.14*180
lista.append((i,temp))
return lista
def get... | def getpi(listb):
lista = []
listcc = []
for i in listb:
temp = i / 180 * 3.14
lista.append((temp, i))
listcc.append(temp)
return lista
def getangle(listb):
lista = []
for i in listb:
temp = i / 3.14 * 180
lista.append((i, temp))
return lista
def get... |
class EthJsonRpcError(Exception):
pass
class ConnectionError(EthJsonRpcError):
pass
class BadStatusCodeError(EthJsonRpcError):
pass
class BadJsonError(EthJsonRpcError):
pass
class BadResponseError(EthJsonRpcError):
pass
| class Ethjsonrpcerror(Exception):
pass
class Connectionerror(EthJsonRpcError):
pass
class Badstatuscodeerror(EthJsonRpcError):
pass
class Badjsonerror(EthJsonRpcError):
pass
class Badresponseerror(EthJsonRpcError):
pass |
# http://norvig.com/mayzner.html
character_frequencies = {
'a': 8.04,
'c': 3.34,
'b': 1.48,
'e': 12.49,
'd': 3.82,
'g': 1.87,
'f': 2.40,
'i': 7.57,
'h': 5.05,
'k': 0.54,
'j': 0.16,
'm': 2.51,
'l': 4.07,
'o': 7.64,
'n': 7.23,
'q': 0.12,
'p': 2.14,
... | character_frequencies = {'a': 8.04, 'c': 3.34, 'b': 1.48, 'e': 12.49, 'd': 3.82, 'g': 1.87, 'f': 2.4, 'i': 7.57, 'h': 5.05, 'k': 0.54, 'j': 0.16, 'm': 2.51, 'l': 4.07, 'o': 7.64, 'n': 7.23, 'q': 0.12, 'p': 2.14, 's': 6.51, 'r': 6.28, 'u': 2.73, 't': 9.28, 'w': 1.68, 'v': 1.05, 'y': 1.66, 'x': 0.23, 'z': 0.09, ' ': 19.1... |
# type this to run tests
# 'python -m nose FILENAME -v'
# 'nosetests FILENAME -v'
def test_case01():
assert 'aaa'.upper() == 'AAA'
| def test_case01():
assert 'aaa'.upper() == 'AAA' |
_ = 1 < 3
_ = 1 <= 3
_ = 1 < input() and input() > 3
_ = 1 < input() and input() >= 3
_ = 1 < input() and 1 <= input() and input() >= 3
| _ = 1 < 3
_ = 1 <= 3
_ = 1 < input() and input() > 3
_ = 1 < input() and input() >= 3
_ = 1 < input() and 1 <= input() and (input() >= 3) |
def get_input(filename):
data = []
with open(filename, 'r') as i:
for x in i.readlines():
data.append(int(x))
return data
def count_increases(measurements):
previous = measurements[0]
increases = 0
for measurement in measurements[1:]:
if measurement > previous:
... | def get_input(filename):
data = []
with open(filename, 'r') as i:
for x in i.readlines():
data.append(int(x))
return data
def count_increases(measurements):
previous = measurements[0]
increases = 0
for measurement in measurements[1:]:
if measurement > previous:
... |
def stockmax(p):
ind_max = p.index(max(p)) #find the max price
inv = sum(p[:ind_max]) #split the array before and after max price
pf = len(p[:ind_max])*p[ind_max] - inv #buy all stocks before max price
if len(p[ind_max+1:]) > 0:
pf += stockmax(p[ind_max+1:]) #then sell them at max price
ret... | def stockmax(p):
ind_max = p.index(max(p))
inv = sum(p[:ind_max])
pf = len(p[:ind_max]) * p[ind_max] - inv
if len(p[ind_max + 1:]) > 0:
pf += stockmax(p[ind_max + 1:])
return pf |
def multiply(m, n):
if n > m:
m, n = n, m
if n == 0:
return 0
return m + multiply(m, n - 1)
# print(multiply(3, 5))
def rec(x, y): # x ^ y
if y > 0:
return x * rec(x, y - 1)
return 1
# print(rec(3, 5))
def hailstone(n):
# n is even: n = n / 2
# n is odd: n =... | def multiply(m, n):
if n > m:
(m, n) = (n, m)
if n == 0:
return 0
return m + multiply(m, n - 1)
def rec(x, y):
if y > 0:
return x * rec(x, y - 1)
return 1
def hailstone(n):
if n == 1:
return 1
if n % 2 == 0:
return 1 + hailstone(n // 2)
return 1 ... |
# Utility functions
def mk_param_summary(hyperparams):
return '__'.join([hpname + '_' + val for hpname, val in hyperparams.items()])
def insert_param_summary(filename, param_summary):
basename, extn = filename.rsplit('.', 1)
return basename + '__' + param_summary + '.' + extn
def combinations(ll):
... | def mk_param_summary(hyperparams):
return '__'.join([hpname + '_' + val for (hpname, val) in hyperparams.items()])
def insert_param_summary(filename, param_summary):
(basename, extn) = filename.rsplit('.', 1)
return basename + '__' + param_summary + '.' + extn
def combinations(ll):
last_pass = []
... |
side = 1080
thickness = side*0.4
frames = 84
def skPts():
points = []
for i in range(360):
x = cos(radians(i))
y = sin(radians(i))
points.append((x, y))
return points
def shape(step, var):
speed = var/step
fill(1, 1, 1, 0.05)
stroke(None)
shape = BezierPath()
... | side = 1080
thickness = side * 0.4
frames = 84
def sk_pts():
points = []
for i in range(360):
x = cos(radians(i))
y = sin(radians(i))
points.append((x, y))
return points
def shape(step, var):
speed = var / step
fill(1, 1, 1, 0.05)
stroke(None)
shape = bezier_path()
... |
#EJERCICIO PRACTICO NUMERO 5
print("===========================")
print("EJERCICIO PRACTICO NUMERO 5")
print("===========================\n")
print("=====================")
print("SUCESION DE FIBONACC1")
print("=====================\n")
x, y= 0, 1
while y <= 1597:
print(x, y, end = " ")
x = x + y
y = x ... | print('===========================')
print('EJERCICIO PRACTICO NUMERO 5')
print('===========================\n')
print('=====================')
print('SUCESION DE FIBONACC1')
print('=====================\n')
(x, y) = (0, 1)
while y <= 1597:
print(x, y, end=' ')
x = x + y
y = x + y
print('\nFin.') |
'''
need to be very calm to solve this kind of problem
should never confuse yourself, keep clear mind
there is only 2 cases:
1. there is idle: using Counter to solve this case
2. there is no idle: len(tasks)
'''
class Solution:
def leastInterval(self, tasks: List[str], n: int) -> int:
if not task... | """
need to be very calm to solve this kind of problem
should never confuse yourself, keep clear mind
there is only 2 cases:
1. there is idle: using Counter to solve this case
2. there is no idle: len(tasks)
"""
class Solution:
def least_interval(self, tasks: List[str], n: int) -> int:
if not ta... |
print ("Hello \
world")
# Backslash(\) is a special character that creates whitespace
| print('Hello world') |
s = 'nothyp_onan@'
l = [1,2,3,4,5,6,7,8,9]
print(s[::-1])
print(l[::-1])
print(reversed(l))
l1 = l.reverse
print(l1) | s = 'nothyp_onan@'
l = [1, 2, 3, 4, 5, 6, 7, 8, 9]
print(s[::-1])
print(l[::-1])
print(reversed(l))
l1 = l.reverse
print(l1) |
class BaseContest(object):
'''BaseContest is an abstract class for contest-specific modifications to
Marathoner.
'''
def __init__(self, project):
self.project = project
self.maximize = project.maximize
def extract_score(self, visualizer_stdout, solution_stderr):
'''Extract r... | class Basecontest(object):
"""BaseContest is an abstract class for contest-specific modifications to
Marathoner.
"""
def __init__(self, project):
self.project = project
self.maximize = project.maximize
def extract_score(self, visualizer_stdout, solution_stderr):
"""Extract ... |
def slices(series: str, length: int) -> list[str]:
size = len(series)
if length > size or length < 1:
raise ValueError("Invalid Input")
return [series[i:i + length] for i in range(size - length + 1)]
| def slices(series: str, length: int) -> list[str]:
size = len(series)
if length > size or length < 1:
raise value_error('Invalid Input')
return [series[i:i + length] for i in range(size - length + 1)] |
#!/usr/bin/env python3
input = '52554437147555553177771524418267843219182859995942215316362429449983637161192948458385799435625432472399695557917723926815678834498379821192395363253412635244153971238243584678919637629487233277745457158515424298321191791399144715235153322473174417191845568913621792673683254866423766856... | input = '52554437147555553177771524418267843219182859995942215316362429449983637161192948458385799435625432472399695557917723926815678834498379821192395363253412635244153971238243584678919637629487233277745457158515424298321191791399144715235153322473174417191845568913621792673683254866423766856577596238768549587216365... |
#Time Complexity: O(n)
#Space Complexity: O(1)
#Speed: 84.65%
#Memory: 84.34%
class Solution:
def evalRPN(self, tokens: List[str]) -> int:
stack = []
for token in tokens:
if token.isdigit() or token[1:].isdigit():
stack.append(int(token))
else:
... | class Solution:
def eval_rpn(self, tokens: List[str]) -> int:
stack = []
for token in tokens:
if token.isdigit() or token[1:].isdigit():
stack.append(int(token))
else:
y = stack.pop()
x = stack.pop()
if token ==... |
#
# PySNMP MIB module SNA-SDLC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SNA-SDLC-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 16:52:15 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019,... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_constraint, constraints_union, value_size_constraint, single_value_constraint) ... |
class MyWorkflow(object):
def __init__(self):
pass
def step3(self, session_time = None):
print("Step3 of session {0}".format(session_time))
| class Myworkflow(object):
def __init__(self):
pass
def step3(self, session_time=None):
print('Step3 of session {0}'.format(session_time)) |
#Criando o teste de convergencia 2 (Criterio de Sessenfeld):
def convergencia_2(matriz, num):
print('\n\nCriterio de Sessenfeld:')
beta = list()
for i in range(0, num):
beta.append(1)
for l in range(0, num):
soma = 0;
for c in range(0, dimensao):
if c != l:
soma = soma + (math.fabs(mat... | def convergencia_2(matriz, num):
print('\n\nCriterio de Sessenfeld:')
beta = list()
for i in range(0, num):
beta.append(1)
for l in range(0, num):
soma = 0
for c in range(0, dimensao):
if c != l:
soma = soma + math.fabs(matriz[l][c]) * beta[c]
... |
def flatten(myList):
newList = []
for item in myList:
if type(item) == list:
newList.extend(flatten(item))
else:
newList.append(item)
return newList
def main():
myList1 = [1,2,3,[1,2],5,[3,4,5,6,7]]
print(flatten(myList1))
myList2 = [1,[2,[3,[4,[5,[6,[7,[... | def flatten(myList):
new_list = []
for item in myList:
if type(item) == list:
newList.extend(flatten(item))
else:
newList.append(item)
return newList
def main():
my_list1 = [1, 2, 3, [1, 2], 5, [3, 4, 5, 6, 7]]
print(flatten(myList1))
my_list2 = [1, [2, [... |
#
# This file is part of the profilerTools suite (see
# https://github.com/mssm-labmmol/profiler).
#
# Copyright (c) 2020 mssm-labmmol
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software withou... | class Cmdlineopts(object):
n_procs = 1
traj_files = []
stp_files = []
wei_files = []
ref_files = []
input_file = ''
out_prefix = 'profopt'
dihspec_files = None
debug_emm = False
class Optopts(object):
n_tors = 1
b_opt_phase = False
opt_tors = [1, 2, 3, 4, 5, 6]
lj_ma... |
class Solution:
def diagonalSum(self, mat: List[List[int]]) -> int:
x=[]
for i,j in enumerate(mat):
x.append(j[i])
x.append(j[len(mat)-(i+1)])
if len(mat)%2==0:
return sum(x)
else:
y=mat[len(mat)//2]
z=y[len(mat)//2]
... | class Solution:
def diagonal_sum(self, mat: List[List[int]]) -> int:
x = []
for (i, j) in enumerate(mat):
x.append(j[i])
x.append(j[len(mat) - (i + 1)])
if len(mat) % 2 == 0:
return sum(x)
else:
y = mat[len(mat) // 2]
z = y... |
class Node:
def __init__(self, data) -> None:
self.data = data
self.right = self.down = None
class LinkedList:
def __init__(self) -> None:
self.head = self.rear = None
def insert(self, item, location):
temp = Node(item)
if self.rear == None:
... | class Node:
def __init__(self, data) -> None:
self.data = data
self.right = self.down = None
class Linkedlist:
def __init__(self) -> None:
self.head = self.rear = None
def insert(self, item, location):
temp = node(item)
if self.rear == None:
self.head ... |
#continue dan break bisa digunakan di For-Loop dan While-Loop
#Belajar Continue --> Men-skip proses looping sehingga melanjutkan looping selanjutnya
#definisi menurut aris --> digunakan utk menolak data range
for i in range(1,10):
if (i) % 2 == 1: #artinya ganjil
continue #statment TRUE di atas a... | for i in range(1, 10):
if i % 2 == 1:
continue
print(i)
for io in range(1, 10):
if io % 2 == 0:
continue
print(io)
print('====BREAK====')
for io in range(1, 100):
if io % 45 == 0:
break
print(io)
while True:
data = input('Masukkan pengulangan :')
if data == 'x':
... |
# define a function that finds the truth by shifting the letter by the specified amount
def lassoLetter( letter, shiftAmount ):
# invoke the ord function to translate the letter to its ASCII code
# and save it to the variable called letterCode
letterCode = ord(letter.lower())
# the ASCII number re... | def lasso_letter(letter, shiftAmount):
letter_code = ord(letter.lower())
a_ascii = ord('a')
alphabet_size = 26
true_letter_code = aAscii + (letterCode - aAscii + shiftAmount) % alphabetSize
decoded_letter = chr(trueLetterCode)
return decodedLetter
def lasso_word(word, shiftAmount):
decoded_... |
t=int(input())
if t>=1:
print("bigger than 1")
else:
print("smaller than 1") | t = int(input())
if t >= 1:
print('bigger than 1')
else:
print('smaller than 1') |
# Copyright 2015 Jason T Clark
#
# 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 pre_compile(S, E, N, D, M, O, R, Y):
return D + 10 * N + 100 * E + 1000 * S + (E + 10 * R + 100 * O + 1000 * M) == Y + 10 * E + 100 * N + 1000 * O + 10000 * M
lambda S, E, N, D, M, O, R, Y: D + 10 * N + 100 * E + 1000 * S + (E + 10 * R + 100 * O + 1000 * M) == Y + 10 * E + 100 * N + 1000 * O + 10000 * M |
for i in range(1,101):
if(i%3==0 and i%5==0):
print("FizzBuzz")
if(i%3==0):
print("Fizz")
if(i%5==0):
print("Buzz")
else:
print(i) | for i in range(1, 101):
if i % 3 == 0 and i % 5 == 0:
print('FizzBuzz')
if i % 3 == 0:
print('Fizz')
if i % 5 == 0:
print('Buzz')
else:
print(i) |
if __name__ == '__main__':
x = int(input())
y = int(input())
z = int(input())
n = int(input())
l = []
for i in range(x+1):
for j in range(y+1):
for k in range(z+1):
elem = []
elem.append(i)
elem.append(j)
elem.... | if __name__ == '__main__':
x = int(input())
y = int(input())
z = int(input())
n = int(input())
l = []
for i in range(x + 1):
for j in range(y + 1):
for k in range(z + 1):
elem = []
elem.append(i)
elem.append(j)
e... |
# Created by MechAviv
# Kinesis Introduction
# Map ID :: 101020400
# East Forest :: Magician Association
KINESIS = 1531000
NERO = 1531003
THREE_MOON = 1531004
sm.setNpcOverrideBoxChat(NERO)
sm.sendNext("#face1#Good job! See, you're getting faster every time.")
sm.completeQuest(parentID)
sm.giveExp(11500)
| kinesis = 1531000
nero = 1531003
three_moon = 1531004
sm.setNpcOverrideBoxChat(NERO)
sm.sendNext("#face1#Good job! See, you're getting faster every time.")
sm.completeQuest(parentID)
sm.giveExp(11500) |
kwargs = {"a": 1, "b": 2, "c": 3}
print(kwargs.pop("d"))
| kwargs = {'a': 1, 'b': 2, 'c': 3}
print(kwargs.pop('d')) |
print("Printing n fibonacci numbers")
i=1
x=0
y=1
p=int(input("How many numbers would you like to have displayed: "))
while(i<=p):
print(x,end=' ')
s=x+y
x=y
y=s
i=i+1
print("\n\nEnd of Program\n")
print("Press \"Enter key\" to exit")
u=input()
| print('Printing n fibonacci numbers')
i = 1
x = 0
y = 1
p = int(input('How many numbers would you like to have displayed: '))
while i <= p:
print(x, end=' ')
s = x + y
x = y
y = s
i = i + 1
print('\n\nEnd of Program\n')
print('Press "Enter key" to exit')
u = input() |
# Write your solutions for 1.5 here!
class Superheros:
def __init__(self, name,superpower, strengh):
self.name = name
self.superpower = superpower
self.strengh = strengh
def name_strengh(self):
print("the name of the superhero is: " + self.name +",his strengh level is: "+str(self.strengh))
def save_civilian(... | class Superheros:
def __init__(self, name, superpower, strengh):
self.name = name
self.superpower = superpower
self.strengh = strengh
def name_strengh(self):
print('the name of the superhero is: ' + self.name + ',his strengh level is: ' + str(self.strengh))
def save_civili... |
A=[[1,2, 8], [3, 7,4]]
B=[[5,6, 9], [7,6 ,0]]
c=[]
for i in range(len(A)): #range of len gives me indecesc.
c.append([])
for j in range(len(A[i])):
sum = A[i][j]+B[i][j]
c[i].append(sum)
print(c)
# for i in range(len(A)): #range of len gives me indeces
# for j in range(len(A[i])): #again ind... | a = [[1, 2, 8], [3, 7, 4]]
b = [[5, 6, 9], [7, 6, 0]]
c = []
for i in range(len(A)):
c.append([])
for j in range(len(A[i])):
sum = A[i][j] + B[i][j]
c[i].append(sum)
print(c) |
# output shape openpose keypoints for body, hands, and face
body_keypoints_num = 25
left_hand_keyp_num = 21
right_hand_keyp_num = 21
face_keyp_num = 51
face_contour_keyp_num = 17
| body_keypoints_num = 25
left_hand_keyp_num = 21
right_hand_keyp_num = 21
face_keyp_num = 51
face_contour_keyp_num = 17 |
class Hello:
def __init__(self, name):
self.name = name
def say(self):
print('Hello!,', self.name) | class Hello:
def __init__(self, name):
self.name = name
def say(self):
print('Hello!,', self.name) |
class A:
def __init__(self):
super().__init__()
print("A")
class B(A):
def __init__(self):
super().__init__()
print("B")
class C:
def __init__(self):
super().__init__()
print("C")
class D(B, C):
def __init__(self):
super().__init__()
... | class A:
def __init__(self):
super().__init__()
print('A')
class B(A):
def __init__(self):
super().__init__()
print('B')
class C:
def __init__(self):
super().__init__()
print('C')
class D(B, C):
def __init__(self):
super().__init__()
... |
class ServiceError(Exception):
pass
class LicenceError(Exception):
pass
class AccountError(Exception):
pass
class RateLimited(Exception):
pass
codeToError = {
0: "There was an error contacting the ProfanityBlocker service. Please try again later.",
104: "There was an error with your licence ... | class Serviceerror(Exception):
pass
class Licenceerror(Exception):
pass
class Accounterror(Exception):
pass
class Ratelimited(Exception):
pass
code_to_error = {0: 'There was an error contacting the ProfanityBlocker service. Please try again later.', 104: 'There was an error with your licence for Prof... |
with open("../pokemon_type_relations.csv", "r") as reader:
header = reader.readline().split(",") # Read header
while True:
line = reader.readline()
if not line:
break
line = line.split(",")
attacker = line[0]
weak = []
... | with open('../pokemon_type_relations.csv', 'r') as reader:
header = reader.readline().split(',')
while True:
line = reader.readline()
if not line:
break
line = line.split(',')
attacker = line[0]
weak = []
strong = []
immune = []
for i i... |
N = int(input())
vals1 = [int(a) for a in input().split()]
vals2 = [int(a) for a in input().split()]
total = 0
for i in range(N):
h1, h2 = vals1[i], vals1[i + 1]
width = vals2[i]
h_dif = abs(h1 - h2)
min_h = min(h1, h2)
total += min_h * width
total += (h_dif * width) / 2
print(total) | n = int(input())
vals1 = [int(a) for a in input().split()]
vals2 = [int(a) for a in input().split()]
total = 0
for i in range(N):
(h1, h2) = (vals1[i], vals1[i + 1])
width = vals2[i]
h_dif = abs(h1 - h2)
min_h = min(h1, h2)
total += min_h * width
total += h_dif * width / 2
print(total) |
WIDTH = 16
HEIGHT = 32
FIRST = 0
LAST = 255
_FONT = \
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'\
b'\x0... | width = 16
height = 32
first = 0
last = 255
_font = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x... |
record_list=[]
y=int(input('Enter no.of records to be entered'))
for x in range(1,y+1,1):
name=input('Enter name: ')
roll_num=int(input("Enter roll number: "))
sub=input("Enter subject: ")
score=float(input("Enter score: "))
record_list.append([name,roll_num,sub,score])
print(record_list)
q=1
f... | record_list = []
y = int(input('Enter no.of records to be entered'))
for x in range(1, y + 1, 1):
name = input('Enter name: ')
roll_num = int(input('Enter roll number: '))
sub = input('Enter subject: ')
score = float(input('Enter score: '))
record_list.append([name, roll_num, sub, score])
print(reco... |
# Copyright 2020 The Monogon Project Authors.
#
# SPDX-License-Identifier: Apache-2.0
#
# 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
... | load('@bazel_gazelle//:deps.bzl', 'go_repository')
load('@io_bazel_rules_go//go:def.bzl', 'GoLibrary', 'go_context', 'go_library')
def _bindata_impl(ctx):
out = ctx.actions.declare_file('bindata.go')
arguments = ctx.actions.args()
arguments.add_all(['-pkg', ctx.attr.package, '-prefix', ctx.label.workspace_... |
names = [
'John',
'Mary',
'Joe',
'Matt',
'David',
'Matt',
'John'
]
results = []
for name in names:
if name in results:
continue
results.append(name)
print(results) | names = ['John', 'Mary', 'Joe', 'Matt', 'David', 'Matt', 'John']
results = []
for name in names:
if name in results:
continue
results.append(name)
print(results) |
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
DEPS = [
'chromium',
'chromium_android',
'recipe_engine/path',
]
def RunSteps(api):
api.chromium.set_config('chromium')
api.chromium_android.stac... | deps = ['chromium', 'chromium_android', 'recipe_engine/path']
def run_steps(api):
api.chromium.set_config('chromium')
api.chromium_android.stackwalker(api.path['checkout'], [api.chromium.output_dir.join('lib.unstripped', 'libchrome.so')])
def gen_tests(api):
yield api.test('basic') |
# For Keystone Engine. AUTO-GENERATED FILE, DO NOT EDIT [systemz_const.py]
KS_ERR_ASM_SYSTEMZ_INVALIDOPERAND = 512
KS_ERR_ASM_SYSTEMZ_MISSINGFEATURE = 513
KS_ERR_ASM_SYSTEMZ_MNEMONICFAIL = 514
| ks_err_asm_systemz_invalidoperand = 512
ks_err_asm_systemz_missingfeature = 513
ks_err_asm_systemz_mnemonicfail = 514 |
# 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 to build experimental directory.
{
'targets': [
{
'target_name': 'experimental',
'type': 'static_library',
'include_dirs': [
'../include/config'... | {'targets': [{'target_name': 'experimental', 'type': 'static_library', 'include_dirs': ['../include/config', '../include/core'], 'sources': ['../experimental/SkSetPoly3To3.cpp', '../experimental/SkSetPoly3To3_A.cpp', '../experimental/SkSetPoly3To3_D.cpp'], 'direct_dependent_settings': {'include_dirs': ['../experimental... |
class NodeCapacity:
def __init__(self, json):
self.cpu = json['cpu']
self.memory = self.__convert_mem_str_to_int__(json['memory'])
self.pods = json['pods']
def __convert_mem_str_to_int__(self, mem_str):
''' unit of retrurned value is Mi '''
value = float(mem_str[0:-2])
... | class Nodecapacity:
def __init__(self, json):
self.cpu = json['cpu']
self.memory = self.__convert_mem_str_to_int__(json['memory'])
self.pods = json['pods']
def __convert_mem_str_to_int__(self, mem_str):
""" unit of retrurned value is Mi """
value = float(mem_str[0:-2])
... |
class nloptSolver( optwSolver ):
def solve( self ):
algorithm = solver[6:]
if( algorithm == "" or algorithm == "MMA" ):
#this is the default
opt = nlopt.opt( nlopt.LD_MMA, self.n )
elif( algorithm == "SLSQP" ):
opt = nlopt.opt( nlopt.LD_SLSQP, self.n )
... | class Nloptsolver(optwSolver):
def solve(self):
algorithm = solver[6:]
if algorithm == '' or algorithm == 'MMA':
opt = nlopt.opt(nlopt.LD_MMA, self.n)
elif algorithm == 'SLSQP':
opt = nlopt.opt(nlopt.LD_SLSQP, self.n)
elif algorithm == 'AUGLAG':
o... |
class Solution:
def trap(self, height: List[int]) -> int:
res = 0
# build memos
max_height_left = [0] * len(height)
max_height_left[0] = height[0]
for i in range(1, len(height)):
max_height_left[i] = max(max_height_left[i-1], height[i])
max_height_right = ... | class Solution:
def trap(self, height: List[int]) -> int:
res = 0
max_height_left = [0] * len(height)
max_height_left[0] = height[0]
for i in range(1, len(height)):
max_height_left[i] = max(max_height_left[i - 1], height[i])
max_height_right = [0] * len(height)
... |
'''
*
***
*****
*******
*********
*******
*****
***
*
'''
n = int(input())
i = 0
while i < (n//2) + 1:
j = 1
while j <= (n//2) - i:
print(' ', end='')
j += 1
k = 0
while k <= i:
print('*', end='')
k += 1
l = i
while l >= 1:
print('*', ... | """
*
***
*****
*******
*********
*******
*****
***
*
"""
n = int(input())
i = 0
while i < n // 2 + 1:
j = 1
while j <= n // 2 - i:
print(' ', end='')
j += 1
k = 0
while k <= i:
print('*', end='')
k += 1
l = i
while l >= 1:
print('*', e... |
def take_List(li,Qu_st):
r=[]
for i in range(len(li)):
if(Qu_st in li[i] ):
r.append(li[i])
print(r)
li=['sser','ser','song']
q='ss'
take_List(li,q)
| def take__list(li, Qu_st):
r = []
for i in range(len(li)):
if Qu_st in li[i]:
r.append(li[i])
print(r)
li = ['sser', 'ser', 'song']
q = 'ss'
take__list(li, q) |
_base_ = "./ss_mlBCE_MaskFull_PredDouble_PBR05_woCenter_edgeLower_refinePM10_01_02MasterChefCan.py"
OUTPUT_DIR = "output/self6dpp/ssYCBV/ss_mlBCE_MaskFull_PredDouble_PBR05_woCenter_edgeLower_refinePM10/13_24Bowl"
DATASETS = dict(
TRAIN=("ycbv_024_bowl_train_real_aligned_Kuw",),
TRAIN2=("ycbv_024_bowl_train_pbr"... | _base_ = './ss_mlBCE_MaskFull_PredDouble_PBR05_woCenter_edgeLower_refinePM10_01_02MasterChefCan.py'
output_dir = 'output/self6dpp/ssYCBV/ss_mlBCE_MaskFull_PredDouble_PBR05_woCenter_edgeLower_refinePM10/13_24Bowl'
datasets = dict(TRAIN=('ycbv_024_bowl_train_real_aligned_Kuw',), TRAIN2=('ycbv_024_bowl_train_pbr',))
model... |
class Solution:
def isHappy(self, n: int) -> bool:
l = set()
while True:
s = 0
while n > 0:
s += (n % 10) ** 2
n = n // 10
if s == 1:
return True
if s in l:
return False
n = s
... | class Solution:
def is_happy(self, n: int) -> bool:
l = set()
while True:
s = 0
while n > 0:
s += (n % 10) ** 2
n = n // 10
if s == 1:
return True
if s in l:
return False
n = ... |
DATABASE_ENGINE = 'sqlite3'
SECRET_KEY = 'abcd123'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': './example.db',
}
}
INSTALLED_APPS = (
'django_bouncy',
)
BOUNCY_TOPIC_ARN = ['arn:aws:sns:us-east-1:250214102493:Demo_App_Unsubscribes']
TEST_RUNNER = 'django_n... | database_engine = 'sqlite3'
secret_key = 'abcd123'
databases = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': './example.db'}}
installed_apps = ('django_bouncy',)
bouncy_topic_arn = ['arn:aws:sns:us-east-1:250214102493:Demo_App_Unsubscribes']
test_runner = 'django_nose.NoseTestSuiteRunner'
nose_args = ['-... |
while 1:
a = int(input("please input a: "))
b = int(input("please input b: "))
print(a+b)
| while 1:
a = int(input('please input a: '))
b = int(input('please input b: '))
print(a + b) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.